diff options
Diffstat (limited to 'files/pt-pt/mozilla')
129 files changed, 17049 insertions, 0 deletions
diff --git a/files/pt-pt/mozilla/add-ons/amo/index.html b/files/pt-pt/mozilla/add-ons/amo/index.html new file mode 100644 index 0000000000..3857ed65ca --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/amo/index.html @@ -0,0 +1,9 @@ +--- +title: AMO +slug: Mozilla/Add-ons/AMO +tags: + - NeedsTranslation + - TopicStub +translation_of: Mozilla/Add-ons/AMO +--- +<p>Content to be added.</p> diff --git a/files/pt-pt/mozilla/add-ons/amo/policy/em_destaque/index.html b/files/pt-pt/mozilla/add-ons/amo/policy/em_destaque/index.html new file mode 100644 index 0000000000..71eafffe67 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/amo/policy/em_destaque/index.html @@ -0,0 +1,85 @@ +--- +title: AMO - Políticas de Extensões em Destaque +slug: Mozilla/Add-ons/AMO/Policy/Em_destaque +translation_of: Mozilla/Add-ons/AMO/Policy/Featured +--- +<p>{{AddonSidebar}}</p> + +<p>Featured add-ons are top-quality extensions and themes highlighted on <a href="https://addons.mozilla.org/en-US/firefox/extensions/?sort=featured">AMO</a>, Firefox's Add-ons Manager, and across other Mozilla websites. These add-ons showcase the power of Firefox customization and are useful to a wide audience.</p> + +<p>Featured extensions are chosen by the Featured Extensions Advisory Board, a small group of extension developers and fans from the Mozilla community who have volunteered to review and vote on nominations.</p> + +<p>Todos os meses, são escolhidas novas <a href="https://addons.mozilla.org/pt-PT/firefox/search/?featured=true&type=extension">extensões em destaque</a>.</p> + +<h3 id="Critérios_para_Extensões_em_Destaque">Critérios para Extensões em Destaque</h3> + +<p>Before nominating an extension to be featured, please ensure it meets the following criteria:</p> + +<ol> + <li>The extension must have a complete and informative listing on AMO. This means: + <ul> + <li>a 64-pixel custom icon</li> + <li>a clear and concise name (no lengthy keywords)</li> + <li>a clear and concise summary of the extension's functionality</li> + <li>detailed description and privacy policy, if applicable</li> + <li>updated screenshots of the extension's functionality</li> + </ul> + </li> + <li>The extension must have excellent user reviews and any problems or support requests must be promptly addressed by the developer.</li> + <li>The extension must have a minimum of 500 users.</li> + <li>The extension must be built with <a href="https://developer.mozilla.org/Add-ons/WebExtensions">WebExtensions</a> API.</li> + <li>The extension must be compatible with the latest release of Firefox.</li> + <li><strong>Most importantly</strong>, the extension must have wide consumer appeal to Firefox's users and be outstanding in nearly every way: user experience, performance, security, and usefulness or entertainment value.</li> +</ol> + +<h3 id="Painel_de_Descoberta">Painel de Descoberta</h3> + +<p>The Get Add-ons section (also referred to as the Discovery Pane) in about:addons serves a distinct editorial function: it is a tightly curated list of extensions and themes selected by Mozilla staff to address an array of the most common user needs (e.g. ad blockers, screenshot tools, etc.). The Discovery Pane is primarily intended to introduce extensions to Firefox users who have limited experience with browser customization. As such, we only select extensions that meet the highest standards of functionality, user experience, and Firefox compatibility.</p> + +<p>Only content that is part of AMO’s <a class="external text" href="https://addons.mozilla.org/en-US/firefox/search/?featured=true&type=extension" rel="nofollow">Featured Extensions collection</a> will be considered for the Discovery Pane; please note that featured content must meet certain <a href="https://wiki.mozilla.org/AMO/Featured_Board_Process#Add-on_Requirements" title="AMO/Featured Board Process">criteria</a>.</p> + +<p>Discovery Pane content is updated monthly, though some highly popular extensions may remain on the page for an indefinite period of time.</p> + +<p>If you’d like to nominate a great extensions for consideration in the Discovery Pane, please send us a link to the add-on on AMO to <strong>amo-featured@mozilla.org</strong> and we’ll add your nomination to the editorial review queue. There’s no need to mention you’re nominating add-ons specifically for the Discovery Pane, but feel free to note that if you like.</p> + +<h3 id="Nomear_um_Extra">Nomear um Extra</h3> + +<p>If you wish to nominate an extension to be featured and it meets the criteria above, send an email to <a href="mailto:amo-featured@mozilla.org">amo-featured@mozilla.org</a> with:</p> + +<ul> + <li>the extension name, URL, and whether you are its developer</li> + <li>a short explanation of why the extension has wide appeal and should be featured</li> + <li>optionally, links to any external reviews or articles mentioning the extension</li> +</ul> + +<p>Extension nominations are reviewed by the Advisory Board once a month. Common reasons for rejection include lacking wide appeal to consumers, a suboptimal user experience, quality or security issues, incompatibility, and similarity to another featured extension. Rejected extension cannot be re-nominated within 3 months.</p> + +<h3 id="Rodar_Extensões_em_Destaque">Rodar Extensões em Destaque</h3> + +<p>Mozilla and the Featured Extensions Advisory Board regularly evaluate and rotate out featured extensions. Some of the most common reasons for extensions being removed from the featured list are:</p> + +<ul> + <li>Lack of growth — Extensions that are featured typically experience a substantial gain in both downloads and active users. If an extension is not demonstrating growth in any substantial way, that's a good indicator the extension may not be very useful to our users.</li> + <li>Negative reviews — Featured extensions should have a great experience and very few bugs, so extensions with many negative reviews may be reconsidered.</li> + <li>Incompatibility with upcoming Firefox versions — Featured extensions are expected to be compatible with stable and beta versions of Firefox. Extensions not yet compatible with a Beta version of Firefox four weeks before its expected release will lose their featured status.</li> +</ul> + +<h3 id="Aderir_ao_Conselho_Consultivo_de_Extensões_em_Destaque">Aderir ao Conselho Consultivo de Extensões em Destaque</h3> + +<p>Every six months a new Advisory Board is chosen based on applications from the add-ons community. Members must:</p> + +<ul> + <li>be active members of the add-ons community, whether as a developer, evangelist, or fan</li> + <li>commit to trying all the nominations submitted, giving their feedback, and casting their votes every month</li> + <li>abstain from voting on extensions that they have any business or personal affiliations with, as well as direct competitors of any such extensions</li> +</ul> + +<p>Members of the Mozilla Add-ons team may veto any extension's selection because of security, privacy, compatibility, or any other reason, but in general it is up to the Board to select extensions to feature.</p> + +<p>This featured policy only applies to the addons.mozilla.org global list of featured extensions. Extensions featured in other locations are often pulled from this list, but Mozilla may feature any extension in other locations without the Board's consent. Additionally, locale-specific features override the global defaults, so if a locale has opted to select its own features, some or all of the global features may not appear in that locale.</p> + +<p>Follow the <a href="http://blog.mozilla.com/addons">Add-ons Blog</a> or <a href="http://www.twitter.com/mozamo">@mozamo</a> on Twitter to learn when the next application period opens.</p> + +<p><em>Última atualização: 12 de abril de 2018</em></p> + +<p><span class="comment seoSummary">How up-and-coming add-ons become featured and what's involved in the process. </span></p> diff --git a/files/pt-pt/mozilla/add-ons/amo/policy/index.html b/files/pt-pt/mozilla/add-ons/amo/policy/index.html new file mode 100644 index 0000000000..2dd894f5bd --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/amo/policy/index.html @@ -0,0 +1,19 @@ +--- +title: Políticas AMO +slug: Mozilla/Add-ons/AMO/Policy +tags: + - NeedsTranslation + - TopicStub +translation_of: Mozilla/Add-ons/AMO/Policy +--- +<p>Mozilla está empenhada em garantir uma grande experiência com os extras para os nossos utilizadores e desenvolvedores. Por favor, reveja as políticas abaixo antes de submeter o seu extra.</p> + +<dl> + <dd></dd><dt><a href="/Mozilla/Add-ons/AMO/Policy/Agreement">Developer Agreement</a></dt> +<dd>Effective January 5, 2016</dd> <dt><a href="/Mozilla/Add-ons/AMO/Policy/Reviews">Review Process</a></dt> +<dd>Add-ons extend the core capabilities of Firefox, allowing users to modify and personalize their Web experience. A healthy add-on ecosystem, built on trust, is vital for developers to be successful and users to feel safe making Firefox their own. For these reasons, Mozilla requires all add-ons to comply with the following set of policies on acceptable practices. The below is not intended to serve as legal advice, nor is it intended to serve as a comprehensive list of terms to include in your add-on’s privacy policy.</dd> <dt><a href="/Mozilla/Add-ons/AMO/Policy/Featured">Featured Add-ons</a></dt> +<dd>How up-and-coming add-ons become featured and what's involved in the process. </dd> <strong><a href="/en-US/Add-ons#Contact_us">Contacting us</a></strong> + + <p> How to get in touch with us regarding these policies or your add-on.</p> + +</dl> diff --git a/files/pt-pt/mozilla/add-ons/amo/policy/revisões/index.html b/files/pt-pt/mozilla/add-ons/amo/policy/revisões/index.html new file mode 100644 index 0000000000..96e6d880f5 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/amo/policy/revisões/index.html @@ -0,0 +1,160 @@ +--- +title: Políticas de Extras +slug: Mozilla/Add-ons/AMO/Policy/Revisões +tags: + - Extras + - Política de Revisão +translation_of: Mozilla/Add-ons/AMO/Policy/Reviews +--- +<p>{{AddonSidebar}}</p> + +<p>Os extras estendem os recursos principais do Firefox, permitindo que os utilizadores modifiquem e personalizem a sua experiência na Web. Um ecossistema de extras saudável, baseado na confiança, é vital para que os programadores sejam bem-sucedidos e os utilizadores se sintam seguros, tornando o Firefox deles próprio. Por estes motivos, a Mozilla requer que todos os extras estejam em conformidade com o seguinte conjunto de políticas sobre as práticas aceitáveis. O abaixo, não se destina para servir como aconselhamento jurídico, nem pretende servir como uma lista abrangente de termos para incluir na política de privacidade do seu extra.</p> + +<p>Todos os extras estão sujeitos a estas políticas, independentemente de como eles são distribuídos. Os extras que não estejam em conformidade com estas políticas podem estar sujeitos à rejeição ou desativação pela Mozilla.</p> + +<h2 id="Sem_Surpresas">Sem Surpresas</h2> + +<p>As surpresas podem ser apropriadas em muitas situações, mas não são bem-vindas quando a segurança, a privacidade e o controlo do utilizador estão em jogo. É extremamente importante ser o mais transparente possível quando submeter um extra. Os utilizadores deverão ser capazes de discernir facilmente qual é a funcionalidade do seu extra e não receber experiências inesperadas do utilizador depois de o instalal.</p> + +<h3 id="Funcionalidades_Inesperadas">Funcionalidades Inesperadas</h3> + +<p>“Funcionalidades" inesperadas são aquelas que não estão relacionadas com a função principal do extra e provavelmente não são do nome do extra ou da descrição esperada por um utilizador que está a instalar esse extra.</p> + +<p>Um extra deveria incluir qualquer funcionalidade inesperada que se enquadre numa das seguintes categorias:</p> + +<ul> + <li>Potencialmente compromete a privacidade ou a segurança do utilizador (tal como enviar dados para terceiros)</li> + <li>Altera as definições predefinidas, tal como o novo separador, a página inicial ou o motor de pesquisa</li> + <li>Faz alterações inesperadas no navegador ou no conteúdo da Web</li> + <li>Inclui recursos ou funcionalidades não relacionadas com as funções principais do extra</li> +</ul> + +<p>Então, a(s) funcionalidade(s) "inesperada(s)" devem seguir todos os seguintes requisitos:</p> + +<ul> + <li>A descrição do extra deve indicar claramente quais as alterações que o extra efetua.</li> + <li>Todas as alterações devem ser "opcionais", o que significa que o utilziador deve executar uma ação não predefinida para aprovar a alteração. As alterações que solicitam aos utilizadores por meio do sistema de permissões não requerem uma opção adicional.</li> + <li>A interface de opções deve declarar claramente o nome do extra que está a solicitar a alteração.</li> +</ul> + +<h2 id="Conteúdo">Conteúdo</h2> + +<p>Os extras que utilizarem as marcas registadas da Mozilla devem obedecer à <a href="https://www.mozilla.org/en-US/foundation/trademarks/policy/">Política de Marcas Registadas da Mozilla</a>. Se o extra utiliza “Firefox” no seu nome, o padrão de nomeação que o extra deve seguir é “<nome do Extra> por Firefox”.</p> + +<p>Além disso, os extras listados em <a href="https://addons.mozilla.org/pt-PT/firefox/">Extras para o Firefox</a> (AMO) devem seguir as seguintes políticas:</p> + +<ul> + <li>All add-ons submitted for listing on AMO are subject to Mozilla’s <a href="https://www.mozilla.org/en-US/about/legal/acceptable-use/">Conditions of Use</a>.</li> + <li>Add-ons must disclose when payment is required to enable any functionality.</li> + <li>Any add-ons, or add-on content, hosted on Mozilla site(s) must conform to the laws of the United States.</li> + <li>The add-on listing should have an easy-to-read description about everything it does, and any information it collects. Please consult our best practices guide for <a href="https://developer.mozilla.org/en-US/Add-ons/Listing">creating an appealing listing</a>.</li> + <li>Add-ons that are intended for internal or private use, or for distribution testing may not be listed on AMO. Such add-ons may be <a href="https://developer.mozilla.org/en-US/Add-ons/Distribution#Self-distributed_(unlisted)_versions">uploaded for self-distribution</a> instead.</li> + <li>If the add-on is a fork of another add-on, the name must clearly distinguish it from the original and provide a significant difference in functionality and/or code.</li> +</ul> + +<h2 id="Linhas_Diretrizes_de_Submissão">Linhas Diretrizes de Submissão</h2> + +<p>Os extras devem funcionar apenas conforme o descrito e devem fornecer uma experiência de utilizador atraente. Com base na descrição do extra, um utilizador deve ser capaz de entender e utilizar os recursos do extra sem exigir conhecimento especializado. Dicas sobre como criar uma boa experiência do utilziador para o seu extra podem ser encontradas <a href="/pt-PT/Add-ons/WebExtensions/As_melhores_praticas_de_experiencia_do_utilizador">aqui</a>.</p> + +<p>During review, the add-on undergoes basic testing in addition to code review. To facilitate the functional testing, the add-on author must provide testing information and, if applicable, testing credentials required to use the add-on if an account is needed for any part of the add-on’s functionality.</p> + +<p>Issues brought up during review must be addressed using best efforts. If corrections have been requested, the new version should not contain unrelated changes, as this complicates the review process and can lead to further rejections.</p> + +<h3 id="Submissão_de_Código_Fonte">Submissão de Código Fonte</h3> + +<p>Add-ons may contain transpiled, obfuscated, minified or otherwise machine-generated code, but Mozilla needs to review a copy of the human-readable source code. The author must provide this information to Mozilla during submission as well as instructions on how to reproduce the build.</p> + +<p>The provided source code will be reviewed by an administrator and will not be redistributed in any way. The code will only be used for the purpose of reviewing the add-on. Failure to provide this information will result in rejection.</p> + +<p>Please read our <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/Source_Code_Submission">Source Code Submission guidelines</a> to avoid unexpected rejections.</p> + +<h2 id="Práticas_de_Desenvolvimento">Práticas de Desenvolvimento</h2> + +<p>In general, developers are free to maintain their add-ons in the manner they choose. However, in order to maintain appropriate data security and effectively review code, we do have certain technical requirements that all add-ons must meet. In particular, potentially dangerous APIs may only be used in ways that are demonstrably safe, and code within add-ons that cannot be verified as behaving safely and correctly may need to be refactored.</p> + +<p>While any code, method or practice in a submitted add-on is subject to review and rejection, the following requirements are of particular importance:</p> + +<ul> + <li>Add-ons must only request those permissions that are necessary for function</li> + <li>Add-ons must be self-contained and not load remote code for execution</li> + <li>Add-ons must use encrypted channels for sending sensitive user data</li> + <li>Add-ons should avoid including duplicate or unnecessary files</li> + <li>Add-on code must be written in a way that is reviewable and understandable. Reviewers may ask you to refactor parts of the code if it is not reviewable.</li> + <li>Add-ons must not negatively impact the performance or stability of Firefox.</li> + <li>Only release versions of third-party libraries and/or frameworks may be included with an add-on. Modifications to these libraries/frameworks are not permitted.</li> +</ul> + +<h2 id="Gestão_Recolha_e_Divulgação_de_Dados">Gestão, Recolha e Divulgação de Dados</h2> + +<p>You must disclose how the add-on collects, uses, stores and shares user data in the privacy policy field on AMO. Mozilla expects that the add-on limits data collection whenever possible, in keeping with Mozilla’s <a href="https://www.mozilla.org/en-US/about/policy/lean-data/">Lean Data Practices</a> and Mozilla’s <a href="https://www.mozilla.org/en-US/privacy/principles/">Data Privacy Principles</a>, and uses the data only for the purpose for which it was originally collected.</p> + +<p>User data includes all information the add-on collects, regardless of the manner. It can be personal data actively provided by the user (such as a name or email address), technical data (such as operating system, build ID, version numbers, crash reports, activation, updates), and interaction or activity data (add-on activity data, visited URLs, console logs), including interactions with Firefox.</p> + +<p>The add-on’s privacy policy must be the full policy text; it cannot be a link to an externally hosted privacy policy. In addition, the privacy policy must:</p> + +<ul> + <li>be specific and exclusive to the add-on,</li> + <li>clearly describe the purpose of the data collection,</li> + <li>set forth the exact data to be collected,</li> + <li>address the add-on’s particular privacy properties.</li> +</ul> + +<p>A summary of this information must be included in the add-on’s listing description. Finally, you and your add-on must also comply with all applicable data privacy laws as well as any other laws that may apply to your specific add-on.</p> + +<h3 id="Interações_do_Utilizador_e_Dados_Técnicos">Interações do Utilizador e Dados Técnicos</h3> + +<ul> + <li>Users must be provided a clear way to control this data collection. The control mechanism must be shown during the installation process of the add-on.</li> + <li>Add-ons must only collect information about add-on performance and/or use.</li> + <li>Collecting ancillary information (e.g. any data not explicitly required for the add-on’s basic functionality) is prohibited.</li> +</ul> + +<h3 id="Cookies">Cookies</h3> + +<ul> + <li>If your add-on installs cookies, this must also be disclosed in the add-on’s privacy policy.</li> + <li>The add-on privacy policy must clearly express the placing and purposes of the cookie(s). It is highly recommended that you disclose the types of cookies being used.</li> + <li>Users must be provided an opportunity to refuse the storage of or access to cookies, and must be informed of the consequences of doing so (e.g., without a functional cookie, the add-on may not work).</li> + <li>Installing cookies that are not explicitly required for the add-on’s functionality is prohibited.</li> +</ul> + +<h3 id="Dados_Pessoais">Dados Pessoais</h3> + +<ul> + <li>If you are collecting any personal information, the users must provide affirmative consent (i.e., explicit opt-in from the user). It must be clear to the user that they give consent to the collection of personal data.</li> + <li>Collecting ancillary personal information (e.g., any data not explicitly required for the add-on’s basic functionality) is prohibited.</li> + <li>Any transmission of this type of data must use secure, encrypted connections.</li> +</ul> + +<h3 id="Protocolos_de_Privacidade_Adicionais">Protocolos de Privacidade Adicionais</h3> + +<ul> + <li>Leaking local or user-sensitive information to websites or other processes (e.g., using native messaging) is prohibited.</li> + <li>If the add-on uses native messaging, the privacy policy must clearly disclose which information is being exchanged with the native application. Data exchanged with the native application must be in accordance with our No Surprises policy.</li> + <li>HTTPS must be used for security and privacy-sensitive operations such as transmitting passwords or tokens.</li> + <li>Browsing data from private browsing sessions must not be stored.</li> + <li>Identity information must not be leaked to web content in private browsing sessions.</li> +</ul> + +<h2 id="Vulnerabilidades_de_Segurança">Vulnerabilidades de Segurança</h2> + +<p>Because add-ons run in an environment with elevated privileges relative to ordinary web pages, they present a very serious set of security considerations. They have the potential to open security holes not only in the add-ons themselves, but also in the browser, in web pages, and, in particularly distressing cases, the entire system the browser is running on.</p> + +<p>As a result, we take our security policies very seriously and apply them to all add-ons, whether hosted on AMO or not. We expect all add-ons to be secure and well-maintained in handling both their own data and their user’s data. They must also securely manage all of their interactions with the web, the browser and the operating system.</p> + +<h2 id="Monetização">Monetização</h2> + +<ul> + <li>Os mecanismos de monetização devem cumprir com as políticas na secção <em>Divulgação, Recolha e Gestão de Dados</em>. Em particular, um extra deve ser acompanhado de um mecanismo de controle de utilizador claro (e opção para dados pessoais) apresentado durante o processo de instalação ou atualização do extra. A recolha de informação auxiliar para monetização é proibida.</li> + <li>Um extra que injetar publicidade no conteúdo da página da Web deve identificar claramente o conteúdo injetado como originário do extra.</li> + <li>A inclusão de mineiros de criptomoedas ou funcionalidades similares num extra é proibida.</li> + <li>A modificação do conteúdo da Web ou a facilitação de redirecionamentos para incluir etiquetas de promoção de afiliados não é permitida. Por outro lado, a utilização da promoção de afiliação nos elementos da interface do utilizador claramente identificada como pertencentes ao extra é aceitável.</li> +</ul> + +<h2 id="Conformidade_e_Lista_de_Bloqueio">Conformidade e Lista de Bloqueio</h2> + +<p>Para os extras que não correspondem com estas políticas, a Mozilla pode rejeitar ou bloquear as versões afetadas ou extras completos, dependendo da extensão da sua não conformidade.</p> + +<p>Geralmente, a Mozilla tentará entrar em contacto com o(s) programador(es) do extra e fornecer um prazo razoável para que os problemas sejam corrigidos antes que um bloqueio seja implementado. Se um extra for considerado malicioso ou se os seus programadores tiverem se mostrado inalcançáveis ou não responderem, ou no caso de violações recorrentes, a inclusão na listagem de bloqueio ser imediata.</p> + +<p>A Mozilla reserva o direito de bloquear ou eliminar a conta do programador em addons.mozilla.org, evitando assim a utilização adicional do serviço.</p> diff --git a/files/pt-pt/mozilla/add-ons/crição_de_extensões_firefox_com_sistema_mozilla/index.html b/files/pt-pt/mozilla/add-ons/crição_de_extensões_firefox_com_sistema_mozilla/index.html new file mode 100644 index 0000000000..35a9c7fbe1 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/crição_de_extensões_firefox_com_sistema_mozilla/index.html @@ -0,0 +1,518 @@ +--- +title: >- + Criação de extensões personalizadas do Firefox com o sistema de criação da + Mozilla +slug: Mozilla/Add-ons/Crição_de_extensões_Firefox_com_Sistema_Mozilla +translation_of: >- + Archive/Add-ons/Creating_Custom_Firefox_Extensions_with_the_Mozilla_Build_System +--- +<p>{{AddonSidebar}}</p> + +<p>Existe uma <a href="/pt-PT/Add-ons" title="en/Extensions">abundância de material</a> na criação de extensões para Firefox. Todos estes documentos atualmente assumem, contudo, que está a desenvolver a sua extensão utilizando apena <a href="/en/JavaScript" title="en/JavaScript">JavaScript </a>e <a href="/en/XUL" title="en/XUL">XUL</a>. Para extenões complexas, poderá ser necessário criar componentes em C++ que proporcionam uma funcionalidade adicional. Os motivos pelos quais poderá querer incluir componentes C++ na sua extensão incluem:</p> + +<div class="m2"> +<div class="mrg"> +<div class="client" id="baseBody" style=""> +<div id="textContainer" style="DISPLAY: block;"> +<div id="FtxtWnd" style=""> +<div class="targetTxt"> </div> +</div> +</div> +</div> +</div> +</div> + +<ul> + <li>Need for high-performance beyond what can be delivered by JavaScript code.</li> + <li>Use of third-party libraries written in C or C++.</li> + <li>Use of Mozilla interfaces that are not exposed via <a href="/en/XPCOM" title="en/XPCOM">XPCOM</a> (e.g. <a href="/en/NSPR" title="en/NSPR">NSPR</a>).</li> +</ul> + +<div class="note"><strong>Note:</strong> With the modern JIT Javascript Engine in Gecko and <a href="/en/js-ctypes/js-ctypes_reference" title="js-ctypes reference">js-ctypes</a> more extension code can be written only in JavaScript than ever before. Please consider all of your options carefully before deciding to use native code (C++) in your extension. In addition, binary components need to be recompiled for every major Firefox release, which can be frustrating.</div> + +<p>This article describes how to set up the development environment for a large, complex Firefox extension with any or all of the above-mentioned requirements. I should also stress that you do <em>not</em> have to build Mozilla or use the Mozilla build system if you want to create C++ components for Mozilla. If you are just looking to create an <a href="/en/XPCOM" title="en/XPCOM">XPCOM</a> component or two, this is probably overkill, and you might want to take a look at <a class="external" href="http://www.iosart.com/firefox/xpcom/">this guide</a> instead. On the other hand, if you are an experienced developer or team, and you know that you are going to build a large, complex extension, you would do well to consider the approach described in this article.</p> + +<p>One final note: I’ve only tried these techniques inside Firefox, but they’ll probably work more or less unchanged on other Gecko-based platforms like Thunderbird or Seamonkey. If someone can confirm this and/or provide guidelines for what’s different, I’ll update the article to incorporate this information.</p> + +<h3 id="Bambi_Cruza-se_com_Mozilla">Bambi Cruza-se com Mozilla</h3> + +<p>None of this is for the faint of heart. In particular, the initial step involves building Mozilla, which is a huge - nay, gargantuan! - project. Many intelligent developers have been driven to the brink of insanity trying to build it for the first time. If you're not an experienced C++ developer, I wouldn’t even bother. Stick to JavaScript.</p> + +<h4 id="Nas_Plataformas_do_Windows">Nas Plataformas do Windows</h4> + +<p>The first time I built Mozilla I used <a href="/En/Developer_Guide/Build_Instructions/Windows_Prerequisites" title="En/Developer_Guide/Build_Instructions/Windows_Prerequisites">this guide</a>. I can’t even remember why anymore, but I got stuck in a number of places, and the whole affair ended up taking far longer than I originally expected. Much furniture was smashed, much hair torn out by the roots. Here’s a <a class="external" href="http://whereswalden.com/mozilla/msvcfree/">comprehensive looking guide</a> that’s gotten good reviews. Follow every step methodically and you’ll probably be alright. Focus on the fact that once you get the build working, it’ll probably work effortlessly from then on. Maybe.</p> + +<h4 id="Em_Outras_Plataformas">Em Outras Plataformas</h4> + +<p>On other platforms, namely Linux and MacOS, the process is much easier. All the tools for building are available built-in, and therefore all you have to do is run some commands in the terminal. You can find full instructions for almost any OS <a href="/En/Developer_Guide/Build_Instructions" title="En/Developer_Guide/Build_Instructions">here</a>.</p> + +<h3 id="Estruturar_o_Seu_Projeto">Estruturar o Seu Projeto</h3> + +<p>Mozilla includes a number of complex extensions that are integrated into its build process. It has thus been necessary to solve all of the issues involved in creating and registering XPCOM components, building JAR files and manifests, installing the lot into the Firefox <code>extensions/</code> directory and so forth. So it behooves us to piggyback on this infrastructure to build our extension.</p> + +<p>First of all, think of a catchy name for your extension and create a directory with that name under the <code>/mozilla/extensions/</code> directory. Use only lowercase letters. You should see a bunch of other directories (<code>inspector/</code>, <code>reporter/</code> and so forth) at the same level in the build tree.</p> + +<p>Note that before actually building anything, the Mozilla build system invokes a configuration process that generates the actual makefiles used for the build from makefile templates called <code>Makefile.in</code>. The actual makefiles tend to be very similar or identical to the templates, but the extra flexibility gained from having the makefiles generated dynamically is one of the things that makes the build system so powerful.</p> + +<h4 id="Anatomia_de_uma_Extensão_C_Simples">Anatomia de uma Extensão C++ Simples</h4> + +<p>We assume that you are using C++ to write XPCOM components that can be used either from other C++ components or from JavaScript. The process of creating a component is actually relatively straightforward when the Mozilla build system is used.</p> + +<p>In the simplest case, a component will consist of a single main directory with two subdirectories, <code>public/</code> and <code>src/</code>. The main directory and each subdirectory must contain a <code>Makefile.in</code> (from now on I’ll just refer to this file as a makefile although we know that it is actually used to generate the real makefile). This makefile says two things. First of all, it lists the subdirectories that make up the extension, so the build system knows where to look for additional makefiles. Secondly, it instructs the build system to create a new extension, rather than copying the components directly into Firefox’s binary directory. The main advantage of using an extension is that it is easy to package everything up and install it on another machine.</p> + +<p>So here’s your basic, plain-vanilla top-level makefile (<code>Makefile.in</code> in the main extension directory):</p> + +<pre>DEPTH = ../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = myextension + +DIRS = public src + +XPI_NAME = myextension +INSTALL_EXTENSION_ID = myextension@mycompany.com +XPI_PKGNAME = myextension + +DIST_FILES = install.rdf + +include $(topsrcdir)/config/rules.mk +</pre> + +<p>A detailed description of the make process, describing the key features of this makefile, can be found <a href="/en/How_Mozilla's_build_system_works" title="en/How_Mozilla's_build_system_works">here</a>. <strong>MODULE</strong> and <strong>XPI_NAME</strong> are both set to the name of your extension; they should be repeated in all project makefiles so that all of the files land in the same place in the XPI staging area (see below). <strong>INSTALL_EXTENSION_ID</strong> is the unique ID of your extension. This can be a GUID, but the format shown above is prettier and, let’s face it, a lot easier to remember. You don’t have to provide an <strong>XPI_PKGNAME</strong>, but if you do an XPI file, suitable for distribution, is automatically created in the root of the XPI staging area (<code>/mozilla/$(MOZ_OBJDIR)/dist/xpi-stage/</code>).</p> + +<p>Every extension must include an <code>install.rdf</code> file that tells Firefox how to install it. This file should be located in the main extension directory and look something like this:</p> + +<pre class="brush: xml"><?xml version="1.0"?> + +<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:em="http://www.mozilla.org/2004/em-rdf#"> + <Description about="urn:mozilla:install-manifest"> + <em:id>myextension@mycompany.com</em:id> + <em:version>0.1</em:version> + + <em:targetApplication> + <!-- Firefox --> + <Description> + <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> + <em:minVersion>1.0+</em:minVersion> + <em:maxVersion>1.0+</em:maxVersion> + </Description> + </em:targetApplication> + + <!-- front-end metadata --> + <em:name>My First Extension</em:name> + <em:description>Just an example.</em:description> + <em:creator>allpeers.com</em:creator> + <em:homepageURL>http://www.allpeers.com/blog/</em:homepageURL> + </Description> +</RDF> +</pre> + +<p>There's a <a href="/en/Install_Manifests" title="en/Install_Manifests">detailed description</a> of the format of the <code>install.rdf</code> file. Use the <strong>DIST_FILES</strong> variable in the makefile to tell <code>make</code> to copy the file into the extension directory and (optional) XPI file.</p> + +<h4 id="Interfaces_Públicas">Interfaces Públicas</h4> + +<p>The <code>public/</code> directory contains any interfaces that need to be accessed by other modules. These can be <a class="external" href="http://www.mozilla.org/scriptable/xpidl/idl-authors-guide/index.html">IDL</a> files describing <a href="/en/XPCOM" title="en/XPCOM">XPCOM</a> interfaces, which are used to generate normal C++ header files for inclusion in your source files. They can also be normal C++ header files that are to be used directly by other modules. The easiest way to accomplish the latter is to use inline implementations for all methods so you don’t have any additional linking dependencies. Otherwise you will have to link statically to your module if you use these public headers in other modules. Personally I would discourage this practice (among other things, static linking means the same code gets loaded more than once into memory, and the code won’t be available from JavaScript or other non-C++ languages) and encourage the use of XPCOM wherever possible.</p> + +<p>The makefile in the <code>public/</code> directory should follow this model:</p> + +<pre>DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = myextension +XPIDL_MODULE = myextension + +XPI_NAME = myextension + +EXPORTS = \ + myHeader.h \ + $(NULL) + +XPIDLSRCS = \ + myIFirstComponent.idl \ + myISecondComponent.idl \ + $(NULL) + +include $(topsrcdir)/config/rules.mk +</pre> + +<p><strong>XPIDL_MODULE</strong> is the name of the generated XPT file that contains type information about your <a class="external" href="http://www.mozilla.org/scriptable/xpidl/idl-authors-guide/index.html">IDL</a> interfaces. If you have multiple modules, make absolutely sure that you use a different value for <strong>XPIDL_MODULE</strong> for each one. Otherwise the first module’s XPT file will be overwritten by the second and you’ll get <strong>NS_ERROR_XPC_BAD_IID</strong> errors when you try to access its IDL interfaces from your code. The files under <strong>EXPORTS</strong> are copied directly to the <code>/mozilla/$(MOZ_OBJDIR)/dist/include/</code> directory and are thus accessible from other modules (the value of <strong>MOZ_OBJDIR</strong> is defined in <code>/mozilla/.mozconfig</code>). XPIDLSRCS are run through the IDL processor, and the generated C++ headers are copied into the same include directory. In addition, an XPT (type library) file is generated and placed in the <code>components/</code> subdirectory of your extension.</p> + +<h4 id="Ficheiros_Fonte">Ficheiros Fonte</h4> + +<p>Now it’s time to create the makefile and source files in the <code>src/</code> subdirectory. If you're implementing interfaces that you've described using IDL, the easiest way to do this is to leave the <code>src/</code> directory empty and run <code>make</code> on the <code>public/</code> directory only; this will be explained shortly.</p> + +<p>Then open the generated header file for your interface from <code>/mozilla/$(MOZ_OBJDIR)/dist/include/</code>. It contains stubs for the component .H and .CPP files that you can copy and paste into your implementation files. All you have to do is fill in the implementation stubs in the C++ file and you’re good to go.</p> + +<p>Here’s an example of the makefile you need to place into your <code>src</code> directory:</p> + +<pre class="eval">DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +IS_COMPONENT = 1 +<a href="/en/MODULE" title="en/MODULE">MODULE</a> = myextension +<a href="/en/LIBRARY_NAME" title="en/LIBRARY_NAME">LIBRARY_NAME</a> = myExtension +<a href="/en/USE_STATIC_LIBS" title="en/USE_STATIC_LIBS">USE_STATIC_LIBS</a> = 1 + +XPI_NAME = myextension + +<a href="/en/CPPSRCS" title="en/CPPSRCS">CPPSRCS</a> = \ + myFirstComponent.cpp \ + mySecondComponent.cpp \ + myExtension.cpp \ + $(NULL) + +include $(topsrcdir)/config/rules.mk + +<a href="/en/EXTRA_DSO_LDOPTS" title="en/EXTRA_DSO_LDOPTS">EXTRA_DSO_LDOPTS</a> += \ + $(MOZ_COMPONENT_LIBS) \ + $(NSPR_LIBS) \ + $(NULL) +</pre> + +<p>In this example, the first two files contain the implementation of the extension’s two components. The final file, <code>myExtension.cpp</code>, contains the code necessary to register these components, as described in the next section.</p> + +<h4 id="Registar_os_Seus_Componentes">Registar os Seus Componentes</h4> + +<p><a href="/pt-PT/docs/Mozilla/Tech/XPCOM/Guide/Alterações_XPCOM_Gecko_2.0" title="XPCOM changes in Gecko 2.0">Este artigo </a>explica como registar os componentes XPCOM no Gecko 2.0 e superior.</p> + +<h4 id="Criação_de_Extensão">Criação de Extensão</h4> + +<p>As mentioned above, you’ll probably want to build your extension immediately after creating your IDL files in order to generate the C++ stubs for your component implementations. I’m assuming that you’ve already built Firefox successfully. If not, return immediately to the beginning of this article and don’t come back til you have a functioning <code>firefox.exe</code>. Do not pass go. Do not collect $200.</p> + +<p>Still here? Okay, now we have to modify your <code>.mozconfig</code> (in the <code>/mozilla/</code> root directory) so that your extension is built along with Mozilla. Add the following line at the end of the file:</p> + +<pre class="brush: shell">ac_add_options --enable-extensions=default,myextension +</pre> + +<p>Now launch <code>make</code> from the Mozilla root:</p> + +<pre class="brush: shell">make -f client.mk build +</pre> + +<p>Even if you have an up-to-date Firefox build, you’ll have to wait a while for <code>make</code> to recurse over the entire Mozilla source tree looking for new stuff (on my machine, which is pretty fast, this takes a good 10-15 minutes). Eventually it will reach your extension and generate a bunch of stuff under <code>/mozilla/$(MOZ_OBJDIR)/</code>:</p> + +<ul> + <li>Exported header files and generated header files (from IDL) in <code>dist/include/</code></li> + <li>Static libraries for your modules in <code>dist/lib/</code> (in case other modules want to link statically to your stuff instead of using XPCOM).</li> + <li>XPI file in <code>dist/xpi-stage/myextension.xpi</code>.</li> + <li>Generated makefiles for your projects in <code>extensions/myextension/</code> (remember, we’re under <code>/mozilla/$(MOZ_OBJDIR)/</code>.</li> + <li>Everything else in <code><a class="link-mailto" href="mailto:dist/bin/extensions/myextension@mycompany.com" rel="freelink">dist/bin/extensions/myextension@mycompany.com</a>/</code>.</li> +</ul> + +<p>A lot of this stuff won’t get created on this first pass since <code>make</code> will gag when it doesn’t find the source files for your components. Don’t worry about this; all you need are the generated header files that contain the C++ implementation stubs. Go back and flesh out the C++ implementation of your components so that the build can complete next time. Remember that you should never, ever modify any of these generated files. Always modify the files used to generate them and rerun <code>make</code>. If you’re changing the generated files directly, you’re probably doing something wrong.</p> + +<p>The process of walking the entire Mozilla tree takes a long time. If you already have a Mozilla build, you can avoid this by creating a makefile for your extension directly. Go to the root of your $(MOZ_OBJDIR) and (from a bash-compatible shell) enter:</p> + +<pre class="eval">../build/autoconf/make-makefile extensions/myextension +</pre> + +<p>If your $(MOZ_OBJDIR) is located outside your $(TOPSRCDIR), you'll need to do:</p> + +<pre class="eval">$(TOPSRCDIR)/build/autoconf/make-makefile -t $(TOPSRCDIR) extensions/myextension +</pre> + +<p>in order for the script to know where your source is (it'll use the extension path you gave it relative to the current dir to figure out where you want your makefiles to go).</p> + +<p>This will generate the proper makefile for your extension. Whether you build the whole Mozilla tree or take this shortcut, you can build from now on by going to <code>/mozilla/$(MOZ_OBJDIR)/extensions/myextension/</code> and typing "make" on the command line. It should build your component without bothering with the rest of Mozilla. If everything works out, you’ll see your XPI file in the XPI staging area. You’ll also see the "exploded" version of the XPI (i.e. the unzipped directory structure) underneath <code>/mozilla/$(MOZ_OBJDIR)/dist/bin/extensions</code>. (If something goes wrong, figure out what, fix it and then come back here and add it to this article.)</p> + +<p>To make sure that the build really finished, launch Firefox and check that your extension is listed when you select Tools/Extensions. If you are using Firefox as your regular browser (and if you’re not, why not!?), you might be annoyed by the fact that you have to close regular Firefox before running your custom-built version. If so, try setting the <strong>MOZ_NO_REMOTE</strong> environment variable to "1" before running the development version of Firefox. You’ll also need to use a different profile for your development version:</p> + +<pre class="brush: shell">firefox -P <em>development</em> +</pre> + +<p>Where <em>development</em> is replaced with the name of the extra profile you’ve created. This will let you run both versions of Firefox simultaneously, saving you oodles of time over the course of the build/test cycle.</p> + +<h4 id="Nenhum_Local_Como_o_Chrome">Nenhum Local Como o Chrome</h4> + +<p>Yippee-ki-yay! Now you have an extension that does, well, absolutely nothing. It’s time to do something with those groovy components that you’ve implemented and registered. The simplest way to do this is to write some <a href="/en/JavaScript" title="en/JavaScript">JavaScript</a> and <a href="/en/XUL" title="en/XUL">XUL</a> code. At this point, it would be very helpful to have a bit of experience <a href="/en/Extensions" title="en/Extensions">writing "regular" extensions</a> (i.e. without using custom C++ components). If you’ve never done this, I strongly recommend that you think of a cool idea for something simple that you’ve always wanted to tweak in Firefox and write it. Just displaying a new menu item that opens a "Hello, World!" dialog box would be already be a great exercise to get warmed up with.</p> + +<p>Assuming you know how to write XUL/JavaScript extensions, you’re aware that the most important stuff goes in the <code>chrome/</code> directory of your extension. Well, the fact that you’re also using C++ components doesn’t change that one whit. So now you need to create the normal <code>content/</code>, <code>locale/</code> and <code>skin/</code> directories in which to place your chrome files. Personally I like placing these directly under the root directory of my module, but I don’t suppose it makes any difference if you prefer putting them under a <code>chrome/</code> subdirectory or whatever. Let freedom reign!</p> + +<p>Once you’ve written the necessary chrome files (for instance, an overlay that adds a menu item to instantiate and use one of your components), you need to package them up as part of your extension. This is accomplished through the use of a <a href="/en/JAR_Manifests" title="en/JAR_Manifests">JAR Manifest</a>. For our simple extension example, this file might look something like this:</p> + +<pre>myextension.jar: +% content myextension %content/ +% locale myextension en-US %locale/en-US/ +% skin myextension classic/1.0 %skin/classic/ +% overlay chrome://browser/content/browser.xul chrome://myextension/content/MyExtensionOverlay.xul + content/MyExtensionOverlay.js (content/MyExtensionOverlay.js) + content/MyExtensionOverlay.xul (content/MyExtensionOverlay.xul) + locale/en-US/MyExtension.dtd (locale/en-US/MyExtension.dtd) + locale/en-US/MyExtension.properties (locale/en-US/MyExtension.properties) + skin/classic/MyExtension.css (skin/classic/MyExtension.css) +</pre> + +<p>Place this code in a file called <code>jar.mn</code> in the root directory of your extension, making sure that the paths in parentheses point to actual files (when interpreted relative to the root directory). You also have to make one small change to the makefile in the same directory, adding the following line:</p> + +<pre class="eval">USE_EXTENSION_MANIFEST = 1 +</pre> + +<p>This tells <code>make</code> to create a single manifest file called <code>chrome.manifest</code> instead of creating separate manifests with goofy names for each package.</p> + +<p>Now launch <code>make</code> again, and you should see a <code>chrome</code> subdirectory appear in your extension (<code>/mozilla/$(MOZ_OBJDIR)<a class="link-mailto" href="mailto:/dist/bin/extensions/myextension@mycompany.com" rel="freelink">/dist/bin/extensions/myextension@mycompany.com</a>/</code>). Note that the <code>chrome</code> directory contains a JAR (i.e. ZIP) file with all the chrome files listed in <code>jar.mn</code> as well as a complete directory structure mirroring that of the JAR file. The directory structure, however, is empty. Why? I don’t know. Don’t worry about this, the files in the JAR are the ones that are actually used.</p> + +<h4 id="Mantedo-a_Complexa">Mantedo-a Complexa</h4> + +<p>If you’re developing a really complex extension with lots of <a href="/en/XPCOM" title="en/XPCOM">XPCOM</a> components, you’ll probably want to divide your code up into smaller modules.</p> + +<h5 id="Kinda_Sorta_Complex_Extensions">Kinda, Sorta Complex Extensions</h5> + +<p>For a moderately complex extension, it’s probably enough just to subdivide the code into a single level of modules. Let’s assume that you have a <code>base/</code> module that defines a bunch of basic XPCOM components and an <code>advanced/</code> module that defines some chrome as well as other components that use the basic components. Your complete directory structure will look something like this:</p> + +<ul> + <li>myextension + <ul> + <li>base + <ul> + <li>public</li> + <li>src</li> + </ul> + </li> + <li>advanced + <ul> + <li>content</li> + <li>locale + <ul> + <li>en-US</li> + <li>...other locales...</li> + </ul> + </li> + <li>public</li> + <li>skin + <ul> + <li>classic</li> + <li>...other skins...</li> + </ul> + </li> + <li>src</li> + </ul> + </li> + </ul> + </li> +</ul> + +<p>Other than that, nothing really changes. The makefiles in the <code>base/</code> and <code>advanced/</code> directories should look more or less like your original root makefile, remembering to change the <strong>DEPTH</strong> variable to account for the fact that they’ve moved a level further away from the Mozilla root. You also need to remove the <strong>DIST_FILES</strong> variable since that’s going to be in the top-level makefile. Every makefile that generates anything should define the <strong>XPI_NAME</strong> variable to make sure generated files go into your extension and not into the global <code>components/</code> directory. In fact, just define this in every makefile to be safe. You can use the same <strong>MODULE</strong> in both <code>base/</code> and <code>advanced/</code> so that all the generated include files go into the same directory, but make sure that you don’t use the same <strong>XPIDL_MODULE</strong> in the two <code>public/</code> directories or one of the component type libraries (i.e. XPT files) will overwrite the other one and all hell will break loose.</p> + +<p>Each module must also have a different value for the <strong>LIBRARY_NAME</strong> variable. This is the name of the generated dynamic library, so if we call the libraries "myBase" and "myAdvanced", we’ll end up with <code>myBase.dll</code> and <code>myAdvanced.dll</code> (on Windows, at least). And each of these modules is going to have a separate C++ file for registering components. So there will be two files that look like <code>myExtension.cpp</code> in the original example, say <code>Base.cpp</code> and <code>Advanced.cpp</code>. Finally, each module will obviously have its own <code>jar.mn</code>, though they can reference the same JAR filename and package name if you want all the chrome files to be organized in a single JAR file and package. The only file that really stays put is <code>install.rdf</code>, which still exists once and only once in the extension root directory.</p> + +<p>As for the top-level makefile, it will now look like this:</p> + +<pre>DEPTH = ../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = myextension + +DIRS = base advanced + +XPI_NAME = myextension +INSTALL_EXTENSION_ID = myextension@mycompany.com +XPI_PKGNAME = myextension + +DIST_FILES = install.rdf + +include $(topsrcdir)/config/rules.mk +</pre> + +<h5 id="Extensões_Complexas_Sérias">Extensões Complexas Sérias</h5> + +<p>At some point, even a single module may grow to the point where you want to divide it further into submodules. The difference between having separate modules and having a single module with separate submodules is that the submodules all share the same file for registering components (the famous <code>myExtension.cpp</code> file), and when compiled they create a single dynamic library. The decision to split a module into submodules is all about code organization; it doesn’t really affect the final product at all.</p> + +<p>To split a module into submodules, first create a subdirectory for each submodule. Then create an additional directory called <code>build/</code>. Each submodule will be configured to create a static library, and the <code>build/</code> directory will pull these libraries together to create a single dynamic component library. Confused? Here’s an example, showing just the <code>advanced/</code> subbranch of the <code>myextension/</code> directory:</p> + +<ul> + <li>advanced + <ul> + <li>build</li> + <li>intricate + <ul> + <li>public</li> + <li>src</li> + </ul> + </li> + <li>multifarious + <ul> + <li>public</li> + <li>src</li> + </ul> + </li> + <li>content</li> + <li>locale + <ul> + <li>en-US</li> + <li>...other locales...</li> + </ul> + </li> + <li>skin + <ul> + <li>classic</li> + <li>...other skins...</li> + </ul> + </li> + </ul> + </li> +</ul> + +<p>As you can see, we’ve split <code>advanced/</code> into two submodules: <code>intricate/</code> and <code>multifarious/</code>, and we’ve added an additional <code>build/</code> subdirectory. We’ve left the chrome directories directly under <code>advanced/</code>, since they aren’t tied to any specific submodule. This means that <code>jar.mn</code> will stay in the same place.</p> + +<p>The <code>intricate/</code> and <code>multifarious/</code> makefiles will look a lot like the original <code>advanced/</code> makefile, but we’ll need to tweak them a bit. As always, we have to adjust the <strong>DEPTH</strong> variable since the makefiles are deeper in the directory structure. And we should change the <strong>LIBRARY_NAME</strong> to indicate that we’re generating a static library for each submodule. By convention the "_s" suffix is used for this purpose. So let’s call them "myIntricate_s" and "myMultifarious_s". Finally, we define the variable <strong>FORCE_STATIC_LIB</strong>, resulting in a makefile that starts something like this:</p> + +<pre>DEPTH = ../../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = myextension +LIBRARY_NAME = myIntricate_s +FORCE_STATIC_LIB = 1 +USE_STATIC_LIBS = 1 + +XPI_NAME = myextension + +...more stuff here... +</pre> + +<p>The <code>build</code> makefile pulls together the static libraries generated by the submodules and creates a single (dynamic) component library:</p> + +<pre>DEPTH = ../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +IS_COMPONENT = 1 +MODULE = myextension +LIBRARY_NAME = myAdvanced +USE_STATIC_LIBS = 1 + +XPI_NAME = myextension + +DEFINES += XPCOM_GLUE + +SHARED_LIBRARY_LIBS = \ + $(DIST)/lib/$(LIB_PREFIX)myIntricate_s.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)myMultifarious_s.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)xul.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)nss3.$(LIB_SUFFIX) \ + $(NULL) + +CPPSRCS = \ + Advanced.cpp \ + $(NULL) + +include $(topsrcdir)/config/rules.mk + +LOCAL_INCLUDES += \ + -I$(srcdir)/../intricate/src \ + -I$(srcdir)/../multifarious/src \ + $(NULL) +</pre> + +<p>The makefile in the <code>advanced/</code> directory should list the <code>intricate/</code>, <code>multifarious/</code> and <code>build/</code> directories in its <strong>DIRS</strong> variable. Make sure that <code>build/</code> comes last since it can’t create the component library until the other makefiles have completed.</p> + +<h3 id="Outros_Tópicos">Outros Tópicos</h3> + +<h4 id="Adicionar_Ficheiros_de_Dados_às_Suas_Extensões">Adicionar Ficheiros de Dados às Suas Extensões</h4> + +<p>In some cases, you may wish to include additional files in your extension that don’t belong in the <code>chrome/</code> subdirectory. Examples might be database files or XML schemas. This can be achieved by adding a custom step to your makefile that copies the files from the source tree into the extension’s target directory.</p> + +<h5 id="Copiar_Ficheiros_de_Dados_para_a_Diretoria_de_Destino">Copiar Ficheiros de Dados para a Diretoria de Destino</h5> + +<p>Let’s say that you have some data files containing statistical information that you want to include in your extension and make available to your components. You’ve placed these files, which have the extension .TXT, into a <code>stats/</code> subdirectory under your extension directory in the source tree. The following makefile rule can be used to copy these files into the final target directory of the extension:</p> + +<pre>export:: + if test ! -d $(FINAL_TARGET)/stats; then \ + $(NSINSTALL) -D $(FINAL_TARGET)/stats; \ + fi + $(INSTALL) $(srcdir)/*.txt $(FINAL_TARGET)/stats +</pre> + +<h5 id="Aceder_aos_Ficheiros_de_Dados_a_partir_dos_Componentes">Aceder aos Ficheiros de Dados a partir dos Componentes</h5> + +<p>The trick to accessing your data files is to figure out where the home directory of your extension is. Rumor has it that at some future date, this will possible through the <code><a href="/en/XPCOM_Interface_Reference/nsIExtensionManager" title="en/XPCOM_Interface_Reference/nsIExtensionManager">nsIExtensionManager</a></code> interface or something similar. In the meantime, there is a simple and reliable hack that can be used to achieve this. In the implementation of any JavaScript XPCOM component, there is a special <strong>__LOCATION__</strong> (two leading and two trailing underscores) symbol that points to the component’s implementation file. So you can write a simple component which deduces the root directory of your extensions by extrapolating from its location.</p> + +<p><a class="external" href="http://www.builderau.com.au/program/soa/Creating_XPCOM_components_with_JavaScript/0,39024614,39206503,00.htm">This article</a> explains how to create an XPCOM component in JavaScript. You’ll need an IDL file for an interface that looks something like this:</p> + +<pre>interface myILocation : nsISupports +{ + readonly attribute nsIFile locationFile; +}; +</pre> + +<p>Place the IDL file in the <code>public/</code> directory of your project or subproject. In the <code>src/</code> directory, place the JavaScript file that implements the component. The component implementation will include the methods for retrieving the path or file for the extension’s home directory:</p> + +<pre class="brush: js">myLocation.prototype = +{ + QueryInterface: function(iid) + { + if (iid.equals(nsISupports)) + return this; + if (iid.equals(myILocation)) + return this; + + Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE; + return null; + }, + + get locationFile() + { + return __LOCATION__.parent.parent; + } +} +</pre> + +<p>This assumes that the component resides in a subdirectory of the extension directory (by convention, this directory is called <code>components/</code>). The <code>parent</code> property of <strong>__LOCATION__</strong> returns the <code>components/</code>, and the <code>parent</code> of this is the extension directory.</p> + +<p>The last step is to modify the makefile of the source directory where you placed your JavaScript file so that it is copied into the appropriate location in the extension:</p> + +<pre>export:: + $(INSTALL) $(srcdir)/*.js $(FINAL_TARGET)/components +</pre> + +<p>Now you can instantiate an instance of this component and use the <code>locationFile</code> property to get an <code><a href="/en/XPCOM_Interface_Reference/nsIFile" title="en/XPCOM_Interface_Reference/nsIFile">nsIFile</a></code> interface that points to your extension’s home directory.</p> + +<h4 id="Using_Third-Party_Libraries">Using Third-Party Libraries</h4> + +<p>For more sophisticated extensions, you may want to integrate third-party libraries that provide specialized functionality for database connectivity, image processing, networking and the like. If you want your extension to run on all Firefox platforms, you will need to have the source code for the library in question, so I assume that this is available.</p> + +<p>The most convenient approach from the perspective of the development cycle is to create a Mozilla-style makefile for the library. This works well for libraries that have a straightforward make process without extensive configuration. A good example of this is the SQLite library included in the Mozilla build tree at <code>db/sqlite</code>. By adapting the makefile in this way, the library is created as part of the standard Mozilla build process, which eliminates additional build steps. The downside is that you will need to update the modified makefile any time a new version of the library is released.</p> + +<p>For libraries that have complex configuration processes, use a non-standard compiler or have other special characteristics, it may be unfeasible to create a Mozilla-compliant makefile. In this case, I would recommend placing the entire library distribution inside the project or subproject that uses it. So if library <code>acmelib</code> is used inside the <code>multifarious/</code> subproject in the above example, it would be placed as a subdirectory underneath that subproject (at the same level as <code>public/</code> and <code>src/</code>).</p> + +<p>Of course, this means that you will have to build <code>acmelib</code> manually on all platforms before launching the Mozilla build. But at least you can then refer to include files and import libraries from your component using relative paths.</p> + +<h4 id="Building_for_Multiple_Platforms">Building for Multiple Platforms</h4> + +<p>TODO</p> + +<div class="originaldocinfo"> +<h2 id="Original_Document_Information">Original Document Information</h2> + +<ul> + <li>Author: Matthew Gertner - July 26, 2005.</li> + <li>Permission granted to migrate in Jan 2006, including permission to relicense under the CC:By-SA.</li> + <li>Original Source: <a class="external" href="http://www.allpeers.com/blog/creating-complex-firefox-extensions/" rel="freelink">http://www.allpeers.com/blog/creatin...ox-extensions/</a></li> +</ul> +</div> + +<p> </p> diff --git a/files/pt-pt/mozilla/add-ons/distribuicao/index.html b/files/pt-pt/mozilla/add-ons/distribuicao/index.html new file mode 100644 index 0000000000..eede6b7581 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/distribuicao/index.html @@ -0,0 +1,78 @@ +--- +title: Assinar e distribuir os seus extras +slug: Mozilla/Add-ons/Distribuicao +tags: + - Extensões + - Extensões da Web + - Extras + - assinatura + - distribuição + - publicação + - revisões +translation_of: Mozilla/Add-ons/Distribution +--- +<div>{{AddonSidebar}}</div> + +<p>Os extras precisam de ser assinados antes de serem instalados nas versões beta e de lançamento do Firefox. Este processo de assinatura ocorre via addons.mozilla.org (AMO), independentemente de optar por distribuir o seu extra via AMO ou por si mesmo.</p> + +<p>Nós aqui analisamos os requisitos de assinatura e as revisões relacionadas, antes de discutir como escolher entre o distribuir no AMO ou distribuir um extra por si mesmo. Nós também analisamos os canais disponíveis no AMO e respondemos a questões sobre propriedade e disputas de código.</p> + +<h2 class="brush: js" id="Assinar_os_seus_extras">Assinar os seus extras</h2> + +<p>Starting with Firefox 43, add-on extensions and multi-item add-ons that include extensions need to be signed by Mozilla before they can install in release and beta versions of Firefox. Themes, and other types of add-ons such as spelling dictionaries, don't need to be signed.</p> + +<p>Unsigned extensions can be installed in <a href="/en-US/Firefox/Developer_Edition">Developer Edition</a>, Nightly, and <a href="/en-US/Firefox/Enterprise_deployment">ESR</a> versions of Firefox, after toggling the <em>xpinstall.signatures.required</em> preference in <code>about:config</code>.</p> + +<p>Mozilla signs add-ons through the <a href="https://addons.mozilla.org/developers/addon/submit">AMO</a> website and provides three methods for submitting your add-on for signing:</p> + +<ul> + <li>upload your add-on through the <a href="/en-US/Add-ons/Distribution/Submitting_an_add-on">Developer Hub on AMO</a>.</li> + <li>use the <a href="http://addons-server.readthedocs.io/en/latest/topics/api/signing.html">addons.mozilla.org signing API</a>.</li> + <li>use <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/web-ext_command_reference#web-ext_sign">web-ext sign.</a></li> +</ul> + +<p>All the signing options are subject to the <a href="/en-US/Add-ons/AMO/Policy/Agreement">Firefox Add-on Distribution Agreement</a>.</p> + +<p>Using the signing API or web-ext returns you signed add-ons, with no distribution listing created on AMO. If you take the option to upload your add-on through the AMO Developer Hub, you're given a choice between listing on AMO or self-distribution. If you choose self-distribution, at the end of the process you download signed copies of your add-on.</p> + +<p>Regardless of the method used all add-ons must pass an automated validation before they are signed. They may also be subject to a manual code review. The review criteria applied to add-ons are found in the <a href="/en-US/docs/Mozilla/Add-ons/AMO/Policy/Reviews">Add-on Policies</a>.</p> + +<h2 id="Distributir_o_seu_extra">Distributir o seu extra</h2> + +<p>You aren't required to list or distribute your add-on through AMO. You'll, therefore, need to decide if you want to distribute and list your add-on through AMO or distribute it yourself. Here are some things you should consider:</p> + +<ul> + <li>AMO is a very popular distribution platform, with millions of monthly visitors and installations. It's integrated into the Firefox Add-ons Manager, allowing for easy installation of add-ons published on AMO.</li> + <li>When an add-on is listed on AMO, updates to installed copies are handled automatically by Firefox each time a new version is listed on AMO.<br> + To enable Firefox to automatically update self-distributed add-ons, the URL where Firefox can find updates needs to be included in the add-on manifest's <a href="/en-US/Add-ons/Updates">update_link</a> key. Self-distributed add-ons that don't have an update URL check AMO for updates and are updated to a listed version, if one is available.</li> +</ul> + +<p>For more information on how to submit an add-on for distribution on AMO or self-distribution, see <a href="/en-US/docs/Mozilla/Add-ons/Distribution/Submitting_an_add-on">Submitting an add-on.</a></p> + +<h2 id="Mais_informação_sobre_AMO">Mais informação sobre AMO</h2> + +<h3 id="Propriedade">Propriedade</h3> + +<p>Os extras no AMO podem ter vários utilizadores com permissão para atualizar e gerir a listagem. Os autores de um extra podem transferir a propriedade e adicionar programadores à listagem de um extra por meio do <em>Hub </em>do Programdor. Não é necessária nenhuma interação com os representantes da Mozilla para uma transferência de propriedade.</p> + +<p> </p> + +<h4 id="Para_transferir_propriedade">Para transferir propriedade</h4> + +<ul> + <li>Make sure the new owner has an account on <a href="https://addons.mozilla.org/">addons.mozilla.org</a>. New accounts can be created using the "Register or Log in" button, after which the owner must confirm their email address.</li> + <li>Sign into your account on the <a href="https://addons.mozilla.org/developers/">Add-on Developer Hub</a>, and click "Edit Listing" for the extension you want to transfer.</li> + <li>On the left-hand side of the screen, you will see a blue box labeled "Edit Information". Click "Manage Authors & License" — from the resulting page you can add and remove authors.</li> + <li>One you have added the new author's email address, set that person as the extension owner and make sure the "Listed" box has a checkmark. Now you can remove yourself by clicking the "x" next to your email address.</li> + <li>When you're done, click "Save Changes". The new owner will be able to manage updates, listing information, etc., when logged in.</li> +</ul> + +<p> </p> + +<h3 id="Disputas_de_códogo">Disputas de códogo</h3> + +<p>Many add-ons allow their source code to be viewed. This does not mean that the source code is open source or available for use in another add-on. The original author of an add-on retains copyright of their work unless otherwise noted in the add-on's license.</p> + +<p>If we're notified of a copyright or license infringement, we will take steps to address the situation per the DMCA, which may include taking down the add-on listing. Details about this process and how to report trademark or licensing issues can be <a href="https://www.mozilla.org/en-US/about/legal/report-abuse/">found here</a>.</p> + +<p>If you are unsure of the current copyright status of an add-on's source code, you must contact the author and get explicit permission before using the source code.</p> diff --git a/files/pt-pt/mozilla/add-ons/index.html b/files/pt-pt/mozilla/add-ons/index.html new file mode 100644 index 0000000000..2b69084b27 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/index.html @@ -0,0 +1,111 @@ +--- +title: Extras (Add-ons) +slug: Mozilla/Add-ons +tags: + - Extensões + - Extras + - Landing + - Mozilla + - extensão +translation_of: Mozilla/Add-ons +--- +<div>{{AddonSidebar}}</div> + +<p><span class="seoSummary">Os extras permitem que os responsáveis pelo desenvolvimento estendam e modifiquem a funcionalidade do Firefox. As mesmas são criadas utilizando as tecnologias da Web padrão - CSS, HTML e JavaScript - mais algumas APIs de JavaScript dedicadas. Entre outras coisas, um extra poderia:</span></p> + +<ul> + <li>Modificar e alterar a aparência ou conteúdo de um site em particualr</li> + <li>Modificar a interface de utilizador do Firefox</li> + <li>Adicionar novas funcionalidades ao Firefox</li> +</ul> + +<h2 id="Desenvolver_extras">Desenvolver extras</h2> + +<p>Existem, de momento, vários conjuntos de ferramentas utilizadas para desenvolver Aplicações Complementares mas as chamadas <a href="/en-US/Add-ons/WebExtensions">Extensões da Web</a> vão tornar-se o padrão pelo final de 2017. Das restantes a expectativa é de que se tornem <a href="/en-US/Add-ons/Overlay_Extensions">obsoletas</a> dentro do mesmo periodo de tempo.</p> + +<p>Neste documento vai encontrar informação sobre as opções disponíveis para desenvolver aplicações complementares para que possa decidir qual a melhor para si agora e no futuro.</p> + +<h3 id="Criar_um_Novo_Extra">Criar um Novo Extra</h3> + +<p>Se está a desenvolver uma nova aplicação complementar recomendamos que escolha entre um dos dois seguintes métodos. Até que a transição para as Extensões da Web esteja finalizada, existirão prós e contras em relação a ambos os métodos. Por favor leia atentamente as opções para decidir qual a melhor para funcionar com a sua aplicação.</p> + +<ul class="card-grid"> + <li style="position: relative; max-width: 400px;"> + <div style="margin-bottom: 70px;"> + <h4 id="Extensões_da_Web"><a href="pt-PT/Add-ons/WebExtensions">Extensões da Web</a></h4> + + <p>As Extensões da Web são o futuro das Aplicações Complementares para o Firefox. Se a puder utilizar, a API das Extensões da Web será a melhor escolha. Pode começar a desenvolver e publicar Extensões da Web imediatamente, mas as mesmas ainda estão num estado embrionário.<br> + <br> + A maioria das funcionalidades da API Extensões da Web estão também disponíveis no <a href="/en-US/Add-ons/WebExtensions/Browser_support_for_JavaScript_APIs">Firefox para Android</a>.</p> + + <p>We're preparing a first full release for <a href="https://wiki.mozilla.org/RapidRelease/Calendar">Firefox 48</a>.</p> + </div> + <a class="card-grid-button" href="/en-US/Add-ons/WebExtensions">Saber mais</a></li> + <li style="position: relative; max-width: 400px;"> + <div style="margin-bottom: 70px;"> + <h4 id="SDK_de_Extras"><a href="/en-US/Add-ons/SDK">SDK de Extras</a></h4> + + <p>O SDK de Extra proporcina várias APIs para desenvolvimento de extras para o Firefox, e uma ferramenta para desenvolvimento, teste e finalização.</p> + + <p>Também pode executar as extensões de SDK de Extras no<a href="/en-US/Add-ons/SDK/Tutorials/Mobile_development"> Firefox para Android</a>.</p> + + <p>We encourage you to use only <a href="/en-US/Add-ons/SDK/High-Level_APIs">high-level APIs</a> because this will make it easier to migrate to WebExtensions down the road.</p> + </div> + <a class="card-grid-button" href="/en-US/Add-ons/SDK">Learn more</a></li> +</ul> + +<h3 id="Migrar_um_Extra_Existente">Migrar um Extra Existente</h3> + +<p>There are changes coming to Firefox in the next year that will make browsing more reliable for users, and creating add-ons easier for developers. Your add-on may require updating to maintain its compatibility, but once this is done and the transition is complete, your add-on will be more interoperable, secure, and future-proof than ever.</p> + +<p>We've created <a href="https://wiki.mozilla.org/Add-ons/developer/communication">resources, migration paths, office hours, and more</a>, to ensure you have the support you need to get through the transition.</p> + +<p>To get started, use the <a href="https://compatibility-lookup.services.mozilla.com/">add-on compatibility checker</a> to see if your add-on will be affected.</p> + +<h2 id="Publicação_de_extras">Publicação de extras</h2> + +<p><a href="https://addons.mozilla.org">Addons.mozilla.org</a>, commonly known as "AMO," is Mozilla's official site for developers to list add-ons, and for users to discover them. By uploading your add-on to AMO, you can participate in our community of users and creators, and find an audience for your add-on.</p> + +<p>You are not required to list your add-on on AMO, but starting with Firefox 40, your code must be signed by Mozilla or users won't be able to install it.</p> + +<p>For an overview of the process of publishing your add-on, see <a href="https://developer.mozilla.org/en-US/Add-ons/Distribution">Signing and distributing your add-on</a>.</p> + +<h2 id="Outros_tipos_de_extras">Outros tipos de extras</h2> + +<p>Generally, when people speak of add-ons they're referring to extensions, but there are a few other add-on types that allow users to customize Firefox. Those add-ons include:</p> + +<ul> + <li><a href="https://developer.mozilla.org/Add-ons/Themes/Background">Lightweight themes</a> are a simple way to provide limited customization for Firefox.</li> + <li><a href="/en-US/Add-ons/Firefox_for_Android">Mobile add-ons</a> are add-ons for Firefox for Android. Note, though, that we intend to deprecate some of the technology underlying these APIs. In the future, WebExtensions will be fully supported on Firefox for Android.</li> + <li><a href="/en-US/docs/Creating_OpenSearch_plugins_for_Firefox">Search engine plugins</a> add new search engines to the browser's search bar.</li> + <li><a href="/pt-PT/docs/Mozilla/Criação_de_um_complemento_de_dicionário_de_verificação_ortográfica">Dicionários do utilizador</a> são complementos que o deixam verificar a ortografia em diferentes idiomas.</li> + <li><a href="https://support.mozilla.org/pt-PT/kb/use-firefox-interface-other-languages-language-pack">Pacotes de idioma </a>são complementos que o deixam ter mais idiomas disponíveis para a interface do utilizador do Firefox.</li> +</ul> + +<hr> +<h2 id="Contacte-nos">Contacte-nos</h2> + +<p>Pode utilizar as hiperligações abaixo para obetr ajuda, manter-se atualizado com as notícias relacionadas com os complementos, e dar-nos a sua opinião/comentário.</p> + +<h3 id="Fórum_de_extras">Fórum de extras</h3> + +<p>Utilize o <a href="https://discourse.mozilla-community.org/c/add-ons">fórum de conversação sobre os complementos</a> para discutir todos aspetos do desenvolvimento de complementos e obter ajuda.</p> + +<h3 id="Listas_de_endereçosdiscussão">Listas de endereços/discussão</h3> + +<p>Use the <strong>dev-addons</strong> list to discuss development of the add-ons ecosystem, including the development of the WebExtensions system and of AMO:</p> + +<ul> + <li><a href="https://mail.mozilla.org/listinfo/dev-addons">dev-addons list info</a></li> + <li><a href="https://mail.mozilla.org/pipermail/dev-addons/">dev-addons archives</a></li> +</ul> + +<h3 id="IRC">IRC</h3> + +<p>If you're a fan of IRC, you can get in touch at:</p> + +<ul> + <li><a href="irc://irc.mozilla.org/addons">#addons</a> (discussion of the add-ons ecosystem)</li> + <li><a href="irc://irc.mozilla.org/extdev">#extdev</a> (general discussion of add-on development)</li> + <li><a href="irc://irc.mozilla.org/webextensions">#webextensions</a> (discussion of WebExtensions in particular)</li> +</ul> diff --git a/files/pt-pt/mozilla/add-ons/linhas_diretrizes_para_extras/index.html b/files/pt-pt/mozilla/add-ons/linhas_diretrizes_para_extras/index.html new file mode 100644 index 0000000000..4293fe9c74 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/linhas_diretrizes_para_extras/index.html @@ -0,0 +1,8 @@ +--- +title: Linhas Diretrizes para Extras +slug: Mozilla/Add-ons/Linhas_diretrizes_para_extras +translation_of: 'https://extensionworkshop.com/documentation/publish/add-on-policies/' +--- +<div class="warning"> +<p>Este documento já não é válido. Por favor, consulte o documento de <a href="/pt-PT/docs/Mozilla/Add-ons/AMO/Policy/Revisões">Políticas de Revisão</a> para o conjunto atual das políticas de extras.</p> +</div> diff --git a/files/pt-pt/mozilla/add-ons/sdk/index.html b/files/pt-pt/mozilla/add-ons/sdk/index.html new file mode 100644 index 0000000000..1c160220ae --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/sdk/index.html @@ -0,0 +1,97 @@ +--- +title: Add-on SDK +slug: Mozilla/Add-ons/SDK +tags: + - Add-on SDK + - Jetpack +translation_of: Archive/Add-ons/Add-on_SDK +--- +<div class="warning"> +<p>Support for extensions using XUL/XPCOM or the Add-on SDK was removed in Firefox 57, released November 2017. As there is no supported version of Firefox enabling these technologies, this page will be removed by December 2020.</p> + +<p>Add-ons using the techniques described in this document are considered a legacy technology in Firefox. Don't use these techniques to develop new add-ons. Use <a href="/en-US/Add-ons/WebExtensions">WebExtensions</a> instead. If you maintain an add-on which uses the techniques described here, consider migrating it to use WebExtensions.</p> + +<p><strong>Starting from <a href="https://wiki.mozilla.org/RapidRelease/Calendar">Firefox 53</a>, no new legacy add-ons will be accepted on addons.mozilla.org (AMO) for desktop Firefox and Firefox for Android.</strong></p> + +<p><strong>Starting from <a href="https://wiki.mozilla.org/RapidRelease/Calendar">Firefox 57</a>, only extensions developed using WebExtensions APIs will be supported on Desktop Firefox and Firefox for Android. </strong></p> + +<p>Even before Firefox 57, changes coming up in the Firefox platform will break many legacy extensions. These changes include multiprocess Firefox (e10s), sandboxing, and multiple content processes. Legacy extensions that are affected by these changes should migrate to use WebExtensions APIs if they can. See the <a href="https://blog.mozilla.org/addons/2017/02/16/the-road-to-firefox-57-compatibility-milestones/">"Compatibility Milestones" document</a> for more information.</p> + +<p>A wiki page containing <a href="https://wiki.mozilla.org/Add-ons/developer/communication">resources, migration paths, office hours, and more</a>, is available to help developers transition to the new technologies.</p> +</div> +<p>Pode criar extras do Firefox utilizando <strong><u>Add-on SDK</u></strong>. Pode utilizar várias tecnologias da Web padrão: CSS, HTML e JavaScript, para criar os extras. O SDK inclui as APIs de JavaScript APIs, que pode utilziar para criar extras e ferramentas para a criação, execução, testes, e empacotamento dos extras.</p> + +<hr> +<h3 id="Tutoriais"><a href="/en-US/Add-ons/SDK/Tutorials">Tutoriais</a></h3> + +<div class="column-container"> +<div class="column-half"> +<dl> + <dt><a href="/en-US/Add-ons/SDK/Tutorials#getting-started">Getting started</a></dt> + <dd>How to <a href="/en-US/Add-ons/SDK/Tutorials/Installation">install the SDK</a> and <a href="/en-US/Add-ons/SDK/Tutorials/Getting_Started_(jpm)">use the jpm tool</a> to develop, test, and package add-ons.</dd> + <dt><a href="/en-US/Add-ons/SDK/Tutorials#interact-with-the-browser">Interact with the browser</a></dt> + <dd><a href="/en-US/Add-ons/SDK/Tutorials/Open_a_Web_Page">Open web pages</a>, <a href="/en-US/Add-ons/SDK/Tutorials/Listen_For_Page_Load">listen for pages loading</a> and <a href="/en-US/Add-ons/SDK/Tutorials/List_Open_Tabs">list open pages</a>.</dd> + <dt><a href="/en-US/Add-ons/SDK/Tutorials#development-techniques">Development techniques</a></dt> + <dd>Learn about common development techniques, such as <a href="/en-US/Add-ons/SDK/Tutorials/Unit_testing">unit testing</a>, <a href="/en-US/Add-ons/SDK/Tutorials/Logging">logging</a>, <a href="/en-US/Add-ons/SDK/Tutorials/Creating_Reusable_Modules">creating reusable modules</a>, <a href="/en-US/Add-ons/SDK/Tutorials/l10n">localization</a>, and <a href="/en-US/Add-ons/SDK/Tutorials/Mobile_development">mobile development</a>.</dd> +</dl> +</div> + +<div class="column-half"> +<dl> + <dt><a href="/en-US/Add-ons/SDK/Tutorials#create-user-interfaces">Create user interface components</a></dt> + <dd>Create user interface components such as <a href="/en-US/Add-ons/SDK/Tutorials/Adding_a_Button_to_the_Toolbar">toolbar buttons</a>, <a href="/en-US/Add-ons/SDK/Tutorials/Add_a_Context_Menu_Item">context menus</a>, <a href="/en-US/Add-ons/SDK/Tutorials/Add_a_Menu_Item_to_Firefox">menu items</a>, and <a href="/en-US/Add-ons/SDK/Tutorials/Display_a_Popup">dialogs</a>.</dd> + <dt><a href="/en-US/Add-ons/SDK/Tutorials#modify-web-pages">Modify web pages</a></dt> + <dd>Modify pages <a href="/en-US/Add-ons/SDK/Tutorials/Modifying_Web_Pages_Based_on_URL">matching a URL pattern</a> or dynamically <a href="/en-US/Add-ons/SDK/Tutorials/Modifying_the_Page_Hosted_by_a_Tab">modify a particular tab</a>.</dd> + <dt><a href="/en-US/Add-ons/SDK/Tutorials/Annotator">Putting it together</a></dt> + <dd>Walkthrough of the Annotator example add-on.</dd> +</dl> +</div> +</div> + +<hr> +<h3 id="Guias">Guias</h3> + +<div class="column-container"> +<div class="column-half"> +<dl> + <dt><a href="/en-US/Add-ons/SDK/Guides#contributors-guide">Contributor's guide</a></dt> + <dd>Learn <a href="/en-US/Add-ons/SDK/Guides/Getting_Started">how to start contributing</a> to the SDK and about the most important idioms used in the SDK code such as <a href="/en-US/Add-ons/SDK/Guides/Modules">modules</a>, <a href="/en-US/Add-ons/SDK/Guides/Classes_and_Inheritance">classes and inheritance</a>, <a href="/en-US/Add-ons/SDK/Guides/Private_Properties">private properties</a>, and <a href="/en-US/Add-ons/SDK/Guides/Content_Processes">content processes</a>.</dd> + <dt><a href="/en-US/Add-ons/SDK/Guides#sdk-infrastructure">SDK infrastructure</a></dt> + <dd>Aspects of the SDK's underlying technology: <a href="/en-US/Add-ons/SDK/Guides/Module_structure_of_the_SDK">modules</a>, the <a href="/en-US/Add-ons/SDK/Guides/Program_ID">Program ID</a> and the rules defining <a href="/en-US/Add-ons/SDK/Guides/Firefox_Compatibility">Firefox compatibility</a>.</dd> + <dt><a href="/en-US/Add-ons/SDK/Guides/Content_Scripts">Content scripts</a></dt> + <dd>A detailed guide to working with content scripts.</dd> +</dl> +</div> + +<div class="column-half"> +<dl> + <dt><a href="/en-US/Add-ons/SDK/Guides#sdk-idioms">SDK idioms</a></dt> + <dd>The SDK's <a href="/en-US/Add-ons/SDK/Guides/Working_with_Events">event framework</a> and the <a href="/en-US/Add-ons/SDK/Guides/Two_Types_of_Scripts">distinction between add-on scripts and content scripts</a>.</dd> + <dt><a href="/en-US/Add-ons/SDK/Guides/XUL_Migration_Guide">XUL migration</a></dt> + <dd>A guide to <a href="/en-US/Add-ons/SDK/Guides/XUL_Migration_Guide">porting XUL add-ons to the SDK</a>. This guide includes a <a href="/en-US/Add-ons/SDK/Guides/XUL_vs_SDK">comparison of the two toolsets</a> and a <a href="/en-US/Add-ons/SDK/Guides/Porting_the_Library_Detector">working example</a> of porting a XUL add-on.</dd> + <dt><a href="/en-US/Add-ons/SDK/Guides/Multiprocess_Firefox_and_the_SDK">Multiprocess Firefox and the SDK</a></dt> + <dd>How to check whether your add-on is compatible with multiprocess Firefox or not and fix it accordingly.</dd> +</dl> +</div> +</div> + +<hr> +<h3 id="Referência">Referência</h3> + +<div class="column-container"> +<div class="column-half"> +<dl> + <dt><a href="/en-US/Add-ons/SDK/High-Level_APIs">High-Level APIs</a></dt> + <dd>Reference documentation for the high-level SDK APIs.</dd> + <dt><a href="/en-US/Add-ons/SDK/Tools">Tools reference</a></dt> + <dd>Reference documentation for the <a href="/en-US/Add-ons/SDK/Tools/jpm">jpm tool</a> used to develop, test and package add-ons, the <a href="/en-US/Add-ons/SDK/Tools/console">console</a> global used for logging, and the <a href="/en-US/Add-ons/SDK/Tools/package_json">package.json</a> file.</dd> +</dl> +</div> + +<div class="column-half"> +<dl> + <dt><a href="/en-US/Add-ons/SDK/Low-Level_APIs">Low-Level APIs</a></dt> + <dd>Reference documentation for the low-level SDK APIs.</dd> +</dl> +</div> +</div> diff --git a/files/pt-pt/mozilla/add-ons/themes/conceitos_tema/index.html b/files/pt-pt/mozilla/add-ons/themes/conceitos_tema/index.html new file mode 100644 index 0000000000..bb59c4386f --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/themes/conceitos_tema/index.html @@ -0,0 +1,230 @@ +--- +title: Conceitos de Tema +slug: Mozilla/Add-ons/Themes/Conceitos_tema +tags: + - Tema + - extra +translation_of: Mozilla/Add-ons/Themes/Theme_concepts +--- +<div>{{AddonSidebar()}}</div> + +<p>Os temas desenvolvidos utilizando a <a href="/pt-PT/docs/Mozilla/Add-ons/WebExtensions">WebExtensions API</a> no Firefox permitem-lhe alterar a aparência do navegador ao adicionar imagens na área do cabeçalho do navegador Firefox; esta é a área por trás da barra de menus, barras de ferramentas, barra de endereço, barra de pesquisa e seuparador de faixa.</p> + +<p>Estas opções de temas podem ser implementadas como temas estáticos (embora as próprias imagens do tema possam ser animadas) ou como temas dinâmicos criados numa extensão do navegador.</p> + +<div class="note"> +<p>If you have a <a href="/en-US/docs/Mozilla/Add-ons/Themes/Lightweight_themes">lightweight theme</a> it will be converted to this new theme format automatically before lightweight themes are deprecated. You do not need to port your theme. However, please feel free to update your themes to use any of the new features described here.</p> +</div> + +<h2 id="Temas_estásticos">Temas estásticos</h2> + +<p>Static themes are specified using the same resources as a browser extension: a <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json">manifest.json</a> file to define the theme components with those components stored in the same folder as the manifest.json file or a sub folder. These resources are then packed in a zip for publication on <a href="https://addons.mozilla.org">addons.mozilla.org</a> (AMO).</p> + +<div class="note"> +<p>A theme and browser extension functionality cannot be defined in one package, such as including a theme to complement an extension. You can, however, programmatically include a theme in an extension using the Theme API. See <a href="#Dynamic_themes">Dynamic themes</a>.</p> +</div> + +<h3 id="Definir_um_tema">Definir um tema</h3> + +<p>To create a theme (in this example a simple, single image theme):</p> + +<ul> + <li>Create a folder in a suitable location on your computer.</li> + <li>Add the theme image file to the folder: + <pre><mytheme> + <your_header_image>.<type></pre> + </li> + <li>Create a file called manifest.json in the folder and edit its content as follows: + <pre class="brush: json">{ + "manifest_version": 2, + "version": "1.0", + "name": "<your_theme_name>", + "theme": { + "images": { + "headerURL": "<your_header_image>.<type>" + }, + "colors": { + "accentcolor": "#FFFFFF", + "textcolor": "#000" + } + } +} +</pre> + Where: + + <ul> + <li><code>"accentcolor":</code> is the heading area background color for your theme.</li> + <li><code>"</code><code>textcolor</code><code>":</code> the color of the text in the heading area.</li> + </ul> + </li> + <li>Package your theme and submit it to AMO, <a href="/en-US/Add-ons/WebExtensions/Publishing_your_WebExtension">following these instructions</a>.</li> +</ul> + +<h3 id="Static_theme_approaches">Static theme approaches</h3> + +<p>There are two approaches you can take to theming the header area of Firefox: using a single image or using multiple images. You could combine the two, but it’s easier to treat them separately.</p> + +<h4 id="Single_image_themes">Single image themes</h4> + +<p>This is the basic or minimal theming option, where you define:</p> + +<ul> + <li>a single image, which is anchored to the top right of the header area.</li> + <li>A color for the text in the header.</li> +</ul> + +<p>The area your header image needs to fill is a maximum of 200 pixels high. The maximum image width is determined by the resolution of the monitor Firefox is displaying on and how much of the monitor Firefox is using. Practically, this means you would need to allow for a width of up to 5120 pixels wide (for the next generation of 5k monitors). However, rather than creating a very wide image, a better approach is to use a narrower image with a transparent left edge so that it fades to the background color. For example, we could use this image<br> + <img alt="An image of a weta (the common name for a group of about 70 insect species in the families Anostostomatidae and Rhaphidophoridae, endemic to New Zealand) with the left edge fading to total transparency." src="https://mdn.mozillademos.org/files/15215/weta.png" style="height: 200px; width: 406px;"><br> + combined with a complementary background color, to create this effect in the header<br> + <img alt="A single image theme using the weta.png image" src="https://mdn.mozillademos.org/files/15217/basic_theme.png" style="height: 113px; width: 679px;"></p> + +<p>See details about this theme in the <a href="https://github.com/mdn/webextensions-examples/tree/master/themes">themes</a> example <a href="https://github.com/mdn/webextensions-examples/tree/master/themes/weta_fade">weta_fade</a>.</p> + +<p>Obviously, you can still provide a single wide image if you prefer.</p> + +<h4 id="Multiple_image_themes">Multiple image themes</h4> + +<p>As an alternative to creating a single image theme, you have the option to use multiple images. These images can be individually anchored to locations within the header, with the option to apply tiling to each image.</p> + +<p>Depending on the effect you want to create you may need to suppress the mandatory <code>"</code><code>headerURL</code><code>":</code> image with an empty or transparent image. You would use an empty or transparent image if, for example, you wanted to tile a centrally justified image, such as<br> + <img alt="An image of a weta (the common name for a group of about 70 insect species in the families Anostostomatidae and Rhaphidophoridae, endemic to New Zealand) with the left and right edges fading to total transparency." src="https://mdn.mozillademos.org/files/15219/weta_for_tiling.png" style="height: 200px; width: 270px;"><br> + to create this effect<br> + <img alt="A single image theme using the additional images option to align an image to the center of the heading and tile it. " src="https://mdn.mozillademos.org/files/15221/tiled_theme.png" style="height: 113px; width: 679px;"><br> + Here you specify the weta image like this:</p> + +<pre class="brush: json" dir="ltr">"images": { + "headerURL": "empty.png", + "additional_backgrounds": [ "weta_for_tiling.png"] +},</pre> + +<p dir="ltr">and the images tiling with:</p> + +<pre class="brush: json" dir="ltr">"properties": { + "additional_backgrounds_alignment": [ "top" ], + "additional_backgrounds_tiling": [ "repeat" ] +},</pre> + +<p>Full details of how to setup this theme can be found in the <a href="https://github.com/mdn/webextensions-examples/tree/master/themes">themes</a> example <a href="https://github.com/mdn/webextensions-examples/tree/master/themes/weta_tiled">weta_tiled</a>. Full detais of the alignment and tiling options can be found in the <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/theme">"theme" key description</a>.</p> + +<p>Alternatively, you can use multiple images, say combining the original weta image with this one anchored to the left of the header<br> + <img alt="An image of a weta (the common name for a group of about 70 insect species in the families Anostostomatidae and Rhaphidophoridae, endemic to New Zealand) with the right edge fading to total transparency." src="https://mdn.mozillademos.org/files/15223/weta-left.png" style="height: 200px; width: 406px;"><br> + to create this effect<br> + <img alt="A theme using the additional images option to place two mirrored image to the left and right of the browser header." src="https://mdn.mozillademos.org/files/15225/multi_image_theme.png" style="height: 113px; width: 679px;"></p> + +<p>Where the images are specified with:</p> + +<pre class="brush: json" dir="ltr">"images": { + "headerURL": "empty.png", + "additional_backgrounds": [ "weta.png", "weta-left.png"] +},</pre> + +<p dir="ltr">and their alignment by:</p> + +<pre class="brush: json" dir="ltr">"properties": { + "additional_backgrounds_alignment": [ "right top" , "left top" ] +},</pre> + +<p>Full details of how to setup this theme can be found in the <a href="https://github.com/mdn/webextensions-examples/tree/master/themes">themes</a> example <a href="https://github.com/mdn/webextensions-examples/tree/master/themes/weta_mirror">weta_mirror</a>. Full detais of the alignment options can be found in the <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/theme">"theme" key description</a>.</p> + +<h3 id="Static_animated_themes">Static animated themes</h3> + +<p>It is possible to create an animated theme using an APNG format image, as in the <a href="https://github.com/mdn/webextensions-examples/tree/master/themes">themes</a> example <a href="https://github.com/mdn/webextensions-examples/tree/master/themes/animated">animated</a>. However, remember that rapid animations, such as the one in the example might be too distracting for a practical theme.</p> + +<p dir="ltr">You can also animate themes programmatically, which we discuss in <a href="#Dynamic_themes">Dynamic themes</a>.</p> + +<h2 id="Temas_dinâmicos">Temas dinâmicos</h2> + +<p>As an alternative to defining a static theme, you can use the {{WebExtAPIRef("theme")}} API to control the theme used in Firefox from within a browser extension. There are a couple of use cases for this option:</p> + +<ul> + <li>To bundle a theme with a browser extension, as an added extra.</li> + <li>Create a dynamic theme that changes under programmatic control.</li> +</ul> + +<p>And, obviously, you can combine the two and bundle a programmatically controlled theme with your extension.</p> + +<p>Using the {{WebExtAPIRef("theme")}} API is straightforward. First, request "theme"<a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions"> permission</a> in the extension's<a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json"> manifest.json</a> file. Next, you build a JSON object containing the same information you would use in a static theme’s manifest.json, Finally, pass the JSON object in a {{WebExtAPIRef("theme.update()")}} call.</p> + +<p>For example, the following code, from the <a href="https://github.com/mdn/webextensions-examples/tree/master/dynamic-theme">dynamic theme example</a> defines the content for the day and night elements of the dynamic theme:</p> + +<pre class="brush: js" dir="ltr">const themes = { + 'day': { + images: { + headerURL: 'sun.jpg', + }, + colors: { + accentcolor: '#CF723F', + textcolor: '#111', + } + }, + 'night': { + images: { + headerURL: 'moon.jpg', + }, + colors: { + accentcolor: '#000', + textcolor: '#fff', + } + } +};</pre> + +<p>The theme.Theme object is then passed to {{WebExtAPIRef("theme.update()")}} to change the header theme, as in this code snippet from the same example:</p> + +<pre class="brush: js" dir="ltr">function setTheme(theme) { + if (currentTheme === theme) { + // No point in changing the theme if it has already been set. + return; + } + currentTheme = theme; + browser.theme.update(themes[theme]); +}</pre> + +<p dir="ltr">Learn more about dynamic themes and see an additional example in the following video:</p> + +<p dir="ltr">{{EmbedYouTube("ycckyrUN0AY")}}</p> + +<p dir="ltr"> </p> + +<p dir="ltr">If you have not built a browser extension before, check out <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension">Your first extension</a> for a step-by-step guide.</p> + +<h2 id="Compatibilidade_entre_navegadores">Compatibilidade entre navegadores</h2> + +<p>There is currently limited compatibility between themes in the major browsers. Opera takes an entirely different approach, and Microsoft Edge themes are not yet open to developers.</p> + +<p>There is some compatibility between Firefox static themes and Chrome themes, providing the ability to port a single header image theme from Firefox to Chrome. This would be done by amending the manifest.json keys as follows:</p> + +<ul> + <li><code>"headerURL":</code> to <code>"theme_frame":</code></li> + <li><code>"accentcolor":</code> to <code>"frame":</code></li> + <li><code>"textcolor":</code> to <code>"tab_text":</code></li> +</ul> + +<p>Noting that "frame": and "tab_text": support RGB color definition only.</p> + +<p>So, in the single image theme example (weta_fade) could be supported in Chrome using the following manifest.json file:</p> + +<pre class="brush: json" dir="ltr">{ + "manifest_version": 2, + "version": "1.0", + "name": "<your_theme_name>", + "theme": { + "images": { + "theme_frame": "weta.png" + }, + "colors": { + "frame": [ 173 , 176 , 159 ], + "tab_text": [ 0 , 0 , 0 ] + } + } +}</pre> + +<p>However, there will be a couple of differences:</p> + +<ul> + <li>Chrome tiles the <code>“theme_frame”:</code> image from the left of the header area.</li> + <li><code>"tab_text":</code> only affects the text on the highlighted/active tab.</li> +</ul> + +<p dir="ltr"><img alt="The basic theme example using the Chrome compatible manifest.json keys, showing the differences in how those keys are implemented." src="https://mdn.mozillademos.org/files/15227/basic_in_chrome.png" style="height: 113px; width: 679px;"></p> + +<p>For more information, see the notes on <a href="/en-US/Add-ons/WebExtensions/manifest.json/theme#Chrome_compatibility">Chrome compatibility</a>.</p> diff --git a/files/pt-pt/mozilla/add-ons/themes/index.html b/files/pt-pt/mozilla/add-ons/themes/index.html new file mode 100644 index 0000000000..26dfb24673 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/themes/index.html @@ -0,0 +1,49 @@ +--- +title: Temas +slug: Mozilla/Add-ons/Themes +tags: + - Apresentação e Disposição + - Extras + - Temas +translation_of: Mozilla/Add-ons/Themes +--- +<p>{{AddonSidebar}}</p> + +<p>Temas permite-lhe alterar a apresentação e disposição da interface do utilizador e personalizar a seu gosto. Saiba como criar e partilhar os temas!</p> + +<div class="column-container"> +<div class="column-half"> +<h2 class="Documentation" id="Documentation" name="Documentation">Temas de Navegador</h2> + +<dl> + <dt><a href="/en-US/docs/Mozilla/Add-ons/Themes/Theme_concepts">Browser theme concepts</a></dt> + <dd>Get an introduction to creating themes for the latest versions of Firefox</dd> +</dl> + +<h2 class="Documentation" id="Documentation" name="Documentation">Temas Simples</h2> + +<dl> + <dt><a href="/en-US/docs/Themes/Lightweight_themes" title="Themes/Lightweight themes">Lightweight themes</a></dt> + <dd>Building lightweight themes for Firefox</dd> + <dt><a href="/en-US/Add-ons/Themes/Lightweight_Themes/FAQ">Lightweight themes FAQ</a></dt> + <dd>Get answers to commonly asked questions</dd> +</dl> +</div> + +<div class="column-half"> +<h2 id="Ferramentas_e_Recursos">Ferramentas e Recursos</h2> + +<ul> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/theme">Browser theme manifest.json keys</a></li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/theme">Browser extensions theme API</a></li> + <li><a href="http://vanillaorchidstutorials.blogspot.com/2015/11/mozilla-themes-focal-point-sizing.html">Lightweight themes tutorial</a></li> + <li><a href="https://discourse.mozilla.org/c/add-ons/themes">Discourse forum</a></li> + <li><a href="https://blog.mozilla.org/addons/category/personas/">Theme related blog posts</a></li> + <li><a href="/en-US/Mozilla/Add-ons/Themes/Obsolete">Archived resources</a></li> +</ul> +</div> +</div> + +<p> </p> + +<p> </p> diff --git a/files/pt-pt/mozilla/add-ons/themes/obsolete/creating_a_skin_for_firefox/index.html b/files/pt-pt/mozilla/add-ons/themes/obsolete/creating_a_skin_for_firefox/index.html new file mode 100644 index 0000000000..9d187b7315 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/themes/obsolete/creating_a_skin_for_firefox/index.html @@ -0,0 +1,33 @@ +--- +title: Creating a Skin for Firefox +slug: Mozilla/Add-ons/Themes/Obsolete/Creating_a_Skin_for_Firefox +tags: + - Add-ons + - NeedsTranslation + - Themes + - TopicStub +translation_of: Archive/Themes/Creating_a_Skin_for_Firefox +--- +<h2 id="Introduction" name="Introduction">Introduction</h2> + +<p>In order to create a skin for Firefox, there are three things you need to know: how to edit images, how to extract zip files, and how to modify CSS. Firefox uses standard GIF, PNG, and JPEG images for the buttons and CSS to style everything else in the interface.</p> + +<h3 id="What_is_a_skin" name="What_is_a_skin">What is a skin?</h3> + +<p>A skin does not totally change the interface; instead, it just defines how the interface looks. You can't change what happens when the user right clicks on an image, but you can change the look of the right click menu (Make it blue with pink polka dots, for example). If you want to change the functionality of Firefox, you'll have to look into modifying the chrome, which is beyond the scope of this document.</p> + +<h2 id="Contents" name="Contents">Contents</h2> + +<ul> + <li><a href="/en-US/docs/Creating_a_Skin_for_Firefox_Getting_Started">Getting Started</a></li> +</ul> + +<div class="originaldocinfo"> +<h2 id="Original_Document_Information" name="Original_Document_Information">Informações Sobre o Documento Original</h2> +<ul> +<li>Autor(es): Neil Marshall and Tucker Lee</li> +<li>Outros Contribuidores: Brent Marshall, CDN (http://themes.mozdev.org), JP Martin, Boris Zbarsky, Asa Dotzler, WeSaySo, David James, Dan Mauch, Anders Conbere, Tim Regula (http://www.igraphics.nn.cx)</li> +<li>Informações sobre Copyright: Copyright 2002-2003 Neil Marshall, permission given to MDC to migrate into the wiki April 2005 via email.</li> +<li>Original Location: <a class="external" href="http://www.eightlines.com/neil/mozskin" rel="noopener">http://www.eightlines.com/neil/mozskin</a></li> +</ul> +</div> diff --git a/files/pt-pt/mozilla/add-ons/themes/obsolete/index.html b/files/pt-pt/mozilla/add-ons/themes/obsolete/index.html new file mode 100644 index 0000000000..d420b6ebf0 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/themes/obsolete/index.html @@ -0,0 +1,10 @@ +--- +title: Obsolete +slug: Mozilla/Add-ons/Themes/Obsolete +tags: + - NeedsTranslation + - TopicStub +translation_of: Mozilla/Add-ons/Themes/Obsolete +--- +<p>This page collects theme docs that we don't expect will ever be updated, but which we're keeping for the time being as potential source material for updated docs.</p> +<p>{{ ListSubPages ("/en-US/Add-ons/Themes/Obsolete", 5) }}</p> diff --git a/files/pt-pt/mozilla/add-ons/thunderbird/index.html b/files/pt-pt/mozilla/add-ons/thunderbird/index.html new file mode 100644 index 0000000000..b15b535a59 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/thunderbird/index.html @@ -0,0 +1,135 @@ +--- +title: Thunderbird extensions +slug: Mozilla/Add-ons/Thunderbird +tags: + - Add-ons + - Extensions + - NeedsTranslation + - TopicStub + - thunderbird +translation_of: Mozilla/Thunderbird/Thunderbird_extensions +--- +<div class="callout-box"><strong><a href="/en/Extensions/Thunderbird/Building_a_Thunderbird_extension" title="en/Building_a_Thunderbird_extension">Building a Thunderbird extension</a></strong><br> +Step-by-step explanation on how to build an extension for Thunderbird.</div> + +<div> +<p>{{AddonSidebar}}</p> +The following documentation provides help for creating extensions for Mozilla's <a class="internal" href="/en/Thunderbird" title="En/Thunderbird">Thunderbird</a> email client. Although there are many similarities with <a href="/en/Extensions" title="en/Extensions">Firefox extensions</a> there are also some differences that may confound the starting developer.</div> + +<div><br> +<strong>Please help!</strong> You can <a class="internal" href="/en/Extensions/Thunderbird/HowTos" title="en/Extensions/Thunderbird/HowTos">add a how-to</a> (a question or an answer or a code snippet), <a class="internal" href="/en/Extensions/Thunderbird/Useful_newsgroups_discussions" title="En/Extensions/Thunderbird/Useful newsgroups discussions">summarize and link to a relevant newsgroup discussion</a>, or create a tutorial. Need help? Contact <a class="internal" href="/User:jenzed" title="User:jenzed">jenzed</a>.</div> + +<table class="topicpage-table"> + <tbody> + <tr> + <td> + <h2 id="Documentation" name="Documentation"><a href="/Special:Tags?tag=Extensions&language=en" title="Special:Tags?tag=Extensions&language=en">Documentation</a></h2> + + <h3 id="Getting_started_with_Thunderbird">Getting started with Thunderbird</h3> + + <p>A brave, young developer wants to develop an add-on for Thunderbird. Here's a few links to help them through this journey.</p> + + <ul> + <li>Start by reading the tutorial and learn how to<a class="internal" href="/en/Extensions/Thunderbird/Building_a_Thunderbird_extension" title="En/Building a Thunderbird extension"> build a Thunderbird extension</a> (Outdated, still talks about overlays and the add-on builder is no longer available but the tutorial has not been updated.)</li> + <li>Read about the <a href="/en/Thunderbird/Main_Windows" title="Main Windows">main windows</a> so that you know what one means when they say « thread pane », « preview pane », and « folder pane ».</li> + + <li>Want to do some real stuff? See <a class="external" href="http://blog.xulforum.org/index.php?post/2011/03/14/Basic-MimeMessage-demo" title="http://blog.xulforum.org/index.php?post/2011/03/14/Basic-MimeMessage-demo">how to inspect a message</a> (demo add-on included!)</li> + <li>Play with our other <a href="/en/Extensions/Thunderbird/Demo_Addon" title="Demo Addon">demo add-on</a> that exercises some more advanced Thunderbird-specific features</li> + <li>Want to do even more stuff? Don't reinvent the wheel: steal functions from the <a class="link-https" href="https://github.com/protz/thunderbird-stdlib" title="https://github.com/protz/thunderbird-stdlib">thunderbird-stdlib</a> project (doc <a class="external" href="http://protz.github.com/thunderbird-stdlib/doc/symbols/_global_.html" title="http://protz.github.com/thunderbird-stdlib/doc/symbols/_global_.html">here</a>). Functions for dealing with messages (delete them, archive them, change their tags, etc.) are included.</li> + <li>Haven't found what you're looking for? Read the <a class="internal" href="/en/Extensions/Thunderbird/HowTos" rel="internal" title="en/Extensions/Thunderbird/HowTos">Thunderbird how-tos</a>; they contain a lot of recipes for things extensions want to do.</li> + <li>Still haven't managed to do what you wanted? See the list of all <a class="external" href="http://wiki.mozilla.org/Thunderbird/CommunicationChannels" title="http://wiki.mozilla.org/Thunderbird/CommunicationChannels">Thunderbird communication channels </a>so that you know where to ask when you get stuck :-).</li> + <li>Feeling really brave? Read the source using a <a class="external" href="http://doxygen.db48x.net/comm-central/html/" title="http://doxygen.db48x.net/comm-central/html/">fancy interface</a>; you can often find tests that demonstrate how to do what you're trying to achieve.</li> + </ul> + + <h3 id="The_Gloda_database">The Gloda database</h3> + + <p>Thunderbird has a subsystem called Gloda. Gloda stands for « Global Database », and creates Thunderbird-wide relations between objects. Gloda provides concepts such as Conversations, Messages, Identities, Contacts. All these concepts are related together: a Conversation contains Messages which are linked to Identities (<strong>from</strong> field, <strong>to</strong> field) which are themselves part of a Contact: indeed, a contact has multiple identities.</p> + + <p>Typical use cases for Gloda: find all messages whose subject matches [search term], find all messages from [person], find all messages in the same thread as [a given message], find all messages involving [person], etc. etc.</p> + + <p>Gloda is extremely powerful and is used heavily by add-ons such as <a class="link-https" href="https://addons.mozilla.org/en-US/thunderbird/addon/gmail-conversation-view/" title="https://addons.mozilla.org/en-US/thunderbird/addon/gmail-conversation-view/">Thunderbird Conversations</a>. Learn more about Gloda:</p> + + <ul> + <li>an overview of <a href="/en/Thunderbird/gloda" title="Gloda">Gloda</a></li> + <li>learn how to create <a href="/en/Thunderbird/Creating_a_Gloda_message_query" title="Creating a gloda message query">your first message query</a> and read the <a href="/en/Thunderbird/Gloda_examples" title="Gloda examples">gloda examples</a></li> + <li>learn about the Gloda internals: <a href="/en/Thunderbird/Gloda_debugging" title="Gloda debugging">Gloda debugging</a>, <a href="/en/Thunderbird/Gloda_indexing" title="Gloda indexing">Gloda indexing</a></li> + </ul> + + <h3 id="More_Thunderbird-specific_links">More Thunderbird-specific links</h3> + + <p>Some of these links may be wildly out of date, but they still provide valuable information on the codebase.</p> + + <ul> + <li><a class="internal" href="/en/Extensions/Thunderbird/An_overview_of_the_Thunderbird_interface" title="En/Extensions/Thunderbird/An overview of the Thunderbird interface">An overview of Thunderbird components</a></li> + <li><a class="internal" href="/en/Extensions/Thunderbird/Thunderbird_developer_reference_docs" title="en/Extensions/Thunderbird/Thunderbird developer reference docs">Developer reference docs</a>: + <ul> + <li><a class="internal" href="/en/Folders" title="En/Folders">Folder classes</a></li> + <li><a class="internal" href="/en/DB_Views_(message_lists)" title="En/DB Views (message lists)">DB views (message list)</a></li> + <li><a class="internal" href="/en/Message_Summary_Database" title="En/Message Summary Database">Message summary database</a></li> + <li><a class="internal" href="/en/MailNews_Protocols" title="En/MailNews Protocols">MailNews protocols</a></li> + <li><a class="internal" href="/En/MailNews_Filters" rel="internal" title="En/MailNews Filters">MailNews filters</a></li> + <li><a class="internal" href="/en/Extensions/Thunderbird/Error_reporting_tools" title="en/Extension Library/Extensions/Thunderbird/Error reporting tools">Error reporting tools</a></li> + <li><a href="/en/Toolkit_API/STEEL" title="en/Toolkit API/STEEL">STEEL library</a> (obsolete as of Thunderbird 52, use <a class="link-https" href="https://github.com/protz/thunderbird-stdlib" title="https://github.com/protz/thunderbird-stdlib">https://github.com/protz/thunderbird-stdlib</a>)</li> + <li><a class="external" href="http://quetzalcoatal.blogspot.com/2010/01/developing-new-account-types-part-0.html" title="http://quetzalcoatal.blogspot.com/2010/01/developing-new-account-types-part-0.html">Developing new account types</a> <strong>NEW!</strong></li> + </ul> + </li> + <li><a class="internal" href="/en/Extensions/Thunderbird/Useful_newsgroups_discussions" title="En/Extensions/Thunderbird/Useful newsgroups discussions">Useful newsgroup discussions</a> (watch out, anything that's too old should be regarded suspiciously; there's been significant API rewrite over the past years, and most of these techniques are considerably easier now) </li> + <li><a href="/en/Thunderbird/Thunderbird_API_documentation" title="en/Thunderbird/Thunderbird API documentation">Thunderbird API docs</a> (mostly a collection of out-of-date pages, relevance is rather dubious) </li> + <li><a href="/en/Mozilla/Thunderbird/Releases" title="Thunderbird developer release notes">Thunderbird developer release notes</a> - changes in the recent Thunderbird updates affecting add-on developers. <a href="/Thunderbird_5_for_developers" title="Thunderbird 5 for developers">Thunderbird 5 for developers</a> has important information on MsgHdrToMimeMessage which is a central piece of code.</li> + </ul> + + <h3 id="General_links">General links</h3> + + <ul> + <li><a href="/en/Extensions/Thunderbird/Finding_the_code_for_a_feature" title="en/Extensions/Thunderbird/Finding the code for a feature">Finding the code for a feature</a></li> + <li><a class="external" href="http://kb.mozillazine.org/Category:Thunderbird" title="http://kb.mozillazine.org/Category:Thunderbird">Mozillazine articles on Thunderbird</a></li> + <li><a href="/Special:Tags?tag=Thunderbird" title="https://developer.mozilla.org/Special:Tags?tag=Thunderbird">All pages tagged with Thunderbird</a></li> + <li><a href="/Special:Tags?tag=MailNews" title="https://developer.mozilla.org/Special:Tags?tag=MailNews">All pages tagged with MailNews</a></li> + </ul> + </td> + <td> + <h2 id="Community" name="Community">Community</h2> + + <ul> + <li>See the list of all <a class="external" href="http://wiki.mozilla.org/Thunderbird/CommunicationChannels" title="http://wiki.mozilla.org/Thunderbird/CommunicationChannels">Thunderbird communication channels </a>first</li> + <li>Among these are:</li> + </ul> + + <p>{{ DiscussionList("dev-extensions", "mozilla.dev.extensions") }}</p> + + <ul> + <li><a class="link-irc" href="irc://moznet/#extdev">#extdev IRC channel</a> / <a class="link-irc" href="irc://moznet/#maildev">#maildev IRC channel</a></li> + <li><a class="external" href="http://forums.mozillazine.org/viewforum.php?f=19">MozillaZine forum</a></li> + <li><a class="external" href="http://mozdev.org/mailman/listinfo/project_owners">mozdev project owners</a></li> + <li><a href="/en/Extensions/Community" title="en/Extensions/Community">Other community links...</a></li> + </ul> + + <h2 id="Tools" name="Tools">Tools</h2> + + <ul> + <li><a class="link-https" href="https://addons.mozilla.org/en-US/firefox/addon/6622" rel="external nofollow" title="https://addons.mozilla.org/en-US/firefox/addon/6622">DOM Inspector</a> edit the live DOM (Firefox and Thunderbird)</li> + <li><a class="link-https" href="https://addons.mozilla.org/thunderbird/addon/workspace-for-thunderbird/" title="https://addons.mozilla.org/thunderbird/addon/workspace-for-thunderbird/">Workspace for Thunderbird</a>, allows running code snippets in Thunderbird and inspecting variable structure and content</li> + <li><a class="external" href="http://www.hacksrus.com/~ginda/venkman/" rel="external nofollow" title="http://www.hacksrus.com/~ginda/venkman/">Venkman</a>, a JavaScript debugger (<a class="external" href="http://addons.mozilla.org/en-US/firefox/addon/216" rel="external nofollow" title="http://addons.mozilla.org/en-US/firefox/addon/216">Firefox</a>, <a class="external" href="http://addons.mozilla.org/en-US/thunderbird/addon/216" rel="external nofollow" title="http://addons.mozilla.org/en-US/thunderbird/addon/216">Thunderbird</a>)</li> + <li><a class="link-https" href="https://addons.mozilla.org/en-US/firefox/addon/7434/" rel="external nofollow" title="https://addons.mozilla.org/en-US/firefox/addon/7434/">Extension Developer's Extension</a> a suite of development tools</li> + <li><a class="external" href="http://www.gijsk.com/" rel="external nofollow" title="http://www.gijsk.com/">Chrome List</a> view files in chrome:// (<a class="external" href="http://addons.mozilla.org/en-US/firefox/addon/4453" rel="external nofollow" title="http://addons.mozilla.org/en-US/firefox/addon/4453">Firefox</a>, <a class="external" href="http://addons.mozilla.org/en-US/thunderbird/addon/4453" rel="external nofollow" title="http://addons.mozilla.org/en-US/thunderbird/addon/4453">Thunderbird</a>)</li> + <li><a href="/en/Mozmill" title="en/Mozmill">Mozmill</a> test tool and framework</li> + <li><a class="external" href="http://xpcomviewer.mozdev.org/" rel="external nofollow" title="http://xpcomviewer.mozdev.org">XPCOMViewer</a> an XPCOM inspector (Firefox and Thunderbird)</li> + </ul> + + <p>... <a class="internal" href="/en/Setting_up_extension_development_environment#Development_extensions" title="en/Setting up extension development environment#Development extensions">more tools</a> ...</p> + + <p><span class="alllinks"><a href="/Special:Tags?tag=Extensions:Tools&language=en" title="Special:Tags?tag=Extensions:Tools&language=en">View All...</a></span></p> + + <h2 id="Related_Topics" name="Related_Topics">Related Topics</h2> + + <dl> + <dd><a href="/en/XUL" title="en/XUL">XUL</a>, <a href="/en/JavaScript" title="en/JavaScript">JavaScript</a>, <a href="/en/XPCOM" title="en/XPCOM">XPCOM</a>, <a href="/en/Themes" title="en/Themes">Themes</a>, <a href="/En/Developer_Guide" title="en/Developing_Mozilla">Developing Mozilla</a></dd> + </dl> + </td> + </tr> + </tbody> +</table> + +<p><span class="comment">Categories</span></p> + +<p>{{ languages( { "ja": "ja/Extensions/Thunderbird" } ) }}</p> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/a_sua_primeira_extensao/index.html b/files/pt-pt/mozilla/add-ons/webextensions/a_sua_primeira_extensao/index.html new file mode 100644 index 0000000000..21b34f2e2c --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/a_sua_primeira_extensao/index.html @@ -0,0 +1,153 @@ +--- +title: A sua primeira extensão +slug: Mozilla/Add-ons/WebExtensions/A_sua_primeira_extensao +tags: + - Extensões da Web + - Guía +translation_of: Mozilla/Add-ons/WebExtensions/Your_first_WebExtension +--- +<div>{{AddonSidebar}}</div> + +<p>Neste artigo, nós iremos abordar a criação de uma extensão para o Firefox, do início até ao fim. A extensão adiciona apenas um contorno vermelho a qualquer página carregada de 'mozilla.org' ou qualquer um dos seus subdomínios.</p> + +<p>O código fonte para este exemplo está no GitHub: <em><a href="https://github.com/mdn/webextensions-examples/tree/master/borderify">borderify</a></em>.</p> + +<p>Primeiro, precisa de ter o Firefox - versão 45 ou superior.</p> + +<h2 id="Escrever_a_extensão">Escrever a extensão</h2> + +<p>Crie uma nova diretoria e vá para a mesma:</p> + +<pre class="brush: bash">mkdir borderify +cd borderify</pre> + +<h3 id="manifest.json">manifest.json</h3> + +<p>Now create a new file called "manifest.json" directly under the "borderify" directory. Give it the following contents:</p> + +<pre class="brush: json">{ + + "manifest_version": 2, + "name": "Borderify", + "version": "1.0", + + "description": "Adds a red border to all webpages matching mozilla.org.", + + "icons": { + "48": "icons/border-48.png" + }, + + "content_scripts": [ + { + "matches": ["*://*.mozilla.org/*"], + "js": ["borderify.js"] + } + ] + +}</pre> + +<ul> + <li>The first three keys: <code><a href="/en-US/Add-ons/WebExtensions/manifest.json/manifest_version">manifest_version</a></code>, <code><a href="/en-US/Add-ons/WebExtensions/manifest.json/name">name</a></code>, and <code><a href="/en-US/Add-ons/WebExtensions/manifest.json/version">version</a></code>, are mandatory and contain basic metadata for the extension.</li> + <li><code><a href="/en-US/Add-ons/WebExtensions/manifest.json/description">description</a></code> is optional, but recommended: it's displayed in the Add-ons Manager.</li> + <li><code><a href="/en-US/Add-ons/WebExtensions/manifest.json/icons">icons</a></code> is optional, but recommended: it allows you to specify an icon for the extension, that will be shown in the Add-ons Manager.</li> +</ul> + +<p>The most interesting key here is <code><a href="/en-US/Add-ons/WebExtensions/manifest.json/content_scripts">content_scripts</a></code>, which tells Firefox to load a script into Web pages whose URL matches a specific pattern. In this case, we're asking Firefox to load a script called "borderify.js" into all HTTP or HTTPS pages served from "mozilla.org" or any of its subdomains.</p> + +<ul> + <li><a href="/en-US/Add-ons/WebExtensions/Content_scripts">Learn more about content scripts.</a></li> + <li><a href="/en-US/Add-ons/WebExtensions/Match_patterns">Learn more about match patterns</a>.</li> +</ul> + +<div class="warning"> +<p><a href="/en-US/Add-ons/WebExtensions/WebExtensions_and_the_Add-on_ID#When_do_you_need_an_Add-on_ID">In some situations you need to specify an ID for your extension</a>. If you do need to specify an add-on ID, include the <code><a href="/en-US/Add-ons/WebExtensions/manifest.json/applications">applications</a></code> key in <code>manifest.json</code> and set its <code>gecko.id</code> property:</p> + +<pre class="brush: json">"applications": { + "gecko": { + "id": "borderify@example.com" + } +}</pre> +</div> + +<h3 id="iconsborder-48.png">icons/border-48.png</h3> + +<p>The extension should have an icon. This will be shown next to the extension's listing in the Add-ons Manager. Our manifest.json promised that we would have an icon at "icons/border-48.png".</p> + +<p>Create the "icons" directory directly under the "borderify" directory. Save an icon there named "border-48.png". You could use <a href="https://github.com/mdn/webextensions-examples/blob/master/borderify/icons/border-48.png">the one from our example</a>, which is taken from the Google Material Design iconset, and is used under the terms of the <a href="https://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike</a> license.</p> + +<p>If you choose to supply your own icon, It should be 48x48 pixels. You could also supply a 96x96 pixel icon, for high-resolution displays, and if you do this it will be specified as the <code>96</code> property of the <code>icons</code> object in manifest.json:</p> + +<pre class="brush: json">"icons": { + "48": "icons/border-48.png", + "96": "icons/border-96.png" +}</pre> + +<p>Alternatively, you could supply an SVG file here, and it will be scaled correctly. (Though: if you're using SVG and your icon includes text, you may want to use your SVG editor's "convert to path" tool to flatten the text, so that it scales with a consistent size/position.)</p> + +<ul> + <li><a href="/pt-PT/Add-ons/WebExtensions/manifest.json/icones">Saiba mais sobre a especificação de ícones (icons).</a></li> +</ul> + +<h3 id="borderify.js">borderify.js</h3> + +<p>Finally, create a file called "borderify.js" directly under the "borderify" directory. Give it this content:</p> + +<pre class="brush: js">document.body.style.border = "5px solid red";</pre> + +<p>This script will be loaded into the pages that match the pattern given in the <code>content_scripts</code> manifest.json key. The script has direct access to the document, just like scripts loaded by the page itself.</p> + +<ul> + <li><a href="/en-US/Add-ons/WebExtensions/Content_scripts">Learn more about content scripts.</a></li> +</ul> + +<h2 id="Testá-la">Testá-la</h2> + +<p>Primeiro, reverifique que tem os ficheiros corretos nos locais certos:</p> + +<pre>borderify/ + icons/ + border-48.png + borderify.js + manifest.json</pre> + +<h3 id="Instalar">Instalar</h3> + +<p>Open "about:debugging" in Firefox, click "Load Temporary Add-on" and select any file in your extension's directory:</p> + +<p>{{EmbedYouTube("cer9EUKegG4")}}</p> + +<p>The extension will now be installed, and will stay until you restart Firefox.</p> + +<p>Alternatively, you can run the extension from the command line using the <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Getting_started_with_web-ext">web-ext</a> tool.</p> + +<h3 id="Testar">Testar</h3> + +<p>Now try visiting a page under "mozilla.org", and you should see the red border round the page:</p> + +<p>{{EmbedYouTube("rxBQl2Z9IBQ")}}</p> + +<div class="note"> +<p>Don't try it on addons.mozilla.org, though! Content scripts are currently blocked on that domain.</p> +</div> + +<p>Try experimenting a bit. Edit the content script to change the color of the border, or do something else to the page content. Save the content script, then reload the extensions's files by clicking the "Reload" button in about:debugging. You can see the changes right away:</p> + +<p>{{EmbedYouTube("NuajE60jfGY")}}</p> + +<ul> + <li><a href="/en-US/Add-ons/WebExtensions/Temporary_Installation_in_Firefox">Learn more about loading extensions</a></li> +</ul> + +<h2 id="Empacotar_e_publicação">Empacotar e publicação</h2> + +<p>Para que as outras pessoas utilizem a sua extensão, precisa de empacotá-la e enviá-la para a assinar na Mozilla. Para saber mais sobre isto, consulte <a href="/pt-PT/Add-ons/WebExtensions/Publicar_a_sua_extensao">"Publicar a sua extensão"</a>.</p> + +<h2 id="E_a_seguir">E a seguir?</h2> + +<p>Agora tem uma idéia do processo de desenvolvimento de uma <strong>Extensão da Web</strong> para o Firefox, tente:</p> + +<ul> + <li><a href="/en-US/Add-ons/WebExtensions/Anatomy_of_a_WebExtension">reading more about the anatomy of an extension</a></li> + <li><a href="/en-US/Add-ons/WebExtensions/Your_second_WebExtension">writing a more complex extension</a></li> + <li><a href="/en-US/Add-ons/WebExtensions/API">reading about the JavaScript APIs available for extensions.</a></li> +</ul> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/a_sua_segunda_extensao/index.html b/files/pt-pt/mozilla/add-ons/webextensions/a_sua_segunda_extensao/index.html new file mode 100644 index 0000000000..503f2b4ae9 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/a_sua_segunda_extensao/index.html @@ -0,0 +1,460 @@ +--- +title: A sua segunda extensão +slug: Mozilla/Add-ons/WebExtensions/A_sua_segunda_extensao +tags: + - Extensões da Web +translation_of: Mozilla/Add-ons/WebExtensions/Your_second_WebExtension +--- +<div>{{AddonSidebar}} +<p>Se já leu o artigo da <a href="/pt-PT/Add-ons/WebExtensions/A_sua_primeira_extensao">A sua primeira extens</a>ão, já tem uma ideia de como escrever uma extensão. Neste artigo, nós iremos escrever uma extensão um pouco mais complexa que demonstra algumas mais das APIs. <br> + <br> + A extensão adiciona um novo botão à barra de ferramentas do Firefox. Quando o utilizador clica no botão, nós exibimos uma janela que lhes permite escolher um animal. Uma vez que eles escolhem um animal, nós iremos substituir o conteúdo da página atual com uma fotografia do animal escolhido. <br> + <br> + Para implementar isto, nós iremos:.</p> + +<p>To implement this, we will:</p> + +<ul> + <li><strong>define a <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Browser_action">browser action</a>, which is a button attached to the Firefox toolbar</strong>.<br> + For the button we'll supply: + <ul> + <li>an icon, called "beasts-32.png"</li> + <li>a popup to open when the button is pressed. The popup will include HTML, CSS, and JavaScript.</li> + </ul> + </li> + <li><strong>define an icon for the extension</strong>, called "beasts-48.png". This will be shown in the Add-ons Manager.</li> + <li><strong>write a content script, "beastify.js" that will be injected into web pages</strong>.<br> + This is the code that will actually modify the pages.</li> + <li><strong>package some images of the animals, to replace images in the web page</strong>.<br> + We'll make the images "web accessible resources" so the web page can refer to them.</li> +</ul> + +<p>You could visualise the overall structure of the extension like this:</p> + +<p><img alt="" src="https://mdn.mozillademos.org/files/13671/Untitled-1.png" style="display: block; height: 1200px; margin-left: auto; margin-right: auto; width: 860px;"></p> + +<p>It's a simple extension, but shows many of the basic concepts of the WebExtensions API:</p> + +<ul> + <li>adding a button to the toolbar</li> + <li>defining a popup panel using HTML, CSS, and JavaScript</li> + <li>injecting content scripts into web pages</li> + <li>communicating between content scripts and the rest of the extension</li> + <li>packaging resources with your extension that can be used by web pages</li> +</ul> + +<p>You can find <a href="https://github.com/mdn/webextensions-examples/tree/master/beastify">complete source code for the extension on GitHub</a>.</p> + +<p>To write this extension, you'll need Firefox 45 or newer.</p> + +<h2 id="Escrever_a_extensão">Escrever a extensão</h2> + +<p>Create a new directory and navigate to it:</p> + +<pre class="brush: bash">mkdir beastify +cd beastify</pre> + +<h3 id="manifest.json">manifest.json</h3> + +<p>Now create a new file called "manifest.json", and give it the following contents:</p> + +<pre class="brush: json">{ + + "manifest_version": 2, + "name": "Beastify", + "version": "1.0", + + "description": "Adds a browser action icon to the toolbar. Click the button to choose a beast. The active tab's body content is then replaced with a picture of the chosen beast. See https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Examples#beastify", + "homepage_url": "https://github.com/mdn/webextensions-examples/tree/master/beastify", + "icons": { + "48": "icons/beasts-48.png" + }, + + "permissions": [ + "activeTab" + ], + + "browser_action": { + "default_icon": "icons/beasts-32.png", + "default_title": "Beastify", + "default_popup": "popup/choose_beast.html" + }, + + "web_accessible_resources": [ + "beasts/frog.jpg", + "beasts/turtle.jpg", + "beasts/snake.jpg" + ] + +} +</pre> + +<ul> + <li>The first three keys: <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/manifest_version">manifest_version</a></code>, <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/name">name</a></code>, and <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/version">version</a></code>, are mandatory and contain basic metadata for the extension.</li> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/description">description</a></code> and <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/homepage_url">homepage_url</a></code> are optional, but recommended: they provide useful information about the extension.</li> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/icons">icons</a></code> is optional, but recommended: it allows you to specify an icon for the extension, that will be shown in the Add-ons Manager.</li> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions">permissions</a></code> lists permissions the extension needs. We're just asking for the <a href="/en-US/Add-ons/WebExtensions/manifest.json/permissions#activeTab_permission"><code>activeTab</code> permission</a> here.</li> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_action">browser_action</a></code> specifies the toolbar button. We're supplying three pieces of information here: + <ul> + <li><code>default_icon</code> is mandatory, and points to the icon for the button</li> + <li><code>default_title</code> is optional, and will be shown in a tooltip</li> + <li><code>default_popup</code> is used if you want a popup to be shown when the user clicks the button. We do, so we've included this key and made it point to an HTML file included with the extension.</li> + </ul> + </li> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/web_accessible_resources">web_accessible_resources</a></code> lists files that we want to make accessible to web pages. Since the extension replaces the content in the page with images we've packaged with the extension, we need to make these images accessible to the page.</li> +</ul> + +<p>Note that all paths given are relative to manifest.json itself.</p> + +<h3 id="O_ícone">O ícone</h3> + +<p>The extension should have an icon. This will be shown next to the extension's listing in the Add-ons Manager (you can open this by visiting the URL "about:addons"). Our manifest.json promised that we would have an icon for the toolbar at "icons/beasts-48.png".</p> + +<p>Create the "icons" directory and save an icon there named "beasts-48.png". You could use <a href="https://github.com/mdn/webextensions-examples/blob/master/beastify/icons/beasts-48.png">the one from our example</a>, which is taken from the <a href="https://www.iconfinder.com/iconsets/free-retina-icon-set">Aha-Soft’s Free Retina iconset</a>, and used under the terms of its <a href="http://www.aha-soft.com/free-icons/free-retina-icon-set/">license</a>.</p> + +<p>If you choose to supply your own icon, It should be 48x48 pixels. You could also supply a 96x96 pixel icon, for high-resolution displays, and if you do this it will be specified as the <code>96</code> property of the <code>icons</code> object in manifest.json:</p> + +<pre class="brush: json line-numbers language-json"><code class="language-json"><span class="key token">"icons":</span> <span class="punctuation token">{</span> + <span class="key token">"48":</span> <span class="string token">"icons/beasts-48.png"</span><span class="punctuation token">,</span> + <span class="key token">"96":</span> <span class="string token">"icons/beasts-96.png"</span> +<span class="punctuation token">}</span></code></pre> + +<h3 id="O_botão_de_barra_de_ferramentas">O botão de barra de ferramentas</h3> + +<p>The toolbar button also needs an icon, and our manifest.json promised that we would have an icon for the toolbar at "icons/beasts-32.png".</p> + +<p>Save an icon named "beasts-32.png" in the "icons" directory. You could use <a href="https://github.com/mdn/webextensions-examples/blob/master/beastify/icons/beasts-32.png">the one from our example</a>, which is taken from the <a href="http://www.iconbeast.com/free">IconBeast Lite icon set</a> and used under the terms of its <a href="http://www.iconbeast.com/faq/">license</a>.</p> + +<p>If you don't supply a popup, then a click event is dispatched to your extension when the user clicks the button. If you do supply a popup, the click event is not dispatched, but instead, the popup is opened. We want a popup, so let's create that next.</p> + +<h3 id="A_janela_(popup)">A janela (popup)</h3> + +<p>The function of the popup is to enable the user to choose one of three beasts.</p> + +<p>Create a new directory called "popup" under the extension root. This is where we'll keep the code for the popup. The popup will consist of three files:</p> + +<ul> + <li><strong><code>choose_beast.html</code></strong> defines the content of the panel</li> + <li><strong><code>choose_beast.css</code></strong> styles the content</li> + <li><strong><code>choose_beast.js</code></strong> handles the user's choice by running a content script in the active tab</li> +</ul> + +<pre class="brush: bash">mkdir popup +cd popup +touch choose_beast.html choose_beast.css choose_beast.js +</pre> + +<h4 id="choose_beast.html">choose_beast.html</h4> + +<p>The HTML file looks like this:</p> + +<pre class="brush: html"><!DOCTYPE html> + +<html> + <head> + <meta charset="utf-8"> + <link rel="stylesheet" href="choose_beast.css"/> + </head> + +<body> + <div id="popup-content"> + <div class="button beast">Frog</div> + <div class="button beast">Turtle</div> + <div class="button beast">Snake</div> + <div class="button reset">Reset</div> + </div> + <div id="error-content" class="hidden"> + <p>Can't beastify this web page.</p><p>Try a different page.</p> + </div> + <script src="choose_beast.js"></script> +</body> + +</html> +</pre> + +<p>We have a <code><a href="/en-US/docs/Web/HTML/Element/div"><div></a></code> element with an ID of <code>"popup-content"</code> that contains an element for each animal choice. We have another <code><div></code> with an ID of <code>"error-content"</code> and a class <code>"hidden"</code>. We'll use that in case there's a problem initializing the popup.</p> + +<p>Note that we include the CSS and JS files from this file, just like a web page.</p> + +<h4 id="choose_beast.css">choose_beast.css</h4> + +<p>The CSS fixes the size of the popup, ensures that the three choices fill the space, and gives them some basic styling. It also hides elements with <code>class="hidden"</code>: this means that our <code>"error-content"</code> <code><div></code> will be hidden by default.</p> + +<pre class="brush: css">html, body { + width: 100px; +} + +.hidden { + display: none; +} + +.button { + margin: 3% auto; + padding: 4px; + text-align: center; + font-size: 1.5em; + cursor: pointer; +} + +.beast:hover { + background-color: #CFF2F2; +} + +.beast { + background-color: #E5F2F2; +} + +.reset { + background-color: #FBFBC9; +} + +.reset:hover { + background-color: #EAEA9D; +} + +</pre> + +<h4 id="choose_beast.js">choose_beast.js</h4> + +<p>Here's the JavaScript for the popup:</p> + +<pre class="brush: js">/** + * CSS to hide everything on the page, + * except for elements that have the "beastify-image" class. + */ +const hidePage = `body > :not(.beastify-image) { + display: none; + }`; + +/** + * Listen for clicks on the buttons, and send the appropriate message to + * the content script in the page. + */ +function listenForClicks() { + document.addEventListener("click", (e) => { + + /** + * Given the name of a beast, get the URL to the corresponding image. + */ + function beastNameToURL(beastName) { + switch (beastName) { + case "Frog": + return browser.extension.getURL("beasts/frog.jpg"); + case "Snake": + return browser.extension.getURL("beasts/snake.jpg"); + case "Turtle": + return browser.extension.getURL("beasts/turtle.jpg"); + } + } + + /** + * Insert the page-hiding CSS into the active tab, + * then get the beast URL and + * send a "beastify" message to the content script in the active tab. + */ + function beastify(tabs) { + browser.tabs.insertCSS({code: hidePage}).then(() => { + let url = beastNameToURL(e.target.textContent); + browser.tabs.sendMessage(tabs[0].id, { + command: "beastify", + beastURL: url + }); + }); + } + + /** + * Remove the page-hiding CSS from the active tab, + * send a "reset" message to the content script in the active tab. + */ + function reset(tabs) { + browser.tabs.removeCSS({code: hidePage}).then(() => { + browser.tabs.sendMessage(tabs[0].id, { + command: "reset", + }); + }); + } + + /** + * Just log the error to the console. + */ + function reportError(error) { + console.error(`Could not beastify: ${error}`); + } + + /** + * Get the active tab, + * then call "beastify()" or "reset()" as appropriate. + */ + if (e.target.classList.contains("beast")) { + browser.tabs.query({active: true, currentWindow: true}) + .then(beastify) + .catch(reportError); + } + else if (e.target.classList.contains("reset")) { + browser.tabs.query({active: true, currentWindow: true}) + .then(reset) + .catch(reportError); + } + }); +} + +/** + * There was an error executing the script. + * Display the popup's error message, and hide the normal UI. + */ +function reportExecuteScriptError(error) { + document.querySelector("#popup-content").classList.add("hidden"); + document.querySelector("#error-content").classList.remove("hidden"); + console.error(`Failed to execute beastify content script: ${error.message}`); +} + +/** + * When the popup loads, inject a content script into the active tab, + * and add a click handler. + * If we couldn't inject the script, handle the error. + */ +browser.tabs.executeScript({file: "/content_scripts/beastify.js"}) +.then(listenForClicks) +.catch(reportExecuteScriptError); + +</pre> + +<p>The place to start here is line 96. The popup script executes a content script in the active tab as soon as the popup is loaded, using the <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/executeScript">browser.tabs.executeScript()</a></code> API. If executing the content script is successful, then the content script will stay loaded in the page until the tab is closed or the user navigates to a different page.</p> + +<p>A common reason the <code>browser.tabs.executeScript()</code> call might fail is that you can't execute content scripts in all pages. For example, you can't execute them in privileged browser pages like about:debugging, and you can't execute them on pages in the <a href="https://addons.mozilla.org/">addons.mozilla.org</a> domain. If it does fail, <code>reportExecuteScriptError()</code> will hide the <code>"popup-content"</code> <code><div></code>, show the <code>"error-content"</code> <code><div></code>, and log an error to the <a href="/en-US/Add-ons/WebExtensions/Debugging">console</a>.</p> + +<p>If executing the content script is successful, we call <code>listenForClicks()</code>. This listens for clicks on the popup.</p> + +<ul> + <li>If the click was on a button with <code>class="beast"</code>, then we call <code>beastify()</code>.</li> + <li>If the click was on a button with <code>class="reset"</code>, then we call <code>reset()</code>.</li> +</ul> + +<p>The <code>beastify()</code> function does three things:</p> + +<ul> + <li>map the button clicked to a URL pointing to an image of a particular beast</li> + <li>hide the page's whole content by injecting some CSS, using the <code><a href="/en-US/Add-ons/WebExtensions/API/tabs/insertCSS">browser.tabs.insertCSS()</a></code> API</li> + <li>send a "beastify" message to the content script using the <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/sendMessage">browser.tabs.sendMessage()</a></code> API, asking it to beastify the page, and passing it the URL to the beast image.</li> +</ul> + +<p>The <code>reset()</code> function essentially undoes a beastify:</p> + +<ul> + <li>remove the CSS we added, using the <code><a href="/en-US/Add-ons/WebExtensions/API/tabs/removeCSS">browser.tabs.removeCSS()</a></code> API</li> + <li>send a "reset" message to the content script asking it to reset the page.</li> +</ul> + +<h3 id="O_script_de_conteúdo">O <em>script</em> de conteúdo</h3> + +<p>Create a new directory, under the extension root, called "content_scripts" and create a new file in it called "beastify.js", with the following contents:</p> + +<pre class="brush: js">(function() { + /** + * Check and set a global guard variable. + * If this content script is injected into the same page again, + * it will do nothing next time. + */ + if (window.hasRun) { + return; + } + window.hasRun = true; + + /** + * Given a URL to a beast image, remove all existing beasts, then + * create and style an IMG node pointing to + * that image, then insert the node into the document. + */ + function insertBeast(beastURL) { + removeExistingBeasts(); + let beastImage = document.createElement("img"); + beastImage.setAttribute("src", beastURL); + beastImage.style.height = "100vh"; + beastImage.className = "beastify-image"; + document.body.appendChild(beastImage); + } + + /** + * Remove every beast from the page. + */ + function removeExistingBeasts() { + let existingBeasts = document.querySelectorAll(".beastify-image"); + for (let beast of existingBeasts) { + beast.remove(); + } + } + + /** + * Listen for messages from the background script. + * Call "beastify()" or "reset()". + */ + browser.runtime.onMessage.addListener((message) => { + if (message.command === "beastify") { + insertBeast(message.beastURL); + } else if (message.command === "reset") { + removeExistingBeasts(); + } + }); + +})(); +</pre> + +<p>The first thing the content script does is to check for a global variable <code>window.hasRun</code>: if it's set the script returns early, otherwise it sets <code>window.hasRun</code> and continues. The reason we do this is that every time the user opens the popup, the popup executes a content script in the active tab, so we could have multiple instances of the script running in a single tab. If this happens, we need to make sure that only the first instance is actually going to do anything.</p> + +<p>After that, the place to start is line 40, where the content script listens for messages from the popup, using the <code><a href="/en-US/Add-ons/WebExtensions/API/runtime/onMessage">browser.runtime.onMessage</a></code> API. We saw above that the popup script can send two different sorts of messages: "beastify" and "reset".</p> + +<ul> + <li>if the message is "beastify", we expect it to contain a URL pointing to a beast image. We remove any beasts that might have been added by previous "beastify" calls, then construct and append an <code><a href="/en-US/docs/Web/HTML/Element/img"><img></a></code> element whose <code>src</code> attribute is set to the beast URL.</li> + <li>if the message is "reset", we just remove any beasts that might have been added.</li> +</ul> + +<h3 id="As_feras">As feras</h3> + +<p>Finally, we need to include the images of the beasts.</p> + +<p>Create a new directory called "beasts", and add the three images in that directory, with the appropriate names. You can get the images from <a href="https://github.com/mdn/webextensions-examples/tree/master/beastify/beasts">the GitHub repository</a>, or from here:</p> + +<p><img alt="" src="https://mdn.mozillademos.org/files/11459/frog.jpg" style="display: inline-block; height: 200px; margin: 20px; width: 200px;"><img alt="" src="https://mdn.mozillademos.org/files/11461/snake.jpg" style="display: inline-block; height: 200px; margin: 20px; width: 200px;"><img alt="" src="https://mdn.mozillademos.org/files/11463/turtle.jpg" style="display: inline-block; height: 200px; margin: 20px; width: 200px;"></p> + +<h2 id="Testar_a_extensão">Testar a extensão</h2> + +<p>First, double check that you have the right files in the right places:</p> + +<pre>beastify/ + + beasts/ + frog.jpg + snake.jpg + turtle.jpg + + content_scripts/ + beastify.js + + icons/ + beasts-32.png + beasts-48.png + + popup/ + choose_beast.css + choose_beast.html + choose_beast.js + + manifest.json</pre> + +<p>Starting in Firefox 45, you can install extensions temporarily from disk.</p> + +<p>Open "about:debugging" in Firefox, click "Load Temporary Add-on", and select your manifest.json file. You should then see the extension's icon appear in the Firefox toolbar:</p> + +<p>{{EmbedYouTube("sAM78GU4P34")}}</p> + +<p>Open a web page, then click the icon, select a beast, and see the web page change:</p> + +<p>{{EmbedYouTube("YMQXyAQSiE8")}}</p> + +<h2 id="Programae_a_partir_da_linha_de_comando">Programae a partir da linha de comando</h2> + +<p>Pode automatizar o passo da instalação temporária utilizando a ferramenta <a href="/pt-PT/Add-ons/WebExtensions/Primeiros_passos_com_web-ext">web-ext</a>. Experimente isto:</p> + +<pre class="brush: bash">cd beastify +web-ext run</pre> +</div> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/anatomia_de_uma_extensao/index.html b/files/pt-pt/mozilla/add-ons/webextensions/anatomia_de_uma_extensao/index.html new file mode 100644 index 0000000000..ecad403ae1 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/anatomia_de_uma_extensao/index.html @@ -0,0 +1,135 @@ +--- +title: Anatomia de uma extensão +slug: Mozilla/Add-ons/WebExtensions/Anatomia_de_uma_extensao +tags: + - Extensões da Web +translation_of: Mozilla/Add-ons/WebExtensions/Anatomy_of_a_WebExtension +--- +<div>{{AddonSidebar}}</div> + +<p>Uma extensão consiste numa coleção de ficheiros, empacotados para distribuição e instalação. Neste artigo, nós passaremos rapidamente pelos ficheiros que podem estar presentes numa extensão.</p> + +<h2 id="manifest.json">manifest.json</h2> + +<p>This is the only file that must be present in every extension. It contains basic metadata such as its name, version and the permissions it requires. It also provides pointers to other files in the extension.</p> + +<p>This manifest can also contain pointers to several other types of files:</p> + +<ul> + <li><a href="/en-US/Add-ons/WebExtensions/Anatomy_of_a_WebExtension#Background_scripts">Background pages</a>: Implement long-running logic.</li> + <li>Icons for the extension and any buttons it might define.</li> + <li><a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Anatomy_of_a_WebExtension#Sidebars_popups_options_pages">Sidebars, popups, and options pages</a>: HTML documents that provide content for various user interface components.</li> + <li><a href="/en-US/Add-ons/WebExtensions/Anatomy_of_a_WebExtension#Content_scripts">Content scripts</a>: JavaScript included with your extension, that you will inject into web pages.</li> +</ul> + +<p><img alt="" src="https://mdn.mozillademos.org/files/13669/webextension-anatomy.png" style="display: block; height: 581px; margin-left: auto; margin-right: auto; width: 600px;"></p> + +<p>See the <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json">manifest.json</a> reference page for all the details.</p> + +<p>Other than those referenced from the manifest, an extension can include additional <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Anatomy_of_a_WebExtension#Extension_pages">Extension pages</a> with supporting files.</p> + +<h2 id="Scripts_de_fundo_(segundo_plano)"><em>Scripts</em> de fundo (segundo plano)</h2> + +<p>Extensions often need to maintain long-term state or perform long-term operations independently of the lifetime of any particular web page or browser window. That is what background scripts are for.</p> + +<p>Background scripts are loaded as soon as the extension is loaded and stay loaded until the extension is disabled or uninstalled. You can use any of the <a href="/en-US/Add-ons/WebExtensions/API">WebExtension APIs</a> in the script, as long as you have requested the necessary <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions">permissions</a>.</p> + +<h3 id="Especificar_os_scripts_de_fundo">Especificar os <em>scripts</em> de fundo</h3> + +<p>You can include a background script using the <code>background</code> key in "manifest.json":</p> + +<pre class="brush: json">// manifest.json + +"background": { + "scripts": ["background-script.js"] +}</pre> + +<p>You can specify multiple background scripts: if you do, they run in the same context, just like multiple scripts that are loaded into a single web page.</p> + +<h3 id="Ambiente_de_script_de_fundo">Ambiente de <em>script</em> de fundo</h3> + +<h4 id="APIS_de_DOM">APIS de DOM</h4> + +<p>Background scripts run in the context of special pages called background pages. This gives them a <code><a href="/en-US/docs/Web/API/Window">window</a></code> global, along with all the standard DOM APIs provided by that object.</p> + +<p>You do not have to supply your background page. If you include a background script, an empty background page will be created for you.</p> + +<p>However, you can choose to supply your background page as a separate HTML file:</p> + +<pre class="brush: json">// manifest.json + +"background": { + "page": "background-page.html" +}</pre> + +<h4 id="APIs_da_Extensão_da_Web">APIs da Extensão da Web</h4> + +<p>Background scripts can use any of the <a href="/en-US/Add-ons/WebExtensions/API">WebExtension APIs</a> in the script, as long as their extension has the necessary <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions">permissions</a>.</p> + +<h4 id="Acesso_cruzado_da_origem">Acesso cruzado da origem</h4> + +<p>Background scripts can make XHR requests to any hosts for which they have <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions">host permissions</a>.</p> + +<h4 id="Conteúdo_da_Web">Conteúdo da Web</h4> + +<p>Background scripts do not get direct access to web pages. However, they can load <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts">content scripts</a> into web pages and can <a href="/en-US/Add-ons/WebExtensions/Content_scripts#Communicating_with_background_scripts">communicate with these content scripts using a message-passing API</a>.</p> + +<h4 id="Política_de_segurança_do_conteúdo">Política de segurança do conteúdo</h4> + +<p>Background scripts are restricted from certain potentially dangerous operations, like the use of <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval">eval()</a></code>, through a Content Security Policy. See <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_Security_Policy">Content Security Policy</a> for more details on this.</p> + +<h2 id="Barras_laterais_janelas_(popups)_opções_de_páginas">Barras laterais, janelas (popups), opções de páginas</h2> + +<p>A sua extensão pode inclur vários componentes da interface do utilizador cujo conteúdo é definido utilizando um documento HTML:</p> + +<ul> + <li>uma <a href="/pt-PT/Add-ons/WebExtensions/interface_do_utilizador/Barras_laterais">barra lateral</a> é um painel que é exibido no lado esquerdo da janela do navegador, junto à página da <em>web</em></li> + <li>uma <a href="/pt-PT/Add-ons/WebExtensions/interface_do_utilizador/Popups">janela (popup</a>) é uma janela que pode exibir quando o utilizador clica num <a href="/pt-PT/Add-ons/WebExtensions/interface_do_utilizador/A%C3%A7%C3%A3o_navegador">botão da barra de ferramentas</a> ou <a href="/pt-PT/Add-ons/WebExtensions/interface_do_utilizador/Acoes_pagina">botão da barra de endereço</a></li> + <li>uma <a href="/pt-PT/Add-ons/WebExtensions/interface_do_utilizador/Options_pages">página de opções </a>é uma página que é mostrada quando o utilizador acede ao seu extra de preferências no gestor de extras nativo do navegador</li> +</ul> + +<p>For each of these components, you create an HTML file and point to it using a specific property in <a href="/pt-PT/Add-ons/WebExtensions/manifest.json">manifest.json</a>. The HTML file can include CSS and JavaScript files, just like a normal web page.</p> + +<p>All of these are a type of <a href="/pt-PT/Add-ons/WebExtensions/interface_do_utilizador/Paginas_de_extens%C3%A3o">Extension pages</a>, and unlike a normal web page, your JavaScript can use all the same privileged WebExtension APIs as your background script. They can even directly access variables in the background page using {{WebExtAPIRef("runtime.getBackgroundPage()")}}.</p> + +<h2 id="Páginas_de_extensão">Páginas de extensão</h2> + +<p>You can also include HTML documents in your extension which are not attached to some predefined user interface component. Unlike the documents you might provide for sidebars, popups, or options pages, these don't have an entry in manifest.json. However, they do also get access to all the same privileged WebExtension APIs as your background script.</p> + +<p>You'd typically load a page like this using {{WebExtAPIRef("windows.create()")}} or {{WebExtAPIRef("tabs.create()")}}.</p> + +<p>See <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Extension_pages">Extension pages</a> to learn more.</p> + +<h2 id="Scripts_de_conteúdo"><em>Scripts</em> de conteúdo</h2> + +<p>Use content scripts to access and manipulate web pages. Content scripts are loaded into web pages and run in the context of that particular page.</p> + +<p>Content scripts are extension-provided scripts which run in the context of a web page; this differs from scripts which are loaded by the page itself, including those which are provided in {{HTMLElement("script")}} elements within the page.</p> + +<p>Content scripts can see and manipulate the page's DOM, just like normal scripts loaded by the page.</p> + +<p>Unlike normal page scripts, they can:</p> + +<ul> + <li>Make cross-domain XHR requests.</li> + <li>Use a small subset of the <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API">WebExtension APIs</a>.</li> + <li>Exchange messages with their background scripts and can in this way indirectly access all the WebExtension APIs.</li> +</ul> + +<p>Content scripts cannot directly access normal page scripts but can exchange messages with them using the standard <code><a href="/en-US/docs/Web/API/Window/postMessage">window.postMessage()</a></code> API.</p> + +<p>Usually, when we talk about content scripts, we are referring to JavaScript, but you can inject CSS into web pages using the same mechanism.</p> + +<p>See the <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts">content scripts</a> article to learn more.</p> + +<h2 id="Recursos_de_acessibilidade_da_Web">Recursos de acessibilidade da Web</h2> + +<p>Web accessible resources are resources such as images, HTML, CSS, and JavaScript that you include in the extension and want to make accessible to content scripts and page scripts. Resources which are made web-accessible can be referenced by page scripts and content scripts using a special URI scheme.</p> + +<p>For example, if a content script wants to insert some images into web pages, you could include them in the extension and make them web accessible. Then the content script could create and append <code><a href="/en-US/docs/Web/HTML/Element/img">img</a></code> tags which reference the images via the <code>src</code> attribute.</p> + +<p>To learn more, see the documentation for the <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/web_accessible_resources">web_accessible_resources</a> manifest.json key.</p> + +<p> </p> + +<p> </p> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/api/armazenamento/index.html b/files/pt-pt/mozilla/add-ons/webextensions/api/armazenamento/index.html new file mode 100644 index 0000000000..d267faf520 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/api/armazenamento/index.html @@ -0,0 +1,105 @@ +--- +title: Armazenamento +slug: Mozilla/Add-ons/WebExtensions/API/Armazenamento +tags: + - API + - Armazenamento + - Extensões + - Extensões da Web + - Extras + - Interface + - Não Padrão + - Referencia +translation_of: Mozilla/Add-ons/WebExtensions/API/storage +--- +<div>{{AddonSidebar}}</div> + +<p>Permite que as extensões armazenem e recuperem dados, e escutem as alterações aos itens armazenados.</p> + +<p>O sistema de armazenamento é baseado na <a href="/pt-PT/docs/Web/API/API_de_Armazenamento_da_Web">API de Armazenamento da Web</a>, com algumas diferenças. Entre outras diferençãs, estas incluem:</p> + +<ul> + <li>It's asynchronous.</li> + <li>Values are scoped to the extension, not to a specific domain (i.e. the same set of key/value pairs are available to all scripts in the background context and content scripts).</li> + <li>The values stored can be any JSON-ifiable value, not just <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code>. Among other things, this includes: <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></code> and <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code>, but only when their contents can can be represented as JSON, which does not include DOM nodes. You don't need to convert your values to JSON <code>Strings</code> prior to storing them, but they are represented as JSON internally, thus the requirement that they be JSON-ifiable.</li> + <li>Multiple key/value pairs can be set or retrieved in the same API call.</li> +</ul> + +<p>To use this API you need to include the "storage" <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions">permission</a> in your <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json">manifest.json</a> file.</p> + +<p>Each extension has its own storage area, which can be split into different types of storage.</p> + +<p>Although this API is similar to {{domxref("Window.localStorage")}} it is recommended that you don't use <code>Window.localStorage</code> in the extension code to store extension-related data. Firefox will clear data stored by extensions using the localStorage API in various scenarios where users clear their browsing history and data for privacy reasons, while data saved using the <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage/local">storage.local</a></code> API will be correctly persisted in these scenarios.</p> + +<h2 id="Tipos">Tipos</h2> + +<dl> + <dt>{{WebExtAPIRef("storage.StorageArea")}}</dt> + <dd>An object representing a storage area.</dd> + <dt>{{WebExtAPIRef("storage.StorageChange")}}</dt> + <dd>An object representing a change to a storage area.</dd> +</dl> + +<h2 id="Propriedades">Propriedades</h2> + +<p><code>storage</code> has three properties, which represent the different types of available storage area.</p> + +<dl> + <dt>{{WebExtAPIRef("storage.sync")}}</dt> + <dd>Represents the <code>sync</code> storage area. Items in <code>sync</code> storage are synced by the browser, and are available across all instances of that browser that the user is logged into, across different devices.</dd> + <dt>{{WebExtAPIRef("storage.local")}}</dt> + <dd>Represents the <code>local</code> storage area. Items in <code>local</code> storage are local to the machine the extension was installed on.</dd> + <dt>{{WebExtAPIRef("storage.managed")}}</dt> + <dd>Represents the <code>managed</code> storage area. Items in <code>managed</code> storage are set by the domain administrator and are read-only for the extension. Trying to modify this namespace results in an error.</dd> +</dl> + +<h2 id="Eventos">Eventos</h2> + +<dl> + <dt>{{WebExtAPIRef("storage.onChanged")}}</dt> + <dd>Fired when one or more items change in a storage area.</dd> +</dl> + +<h2 id="Compatibilidade_do_navegador">Compatibilidade do navegador</h2> + +<p>{{Compat("webextensions.api.storage")}}</p> + +<p>{{WebExtExamples("h2")}}</p> + +<div class="note"><strong>Reconehcimentos</strong> + +<p>This API is based on Chromium's <a href="https://developer.chrome.com/extensions/storage"><code>chrome.storage</code></a> API. This documentation is derived from <a href="https://chromium.googlesource.com/chromium/src/+/master/extensions/common/api/storage.json"><code>storage.json</code></a> in the Chromium code.</p> + +<p>Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.</p> +</div> + +<div class="hidden"> +<pre>// Copyright 2015 The Chromium Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +</pre> +</div> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/api/browseraction/index.html b/files/pt-pt/mozilla/add-ons/webextensions/api/browseraction/index.html new file mode 100644 index 0000000000..2b520684db --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/api/browseraction/index.html @@ -0,0 +1,127 @@ +--- +title: Ação do navegador +slug: Mozilla/Add-ons/WebExtensions/API/browserAction +tags: + - API + - Ação do navegador + - Extensões + - Extensões da Web + - Extras + - Interface + - Não Padrão + - Referencia +translation_of: Mozilla/Add-ons/WebExtensions/API/browserAction +--- +<div>{{AddonSidebar}}</div> + +<p>Adiciona um botão à barra de ferramentas do navegador.</p> + +<p>Uma <a href="/pt-PT/Add-ons/WebExtensions/interface_do_utilizador/Ação_navegador">ação do navegador </a>é um botão na barra de ferramentas do navegador.</p> + +<p>You can associate a popup with the button. The popup is specified using HTML, CSS and JavaScript, just like a normal web page. JavaScript running in the popup gets access to all the same WebExtension APIs as your background scripts, but its global context is the popup, not the current page displayed in the browser. To affect web pages you need to communicate with them via <a href="/en-US/Add-ons/WebExtensions/Modify_a_web_page#Messaging">messages</a>.</p> + +<p>If you specify a popup, it will be shown — and the content will be loaded — when the user clicks the icon. If you do not specify a popup, then when the user clicks the icon an event is dispatched to your extension.</p> + +<p>You can define most of a browser action's properties declaratively using the <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_action">browser_action</a></code> key in the manifest.json.</p> + +<p>With the <code>browserAction</code> API, you can:</p> + +<ul> + <li>use {{WebExtAPIRef("browserAction.onClicked")}} to listen for clicks on the icon.</li> + <li>get and set the icon's properties — icon, title, popup, and so on. You can get and set these globally across all tabs, or for a specific tab by passing the tab ID as an additional argument.</li> +</ul> + +<h2 id="Tipos">Tipos</h2> + +<dl> + <dt>{{WebExtAPIRef("browserAction.ColorArray")}}</dt> + <dd>An array of four integers in the range 0-255 defining an RGBA color.</dd> + <dt>{{WebExtAPIRef("browserAction.ImageDataType")}}</dt> + <dd>Pixel data for an image. Must be an <code><a href="/en-US/docs/Web/API/ImageData">ImageData</a></code> object (for example, from a {{htmlelement("canvas")}} element).</dd> +</dl> + +<h2 id="Funções">Funções</h2> + +<dl> + <dt>{{WebExtAPIRef("browserAction.setTitle()")}}</dt> + <dd>Sets the browser action's title. This will be displayed in a tooltip.</dd> + <dt>{{WebExtAPIRef("browserAction.getTitle()")}}</dt> + <dd>Gets the browser action's title.</dd> + <dt>{{WebExtAPIRef("browserAction.setIcon()")}}</dt> + <dd>Sets the browser action's icon.</dd> + <dt>{{WebExtAPIRef("browserAction.setPopup()")}}</dt> + <dd>Sets the HTML document to be opened as a popup when the user clicks on the browser action's icon.</dd> + <dt>{{WebExtAPIRef("browserAction.getPopup()")}}</dt> + <dd>Gets the HTML document set as the browser action's popup.</dd> + <dt>{{WebExtAPIRef("browserAction.openPopup()")}}</dt> + <dd>Open the browser action's popup.</dd> + <dt>{{WebExtAPIRef("browserAction.setBadgeText()")}}</dt> + <dd>Sets the browser action's badge text. The badge is displayed on top of the icon.</dd> + <dt>{{WebExtAPIRef("browserAction.getBadgeText()")}}</dt> + <dd>Gets the browser action's badge text.</dd> + <dt>{{WebExtAPIRef("browserAction.setBadgeBackgroundColor()")}}</dt> + <dd>Sets the badge's background color.</dd> + <dt>{{WebExtAPIRef("browserAction.getBadgeBackgroundColor()")}}</dt> + <dd>Gets the badge's background color.</dd> + <dt>{{WebExtAPIRef("browserAction.enable()")}}</dt> + <dd>Enables the browser action for a tab. By default, browser actions are enabled for all tabs.</dd> + <dt>{{WebExtAPIRef("browserAction.disable()")}}</dt> + <dd>Disables the browser action for a tab, meaning that it cannot be clicked when that tab is active.</dd> +</dl> + +<h2 id="Eventos">Eventos</h2> + +<dl> + <dt>{{WebExtAPIRef("browserAction.onClicked")}}</dt> + <dd>Fired when a browser action icon is clicked. This event will not fire if the browser action has a popup.</dd> +</dl> + +<h2 id="Compatibilidade_de_navegador">Compatibilidade de navegador</h2> + +<p>{{Compat("webextensions.api.browserAction")}}</p> + +<div class="hidden note"> +<p>The "Chrome incompatibilities" section is included from <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities"> https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities</a> using the <a href="/en-US/docs/Template:WebExtChromeCompat">WebExtChromeCompat</a> macro.</p> + +<p>If you need to update this content, edit <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities">https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities</a>, then shift-refresh this page to see your changes.</p> +</div> + +<p>{{WebExtExamples("h2")}}</p> + +<div class="note"><strong>Reconhecimentos</strong> + +<p>This API is based on Chromium's <a href="https://developer.chrome.com/extensions/browserAction"><code>chrome.browserAction</code></a> API. This documentation is derived from <a href="https://chromium.googlesource.com/chromium/src/+/master/chrome/common/extensions/api/browser_action.json"><code>browser_action.json</code></a> in the Chromium code.</p> + +<p>Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.</p> +</div> + +<div class="hidden"> +<pre>// Copyright 2015 The Chromium Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +</pre> +</div> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/api/browsingdata/index.html b/files/pt-pt/mozilla/add-ons/webextensions/api/browsingdata/index.html new file mode 100644 index 0000000000..14dbd68d3a --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/api/browsingdata/index.html @@ -0,0 +1,130 @@ +--- +title: browsingData +slug: Mozilla/Add-ons/WebExtensions/API/browsingData +tags: + - API + - Add-ons + - Extensions + - NeedsTranslation + - Non-standard + - Reference + - TopicStub + - WebExtensions + - browsingData +translation_of: Mozilla/Add-ons/WebExtensions/API/browsingData +--- +<div>{{AddonSidebar}}</div> + +<p>Enables extensions to clear the data that is accumulated while the user is browsing.</p> + +<p>In the <code>browsingData</code> API, browsing data is divided into types:</p> + +<ul> + <li>browser cache</li> + <li>cookies</li> + <li>downloads</li> + <li>history</li> + <li>local storage</li> + <li>plugin data</li> + <li>saved form data</li> + <li>saved passwords</li> +</ul> + +<p>You can use the {{WebExtAPIRef("browsingData.remove()")}} function to remove any combination of these types. There are also dedicated functions to remove each particular type of data, such as {{WebExtAPIRef("browsingData.removePasswords()", "removePasswords()")}}, {{WebExtAPIRef("browsingData.removeHistory()", "removeHistory()")}} and so on.</p> + +<p>All the <code>browsingData.remove[X]()</code> functions take a {{WebExtAPIRef("browsingData.RemovalOptions")}} object, which you can use to control two further aspects of data removal:</p> + +<ul> + <li>how far back in time to remove data</li> + <li>whether to remove data only from normal web pages, or also from hosted web apps and add-ons. Note that this option is not yet supported in Firefox.</li> +</ul> + +<p>Finally, this API gives you a {{WebExtAPIRef("browsingData.settings()")}} function that gives you the current value of the settings for the browser's built-in "Clear History" feature.</p> + +<p>To use this API you must have the "browsingData" <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/permissions#API_permissions">API permission</a>.</p> + +<h2 id="Types">Types</h2> + +<dl> + <dt>{{WebExtAPIRef("browsingData.DataTypeSet")}}</dt> + <dd>Object used to specify the type of data to remove: for example, history, downloads, passwords, and so on.</dd> + <dt>{{WebExtAPIRef("browsingData.RemovalOptions")}}</dt> + <dd>Object used to specify how far back in time to remove data, and whether to remove data added through normal web browsing, by hosted apps, or by add-ons.</dd> +</dl> + +<h2 id="Methods">Methods</h2> + +<dl> + <dt>{{WebExtAPIRef("browsingData.remove()")}}</dt> + <dd>Removes browsing data for the data types specified.</dd> + <dt>{{WebExtAPIRef("browsingData.removeCache()")}}</dt> + <dd>Clears the browser's cache.</dd> + <dt>{{WebExtAPIRef("browsingData.removeCookies()")}}</dt> + <dd>Removes cookies.</dd> + <dt>{{WebExtAPIRef("browsingData.removeDownloads()")}}</dt> + <dd>Removes the list of downloaded files.</dd> + <dt>{{WebExtAPIRef("browsingData.removeFormData()")}}</dt> + <dd>Clears saved form data.</dd> + <dt>{{WebExtAPIRef("browsingData.removeHistory()")}}</dt> + <dd>Clears the browser's history.</dd> + <dt>{{WebExtAPIRef("browsingData.removeLocalStorage()")}}</dt> + <dd>Clears any <a href="/en-US/docs/Web/API/Window/localStorage">local storage</a> created by websites.</dd> + <dt>{{WebExtAPIRef("browsingData.removePasswords()")}}</dt> + <dd>Clears saved passwords.</dd> + <dt>{{WebExtAPIRef("browsingData.removePluginData()")}}</dt> + <dd>Clears data associated with plugins.</dd> + <dt>{{WebExtAPIRef("browsingData.settings()")}}</dt> + <dd>Gets the current value of settings in the browser's "Clear History" feature.</dd> +</dl> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + + + +<p>{{Compat("webextensions.api.browsingData", 2)}}</p> + +<div class="note hidden"> +<p>The "Chrome incompatibilities" section is included from <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities"> https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities</a> using the <a href="/en-US/docs/Template:WebExtChromeCompat">WebExtChromeCompat</a> macro.</p> + +<p>If you need to update this content, edit <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities">https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities</a>, then shift-refresh this page to see your changes.</p> +</div> + +<p>{{WebExtExamples("h2")}}</p> + +<div class="note"><strong>Acknowledgements</strong> + +<p>This API is based on Chromium's <a href="https://developer.chrome.com/extensions/browsingData"><code>chrome.browsingData</code></a> API.</p> + +<p>Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.</p> +</div> + +<div class="hidden"> +<pre>// Copyright 2015 The Chromium Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +</pre> +</div> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/api/browsingdata/removeplugindata/index.html b/files/pt-pt/mozilla/add-ons/webextensions/api/browsingdata/removeplugindata/index.html new file mode 100644 index 0000000000..e67f9b8c70 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/api/browsingdata/removeplugindata/index.html @@ -0,0 +1,124 @@ +--- +title: browsingData.removePluginData() +slug: Mozilla/Add-ons/WebExtensions/API/browsingData/removePluginData +tags: + - API + - Dados de navegação + - Extensões + - Extensões da Web + - Extras + - Referencia + - metodo + - remover Dados do Plug-in +translation_of: Mozilla/Add-ons/WebExtensions/API/browsingData/removePluginData +--- +<div>{{AddonSidebar()}}</div> + +<p>Limpa dados guardados nos plug-ins do navegador.</p> + +<p>Pode utilizar o parâmetro <code>removalOptions</code>, que é um objeto {{WebExtAPIRef("browsingData.RemovalOptions")}}, para:</p> + +<ul> + <li>limpar apenas os dados do plug-in guardados depois de algum tempo</li> + <li>controlar se deve limpar apenas os dados guardados pelos plug-ins em execução nas páginas da Web normais ou limpar os dados guardados pelos plug-ins em execução nas aplicações hospedadas e também nas extensões.</li> +</ul> + +<p>Esta é uma função assíncrona que retorna um <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a></code>.</p> + +<h2 id="Sintaxe">Sintaxe</h2> + +<pre class="syntaxbox brush:js">var removing = browser.browsingData.removePluginData( + removalOptions // RemovalOptions object +) +</pre> + +<h3 id="Parâmetros">Parâmetros</h3> + +<dl> + <dt><code>removalOptions</code></dt> + <dd><code>object</code>. A {{WebExtAPIRef("browsingData.RemovalOptions")}} object, which may be used to clear only plugin data stored after a given time, and whether to clear only data stored by plugins running in normal web pages or to clear data stored by plugins running in hosted apps and extensions as well.</dd> +</dl> + +<h3 id="Devolver_valor">Devolver valor</h3> + +<p>A <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a></code> that will be fulfilled with no arguments when the removal has finished. If any error occurs, the promise will be rejected with an error message.</p> + +<h2 id="Compatibilidade_de_navegador">Compatibilidade de navegador</h2> + +<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> + +<p>{{Compat("webextensions.api.browsingData.removePluginData")}}</p> + +<h2 id="Exemplos">Exemplos</h2> + +<p>Remove data stored by plugins in the last week:</p> + +<pre class="brush: js">function onRemoved() { + console.log("removed"); +} + +function onError(error) { + console.error(error); +} + +function weekInMilliseconds() { + return 1000 * 60 * 60 * 24 * 7; +} + +var oneWeekAgo = (new Date()).getTime() - weekInMilliseconds(); + +browser.browsingData.removePluginData({since: oneWeekAgo}). +then(onRemoved, onError);</pre> + +<p>Remove all data stored by plugins:</p> + +<pre class="brush: js">function onRemoved() { + console.log("removed"); +} + +function onError(error) { + console.error(error); +} + +browser.browsingData.removePluginData({}). +then(onRemoved, onError);</pre> + +<p>{{WebExtExamples}}</p> + +<div class="note"><strong>Reconhecimentos</strong> + +<p>This API is based on Chromium's <a href="https://developer.chrome.com/extensions/browsingData"><code>chrome.browsingData</code></a> API.</p> + +<p>Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.</p> +</div> + +<div class="hidden"> +<pre>// Copyright 2015 The Chromium Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +</pre> +</div> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/api/devtools.panels/index.html b/files/pt-pt/mozilla/add-ons/webextensions/api/devtools.panels/index.html new file mode 100644 index 0000000000..ebeb53d591 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/api/devtools.panels/index.html @@ -0,0 +1,103 @@ +--- +title: devtools.panels +slug: Mozilla/Add-ons/WebExtensions/API/devtools.panels +tags: + - API + - Extensões + - Extensões da Web + - Extras + - Referencia + - devtools.panels +translation_of: Mozilla/Add-ons/WebExtensions/API/devtools.panels +--- +<div>{{AddonSidebar}}</div> + +<div class="note"> +<p>Embora as APIs sejam baseadas no <a href="https://developer.chrome.com/extensions/devtools">Chrome devtools APIs</a>, ainda existem muitas funcionalidades que ainda não estão implementadas no Firefox, e por isso, não estão documentadas aqui. Para ver quais as funcionalidades que estão atualmente em falta, por favor, consulte <a href="/pt-PT/Add-ons/WebExtensions/Extensão_das_ferramentas_de_desenvolvimento#Limitações_das_APIs_de_devtools">Limitações das APIs de devtools</a>.</p> +</div> + +<p>The <code>devtools.panels</code> API lets a devtools extension define its user interface inside the devtools window.</p> + +<p>The devtools window hosts a number of separate tools - the JavaScript Debugger, Network Monitor, and so on. A row of tabs across the top lets the user switch between the different tools. The window hosting each tool's user interface is called a "panel".</p> + +<p>With the <code>devtools.panels</code> API you can create new panels in the devtools window.</p> + +<p>Like all the <code>devtools</code> APIs, this API is only available to code running in the document defined in the <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/devtools_page">devtools_page</a> manifest.json key, or in other devtools documents created by the extension (such as the panel's own document). See <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Extending_the_developer_tools">Extending the developer tools</a> for more.</p> + +<h2 id="Tipos">Tipos</h2> + +<dl> + <dt><code><a href="/en-US/Add-ons/WebExtensions/API/devtools.panels/ElementsPanel">devtools.panels.ElementsPanel</a></code></dt> + <dd>Represents the HTML/CSS inspector in the browser's devtools.</dd> + <dt><code><a href="/en-US/Add-ons/WebExtensions/API/devtools.panels/ExtensionPanel">devtools.panels.ExtensionPanel</a></code></dt> + <dd>Represents a devtools panel created by the extension.</dd> + <dt><code><a href="/en-US/Add-ons/WebExtensions/API/devtools.panels/ExtensionSidebarPane">devtools.panels.ExtensionSidebarPane</a></code></dt> + <dd>Represents a pane that an extension has added to the HTML/CSS inspector in the browser's devtools.</dd> +</dl> + +<h2 id="Propriedades">Propriedades</h2> + +<dl> + <dt><code><a href="/en-US/Add-ons/WebExtensions/API/devtools.panels/elements">devtools.panels.elements</a></code></dt> + <dd>A reference to an <code><a href="/en-US/Add-ons/WebExtensions/API/devtools.panels/ElementsPanel">ElementsPanel</a></code> object.</dd> + <dt><code><a href="/en-US/Add-ons/WebExtensions/API/devtools.panels/themeName">devtools.panels.themeName</a></code></dt> + <dd>The name of the current devtools theme.</dd> +</dl> + +<h2 id="Funções">Funções</h2> + +<dl> + <dt><code><a href="/en-US/Add-ons/WebExtensions/API/devtools.panels/create">devtools.panels.create()</a></code></dt> + <dd>Creates a new devtools panel.</dd> +</dl> + +<h2 id="Eventos">Eventos</h2> + +<dl> + <dt><code><a href="/en-US/Add-ons/WebExtensions/API/devtools.panels/onThemeChanged">devtools.panels.onThemeChanged</a></code></dt> + <dd>Fired when the devtools theme changes.</dd> +</dl> + +<h2 id="Compatibilidade_do_navegador">Compatibilidade do navegador</h2> + +<p>{{Compat("webextensions.api.devtools.panels", 2)}}</p> + +<p>{{WebExtExamples("h2")}}</p> + +<div class="note"><strong>Reconhecimentos</strong> + +<p>This API is based on Chromium's <a href="https://developer.chrome.com/extensions/devtools_panels"><code>chrome.devtools.panels</code></a> API.</p> + +<p>Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.</p> +</div> + +<div class="hidden"> +<pre>// Copyright 2015 The Chromium Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +</pre> +</div> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/api/i18n/index.html b/files/pt-pt/mozilla/add-ons/webextensions/api/i18n/index.html new file mode 100644 index 0000000000..824e2eb308 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/api/i18n/index.html @@ -0,0 +1,93 @@ +--- +title: i18n +slug: Mozilla/Add-ons/WebExtensions/API/i18n +tags: + - API + - Extensões + - Extensões da Web + - Extras + - Não Padrão + - Referencia + - i18n +translation_of: Mozilla/Add-ons/WebExtensions/API/i18n +--- +<div>{{AddonSidebar}}</div> + +<p>Funções para a internationalizar a sua extensão. Pode utilizar estas APIs para ter as suas <em>strings</em> traduzidas dos ficheiros de localização empacotados com a sua extensão, descubra o idioma atual do navegador e descubra o valor do seu <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Content_negotiation#The_Accept-Language_header">cabeçalho Accept-Language</a>.</p> + +<p id="See_also">Para mais detalhes em como utilizar i18n para sua extensão, consulte:</p> + +<ul> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Internationalization">Internationalization</a>: a guide to using the WebExtension i18n system.</li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/i18n/Locale-Specific_Message_reference">Locale-Specific Message reference</a>: extensions supply locale-specific strings in files called <code>messages.json</code>. This page describes the format of <code>messages.json</code>.</li> +</ul> + +<h2 id="Tipos">Tipos</h2> + +<dl> + <dt>{{WebExtAPIRef("i18n.LanguageCode")}}</dt> + <dd>A <a href="https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.10">language tag</a> such as <code>"en-US"</code> or "<code>fr</code>".</dd> +</dl> + +<h2 id="Funções">Funções</h2> + +<dl> + <dt>{{WebExtAPIRef("i18n.getAcceptLanguages()")}}</dt> + <dd>Gets the <a href="/en-US/docs/Web/HTTP/Content_negotiation#The_Accept-Language_header">accept-languages</a> of the browser. This is different from the locale used by the browser. To get the locale, use {{WebExtAPIRef('i18n.getUILanguage')}}.</dd> + <dt>{{WebExtAPIRef("i18n.getMessage()")}}</dt> + <dd>Gets the localized string for the specified message.</dd> + <dt>{{WebExtAPIRef("i18n.getUILanguage()")}}</dt> + <dd>Gets the UI language of the browser. This is different from {{WebExtAPIRef('i18n.getAcceptLanguages')}} which returns the preferred user languages.</dd> + <dt>{{WebExtAPIRef("i18n.detectLanguage()")}}</dt> + <dd>Detects the language of the provided text using the <a href="https://github.com/CLD2Owners/cld2">Compact Language Detector</a>.</dd> +</dl> + +<dl> +</dl> + +<h2 id="Compatibilidade_de_navegador">Compatibilidade de navegador</h2> + +<p>{{Compat("webextensions.api.i18n")}}</p> + +<p>{{WebExtExamples("h2")}}</p> + +<dl> +</dl> + +<div class="note"><strong>Agradecimentos</strong> + +<p>This API is based on Chromium's <a href="https://developer.chrome.com/extensions/i18n"><code>chrome.i18n</code></a> API. This documentation is derived from <a href="https://chromium.googlesource.com/chromium/src/+/master/chrome/common/extensions/api/i18n.json"><code>i18n.json</code></a> in the Chromium code.</p> + +<p>Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.</p> +</div> + +<div class="hidden"> +<pre>// Copyright 2015 The Chromium Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +</pre> +</div> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/api/index.html b/files/pt-pt/mozilla/add-ons/webextensions/api/index.html new file mode 100644 index 0000000000..24e8c119a7 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/api/index.html @@ -0,0 +1,13 @@ +--- +title: APIs de JavaScript +slug: Mozilla/Add-ons/WebExtensions/API +translation_of: Mozilla/Add-ons/WebExtensions/API +--- +<div>{{AddonSidebar}}</div> + +<div>{{SubpagesWithSummaries}}</div> + +<div class="note"><strong>Agradecimentos</strong> + +<p>Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.</p> +</div> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/api/pageaction/index.html b/files/pt-pt/mozilla/add-ons/webextensions/api/pageaction/index.html new file mode 100644 index 0000000000..1453336c6c --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/api/pageaction/index.html @@ -0,0 +1,108 @@ +--- +title: Ação de página +slug: Mozilla/Add-ons/WebExtensions/API/pageAction +tags: + - API + - Ação de página + - Extensões + - Extensões da Web + - Extras + - Interface + - Não Padrão + - Referencia +translation_of: Mozilla/Add-ons/WebExtensions/API/pageAction +--- +<div>{{AddonSidebar}}</div> + +<p>Uma <a href="/pt-PT/Add-ons/WebExtensions/interface_do_utilizador/Acoes_pagina">ação de página</a> é ícone clicável dentro da barra de endereço do navegador.</p> + +<p> </p> + +<p><img alt="" src="https://mdn.mozillademos.org/files/12960/page-action.png" style="display: block; height: 262px; margin-left: auto; margin-right: auto; width: 850px;"></p> + +<p>Pode ouvir cliques no ícone, ou especificar uma <a href="/pt-PT/Add-ons/WebExtensions/interface_do_utilizador/Popups">janela (<em>popup</em>)</a> que será aberta quando o ícone for clicado.</p> + +<p>If you specify a popup, you can define its contents and behavior using HTML, CSS, and JavaScript, just like a normal web page. JavaScript running in the popup gets access to all the same WebExtension APIs as your background scripts.</p> + +<p>You can define most of a page action's properties declaratively using the <a href="/en-US/Add-ons/WebExtensions/manifest.json/page_action">page_action key</a> in your <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json">manifest.json</a>, but can also redefine them programmatically using this API.</p> + +<p>Page actions are for actions that are only relevant to particular pages. If your icon should always be available, use a <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Browser_action">browser action</a> instead.</p> + +<h2 id="Tipos">Tipos</h2> + +<dl> + <dt>{{WebExtAPIRef("pageAction.ImageDataType")}}</dt> + <dd>Dados de píxel para uma imagem.</dd> +</dl> + +<h2 id="Funções">Funções</h2> + +<dl> + <dt>{{WebExtAPIRef("pageAction.show()")}}</dt> + <dd>Shows the page action for a given tab.</dd> + <dt>{{WebExtAPIRef("pageAction.hide()")}}</dt> + <dd>Hides the page action for a given tab.</dd> + <dt>{{WebExtAPIRef("pageAction.setTitle()")}}</dt> + <dd>Sets the page action's title. This is displayed in a tooltip over the page action.</dd> + <dt>{{WebExtAPIRef("pageAction.getTitle()")}}</dt> + <dd>Gets the page action's title.</dd> + <dt>{{WebExtAPIRef("pageAction.setIcon()")}}</dt> + <dd>Sets the page action's icon.</dd> + <dt>{{WebExtAPIRef("pageAction.setPopup()")}}</dt> + <dd>Sets the URL for the page action's popup.</dd> + <dt>{{WebExtAPIRef("pageAction.getPopup()")}}</dt> + <dd>Gets the URL for the page action's popup.</dd> + <dt>{{WebExtAPIRef("pageAction.openPopup()")}}</dt> + <dd>Opens the page action's popup.</dd> +</dl> + +<h2 id="Eventos">Eventos</h2> + +<dl> + <dt>{{WebExtAPIRef("pageAction.onClicked")}}</dt> + <dd>Fired when a page action icon is clicked. This event will not fire if the page action has a popup.</dd> +</dl> + +<h2 id="Compatibilidade_de_navegador">Compatibilidade de navegador</h2> + +<p>{{Compat("webextensions.api.pageAction")}}</p> + +<p>{{WebExtExamples("h2")}}</p> + +<div class="note"><strong>Reconhecimentos</strong> + +<p>This API is based on Chromium's <a href="https://developer.chrome.com/extensions/pageAction"><code>chrome.pageAction</code></a> API. This documentation is derived from <a href="https://chromium.googlesource.com/chromium/src/+/master/chrome/common/extensions/api/page_action.json"><code>page_action.json</code></a> in the Chromium code.</p> + +<p>Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.</p> +</div> + +<div class="hidden"> +<pre>// Copyright 2015 The Chromium Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +</pre> +</div> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/api/sidebaraction/index.html b/files/pt-pt/mozilla/add-ons/webextensions/api/sidebaraction/index.html new file mode 100644 index 0000000000..8717b019f2 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/api/sidebaraction/index.html @@ -0,0 +1,182 @@ +--- +title: sidebarAction +slug: Mozilla/Add-ons/WebExtensions/API/sidebarAction +tags: + - API + - Barra Lateral + - Extensões + - Extensões da Web + - Não Padrão + - Referencia + - sidebarAction +translation_of: Mozilla/Add-ons/WebExtensions/API/sidebarAction +--- +<div>{{AddonSidebar}}</div> + +<p>Obtém e define as propriedades da barra lateral de uma extensão.</p> + +<p>Uma <a href="/pt-PT/Add-ons/WebExtensions/interface_do_utilizador/Barras_laterais">barra lateral</a> é um painel que é exibido no lado esquerdo ou direito da janela do navegador, ao lado da página da <em>web</em>. O navegador fornece uma interface do utilizador que permite ao utilizador ver as barras laterais disponíveis no momento e selecionar uma barra lateral para exibir. Utilizando a chave de manifest.json <code><a href="/en-US/Add-ons/WebExtensions/manifest.json/sidebar_action">sidebar_action</a></code> , uma extensão pdoe definir a sua própria barra lateral. Utilizando a API <code>sidebarAction</code> descrita aqui, uma extension pode obter um conjunto de propriedades da barra lateral.</p> + +<p>A API <code>sidebarAction</code> é modelada de perto na API {{WebExtAPIRef("browserAction")}}.</p> + +<p>A API sidebarAction é baseada na API <a href="https://dev.opera.com/extensions/sidebar-action-api/">sidebarAction d</a>o Opera. Contudo, note que o seguinte ainda não é suportado: <code>setBadgeText()</code>, <code>getBadgeText()</code>, <code>setBadgeBackgroundColor()</code>, <code>getBadgeBackgroundColor()</code>, <code>onFocus</code>, <code>onBlur</code>.</p> + +<h2 id="Tipos">Tipos</h2> + +<dl> + <dt>{{WebExtAPIRef("sidebarAction.ImageDataType")}}</dt> + <dd>Dados de pixel para uma imagem. Deve ser um objeto <code><a href="/en-US/docs/Web/API/ImageData">ImageData</a></code> (por exemplo, de um elemento {{htmlelement("canvas")}}).</dd> +</dl> + +<h2 id="Funções">Funções</h2> + +<dl> + <dt>{{WebExtAPIRef("sidebarAction.setPanel()")}}</dt> + <dd>Define o painel da barra lateral.</dd> + <dt>{{WebExtAPIRef("sidebarAction.getPanel()")}}</dt> + <dd>Obtém o painel da barra lateral.</dd> + <dt>{{WebExtAPIRef("sidebarAction.setTitle()")}}</dt> + <dd>Definie o título da barra lateral. Isto será exibido em qualquer IU fornecida pelo navegador para listar as barras de ferrramentas, tal como um menu.</dd> + <dt>{{WebExtAPIRef("sidebarAction.getTitle()")}}</dt> + <dd>Obtém o título da barra lateral.</dd> + <dt>{{WebExtAPIRef("sidebarAction.setIcon()")}}</dt> + <dd>Define o ícone da barra lateral.</dd> + <dt>{{WebExtAPIRef("sidebarAction.open()")}}</dt> + <dd>Abre a abarra lateral.</dd> + <dt>{{WebExtAPIRef("sidebarAction.close()")}}</dt> + <dd>fecha a barra lateral.</dd> + <dt>{{WebExtAPIRef("sidebarAction.isOpen()")}}</dt> + <dd>Verifica sebarra lateral está ou não aberta.</dd> +</dl> + +<h2 id="Compatibilidade_de_navegador">Compatibilidade de navegador</h2> + +<p>{{Compat("webextensions.api.sidebarAction")}}</p> + +<h2 id="Exemplo_de_extras_(add-ons)">Exemplo de extras (add-ons)</h2> + +<ul> + <li><a class="external external-icon" href="https://github.com/mdn/webextensions-examples/tree/master/annotate-page">página de notas (annotate-page</a>)</li> +</ul> + +<div class="note"><strong>Reconhecimentos</strong> + +<p>Esta API é baseada na API <a href="https://dev.opera.com/extensions/sidebar-action-api/"><code>chrome.sidebarAction</code></a> do Opera.</p> + +<p>Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.</p> +</div> + +<div class="hidden"> +<pre>// Copyright 2015 The Chromium Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +</pre> +</div> + +<div id="SL_balloon_obj" style="display: block;"> +<div class="SL_ImTranslatorLogo" id="SL_button" style="display: none;"> </div> + +<div id="SL_shadow_translation_result2" style="display: none;"> </div> + +<div id="SL_shadow_translator" style="display: none;"> +<div id="SL_planshet"> +<div id="SL_arrow_up" style=""> </div> + +<div id="SL_Bproviders"> +<div class="SL_BL_LABLE_ON" id="SL_P0" title="Google">G</div> + +<div class="SL_BL_LABLE_ON" id="SL_P1" title="Microsoft">M</div> + +<div class="SL_BL_LABLE_ON" id="SL_P2" title="Translator">T</div> +</div> + +<div id="SL_alert_bbl" style="display: none;"> +<div id="SLHKclose" style=""> </div> + +<div id="SL_alert_cont"> </div> +</div> + +<div id="SL_TB"> +<table id="SL_tables"> + <tbody> + <tr> + <td class="SL_td"><input></td> + <td class="SL_td"><select><option value="auto">Detect language</option><option value="af">Afrikaans</option><option value="sq">Albanian</option><option value="am">Amharic</option><option value="ar">Arabic</option><option value="hy">Armenian</option><option value="az">Azerbaijani</option><option value="eu">Basque</option><option value="be">Belarusian</option><option value="bn">Bengali</option><option value="bs">Bosnian</option><option value="bg">Bulgarian</option><option value="ca">Catalan</option><option value="ceb">Cebuano</option><option value="ny">Chichewa</option><option value="zh-CN">Chinese (Simplified)</option><option value="zh-TW">Chinese (Traditional)</option><option value="co">Corsican</option><option value="hr">Croatian</option><option value="cs">Czech</option><option value="da">Danish</option><option value="nl">Dutch</option><option value="en">English</option><option value="eo">Esperanto</option><option value="et">Estonian</option><option value="tl">Filipino</option><option value="fi">Finnish</option><option value="fr">French</option><option value="fy">Frisian</option><option value="gl">Galician</option><option value="ka">Georgian</option><option value="de">German</option><option value="el">Greek</option><option value="gu">Gujarati</option><option value="ht">Haitian Creole</option><option value="ha">Hausa</option><option value="haw">Hawaiian</option><option value="iw">Hebrew</option><option value="hi">Hindi</option><option value="hmn">Hmong</option><option value="hu">Hungarian</option><option value="is">Icelandic</option><option value="ig">Igbo</option><option value="id">Indonesian</option><option value="ga">Irish</option><option value="it">Italian</option><option value="ja">Japanese</option><option value="jw">Javanese</option><option value="kn">Kannada</option><option value="kk">Kazakh</option><option value="km">Khmer</option><option value="ko">Korean</option><option value="ku">Kurdish</option><option value="ky">Kyrgyz</option><option value="lo">Lao</option><option value="la">Latin</option><option value="lv">Latvian</option><option value="lt">Lithuanian</option><option value="lb">Luxembourgish</option><option value="mk">Macedonian</option><option value="mg">Malagasy</option><option value="ms">Malay</option><option value="ml">Malayalam</option><option value="mt">Maltese</option><option value="mi">Maori</option><option value="mr">Marathi</option><option value="mn">Mongolian</option><option value="my">Myanmar (Burmese)</option><option value="ne">Nepali</option><option value="no">Norwegian</option><option value="ps">Pashto</option><option value="fa">Persian</option><option value="pl">Polish</option><option value="pt">Portuguese</option><option value="pa">Punjabi</option><option value="ro">Romanian</option><option value="ru">Russian</option><option value="sm">Samoan</option><option value="gd">Scots Gaelic</option><option value="sr">Serbian</option><option value="st">Sesotho</option><option value="sn">Shona</option><option value="sd">Sindhi</option><option value="si">Sinhala</option><option value="sk">Slovak</option><option value="sl">Slovenian</option><option value="so">Somali</option><option value="es">Spanish</option><option value="su">Sundanese</option><option value="sw">Swahili</option><option value="sv">Swedish</option><option value="tg">Tajik</option><option value="ta">Tamil</option><option value="te">Telugu</option><option value="th">Thai</option><option value="tr">Turkish</option><option value="uk">Ukrainian</option><option value="ur">Urdu</option><option value="uz">Uzbek</option><option value="vi">Vietnamese</option><option value="cy">Welsh</option><option value="xh">Xhosa</option><option value="yi">Yiddish</option><option value="yo">Yoruba</option><option value="zu">Zulu</option></select></td> + <td class="SL_td"> + <div id="SL_switch_b" style="" title="Switch languages"> </div> + </td> + <td class="SL_td"><select><option value="af">Afrikaans</option><option value="sq">Albanian</option><option value="am">Amharic</option><option value="ar">Arabic</option><option value="hy">Armenian</option><option value="az">Azerbaijani</option><option value="eu">Basque</option><option value="be">Belarusian</option><option value="bn">Bengali</option><option value="bs">Bosnian</option><option value="bg">Bulgarian</option><option value="ca">Catalan</option><option value="ceb">Cebuano</option><option value="ny">Chichewa</option><option value="zh-CN">Chinese (Simplified)</option><option value="zh-TW">Chinese (Traditional)</option><option value="co">Corsican</option><option value="hr">Croatian</option><option value="cs">Czech</option><option value="da">Danish</option><option value="nl">Dutch</option><option value="en">English</option><option value="eo">Esperanto</option><option value="et">Estonian</option><option value="tl">Filipino</option><option value="fi">Finnish</option><option value="fr">French</option><option value="fy">Frisian</option><option value="gl">Galician</option><option value="ka">Georgian</option><option value="de">German</option><option value="el">Greek</option><option value="gu">Gujarati</option><option value="ht">Haitian Creole</option><option value="ha">Hausa</option><option value="haw">Hawaiian</option><option value="iw">Hebrew</option><option value="hi">Hindi</option><option value="hmn">Hmong</option><option value="hu">Hungarian</option><option value="is">Icelandic</option><option value="ig">Igbo</option><option value="id">Indonesian</option><option value="ga">Irish</option><option value="it">Italian</option><option value="ja">Japanese</option><option value="jw">Javanese</option><option value="kn">Kannada</option><option value="kk">Kazakh</option><option value="km">Khmer</option><option value="ko">Korean</option><option value="ku">Kurdish</option><option value="ky">Kyrgyz</option><option value="lo">Lao</option><option value="la">Latin</option><option value="lv">Latvian</option><option value="lt">Lithuanian</option><option value="lb">Luxembourgish</option><option value="mk">Macedonian</option><option value="mg">Malagasy</option><option value="ms">Malay</option><option value="ml">Malayalam</option><option value="mt">Maltese</option><option value="mi">Maori</option><option value="mr">Marathi</option><option value="mn">Mongolian</option><option value="my">Myanmar (Burmese)</option><option value="ne">Nepali</option><option value="no">Norwegian</option><option value="ps">Pashto</option><option value="fa">Persian</option><option value="pl">Polish</option><option value="pt">Portuguese</option><option value="pa">Punjabi</option><option value="ro">Romanian</option><option value="ru">Russian</option><option value="sm">Samoan</option><option value="gd">Scots Gaelic</option><option value="sr">Serbian</option><option value="st">Sesotho</option><option value="sn">Shona</option><option value="sd">Sindhi</option><option value="si">Sinhala</option><option value="sk">Slovak</option><option value="sl">Slovenian</option><option value="so">Somali</option><option selected value="es">Spanish</option><option value="su">Sundanese</option><option value="sw">Swahili</option><option value="sv">Swedish</option><option value="tg">Tajik</option><option value="ta">Tamil</option><option value="te">Telugu</option><option value="th">Thai</option><option value="tr">Turkish</option><option value="uk">Ukrainian</option><option value="ur">Urdu</option><option value="uz">Uzbek</option><option value="vi">Vietnamese</option><option value="cy">Welsh</option><option value="xh">Xhosa</option><option value="yi">Yiddish</option><option value="yo">Yoruba</option><option value="zu">Zulu</option></select></td> + <td class="SL_td"> </td> + <td class="SL_td"> + <div id="SL_TTS_voice" style="" title="English"> </div> + </td> + <td class="SL_td"> + <div class="SL_copy" id="SL_copy" style="" title="Copy translation"> </div> + </td> + <td class="SL_td"> + <div id="SL_bbl_font_patch"> </div> + + <div class="SL_bbl_font" id="SL_bbl_font" style="" title="Font size"> </div> + </td> + <td class="SL_td"> + <div id="SL_bbl_help" style="" title="Help"> </div> + </td> + <td class="SL_td"> + <div class="SL_pin_off" id="SL_pin" style="" title="Pin pop-up bubble"> </div> + </td> + </tr> + </tbody> +</table> +</div> +</div> + +<div id="SL_shadow_translation_result" style=""> </div> + +<div class="SL_loading" id="SL_loading" style=""> </div> + +<div id="SL_player2"> </div> + +<div id="SL_alert100">Text-to-speech function is limited to 200 characters</div> + +<div id="SL_Balloon_options" style="background: rgb(255, 255, 255);"> +<div id="SL_arrow_down" style=""> </div> + +<table id="SL_tbl_opt" style="width: 100%;"> + <tbody> + <tr> + <td><input></td> + <td> + <div id="SL_BBL_IMG" style="" title="Show Translator's button 3 second(s)"> </div> + </td> + <td><a class="SL_options" title="Show options">Options</a> : <a class="SL_options" title="Translation History">History</a> : <a class="SL_options" title="ImTranslator Feedback">Feedback</a> : <a class="SL_options" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=GD9D8CPW8HFA2" title="Make a small contribution">Donate</a></td> + <td><span id="SL_Balloon_Close" title="Close">Close</span></td> + </tr> + </tbody> +</table> +</div> +</div> +</div> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/as_melhores_praticas_de_experiencia_do_utilizador/index.html b/files/pt-pt/mozilla/add-ons/webextensions/as_melhores_praticas_de_experiencia_do_utilizador/index.html new file mode 100644 index 0000000000..0b3aba116e --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/as_melhores_praticas_de_experiencia_do_utilizador/index.html @@ -0,0 +1,159 @@ +--- +title: As melhores práticas de experiência do utilizador +slug: >- + Mozilla/Add-ons/WebExtensions/As_melhores_praticas_de_experiencia_do_utilizador +tags: + - Extensões + - Extras + - Guía + - IU + - UX +translation_of: Mozilla/Add-ons/WebExtensions/User_experience_best_practices +--- +<div>{{AddonSidebar()}}</div> + +<p dir="ltr" id="docs-internal-guid-04f024b5-ab18-81ba-29b2-520d0891bcac">As melhores extensões do Firefox fornecem aos utilizadores uma nova funcionalidade ou recurso que corresponde a uma necessidade. Ao corresponder a essa necessidade irá ajudar os utilziadores a trabalhar de uma maneira mais inteligente ou eficiente, ou a obter mais prazer com a sua experiência de navegação.</p> + +<p dir="ltr">You will also want to make sure your users have a great experience using your extension and as a result give it great feedback and a good rating on <a href="https://addons.mozilla.org">addons.mozilla.org</a> (AMO).</p> + +<p dir="ltr">Much has been written about what makes software usable. If you are new to the subject, a good place to start is Jakob Nielsen’s <a href="https://en.wikipedia.org/wiki/Heuristic_evaluation#Nielsen">Usability Heuristics</a>. We recommend, whether you are new to extension development or a seasoned pro, using Nielsen’s Heuristics as a checklist when <a href="#Test_test_and_then_test_again">testing your user experience (UX)</a>.</p> + +<p dir="ltr">So, here we discuss much more specific Firefox and browser extension UX features, offering advice and suggestions that will help you build an extension that delights your users.</p> + +<h2 dir="ltr" id="Seja_Firefoxy">Seja <em>Firefoxy</em></h2> + +<p dir="ltr">Your users have chosen Firefox for a reason, possibly several reasons, so match your extension’s philosophy, features, and look and feel to that of Firefox.</p> + +<h3 dir="ltr" id="Design_values">Design values</h3> + +<p dir="ltr">To best meet the needs of Firefox users, align with the Firefox values.</p> + +<p dir="ltr">The <a href="https://design.firefox.com/values/">Firefox Design Values</a> state that we respect the user's privacy and sovereignty and do not surprise them. We start users with smart defaults on the functionality they want to use and enable them to customize those to their personal preferences so that they are in full control of their experience. We add humor and whimsy to our design and pay attention to details, quality, and performance. Local differences in a global world are important to us, and we help people make sense of the web in clear language.</p> + +<h3 dir="ltr" id="Apresentação_e_impressão">Apresentação e impressão</h3> + +<p dir="ltr">To provide your extensions with the best long term fit to Firefox, align with the <a href="http://design.firefox.com/photon">Firefox Photon Design System</a>. Following Photon will ensure that your extension integrates with the Firefox experience and will make it easier for people to use.</p> + +<h2 dir="ltr" id="Mantenha-a_focada">Mantenha-a focada</h2> + +<p dir="ltr">An extension is best when it is centered around one main use case, addressing that use case as well as possible for the target audience. It should add one function or set of closely related functions to the browser, modify a function of the browser, or modify web pages. Determine if you have achieved this by asking whether you can easily communicate the features and purpose of the extension in three (short) sentences or less.</p> + +<div class="note"> +<p dir="ltr">A short summary description of your extension is also very useful when it comes to creating its listing on AMO, see <a href="/en-US/Add-ons/Listing#Make_sure_your_summary_is_just_long_enough">Make sure your summary is just long enough</a> for more details.</p> +</div> + +<h2 dir="ltr" id="Comece_agora_mesmo">Comece agora mesmo</h2> + +<p dir="ltr">Ensure that your extension is ready to be used immediately after installation. It should be optimized for its main use case, and work as expected for most users without the need for customization.</p> + +<p dir="ltr">Do not expect your users to read detailed instructions, other content, or ask them to configure the extension to use it. Doing so could mean they never get started with your extension and, if they do, could result in poor reviews.</p> + +<h2 dir="ltr" id="Dê_aos_utilizadores_o_que_eles_precisam_onde_eles_precisam">Dê aos utilizadores o que eles precisam, onde eles precisam</h2> + +<p dir="ltr">Choosing the right way or combination of ways to make your extension's functionality available to the user can have a significant effect on usability. Asking a few simple questions about your extension’s functionality can quickly guide you to the right choices:</p> + +<h3 dir="ltr" id="A_minha_extensão_funciona_na_maioria_dos_sites_da_Web_e_páginas_da_Web">A minha extensão funciona na maioria dos sites da Web e páginas da Web?</h3> + +<p dir="ltr">If your extension provides the user with features they can use on almost every website or page, give the user access to it from a <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/user_interface/Browser_action">toolbar button</a> using the <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/browserAction">browser action</a>. This might include providing access to your image editor or opening a page from your website.</p> + +<p dir="ltr"><img alt="" src="https://mdn.mozillademos.org/files/12966/browser-action.png" style="display: block; height: 387px; margin-left: auto; margin-right: auto; width: 782px;"></p> + +<p dir="ltr">Where you have several features you want to give the user access, you can add a <a href="/en-US/Add-ons/WebExtensions/Popups">popup</a> to the button.</p> + +<h3 dir="ltr" id="A_minha_extensão_funciona_apenas_em_alguns_sites_da_Web_e_páginas">A minha extensão funciona apenas em alguns sites da Web e páginas?</h3> + +<p dir="ltr">If your extension offers a feature for a type of web page or specific domains, give the user access to it from an <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Page_actions">address bar button</a> using a <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/pageAction">page action</a>. This might include providing access to your RSS reader on pages with RSS feeds or providing an extended feature to pages on your website.</p> + +<p dir="ltr"><img alt="" src="https://mdn.mozillademos.org/files/12960/page-action.png" style="display: block; height: 262px; margin-left: auto; margin-right: auto; width: 850px;"></p> + +<p dir="ltr">Where you have several features you want to give the user access, you can add a <a href="/en-US/Add-ons/WebExtensions/Popups">popup</a> to the button.</p> + +<h3 dir="ltr" id="A_minha_extensão_precisa_de_mostrar_informação_ou_oferecer_ações_em_paralelo_com_as_páginas_da_Web">A minha extensão precisa de mostrar informação ou oferecer ações em paralelo com as páginas da Web?</h3> + +<p dir="ltr">If your extension includes information or actions that a user would want immediate access to while viewing any web page, use a <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Sidebars">sidebar</a>. This might include notes the user can make about a page’s content or a feature offering various font substitutions to improve readability.</p> + +<p dir="ltr"><img alt="" src="https://mdn.mozillademos.org/files/14825/bookmarks-sidebar.png" style="display: block; height: 761px; margin-left: auto; margin-right: auto; width: 728px;"></p> + +<h3 dir="ltr" id="A_minha_extensão_oferece_funcionalidade_especifica_para_o_conteúdo_da_página_ou_outras_funcionalidades_do_navegador">A minha extensão oferece funcionalidade especifica para o conteúdo da página ou outras funcionalidades do navegador?</h3> + +<p dir="ltr">If your extension offers features the user might want to access in context, add them to an appropriate <a href="/en-US/Add-ons/WebExtensions/user_interface/Context_menu_items">context menu</a>. This might include offering access to an image editor on the image context menu or offering extended copy features on the context menu for selected page content.</p> + +<p dir="ltr"><img alt="Example of content menu items added by a WebExtension, from the context-menu-demo example" src="https://mdn.mozillademos.org/files/15051/context_menu_example.png" style="display: block; height: 587px; margin-left: auto; margin-right: auto; width: 573px;"></p> + +<h3 dir="ltr" id="A_minha_extensão_tem_definições_que_o_utilizador_pode_ajustar">A minha extensão tem definições que o utilizador pode ajustar?</h3> + +<p dir="ltr">If your extension enables the user to change and save settings that affect the behavior of the extension, use an <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Options_pages">options page</a> to provide a standard Preferences link to settings from the Add-on Manager.</p> + +<p dir="ltr"><img alt="Typical preferences button, to access an extension's settings, from the Add-on Manager" src="https://mdn.mozillademos.org/files/15271/add-on-manager-preferences-button.png" style="display: block; height: 80px; margin-left: auto; margin-right: auto; width: 732px;"></p> + +<h3 dir="ltr" id="A_minha_extensão_precisa_de_recolher_muita_informação_ou_exibir_conteúdo_em_adição_aos_separadores_atuais">A minha extensão precisa de recolher muita informação ou exibir conteúdo em adição aos separadores atuais?</h3> + +<p dir="ltr">Where your extension needs to gather or display significant amounts of information (more than is suitable for an <a href="/en-US/docs/Web/API/Window/alert">alert</a> or would benefit from additional formatting) use <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Bundled_web_pages">bundled web pages</a> to deliver forms and similar content.</p> + +<p dir="ltr"><img alt="Example of a simple bundled page displayed as a detached panel." src="https://mdn.mozillademos.org/files/15073/bundled_page_as_panel.png" style="display: block; height: 445px; margin-left: auto; margin-right: auto; width: 680px;"></p> + +<h3 dir="ltr" id="A_minha_extensão_tenta_ajudar_o_utilizador_a_entrar_as_páginas_da_Web_ou_conteúdo">A minha extensão tenta ajudar o utilizador a entrar as páginas da Web ou conteúdo?</h3> + +<p dir="ltr">Where your extension includes a use case to locate web pages or content, for example, offering a site specific search, use <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Omnibox">address bar suggestions</a> to deliver those recommendations.</p> + +<p dir="ltr"><img alt="Example showing the result of the firefox_code_search WebExtension's customization of the address bar suggestions." src="https://mdn.mozillademos.org/files/15075/omnibox_example_full.png" style="display: block; height: 325px; margin-left: auto; margin-right: auto; width: 679px;"></p> + +<h3 dir="ltr" id="A_minha_extensão_oferece_ferramentas_para_os_programadores">A minha extensão oferece ferramentas para os programadores?</h3> + +<p dir="ltr">Where you are providing tools for developers, add them to the Firefox developer tools using <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/devtools_panels">developer tools panels</a>.</p> + +<h2 dir="ltr" id="Mantenha_o_utilizador_informado">Mantenha o utilizador informado</h2> + +<p dir="ltr">Ensuring the user knows what will happen, is happening, and has happened in your extension is an essential part of building trust and ensuring a happy user.</p> + +<h3 dir="ltr" id="Diga_ao_utilizador_o_que_irá_acontecer_antes_que_aconteça">Diga ao utilizador o que irá acontecer, antes que aconteça</h3> + +<p dir="ltr">Users should understand what will happen when they click a button. In addition to a meaningful, descriptive button label, provide tooltips that describe the action that the button will perform.</p> + +<div class="note"> +<p dir="ltr">Do not put the name of the extension alone in the tooltip, unless it is descriptive of the action the button will perform.</p> +</div> + +<p dir="ltr">Do not use the tooltip for any other types of information such as elaborate statistics about your extension. Keep the tooltip content simple and focused on what will happen when the user clicks the button.</p> + +<h3 dir="ltr" id="Se_é_realmente_importante_e_o_utilizador_afastou-se_notifique-os">Se é realmente importante e o utilizador afastou-se, notifique-os</h3> + +<p dir="ltr">If your extension has completed a critical, long running background task, when the task completes use the operating system’s native <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Notifications">notifications</a> to update the user. This can be useful where the user may not be focusing on the extension, or the browser, when the process finishes. However, use sparingly. If it is sufficient for the user to discover that a process has completed when they return to the browser or extension, do not use notifications.</p> + +<p dir="ltr"><img alt="" src="https://mdn.mozillademos.org/files/14043/notify-shadowed.png" style="display: block; height: 334px; margin-left: auto; margin-right: auto; width: 700px;"></p> + +<h3 dir="ltr" id="Utilizar_browserAction_badges_sparingly">Utilizar browserAction badges sparingly</h3> + +<p dir="ltr">You can <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/browserAction/setBadgeText">add a badge</a> over the toolbar icon of a <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/browserAction">browserAction</a>, but do so sparingly to inform users about important events. Do not use them to provide regular or persistent status updates.</p> + +<p dir="ltr">When it comes to <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/browserAction/setBadgeBackgroundColor">coloring a badge</a>, using one of four colors for notifications of different severity is recommended:</p> + +<ul> + <li>Casual: azul</li> + <li>Sucesso: verde</li> + <li>Aviso: amarelo</li> + <li>Erro: vermelho</li> +</ul> + +<div class="note"> +<p dir="ltr">Use of Firefox colors is suggested, for more details see <a href="http://design.firefox.com/photon/visuals/color.html">Firefox Colors</a>. However, for compatibility with <a href="https://developer.chrome.com/extensions/browserAction#icon">Chrome</a> and Opera free color selection is supported.</p> +</div> + +<h2 dir="ltr" id="Testar_testar_e_depois_testar_novamente">Testar, testar, e depois testar novamente</h2> + +<p dir="ltr">Testing is a vital part of creating an outstanding UX for your extension. There are two key aspects of testing your UX:</p> + +<ol> + <li>Test across devices and platforms to ensure your extension works and performs well in as many places as possible. This includes considering factors such as the user’s screen size and resolution—just because your extension looks good and is easy to use on your desktop monitor does not mean it looks as good and works as well on a smaller laptop screen, or, indeed, vice versa.</li> + <li>Test with as many users as possible. Do not assume that you know your audience, as people’s backgrounds and experience can make a huge difference to how they interact with your extension. So, allow for user testing as part of your extension’s development.</li> +</ol> + +<p dir="ltr">Dicas de teste:</p> + +<ul> + <li>In AMO you have the option to <a href="/en-US/Add-ons/Distribution/Submitting_an_add-on#Listing_on_AMO">identify your extension as experimental</a> or publish a <a href="/en-US/Add-ons/Distribution#Beta_versions">beta or other non-final release</a>. If you flag your extension as experimental it is listed in AMO, so that any user can find it, but with a lower profile. When you are happy that the extension is ready for a wider audience, you can turn off the experimental flag and your extension will be listed as normal in AMO. If you have a published extension, you can use the Development channel to offer an alpha or beta version for testing. You will need to direct your testers to the Development Channel of your extension’s listing or let your testers know the link to use to install your extension.<br> + <img alt="The development channel section of an extension's listing page, offering access to alpha and beta versions for testing." src="https://mdn.mozillademos.org/files/15273/extensions-development-channel.png" style="display: block; height: 262px; margin-left: auto; margin-right: auto; width: 751px;"><br> + When you are happy with your update, you can publish it as the new release version of your extension.</li> + <li>If you want to distribute your extension to users outside AMO, you can find the instructions for doing so, and the installation instructions you need to provide users, in the article on <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Alternative_distribution_options/Sideloading_add-ons">Sideloading add-ons</a>. Remember that, unlike distribution through AMO, you will need to send users any updated versions of your extension as you make improvements.</li> + <li>Use the <a href="https://developer.mozilla.org/en-US/docs/Tools/Responsive_Design_Mode">Responsive Design Mode</a> to test your extension for its behavior on other screen sizes and device types.</li> +</ul> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/conversao_de_uma_extensao_legada_do_firefox/index.html b/files/pt-pt/mozilla/add-ons/webextensions/conversao_de_uma_extensao_legada_do_firefox/index.html new file mode 100644 index 0000000000..1898b1712a --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/conversao_de_uma_extensao_legada_do_firefox/index.html @@ -0,0 +1,81 @@ +--- +title: Conversão de uma extensão legada do Firefox +slug: Mozilla/Add-ons/WebExtensions/Conversao_de_uma_extensao_legada_do_firefox +translation_of: Mozilla/Add-ons/WebExtensions/Porting_a_legacy_Firefox_add-on +--- +<div>{{AddonSidebar}}</div> + +<p><span class="seoSummary">Se desenvolveu uma extensão do Firefox utilziando XUL/XPCOM ou SDK de EXtras, esta página irá ajudá-lo a migraar a sua extensão para utilizar as APIs das Extensões da Web. O padrão para criar extensões para o Firefox é para utilizar as </span>APIs das Extensões da Web. Este será a único tipo de extensão suportado no Firefox no fim de novembro de 2017, com o lançamento da versão 57 do <a class="external text" href="https://wiki.mozilla.org/RapidRelease/Calendar" rel="nofollow">Firefox</a>.</p> + +<h2 id="Início_rápido">Início rápido</h2> + +<ol> + <li>Get an idea of the main things you'll have to change in your extension: + <ul> + <li>Familiarize yourself with the <a href="/en-US/Add-ons/WebExtensions/Anatomy_of_a_WebExtension">WebExtension format and structure</a>, and <a href="/en-US/Add-ons/WebExtensions/Your_first_WebExtension">build a basic example</a>.</li> + <li>If your extension is based on XUL and XPCOM, whether it's an <a href="https://developer.mozilla.org/en-US/Add-ons/Overlay_Extensions">overlay extension</a> or a <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/Bootstrapped_extensions">bootstrapped extension</a>, see <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Comparison_with_XUL_XPCOM_extensions">Comparison with XUL/XPCOM extensions</a> to find out how WebExtensions can correspond with the legacy APIs you're using.</li> + <li>If your extension is based on the Add-on SDK, see <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Comparison_with_the_Add-on_SDK">Comparison with the Add-on SDK</a> to find out how WebExtensions can correspond with the legacy SDK APIs you're using.</li> + </ul> + </li> + <li>Rewrite your extension code. See below for migration paths for different types of extensions. From Firefox 51 onwards, you can embed an extension built using WebExtension APIs in a bootstrapped extension or an SDK add-on, and can thus port a legacy extension a piece at a time, and have a working extension at each step. See <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Embedded_WebExtensions">Embedded WebExtensions</a> for more information.</li> + <li>When you're ready to submit the WebExtension version of your extension to AMO... wait a minute... are you truly ready? Because of the extensions permissions model, you cannot revert from WebExtensions back to using a legacy extension format. So test <em>thoroughly</em>, because this is a permanent one-way trip. Also, see the hybrid example below. If you're not ready, you can embed your WebExtension in a legacy extension container, which allows you to test your extension migration but still go back if needed in an emergency.</li> + <li>When you're <em>really</em> ready to submit the WebExtension version of your extension to AMO, first port your old add-on ID to the new WebExtension manifest.json file. Your extension must have the same ID as previous versions. Copy the value in the "id" field from your package.json file into the id field in the <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/applications">applications</a> section of the WebExtension manifest.json file. Then you can submit your extension update to AMO as your normally would.</li> +</ol> + +<div class="note"> +<p>Note that this is a one-way conversion: You <strong>cannot</strong> update an extension using WebExtensions to use a legacy technology. This means that you must be sure that you are ready to commit to using WebExtension APIs before you submit the updated add-on to AMO.</p> +</div> + +<h2 id="Camnihos_de_migração">Camnihos de migração</h2> + +<h3 id="Extensões_SDK">Extensões SDK</h3> + +<p>Here is the comparison chart showing <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Comparison_with_the_Add-on_SDK">SDK APIs and their WebExtensions format counterparts</a>. If you don't see the APIs you need to port to use WebExtensions APIs, look below to learn how to request APIs and also how to implement them.</p> + +<h3 id="Extensões_XULXPCOM">Extensões XUL/XPCOM</h3> + +<p>Here is the comparison chart showing <a href="/en-US/Add-ons/WebExtensions/Comparison_with_XUL_XPCOM_extensions">XUL/XPCOM APIs and their WebExtensions format counterparts</a>. If you don't see the APIs you need to port to use WebExtension APIs, look below to learn how to request APIs and also how to implement them.</p> + +<h3 id="Migração_parcial">Migração parcial</h3> + +<p>An <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Embedded_WebExtensions">Embedded WebExtension</a> is an extension that combines two types of extensions in one, by incorporating a WebExtension inside of a bootstrapped or SDK extension. If you have a legacy extension that writes data to the filesystem, and you’re planning to port it to WebExtensions, <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Embedded_WebExtensions">Embedded WebExtensions</a> are available to help you transition. Embedded WebExtensions can be used to transfer the stored data of your add-on to a format that can be used by WebExtensions. This is essential because it lets you to convert your users without the need for them to take any actions.</p> + +<p>It’s important to emphasize that Embedded WebExtensions are intended to be a transition tool, and will not be supported past Firefox 57. They should not be used for add-ons that are not expected to transition to WebExtensions.</p> + +<h2 id="Não_vê_as_APIs_das_Extensões_da_Web_que_precisa">Não vê as APIs das Extensões da Web que precisa?</h2> + +<p><strong>Develop WebExtension APIs for Firefox</strong> - If you're experienced with Mozilla infrastructure and would like to develop WebExtensions APIs directly for Firefox, here is a list of <a href="https://mzl.la/2dVs5Ys">approved APIs</a> that you can start contributing to.</p> + +<p><strong>Experiment with new WebExtension APIs</strong> - If you want to prototype and tinker with WebExtensions APIs without having to build Firefox, <a href="http://webextensions-experiments.readthedocs.io/en/latest/index.html">WebExtensions Experiments</a> is for you!</p> + +<p><strong>Request a new WebExtensions API</strong> - If you want to request a new WebExtensions API, please read <a class="external text" href="https://wiki.mozilla.org/WebExtensions/NewAPIs" rel="nofollow">this page</a>.</p> + +<h2 id="Ferramentas">Ferramentas</h2> + +<ul> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Getting_started_with_web-ext">web-ext</a> is a command line tool designed to speed up various parts of the extension development process, making development faster and easier.</li> + <li><a href="https://github.com/mi-g/weh">WebExtensions Helper</a> speeds up browser extension development by providing utilities for WebExtensions-based (Firefox, Chrome, Opera and Edge) extensions</li> + <li><a href="https://github.com/yeoman/generator-chrome-extension">Chrome Extension generator </a>creates everything you need to get started with extension development. You can choose Browser UI(Browser,Page Action, Omnibox) type and select permissions you need.</li> + <li><a href="http://extensionizr.com/">Extensionizr</a> is a wizard that helps you create a basic extension</li> + <li><a href="https://github.com/mahemoff/chrome-boilerplate">Chrome Boilerplate</a> is boilerplate code for Chrome WebE<span class="col-11 mr-2 text-gray-dark">xtension.</span></li> + <li><a href="https://github.com/sitepoint/ChromeSkel_a">Skeleton Chrome Extension</a> is an extension bootstrap and template</li> +</ul> + +<h2 id="Documentação">Documentação</h2> + +<ul> + <li><a href="https://wiki.mozilla.org/Add-ons/developer/communication">WebExtensions Project Page</a> on the Mozilla Wiki</li> + <li><a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions">How-to guides</a> covering common extension developer cases, like <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Intercept_HTTP_requests">intercepting web requests</a> and <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Add_a_button_to_the_toolbar">adding a button to the toolbar</a></li> + <li><a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Comparison_with_the_Add-on_SDK">Comparison with the Add-on SDK</a></li> + <li><a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Comparison_with_XUL_XPCOM_extensions">Comparison with XUL/XPCOM extensions</a></li> + <li><a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Browser_support_for_JavaScript_APIs">Browser compatibility table</a> for all WebExtensions APIs</li> + <li><a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Examples">Examples of extensions</a></li> +</ul> + +<h2 id="Contactar">Contactar</h2> + +<ul> + <li> + <p>Pode utilizar as hiperligações <a href="https://developer.mozilla.org/pt-PT/docs/Mozilla/Add-ons#Contacte-nos">aqui</a> para obter ajuda, manter-se atualizado com as novidades sobre os extras, e dar-nos a sua opinião.</p> + </li> +</ul> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/dubla_padrões/index.html b/files/pt-pt/mozilla/add-ons/webextensions/dubla_padrões/index.html new file mode 100644 index 0000000000..8c0f5e3480 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/dubla_padrões/index.html @@ -0,0 +1,430 @@ +--- +title: dubla padrões em extensão manifestos +slug: Mozilla/Add-ons/WebExtensions/dubla_padrões +translation_of: Mozilla/Add-ons/WebExtensions/Match_patterns +--- +<div>{{AddonSidebar}}</div> + +<p>Match patterns are a way to specify groups of URLs: a match pattern matches a specific set of URLs. They are used in WebExtensions APIs in a few places, most notably to specify which documents to load <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts">content scripts</a> into, and to specify which URLs to add <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest">webRequest</a></code> listeners to.</p> + +<p>APIs that use match patterns usually accept a list of match patterns, and will perform the appropriate action if the URL matches any of the patterns. See, for example, the <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/content_scripts">content_scripts</a></code> key in manifest.json.</p> + +<h2 id="Match_pattern_structure">Match pattern structure</h2> + +<div class="note"> +<p><strong>Note:</strong> Some browsers don’t support certain schemes.<br> + Check the <a href="#Browser_compatibility">Browser compatibility table</a> for details.</p> +</div> + +<p>All match patterns are specified as strings. Apart from the special <code><a href="/en-US/Add-ons/WebExtensions/Match_patterns#%3Call_urls%3E"><all_urls></a></code> pattern, match patterns consist of three parts: <em>scheme</em>, <em>host</em>, and <em>path</em>. The scheme and host are separated by <code>://</code>.</p> + +<pre><scheme>://<host><path></pre> + +<h3 id="scheme">scheme</h3> + +<p>The <em>scheme</em> component may take one of two forms:</p> + +<table class="fullwidth-table standard-table"> + <thead> + <tr> + <th scope="col" style="width: 50%;">Form</th> + <th scope="col">Matches</th> + </tr> + </thead> + <tbody> + <tr> + <td><code>*</code></td> + <td>Only "http" and "https" and in some browsers also <a href="/en-US/docs/Web/API/WebSockets_API">"ws" and "wss"</a>.</td> + </tr> + <tr> + <td>One of <code>http</code>, <code>https</code>, <code>ws</code>, <code>wss</code>, <code>ftp</code>, <code>ftps</code>, <code>data</code> or <code>file</code>.</td> + <td>Only the given scheme.</td> + </tr> + </tbody> +</table> + +<h3 id="host">host</h3> + +<p>The <em>host</em> component may take one of three forms:</p> + +<table class="fullwidth-table standard-table"> + <thead> + <tr> + <th scope="col" style="width: 50%;">Form</th> + <th scope="col">Matches</th> + </tr> + </thead> + <tbody> + <tr> + <td><code>*</code></td> + <td>Any host.</td> + </tr> + <tr> + <td><code>*.</code> followed by part of the hostname.</td> + <td>The given host and any of its subdomains.</td> + </tr> + <tr> + <td>A complete hostname, without wildcards.</td> + <td>Only the given host.</td> + </tr> + </tbody> +</table> + +<p><em>host</em> must not include a port number.</p> + +<p><em>host</em> is optional only if the <em>scheme</em> is "file".</p> + +<p>Note that the wildcard may only appear at the start.</p> + +<h3 id="path">path</h3> + +<p>The <em>path</em> component must begin with a <code>/</code>.</p> + +<p>After that, it may subsequently contain any combination of the <code>*</code> wildcard and any of the characters that are allowed in URL paths or query strings. Unlike <em>host</em>, the <em>path</em> component may contain the <code>*</code> wildcard in the middle or at the end, and the <code>*</code> wildcard may appear more than once.</p> + +<p>The value for the <em>path</em> matches against the string which is the URL path plus the <a href="https://en.wikipedia.org/wiki/Query_string">URL query string</a>. This includes the <code>?</code> between the two, if the query string is present in the URL. For example, if you want to match URLs on any domain where the URL path ends with <code>foo.bar</code>, then you need to use an array of Match Patterns like <code>['*://*/*foo.bar', '*://*/*foo.bar?*']</code>. The <code>?*</code> is needed, rather than just <code>bar*</code>, in order to anchor the ending <code>*</code> as applying to the URL query string and not some portion of the URL path.</p> + +<p>Neither the <a href="https://en.wikipedia.org/wiki/Fragment_identifier">URL fragment identifier</a>, nor the <code>#</code> which precedes it, are considered as part of the <em>path</em>.</p> + +<div class="blockIndicator note"> +<p><strong>Note</strong>: The path pattern string should not include a port number. Adding a port, as in: <em>"http://localhost:1234/*" </em>causes the match pattern to be ignored. However, "<em>http://localhost:1234</em>" will match with "<em>http://localhost/*</em>"</p> +</div> + +<h3 id="<all_urls>"><all_urls></h3> + +<p>The special value <code><all_urls></code> matches all URLs under any of the supported schemes: that is "http", "https", "ws", "wss", "ftp", "data", and "file".</p> + +<h2 id="Examples">Examples</h2> + +<table class="fullwidth-table standard-table"> + <thead> + <tr> + <th scope="col" style="width: 33%;">Pattern</th> + <th scope="col" style="width: 33%;">Example matches</th> + <th scope="col" style="width: 33%;">Example non-matches</th> + </tr> + </thead> + <tbody> + <tr> + <td> + <p><code><all_urls></code></p> + + <p>Match all URLs.</p> + </td> + <td> + <p><code>http://example.org/</code></p> + + <p><code>https://a.org/some/path/</code></p> + + <p><code>ws://sockets.somewhere.org/</code></p> + + <p><code>wss://ws.example.com/stuff/</code></p> + + <p><code>ftp://files.somewhere.org/</code></p> + + <p><code>ftps://files.somewhere.org/</code></p> + </td> + <td> + <p><code>resource://a/b/c/</code><br> + (unsupported scheme)</p> + </td> + </tr> + <tr> + <td> + <p><code>*://*/*</code></p> + + <p>Match all HTTP, HTTPS and WebSocket URLs.</p> + </td> + <td> + <p><code>http://example.org/</code></p> + + <p><code>https://a.org/some/path/</code></p> + + <p><code>ws://sockets.somewhere.org/</code></p> + + <p><code>wss://ws.example.com/stuff/</code></p> + </td> + <td> + <p><code>ftp://ftp.example.org/</code><br> + (unmatched scheme)</p> + + <p><code>ftps://ftp.example.org/</code><br> + (unmatched scheme)</p> + + <p><code>file:///a/</code><br> + (unmatched scheme)</p> + </td> + </tr> + <tr> + <td> + <p><code>*://*.mozilla.org/*</code></p> + + <p>Match all HTTP, HTTPS and WebSocket URLs that are hosted at "mozilla.org" or one of its subdomains.</p> + </td> + <td> + <p><code>http://mozilla.org/</code></p> + + <p><code>https://mozilla.org/</code></p> + + <p><code>http://a.mozilla.org/</code></p> + + <p><code>http://a.b.mozilla.org/</code></p> + + <p><code>https://b.mozilla.org/path/</code></p> + + <p><code>ws://ws.mozilla.org/</code></p> + + <p><code>wss://secure.mozilla.org/something</code></p> + </td> + <td> + <p><code>ftp://mozilla.org/</code><br> + (unmatched scheme)</p> + + <p><code>http://mozilla.com/</code><br> + (unmatched host)</p> + + <p><code>http://firefox.org/</code><br> + (unmatched host)</p> + </td> + </tr> + <tr> + <td> + <p><code>*://mozilla.org/</code></p> + + <p>Match all HTTP, HTTPS and WebSocket URLs that are hosted at exactly "mozilla.org/".</p> + </td> + <td> + <p><code>http://mozilla.org/</code></p> + + <p><code>https://mozilla.org/</code></p> + + <p><code>ws://mozilla.org/</code></p> + + <p><code>wss://mozilla.org/</code></p> + </td> + <td> + <p><code>ftp://mozilla.org/</code><br> + (unmatched scheme)</p> + + <p><code>http://a.mozilla.org/</code><br> + (unmatched host)</p> + + <p><code>http://mozilla.org/a</code><br> + (unmatched path)</p> + </td> + </tr> + <tr> + <td> + <p><code>ftp://mozilla.org/</code></p> + + <p>Match only "ftp://mozilla.org/".</p> + </td> + <td><code>ftp://mozilla.org</code></td> + <td> + <p><code>http://mozilla.org/</code><br> + (unmatched scheme)</p> + + <p><code>ftp://sub.mozilla.org/</code><br> + (unmatched host)</p> + + <p><code>ftp://mozilla.org/path</code><br> + (unmatched path)</p> + </td> + </tr> + <tr> + <td> + <p><code>https://*/path</code></p> + + <p>Match HTTPS URLs on any host, whose path is "path".</p> + </td> + <td> + <p><code>https://mozilla.org/path</code></p> + + <p><code>https://a.mozilla.org/path</code></p> + + <p><code>https://something.com/path</code></p> + </td> + <td> + <p><code>http://mozilla.org/path</code><br> + (unmatched scheme)</p> + + <p><code>https://mozilla.org/path/</code><br> + (unmatched path)</p> + + <p><code>https://mozilla.org/a</code><br> + (unmatched path)</p> + + <p><code>https://mozilla.org/</code><br> + (unmatched path)</p> + + <p><code>https://mozilla.org/path?foo=1</code><br> + (unmatched path due to URL query string)</p> + </td> + </tr> + <tr> + <td> + <p><code>https://*/path/</code></p> + + <p>Match HTTPS URLs on any host, whose path is "path/" and which has no URL query string.</p> + </td> + <td> + <p><code>https://mozilla.org/path/</code></p> + + <p><code>https://a.mozilla.org/path/</code></p> + + <p><code>https://something.com/path</code>/</p> + </td> + <td> + <p><code>http://mozilla.org/path/</code><br> + (unmatched scheme)</p> + + <p><code>https://mozilla.org/path</code><br> + (unmatched path)</p> + + <p><code>https://mozilla.org/a</code><br> + (unmatched path)</p> + + <p><code>https://mozilla.org/</code><br> + (unmatched path)</p> + + <p><code>https://mozilla.org/path/</code><code>?foo=1</code><br> + (unmatched path due to URL query string)</p> + </td> + </tr> + <tr> + <td> + <p><code>https://mozilla.org/*</code></p> + + <p>Match HTTPS URLs only at "mozilla.org", with any URL path and URL query string.</p> + </td> + <td> + <p><code>https://mozilla.org/</code></p> + + <p><code>https://mozilla.org/path</code></p> + + <p><code>https://mozilla.org/another</code></p> + + <p><code>https://mozilla.org/path/to/doc</code></p> + + <p><code>https://mozilla.org/path/to/doc?foo=1</code></p> + </td> + <td> + <p><code>http://mozilla.org/path</code><br> + (unmatched scheme)</p> + + <p><code>https://mozilla.com/path</code><br> + (unmatched host)</p> + </td> + </tr> + <tr> + <td> + <p><code>https://mozilla.org/a/b/c/</code></p> + + <p>Match only this URL, or this URL with any URL fragment.</p> + </td> + <td> + <p><code>https://mozilla.org/a/b/c/</code></p> + + <p><code>https://mozilla.org/a/b/c/#section1</code></p> + </td> + <td>Anything else.</td> + </tr> + <tr> + <td> + <p><code>https://mozilla.org/*/b/*/</code></p> + + <p>Match HTTPS URLs hosted on "mozilla.org", whose path contains a component "b" somewhere in the middle. Will match URLs with query strings, if the string ends in a <code>/</code>.</p> + </td> + <td> + <p><code>https://mozilla.org/a/b/c/</code></p> + + <p><code>https://mozilla.org/d/b/f/</code></p> + + <p><code>https://mozilla.org/a/b/c/d/</code></p> + + <p><code>https://mozilla.org/a/b/c/d/#section1</code></p> + + <p><code>https://mozilla.org/a/b/c/d/?foo=/</code></p> + + <p><code>https://mozilla.org/a?foo=21314&bar=/b/&extra=c/</code></p> + </td> + <td> + <p><code>https://mozilla.org/b/*/</code><br> + (unmatched path)</p> + + <p><code>https://mozilla.org/a/b/</code><br> + (unmatched path)</p> + + <p><code>https://mozilla.org/a/b/c/d/?foo=bar</code><br> + (unmatched path due to URL query string)</p> + </td> + </tr> + <tr> + <td> + <p><code>file:///blah/*</code></p> + + <p>Match any FILE URL whose path begins with "blah".</p> + </td> + <td> + <p><code>file:///blah/</code></p> + + <p><code>file:///blah/bleh</code></p> + </td> + <td><code>file:///bleh/</code><br> + (unmatched path)</td> + </tr> + </tbody> +</table> + +<h3 id="Invalid_match_patterns">Invalid match patterns</h3> + +<table class="fullwidth-table standard-table"> + <thead> + <tr> + <th scope="col">Invalid pattern</th> + <th scope="col">Reason</th> + </tr> + </thead> + <tbody> + <tr> + <td><code>resource://path/</code></td> + <td>Unsupported scheme.</td> + </tr> + <tr> + <td><code>https://mozilla.org</code></td> + <td>No path.</td> + </tr> + <tr> + <td><code>https://mozilla.*.org/</code></td> + <td>"*" in host must be at the start.</td> + </tr> + <tr> + <td><code>https://*zilla.org/</code></td> + <td>"*" in host must be the only character or be followed by ".".</td> + </tr> + <tr> + <td><code>http*://mozilla.org/</code></td> + <td>"*" in scheme must be the only character.</td> + </tr> + <tr> + <td><code>https://mozilla.org:80/</code></td> + <td>Host must not include a port number.</td> + </tr> + <tr> + <td><code>*://*</code></td> + <td>Empty path: this should be "<code>*://*/*</code>".</td> + </tr> + <tr> + <td><code>file://*</code></td> + <td>Empty path: this should be "<code>file:///*</code>".</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<h3 id="scheme_2">scheme</h3> + + + +<p>{{Compat("webextensions.match_patterns.scheme",10)}}</p> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/e_a_seguir/index.html b/files/pt-pt/mozilla/add-ons/webextensions/e_a_seguir/index.html new file mode 100644 index 0000000000..f16f7e619b --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/e_a_seguir/index.html @@ -0,0 +1,60 @@ +--- +title: E a seguir? +slug: Mozilla/Add-ons/WebExtensions/E_a_seguir +tags: + - Extensão da Web + - Extensões + - Principiante +translation_of: Mozilla/Add-ons/WebExtensions/What_next_ +--- +<div>{{AddonSidebar}}</div> + +<p>Agora, irá estar pronto para começar a transformar a sua ideia de uma extensão de navegador em realidade. Antes de começar essa jornada, vale a pena estar ciente de algumas coisas que irão ajudar a facilitar.</p> + +<h2 id="O_seu_ambiente_de_desenvolvimento">O seu ambiente de desenvolvimento</h2> + +<p>You don't need any special development or build environment tools to create browser extensions: It's entirely possible to create great browser extensions with no more than a text editor. However, you may have been developing for the web and have a set of tools and an environment you want to reuse. If you do, you need to be aware of a couple of things.</p> + +<p>If you use minification or obfuscation tools to deliver your final code, you’ll need to provide your source code to <a href="#The_review_process">the AMO review process</a>. Also, the tools you use—those for minification, obfuscation, and build processes—will need to be open source (or offer unlimited free use) and be available to run on the reviewer’s computer (Windows, Mac, or Linux). Unfortunately, our reviewers can't work with commercial or web-based tools.</p> + +<p><a href="/en-US/Add-ons/Source_Code_Submission#About_build_tools">Learn more about build tools</a></p> + +<h2 id="Bibliotecas_de_terceiros">Bibliotecas de terceiros</h2> + +<p>Third-party libraries are a great way to add complex features or functionality to your browser extensions quickly. When you submit an extension to the <a href="#The_review_processv">AMO review process</a>, the process will also consider any third-party libraries used. To streamline the review, make sure you always download third-party libraries from their official website or repository, and if the library is minified provide a link to the source code. Please note that third-party libraries cannot be modified in any way.</p> + +<p><a href="/en-US/Add-ons/Source_Code_Submission">Learn more about submitting source code</a></p> + +<h2 id="O_Acordo_de_Distribuição_do_Extra_do_Firefox">O Acordo de Distribuição do Extra do Firefox</h2> + +<p>Browser extensions need to be signed to install into the release or beta versions of Firefox. Signing takes place in addons.mozilla.org (AMO) and is subject to the terms and conditions of the Firefox Add-on Distribution Agreement. The goal of the agreement is to ensure Firefox users get access to well supported, quality add-ons that enhance the Firefox experience.</p> + +<p><a href="/pt-PT/docs/Mozilla/Add-ons/AMO/Policy/Agreement">Leia o acordo</a></p> + +<p><a href="/en-US/Add-ons/WebExtensions/Distribution">Learn more about signing</a></p> + +<h2 id="O_processo_de_revisão">O processo de revisão</h2> + +<p>When a browser extension is submitted for signing, it's subject to automated review. It may also be subject to a manual review, when the automated review determines that a manual review is needed. Your browser extension won't be signed until it’s passed the automated review and may have its signing revoked if it fails to pass the manual review. The review process follows a strict set of guidelines, so it’s easy to check and avoid any likely review problems.</p> + +<p><a href="/en-US/Add-ons/AMO/Policy/Reviews">Check out the review policy and guidelines</a></p> + +<h2 id="Extensões_do_navegador_em_destaque_no_AMO">Extensões do navegador em destaque no AMO</h2> + +<p>If you choose to list your browser extension on AMO, your extension could be featured on the AMO website, in the Firefox browser’s add-on manager, or elsewhere on a Mozilla website. We've compiled a list of guidelines about how extensions are selected for featuring, by following these guidelines you give your extension the best chance of being featured.</p> + +<p><a href="/pt-PT/docs/Mozilla/Add-ons/AMO/Policy/Em_destaque">Saiba mais sobre como colocar os seus extras em destaque</a></p> + +<h2 id="Continue_a_sua_experiência_de_aprendizagem">Continue a sua experiência de aprendizagem</h2> + +<p>Now you know what lies ahead, it's time to dive into more details about browser extension development. In the sections that follow, you’ll discover:</p> + +<ul> + <li>More about the fundamental concepts behind browser extensions, starting with details on how to <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Using_the_JavaScript_APIs">use the JavaScript APIs</a>.</li> + <li>A guide to the <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface">user interface components</a> available to your browser extensions.</li> + <li>A collection of how-to guides on achieving key tasks in your extensions or making use of the JavaScript APIs.</li> + <li>Information on how to port other browser extensions to Firefox.</li> + <li>Details about the Firefox specific workflows you can use to develop browser extensions.</li> + <li>A full reference guide to the JavaScript APIs.</li> + <li>A full reference guide to the Manifest keys.</li> +</ul> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/exemplos_extensoes/index.html b/files/pt-pt/mozilla/add-ons/webextensions/exemplos_extensoes/index.html new file mode 100644 index 0000000000..4a68068c6a --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/exemplos_extensoes/index.html @@ -0,0 +1,28 @@ +--- +title: Exemplos de extensões +slug: Mozilla/Add-ons/WebExtensions/Exemplos_extensoes +tags: + - Extensões da Web +translation_of: Mozilla/Add-ons/WebExtensions/Examples +--- +<div>{{AddonSidebar}}</div> + +<p>Para ajudar a ilustrar como desenvolver extensões, nós mantemos um repositório de exemplos de extensões simples em <a href="https://github.com/mdn/webextensions-examples">https://github.com/mdn/webextensions-examples</a>. Este artigo descreve as APIs de Extensão da Web utilizadas nesse repositório.</p> + +<p>Estes exemplos funcionam no Firefox Nightly: a maioria funciona nas versões anteriores do Firefox, mas verifique a chave <a href="/pt-PT/docs/Mozilla/Add-ons/WebExtensions/manifest.json/applications">strict_min_version</a> em manifest.json da extensão para se certificar.</p> + +<p>Se quiser experimentar estes exemplos, tem três opções principais:</p> + +<ol> + <li>Clone o repositório, depois carregue a extensão diretamente da sua diretoria fonte, utilizando a funcionalidade <a href="/pt-PT/Add-ons/WebExtensions/Instalacao_temporaria_no_Firefox">"Carregar Temporariamente os Extras"</a>. A extensão permanecerá carregada até que reinicie o Firefox.</li> + <li>Clone o repositório, depois utilize a ferramenta de linha de comando <a href="/pt-PT/docs/Mozilla/Add-ons/WebExtensions/Primeiros_passos_com_web-ext">web-ext</a> para executar o Firefox com a extensão instalada.</li> + <li>Clone o repositório, depois vá para a diretoria de <em><a href="https://github.com/mdn/webextensions-examples/tree/master/build">build</a></em>. Esta contém as versões criadas e assinadas de todos os exemplos, e assim pode abri-las no Firefox (utilizando Ficheiro/Abrir Ficheiro) e instale-as permanentemente, tal como uma extensão que instalaria a partir de <a href="https://addons.mozilla.org/en-US/firefox/">addons.mozilla.org</a>.</li> +</ol> + +<div class="warning"> +<p><strong>Importante</strong>: Por favor, não submeta estes exemplos dos exemplos da 'Extensão da Web' para AMO (addons.mozilla.org), não precisa de assinar o extra para executar os exemplos da 'Extensão da Web'. Basta seguir os passos acima.</p> +</div> + +<p>Se desejar contribuir para o repositório, <a href="https://github.com/mdn/webextensions-examples/blob/master/CONTRIBUTING.md">envie-nos um pedido de submissão!</a></p> + +<p>{{WebExtAllExamples}}</p> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/extennsoesweb_e_a_id_do_extra/index.html b/files/pt-pt/mozilla/add-ons/webextensions/extennsoesweb_e_a_id_do_extra/index.html new file mode 100644 index 0000000000..a462a1c02d --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/extennsoesweb_e_a_id_do_extra/index.html @@ -0,0 +1,78 @@ +--- +title: Extensões e a Id. do extra +slug: Mozilla/Add-ons/WebExtensions/ExtennsoesWeb_e_a_id_do_extra +tags: + - Extensões da Web + - WebExtensions +translation_of: Mozilla/Add-ons/WebExtensions/WebExtensions_and_the_Add-on_ID +--- +<div>{{AddonSidebar}}</div> + +<div class="summary"> +<p>Os extras do Firefox contêm uma Id. única que é utilziada para distinguir este extra de qualquer outro extra do Firefox.</p> + +<p>Este artigo descreve como as Ids. de extra são tratados para as extensões criadas com APIs WebExtensions.</p> +</div> + +<p>Firefox add-ons contain a unique identifier which is used both inside Firefox itself and on the <a href="https://addons.mozilla.org/">addons.mozilla.org</a> (AMO) website. For example, it's used by Firefox to check for updates to installed add-ons and to identify which objects (such as data stores) are controlled by this add-on.</p> + +<p>With older types of Firefox add-on, the add-on developer must set the add-on ID explicitly. XUL/XPCOM add-ons set the ID in the <a href="/en-US/docs/Mozilla/Add-ons/Install_Manifests">install manifest</a>, while SDK add-ons set it in the <a href="/en-US/docs/Mozilla/Add-ons/SDK/Tools/package_json">package.json</a>.</p> + +<p>However, from Firefox 48 you can develop, debug, publish, and update extensions without needing to set an explicit ID at all.</p> + +<div class="note"> +<p>Note that the ability to develop and debug WebExtensions that don't include an ID is new in Firefox 48. If you need to use an earlier version of Firefox, then you must use the <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/applications">applications</a></code> key to set an ID explicitly.</p> +</div> + +<h2 id="Basic_workflow_with_no_add-on_ID">Basic workflow with no add-on ID</h2> + +<p>Extensions can explicitly set the add-on ID using the <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/applications">applications</a></code> key in manifest.json. However, this key is usually optional. If you don't set it, then you can usually develop, debug, publish, and update your extension without ever having to deal with an ID. One advantage of this is that Google Chrome does not recognize the <code>applications</code> key and will show a warning if you include it.</p> + +<p>Note, though, that some WebExtension APIs use the add-on ID and expect it to be the same from one browser session to the next. If you use these APIs in Firefox, then you must set the ID explicitly using the <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/applications">applications</a></code> key. See <a href="/en-US/Add-ons/WebExtensions/WebExtensions_and_the_Add-on_ID#When_do_you_need_an_add-on_ID">When do you need an Add-on ID?</a>.</p> + +<h3 id="Developing_and_debugging">Developing and debugging</h3> + +<p>Starting in Firefox 48, if your manifest.json does not contain an ID then the extension will be assigned a randomly-generated temporary ID when you <a href="/en-US/Add-ons/WebExtensions/Temporary_Installation_in_Firefox">install it in Firefox</a> through about:debugging. If you then reload the extension using the "Reload" button, the same ID will be used. If you then restart Firefox and load the add-on again, it will get a new ID.</p> + +<p>If you turn the extension into an .xpi or .zip and install it through about:addons, it will not work. To have it work in this scenario, you will need to add in the <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/applications">applications</a></code> key in manifest.json</p> + +<h3 id="Publishing">Publishing</h3> + +<p>Once you have finished developing the extension, you can <a href="/en-US/Add-ons/WebExtensions/Publishing_your_WebExtension">package it and submit it to AMO for review and signing</a>. If the packaged extension you upload does not contain an ID, AMO will generate one for you. It's only at this point that the add-on will be assigned a permanent ID, which will be embedded in the signed packaged extension.</p> + +<p>Note that once an extension has been given a permanent ID, you can't then update it to use the Add-on SDK or legacy XUL/XPCOM techniques. If you do switch to one of these platforms, you must submit it as a distinct new add-on, with a new ID.</p> + +<h3 id="Updating">Updating</h3> + +<p>Even after this point, though, you don't generally have to deal with the ID at all. You can continue to develop the add-on without an ID, and when you want to update, upload the new version by visiting the add-on's AMO page. Because you are uploading the add-on through that page, AMO knows that this is an update to this particular add-on, even though it doesn't contain an ID.</p> + +<div class="note"> +<p>It's essential with this workflow that you update the add-on <em>manually using its page on AMO</em>, otherwise AMO will not understand that the submission is an update to an existing add-on, and will treat the update as a brand-new add-on.</p> +</div> + +<p>You can do the same thing if you are updating from an older add-on type, such as a XUL/XPCOM add-on, to use WebExtensions APIs. Just visit the old add-on's page on AMO, upload the new extension there, and it will be treated as an update to the old version.</p> + +<h2 id="Quando_é_que_precisa_de_uma_Id._de_extra">Quando é que precisa de uma Id. de extra?</h2> + +<ul> + <li>If you are loading the add-on from its XPI file, are not loading it temporarily using about:debugging and it is not signed.</li> + <li>If you use <a href="https://addons-server.readthedocs.io/en/latest/topics/api/signing.html">AMO's API</a> for uploading your add-on, rather than uploading it manually on its page, then you need to include the add-on's ID in the request.</li> + <li>Some WebExtension APIs use the add-on ID and expect it to be the same from one browser session to the next. If you use these APIs, then you must set the ID explicitly using the <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/applications">applications</a></code> key. This applies to the following APIs: + <ul> + <li>{{WebExtAPIRef("storage.managed")}}</li> + <li>{{WebExtAPIRef("storage.sync")}}</li> + <li>{{WebExtAPIRef("identity.getRedirectURL")}}</li> + <li><a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Native_messaging">Native messaging</a></li> + <li>{{WebExtAPIRef("pkcs11")}}</li> + <li>{{WebExtAPIRef("runtime.onMessageExternal")}}</li> + <li>{{WebExtAPIRef("runtime.onConnectExternal")}}</li> + </ul> + </li> + <li>Using Firefox for Android. See <a href="/en-US/Add-ons/WebExtensions/manifest.json/applications">applications in manifest.json</a>.</li> +</ul> + +<p> </p> + +<p> </p> + +<p> </p> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/extensão_das_ferramentas_de_desenvolvimento/index.html b/files/pt-pt/mozilla/add-ons/webextensions/extensão_das_ferramentas_de_desenvolvimento/index.html new file mode 100644 index 0000000000..dc98e7fd37 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/extensão_das_ferramentas_de_desenvolvimento/index.html @@ -0,0 +1,156 @@ +--- +title: Extensão das ferramentas de desenvolvimento +slug: Mozilla/Add-ons/WebExtensions/Extensão_das_ferramentas_de_desenvolvimento +translation_of: Mozilla/Add-ons/WebExtensions/Extending_the_developer_tools +--- +<div>{{AddonSidebar}}</div> + +<div class="note"> +<p>Esta página descreve as APIs das <em>devtools</em> que existem no Firefox 55. Embora as APIs sejam baseadas nas <a href="https://developer.chrome.com/extensions/devtools">APIs de devtools do Chrome</a>, ainda existem muitas funcionalidades que ainda não estão implementadas no Firefox, e por isso, não estão documentadas aqui. Para ver quais as funcionalidades que estão atualmente em falta, por favor, consulte <a href="/pt-PT/Add-ons/WebExtensions/Extensão_das_ferramentas_de_desenvolvimento#Limitações_das_APIs_de_devtools">Limitações das APIs de devtools</a>.</p> +</div> + +<p>Pode utilizar as APIs das Extensões da Web para ampliar as ferramentas de desenvollvimento integradas no navegador. Para criar a extensão <em>devtools</em>, inclua a chave "<a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/devtools_page">devtools_page</a>" no <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json">manifest.json</a>:</p> + +<pre class="brush: json">"devtools_page": "devtools/devtools-page.html"</pre> + +<p>O valor desta chave é um URL a apontar para um ficheiro HTML que foi incorporado com a sua extensão. O URL deverá ser relativo ao próprio ficheiro manifest.json.</p> + +<p>O ficheiro HTML define uma página especial na extensão, chamada de página <em>devtools</em>.</p> + +<h2 id="A_página_devtools">A página devtools</h2> + +<p>The devtools page is loaded when the browser devtools are opened, and unloaded when it is closed. Note that because the devtools window is associated with a single tab, it's quite possible for more than one devtools window - hence more than one devtools page - to exist at the same time.</p> + +<p>The devtools page doesn't have any visible DOM, but can include JavaScript sources using <code><a href="/en-US/docs/Web/HTML/Element/script"><script></a></code> tags. The sources must be bundled with the extension itself. The sources get access to:</p> + +<ul> + <li>the normal DOM APIs accessible through the global <code><a href="/en-US/docs/Web/API/Window">window</a></code> object</li> + <li>the same <a href="/en-US/Add-ons/WebExtensions/Content_scripts#WebExtension_APIs">WebExtension APIs as in Content Scripts</a></li> + <li>the devtools APIs: + <ul> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/devtools.inspectedWindow">devtools.inspectedWindow</a></code></li> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/devtools.network">devtools.network</a></code></li> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/devtools.panels">devtools.panels</a></code></li> + </ul> + </li> +</ul> + +<p>Note that the devtools page does not get access to any other WebExtension APIs, and the background page doesn't get access to the devtools APIs. Instead, the devtools page and the background page must communicate using the <code>runtime</code> messaging APIs.</p> + +<h2 id="Criar_painéis">Criar painéis</h2> + +<p>The devtools window hosts a number of separate tools - the JavaScript Debugger, Network Monitor, and so on. A row of tabs across the top lets the user switch between the different tools. The window hosting each tool's user interface is called a "panel".</p> + +<p>Using the <code>devtools.panels.create()</code> API, you can create your own panel in the devtools window:</p> + +<pre class="brush: js">browser.devtools.panels.create( + "My Panel", // title + "icons/star.png", // icon + "devtools/panel/panel.html" // content +).then((newPanel) => { + newPanel.onShown.addListener(initialisePanel); + newPanel.onHidden.addListener(unInitialisePanel); +});</pre> + +<p>This takes three mandatory arguments: the panel's title, icon, and content. It returns a <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a></code> which resolves to a <code>devtools.panels.ExtensionPanel</code> object representing the new panel.</p> + +<h2 id="Interagir_com_a_janela_de_destino">Interagir com a janela de destino</h2> + +<p>The developer tools are always attached to a particular browser tab. This is referred to as the "target" for the developer tools, or the "inspected window". You can interact with the inspected window using the <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/devtools.inspectedWindow">devtools.inspectedWindow</a></code> API.</p> + +<h3 id="Executar_código_na_janela_de_destino">Executar código na janela de destino</h3> + +<p>The <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/devtools.inspectedWindow/eval">devtools.inspectedWindow.eval()</a></code> provides one way to run code in the inspected window.</p> + +<p>This is somewhat like using {{WebExtAPIRef("tabs.executeScript()")}} to inject a content script, but with one important difference:</p> + +<ul> + <li>unlike content scripts, scripts loaded using <code>devtools.inspectedWindow.eval()</code><strong> do not</strong> get <a href="/en-US/Add-ons/WebExtensions/Content_scripts#DOM_access">a "clean view of the DOM"</a>: that is, they can see changes to the page made by page scripts.</li> +</ul> + +<div class="note"> +<p>Note that a clean view of the DOM is a security feature, intended to help prevent hostile pages from tricking extensions by redefining the behavior of native DOM functions. This means you need to be very careful using eval(), and should use a normal content script if you can.</p> +</div> + +<p>Scripts loaded using <code>devtools.inspectedWindow.eval()</code> also don't see any JavaScript variables defined by content scripts.</p> + +<h3 id="Trabalhar_com_scripts_de_conteúdo">Trabalhar com <em>scripts</em> de conteúdo</h3> + +<p>A devtools document doesn't have direct access to {{WebExtAPIRef("tabs.executeScript()")}}, so if you need to inject a content script, the devtools document must send a message to the background script asking it to inject the script. The <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/devtools.inspectedWindow/tabId">devtools.inspectedWindow.tabId</a></code> provides the ID of the target tab: the devtools document can pass this to the background script, and the background script can in turn pass it into {{WebExtAPIRef("tabs.executeScript()")}}:</p> + +<pre class="brush: js">// devtools-panel.js + +const scriptToAttach = "document.body.innerHTML = 'Hi from the devtools';"; + +window.addEventListener("click", () => { + browser.runtime.sendMessage({ + tabId: browser.devtools.inspectedWindow.tabId, + script: scriptToAttach + }); +});</pre> + +<pre class="brush: js">// background.js + +function handleMessage(request, sender, sendResponse) { + browser.tabs.executeScript(request.tabId, { + code: request.script + }); +} + +browser.runtime.onMessage.addListener(handleMessage);</pre> + +<p>If you need to exchange messages between the content scripts running in the target window and a devtools document, it's a good idea to use the {{WebExtAPIRef("runtime.connect()")}} and {{WebExtAPIRef("runtime.onConnect")}} to set up a connection between the background page and the devtools document. The background page can then maintain a mapping between tab IDs and {{WebExtAPIRef("runtime.Port")}} objects, and use this to route messages between the two scopes.</p> + +<p><img alt="" src="https://mdn.mozillademos.org/files/14923/devtools-content-scripts.png" style="display: block; height: 416px; margin-left: auto; margin-right: auto; width: 600px;"></p> + +<h2 id="Limitações_das_APIs_de_devtools">Limitações das APIs de devtools</h2> + +<p>These APIs are based on the Chrome devtools APIs, but many features are still missing, compared with Chrome. This section lists the features that are still not implemented, as of Firefox 54. Note that the devtools APIs are under active development and we expect to add support for most of them in future releases.</p> + +<h3 id="devtools.inspectedWindow">devtools.inspectedWindow</h3> + +<p>The following are not supported:</p> + +<ul> + <li><code>inspectedWindow.getResources()</code></li> + <li><code>inspectedWindow.onResourceAdded</code></li> + <li><code>inspectedWindow.onResourceContentCommitted</code></li> +</ul> + +<p>None of the options to <code>inspectedWindow.eval()</code> are supported.</p> + +<p>Scripts injected using <code>inspectedWindow.eval()</code> can't use any of the Console's command-line helper functions, like $0.</p> + +<h3 id="devtools.network">devtools.network</h3> + +<p>The following are not supported:</p> + +<ul> + <li><code>network.getHAR()</code></li> + <li><code>network.onRequestFinished</code></li> +</ul> + +<h3 id="devtools.panels">devtools.panels</h3> + +<p>O seguinte não é suportado:</p> + +<ul> + <li><code>panels.elements</code></li> + <li><code>panels.sources</code></li> + <li><code>panels.setOpenResourceHandler()</code></li> + <li><code>panels.openResource()</code></li> + <li><code>panels.ExtensionPanel.createStatusBarButton()</code></li> + <li><code>panels.Button</code></li> + <li><code>panels.ElementsPanel</code></li> + <li><code>panels.SourcesPanel</code></li> +</ul> + +<h2 id="Exemplos">Exemplos</h2> + +<p>The <a href="https://github.com/mdn/webextensions-examples">webextensions-examples</a> repo on GitHub, contains several examples of extensions that use devtools panels:</p> + +<ul> + <li> + <p><a href="https://github.com/mdn/webextensions-examples/blob/master/devtools-panels/">devtools-panels</a> utiliza painéis de <em>devtools</em>:</p> + </li> +</ul> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/index.html b/files/pt-pt/mozilla/add-ons/webextensions/index.html new file mode 100644 index 0000000000..4c894e2cf1 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/index.html @@ -0,0 +1,135 @@ +--- +title: Extensões de Navegador +slug: Mozilla/Add-ons/WebExtensions +tags: + - Extensões da Web + - Extras + - Landing +translation_of: Mozilla/Add-ons/WebExtensions +--- +<div>{{AddonSidebar}}</div> + +<p>As extensões podem ampliar e modificar a capacidade de um navegador. As extensões para Firefox são criadas utilizando a API de WebExtensions, um sistema de navegador cruzado para desenvolver extensões. Em grande medida, o sistema é compatível com a <a class="external-icon external" href="https://developer.chrome.com/extensions">API de extensão</a> suportada pelo Google Chrome, Opera e <a href="https://browserext.github.io/browserext/">W3C Draft Community Group</a>.</p> + +<p>As extensões escritas para estes navegadores irão na maioria dos casos ser executadas no Firefox ou <a href="https://docs.microsoft.com/pt-pt/microsoft-edge/extensions">Microsoft Edge</a> com <a href="/pt-PT/Add-ons/WebExtensions/Trasnsferir_extensao_Google_Chrome">apenas algumas alterações</a>. A API também é totalmente compatível com <a href="/pt-PT/Firefox/Multiprocess_Firefox">os multiprocessos do Firefox</a>.</p> + +<p>Se tiver ideias ou questões, ou precisar de ajuda para migrar um extra legado para utilizar as APIs de WebExtensions, pode contactar-nos em <a href="https://mail.mozilla.org/listinfo/dev-addons">lista de discussões dev-addons</a> ou <a href="irc://irc.mozilla.org/webextensions">#webextensions</a> no <a href="https://wiki.mozilla.org/IRC">IRC</a></p> + +<div class="row topicpage-table"> +<div class="section"> +<h2 id="Começar">Começar</h2> + +<ul> + <li><a href="/pt-PT/Add-ons/WebExtensions/O_que_sao_WebExtensions">O que são extensões?</a></li> + <li><a href="/pt-PT/Add-ons/WebExtensions/A_sua_primeira_extensao">A sua primeira extensão</a></li> + <li><a href="/pt-PT/Add-ons/WebExtensions/A_sua_segunda_extensao">A sua seguna extensão</a></li> + <li><a href="/pt-PT/Add-ons/WebExtensions/Anatomia_de_uma_extensao">Anatomia de uma extensã</a>o</li> + <li><a href="/pt-PT/docs/Mozilla/Add-ons/WebExtensions/Exemplos_extensoes">Exemplos de Extensões</a></li> + <li><a href="/pt-PT/docs/Mozilla/Add-ons/WebExtensions/E_a_seguir">E a seguir?</a></li> +</ul> + +<h2 id="Conceitos">Conceitos</h2> + +<ul> + <li><a href="/pt-PT/docs/Mozilla/Add-ons/WebExtensions/API">Resumo da API de JavaScript</a></li> + <li><a href="/pt-PT/docs/Mozilla/Add-ons/WebExtensions/Scripts_Conteudo">Scripts de Conteúdo</a></li> + <li><a href="/en-US/Add-ons/WebExtensions/Match_patterns">Match patterns</a></li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Working_with_files">Working with files</a></li> + <li><a href="/pt-PT/docs/Mozilla/Add-ons/WebExtensions/Internationalization">Internationalização</a> (Tradução)</li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Security_best_practices">Security best practices</a></li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_Security_Policy">Content Security Policy</a></li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_messaging">Native messaging</a></li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Using_the_devtools_APIs">Using the devtools APIs</a></li> + <li><a href="/en-US/Add-ons/WebExtensions/User_experience_best_practices">User experience best practices</a></li> + <li><a href="/en-US/Add-ons/WebExtensions/Native_manifests">Native manifests</a></li> +</ul> + +<h2 id="Interface_do_utilizador">Interface do utilizador</h2> + +<ul> + <li><a href="/pt-PT/Add-ons/WebExtensions/interface_do_utilizador">Introdução</a></li> + <li><a href="/pt-PT/Add-ons/WebExtensions/interface_do_utilizador/Ação_navegador">Botão da barra de ferramentas do navegador</a></li> + <li><a href="/pt-PT/Add-ons/WebExtensions/interface_do_utilizador/Popups">Botão da barra de ferramentas do navegador com uma janela (<em>popup</em>)</a></li> + <li><a href="/pt-PT/Add-ons/WebExtensions/interface_do_utilizador/Acoes_pagina">Botão da barra de endereço</a></li> + <li><a href="/pt-PT/Add-ons/WebExtensions/interface_do_utilizador/Popups">Botão da barra de endereço com uma janela (<em>popup</em>)</a></li> + <li><a href="/pt-PT/Add-ons/WebExtensions/interface_do_utilizador/Itens_do_menu_de_contexto">Itens do menu de contexto</a></li> + <li><a href="/pt-PT/Add-ons/WebExtensions/interface_do_utilizador/Barras_laterais">Barras laterais</a></li> + <li><a href="/pt-PT/Add-ons/WebExtensions/interface_do_utilizador/Options_pages">Página de opções</a></li> + <li><a href="https://developer.mozilla.org/pt-PT/docs/Mozilla/Add-ons/WebExtensions/interface_do_utilizador/Paginas_de_extens%C3%A3o">Páginas de extensão</a></li> + <li><a href="/pt-PT/Add-ons/WebExtensions/interface_do_utilizador/Notificacoes">Notificações</a></li> + <li><a href="https://developer.mozilla.org/pt-PT/docs/Mozilla/Add-ons/WebExtensions/interface_do_utilizador/Omnibox">Sugestões da barra de endereço</a></li> + <li><a href="/pt-PT/Add-ons/WebExtensions/interface_do_utilizador/devtools_panels">Painés das ferramentas de desenvolvimento</a></li> + <li><a href="https://developer.mozilla.org/pt-PT/docs/Mozilla/Add-ons/WebExtensions/interface_do_utilizador/Estilos_de_navegador">Estilos de navegador</a></li> +</ul> + +<h2 id="Como...">Como...</h2> + +<ul> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Intercept_HTTP_requests">Intercept HTTP requests</a></li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Modify_a_web_page">Modify a web page</a></li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Add_a_button_to_the_toolbar">Add a button to the toolbar</a></li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Implement_a_settings_page">Implement a settings page</a></li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard">Interact with the clipboard</a></li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Working_with_the_Tabs_API">Work with the Tabs API</a></li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Work_with_the_Bookmarks_API">Work with the Bookmarks API</a></li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Work_with_the_Cookies_API">Work with the Cookies API</a></li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Work_with_contextual_identities">Work with contextual identities</a></li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Safely_inserting_external_content_into_a_page">Insert external content</a></li> +</ul> + +<ul> +</ul> + +<h2 id="Porting">Porting</h2> + +<ul> + <li><a href="/pt-PT/docs/Mozilla/Add-ons/WebExtensions/Trasnsferir_extensao_Google_Chrome">Conversão de uma extensão do Google Chrome</a></li> + <li><a href="/pt-PT/docs/Mozilla/Add-ons/WebExtensions/Conversao_de_uma_extensao_legada_do_firefox">Conversão de uma extensão legada do Firefox</a></li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Developing_WebExtensions_for_Firefox_for_Android">Developing for Firefox for Android</a></li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Embedded_WebExtensions">Embedded WebExtensions</a></li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Comparison_with_the_Add-on_SDK">Comparison with the Add-on SDK</a></li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Comparison_with_XUL_XPCOM_extensions">Comparison with XUL/XPCOM extensions</a></li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Chrome_incompatibilities">Chrome incompatibilities</a></li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Differences_between_desktop_and_Android">Differences between desktop and Android</a></li> +</ul> + +<h2 id="Fluxo_de_trabalho_do_Firefox">Fluxo de trabalho do Firefox</h2> + +<ul> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/User_experience_best_practices">User experience</a></li> + <li><a href="/en-US/Add-ons/WebExtensions/Temporary_Installation_in_Firefox">Installation</a></li> + <li><a href="/en-US/Add-ons/WebExtensions/Debugging">Debugging</a></li> + <li><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Testing_persistent_and_restart_features">Testing persistent and restart features</a></li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Getting_started_with_web-ext">Getting started with web-ext</a></li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/web-ext_command_reference">web-ext command reference</a></li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/WebExtensions_and_the_Add-on_ID">Extensions and the Add-on ID</a></li> + <li><a href="/en-US/Add-ons/WebExtensions/Alternative_distribution_options">Alternative distribution options</a></li> + <li><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Request_the_right_permissions">Request the right permissions</a></li> + <li><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Sharing_objects_with_page_scripts">Sharing objects with page scripts</a></li> + <li><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Retiring_your_extension">Retiring your extension</a></li> + <li><a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Tips">Tips and Tricks</a></li> +</ul> +</div> + +<div class="section"> +<h2 id="Referência">Referência</h2> + +<h3 id="APIS_de_JavaScript">APIS de JavaScript</h3> + +<ul> + <li><a href="/pt-PT/Add-ons/WebExtensions/API">Sinopse de API de JavaScript API</a></li> + <li><a href="/pt-PT/Add-ons/WebExtensions/Suporte_navegador_APIs_JavaScript">Tabelas de compatibilidade de navegador para as APIs de JavaScript</a></li> +</ul> + +<div class="twocolumns">{{ ListSubpages ("/en-US/Add-ons/WebExtensions/API") }}</div> + +<h3 id="idManifest_keys>Manifest_keys">id="Manifest_keys">Manifest keys</h3> + +<ul> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json">manifest.json overview</a></li> + <li><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Browser_compatibility_for_manifest.json">Browser compatibility for manifest.json</a></li> +</ul> + +<div class="twocolumns">{{ ListSubpages ("/en-US/Add-ons/WebExtensions/manifest.json") }}</div> +</div> +</div> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/instalacao_temporaria_no_firefox/index.html b/files/pt-pt/mozilla/add-ons/webextensions/instalacao_temporaria_no_firefox/index.html new file mode 100644 index 0000000000..47730abceb --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/instalacao_temporaria_no_firefox/index.html @@ -0,0 +1,50 @@ +--- +title: Instalação temporária no Firefox +slug: Mozilla/Add-ons/WebExtensions/Instalacao_temporaria_no_Firefox +tags: + - Extensões da Web +translation_of: Mozilla/Add-ons/WebExtensions/Temporary_Installation_in_Firefox +--- +<div>{{AddonSidebar}}</div> + +<p>Este artigo descreve como um programador de extra (add-on) pode instalar temporariamente uma extensão no Firefox para testes e depuração. A extensão permanecerá instalada até que reinicie o Firefox. Pode utilizar este método com qualquer tipo de extensão sem reinício, incluindo as <a href="/pt-PT/docs/Archive/Add-ons/Extensoes_bootstrapped">extensões bootstrapped</a> e <a href="/pt-PT/Add-ons/SDK">extras de Add-on SDK</a>.</p> + +<p>Note that this is <em>not</em> how end users should install add-ons in Firefox. End users will install add-ons by downloading and opening packaged add-ons that have been signed by Mozilla. To learn how an extension developer can get an add-on packaged and signed, see <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Publishing_your_WebExtension">Publishing your extension</a>.</p> + +<p>To install an extension temporarily:</p> + +<ul> + <li>open Firefox</li> + <li>enter "about:debugging" in the URL bar</li> + <li>click "Load Temporary Add-on"</li> + <li>open the extension's directory and select any file inside the extension.</li> +</ul> + +<p>The extension will be installed, and will stay installed until you restart Firefox.</p> + +<p>{{EmbedYouTube("cer9EUKegG4")}}</p> + +<h2 id="Recarregar_uma_extensão_temporária">Recarregar uma extensão temporária</h2> + +<p>Starting in Firefox 48, there's a new button labeled "Reload" next to the extension's entry in about:debugging:</p> + +<p><img alt="" src="https://mdn.mozillademos.org/files/13462/reload.png" style="display: block; height: 544px; margin-left: auto; margin-right: auto; width: 848px;">This does what it says:</p> + +<ul> + <li>reloading any persistent scripts, such as <a href="/en-US/Add-ons/WebExtensions/Anatomy_of_a_WebExtension#Background_scripts">background scripts</a></li> + <li>parsing the <code>manifest.json</code> file again, so changes to <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions">permissions</a></code>, <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/content_scripts">content_scripts</a></code>, <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_action">browser_action</a></code> or any other keys will take effect.</li> +</ul> + +<p>{{EmbedYouTube("NuajE60jfGY")}}</p> + +<div class="note"> +<p>Note that in Firefox 48 only, "Reload" does not update the extension's name and description that are displayed in about:debugging and about:addons. This is fixed in Firefox 49.</p> +</div> + +<h2 id="Utilizar_a_linha_de_comando">Utilizar a linha de comando</h2> + +<p>If you are already using the command line for development, check out the <a href="/en-US/Add-ons/WebExtensions/Getting_started_with_web-ext">web-ext</a> tool. It automates the temporary installation step and automatically reloads your extension when its source code changes.</p> + +<h2 id="Detetar_instalaçao_temporária">Detetar instalaçao temporária</h2> + +<p>Your extension can detect whether it was installed from about:debugging rather than as a built and signed extension downloaded from <a href="https://addons.mozilla.org">addons.mozilla.org</a>. Listen for the {{WebExtAPIRef("runtime.onInstalled")}} event, and check the value of <code>details.temporary</code>.</p> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/interceptar_pedidos_http/index.html b/files/pt-pt/mozilla/add-ons/webextensions/interceptar_pedidos_http/index.html new file mode 100644 index 0000000000..b938b514d4 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/interceptar_pedidos_http/index.html @@ -0,0 +1,160 @@ +--- +title: Interceptar Pedidos HTTP +slug: Mozilla/Add-ons/WebExtensions/Interceptar_Pedidos_HTTP +tags: + - Add-ons + - Como-fazer + - Extensões + - ExtensõesWeb +translation_of: Mozilla/Add-ons/WebExtensions/Intercept_HTTP_requests +--- +<div>{{AddonSidebar}}</div> + +<p>Para interceptar pedidos HTTP, use a {{WebExtAPIRef("webRequest")}} API. Esta API permite que você adicione ouvintes para várias etapas ao fazer uma solicitação HTTP. Nos ouvintes, você pode:</p> + +<ul> + <li>obter acesso para solicitar cabeçalhos e corpos e cabeçalhos de resposta.</li> + <li>pedidos de cancelamento e redirecionamento</li> + <li>modificar pedidos e cabeçalhos de resposta</li> +</ul> + +<p>Neste articulo nós vamos dar uma olhada a tres usos diferentes para o modulo <code>webRequest</code>:</p> + +<ul> + <li>Logar pedidos URLs quando eles são feitos.</li> + <li>Redirecionar pedidos.</li> + <li>Modificar cabeçalhos de pedidos.</li> +</ul> + +<h2 id="Loggar_pedidos_URLs">Loggar pedidos URLs</h2> + +<p>Crie um diretorio chamado "requests". Nesse diretorio crie um ficheiro chamado "manifest.json" com o seguinte conteudo:</p> + +<pre class="brush: json">{ + "description": "Demonstração webRequests", + "manifest_version": 2, + "name": "webRequest-demo", + "version": "1.0", + + "permissions": [ + "webRequest", + "<all_urls>" + ], + + "background": { + "scripts": ["background.js"] + } +}</pre> + +<p>De seguida, crie um ficheiro chamado "background.js" com o seguinte conteudo:</p> + +<pre class="brush: js">function logURL(requestDetails) { + console.log("A carregar: " + requestDetails.url); +} + +browser.webRequest.onBeforeRequest.addListener( + logURL, + {urls: ["<all_urls>"]} +); + +</pre> + +<p>Here we use {{WebExtAPIRef("webRequest.onBeforeRequest", "onBeforeRequest")}} to call the <code>logURL()</code> function just before starting the request. The <code>logURL()</code> function grabs the URL of the request from the event object and logs it to the browser console. The <code>{urls: ["<all_urls>"]}</code> <a href="/en-US/Add-ons/WebExtensions/Match_patterns">pattern</a> means we will intercept HTTP requests to all URLs.</p> + +<p>To test it out, <a href="/en-US/Add-ons/WebExtensions/Temporary_Installation_in_Firefox">install the extension</a>, <a href="/en-US/docs/Tools/Browser_Console">open the Browser Console</a>, and open some Web pages. In the Browser Console, you should see the URLs for any resources that the browser requests:</p> + +<p>{{EmbedYouTube("X3rMgkRkB1Q")}}</p> + +<h2 id="Redirecting_requests">Redirecting requests</h2> + +<p>Now let's use <code>webRequest</code> to redirect HTTP requests. First, replace manifest.json with this:</p> + +<pre class="brush: json">{ + + "description": "Demonstrating webRequests", + "manifest_version": 2, + "name": "webRequest-demo", + "version": "1.0", + + "permissions": [ + "webRequest", + "webRequestBlocking", + "https://developer.mozilla.org/", + "https://mdn.mozillademos.org/" + ], + + "background": { + "scripts": ["background.js"] + } + +}</pre> + +<p>The only change here is to add the <code>"webRequestBlocking"</code> <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions">permission</a></code>. We need to ask for this extra permission whenever we are actively modifying a request.</p> + +<p>Next, replace "background.js" with this:</p> + +<pre class="brush: js">var pattern = "https://mdn.mozillademos.org/*"; + +function redirect(requestDetails) { + console.log("Redirecting: " + requestDetails.url); + return { + redirectUrl: "https://38.media.tumblr.com/tumblr_ldbj01lZiP1qe0eclo1_500.gif" + }; +} + +browser.webRequest.onBeforeRequest.addListener( + redirect, + {urls:[pattern], types:["image"]}, + ["blocking"] +);</pre> + +<p>Again, we use the {{WebExtAPIRef("webRequest.onBeforeRequest", "onBeforeRequest")}} event listener to run a function just before each request is made. This function will replace the target URL with the <code>redirectUrl</code> specified in the function.</p> + +<p>This time we are not intercepting every request: the <code>{urls:[pattern], types:["image"]}</code> option specifies that we should only intercept requests (1) to URLs residing under "https://mdn.mozillademos.org/" (2) for image resources. See {{WebExtAPIRef("webRequest.RequestFilter")}} for more on this.</p> + +<p>Also note that we're passing an option called <code>"blocking"</code>: we need to pass this whenever we want to modify the request. It makes the listener function block the network request, so the browser waits for the listener to return before continuing. See the {{WebExtAPIRef("webRequest.onBeforeRequest")}} documentation for more on <code>"blocking"</code>.</p> + +<p>To test it out, open a page on MDN that contains a lot of images (for example <a href="https://developer.mozilla.org/en-US/docs/Tools/Network_Monitor">https://developer.mozilla.org/en-US/docs/Tools/Network_Monitor</a>), <a href="/en-US/Add-ons/WebExtensions/Temporary_Installation_in_Firefox#Reloading_a_temporary_add-on">reload the extension</a>, and then reload the MDN page:</p> + +<p>{{EmbedYouTube("ix5RrXGr0wA")}}</p> + +<h2 id="Modifying_request_headers">Modifying request headers</h2> + +<p>Finally we'll use <code>webRequest</code> to modify request headers. In this example we'll modify the "User-Agent" header so the browser identifies itself as Opera 12.16, but only when visiting pages under http://useragentstring.com/".</p> + +<p>The "manifest.json" can stay the same as in the previous example.</p> + +<p>Replace "background.js" with code like this:</p> + +<pre class="brush: js">var targetPage = "http://useragentstring.com/*"; + +var ua = "Opera/9.80 (X11; Linux i686; Ubuntu/14.10) Presto/2.12.388 Version/12.16"; + +function rewriteUserAgentHeader(e) { + for (var header of e.requestHeaders) { + if (header.name.toLowerCase() == "user-agent") { + header.value = ua; + } + } + return {requestHeaders: e.requestHeaders}; +} + +browser.webRequest.onBeforeSendHeaders.addListener( + rewriteUserAgentHeader, + {urls: [targetPage]}, + ["blocking", "requestHeaders"] +);</pre> + +<p>Here we use the {{WebExtAPIRef("webRequest.onBeforeSendHeaders", "onBeforeSendHeaders")}} event listener to run a function just before the request headers are sent.</p> + +<p>The listener function will be called only for requests to URLs matching the <code>targetPage</code> <a href="/en-US/Add-ons/WebExtensions/Match_patterns">pattern</a>. Also note that we've again passed <code>"blocking"</code> as an option. We've also passed <code>"requestHeaders"</code>, which means that the listener will be passed an array containing the request headers that we expect to send. See {{WebExtAPIRef("webRequest.onBeforeSendHeaders")}} for more information on these options.</p> + +<p>The listener function looks for the "User-Agent" header in the array of request headers, replaces its value with the value of the <code>ua</code> variable, and returns the modified array. This modified array will now be sent to the server.</p> + +<p>To test it out, open <a href="http://useragentstring.com/">useragentstring.com</a> and check that it identifies the browser as Firefox. Then reload the extension, reload <a href="http://useragentstring.com/">useragentstring.com</a>, and check that Firefox is now identified as Opera:</p> + +<p>{{EmbedYouTube("SrSNS1-FIx0")}}</p> + +<h2 id="Learn_more">Learn more</h2> + +<p>To learn about all the things you can do with the <code>webRequest</code> API, see its <a href="/en-US/Add-ons/WebExtensions/API/WebRequest">reference documentation</a>.</p> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/acoes_pagina/index.html b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/acoes_pagina/index.html new file mode 100644 index 0000000000..7093d3355c --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/acoes_pagina/index.html @@ -0,0 +1,50 @@ +--- +title: Botão da barra de endereço +slug: Mozilla/Add-ons/WebExtensions/interface_do_utilizador/Acoes_pagina +tags: + - Extensões da Web + - Interface do Utilizador +translation_of: Mozilla/Add-ons/WebExtensions/user_interface/Page_actions +--- +<div>{{AddonSidebar}}</div> + +<p>Normalmente referido como uma <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/pageAction">ação da página</a>, esta opção da inteface do utilizador é um botão adicionado à barra de endereço do navegador. Os utilziadores clicam no botão para interagir com a sua extensão.</p> + +<p><img alt="" src="https://mdn.mozillademos.org/files/12960/page-action.png" style="display: block; height: 262px; margin-left: auto; margin-right: auto; width: 850px;"></p> + +<p>Use this button when a feature is only relevant for some web pages. By default, the address bar button is hidden in all browser tabs, and you call <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/PageAction/show" title="Shows the page action for a given tab. The page action is shown whenever the given tab is the active tab."><code>pageAction.show()</code></a> and <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/PageAction/hide" title="Hides the page action for a given tab."><code>pageAction.hide()</code></a> to show or hide it in specific tabs.</p> + +<p>Compare to the <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Browser_action">toolbar button</a>, which offers similar behavior but is used in situations where the extension's features are applicable to almost every web page.</p> + +<h2 id="Especificar_a_ação_da_página">Especificar a ação da página</h2> + +<p>You define the page action's properties using the <code><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/page_action">page_action</a></code> key in manifest.json:</p> + +<pre class="brush: json line-numbers language-json"><code class="language-json"><span class="key token">"page_action":</span> <span class="punctuation token">{</span> + <span class="key token">"browser_style":</span> <span class="keyword token">true</span><span class="punctuation token">,</span> + <span class="key token">"default_icon":</span> <span class="punctuation token">{</span> + <span class="key token">"19":</span> <span class="string token">"button/geo-19.png"</span><span class="punctuation token">,</span> + <span class="key token">"38":</span> <span class="string token">"button/geo-38.png"</span> + <span class="punctuation token">}</span><span class="punctuation token">,</span> + <span class="key token">"default_title":</span> <span class="string token">"Whereami?"</span> +<span class="punctuation token">}</span></code></pre> + +<p>The only mandatory key is <code>default_icon</code>.</p> + +<p>There are two ways to specify a page action: with or without a <a href="/en-US/Add-ons/WebExtensions/Popups">popup</a>. If you don't specify a popup, when the user clicks the button an event is dispatched to the extension, which the extension listens for using <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/pageAction/onClicked" title="Fired when a browser action icon is clicked. This event will not fire if the browser action has a popup."><code>pageAction.onClicked</code></a>:</p> + +<pre class="brush: js line-numbers language-js"><code class="language-js">browser<span class="punctuation token">.</span>pageAction<span class="punctuation token">.</span>onClicked<span class="punctuation token">.</span><span class="function token">addListener</span><span class="punctuation token">(</span>handleClick<span class="punctuation token">)</span><span class="punctuation token">;</span></code></pre> + +<p>If you specify a popup, the click event is not dispatched: instead, the popup is shown when the user clicks the button. The user is able to interact with the popup and it closes automatically when the user clicks outside it. See the <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Popups">Popup </a>article for more details on creating and managing popups.</p> + +<p>Note that your extension can have one page action only.</p> + +<p>You can change any of the page action properties programmatically using the <code><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/pageAction">pageAction</a></code> API.</p> + +<h2 id="Exemplos">Exemplos</h2> + +<p>The <a href="https://github.com/mdn/webextensions-examples">webextensions-examples</a> repo on GitHub, contains several examples of extensions that use page action:</p> + +<ul> + <li><a href="https://github.com/mdn/webextensions-examples/tree/master/chill-out">chill-out</a> uses a page action without a popup.</li> +</ul> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/ação_navegador/index.html b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/ação_navegador/index.html new file mode 100644 index 0000000000..c5da78003b --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/ação_navegador/index.html @@ -0,0 +1,50 @@ +--- +title: Botão da Barra de Ferramentas +slug: Mozilla/Add-ons/WebExtensions/interface_do_utilizador/Ação_navegador +tags: + - Extensão da Web +translation_of: Mozilla/Add-ons/WebExtensions/user_interface/Browser_action +--- +<div>{{AddonSidebar}}</div> + +<p>Normalmente referido como uma <a href="/pt-PT/Add-ons/WebExtensions/API/browserAction">ação do navegador</a>, esta opção da interface do utilizador é um botão adicionado à barra de ferramentas do navegador. Os utilizadores clicam no botão para interagir com a sua extensão.<br> + <img alt="" src="https://mdn.mozillademos.org/files/15751/browser-action.png" style="display: block; height: 182px; margin-left: auto; margin-right: auto; width: 350px;"></p> + +<p>The toolbar button (browser action) is very like the address bar button (page action). For the differences, and guidance on when to use what, see <a href="/en-US/Add-ons/WebExtensions/user_interface/Page_actions#Page_actions_and_browser_actions">Page actions and browser actions</a>.</p> + +<h2 id="Especificar_a_ação_do_navegador">Especificar a ação do navegador</h2> + +<p>Define as propriedades da ação do navegador utilizando a chave <code><a href="/pt-PT/Add-ons/WebExtensions/manifest.json/browser_action">browser_action</a></code> em manifest.json:</p> + +<pre class="brush: json line-numbers language-json"><code class="language-json"><span class="key token">"browser_action":</span> <span class="punctuation token">{</span> + <span class="key token">"default_icon":</span> <span class="punctuation token">{</span> + <span class="key token">"19":</span> <span class="string token">"button/geo-19.png"</span><span class="punctuation token">,</span> + <span class="key token">"38":</span> <span class="string token">"button/geo-38.png"</span> + <span class="punctuation token">}</span><span class="punctuation token">,</span> + <span class="key token">"default_title":</span> <span class="string token">"Whereami?"</span> +<span class="punctuation token">}</span></code></pre> + +<p>The only mandatory key is <code>default_icon</code>.</p> + +<p>There are two ways to specify a browser action: with or without a <a href="/en-US/Add-ons/WebExtensions/Popups">popup</a>. If you don't specify a popup, when the user clicks the button an event is dispatched to the extension, which the extension listens for using <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/BrowserAction/onClicked" title="Fired when a browser action icon is clicked. This event will not fire if the browser action has a popup."><code>browserAction.onClicked</code></a>:</p> + +<pre class="brush: js line-numbers language-js"><code class="language-js">browser<span class="punctuation token">.</span>browserAction<span class="punctuation token">.</span>onClicked<span class="punctuation token">.</span><span class="function token">addListener</span><span class="punctuation token">(</span>handleClick<span class="punctuation token">)</span><span class="punctuation token">;</span></code></pre> + +<p>If you specify a popup, the click event is not dispatched: instead, the popup is shown when the user clicks the button. The user is able to interact with the popup and it closes automatically when the user clicks outside it. See the <a href="/en-US/Add-ons/WebExtensions/Popups">Popup </a>article for more details on creating and managing popups.</p> + +<p>Note that your extension can have only one browser action.</p> + +<p>You can change any of the browser action properties programmatically using the <code><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/browserAction">browserAction</a></code> API.</p> + +<h2 id="Ícones">Ícones</h2> + +<p>For details on how to create icons to use with your browser action, see <a href="https://design.firefox.com/photon/visuals/iconography.html">Iconography</a> in the <a class="grey-90 no-underline hover-no-underline" href="https://design.firefox.com/photon/index.html">Photon Design System</a> documentation.</p> + +<h2 id="Exemplos">Exemplos</h2> + +<p>The <a href="https://github.com/mdn/webextensions-examples">webextensions-examples</a> repository on GitHub contains two examples of extensions that implement browser actions:</p> + +<ul> + <li><a href="https://github.com/mdn/webextensions-examples/blob/master/bookmark-it/">bookmark-it</a> uses a browser action without a popup.</li> + <li><a href="https://github.com/mdn/webextensions-examples/tree/master/beastify">beastify</a> uses a browser action with a popup.</li> +</ul> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/barras_laterais/index.html b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/barras_laterais/index.html new file mode 100644 index 0000000000..2cfa1800a7 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/barras_laterais/index.html @@ -0,0 +1,57 @@ +--- +title: Barras laterais +slug: Mozilla/Add-ons/WebExtensions/interface_do_utilizador/Barras_laterais +tags: + - Extensões da Web +translation_of: Mozilla/Add-ons/WebExtensions/user_interface/Sidebars +--- +<div>{{AddonSidebar}}</div> + +<div> +<p> </p> + +<p>Uma barra lateral é um painel que é exibido no lado esquerdo da janela do navegador, ao lado da página da Web. O navegador fornece uma IU que permite ao utilizador ver as barras laterais atualmente disponíveis e selecionar uma barra lateral para exibir. Por exemplo, o Firefox tem um menu 'Ver -> Barra lateral'. Apenas pode ser exibida uma barra lateral de cada vez, e essa barra lateral será exibida para todos os separadores e todas as janelas do navegador.</p> + +<p>O navegador poderá incluir uma série de barras laterais integradas. Por exemplo, o Firefox inclui uma barra lateral para interagir com marcadores:</p> + +<p><img alt="" src="https://mdn.mozillademos.org/files/14825/bookmarks-sidebar.png" style="display: block; height: 761px; margin-left: auto; margin-right: auto; width: 728px;">Using the <code>sidebar_action</code> manifest.json key, an extension can add its own sidebar to the browser. It will be listed alongside the built-in sidebars, and the user will be able to open it using the same mechanism as for the built-in sidebars.</p> + +<p>Like a browser action popup, you specify the sidebar's contents as an HTML document. When the user opens the sidebar, its document is loaded into every open browser window. Each window gets its own instance of the document. When new windows are opened, they get their own sidebar documents as well.</p> + +<p>You can set a document for a particular tab using the {{WebExtAPIRef("sidebarAction.setPanel()")}} function. A sidebar can figure out which window it belongs to using the {{WebExtAPIRef("windows.getCurrent()")}} API:</p> + +<pre class="brush: js">// sidebar.js +browser.windows.getCurrent({populate: true}).then((windowInfo) => { + myWindowId = windowInfo.id; +});</pre> + +<p>This is useful if a sidebar wants to display different content for different windows. For an example of this, see the <a href="https://github.com/mdn/webextensions-examples/tree/master/annotate-page">"annotate-page" example</a>.</p> + +<p>Sidebar documents get access to the same set of privileged JavaScript APIs that the extension's background and popup scripts get. They can get direct access to the background page (unless the sidebar belongs to incognito mode window) using {{WebExtAPIRef("runtime.getBackgroundPage()")}}, and can interact with content scripts or native applications using messaging APIs like {{WebExtAPIRef("tabs.sendMessage()")}} and {{WebExtAPIRef("runtime.sendNativeMessage()")}}.</p> + +<p>Sidebar documents are unloaded when their browser window is closed or when the user closes the sidebar. This means that unlike background pages, sidebar documents don't stay loaded all the time, but unlike browser action popups, they stay loaded while the user interacts with web pages.</p> + +<p>When an extension that defines a sidebar is first installed, its sidebar will be opened automatically. This is intended to help the user understand that the extension includes a sidebar. Note that it's not possible for extension to open sidebars programmatically: sidebars can only be opened by the user.</p> + +<h2 id="Especificar_barras_laterais">Especificar barras laterais</h2> + +<p>To specify a sidebar, define the default document with the <code><a href="/en-US/Add-ons/WebExtensions/manifest.json/sidebar_action">sidebar_action</a></code> manifest.json key, alongside a default title and icon:</p> + +<pre class="brush: json">"sidebar_action": { + "default_title": "My sidebar", + "default_panel": "sidebar.html", + "default_icon": "sidebar_icon.png" +}</pre> + +<p>You can change the title, panel, and icon programmatically using the {{WebExtAPIRef("sidebarAction")}} API.</p> + +<p>Title and icon are shown to the user in any UI provided by the browser to list sidebars, such as the "View > Sidebar" menu in Firefox.</p> + +<h2 id="Exemplo">Exemplo</h2> + +<p>O repositório de <a href="https://github.com/mdn/webextensions-examples">exemplos das extensões da Web</a> no GitHub, contém vários exemplos de extensões que utilizam a barra lateral:</p> + +<ul> + <li><a href="https://github.com/mdn/webextensions-examples/tree/master/annotate-page">annotate-page</a> utiliza uma barra lateral.</li> +</ul> +</div> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/devtools_panels/index.html b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/devtools_panels/index.html new file mode 100644 index 0000000000..a2bc9921ad --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/devtools_panels/index.html @@ -0,0 +1,62 @@ +--- +title: Painéis das ferramentas de desenvolvimento +slug: Mozilla/Add-ons/WebExtensions/interface_do_utilizador/devtools_panels +tags: + - Extensões da Web + - Guía + - Interface do Utilizador + - Principiante +translation_of: Mozilla/Add-ons/WebExtensions/user_interface/devtools_panels +--- +<div>{{AddonSidebar}}</div> + +<div class="note"> +<p>Esta funcionalidade está disponível desde o Firefox 54.</p> +</div> + +<p>Quando uma extensão fornece ferramentas que são úteis para os programadores, é possível adicionar uma IU para as mesmas para as ferramentas de desenvolvimento do navegador como um novo painel.</p> + +<p><img alt='Simple example showing the addition of "My panel" to the Developer Tools tabs.' src="https://mdn.mozillademos.org/files/15035/devtools_panel_example.png" style="height: 352px; width: 1192px;"></p> + +<h2 id="Especificar_um_painel_de_ferramentas_de_desenvolvimento">Especificar um painel de ferramentas de desenvolvimento</h2> + +<p>Um painél das ferramentas de desenvovlimento é adicionado utilizando a API <code><a href="/pt-PT/Add-ons/WebExtensions/API/devtools.panels">devtools.panels</a></code>, que precisa de ser executada a partir de uma página de <em>devtools</em> especial.</p> + +<p>Adicione a páginas de devtools, incluindo a chave <code><a href="/pt-PT/Add-ons/WebExtensions/manifest.json/devtools_page">devtools_page</a></code> na extensão de <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json">manifest.json</a> e forneça a localização do ficheiro HTML da página na extensão:</p> + +<pre class="brush: json line-numbers language-json"><code class="language-json"><span class="key token">"devtools_page":</span> <span class="string token">"devtools-page.html"</span></code></pre> + +<p>From the devtools page, call a script that will add the devtools panel:</p> + +<pre class="brush: html"><body> + <script src="devtools.js"></script> +</body></pre> + +<p>In the script, create the devtools panel by specifying the panel's title, icon, and HTML file that provides the panel's content:</p> + +<pre class="brush: js">function handleShown() { + console.log("panel is being shown"); +} + +function handleHidden() { + console.log("panel is being hidden"); +} + +browser.devtools.panels.create( + "My Panel", // title + "icons/star.png", // icon + "devtools/panel/panel.html" // content +).then((newPanel) => { + newPanel.onShown.addListener(handleShown); + newPanel.onHidden.addListener(handleHidden); +});</pre> + +<p>The extension can now run code in the inspected window using <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/devtools.inspectedWindow/eval"><code>devtools</code>.inspectedWindow.eval()</a></code> or by injecting a content script via the background script by passing a message. You can find more details on how to do this in <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Extending_the_developer_tools">Extending the developer tools.</a></p> + +<h2 id="Exemplos">Exemplos</h2> + +<p>The <a href="https://github.com/mdn/webextensions-examples">webextensions-examples</a> repo on GitHub, contains several examples of extensions that use devtools panels:</p> + +<ul> + <li><a href="https://github.com/mdn/webextensions-examples/blob/master/devtools-panels/">devtools-panels</a> use devtools panels:</li> +</ul> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/estilos_de_navegador/index.html b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/estilos_de_navegador/index.html new file mode 100644 index 0000000000..bc2f1bd2da --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/estilos_de_navegador/index.html @@ -0,0 +1,453 @@ +--- +title: Estilos de navegador +slug: Mozilla/Add-ons/WebExtensions/interface_do_utilizador/Estilos_de_navegador +tags: + - Extensões + - Extensões da Web + - Extras +translation_of: Mozilla/Add-ons/WebExtensions/user_interface/Browser_styles +--- +<div>{{AddonSidebar}}</div> + +<p>Certain user interface components - browser and page action <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Popups">popups</a>, <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Sidebars">sidebars</a>, and <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/user_interface/Options_pages">options pages</a> - are specified by your extension in essentially the same way:</p> + +<ol> + <li>create an HTML file defining the structure of the UI element</li> + <li>add a manifest.json key (<code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_action">browser_action</a></code>, <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/page_action">page_action</a></code>, <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/sidebar_action">sidebar_action</a></code>, or <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/options_ui">options_ui</a></code>) pointing to that HTML file.</li> +</ol> + +<p>One of the challenges with this approach is styling the element in such a way that it fits in with the browser's own style. To help with this, the manifest.json keys include an extra optional property: <code>browser_style</code>. If this is included and set to <code>true</code>, then your document will get one or more extra stylesheets that will help make it look consistent with the browser's UI and with other extensions that use the <code>browser_style</code> property.</p> + +<p>In Firefox, the stylesheet can be seen at <code>chrome://browser/content/extension.css</code>. The extra stylesheet at <code>chrome://browser/content/extension-mac.css</code> is also included on OS X.</p> + +<p>Most styles are automatically applied, but some elements require you to add the <span style="white-space: nowrap;">non-standard</span> <code style="white-space: nowrap;">browser-style</code> class to get their styling since Firefox 55, as detailed in the table below:</p> + +<table class="fullwidth-table standard-table"> + <thead> + <tr> + <th scope="col">Elemento</th> + <th scope="col">Exemplo</th> + </tr> + </thead> + <tbody> + <tr> + <td><code><a href="/en-US/docs/Web/HTML/Element/button"><button></a></code></td> + <td> + <pre class="brush: html no-line-numbers"> +<button class="browser-style">Click me</button>{{non-standard_inline}}</pre> + </td> + </tr> + <tr> + <td> + <p><code><a href="/en-US/docs/Web/HTML/Element/select"><select></a></code></p> + </td> + <td> + <pre class="brush: html no-line-numbers"> +<select class="browser-style" name="select"> + <option value="value1">Value 1</option> + <option value="value2" selected>Value 2</option> + <option value="value3">Value 3</option> +</select></pre> + </td> + </tr> + <tr> + <td><code><a href="/en-US/docs/Web/HTML/Element/textarea"><textarea></a></code></td> + <td> + <pre class="brush: html no-line-numbers"> +<textarea class="browser-style">Write here</textarea></pre> + </td> + </tr> + <tr> + <td>Parent of an <code><a href="/en-US/docs/Web/HTML/Element/input"><input></a></code></td> + <td> + <pre class="brush: html no-line-numbers"> +<div class="browser-style"> + <input type="radio" id="op1" name="choices" value="op1"> + <label for="op1">Option 1</label> + + <input type="radio" id="op2" name="choices" value="op2"> + <label for="op2">Option 2</label> +</div></pre> + </td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilidade_de_navegador">Compatibilidade de navegador</h2> + + + +<p>{{Compat("webextensions.browser_style")}}</p> + +<h2 id="Componentes_de_Painel_do_Firefox">Componentes de Painel do Firefox</h2> + +<div class="overheadIndicator nonStandard nonStandardHeader"> +<p><strong>{{NonStandardBadge(1)}} Non-Standard</strong><br> + This feature is non-standard and only works in Firefox.</p> +</div> + +<p>The <code>chrome://browser/content/extension.css</code> stylesheet also contains the styles for the Firefox Panel Components.</p> + +<p>The <a href="https://firefoxux.github.io/StyleGuide/#/navigation">legacy Firefox Style Guide</a> documents proper usage.</p> + +<table class="fullwidth-table standard-table"> + <thead> + <tr> + <th scope="col">Elemento</th> + <th scope="col">Exemplo</th> + </tr> + </thead> + <tbody> + <tr> + <td>Cabeçalho</td> + <td> + <pre class="brush: html"> +<header class="panel-section panel-section-header"> + <div class="icon-section-header"><img src="image.svg"/></div> + <div class="text-section-header">Header</div> +</header></pre> + </td> + </tr> + <tr> + <td>Rodapé</td> + <td> + <pre class="brush: html"> +<footer class="panel-section panel-section-footer"> + <button class="panel-section-footer-button">Cancel</button> + <div class="panel-section-footer-separator"></div> + <button class="panel-section-footer-button default">Confirm</button> +</footer></pre> + </td> + </tr> + <tr> + <td>Separadores</td> + <td> + <pre class="brush: html"> +<div class="panel-section panel-section-tabs"> + <button class="panel-section-tabs-button selected">Tab</button> + <div class="panel-section-tabs-separator"></div> + <button class="panel-section-tabs-button">Tab</button> + <div class="panel-section-tabs-separator"></div> + <button class="panel-section-tabs-button">Tab</button> +</div></pre> + </td> + </tr> + <tr> + <td>Form</td> + <td> + <pre class="brush: html"> +<div class="panel-section panel-section-formElements"> + <div class="panel-formElements-item"> + <label for="name01">Label:</label> + <input type="text" value="Name" id="name01" /> + </div> + <div class="panel-formElements-item"> + <label for="picker01">Label:</label> + <select id="picker01"> + <option value="value1" selected="true">Dropdown</option> + <option value="value2">List Item</option> + <option value="value3">List Item</option> + </select> + </div> + <div class="panel-formElements-item"> + <label for="placeholder01">Label:</label> + <input type="text" placeholder="Placeholder" id="placeholder01" /> + <button name="expander" class="expander"></button> + </div> +</div></pre> + </td> + </tr> + <tr> + <td>Menu</td> + <td> + <pre class="brush: html"> +<div class="panel-section panel-section-list"> + <div class="panel-list-item"> + <div class="icon"></div> + <div class="text">List Item</div> + <div class="text-shortcut">Ctrl-L</div> + </div> + + <div class="panel-list-item"> + <div class="icon"></div> + <div class="text">List Item</div> + <div class="text-shortcut"></div> + </div> + + <div class="panel-section-separator"></div> + + <div class="panel-list-item disabled"> + <div class="icon"></div> + <div class="text">Disabled List Item</div> + <div class="text-shortcut"></div> + </div> + + <div class="panel-section-separator"></div> + + <div class="panel-list-item"> + <div class="icon"></div> + <div class="text">List Item</div> + <div class="text-shortcut"></div> + </div> + + <div class="panel-list-item"> + <div class="icon"></div> + <div class="text">List Item</div> + <div class="text-shortcut"></div> + </div> +</div></pre> + </td> + </tr> + </tbody> +</table> + +<h3 id="Exemplo">Exemplo</h3> + +<h4 id="HTML">HTML</h4> + +<pre class="brush: html"><header class="panel-section panel-section-header"> + <div class="icon-section-header"><!-- An image goes here. --></div> + <div class="text-section-header">Header</div> +</header> + +<div class="panel-section panel-section-list"> + <div class="panel-list-item"> + <div class="icon"></div> + <div class="text">List Item</div> + <div class="text-shortcut">Ctrl-L</div> + </div> + + <div class="panel-list-item"> + <div class="icon"></div> + <div class="text">List Item</div> + <div class="text-shortcut"></div> + </div> + + <div class="panel-section-separator"></div> + + <div class="panel-list-item disabled"> + <div class="icon"></div> + <div class="text">Disabled List Item</div> + <div class="text-shortcut"></div> + </div> + + <div class="panel-section-separator"></div> + + <div class="panel-list-item"> + <div class="icon"></div> + <div class="text">List Item</div> + <div class="text-shortcut"></div> + </div> + + <div class="panel-list-item"> + <div class="icon"></div> + <div class="text">List Item</div> + <div class="text-shortcut"></div> + </div> +</div> + +<footer class="panel-section panel-section-footer"> + <button class="panel-section-footer-button">Cancel</button> + <div class="panel-section-footer-separator"></div> + <button class="panel-section-footer-button default">Confirm</button> +</footer></pre> + +<div class="hidden"> +<h4 id="CSS">CSS</h4> + +<pre class="brush: css">/* Global */ +html, +body { + background: white; + box-sizing: border-box; + color: #222426; + cursor: default; + display: flex; + flex-direction: column; + font: caption; + margin: 0; + padding: 0; + -moz-user-select: none; +} + +body * { + box-sizing: border-box; + text-align: start; +} + +button.panel-section-footer-button, +button.panel-section-tabs-button { + color: inherit; + background-color: unset; + font: inherit; + text-shadow: inherit; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + border: none; +} + +/* Panel Section */ +.panel-section { + display: flex; + flex-direction: row; +} + +.panel-section-separator { + background-color: rgba(0, 0, 0, 0.15); + min-height: 1px; +} + +/* Panel Section - Header */ +.panel-section-header { + border-bottom: 1px solid rgba(0, 0, 0, 0.15); + padding: 16px; +} + +.panel-section-header > .icon-section-header { + background-position: center center; + background-repeat: no-repeat; + height: 32px; + margin-right: 16px; + position: relative; + width: 32px; +} + +.panel-section-header > .text-section-header { + align-self: center; + font-size: 1.385em; + font-weight: lighter; +} + +/* Panel Section - List */ +.panel-section-list { + flex-direction: column; + padding: 4px 0; +} + +.panel-list-item { + align-items: center; + display: flex; + flex-direction: row; + height: 24px; + padding: 0 16px; +} + +.panel-list-item:not(.disabled):hover { + background-color: rgba(0, 0, 0, 0.06); + border-bottom: 1px solid rgba(0, 0, 0, 0.1); + border-top: 1px solid rgba(0, 0, 0, 0.1); +} + +.panel-list-item:not(.disabled):hover:active { + background-color: rgba(0, 0, 0, 0.1); +} + +.panel-list-item.disabled { + color: #999; +} + +.panel-list-item > .icon { + flex-grow: 0; + flex-shrink: 0; +} + +.panel-list-item > .text { + flex-grow: 10; +} + +.panel-list-item > .text-shortcut { + color: #808080; + font-family: "Lucida Grande", caption; + font-size: .847em; + justify-content: flex-end; +} + +.panel-section-list .panel-section-separator { + margin: 4px 0; +} + +/* Panel Section - Footer */ +.panel-section-footer { + background-color: rgba(0, 0, 0, 0.06); + border-top: 1px solid rgba(0, 0, 0, 0.15); + color: #1a1a1a; + display: flex; + flex-direction: row; + height: 41px; + margin-top: -1px; + padding: 0; +} + +.panel-section-footer-button { + flex: 1 1 auto; + height: 100%; + margin: 0 -1px; + padding: 12px; + text-align: center; +} + +.panel-section-footer-button > .text-shortcut { + color: #808080; + font-family: "Lucida Grande", caption; + font-size: .847em; +} + +.panel-section-footer-button:hover { + background-color: rgba(0, 0, 0, 0.06); +} + +.panel-section-footer-button:hover:active { + background-color: rgba(0, 0, 0, 0.1); +} + +.panel-section-footer-button.default { + background-color: #0996f8; + box-shadow: 0 1px 0 #0670cc inset; + color: #fff; +} + +.panel-section-footer-button.default:hover { + background-color: #0670cc; + box-shadow: 0 1px 0 #005bab inset; +} + +.panel-section-footer-button.default:hover:active { + background-color: #005bab; + box-shadow: 0 1px 0 #004480 inset; +} + +.panel-section-footer-separator { + background-color: rgba(0, 0, 0, 0.1); + width: 1px; + z-index: 99; +}</pre> + +<hr> +<pre class="brush: css">/* Example specific – not part of chrome://browser/content/extension.css */ +body { + background: #fcfcfc; + background-clip: padding-box; + border: 1px solid rgba(24,26,27,.2); + box-shadow: 0 3px 5px rgba(24,26,27,.1),0 0 7px rgba(24,26,27,.1); + box-sizing: content-box; + margin: 2em auto .5em; + width: 384px; +} + +html { + min-height: 100vh; +} + +html > body { + margin: auto; +} + +.icon-section-header { + background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIj48Y2lyY2xlIGZpbGw9IiMzNjM5NTkiIGN4PSIxNSIgY3k9IjE1IiByPSIxNSIvPjwvc3ZnPg=="); +}</pre> +</div> + +<h4 id="Result">Result</h4> + +<p>{{EmbedLiveSample("Example","640","360")}}</p> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/index.html b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/index.html new file mode 100644 index 0000000000..6ec29a7fcf --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/index.html @@ -0,0 +1,93 @@ +--- +title: Interface do utilizador +slug: Mozilla/Add-ons/WebExtensions/interface_do_utilizador +tags: + - Interface do Utilizador + - Landing + - WebExtensions +translation_of: Mozilla/Add-ons/WebExtensions/user_interface +--- +<div>{{AddonSidebar}}</div> + +<p>As extensões que utilizam as APIs de WebExtension são fornecidas com várias opções de interface do utilizador, e assim, as suas funcionalidades podem ficar disponíveis para o utilizador. Um resumo dessas opções é fornecido abaixo, com uma introdução mais detalhada para cada opção da interface do utilziador nesta secção .</p> + +<div class="note"> +<p>For advice on using these UI components to create a great user experience in your extension, please see the <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/User_experience_best_practices">User experience best practices</a> article.</p> +</div> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Opção de UI</th> + <th scope="col">Descrição</th> + <th scope="col" style="width: 350px;">Exemplo</th> + </tr> + </thead> + <tbody> + <tr> + <td><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Browser_action">Browser toolbar button</a></td> + <td>A button on the browser toolbar that dispatches an event to the extension when clicked. By default, the button is visible in all tabs.</td> + <td><img alt="Example of a WebExtension toolbar button" src="https://mdn.mozillademos.org/files/12966/browser-action.png" style="height: 99px; width: 350px;"></td> + </tr> + <tr> + <td>Browser toolbar button with a <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Popups">popup</a></td> + <td>A popup on a button in the browser toolbar that opens when the button is clicked. The popup is defined in an HTML document that handles the user interaction.</td> + <td><img alt="Example of a WebExtension toolbar button with a popup" src="https://mdn.mozillademos.org/files/14039/popup-shadow.png" style="height: 156px; width: 350px;"></td> + </tr> + <tr> + <td><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Page_actions">Address bar button</a></td> + <td>A button on the browser address bar that dispatches an event to the extension when clicked. By default, the button is hidden in all tabs.</td> + <td><img alt="Example showing an address bar button (page action)" src="https://mdn.mozillademos.org/files/15047/address_bar_button.png" style="height: 127px; width: 350px;"></td> + </tr> + <tr> + <td>Address bar button with a <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Popups">popup</a></td> + <td>A popup on a button in the browser address bar that opens when the button is clicked. The popup is defined in an HTML document that handles the user interaction.</td> + <td><img alt="Example of a popup on the address bar button" src="https://mdn.mozillademos.org/files/15053/page_action_popup.png" style="height: 250px; width: 330px;"></td> + </tr> + <tr> + <td><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Context_menu_items">Context menu items</a></td> + <td>Menu items, checkboxes, and radio buttons on one or more of the browser's context menus. Also, menus can be structured by adding separators. When menu items are clicked, an event is dispatched to the extension.</td> + <td><img alt="" src="https://mdn.mozillademos.org/files/15051/context_menu_example.png" style="height: 359px; width: 350px;"></td> + </tr> + <tr> + <td><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Sidebars">Sidebar</a></td> + <td> + <p dir="ltr">An HTML document displayed next to a web page, with the option for unique content per page. The sidebar is opened when the extension is installed, then obeys the user's sidebar visibility selection. User interaction within the sidebar is handled by its HTML document.</p> + </td> + <td><img alt="Example of a WebExtension's sidebar" src="https://mdn.mozillademos.org/files/14825/bookmarks-sidebar.png" style="height: 209px; width: 350px;"></td> + </tr> + <tr> + <td><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Options_pages">Options page</a></td> + <td>A page that enables you to define preferences for your extension that your users can change. The user can access this page in the from the browser's add-ons manager.</td> + <td><img alt="Example showing the options page content added in the favorite colors example." src="https://mdn.mozillademos.org/files/15055/options_page.png" style="height: 259px; width: 350px;"></td> + </tr> + <tr> + <td><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Bundled_web_pages">Bundled web pages</a></td> + <td>Use web pages included in your extension to provide forms, help, or any other content required, within windows or tabs.</td> + <td><img alt="Example of a simple bundled page displayed as a detached panel." src="https://mdn.mozillademos.org/files/15063/bundled_page_as_panel_small.png" style="height: 180px; width: 350px;"></td> + </tr> + <tr> + <td><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Notifications">Notifications</a></td> + <td>Transient notifications displayed to the user through the underlying operating system's notifications mechanism. Dispatches an event to the extension when the user clicks a notification, or when a notification closes (either automatically or at the user's request).</td> + <td><img alt="Example notification from a WebExtension" src="https://mdn.mozillademos.org/files/14043/notify-shadowed.png" style="height: 95px; width: 350px;"></td> + </tr> + <tr> + <td><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Omnibox">Address bar suggestions</a></td> + <td>Offer custom address bar suggestions when the user enters a keyword.</td> + <td><img alt="Example showing the result of the firefox_code_search WebExtension's customization of the address bar suggestions." src="https://mdn.mozillademos.org/files/15059/omnibox_example_small.png" style="height: 242px; width: 350px;"></td> + </tr> + <tr> + <td><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/devtools_panels">Developer tools panels</a></td> + <td>A tab with an associated HTML document that displays in the browser's developer tools.</td> + <td><img alt="New panel tab in the Developer Tools tab bar" src="https://mdn.mozillademos.org/files/15049/developer_panel_tab.png" style="height: 180px; width: 350px;"></td> + </tr> + </tbody> +</table> + +<p>The following how-to guides provide step-by-step guidance to creating some of these user interface options:</p> + +<ul> + <li><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Add_a_button_to_the_toolbar">Add a button to the toolbar</a></li> + <li><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Implement_a_settings_page">Implement a settings page</a></li> + <li><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Extending_the_developer_tools">Extending the developer tools</a></li> +</ul> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/itens_do_menu_de_contexto/index.html b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/itens_do_menu_de_contexto/index.html new file mode 100644 index 0000000000..231a800bc3 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/itens_do_menu_de_contexto/index.html @@ -0,0 +1,51 @@ +--- +title: Itens do menu de contexto +slug: >- + Mozilla/Add-ons/WebExtensions/interface_do_utilizador/Itens_do_menu_de_contexto +tags: + - Extensões da Web +translation_of: Mozilla/Add-ons/WebExtensions/user_interface/Context_menu_items +--- +<div>{{AddonSidebar}}</div> + +<div> +<p>Essa opção da interface do utilizador adiciona um ou mais itens a um menu de contexto do navegador.</p> + +<p><img alt="Example of content menu items added by a WebExtension, from the context-menu-demo example" src="https://mdn.mozillademos.org/files/15051/context_menu_example.png" style="display: block; height: 587px; margin-left: auto; margin-right: auto; width: 573px;"></p> + +<p>You would use this option to expose features that are relevant to specific browser or web page contexts. For example, you could show features to open a graphic editor when the user clicks on an image or offer a feature to save page content when part of a page is selected. You can add plain menu items, checkbox items, radio button groups, and separators to menus. Once a context menu item has been added using {{WebExtAPIRef("contextMenus.create")}} it's displayed in all browser tabs, but you can hide it by removing it with {{WebExtAPIRef("contextMenus.remove")}}.</p> + +<h2 id="Especificar_itens_do_menu_de_contexto">Especificar itens do menu de contexto</h2> + +<p>You manage context menu items programmatically, using the {{WebExtAPIRef("contextMenus")}} API. However, you need to request the <code>contextMenus</code> permission in your manifest.json to be able to take advantage of the API.</p> + +<pre class="brush: json">"permissions": ["contextMenus"]</pre> + +<p>You can then add (and update or delete) the context menu items in your extension's background script. To create a menu item you specify an id, its title, and the context menus it should appear on:</p> + +<pre class="brush: js">browser.contextMenus.create({ + id: "log-selection", + title: browser.i18n.getMessage("contextMenuItemSelectionLogger"), + contexts: ["selection"] +}, onCreated);</pre> + +<p>Your extension then listens for clicks on the menu items. The passed information about the item clicked, the context where the click happened, and details of the tab where the click took place can then be used to invoke the appropriate extension functionality.</p> + +<pre class="brush: js">browser.contextMenus.onClicked.addListener(function(info, tab) { + switch (info.menuItemId) { + case "log-selection": + console.log(info.selectionText); + break; + ... + } +})</pre> + +<h2 id="Exemplos">Exemplos</h2> + +<p>O repositório de <a class="external external-icon" href="https://github.com/mdn/webextensions-examples">wexemplos das Extensões da Web </a>no GitHub, contém vários exemplos de extensões que utilizam os itens do menu de contexto:</p> + +<ul> + <li><a href="https://github.com/mdn/webextensions-examples/tree/master/menu-demo">menu-demo</a> adds several items to the browser's context menu.</li> + <li><a href="https://github.com/mdn/webextensions-examples/tree/master/context-menu-copy-link-with-types">context-menu-copy-link-with-types</a> adds a context menu item to links that copies the URL to the clipboard, as plain text and rich HTML.</li> +</ul> +</div> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/notificacoes/index.html b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/notificacoes/index.html new file mode 100644 index 0000000000..5b38d4f29f --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/notificacoes/index.html @@ -0,0 +1,50 @@ +--- +title: Notificações +slug: Mozilla/Add-ons/WebExtensions/interface_do_utilizador/Notificacoes +tags: + - Extensões da Web +translation_of: Mozilla/Add-ons/WebExtensions/user_interface/Notifications +--- +<div>{{AddonSidebar}}</div> + +<div> +<p>As notificações permitem-lhe comunicar a informação sobre a sua extensão ou o seu conteúdo utilizando o serviço de notificação do sistema operativo subjacente:</p> + +<p><img alt="" src="https://mdn.mozillademos.org/files/14043/notify-shadowed.png" style="display: block; height: 334px; margin-left: auto; margin-right: auto; width: 700px;"></p> + +<p>As notificações podem incluir uma chamada para ação para o utilizador, e o seu extra pode escutar o utilizador a clicar na notificação ou a notificação a fechar.</p> + +<h2 id="Especificar_as_notificações">Especificar as notificações</h2> + +<p>Pode gerir as notificações programaticamente, utilizando a API {{WebExtAPIRef("notifications")}}. Para utilizar esta API deve solicitar a permissão de <em><code>notifications</code></em> no seu manifest.json:</p> + +<pre class="brush: json"><span class="pl-s"><span class="pl-pds">"</span>permissions<span class="pl-pds">"</span></span>: [<span class="pl-s"><span class="pl-pds">"</span>notifications<span class="pl-pds">"</span></span>]</pre> + +<p>Depois, pode utilziar {{WebExtAPIRef("notifications.create")}} para criar as suas notificações, como neste exemplo de <a href="https://github.com/mdn/webextensions-examples/tree/master/notify-link-clicks-i18n">notify-link-clicks-i18n:</a></p> + +<pre class="brush: js">var title = browser.i18n.getMessage("notificationTitle"); +var content = browser.i18n.getMessage("notificationContent", message.url); +browser.notifications.create({ + "type": "basic", + "iconUrl": browser.extension.getURL("icons/link-48.png"), + "title": title, + "message": content +});</pre> + +<p>Este código cria uma notificação com um ícone, título, e mensagem.</p> + +<p>Se a notificação incluir uma chamada para ação, pode escutar o utilizador a clicar na notificação para chamar a ação para manipular a ação:</p> + +<pre class="brush: js line-numbers language-js"><code class="language-js">browser<span class="punctuation token">.</span>notifications<span class="punctuation token">.</span>onClicked<span class="punctuation token">.</span><span class="function token">addListener</span><span class="punctuation token">(</span>handleClick<span class="punctuation token">)</span><span class="punctuation token">;</span> +</code></pre> + +<p>Se estiver a enviar chamadas para ação através das notificações, também irá querer definir a notificação opcional <code>id</code>, e assim, pode saber qual a chamada para ação que o utilizador selecionou.</p> + +<h2 id="Exemplos">Exemplos</h2> + +<p>O repositório dos <a href="https://github.com/mdn/webextensions-examples">exemplos da extensões da Web</a> no GitHub, contém vários exemplos das extensões que utilizam <em>creates notifications</em>:</p> + +<ul> + <li><a href="https://github.com/mdn/webextensions-examples/tree/master/notify-link-clicks-i18n">notify-link-clicks-i18n</a> utiliza <em>creates notifications</em>.</li> +</ul> +</div> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/omnibox/index.html b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/omnibox/index.html new file mode 100644 index 0000000000..c0f9f41dca --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/omnibox/index.html @@ -0,0 +1,70 @@ +--- +title: Sugestões da barra de endereço +slug: Mozilla/Add-ons/WebExtensions/interface_do_utilizador/Omnibox +tags: + - Extensões da Web + - Interface do Utilizador +translation_of: Mozilla/Add-ons/WebExtensions/user_interface/Omnibox +--- +<div>{{AddonSidebar()}}</div> + +<p>Using the {{WebExtAPIRef("omnibox")}} API, extensions can customize the suggestions offered in the browser address bar's drop-down when the user enters a keyword.</p> + +<p><img alt="Example showing the result of the firefox_code_search WebExtension's customization of the address bar suggestions." src="https://mdn.mozillademos.org/files/15749/omnibox_example_small.png" style="display: block; height: 232px; margin-left: auto; margin-right: auto; width: 350px;"></p> + +<p>This enables your extension to, for example, search a library of free ebooks or, as in the example above, a repository of code examples.</p> + +<h2 id="Especificando_a_personalização_de_omnibox">Especificando a personalização de omnibox</h2> + +<p>You tell your extension that it is going to customize the address bar suggestions by including the <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/omnibox">omnibox</a> key and definition of the trigger keyword in its <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json">manifest.json</a> file:</p> + +<pre class="brush: json line-numbers language-json"> "omnibox": { "keyword" : "cs" }</pre> + +<p>In the extension's background JavaScript file, using {{WebExtAPIRef("omnibox.setDefaultSuggestion()")}}, you can optionally define the first suggestion to be displayed in the address bar drop-down. Use this to provide a hint on how to use the feature:</p> + +<pre class="brush: js line-numbers language-js">browser.omnibox.setDefaultSuggestion({ + description: `Search the firefox codebase + (e.g. "hello world" | "path:omnibox.js onInputChanged")` +});</pre> + +<p>You can then add the code to provide the customized content by listening for {{WebExtAPIRef("omnibox.onInputStarted")}}, which is dispatched when the user has typed the keyword and a space, and {{WebExtAPIRef("omnibox.onInputChanged")}}, which is dispatched whenever the user updates the address bar entry. You can then populate the suggestions, in this case building a search of https://searchfox.org/mozilla-central using the term entered by the user:</p> + +<pre class="brush: js">browser.omnibox.onInputChanged.addListener((text, addSuggestions) => { + let headers = new Headers({"Accept": "application/json"}); + let init = {method: 'GET', headers}; + let url = buildSearchURL(text); + let request = new Request(url, init); + + fetch(request) + .then(createSuggestionsFromResponse) + .then(addSuggestions); +});</pre> + +<p>If the extension set a default suggestion using {{WebExtAPIRef("omnibox.setDefaultSuggestion()")}}, then this will appear first in the drop-down.</p> + +<p>The extension can then listen for the user clicking one of the suggestions, using {{WebExtAPIRef("omnibox.onInputEntered")}}. If the default suggestion is clicked the user's custom term is returned, otherwise the suggestion's string is returned. This also passes information on the user's browser preferences for handling new links. In the code below the user's custom term is used to create a search, otherwise the suggested URL is opened:</p> + +<pre class="brush: js">browser.omnibox.onInputEntered.addListener((text, disposition) => { + let url = text; + if (!text.startsWith(SOURCE_URL)) { + // Update the url if the user clicks on the default suggestion. + url = `${SEARCH_URL}?q=${text}`; + } + switch (disposition) { + case "currentTab": + browser.tabs.update({url}); + break; + case "newForegroundTab": + browser.tabs.create({url}); + break; + case "newBackgroundTab": + browser.tabs.create({url, active: false}); + break; + } +});</pre> + +<p> </p> + +<h2 id="Exemplos">Exemplos</h2> + +<p>O repositório dos <a href="https://github.com/mdn/webextensions-examples">exemplos das extensões da Web</a> no GitHub inclui o exemplo <a class="external external-icon" href="https://github.com/mdn/webextensions-examples/tree/master/firefox-code-search">firefox-code-search</a> que personaliza a barra de pesquisa.</p> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/options_pages/index.html b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/options_pages/index.html new file mode 100644 index 0000000000..b3bee11990 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/options_pages/index.html @@ -0,0 +1,64 @@ +--- +title: Página de opções +slug: Mozilla/Add-ons/WebExtensions/interface_do_utilizador/Options_pages +tags: + - Extensões da Web +translation_of: Mozilla/Add-ons/WebExtensions/user_interface/Options_pages +--- +<div>{{AddonSidebar}}</div> + +<div> +<p>Uma página de <strong>Opções</strong> permite-lhe definir as preferências para sua extensão que os seus utilizadores podem alterar. Os utilizadores podem aceder á página das opções para uma extensão a partir do do gestor de extras do navegador:</p> + +<p>{{EmbedYouTube("02oXAcbUv-s")}}</p> + +<p>The way users access the page, and the way it's integrated into the browser's user interface, will vary from one browser to another.</p> + +<ul> +</ul> + +<p>You can open the page programmatically by calling <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/Runtime/openOptionsPage" title="If your add-on does not have an options page, or the browser failed to create one for some other reason, runtime.lastError will be set."><code>runtime.openOptionsPage()</code></a>.</p> + +<p>Options pages have a Content Security Policy that restricts the sources from which they can load resources, and disallows some unsafe practices such as the use of <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval">eval()</a></code>. See <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_Security_Policy">Content Security Policy</a> for more details.</p> + +<h2 id="Especificar_a_página_de_opções">Especificar a página de opções</h2> + +<p>To create an options page, write an HTML file defining the page. This page can include CSS and JavaScript files, like a normal web page. This page, from the <a href="https://github.com/mdn/webextensions-examples/tree/master/favourite-colour">favourite-colour</a> example, includes a JavaScript file:</p> + +<pre class="brush: html"><!DOCTYPE html> + +<html> + <head> + <meta charset="utf-8"> + </head> + +<body> + <form> + <label>Favourite colour</label> + <input type="text" id="colour" > + <button type="submit">Save</button> + </form> + <script src="options.js"></script> +</body> + +</html></pre> + +<p>JavaScript em execução na página pode utilizar a <a href="/pt-PT/Add-ons/WebExtensions/API">API das Extensões da Web</a> que o extra tem <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions">permissões</a> para. Em particular, pode utilziar a APi de <a href="/pt-PT/Add-ons/WebExtensions/API/Armazenamento" title="Enables WebExtensions to store and retrieve data, and listen for changes to stored items."><code>armazenamento</code></a> para manter as preferências.</p> + +<p>Package the page's files in your extension.</p> + +<p>You also need to include the <code><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/options_ui">options_ui</a></code> key in your manifest.json file, giving it the URL to the page.</p> + +<pre class="brush: json">"options_ui": { + "page": "options.html", + "browser_style": true +},</pre> + +<h2 id="Exemplos">Exemplos</h2> + +<p>The <a href="https://github.com/mdn/webextensions-examples">webextensions-examples</a> repo on GitHub, contains several examples of extensions that use an options page:</p> + +<ul> + <li><a href="https://github.com/mdn/webextensions-examples/tree/master/favourite-colour">favourite-colour</a> example extension with options page</li> +</ul> +</div> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/paginas_de_extensão/index.html b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/paginas_de_extensão/index.html new file mode 100644 index 0000000000..4bf94b9653 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/paginas_de_extensão/index.html @@ -0,0 +1,64 @@ +--- +title: Páginas de extensão +slug: Mozilla/Add-ons/WebExtensions/interface_do_utilizador/Paginas_de_extensão +translation_of: Mozilla/Add-ons/WebExtensions/user_interface/Extension_pages +--- +<div>{{AddonSidebar()}}</div> + +<p>Pode inclur páginas html na sua extensão para fornecer formulários, ajuda, ou qualquer outro conteúdo que a sua extensão precisar.</p> + +<p><img alt="Example of a simple bundled page displayed as a detached panel." src="https://mdn.mozillademos.org/files/15752/bundled_page_as_panel_small.png" style="display: block; height: 216px; margin-left: auto; margin-right: auto; width: 350px;"></p> + +<p>These pages also get access to the same privileged JavaScript APIs that are available to your extension's background scripts.</p> + +<h2 id="Especificar_páginas_de_extensão">Especificar páginas de extensão</h2> + +<p>You can include HTML files, and their associated CSS or JavaScript files, in your extension. The files can be included in the root or organized within meaningful sub-folders.</p> + +<pre>/my-extension + /manifest.json + /my-page.html + /my-page.js</pre> + +<h2 id="Exibir_páginas_de_extensão">Exibir páginas de extensão</h2> + +<p>There are two options for displaying extension pages: {{WebExtAPIRef("windows.create()")}} and {{WebExtAPIRef("tabs.create()")}}.</p> + +<p>Using <code>windows.create()</code>, for example, you can open an HTML page into a detached panel (a window without the normal browser UI of address bar, bookmark bar, and alike) to create a dialog-like user experience:</p> + +<pre class="brush: js">var createData = { + type: "detached_panel", + url: "panel.html", + width: 250, + height: 100 +}; +var creating = browser.windows.create(createData);</pre> + +<p>When the window is no longer needed, it can be closed programmatically, for example, after the user clicks a button, by passing the id of the current window to {{WebExtAPIRef("windows.remove()")}}:</p> + +<pre class="brush: js">document.getElementById("closeme").addEventListener("click", function(){ + var winId = browser.windows.WINDOW_ID_CURRENT; + var removing = browser.windows.remove(winId); +}); </pre> + +<h2 id="Páginas_de_extensão_e_histório">Páginas de extensão e histório</h2> + +<p>By default, pages you open in this way will be stored in the user's history, just like normal web pages. If you don't want to have this behavior, use {{WebExtAPIRef("history.deleteUrl()")}} to remove the browser's record:</p> + +<pre class="comment-text " id="ct-4">function onVisited(historyItem) { + if (historyItem.url == browser.extension.getURL(myPage)) { + browser.history.deleteUrl({url: historyItem.url}); + } +} + +browser.history.onVisited.addListener(onVisited);</pre> + +<p>To use the history API, you must request the "history" <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions">permission</a> in your <code><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json">manifest.json</a></code> file.</p> + +<h2 id="Desenho_da_página_da_Web">Desenho da página da Web</h2> + +<p>For details on how to design your web page's to match the style of Firefox, see the <a class="grey-90 no-underline hover-no-underline" href="https://design.firefox.com/photon/index.html">Photon Design System</a> documentation.</p> + +<h2 id="Exemplos">Exemplos</h2> + +<p>The <a class="external external-icon" href="https://github.com/mdn/webextensions-examples">webextensions-examples</a> repository on GitHub includes the <a class="external external-icon" href="https://github.com/mdn/webextensions-examples/tree/master/window-manipulator">window-manipulator</a> example, which implements several of the options for creating windows.</p> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/popups/index.html b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/popups/index.html new file mode 100644 index 0000000000..6bbf3f7ce8 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/popups/index.html @@ -0,0 +1,60 @@ +--- +title: Janelas (Popups) +slug: Mozilla/Add-ons/WebExtensions/interface_do_utilizador/Popups +tags: + - Extensions + - IU + - Interface do Utilizador + - Janela + - popup +translation_of: Mozilla/Add-ons/WebExtensions/user_interface/Popups +--- +<div>{{AddonSidebar}}</div> + +<div> +<p>Uma janela (<em>popup)</em> é uma janela que está associada com um <a href="/pt-PT/Add-ons/WebExtensions/interface_do_utilizador/Ação_navegador">botão da barra de ferramentas</a> ou <a href="/pt-PT/Add-ons/WebExtensions/interface_do_utilizador/Acoes_pagina">botão da barra de endereço</a>.</p> + +<p><img alt="" src="https://mdn.mozillademos.org/files/15747/page_action_popup.png" style="display: block; height: 282px; margin-left: auto; margin-right: auto; width: 350px;"></p> + +<p>Quando o usuário clica no botão, a janela popup é exibida. Quando o usuário clica em qualquer lugar fora do popup, ele é fechado. O popup pode ser fechado via programação usando a função <code><a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/close">window.close()</a></code> em um script sendo executado no popup. Entretanto, você não pode abrir o popup via programação a partir do código JavaScript da extensão: ele somente se abre em resposta a uma ação do usuário.</p> + +<p>Você pode definir um atalho de teclado que abre o popup usando <code>"_execute_browser_action"</code> and <code>"_execute_page_action"</code>. Veja a documentação da chave <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/commands">commands</a></code><span style="display: none;"> </span> no manifest.json.</p> + +<h2 id="Especificar_uma_janela">Especificar uma janela</h2> + +<p>O popup é definido por um arquivo HTML, que pode incluir arquivos CSS e JavaScript, como uma página comum. Diferentemente de uma página comum, o código JavaScript pode usar todos os <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API">WebExtension APIs</a> que a extensão tem <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions">permissions</a> .</p> + +<p>O documento do popup é carregado toda vez que ele é exibido, e descarregado quando o popup é fechado.</p> + +<p>O arquivo HTML é incluído na extensão e especificado como parte do <code><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_action">browser_action</a></code> ou chave <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/page_action">page_action</a> por <code>"default_popup"</code> no arquivo manifest.json:</p> + +<pre class="brush: json"> "browser_action": { + "default_icon": "icons/beasts-32.png", + "default_title": "Beastify", + "default_popup": "popup/choose_beast.html" + }</pre> + +<p>You can ask the browser to include a stylesheet in your popup that will make it look consistent with the browser's UI. To do this, include <code>"browser_style": true</code> in the <code><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_action">browser_action</a></code> or <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/page_action">page_action</a> key.</p> + +<p>Popups have a Content Security Policy that restricts the sources from which they can load resources, and disallows some unsafe practices such as the use of <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval">eval()</a></code>. See <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_Security_Policy">Content Security Policy</a> for more details on this.</p> + +<h2 id="Depurar_janelas">Depurar janelas</h2> + +<p>You can debug a popup's markup and JavaScript using the Add-on Debugger, but you'll need to turn on the Disable popup auto hide feature to prevent popups from hiding when you click outside them.<a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Debugging#Debugging_popups"> Read about debugging popups</a>.</p> + +<h2 id="Redimensionar_janelas">Redimensionar janelas</h2> + +<p>Popups resize automatically to fit their content. The algorithm for this may differ from one browser to another.</p> + +<p>In Firefox, the size is calculated just before the popup is shown, and at most 10 times per second after DOM mutations. For strict mode documents, the size is calculated based on the layout size of the <code><a href="/en-US/docs/Web/HTML/Element/body"><body></a></code> element. For quirks mode, it's the <code><a href="/en-US/docs/Web/HTML/Element/html"><html></a></code> element. Firefox calculates the preferred width of the contents of that element, reflows it to that width, and then resizes so there's no vertical scrolling. It will grow to a size of <strong>800x600 pixels</strong> at most if that fits on the user's screen. If the user <a href="https://support.mozilla.org/en-US/kb/customize-firefox-controls-buttons-and-toolbars#w_customize-the-menu-or-the-toolbar">moves the extension's button to the menu</a> or it appears in the toolbar overflow, then the popup appears inside the menu's panel and is given a fixed width.</p> + +<p>No Firefox Android 57, <em>popup </em>é mostrada como uma página normal num novo separador.</p> + +<h2 id="Desenho_de_janela">Desenho de janela</h2> + +<p>Para obter detalhes sobre como desenhar a sua janela (popup) da página da Web para combinar com o estilo do Firefox, consulte a documentação <a class="grey-90 no-underline hover-no-underline" href="https://design.firefox.com/photon/index.html">Photon Design System</a>.</p> + +<h2 id="Exemplos">Exemplos</h2> + +<p>The <a href="https://github.com/mdn/webextensions-examples">webextensions-examples</a> repository on GitHub includes the <a href="https://github.com/mdn/webextensions-examples/tree/master/beastify">beastify</a> example which implements a browser action with a popup.</p> +</div> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/internationalization/index.html b/files/pt-pt/mozilla/add-ons/webextensions/internationalization/index.html new file mode 100644 index 0000000000..4892048ba8 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/internationalization/index.html @@ -0,0 +1,417 @@ +--- +title: Internationalization +slug: Mozilla/Add-ons/WebExtensions/Internationalization +tags: + - Artigo + - Extensões da Web + - Guía + - Internacionalização + - Localização + - Tradução + - i18n + - mensagens predefinidas + - messages.json + - placeholders + - símbolos +translation_of: Mozilla/Add-ons/WebExtensions/Internationalization +--- +<div>{{AddonSidebar}}</div> + +<p>A API das <a href="/pt-PT/docs/Mozilla/Add-ons/WebExtensions">Extensões da Web</a> tem um módulo bastante útil disponível para a internacionalização das extensões — <a href="/pt-PT/docs/Mozilla/Add-ons/WebExtensions/API/i18n">i18n</a>. Neste artigo, nós iremos explorar as suas funcionaldiades e fornecemos um exemplo prático de como este funciona. O sistema i18n para as extensões criadas utilizando as APIs da Extensão da Web é semelhante às bibliotecas de JavaScript comuns do i18n, tal como <a href="http://i18njs.com/">i18n.js</a>.</p> + +<div class="note"> +<p>The example extension featured in this article — <a href="https://github.com/mdn/webextensions-examples/tree/master/notify-link-clicks-i18n">notify-link-clicks-i18n</a> — is available on GitHub. Follow along with the source code as you go through the sections below.</p> +</div> + +<h2 id="Anatomia_de_uma_extensão_internacionalizada">Anatomia de uma extensão internacionalizada</h2> + +<p>An internationalized extension can contain the same features as any other extension — <a href="/en-US/Add-ons/WebExtensions/Anatomy_of_a_WebExtension#Background_scripts">background scripts</a>, <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts">content scripts</a>, etc. — but it also has some extra parts to allow it to switch between different locales. These are summarized in the following directory tree:</p> + +<ul class="directory-tree"> + <li>extension-root-directory/ + <ul> + <li>_locales + <ul> + <li>en + <ul> + <li>messages.json + <ul> + <li>English messages (strings)</li> + </ul> + </li> + </ul> + </li> + <li>de + <ul> + <li>messages.json + <ul> + <li>German messages (strings)</li> + </ul> + </li> + </ul> + </li> + <li>etc.</li> + </ul> + </li> + <li>manifest.json + <ul> + <li>locale-dependent metadata</li> + </ul> + </li> + <li>myJavascript.js + <ul> + <li>JavaScript for retrieving browser locale, locale-specific messages, etc.</li> + </ul> + </li> + <li>myStyles.css + <ul> + <li>locale-dependent CSS</li> + </ul> + </li> + </ul> + </li> +</ul> + +<p>Let's explore each of the new features in turn — each of the below sections represents a step to follow when internationalizing your extension.</p> + +<h2 id="Fornecer_strings_traduzidas_em__locales">Fornecer <em>strings</em> traduzidas em _locales</h2> + +<div class="pull-aside"> +<div class="moreinfo">You can look up language subtags using the <em>Find</em> tool on the <a href="https://r12a.github.io/app-subtags/">Language subtag lookup page</a>. Note that you need to search for the English name of the language.</div> +</div> + +<p>Every i18n system requires the provision of strings translated into all the different locales you want to support. In extensions, these are contained within a directory called <code>_locales</code>, placed inside the extension root. Each individual locale has its strings (referred to as messages) contained within a file called <code>messages.json</code>, which is placed inside a subdirectory of <code>_locales</code>, named using the language subtag for that locale's language.</p> + +<p>Note that if the subtag includes a basic language plus a regional variant, then the language and variant are conventionally separated using a hyphen: for example, "en-US". However, in the directories under <code>_locales</code>, <strong>the separator must be an underscore</strong>: "en_US".</p> + +<p>So <a href="https://github.com/mdn/webextensions-examples/tree/master/notify-link-clicks-i18n/_locales">for example, in our sample app</a> we have directories for "en" (English), "de" (German), "nl" (Dutch), and "ja" (Japanese). Each one of these has a <code>messages.json</code> file inside it.</p> + +<p>Let's now look at the structure of one of these files (<a href="https://github.com/mdn/webextensions-examples/blob/master/notify-link-clicks-i18n/_locales/en/messages.json">_locales/en/messages.json</a>):</p> + +<pre class="brush: json">{ + "extensionName": { + "message": "Notify link clicks i18n", + "description": "Name of the extension." + }, + + "extensionDescription": { + "message": "Shows a notification when the user clicks on links.", + "description": "Description of the extension." + }, + + "notificationTitle": { + "message": "Click notification", + "description": "Title of the click notification." + }, + + "notificationContent": { + "message": "You clicked $URL$.", + "description": "Tells the user which link they clicked.", + "placeholders": { + "url" : { + "content" : "$1", + "example" : "https://developer.mozilla.org" + } + } + } +}</pre> + +<p>This file is standard JSON — each one of its members is an object with a name, which contains a <code>message</code> and a <code>description</code>. All of these items are strings; <code>$URL$</code> is a placeholder, which is replaced with a substring at the time the <code>notificationContent</code> member is called by the extension. You'll learn how to do this in the {{anch("Retrieving message strings from JavaScript")}} section.</p> + +<div class="note"> +<p><strong>Note</strong>: You can find much more information about the contents of <code>messages.json</code> files in our <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/i18n/Locale-Specific_Message_reference">Locale-Specific Message reference</a>.</p> +</div> + +<h2 id="Internacionalizar_manifest.json">Internacionalizar manifest.json</h2> + +<p>There are a couple of different tasks to carry out to internationalize your manifest.json.</p> + +<h3 id="Obter_as_strings_traduzidas_em_manifests">Obter as <em>strings</em> traduzidas em <em>manifests</em></h3> + +<p>Your <a href="https://github.com/mdn/webextensions-examples/blob/master/notify-link-clicks-i18n/manifest.json">manifest.json</a> includes strings that are displayed to the user, such as the extension's name and description. If you internationalize these strings and put the appropriate translations of them in messages.json, then the correct translation of the string will be displayed to the user, based on the current locale, like so.</p> + +<p>To internationalize strings, specify them like this:</p> + +<pre class="brush: json">"name": "__MSG_extensionName__", +"description": "__MSG_extensionDescription__",</pre> + +<p>Here, we are retrieving message strings dependant on the browser's locale, rather than just including static strings.</p> + +<p>To call a message string like this, you need to specify it like this:</p> + +<ol> + <li>Two underscores, followed by</li> + <li>The string "MSG", followed by</li> + <li>One underscore, followed by</li> + <li>The name of the message you want to call as defined in <code>messages.json</code>, followed by</li> + <li>Two underscores</li> +</ol> + +<pre><strong>__MSG_</strong> + <em>messageName</em> + <strong>__</strong></pre> + +<h3 id="Especificar_uma_locale_predefinida">Especificar uma <em>locale</em> predefinida</h3> + +<p>Another field you should specify in your manifest.json is <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/default_locale">default_locale</a>:</p> + +<pre class="brush: json">"default_locale": "en"</pre> + +<p>This specifies a default locale to use if the extension doesn't include a localized string for the browser's current locale. Any message strings that are not available in the browser locale are taken from the default locale instead. There are some more details to be aware of in terms of how the browser selects strings — see {{anch("Localized string selection")}}.</p> + +<h2 id="Locale-dependent_CSS">Locale-dependent CSS</h2> + +<p>Note that you can also retrieve localized strings from CSS files in the extension. For example, you might want to construct a locale-dependent CSS rule, like this:</p> + +<pre class="brush: css">header { + background-image: url(../images/__MSG_extensionName__/header.png); +}</pre> + +<p>This is useful, although you might be better off handling such a situation using {{anch("Predefined messages")}}.</p> + +<h2 id="Obter_strings_a_partir_de_JavaScript">Obter <em>strings</em> a partir de JavaScript</h2> + +<p>So, you've got your message strings set up, and your manifest. Now you just need to start calling your message strings from JavaScript so your extension can talk the right language as much as possible. The actual <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/i18n">i18n API</a> is pretty simple, containing just four main methods:</p> + +<ul> + <li>You'll probably use {{WebExtAPIRef("i18n.getMessage()")}} most often — this is the method you use to retrieve a specific language string, as mentioned above. We'll see specific usage examples of this below.</li> + <li>The {{WebExtAPIRef("i18n.getAcceptLanguages()")}} and {{WebExtAPIRef("i18n.getUILanguage()")}} methods could be used if you needed to customize the UI depending on the locale — perhaps you might want to show preferences specific to the users' preferred languages higher up in a prefs list, or display cultural information relevant only to a certain language, or format displayed dates appropriately according to the browser locale.</li> + <li>The {{WebExtAPIRef("i18n.detectLanguage()")}} method could be used to detect the language of user-submitted content, and format it appropriately.</li> +</ul> + +<p>In our <a href="https://github.com/mdn/webextensions-examples/tree/master/notify-link-clicks-i18n">notify-link-clicks-i18n</a> example, the<a href="https://github.com/mdn/webextensions-examples/blob/master/notify-link-clicks-i18n/background-script.js"> background script</a> contains the following lines:</p> + +<pre class="brush: js">var title = browser.i18n.getMessage("notificationTitle"); +var content = browser.i18n.getMessage("notificationContent", message.url);</pre> + +<p>The first one just retrieves the <code>notificationTitle message</code> field from the available <code>messages.json</code> file most appropriate for the browser's current locale. The second one is similar, but it is being passed a URL as a second parameter. What gives? This is how you specify the content to replace the <code>$URL$</code> placeholder we see in the <code>notificationContent message</code> field:</p> + +<pre class="brush: json">"notificationContent": { + "message": "You clicked $URL$.", + "description": "Tells the user which link they clicked.", + "placeholders": { + "url" : { + "content" : "$1", + "example" : "https://developer.mozilla.org" + } + } +} +</pre> + +<p>The <code>"placeholders"</code> member defines all the placeholders, and where they are retrieved from. The <code>"url"</code> placeholder specifies that its content is taken from $1, which is the first value given inside the second parameter of <code>getMessage()</code>. Since the placeholder is called <code>"url"</code>, we use <code>$URL$</code> to call it inside the actual message string (so for <code>"name"</code> you'd use <code>$NAME$</code>, etc.) If you have multiple placeholders, you can provide them inside an array that is given to {{WebExtAPIRef("i18n.getMessage()")}} as the second parameter — <code>[a, b, c]</code> will be available as <code>$1</code>, <code>$2</code>, and <code>$3</code>, and so on, inside <code>messages.json</code>.</p> + +<p>Let's run through an example: the original <code>notificationContent</code> message string in the <code>en/messages.json</code> file is</p> + +<pre>You clicked $URL$.</pre> + +<p>Let's say the link clicked on points to <code>https://developer.mozilla.org</code>. After the {{WebExtAPIRef("i18n.getMessage()")}} call, the contents of the second parameter are made available in messages.json as <code>$1</code>, which replaces the <code>$URL$</code> placeholder as defined in the <code>"url"</code> placeholder. So the final message string is</p> + +<pre>You clicked https://developer.mozilla.org.</pre> + +<h3 id="Direct_placeholder_usage">Direct placeholder usage</h3> + +<p>It is possible to insert your variables (<code>$1</code>, <code>$2</code>, <code>$3</code>, etc.) directly into the message strings, for example we could rewrite the above <code>"notificationContent"</code> member like this:</p> + +<pre class="brush: json">"notificationContent": { + "message": "You clicked $1.", + "description": "Tells the user which link they clicked." +}</pre> + +<p>This may seem quicker and less complex, but the other way (using <code>"placeholders"</code>) is seen as best practice. This is because having the placeholder name (e.g. <code>"url"</code>) and example helps you to remember what the placeholder is for — a week after you write your code, you'll probably forget what <code>$1</code>–<code>$8</code> refer to, but you'll be more likely to know what your placeholder names refer to.</p> + +<h3 id="Hardcoded_substitution">Hardcoded substitution</h3> + +<p>It is also possible to include hardcoded strings in placeholders, so that the same value is used every time, instead of getting the value from a variable in your code. For example:</p> + +<pre class="brush: json">"mdn_banner": { + "message": "For more information on web technologies, go to $MDN$.", + "description": "Tell the user about MDN", + "placeholders": { + "mdn": { + "content": "https://developer.mozilla.org/" + } + } +}</pre> + +<p>In this case we are just hardcoding the placeholder content, rather than getting it from a variable value like <code>$1</code>. This can sometimes be useful when your message file is very complex, and you want to split up different values to make the strings more readable in the file, plus then these values could be accessed programmatically.</p> + +<p>In addition, you can use such substitutions to specify parts of the string that you don't want to be translated, such as person or business names.</p> + +<h2 id="Seleção_de_string_traduzida">Seleção de string traduzida</h2> + +<p>Locales can be specified using only a language code, like <code>fr</code> or <code>en</code>, or they may be further qualified with a region code, like <code>en_US</code> or <code>en_GB</code>, which describes a regional variant of the same basic language. When you ask the i18n system for a string, it will select a string using the following algorithm:</p> + +<ol> + <li>if there is a <code>messages.json</code> file for the exact current locale, and it contains the string, return it.</li> + <li>Otherwise, if the current locale is qualified with a region (e.g. <code>en_US</code>) and there is a <code>messages.json</code> file for the regionless version of that locale (e.g. <code>en</code>), and that file contains the string, return it.</li> + <li>Otherwise, if there is a <code>messages.json</code> file for the <code>default_locale</code> defined in the <code>manifest.json</code>, and it contains the string, return it.</li> + <li>Otherwise return an empty string.</li> +</ol> + +<p>Take the following example:</p> + +<ul class="directory-tree"> + <li>extension-root-directory/ + <ul> + <li>_locales + <ul> + <li>en_GB + <ul> + <li>messages.json + <ul> + <li><code>{ "colorLocalised": { "message": "colour", "description": "Color." }, ... }</code></li> + </ul> + </li> + </ul> + en + + <ul> + <li>messages.json + <ul> + <li><code>{ "colorLocalised": { "message": "color", "description": "Color." }, ... }</code></li> + </ul> + </li> + </ul> + </li> + <li>fr + <ul> + <li>messages.json + <ul> + <li><code>{ "colorLocalised": { "message": "<span lang="fr">couleur</span>", "description": "Color." }, ...}</code></li> + </ul> + </li> + </ul> + </li> + </ul> + </li> + </ul> + </li> +</ul> + +<p>Suppose the <code>default_locale</code> is set to <code>fr</code>, and the browser's current locale is <code>en_GB</code>:</p> + +<ul> + <li>If the extension calls <code>getMessage("colorLocalised")</code>, it will return "colour".</li> + <li>If "colorLocalised" were not present in <code>en_GB</code>, then <code>getMessage("colorLocalised")</code>, would return "color", not "couleur".</li> +</ul> + +<h2 id="Mensagens_predefinidas">Mensagens predefinidas</h2> + +<p>The i18n module provides us with some predefined messages, which we can call in the same way as we saw earlier in {{anch("Calling message strings from manifests and extension CSS")}}. For example:</p> + +<pre>__MSG_extensionName__</pre> + +<p>Predefined messages use exactly the same syntax, except with <code>@@</code> before the message name, for example</p> + +<pre>__MSG_@@ui_locale__</pre> + +<p>The following table shows the different available predefined messages:</p> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Nome da mensagem</th> + <th scope="col">Descrição</th> + </tr> + </thead> + <tbody> + <tr> + <td><code>@@extension_id</code></td> + <td> + <p>The extension's internally-generated UUID. You might use this string to construct URLs for resources inside the extension. Even unlocalized extensions can use this message.</p> + + <p>You can't use this message in a manifest file.</p> + + <p>Also note that this ID is <em>not</em> the add-on ID returned by {{WebExtAPIRef("runtime.id")}}, and that can be set using the <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/applications">applications</a> key in manifest.json. It's the generated UUID that appears in the add-on's URL. This means that you can't use this value as the <code>extensionId</code> parameter to {{WebExtAPIRef("runtime.sendMessage()")}}, and can't use it to check against the <code>id</code> property of a {{WebExtAPIRef("runtime.MessageSender")}} object.</p> + </td> + </tr> + <tr> + <td><code>@@ui_locale</code></td> + <td>The current locale; you might use this string to construct locale-specific URLs.</td> + </tr> + <tr> + <td><code>@@bidi_dir</code></td> + <td>The text direction for the current locale, either "ltr" for left-to-right languages such as English or "rtl" for right-to-left languages such as Arabic.</td> + </tr> + <tr> + <td><code>@@bidi_reversed_dir</code></td> + <td>If the <code>@@bidi_dir</code> is "ltr", then this is "rtl"; otherwise, it's "ltr".</td> + </tr> + <tr> + <td><code>@@bidi_start_edge</code></td> + <td>If the <code>@@bidi_dir</code> is "ltr", then this is "left"; otherwise, it's "right".</td> + </tr> + <tr> + <td><code>@@bidi_end_edge</code></td> + <td>If the <code>@@bidi_dir</code> is "ltr", then this is "right"; otherwise, it's "left".</td> + </tr> + </tbody> +</table> + +<p>Going back to our earlier example, it would make more sense to write it like this:</p> + +<pre class="brush: css">header { + background-image: url(../images/__MSG_@@ui_locale__/header.png); +}</pre> + +<p>Now we can just store our local specific images in directories that match the different locales we are supporting — en, de, etc. — which makes a lot more sense.</p> + +<p>Let's look at an example of using <code>@@bidi_*</code> messages in a CSS file:</p> + +<pre class="brush: css">body { + direction: __MSG_@@bidi_dir__; +} + +div#header { + margin-bottom: 1.05em; + overflow: hidden; + padding-bottom: 1.5em; + padding-__MSG_@@bidi_start_edge__: 0; + padding-__MSG_@@bidi_end_edge__: 1.5em; + position: relative; +}</pre> + +<p>For left-to-right languages such as English, the CSS declarations involving the predefined messages above would translate to the following final code lines:</p> + +<pre class="brush: css">direction: ltr; +padding-left: 0; +padding-right: 1.5em; +</pre> + +<p>For a right-to-left language like Arabic, you'd get:</p> + +<pre class="brush: css">direction: rtl; +padding-right: 0; +padding-left: 1.5em;</pre> + +<h2 id="Testar_a_sua_extensão">Testar a sua extensão</h2> + +<p>Starting in Firefox 45, you can install extensions temporarily from disk — see <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Packaging_and_installation#Loading_from_disk">Loading from disk</a>. Do this, and then try testing out our <a href="https://github.com/mdn/webextensions-examples/tree/master/notify-link-clicks-i18n">notify-link-clicks-i18n</a> extension. Go to one of your favourite websites and click a link to see if a notification appears reporting the URL of the clicked link.</p> + +<p>Next, change Firefox's locale to one supported in the extension that you want to test.</p> + +<ol> + <li>Open "about:config" in Firefox, and search for the <code>intl.locale.requested</code> preference (bear in mind that before Firefox 59, this pref is called <code>general.useragent.locale</code>).</li> + <li>If the preference exists, double-click it (or press Return/Enter) to select it, enter the language code for the locale you want to test, then click "OK" (or press Return/Enter). For example in our example extension, "en" (English), "de" (German), "nl" (Dutch), and "ja" (Japanese) are supported. You can also set the value to an empty string (<code>""</code>), which will cause the browser to use the OS default locale.</li> + <li>If the <code>intl.locale.requested</code> preference does not exist, right-click the list of preferences (or activate the context menu using the keyboard), and choose "New" followed by "String". Enter <code>intl.locale.requested</code> for the preference name and, "de", or "nl", etc. for the preference value, as described in step 2 above.</li> + <li>Search for <code>intl.locale.matchOS</code> and, if the preference exists and has the value <code>true</code>, double-click it so that it is set to <code>false</code>.</li> + <li>Restart your browser to complete the change.</li> +</ol> + +<div class="note"> +<p><strong>Nota</strong>: This works to change the browser's locale, even if you haven't got the <a href="https://addons.mozilla.org/en-US/firefox/language-tools/">language pack</a> installed for that language. You'll just get the browser UI in your default language if this is the case.</p> +</div> + +<ol> +</ol> + +<div class="note"> +<p><strong>Nota:</strong> To change the result of <code>getUILanguage</code> the language pack is required, since it reflects the browser UI language and not the language used for extension messages.</p> +</div> + +<p>Load the extension temporarily from disk again, then test your new locale:</p> + +<ul> + <li>Visit "about:addons" again — you should now see the extension listed, with its icon, plus name and description in the chosen language.</li> + <li>Test your extension again. In our example, you'd go to another website and click a link, to see if the notification now appears in the chosen language.</li> +</ul> + +<p>{{EmbedYouTube("R7--fp5pPGg")}}</p> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/manifest.json/browser_action/index.html b/files/pt-pt/mozilla/add-ons/webextensions/manifest.json/browser_action/index.html new file mode 100644 index 0000000000..41b720af8b --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/manifest.json/browser_action/index.html @@ -0,0 +1,236 @@ +--- +title: browser_action +slug: Mozilla/Add-ons/WebExtensions/manifest.json/browser_action +tags: + - Extensões + - Extensões da Web + - Extras +translation_of: Mozilla/Add-ons/WebExtensions/manifest.json/browser_action +--- +<div>{{AddonSidebar}}</div> + +<table class="fullwidth-table standard-table"> + <tbody> + <tr> + <th scope="row" style="width: 30%;">Tipo</th> + <td><code>Objeto</code></td> + </tr> + <tr> + <th scope="row">Obrigatório</th> + <td>Não</td> + </tr> + <tr> + <th scope="row">Exemplo</th> + <td> + <pre class="brush: json no-line-numbers"> +"browser_action": { + "browser_style": true, + "default_icon": { + "16": "button/geo-16.png", + "32": "button/geo-32.png" + }, + "default_title": "Whereami?", + "default_popup": "popup/geo.html", + "theme_icons": [{ + "light": "icons/geo-32-light.png", + "dark": "icons/geo-32.png", + "size": 32 + }] +}</pre> + </td> + </tr> + </tbody> +</table> + +<p>A browser action is a button that your extension adds to the browser's toolbar. The button has an icon, and may optionally have a popup whose content is specified using HTML, CSS, and JavaScript.</p> + +<p>If you supply a popup, then the popup is opened when the user clicks the button, and your JavaScript running in the popup can handle the user's interaction with it. If you don't supply a popup, then a click event is dispatched to your extension's <a href="/en-US/Add-ons/WebExtensions/Anatomy_of_a_WebExtension#Background_scripts">background scripts</a> when the user clicks the button.</p> + +<p>You can also create and manipulate browser actions programmatically using the <a href="/en-US/Add-ons/WebExtensions/API/browserAction">browserAction API</a>.</p> + +<h2 id="Sintaxe">Sintaxe</h2> + +<p>The <code>browser_action</code> key is an object that may have any of the following properties, all optional:</p> + +<table class="fullwidth-table standard-table"> + <thead> + <tr> + <th scope="col">Nome</th> + <th scope="col">Tipo</th> + <th scope="col">Descrição</th> + </tr> + </thead> + <tbody> + <tr> + <td><code>browser_style</code></td> + <td><code>Booliano</code></td> + <td> + <div class="geckoVersionNote">Novo no Firefox 48</div> + + <p>Optional, defaulting to <code>false</code>.</p> + + <p>Use this to include a stylesheet in your popup that will make it look consistent with the browser's UI and with other extensions that use the <code>browser_style</code> property. Although this key defaults to <code>false</code>, it's recommended that you include it and set it to <code>true</code>.</p> + + <p>In Firefox, the stylesheet can be seen at chrome://browser/content/extension.css, or chrome://browser/content/extension-mac.css on OS X.</p> + + <p>The <a href="https://firefoxux.github.io/StyleGuide/#/controls">Firefox Style Guide</a> describes the classes you can apply to elements in the popup in order to get particular styles.</p> + + <p>The <a href="https://github.com/mdn/webextensions-examples/tree/master/latest-download">latest-download</a> example extension uses <code>browser_style</code> in its popup.</p> + </td> + </tr> + <tr> + <td><code>default_area</code></td> + <td><code>String</code></td> + <td> + <div class="geckoVersionNote">Novo no Firefox 54</div> + + <p>Defines the part of the browser in which the button is initially placed. This is a string that may take one of four values:</p> + + <ul> + <li>"navbar": the button is placed in the main browser toolbar, alongside the URL bar.</li> + <li>"menupanel": the button is placed in a popup panel.</li> + <li>"tabstrip": the button is placed in the toolbar that contains browser tabs.</li> + <li>"personaltoolbar": the button is placed in the bookmarks toolbar.</li> + </ul> + + <p>This property is only supported in Firefox.</p> + + <p>This property is optional, and defaults to "navbar".</p> + + <p>An extension can't change the location of the button after it has been installed, but the user may be able to move the button using the browser's built-in UI customization mechanism.</p> + </td> + </tr> + <tr> + <td><code>default_icon</code></td> + <td><code>Object</code> or <code>String</code></td> + <td> + <p>Use this to specify one or more icons for the browser action. The icon is shown in the browser toolbar by default.</p> + + <p>Icons are specified as URLs relative to the manifest.json file itself.</p> + + <p>You can specify a single icon file by supplying a string here:</p> + + <pre class="brush: json no-line-numbers"> +"default_icon": "path/to/geo.svg"</pre> + + <p>To specify multiple icons in different sizes, specify an object here. The name of each property is the icon's height in pixels, and must be convertible to an integer. The value is the URL. For example:</p> + + <pre class="brush: json no-line-numbers"> + "default_icon": { + "16": "path/to/geo-16.png", + "32": "path/to/geo-32.png" + }</pre> + + <p>See <a href="/en-US/Add-ons/WebExtensions/manifest.json/browser_action#Choosing_icon_sizes">Choosing icon sizes</a> for more guidance on this.</p> + </td> + </tr> + <tr> + <td><code>default_popup</code></td> + <td><code>String</code></td> + <td> + <p>The path to an HTML file containing the specification of the popup.</p> + + <p>The HTML file may include CSS and JavaScript files using <code><a href="/en-US/docs/Web/HTML/Element/link"><link></a></code> and <code><a href="/en-US/docs/Web/HTML/Element/script"><script></a></code> elements, just like a normal web page.</p> + + <p>Unlike a normal web page, JavaScript running in the popup can access all the <a href="/en-US/Add-ons/WebExtensions/API">WebExtension APIs</a> (subject, of course, to the extension having the appropriate <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions">permissions</a>).</p> + + <p>This is a <a href="/en-US/Add-ons/WebExtensions/Internationalization#Internationalizing_manifest.json">localizable property</a>.</p> + </td> + </tr> + <tr> + <td><code>default_title</code></td> + <td><code>String</code></td> + <td> + <p>Tooltip for the button, displayed when the user moves their mouse over it. If the button is added to the browser's menu panel, this is also shown under the app icon.</p> + + <p>This is a <a href="/en-US/Add-ons/WebExtensions/Internationalization#Internationalizing_manifest.json">localizable property</a>.</p> + </td> + </tr> + <tr> + <td><code>theme_icons</code></td> + <td><code>Array</code></td> + <td> + <p>This property enables you to specify different icons for dark and light themes.</p> + + <p>If this property is present, it's an array containing at least one <code>ThemeIcons</code> object. A <code>ThemeIcons</code> object contains three properties, all mandatory:</p> + + <dl> + <dt><code>"dark"</code></dt> + <dd>A URL pointing to an icon. This icon will be selected when themes with dark text are active (e.g. Firefox's Light theme, and the Default theme if no default_icon is specified).</dd> + <dt><code>"light"</code></dt> + <dd>A URL pointing to an icon. This icon will be selected when themes with light text are active (e.g. Firefox's Dark theme).</dd> + <dt><code>"size"</code></dt> + <dd>The size of the two icons in pixels.</dd> + </dl> + + <p>Icons are specified as URLs relative to the manifest.json file itself.</p> + + <p>Providing multiple <code>ThemeIcons</code> objects enables you to supply a set of icon pairs in different sizes.</p> + </td> + </tr> + </tbody> +</table> + +<h2 id="Escolher_os_tamanhos_do_ícone">Escolher os tamanhos do ícone</h2> + +<p>The browser action's icon may need to be displayed in different sizes in different contexts:</p> + +<ul> + <li>The icon is displayed by default in the browser toolbar, but the user can move it into the browser's menu panel (the panel that opens when the user clicks the "hamburger" icon). The icon in the toolbar is smaller than the icon in the menu panel.</li> + <li>On a high-density display like a Retina screen, icons needs to be twice as big.</li> +</ul> + +<p>If the browser can't find an icon of the right size in a given situation, it will pick the best match and scale it. Scaling may make the icon appear blurry, so it's important to choose icon sizes carefully.</p> + +<p>There are two main approaches to this. You can supply a single icon as an SVG file, and it will be scaled correctly:</p> + +<pre class="brush: json no-line-numbers">"default_icon": "path/to/geo.svg"</pre> + +<p>Alternatively, you can supply several icons in different sizes, and the browser will pick the best match.</p> + +<p>In Firefox:</p> + +<ul> + <li>The default height and width for icons in the toolbar is 16 * <code><a href="/en-US/docs/Web/API/Window/devicePixelRatio">window.devicePixelRatio</a></code>.</li> + <li>The default height and width for icons in the menu panel is 32 * <code><a href="/en-US/docs/Web/API/Window/devicePixelRatio">window.devicePixelRatio</a></code>.</li> +</ul> + +<p>So you can specify icons that match exactly, on both normal and Retina displays, by supplying three icon files, and specifying them like this:</p> + +<pre class="brush: json no-line-numbers"> "default_icon": { + "16": "path/to/geo-16.png", + "32": "path/to/geo-32.png", + "64": "path/to/geo-64.png" + }</pre> + +<p>If Firefox can't find an exact match for the size it wants, then it will pick the smallest icon specified that's bigger than the ideal size. If all icons are smaller than the ideal size, it will pick the biggest icon specified.</p> + +<h2 id="Exemplo">Exemplo</h2> + +<pre class="brush: json no-line-numbers">"browser_action": { + "default_icon": { + "16": "button/geo-16.png", + "32": "button/geo-32.png" + } +}</pre> + +<p>A browser action with just an icon, specified in 2 different sizes. The extension's background scripts can receive click events when the user clicks the icon using code like this:</p> + +<pre class="brush: js no-line-numbers"> browser.browserAction.onClicked.addListener(handleClick);</pre> + +<pre class="brush: json">"browser_action": { + "default_icon": { + "16": "button/geo-16.png", + "32": "button/geo-32.png" + }, + "default_title": "Whereami?", + "default_popup": "popup/geo.html" +}</pre> + +<p>A browser action with an icon, a title, and a popup. The popup will be shown when the user clicks the button.</p> + +<p>For a simple, but complete, extension that uses a browser action, see the <a href="/en-US/Add-ons/WebExtensions/Your_second_WebExtension">walkthrough tutorial</a>.</p> + +<h2 id="Compatibilidade_de_navegador">Compatibilidade de navegador</h2> + +<p>{{Compat("webextensions.manifest.browser_action", 10)}}</p> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/manifest.json/browser_specific_settings/index.html b/files/pt-pt/mozilla/add-ons/webextensions/manifest.json/browser_specific_settings/index.html new file mode 100644 index 0000000000..3d52790362 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/manifest.json/browser_specific_settings/index.html @@ -0,0 +1,107 @@ +--- +title: applications +slug: Mozilla/Add-ons/WebExtensions/manifest.json/browser_specific_settings +tags: + - Extensões + - Extensões da Web + - Extras +translation_of: Mozilla/Add-ons/WebExtensions/manifest.json/browser_specific_settings +--- +<div>{{AddonSidebar}}</div> + +<table class="fullwidth-table standard-table"> + <tbody> + <tr> + <th scope="row" style="width: 30%;">Tipo</th> + <td><code>Object</code></td> + </tr> + <tr> + <th scope="row">Obrigatório</th> + <td>Usually, no (but see also <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/WebExtensions_and_the_Add-on_ID#When_do_you_need_an_add-on_ID">When do you need an Add-on ID?</a>). Mandatory before Firefox 48 (desktop) and Firefox for Android.</td> + </tr> + <tr> + <th scope="row">Exemplo</th> + <td> + <pre class="brush: json no-line-numbers"> +"applications": { + "gecko": { + "id": "addon@example.com", + "strict_min_version": "42.0" + } +}</pre> + </td> + </tr> + </tbody> +</table> + +<h2 id="Descrição">Descrição</h2> + +<p>A chave <code>applications</code> contém chaves que são especificas de uma <em>application</em> de um anfitrião em particular.</p> + +<h3 id="Propriedadee_(Gecko)_do_Firefox">Propriedadee (Gecko) do Firefox</h3> + +<p>Currently this contains just one key, <code>gecko</code>, which may contain four string attributes:</p> + +<ul> + <li><code>id</code> is the extension ID. Optional from Firefox 48, mandatory before Firefox 48. See <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/WebExtensions_and_the_Add-on_ID">Extensions and the Add-on ID</a> to see when you need to specify an add-on ID.</li> + <li><code>strict_min_version</code>: minimum version of Gecko to support. Versions containing a "*" are not valid in this field. Defaults to "42a1".</li> + <li><code>strict_max_version</code>: maximum version of Gecko to support. If the Firefox version on which the extension is being installed or run is above this version, then the extension will be disabled, or not permitted to be installed. Defaults to "*", which disables checking for a maximum version.</li> + <li><code>update_url</code> is a link to an <a href="/en-US/Add-ons/Updates">extension update manifest</a>. Note that the link must begin with "https". This key is for managing extension updates yourself (i.e. not through AMO).</li> +</ul> + +<p>Consulte a lista das <a href="https://addons.mozilla.org/pt-PT/firefox/pages/appversions/">versões válidas de Gecko</a>.</p> + +<h4 id="Formato_da_Id._da_Extensão">Formato da Id. da Extensão</h4> + +<p>A Id. da extensão deve ser uma das seguintes:</p> + +<ul> + <li><a href="https://en.wikipedia.org/wiki/Universally_unique_identifier" title="Generating_GUIDs">GUID</a></li> + <li>A string formatted like an email address: <code class="plain">extensionname@example.org</code></li> +</ul> + +<p>The latter format is easier to generate and manipulate. Be aware that using a real email address here may attract spam.</p> + +<p>Por exemplo:</p> + +<pre class="brush:json;auto-links:false no-line-numbers">"id": "extensionname@example.org", + +"id": "{daf44bf7-a45e-4450-979c-91cf07434c3d}"</pre> + +<h3 id="Propriedades_do_Microsoft_Edge">Propriedades do Microsoft Edge</h3> + +<p>Microsoft Edge stores its browser specific settings in the <code>edge</code> subkey, which has the following properties:</p> + +<dl> + <dt><code>browser_action_next_to_addressbar</code></dt> + <dd> + <p>Boolean property which controls the placement of the <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Browser_actions">browser action</a>.</p> + + <ul> + <li><code>true</code> is equivalent to setting <code><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_action#Syntax">browser_action.default_area</a></code> to <code>navbar</code>.</li> + <li><code>false</code> is equivalent to setting <code><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_action#Syntax">browser_action.default_area</a></code> to <code>menupanel</code>.</li> + </ul> + </dd> +</dl> + +<h2 id="Exemplos">Exemplos</h2> + +<p>Example with all possible keys. Note that most extensions will omit <code>strict_max_version</code> and <code>update_url</code>.</p> + +<pre class="brush: json no-line-numbers">"applications": { + "gecko": { + "id": "addon@example.com", + "strict_min_version": "42.0", + "strict_max_version": "50.*", + "update_url": "https://example.com/updates.json" + }, + "edge": { + <code>"browser_action_next_to_addressbar": true</code> + } +}</pre> + +<h2 id="Compatibilidade_de_navegador">Compatibilidade de navegador</h2> + +<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> + +<p>{{Compat("webextensions.manifest.browser_specific_settings")}}</p> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/manifest.json/devtools_page/index.html b/files/pt-pt/mozilla/add-ons/webextensions/manifest.json/devtools_page/index.html new file mode 100644 index 0000000000..6f53c96b01 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/manifest.json/devtools_page/index.html @@ -0,0 +1,42 @@ +--- +title: devtools_page +slug: Mozilla/Add-ons/WebExtensions/manifest.json/devtools_page +translation_of: Mozilla/Add-ons/WebExtensions/manifest.json/devtools_page +--- +<div>{{AddonSidebar}}</div> + +<table class="fullwidth-table standard-table"> + <tbody> + <tr> + <th scope="row" style="width: 30%;">Tipo</th> + <td><code>String</code></td> + </tr> + <tr> + <th scope="row">Obrigatório</th> + <td>Não</td> + </tr> + <tr> + <th scope="row">Exemplo</th> + <td> + <pre class="brush: json no-line-numbers"> +"devtools_page": "devtools/my-page.html"</pre> + </td> + </tr> + </tbody> +</table> + +<p>Utilziae esta chave para permitir que a sua extensão amplie as <em>devtools </em>do navegador integradas.</p> + +<p>esta chave é definida como um URL para um ficheiro HTML. O ficheiro HTML deverá ser incorporado com a extensão, e o URL é relativo à raiz das extensões.</p> + +<p>Consulte <a href="/pt-PT/Add-ons/WebExtensions/Extensão_das_ferramentas_de_desenvolvimento">Extensão das ferramentas de desenvolvimento</a> para saber mais.</p> + +<h2 id="Exemplo">Exemplo</h2> + +<pre class="brush: json no-line-numbers">"devtools_page": "devtools/my-page.html"</pre> + +<h2 id="Compatibilidade_de_navegador">Compatibilidade de navegador</h2> + +<p class="hidden">A tabela de compatibilidade nesta página é gerada a partir dos dados estruturados. Se pretender contribuir para os dados, por favor, consulte <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> e envie-nos um pedido de submissão (<em>pull</em>).</p> + +<p>{{Compat("webextensions.manifest.devtools_page")}}</p> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/manifest.json/icones/index.html b/files/pt-pt/mozilla/add-ons/webextensions/manifest.json/icones/index.html new file mode 100644 index 0000000000..c9fd687771 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/manifest.json/icones/index.html @@ -0,0 +1,78 @@ +--- +title: Ícones (icons) +slug: Mozilla/Add-ons/WebExtensions/manifest.json/icones +tags: + - Extensões + - Extensões da Web + - Extras +translation_of: Mozilla/Add-ons/WebExtensions/manifest.json/icons +--- +<div>{{AddonSidebar}}</div> + +<table class="fullwidth-table standard-table"> + <tbody> + <tr> + <th scope="row" style="width: 30%;">Tipo</th> + <td><code>Objeto</code></td> + </tr> + <tr> + <th scope="row">Obrigatório</th> + <td>Não</td> + </tr> + <tr> + <th scope="row">Exemplo</th> + <td> + <pre class="brush: json no-line-numbers"> +"icons": { + "48": "icon.png", + "96": "icon@2x.png" +}</pre> + </td> + </tr> + </tbody> +</table> + +<p>The <code>icons</code> key specifies icons for your extension. Those icons will be used to represent the extension in components such as the Add-ons Manager.</p> + +<p>It consists of key-value pairs of image size in px and image path relative to the root directory of the extension.</p> + +<p>If <code>icons</code> is not supplied, a standard extension icon will be used by default.</p> + +<p>You should supply at least a main extension icon, ideally 48x48 px in size. This is the default icon that will be used in the Add-ons Manager. You may, however, supply icons of any size and Firefox will attempt to find the best icon to display in different components.</p> + +<p>Firefox will consider the screen resolution when choosing an icon. To deliver the best visual experience to users with high-resolution displays, such as Retina displays, provide double-sized versions of all your icons.</p> + +<h2 id="Exemplo">Exemplo</h2> + +<p>The keys in the <code>icons</code> object specify the icon size in px, values specify the relative icon path. This example contains a 48px extension icon and a larger version for high-resolution displays.</p> + +<pre class="brush: json no-line-numbers">"icons": { + "48": "icon.png", + "96": "icon@2x.png" +}</pre> + +<h2 id="SVG">SVG</h2> + +<p>You can use SVG and the browser will scale your icon appropriately. There are currently two caveats though:</p> + +<ol> + <li>You need to specify a viewBox in the image. E.g.: + <pre class="brush: html"><svg viewBox="0 0 48 48" width="48" height="48" ...</pre> + </li> + <li>Even though you can use one file, you still need to specify various size of the icon in your manifest. E.g.: + <pre class="brush: json">"icons": { + "48": "icon.svg", + "96": "icon.svg" +}</pre> + </li> +</ol> + +<div class="note"> +<p>If you are using a program like Inkscape for creating SVG, you might want to save it as a "plain SVG". Firefox might be confused by various special namespaces and not display your icon.</p> +</div> + +<h2 id="Compatibilidade_de_navegador">Compatibilidade de navegador</h2> + +<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> + +<p>{{Compat("webextensions.manifest.icons")}}</p> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/manifest.json/index.html b/files/pt-pt/mozilla/add-ons/webextensions/manifest.json/index.html new file mode 100644 index 0000000000..4f8e087281 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/manifest.json/index.html @@ -0,0 +1,132 @@ +--- +title: manifest.json +slug: Mozilla/Add-ons/WebExtensions/manifest.json +tags: + - Add-ons + - Extensões + - WebExtensions +translation_of: Mozilla/Add-ons/WebExtensions/manifest.json +--- +<div>{{AddonSidebar}}</div> + +<p>O ficheiro manifest.json é o único ficheiro que deve ser incluído em extensões que usem APIs de WebExtension.</p> + +<p>Com o <code>manifest.json</code>, é possível especificar metadados sobre a extensão a que pertence, tal como o nome, a versão, e funcionalidades como <em>scripts </em>de <em>background</em>, <em>scripts</em> de conteúdo, e ações de <em>browser</em>.</p> + +<p>O <code>manifest.json</code><em> </em>é um ficheiro em formato <a href="https://wiki.developer.mozilla.org/en-US/docs/Glossary/JSON">JSON</a>, mas também suporta comentários do tipo "//".</p> + +<h2 id="Propriedades_do_manifest.json">Propriedades do manifest.json</h2> + +<p>Seguem-se as propriedades que o <code>manifest.json</code> suporta:</p> + +<div class="twocolumns">{{ ListSubpages ("/en-US/Add-ons/WebExtensions/manifest.json") }}</div> + +<div class="twocolumns"></div> + +<h3 id="Notas_sobre_propriedades_do_manifest.json">Notas sobre propriedades do manifest.json</h3> + +<ul> + <li><code>as únicas <strong>propriedades obrigatórias</strong> são "manifest_version"</code>, <code>"version"</code>, e <code>"name"</code>. <code>"default_locale"</code> só é obrigatório se existir uma pasta "_locales". Caso contrário, a propriedade não pode existir.</li> + <li> + <p><code>"browser_specific_settings"</code> não é compatível com Google Chrome.</p> + </li> +</ul> + +<h3 id="Como_aceder_a_propriedades_manifest.json_em_runtime">Como aceder a propriedades manifest.json em <em>runtime</em></h3> + +<p>É possível aceder ao <code>manifest.json</code> de uma extensão a partir de um <em>script</em><em> </em>da mesma, com a função de JavaScript {{WebExtAPIRef("runtime.getManifest()")}}:</p> + +<pre class="brush: js notranslate">browser.runtime.getManifest().version;</pre> + +<h2 id="Compatibilidade_de_browsers">Compatibilidade de <em>browsers</em></h2> + +<p>{{Compat("webextensions.manifest")}}</p> + +<h2 id="Exemplo">Exemplo</h2> + +<p>Os exemplos seguintes demonstram como funcionam algumas propriedades comuns nos <em>manifest.json.</em> </p> + +<div class="blockIndicator note"> +<p><strong>Nota:</strong> Estes exemplos não funcionam se forem simplesmente copiados e colados. As propriedades necessárias são determinadas pelas características de cada extensão</p> +</div> + +<p>Para ver exemplos completos de extensões, veja a página <a href="https://wiki.developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Examples">Exemplos de extensões</a>.</p> + +<pre class="brush: json notranslate">{ + "applications": { + "gecko": { + "id": "addon@example.com", + "strict_min_version": "42.0" + } + }, + + "background": { + "scripts": ["jquery.js", "my-background.js"], + "page": "my-background.html" + }, + + "browser_action": { + "default_icon": { + "19": "button/geo-19.png", + "38": "button/geo-38.png" + }, + "default_title": "Whereami?", + "default_popup": "popup/geo.html" + }, + + "commands": { + "toggle-feature": { + "suggested_key": { + "default": "Ctrl+Shift+Y", + "linux": "Ctrl+Shift+U" + }, + "description": "Send a 'toggle-feature' event" + } + }, + + "content_security_policy": "script-src 'self' https://example.com; object-src 'self'", + + "content_scripts": [ + { + "exclude_matches": ["*://developer.mozilla.org/*"], + "matches": ["*://*.mozilla.org/*"], + "js": ["borderify.js"] + } + ], + + "default_locale": "en", + + "description": "...", + + "icons": { + "48": "icon.png", + "96": "icon@2x.png" + }, + + "manifest_version": 2, + + "name": "...", + + "page_action": { + "default_icon": { + "19": "button/geo-19.png", + "38": "button/geo-38.png" + }, + "default_title": "Whereami?", + "default_popup": "popup/geo.html" + }, + + "permissions": ["webNavigation"], + + "version": "0.1", + + "web_accessible_resources": ["images/my-image.png"] +}</pre> + +<h2 id="Compatibilidade_de_browsers_2">Compatibilidade de <em>browsers</em></h2> + +<p>Consulte a <a href="https://wiki.developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Browser_compatibility_for_manifest.json">tabela de compatibilidade de browsers do manifest.json</a> para saber que <em>browsers </em>suportam cada propriedade do <code>manifest.json</code>.</p> + +<h2 id="Ver_também">Ver também</h2> + +<p>{{WebExtAPIRef("permissions")}} JavaScript API</p> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/o_que_sao_webextensions/index.html b/files/pt-pt/mozilla/add-ons/webextensions/o_que_sao_webextensions/index.html new file mode 100644 index 0000000000..c2d7ef5d71 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/o_que_sao_webextensions/index.html @@ -0,0 +1,59 @@ +--- +title: O que são extensões? +slug: Mozilla/Add-ons/WebExtensions/O_que_sao_WebExtensions +tags: + - Extensões + - Extensões da Web +translation_of: Mozilla/Add-ons/WebExtensions/What_are_WebExtensions +--- +<div>{{AddonSidebar}}</div> + +<p>Uma extensão adiciona funcionalidades e funções a um navegador. É criada, utilizando a tecnologia padrão baseada na Web - CSS, HTML e JavaScript. Esta tira vantagem de algumas APIs da Web, como JavaScript pode em uma página da web, mas uma extensão também tem acesso ao seu próprio conjunto de APIs de JavaScript. Isto significa que pode fazer muito mais numa extensão do que pode com o código numa página da Web. Aqui estão apenas alguns exemplos das coisas que pode fazer.</p> + +<p><strong>Melhore ou complemente um site da Web</strong>: utilize um extra para fornecer funcionalidades adicionais no navegador ou informação do seu site da Web. Permita que os utilizadores recolham detalhes das páginas que eles visitam, para melhorar o serviço que oferece.</p> + +<p><img alt="" src="https://mdn.mozillademos.org/files/15808/Amazon_add_on.png"></p> + +<p>Exemplos: <a href="https://addons.mozilla.org/en-US/firefox/addon/amazon-browser-bar/">Amazon Assistant para Firefox</a>, <a href="https://addons.mozilla.org/en-US/firefox/addon/onenote-clipper/">OneNote Web Clipper</a>, e <a href="https://addons.mozilla.org/en-US/firefox/addon/grammarly-1/">Grammarly for Firefox</a></p> + +<p><strong>Deixe que os utilizadores mostrem a sua personalidade</strong>: Browser extensions can manipulate the content of pages browsed by a user. Help the user add a favorite logo or picture as the background to every page they visit. Extensions also give you the ability to update the look of the Firefox UI. (Update the Firefox UI using standalone <a href="https://developer.mozilla.org/en-US/Add-ons/Themes/Theme_concepts">theme add-ons</a> too).</p> + +<p><img alt="" src="https://mdn.mozillademos.org/files/15809/MyWeb_New_Tab_add_on.png" style="height: 398px; width: 540px;"></p> + +<p>Exemplos: <a href="https://addons.mozilla.org/en-US/firefox/addon/myweb-new-tab/">MyWeb New Tab</a>, <a href="https://addons.mozilla.org/en-US/firefox/addon/tabliss/">Tabliss</a>, e <a href="https://addons.mozilla.org/en-US/firefox/addon/vivaldifox/">VivaldiFox</a></p> + +<p><strong>Adicionar ou remover conteúdo das páginas da Web</strong>: You might want to help users block intrusive ads from web pages, provide access to a travel guide whenever a country or city is mentioned in a web page, or reformat page content to offer a consistent reading experience. With the ability to access and update both a page’s HTML and CSS, you can help users see the web the way they want to.</p> + +<p><img alt="" src="https://mdn.mozillademos.org/files/15807/ublock_origin_add_on.png" style="height: 480px; width: 640px;"></p> + +<p>Exemplos: <a href="https://addons.mozilla.org/en-US/firefox/addon/ublock-origin/">uBlock Origin</a>, <a href="https://addons.mozilla.org/en-US/firefox/addon/reader/">Reader</a>, e <a href="https://addons.mozilla.org/en-US/firefox/addon/toolbox-google-play-store/">Toolbox para Google Play Store™</a></p> + +<p><strong>Adicionar ferramentas e novas funcionalidades de navegação</strong>: Add new features to a taskboard, or generate QR code images from URLs, hyperlinks, or page text. With flexible UI options and the power of the WebExtensions APIs you can easily add new features to a browser. And, you can enhance almost any website’s features or functionality, it doesn't have to be your website.</p> + +<p><img alt="" src="https://mdn.mozillademos.org/files/15806/QR_Code_Image_Generator_add_on.png"></p> + +<p>Examples: <a href="https://addons.mozilla.org/en-US/firefox/addon/qr-code-image-generator/">QR Code Image Generator</a>, <a href="https://addons.mozilla.org/en-US/firefox/addon/swimlanes-for-trello/">Swimlanes for Trello</a>, and <a href="https://addons.mozilla.org/en-US/firefox/addon/tomato-clock/">Tomato Clock</a></p> + +<p><strong>Jogos</strong>: Offer traditional computer games, with off-line play features, but also explore new game possibilities, for example, by incorporating gameplay into everyday browsing.</p> + +<p> <img alt="" src="https://mdn.mozillademos.org/files/15805/Asteroids_in_Popup_add_on%20.png" style="height: 438px; width: 700px;"></p> + +<p>Examples: <a href="https://addons.mozilla.org/en-US/firefox/addon/asteroids-in-popup/">Asteroids in Popup</a>, <a href="https://addons.mozilla.org/en-US/firefox/addon/solitaire-card-game-new-tab/">Solitaire Card Game New Tab</a>, and <a href="https://addons.mozilla.org/en-US/firefox/addon/2048-prime/">2048 Prime</a>.</p> + +<p><strong>Adicionar ferramentas de desenvolvimento</strong>: You may provide web development tools as your business or have developed a useful technique or approach to web development that you want to share. Either way, you can enhance the built-in Firefox developer tools by adding a new tab to the developer toolbar.</p> + +<p><img alt="" src="https://mdn.mozillademos.org/files/15804/aXe_Developer_Tools_add_on.png" style="height: 261px; width: 700px;"></p> + +<p>Examples: <a href="https://addons.mozilla.org/en-US/firefox/addon/web-developer/">Web Developer</a>, <a href="https://addons.mozilla.org/en-US/firefox/addon/react-devtools/">Web React Developer Tools</a>, and <a href="https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/">aXe Developer Tools</a></p> + +<p>Extensions for Firefox are built using the WebExtensions APIs, a cross-browser system for developing extensions. To a large extent, the API is compatible with the <a class="external external-icon" href="https://developer.chrome.com/extensions">extension API</a> supported by Google Chrome and Opera. Extensions written for these browsers will in most cases run in Firefox or Microsoft Edge with just a few <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Porting_a_Google_Chrome_extension">changes</a>. The API is also fully compatible with <a href="/en-US/Firefox/Multiprocess_Firefox">multiprocess Firefox</a>.</p> + +<p>If you have ideas or questions, or need help migrating a legacy add-on to WebExtensions APIs, you can reach us on the <a class="external external-icon" href="https://mail.mozilla.org/listinfo/dev-addons">dev-addons mailing list</a> or in <a href="irc://irc.mozilla.org/extdev">#extdev</a> on <a class="external external-icon" href="https://wiki.mozilla.org/IRC">IRC</a>.</p> + +<h2 id="E_a_seguir">E a seguir?</h2> + +<ul> + <li>Consulte o desenvolvimento de uma extensão simples em <a href="https://developer.mozilla.org/pt-PT/Add-ons/WebExtensions/A_sua_primeira_extensao">A sua primeira extensão</a>.</li> + <li>Saiba sobre a estrutura de uma extensão em <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Anatomy_of_a_WebExtension">Anatomia de uma extensão</a>.</li> + <li>Experimente alguns exemplos de extensões em <a href="/pt-PT/Add-ons/WebExtensions/Exemplos_extensoes">Exemplos de extensões</a>.</li> +</ul> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/primeiros_passos_com_web-ext/index.html b/files/pt-pt/mozilla/add-ons/webextensions/primeiros_passos_com_web-ext/index.html new file mode 100644 index 0000000000..a6eb21ffc1 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/primeiros_passos_com_web-ext/index.html @@ -0,0 +1,304 @@ +--- +title: Primeiros passos com web-ext +slug: Mozilla/Add-ons/WebExtensions/Primeiros_passos_com_web-ext +tags: + - Extensão da Web + - Ferramentas + - Guía + - Instalação + - Testes + - empacotamento + - web-ext +translation_of: Mozilla/Add-ons/WebExtensions/Getting_started_with_web-ext +--- +<div>{{AddonSidebar}}</div> + +<p class="summary">web-ext é uma ferramenta da linha de comando desenhada para acelerar várias partes do processo de desenvolvimento da extensão, tornado o desenvolvimento mais rápido e fácil. Este artigo explica como instalar e utilizar web-ext.</p> + +<h2 id="Instalação">Instalação</h2> + +<p>web-ext is a node-based application that you install with the <a href="https://nodejs.org/">nodejs/npm</a> tool. Install web-ext using the following command:</p> + +<pre class="brush: bash"><code>npm install --global web-ext</code></pre> + +<p>web-ext requires the current <a href="https://github.com/nodejs/Release#release-schedule">LTS</a> (long-term support) version of <a href="https://nodejs.org/">NodeJS</a>.</p> + +<p>To test whether the installation worked run the following command, which displays the web-ext version number:</p> + +<pre class="brush: bash"><code>web-ext --version</code></pre> + +<h2 id="Utilizar_web-ext">Utilizar web-ext</h2> + +<p>Before you start using web-ext, locate an example extension to use—if you don't have one, use one from the <a href="https://github.com/mdn/webextensions-examples">webextensions-examples</a> repo.</p> + +<h3 id="Testar_uma_extensão">Testar uma extensão</h3> + +<p>Test an extension in Firefox by <code>cd</code>'ing into your extension's root directory and entering:</p> + +<pre class="brush: bash"><code>web-ext run</code></pre> + +<p>This starts Firefox and loads the extension temporarily in the browser, just as you can on the <a href="/en-US/docs/Tools/about:debugging#Add-ons">about:debugging page</a>.</p> + +<p>See the <a href="/en-US/Add-ons/WebExtensions/web-ext_command_reference#web-ext_run">run reference guide</a> to learn more.</p> + +<h3 id="Recarregamento_automático_da_extensão">Recarregamento automático da extensão</h3> + +<p>The <code>run</code> command watches your source files and tells Firefox to reload the extension after you edit and save a file. For example, if you changed the <code>name</code> property in your <code>manifest.json</code> file, Firefox displays the new name. This makes it easy to try out new features because you can see the effect immediately. The automatic reloading feature is active by default, you use it like this:</p> + +<pre class="brush: bash"><code>web-ext run</code></pre> + +<p>You can also press the <code>r</code> key in the <code>web-ext</code> terminal to trigger an extension reload.</p> + +<p>If you experience unexpected behavior with the reloading feature, please <a href="https://github.com/mozilla/web-ext/issues">file a bug</a>. You can also disable reloading like this:</p> + +<pre class="brush: bash"><code>web-ext run --no-reload</code></pre> + +<div class="note"> +<p>O reccaregamento da extensão só é suportado a paratir da versão do Firefox 49 ou superior .</p> +</div> + +<h3 id="Testar_em_versões_diferentes_do_Firefox">Testar em versões diferentes do Firefox</h3> + +<p>To run your extension in a version of <a href="https://www.mozilla.org/en-US/firefox/">Firefox Desktop</a> other than the default, use the <code>--firefox</code> option to specify a full path to the binary file. Here is an example for Mac OS:</p> + +<pre class="brush: bash">web-ext run --firefox=/Applications/FirefoxNightly.app/Contents/MacOS/firefox-bin</pre> + +<p>On Windows, the path needs to include <code>firefox.exe</code>, for example:</p> + +<pre class="brush: bash">web-ext run --firefox="C:\Program Files\Mozilla Firefox\firefox.exe"</pre> + +<p>See the <a href="/en-US/Add-ons/WebExtensions/web-ext_command_reference#web-ext_run">run command</a> reference to learn more.</p> + +<h3 id="Testar_no_Firefox_48">Testar no Firefox 48</h3> + +<p>Firefox 48 was the first stable version to use the WebExtension platform, but it doesn't allow <code>web-ext</code> to install an extension remotely. You need to run your extension in Firefox 48 using:</p> + +<pre class="brush: bash">web-ext run --pre-install</pre> + +<h3 id="Testar_no_Firefox_para_Android">Testar no Firefox para Android</h3> + +<p>To run your extension in <a href="https://www.mozilla.org/en-US/firefox/mobile/">Firefox for Android</a>, follow these instructions to <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Developing_WebExtensions_for_Firefox_for_Android#Set_up_your_computer_and_Android_emulator_or_device">set up your computer and device</a>.</p> + +<p>With your device connected to your development computer, run:</p> + +<pre class="brush: bash">web-ext run --target=firefox-android</pre> + +<p>This command displays the device ID for your connected Android device or devices. If you don't see a list of device IDs, make sure you set up the device for development correctly.</p> + +<p><span style="background-color: #ffffff;">N</span>ow, add the device ID to the command:</p> + +<pre class="brush: bash">web-ext run --target=firefox-android --android-device=<device ID></pre> + +<p>If you've multiple versions of Firefox installed, you may need to choose a specific version. For example:</p> + +<pre class="brush: bash">web-ext run --target=firefox-android ... --firefox-apk=org.mozilla.firefox</pre> + +<p>The first time you run this command, you may need to grant Android permissions for the APK. This is because the command needs read / write access to the device storage, so that Firefox for Android can run on a temporary profile. The <code>web-ext</code> output guides you in how to grant these permissions.</p> + +<p>The <code>web-ext</code> command does not alter any of your existing Firefox for Android preferences or data. To see more information about how <code>web-ext</code> is interacting with your device, run the command with <code>--verbose</code>.</p> + +<p>See the <a href="/en-US/Add-ons/WebExtensions/web-ext_command_reference#web-ext_run">run command</a> reference to learn more.</p> + +<h3 id="Depurar_no_Firefox_para_Android">Depurar no Firefox para Android</h3> + +<p>When using <code>web-ext run</code> to test an extension on Firefox for Android, you'll notice a message like this in the console output:</p> + +<pre>You can connect to this Android device on TCP port 51499 +</pre> + +<p>This is a remote debugger port that you can <a href="/en-US/docs/Tools/Remote_Debugging/Firefox_for_Android#Connecting">connect to with Firefox's developer tools</a>. In this case, you'd connect to host <code>localhost</code> on port <code>51499</code>.</p> + +<p>See <a href="/en-US/Add-ons/WebExtensions/Developing_WebExtensions_for_Firefox_for_Android#Debug_your_extension">this guide</a> for more information about debugging an extension on Firefox for Android.</p> + +<h3 id="Testar_extensões_não_assinadas">Testar extensões não assinadas</h3> + +<p>When you execute <a href="/en-US/Add-ons/WebExtensions/web-ext_command_reference#web-ext_run">web-ext run</a>, the extension gets installed temporarily until you close Firefox. This does not violate any signing restrictions. If instead you create a zip file with <a href="/en-US/Add-ons/WebExtensions/web-ext_command_reference#web-ext_build">web-ext build</a> and try to install it into Firefox, you will see an error telling you that the add-on is not signed. You will need to use an <a href="https://wiki.mozilla.org/Addons/Extension_Signing#Unbranded_Builds">unbranded build</a> or use a <a href="https://www.mozilla.org/en-US/firefox/developer/">development build</a> to install unsigned extensions.</p> + +<h3 id="Utilizar_um_perfil_personalizado">Utilizar um perfil personalizado</h3> + +<p>By default, the <code>run</code> command will create a temporary Firefox profile. To run your extension with a specific profile use the <code>--firefox-profile</code> option, like this:</p> + +<pre class="brush: bash">web-ext run --firefox-profile=your-custom-profile</pre> + +<p>This option accepts a string containing the name of your profile or an absolute path to the profile directory. This is helpful if you want to manually configure some settings that will always be available to the <code>run</code> command.</p> + +<h3 id="Manter_alterações_de_perfil">Manter alterações de perfil</h3> + +<p>The <code>run</code> command does not save any changes made to the custom profile specified by <code>--firefox-profile</code>. To keep changes, add this option:</p> + +<pre class="brush: bash">web-ext run --keep-profile-changes --firefox-profile=your-custom-profile</pre> + +<p>This may be helpful if your extension has many different run states.</p> + +<div class="warning"> +<p>This option makes the profile specified by <code>--firefox-profile</code> completely insecure for daily use. It turns off auto-updates and allows silent remote connections, among other things. Specifically, it will make destructive changes to the profile that are required for <code>web-ext</code> to operate.</p> +</div> + +<h3 id="Empacotar_a_sua_extensão">Empacotar a sua extensão</h3> + +<p>Once you've tested your extension and verified that it's working, you can turn it into a package for submitting to <a href="https://addons.mozilla.org">addons.mozilla.org</a> using the following command:</p> + +<pre class="brush: bash"><code>web-ext build</code></pre> + +<p>This outputs a full path to the generated <code>.zip</code> file that can be loaded into a browser.</p> + +<div class="warning"> +<p>The generated <code>.zip</code> file doesn't work on Firefox without signing or adding <code><a href="/en-US/Add-ons/WebExtensions/manifest.json/applications">applications</a>.gecko.id</code> key into <code><a href="/en-US/Add-ons/WebExtensions/manifest.json">manifest.json</a></code>. For more information, please refer <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/WebExtensions_and_the_Add-on_ID">WebExtensions and the Add-on ID</a> page.</p> +</div> + +<p><code>web-ext build</code> is designed to ignore files that are commonly not wanted in packages, such as <code>.git</code>, <code>node_modules</code>, and other artifacts.</p> + +<p>See the <a href="/en-US/Add-ons/WebExtensions/web-ext_command_reference#web-ext_build">build reference guide</a> to learn more.</p> + +<h3 id="Assinar_a_sua_extensão_para_distribuição">Assinar a sua extensão para distribuição</h3> + +<p>As an alternative to publishing your extension on <a href="https://addons.mozilla.org/">addons.mozilla.org</a>, you can self-host your package file but it needs to be <a href="https://developer.mozilla.org/Add-ons/Distribution">signed by Mozilla</a> first. The following command packages and signs a ZIP file, then returns it as a signed XPI file for distribution:</p> + +<pre class="brush: bash"><code>web-ext sign --api-key=$AMO_JWT_ISSUER --api-secret=$AMO_JWT_SECRET </code></pre> + +<p>The API options are required to specify your <a href="https://addons.mozilla.org/en-US/developers/addon/api/key/">addons.mozilla.org credentials</a>.</p> + +<ul> + <li><code>--api-key</code>: the API key (JWT issuer) from <code>addons.mozilla.org</code> needed to sign the extension. This is a string that will look something like <code>user:12345:67</code>.</li> + <li><code>--api-secret</code>: the API secret (JWT secret) from <code>addons.mozilla.org</code> needed to sign the extension. This is a string that will look something like <code>634f34bee43611d2f3c0fd8c06220ac780cff681a578092001183ab62c04e009</code>.</li> +</ul> + +<p>See the <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/web-ext_command_reference#web-ext_sign">sign reference guide</a> to learn more.</p> + +<h3 id="Assinar_as_extensões_sem_uma_Id._explicita">Assinar as extensões sem uma Id. explicita</h3> + +<p><code>web-ext</code> supports signing extensions that do not declare the <a href="/en-US/Add-ons/WebExtensions/manifest.json/applications">applications.gecko.id</a> property in their manifest. The first time you sign an extension without an explicit ID, <a href="https://addons.mozilla.org/">addons.mozilla.org</a> will generate an ID and <code>web-ext</code> will save it to <code>.web-extension-id</code> in the working directory. You should save the ID file so that you can sign future versions of the same extension. If you lose the ID file, you will have to add back the <code>applications.gecko.id</code> property or use the <code>--id</code> option when signing, for example:</p> + +<pre class="brush: bash"><code>web-ext sign --api-key=... --api-secret=... --id="</code>{c23c69a7-f889-447c-9d6b-7694be8035bc}<code>"</code></pre> + +<h3 id="Assinar_num_ambiente_restringido">Assinar num ambiente restringido</h3> + +<p>If you're working in an environment that restricts access to certain domains, you can try using a proxy when signing:</p> + +<pre class="brush: bash"><code>web-ext sign --api-key=... --api-secret=... --api-proxy=https://yourproxy:6000</code></pre> + +<p>See the <a href="/en-US/Add-ons/WebExtensions/web-ext_command_reference#--api-proxy">--api-proxy</a> option to learn more.</p> + +<p>The following domains are used for signing and downloading files:</p> + +<ul> + <li><code>addons.mozilla.org</code></li> + <li><code>addons.cdn.mozilla.net</code></li> +</ul> + +<h3 id="Verificar_com_o_código_lint">Verificar com o código "lint"</h3> + +<p>Before trying out your extension with the <a href="/en-US/Add-ons/WebExtensions/web-ext_command_reference#web-ext_run">run</a> command or submitting your package to <a href="https://addons.mozilla.org/en-US/firefox/">addons.mozilla.org</a>, use the <code>lint</code> command to make sure your <a href="/en-US/Add-ons/WebExtensions/manifest.json">manifest</a> and other source files do not contain any errors. Example:</p> + +<pre class="brush: bash">web-ext lint</pre> + +<p>This uses the <a href="https://github.com/mozilla/addons-linter">addons-linter</a> library to walk through your source code directory and report any errors, such as the declaration of an unknown permission.</p> + +<p>See the <a href="/en-US/Add-ons/WebExtensions/web-ext_command_reference#web-ext_lint">lint reference guide</a> to learn more.</p> + +<h3 id="Definindo_as_predefinições_de_opção_num_ficheiro_de_configuração">Definindo as predefinições de opção num ficheiro de configuração</h3> + +<p>You can specify <code>--config=my-config.js</code> to set default values for any option. Here is an example with the <code>build</code> command:</p> + +<pre class="brush: bash">web-ext --config=my-config.js build</pre> + +<p>The file should be a CommonJS module <a href="https://nodejs.org/docs/latest/api/modules.html#modules_modules">as understood by NodeJS</a> and must export each configuration value. Here is how you would set the default value of <a href="/en-US/Add-ons/WebExtensions/web-ext_command_reference#--verbose_-v">--verbose</a> to <code>true</code>:</p> + +<pre class="brush: javascript">module.exports = { + verbose: true, +};</pre> + +<p>If you want to specify options that only apply to a specific command, you nest the configuration under the command name. Here is an example of adding configuration for <a href="/en-US/Add-ons/WebExtensions/web-ext_command_reference#--overwrite-dest_-o">--overwrite-dest</a> that only applies to the <code>build</code> command as well as <a href="/en-US/Add-ons/WebExtensions/web-ext_command_reference#--firefox_-f">--firefox</a> that only applies to the <code>run</code> command:</p> + +<pre class="brush: javascript">module.exports = { + // Global options: + verbose: true, + // Command options: + build: { + overwriteDest: true, + }, + run: { + firefox: 'nightly', + }, +};</pre> + +<p>To create a configuration key for a command line option, you remove the preceding dashes and convert the name to camel case. As you can see from this example, <code>--overwrite-dest</code> was converted to <code>overwriteDest</code>.</p> + +<p>If an option can be specified multiple times on the command line then you define it as an array. For example, here is how to specify multiple <a href="/en-US/Add-ons/WebExtensions/web-ext_command_reference#--ignore-files_-i">--ignore-files</a> patterns:</p> + +<pre class="brush: javascript">module.exports = { + ignoreFiles: [ + 'package-lock.json', + 'yarn.lock', + ], +};</pre> + +<h3 id="Automatic_discovery_of_configuration_files">Automatic discovery of configuration files</h3> + +<p><code>web-ext</code> will load existing configuration files in the following order:</p> + +<ul> + <li>A config file named <code>.web-ext-config.js</code> in your home directory, for example: + + <ul> + <li>On Windows: <code>C:\Users\<username>\.web-ext-config.js</code></li> + <li>On macOS: <code>/Users/<username>/.web-ext-config.js</code></li> + <li>On Linux: <code>/home/<username>/.web-ext-config.js</code></li> + </ul> + </li> + <li>A config file named <code>web-ext-config.js</code> in the current directory.</li> +</ul> + +<p>If a home directory config and a local directory config define the same option, the value from the latter file will be used.</p> + +<p>To disable automatic loading of configuration files, set this option:</p> + +<pre class="brush: bash">web-ext --no-config-discovery run</pre> + +<p>To diagnose an issue related to config files, re-run your command with <code>--verbose</code>. This will tell you which config file affected which option value.</p> + +<h3 id="Specifying_different_source_and_destination_directories">Specifying different source and destination directories</h3> + +<p>The preceding commands use default directories for the extension source and artifact creation (for example, built <code>.zip</code> files). The defaults are:</p> + +<ul> + <li>Source: The directory you are in.</li> + <li>Artifacts: A directory called <code>./web-ext-artifacts</code>, created inside the current directory.</li> +</ul> + +<p>You can specify different source and destination directories using the <code>--source-dir</code> and <code>--artifacts-dir</code> options when running your commands. Their values can be relative or absolute paths, but must always be specified as strings. Here is an example of specifying both options when building an extension:</p> + +<pre class="brush: bash"><code>web-ext build --source-dir=webextension-examples/notify-link-clicks-i18n --artifacts-dir=zips</code></pre> + +<h3 id="Outputting_verbose_messages">Outputting verbose messages</h3> + +<p>To see in detail what web-ext is doing when you run a command, include the <code>--verbose</code> option. For example:</p> + +<pre class="brush: bash"><code>web-ext build --verbose</code></pre> + +<h3 id="Viewing_all_commands_and_options">Viewing all commands and options</h3> + +<p>You can list all commands and options like this:</p> + +<pre class="brush: bash"><code>web-ext --help</code></pre> + +<p>You can list options for a specific command by adding it as an argument:</p> + +<pre class="brush: bash"><code>web-ext --help run</code></pre> + +<h3 id="Detecting_temporary_installation">Detecting temporary installation</h3> + +<p>Your extension can detect whether it was installed using <code>web-ext run</code>, rather than as a built and signed extension downloaded from <code>addons.mozilla.org</code>. Listen for the {{WebExtAPIRef("runtime.onInstalled")}} event and check the value of <code>details.temporary</code>.</p> + +<h3 id="Using_web-ext_from_a_script">Using web-ext from a script</h3> + +<p>You can use <code>web-ext</code> as a <code>NodeJS</code> module. Here is <a href="https://github.com/mozilla/web-ext#using-web-ext-in-nodejs-code">more information</a>, with example code.</p> + +<h2 id="Consulte_também">Consulte também</h2> + +<ul> + <li><a class="external external-icon" href="https://github.com/mozilla/web-ext">web-ext repo</a></li> + <li> + <p><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/web-ext_command_reference">web-ext command reference</a></p> + </li> +</ul> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/publicar_a_sua_extensao/index.html b/files/pt-pt/mozilla/add-ons/webextensions/publicar_a_sua_extensao/index.html new file mode 100644 index 0000000000..acc5d21d53 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/publicar_a_sua_extensao/index.html @@ -0,0 +1,62 @@ +--- +title: Publicar a sua extensão +slug: Mozilla/Add-ons/WebExtensions/Publicar_a_sua_extensao +tags: + - Extensões da Web +translation_of: Mozilla/Add-ons/WebExtensions/Package_your_extension_ +--- +<div>{{AddonSidebar}}</div> + +<p> </p> + +<div class="pull-aside"> +<div class="moreinfo"> +<p>Packaged extensions in Firefox are called "XPI files", which are ZIP files with a different extension.</p> + +<p>You don't have to use the XPI extension when uploading to AMO.</p> +</div> +</div> + +<p> </p> + +<p>During development, your extension will consist of a directory containing a manifest.json file and the other files it needs—scripts, icons, HTML documents, and so on. You need to zip these into a single file for uploading to AMO.</p> + +<p>If you're using web-ext, use <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/web-ext_command_reference#web-ext_build">web-ext build </a>to package your extension. Otherwise, follow the instructions below for your chosen operating system.</p> + +<div class="note"> +<p><strong>Dica</strong>: The ZIP file must be a ZIP of the extension's files themselves, not of the directory containing them.</p> +</div> + +<h3 id="Windows">Windows</h3> + +<ol> + <li>Abra a pasta com os seus ficheiros da extensão.</li> + <li>Selecione todos os ficheiros.</li> + <li>Clique direito e escolha "Enviar para" → Pasta Comprimida (zipped).</li> +</ol> + +<p><img alt="" src="https://mdn.mozillademos.org/files/11949/install-windows.png" style="display: block; height: 576px; margin-left: auto; margin-right: auto; width: 800px;"></p> + +<h3 id="Mac_OS_X">Mac OS X</h3> + +<ol> + <li>Open the folder with your extension's files.</li> + <li>Select all of the files.</li> + <li>Right click and choose Compress <em>n</em> Items.</li> +</ol> + +<p><img alt="" src="https://mdn.mozillademos.org/files/11951/install-osx.png" style="display: block; height: 449px; margin-left: auto; margin-right: auto; width: 800px;"></p> + +<div class="pull-aside"> +<div class="moreinfo">See <a href="http://www.info-zip.org/mans/zip.html">http://www.info-zip.org/mans/zip.html</a>.</div> +</div> + +<h3 id="Linux_Mac_OS_X_Terminal">Linux / Mac OS X Terminal</h3> + +<ol> + <li>Open Terminal.</li> + <li>Open the directory containing your extension's files, using the command<br> + <code>cd path/to/<em>my-extension</em>/</code></li> + <li>ZIP the content of the directory, using the command<br> + <code>zip -r -FS ../<em>my-extension</em>.zip *</code></li> +</ol> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/scripts_conteudo/index.html b/files/pt-pt/mozilla/add-ons/webextensions/scripts_conteudo/index.html new file mode 100644 index 0000000000..51356eed85 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/scripts_conteudo/index.html @@ -0,0 +1,446 @@ +--- +title: Scripts de Conteúdo +slug: Mozilla/Add-ons/WebExtensions/Scripts_Conteudo +tags: + - Extensões da Web +translation_of: Mozilla/Add-ons/WebExtensions/Content_scripts +--- +<div>{{AddonSidebar}}</div> + +<p>Um <em>script</em> de conteúdo é uma parte da sua extensão que é executada no contexto de uma determinada página da Web (em oposição aos <em>scripts</em> de segundo plano que são parte da própria extensão, ou <em>scripts</em> que são parte do próprio site da Web, tal como aqueles carregados utilizando o {{HTMLElement("script")}} elemento.</p> + +<p><a href="/en-US/Add-ons/WebExtensions/Background_scripts">Background scripts</a> can access all the <a href="/en-US/Add-ons/WebExtensions/API">WebExtension JavaScript APIs</a>, but they can't directly access the content of web pages. So if your extension needs to do that, you need content scripts.</p> + +<p>Just like the scripts loaded by normal web pages, content scripts can read and modify the content of their pages using the standard DOM APIs.</p> + +<p>Content scripts can only access <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Content_scripts#WebExtension_APIs">a small subset of the WebExtension APIs</a>, but they can <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Content_scripts#Communicating_with_background_scripts">communicate with background scripts</a> using a messaging system, and thereby indirectly access the WebExtension APIs.</p> + +<div class="note"> +<p>Note that content scripts are blocked on the following domains: accounts-static.cdn.mozilla.net, accounts.firefox.com, addons.cdn.mozilla.net, addons.mozilla.org, api.accounts.firefox.com, content.cdn.mozilla.net, content.cdn.mozilla.net, discovery.addons.mozilla.org, input.mozilla.org, install.mozilla.org, oauth.accounts.firefox.com, profile.accounts.firefox.com, support.mozilla.org, sync.services.mozilla.com, and testpilot.firefox.com. If you try to inject a content script into a page in these domains, it will fail and the page will log a <a href="/en-US/docs/Web/HTTP/CSP">CSP</a> error.</p> + +<p>As these restrictions include addons.mozilla.org, users may attempt to use your extension immediately after installation and find it doesn't work. You may want to add an appropriate warning or an <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/onboarding_upboarding_offboarding_best_practices">onboarding page</a> that moves users away from addons.mozilla.org.</p> +</div> + +<div class="note"> +<p>Values added to the global scope of a content script with <code>var foo</code> or <code>window.foo = "bar"</code> may disappear due to bug <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1408996">1408996</a>.</p> +</div> + +<h2 id="Carregar_scripts_de_conteúdo">Carregar <em>scripts</em> de conteúdo</h2> + +<p>You can load a content script into a web page in one of three ways:</p> + +<ol> + <li><strong>at install time, into pages that match URL patterns:</strong> using the <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/content_scripts">content_scripts</a></code> key in your manifest.json, you can ask the browser to load a content script whenever the browser loads a page whose URL <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Match_patterns">matches a given pattern</a>.</li> + <li><strong>at runtime, into pages that match URL patterns:</strong> using the {{WebExtAPIRef("contentScripts")}} API, you can ask the browser to load a content script whenever the browser loads a page whose URL <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Match_patterns">matches a given pattern</a>. This is just like method (1), except you can add and remove content scripts at runtime.</li> + <li><strong>at runtime, into specific tabs:</strong> using the <code><a href="/en-US/Add-ons/WebExtensions/API/Tabs/executeScript">tabs.executeScript()</a></code> API, you can load a content script into a specific tab whenever you want: for example, in response to the user clicking on a <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Browser_action">browser action</a>.</li> +</ol> + +<p>There is only one global scope per frame per extension, so variables from one content script can directly be accessed by another content script, regardless of how the content script was loaded.</p> + +<p>Using methods (1) and (2) you can only load scripts into pages whose URLs can be represented using a <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns">match pattern</a>. Using method (3), you can also load scripts into pages packaged with your extension, but you can't load scripts into privileged browser pages like "about:debugging" or "about:addons".</p> + +<h2 id="Ambiente_de_script_de_conteúdo">Ambiente de <em>script</em> de conteúdo</h2> + +<h3 id="Acesso_DOM">Acesso DOM</h3> + +<p>Content scripts can access and modify the page's DOM, just like normal page scripts can. They can also see any changes that were made to the DOM by page scripts.</p> + +<p>However, content scripts get a "clean view of the DOM". This means:</p> + +<ul> + <li>content scripts cannot see JavaScript variables defined by page scripts</li> + <li>if a page script redefines a built-in DOM property, the content script will see the original version of the property, not the redefined version.</li> +</ul> + +<p>In Firefox, this behavior is called <a href="/en-US/docs/Xray_vision">Xray vision</a>.</p> + +<p>For example, consider a web page like this:</p> + +<pre class="brush: html"><!DOCTYPE html> +<html> + <head> + <meta http-equiv="content-type" content="text/html; charset=utf-8" /> + </head> + + <body> + <script src="page-scripts/page-script.js"></script> + </body> +</html></pre> + +<p>The script "page-script.js" does this:</p> + +<pre class="brush: js">// page-script.js + +// add a new element to the DOM +var p = document.createElement("p"); +p.textContent = "This paragraph was added by a page script."; +p.setAttribute("id", "page-script-para"); +document.body.appendChild(p); + +// define a new property on the window +window.foo = "This global variable was added by a page script"; + +// redefine the built-in window.confirm() function +window.confirm = function() { + alert("The page script has also redefined 'confirm'"); +}</pre> + +<p>Now an extension injects a content script into the page:</p> + +<pre class="brush: js">// content-script.js + +// can access and modify the DOM +var pageScriptPara = document.getElementById("page-script-para"); +pageScriptPara.style.backgroundColor = "blue"; + +// can't see page-script-added properties +console.log(window.foo); // undefined + +// sees the original form of redefined properties +window.confirm("Are you sure?"); // calls the original window.confirm()</pre> + +<p>The same is true in reverse: page scripts can't see JavaScript properties added by content scripts.</p> + +<p>All this means that the content script can rely on DOM properties behaving predictably, and doesn't have to worry about variables it defines clashing with variables defined in the page script.</p> + +<p>One practical consequence of this behavior is that a content script won't have access to any JavaScript libraries loaded by the page. So for example, if the page includes jQuery, the content script won't be able to see it.</p> + +<p>If a content script does want to use a JavaScript library, then the library itself should be injected as a content script alongside the content script that wants to use it:</p> + +<pre class="brush: json">"content_scripts": [ + { + "matches": ["*://*.mozilla.org/*"], + "js": ["jquery.js", "content-script.js"] + } +]</pre> + +<p>Note that Firefox provides some APIs that enable content scripts to access JavaScript objects created by page scripts and to expose their own JavaScript objects to page scripts. See <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Sharing_objects_with_page_scripts">Sharing objects with page scripts</a> for more details.</p> + +<h3 id="APIs_da_Extensão_da_Web">APIs da Extensão da Web</h3> + +<p>In addition to the standard DOM APIs, content scripts can use the following WebExtension APIs:</p> + +<p>From <code><a href="/en-US/Add-ons/WebExtensions/API/extension">extension</a></code>:</p> + +<ul> + <li><code><a href="/en-US/Add-ons/WebExtensions/API/extension#getURL()">getURL()</a></code></li> + <li><code><a href="/en-US/Add-ons/WebExtensions/API/extension#inIncognitoContext">inIncognitoContext</a></code></li> +</ul> + +<p>From <code><a href="/en-US/Add-ons/WebExtensions/API/runtime">runtime</a></code>:</p> + +<ul> + <li><code><a href="/en-US/Add-ons/WebExtensions/API/runtime#connect()">connect()</a></code></li> + <li><code><a href="/en-US/Add-ons/WebExtensions/API/runtime#getManifest()">getManifest()</a></code></li> + <li><code><a href="/en-US/Add-ons/WebExtensions/API/runtime#getURL()">getURL()</a></code></li> + <li><code><a href="/en-US/Add-ons/WebExtensions/API/runtime#onConnect">onConnect</a></code></li> + <li><code><a href="/en-US/Add-ons/WebExtensions/API/runtime#onMessage">onMessage</a></code></li> + <li><code><a href="/en-US/Add-ons/WebExtensions/API/runtime#sendMessage()">sendMessage()</a></code></li> +</ul> + +<p>From <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/i18n">i18n</a></code>:</p> + +<ul> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/i18n/getMessage">getMessage()</a></code></li> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/i18n/getAcceptLanguages">getAcceptLanguages()</a></code></li> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/i18n/getUILanguage">getUILanguage()</a></code></li> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/i18n/detectLanguage">detectLanguage()</a></code></li> +</ul> + +<p>From <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/menus">menus</a></code>:</p> + +<ul> + <li><code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/menus/getTargetElement">getTargetElement</a></code></li> +</ul> + +<p>Everything from <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage">storage</a></code>.</p> + +<h3 id="XHR_e_Fetch">XHR e <em>Fetch</em></h3> + +<p>Content scripts can make requests using the normal <code><a href="/en-US/docs/Web/API/XMLHttpRequest">window.XMLHttpRequest</a></code> and <code><a href="/en-US/docs/Web/API/Fetch_API">window.fetch()</a></code> APIs.</p> + +<p>Content scripts get the same cross-domain privileges as the rest of the extension: so if the extension has requested cross-domain access for a domain using the <code><a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/permissions">permissions</a></code> key in manifest.json, then its content scripts get access that domain as well.</p> + +<p>This is accomplished by exposing more privileged XHR and fetch instances in the content script, which has the side-effect of not setting the <code><a href="/en-US/docs/Web/HTTP/Headers/Origin">Origin</a></code> and <code><a href="/en-US/docs/Web/HTTP/Headers/Referer">Referer</a></code> headers like a request from the page itself would, this is often preferable to prevent the request from revealing its cross-orign nature. From version 58 onwards extensions that need to perform requests that behave as if they were sent by the content itself can use <code>content.XMLHttpRequest</code> and <code>content.fetch()</code> instead. For cross-browser extensions their presence must be feature-detected.</p> + +<h2 id="Comunicar_com_scripts_de_segundo_plano">Comunicar com <em>scripts</em> de segundo plano</h2> + +<p>Although content scripts can't directly use most of the WebExtension APIs, they can communicate with the extension's background scripts using the messaging APIs, and can therefore indirectly access all the same APIs that the background scripts can.</p> + +<p>There are two basic patterns for communicating between the background scripts and content scripts: you can send one-off messages, with an optional response, or you can set up a longer-lived connection between the two sides, and use that connection to exchange messages.</p> + +<h3 id="One-off_messages">One-off messages</h3> + +<p>To send one-off messages, with an optional response, you can use the following APIs:</p> + +<table class="fullwidth-table standard-table"> + <thead> + <tr> + <th scope="row"></th> + <th scope="col">In content script</th> + <th scope="col">In background script</th> + </tr> + </thead> + <tbody> + <tr> + <th scope="row">Send a message</th> + <td><code><a href="/en-US/Add-ons/WebExtensions/API/runtime/sendMessage">browser.runtime.sendMessage()</a></code></td> + <td><code><a href="/en-US/Add-ons/WebExtensions/API/Tabs/sendMessage">browser.tabs.sendMessage()</a></code></td> + </tr> + <tr> + <th scope="row">Receive a message</th> + <td><code><a href="/en-US/Add-ons/WebExtensions/API/runtime/onMessage">browser.runtime.onMessage</a></code></td> + <td><code><a href="/en-US/Add-ons/WebExtensions/API/runtime/onMessage">browser.runtime.onMessage</a></code></td> + </tr> + </tbody> +</table> + +<p>For example, here's a content script which listens for click events in the web page. If the click was on a link, it messages the background page with the target URL:</p> + +<pre class="brush: js">// content-script.js + +window.addEventListener("click", notifyExtension); + +function notifyExtension(e) { + if (e.target.tagName != "A") { + return; + } + browser.runtime.sendMessage({"url": e.target.href}); +}</pre> + +<p>The background script listens for these messages and displays a notification using the <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/notifications">notifications</a></code> API:</p> + +<pre class="brush: js">// background-script.js + +browser.runtime.onMessage.addListener(notify); + +function notify(message) { + browser.notifications.create({ + "type": "basic", + "iconUrl": browser.extension.getURL("link.png"), + "title": "You clicked a link!", + "message": message.url + }); +} +</pre> + +<p>This example code is lightly adapted from the <a href="https://github.com/mdn/webextensions-examples/tree/master/notify-link-clicks-i18n">notify-link-clicks-i18n</a> example on GitHub.</p> + +<h3 id="Connection-based_messaging">Connection-based messaging</h3> + +<p>Sending one-off messages can get cumbersome if you are exchanging a lot of messages between a background script and a content script. So an alternative pattern is to establish a longer-lived connection between the two contexts, and use this connection to exchange messages.</p> + +<p>Each side has a <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/Port">runtime.Port</a></code> object, which they can use to exchange messages.</p> + +<p>To create the connection:</p> + +<ul> + <li>one side listens for connections using <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onConnect">runtime.onConnect</a></code></li> + <li>the other side calls either <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/connect">tabs.connect()</a></code> (if connecting to a content script) or <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/connect">runtime.connect()</a></code> (if connecting to a background script). This returns a <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/Port">runtime.Port</a></code> object.</li> + <li>the <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onConnect">runtime.onConnect</a></code> listener gets passed its own <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/Port">runtime.Port</a></code> object.</li> +</ul> + +<p>Once each side has a port, the two sides can exchange messages using <code>runtime.Port.postMessage()</code> to send a message, and <code>runtime.Port.onMessage</code> to receive messages.</p> + +<p>For example, as soon as it loads, this content script:</p> + +<ul> + <li>connects to the background script, and stores the <code>Port</code> in a variable <code>myPort</code></li> + <li>listens for messages on <code>myPort</code>, and logs them</li> + <li>sends messages to the background script, using <code>myPort</code>, when the user clicks the document</li> +</ul> + +<pre class="brush: js">// content-script.js + +var myPort = browser.runtime.connect({name:"port-from-cs"}); +myPort.postMessage({greeting: "hello from content script"}); + +myPort.onMessage.addListener(function(m) { + console.log("In content script, received message from background script: "); + console.log(m.greeting); +}); + +document.body.addEventListener("click", function() { + myPort.postMessage({greeting: "they clicked the page!"}); +});</pre> + +<p>The corresponding background script:</p> + +<ul> + <li>listens for connection attempts from the content script</li> + <li>when it receives a connection attempt: + <ul> + <li>stores the port in a variable named <code>portFromCS</code></li> + <li>sends the content script a message using the port</li> + <li>starts listening to messages received on the port, and logs them</li> + </ul> + </li> + <li>sends messages to the content script, using <code>portFromCS</code>, when the user clicks the extension's browser action</li> +</ul> + +<pre class="brush: js">// background-script.js + +var portFromCS; + +function connected(p) { + portFromCS = p; + portFromCS.postMessage({greeting: "hi there content script!"}); + portFromCS.onMessage.addListener(function(m) { + console.log("In background script, received message from content script") + console.log(m.greeting); + }); +} + +browser.runtime.onConnect.addListener(connected); + +browser.browserAction.onClicked.addListener(function() { + portFromCS.postMessage({greeting: "they clicked the button!"}); +}); +</pre> + +<h4 id="Multiple_content_scripts">Multiple content scripts</h4> + +<p>If you have multiple content scripts communicating at the same time, you might want to store each connection in an array.</p> + + + +<ul> +</ul> + +<pre class="brush: js">// background-script.js + +var ports = [] + +function connected(p) { + ports[p.sender.tab.id] = p + //... +} + +browser.runtime.onConnect.addListener(connected) + +browser.browserAction.onClicked.addListener(function() { + ports.forEach(p => { + p.postMessage({greeting: "they clicked the button!"}) + }) +});</pre> + + + +<ul> +</ul> + +<h2 id="Comunicar_com_a_página_da_Web">Comunicar com a página da Web</h2> + +<p>Although content scripts don't by default get access to objects created by page scripts, they can communicate with page scripts using the DOM <code><a href="/en-US/docs/Web/API/Window/postMessage">window.postMessage</a></code> and <code><a href="/en-US/docs/Web/API/EventTarget/addEventListener">window.addEventListener</a></code> APIs.</p> + +<p>For example:</p> + +<pre class="brush: js">// page-script.js + +var messenger = document.getElementById("from-page-script"); + +messenger.addEventListener("click", messageContentScript); + +function messageContentScript() { + window.postMessage({ + direction: "from-page-script", + message: "Message from the page" + }, "*");</pre> + +<pre class="brush: js">// content-script.js + +window.addEventListener("message", function(event) { + if (event.source == window && + event.data && + event.data.direction == "from-page-script") { + alert("Content script received message: \"" + event.data.message + "\""); + } +});</pre> + +<p>For a complete working example of this, <a href="https://mdn.github.io/webextensions-examples/content-script-page-script-messaging.html">visit the demo page on GitHub</a> and follow the instructions.</p> + +<div class="warning"> +<p>Note that any time you interact with untrusted web content on this way, you need to be very careful. Extensions are privileged code which can have powerful capabilities, and hostile web pages can easily trick them into accessing those capabilities.</p> + +<p>To make a trivial example, suppose the content script code that receives the message does something like this:</p> + +<pre class="brush: js">// content-script.js + +window.addEventListener("message", function(event) { + if (event.source == window && + event.data.direction && + event.data.direction == "from-page-script") { + eval(event.data.message); + } +});</pre> + +<p>Now the page script can run any code with all the privileges of the content script.</p> +</div> + +<h2 id="Using_eval()_in_content_scripts">Using eval() in content scripts</h2> + +<p>In Chrome, <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval">eval()</a></code> always runs code in the context of the content script, not in the context of the page.</p> + +<p>In Firefox:</p> + +<ul> + <li>if you call <code>eval()</code>, it runs code in the context of the content script</li> + <li>if you call <code>window.eval()</code>, it runs code in the context of the page.</li> +</ul> + +<p>For example, consider a content script like this:</p> + +<pre class="brush: js">// content-script.js + +window.eval('window.x = 1;'); +eval('window.y = 2'); + +console.log(`In content script, window.x: ${window.x}`); +console.log(`In content script, window.y: ${window.y}`); + +window.postMessage({ + message: "check" +}, "*");</pre> + +<p>This code just creates some variables x and y using <code>window.eval()</code> and <code>eval()</code>, then logs their values, then messages the page.</p> + +<p>On receiving the message, the page script logs the same variables:</p> + +<pre class="brush: js">window.addEventListener("message", function(event) { + if (event.source === window && event.data && event.data.message === "check") { + console.log(`In page script, window.x: ${window.x}`); + console.log(`In page script, window.y: ${window.y}`); + } +});</pre> + +<p>In Chrome, this will produce output like this:</p> + +<pre>In content script, window.x: 1 +In content script, window.y: 2 +In page script, window.x: undefined +In page script, window.y: undefined</pre> + +<p>In Firefox the following output is produced:</p> + +<pre>In content script, window.x: undefined +In content script, window.y: 2 +In page script, window.x: 1 +In page script, window.y: undefined</pre> + +<p>The same applies to <code><a href="/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout">setTimeout()</a></code>, <code><a href="/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval">setInterval()</a></code>, and <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function()</a></code>.</p> + +<p>When running code in the context of the page, be very careful. The page's environment is controlled by potentially malicious web pages, which can redefine objects you interact with to behave in unexpected ways:</p> + +<pre class="brush: js">// page.js redefines console.log + +var original = console.log; + +console.log = function() { + original(true); +} +</pre> + +<pre class="brush: js">// content-script.js calls the redefined version + +window.eval('console.log(false)'); +</pre> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/suporte_navegador_apis_javascript/index.html b/files/pt-pt/mozilla/add-ons/webextensions/suporte_navegador_apis_javascript/index.html new file mode 100644 index 0000000000..e34a4013d3 --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/suporte_navegador_apis_javascript/index.html @@ -0,0 +1,19 @@ +--- +title: Suporte de navegador para as APIs de JavaScript +slug: Mozilla/Add-ons/WebExtensions/Suporte_navegador_APIs_JavaScript +tags: + - Extensões da Web +translation_of: Mozilla/Add-ons/WebExtensions/Browser_support_for_JavaScript_APIs +--- +<p>{{AddonSidebar}}</p> + +<div>{{WebExtAllCompatTables}}</div> + +<div>A tabela de compatibilidade nesta página é gerada a partir de dados estruturados. Se quiser contribuir para os dados, verifique por favor, consulte https://github.com/mdn/browser-compat-data e envie-nos um pedido de submissão.</div> + +<div> </div> + +<div class="note"><strong>Agradecimentos</strong> + +<p>Os dados de compatibilidade do Microsoft Edge são fornecidos pela Corporação Microsoft e estão incluídos aqui sob a Licença de Creative Commons Attribution 3.0 - Estado Unidos.</p> +</div> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/tips/index.html b/files/pt-pt/mozilla/add-ons/webextensions/tips/index.html new file mode 100644 index 0000000000..dd02a81c1d --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/tips/index.html @@ -0,0 +1,50 @@ +--- +title: Tips and Tricks +slug: Mozilla/Add-ons/WebExtensions/Tips +translation_of: Mozilla/Add-ons/WebExtensions/Tips +--- +<p>{{AddonSidebar}}</p> + +<p>Esta paginas contêm varias dicas e truques que deve ser útil para muitas pessoas devenvolvendo extensões usando WebExtension APIs.</p> + +<h2 id="Usando_recursos_avancados_do_ECMAScript_2015_e_2016.">Usando recursos avancados do ECMAScript 2015 e 2016.</h2> + +<p>Firefox <a href="/Web/JavaScript/New_in_JavaScript/ECMAScript_6_support_in_Mozilla">suporta muitos recursos do ECMAScript 2015</a> fora da box. Diversas novidades e recursos experimental, contanto entretanto, não estão disponiveis por padrão para a Web ou WebExtensions. Se você quer usar esses recursos, é melhor transpilar seu codigo usando uma ferramenta como o <a href="https://babeljs.io/">Babel</a>.</p> + +<p>Cuidado que qualquer coisa abalixo desta linha é informação desatualizada e tem sido removida do Babel 6.</p> + +<p>Babel fornece transformações para a grande maioria dos recursos do ES2015, e os habilita por padrão. Uma vez que o Firefox já suporta totalmente a maiorias dessas, é melhor configurar Babel para ignorar-lá. Nós sugerimos criando um arquivo <code>.babelrc</code>, ou uma seção <code>babel</code> em seu arquivo de projeto <code>package.json</code> contendo o seguinte:</p> + +<pre class="brush: js">{ + "env": { + "firefox": { + "sourceMaps": "inline", + "blacklist": [ + "es5.properties.mutators", + "es6.arrowFunctions", + "es6.destructuring", + "es6.forOf", + "es6.parameters", + "es6.properties.computed", + "es6.properties.shorthand", + "es6.spec.symbols", + "es6.spread", + "es6.tailCall", + "es6.templateLiterals", + "es6.regex.sticky", + "es6.regex.unicode" + ] + } + } +} +</pre> + +<p>Então, para compilar um script individual simplesmente, execute:</p> + +<pre class="brush: sh">BABEL_ENV=firefox babel <filename> +</pre> + +<p>Ou, para compilar cada arquivo JavaScript dentro do diretório <code>src</code> e colocar os arquivos compilados em <code>compiled</code>, copiando arquivos não-JavaScript no processo, executadno:</p> + +<pre class="brush: sh">BABEL_ENV=firefox babel -Dd compiled src +</pre> diff --git a/files/pt-pt/mozilla/add-ons/webextensions/trasnsferir_extensao_google_chrome/index.html b/files/pt-pt/mozilla/add-ons/webextensions/trasnsferir_extensao_google_chrome/index.html new file mode 100644 index 0000000000..006ecce85c --- /dev/null +++ b/files/pt-pt/mozilla/add-ons/webextensions/trasnsferir_extensao_google_chrome/index.html @@ -0,0 +1,22 @@ +--- +title: Conversão de uma extensão do Google Chrome +slug: Mozilla/Add-ons/WebExtensions/Trasnsferir_extensao_Google_Chrome +tags: + - Extensões da Web +translation_of: Mozilla/Add-ons/WebExtensions/Porting_a_Google_Chrome_extension +--- +<div>{{AddonSidebar}}</div> + +<p>As extensões desenvolvidas com as APIs de Extensão da Web são preparadas para compatibilidade entre navegadores: em grande medida, a tecnologia é diretamente compatível com a <a class="external-icon external" href="https://developer.chrome.com/extensions">API de extensão</a> suportada pelo Google Chrome e Opera. As extensões escritas para estes navegadores irão, na maioria do casos, ser executadas no Firefox com apenas algumas alterações. Quase todas das <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API">APIs de extensão </a>são suportadas, utilizando as funções de chamada sob o espaço de nome <code>chrome</code>, o mesmo que Chrome. As únicas APIs que não são suportadas no nome de espaço <code>chrome</code> são aquelas que são intentionalmente incompatíveis com o Chrome. Nesses casos, a página da documentação de API irá declarar explicitamente que só é suportado no espaço do nome <code>browser</code> . O processo de transferir uma extensão do Chrome para Opera é como isto:</p> + +<ol> + <li>Reveja a sua utilização das funcionaldiades de manifest.json e APIs da Extensão da Web contra a <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities">referência de incompatibilidade do Chrome</a>. Se estiver a utilizar as funcionalidades ou APIs que ainda não são suportadas no Firefox, poderá não conseguir converter ainda a sua extensão. A Mozilla fornece um serviço que pode ajudar a automatizar este passo: <a href="https://www.extensiontest.com">Teste de Compatibilidade de Extensão para Firefox</a> (inglês).</li> + <li><a href="https://developer.mozilla.org/pt-PT/docs/Mozilla/Add-ons/WebExtensions/Instalacao_temporaria_no_Firefox">Instale a sua extensão no Firefox</a> e teste-a.</li> + <li>Se tiver quaisquer problemas, contacte-nos em <a href="https://mail.mozilla.org/listinfo/dev-addons">lista de endereços</a> ou <a href="irc://irc.mozilla.org/webextensions">#webextensions</a> no <a class="external external-icon" href="https://wiki.mozilla.org/IRC">IRC</a>.</li> + <li>Submeta o seu extra em <a href="https://developer.mozilla.org/pt-PT/docs/Mozilla/Add-ons/WebExtensions/Publicar_a_sua_extensao">AMO para assinar e distribuir</a>. </li> +</ol> + +<p>Se estava dependente da opção da linha de comando do Chrome para carregar uma extensão descompactada, consulte a ferramenta <a href="https://developer.mozilla.org/pt-PT/docs/Mozilla/Add-ons/WebExtensions/Primeiros_passos_com_web-ext">web-ext</a> que automatiza a instalação temporária no Firefox para desenvolvimento.</p> + +<ul> +</ul> diff --git a/files/pt-pt/mozilla/calendar/calendar_versions/index.html b/files/pt-pt/mozilla/calendar/calendar_versions/index.html new file mode 100644 index 0000000000..7e8c1a7958 --- /dev/null +++ b/files/pt-pt/mozilla/calendar/calendar_versions/index.html @@ -0,0 +1,1037 @@ +--- +title: Versões de Calendário +slug: Mozilla/Calendar/Calendar_Versions +tags: + - Calendário + - Lightning + - Sunbird +translation_of: Mozilla/Calendar/Calendar_Versions +--- +<p>Esta página tem como objetivo fornecer um resumo de qual a versão do Lightning que é compatível com a versão do Thunderbird. Esta também mostra qual a versão da plataforma Mozilla que é utilizada na respetiva versão do Sunbird e do Lightning.</p> + +<p>O objetivo principal da 'Equipa do Calendário' é sincronizar o ciclo de lançamento do Lightning com o Thunderbird. Isto geralmente significa que nós iremos utilizar o código base mais recente do Thunderbird e da Mozilla (comm-central e mozilla-central) para o desenvolvimento ativo. Se o agendamento do Thunderbird ainda não estiver clara, nós retrocederemos as alterações para uma ramificação mais antiga.</p> + +<p>Nota: se estiver a ter problemas e o calendário está em falta, primeiro consulte <a href="https://support.mozilla.org/en-US/kb/calendar-updates-issues-thunderbird">calendar update issues</a>, porque depois do Thunderbird 52 Lightning está integrado (empacotado com o Thunderbird) e não deveria de ter que transferir a extensão. Mas se estiver a executar o Thunderbird - versão 45 ou anterior, utilize a hiperligação de transferência abaixo..</p> + +<h2 id="Lightning">Lightning</h2> + +<h3 id="Resumo_de_Desenvolvimento">Resumo de Desenvolvimento</h3> + +<div class="warning"> +<p>As compilações do Lightning listadas abaixo devem ser consideradas instáveis e estão disponíveis apenas para fins de desenvolvimento e testes.</p> +</div> + +<table class="standard-table" style="height: 182px; width: 1456px;"> + <thead> + <tr> + <th>Lightning<br> + Versão</th> + <th>Thunderbird<br> + Versão</th> + <th>SeaMonkey<br> + Versão</th> + <th> + <p>Plataforma Mozilla<br> + Versão</p> + </th> + <th>Build Name</th> + <th>Changelog</th> + </tr> + </thead> + <tbody> + <tr> + <td style="white-space: nowrap;">6.8a1</td> + <td style="white-space: nowrap;"><a href="https://ftp.mozilla.org/pub/mozilla.org/thunderbird/nightly/latest-comm-central/">66.0a1</a><br> + "Daily"</td> + <td style="white-space: nowrap;">2.63a1</td> + <td style="white-space: nowrap;">mozilla66</td> + <td style="white-space: nowrap;">"nightly"<br> + (comm-central)</td> + <td style="white-space: nowrap;"><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=6.8">changes in 6.8</a></td> + </tr> + <tr> + <td style="white-space: nowrap;">6.7b1</td> + <td style="white-space: nowrap;"><a href="https://www.mozilla.org/en-US/thunderbird/all-beta.html">65.0b1</a><br> + "Beta"</td> + <td style="white-space: nowrap;">2.62b1</td> + <td style="white-space: nowrap;">mozilla65</td> + <td style="white-space: nowrap;">"beta"<br> + (comm-beta)</td> + <td style="white-space: nowrap;"><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=6.7">changes in 6.7</a></td> + </tr> + </tbody> +</table> + +<h3 id="Lançamentos_Estáveis">Lançamentos Estáveis</h3> + +<p>The Lightning releases listed below are considered stable and are recommend for daily usage. </p> + +<p>If you are having trouble and calendar is missing, first see <a href="https://support.mozilla.org/en-US/kb/calendar-updates-issues-thunderbird">calendar update issues</a>, because after Thunderbird 52 Lightning is built-in (bundled with Thunderbird) and you should not need to download the extension. </p> + +<table class="standard-table"> + <thead> + <tr> + <th>Lightning<br> + Versão</th> + <th>Thunderbird<br> + Versão</th> + <th>SeaMonkey<br> + Versão</th> + <th>Plataforma Mozilla<br> + Versão</th> + <th>Data de Lançamento</th> + <th>Registo de Alterações</th> + </tr> + </thead> + <tbody> + <tr> + <td>6.7b1 (Beta)</td> + <td>65.0 (Beta)</td> + <td>2.62</td> + <td>mozilla65</td> + <td> </td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=6.7">changes in 6.7</a></td> + </tr> + <tr> + <td>6.6b4 (Beta)</td> + <td>64.0 (Beta)</td> + <td>2.61</td> + <td>mozilla64</td> + <td>December 2, 2018</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=6.6">changes in 6.6</a></td> + </tr> + <tr> + <td>6.5b1 (Beta)</td> + <td>63.0 (Beta)</td> + <td>2.60</td> + <td>mozilla63</td> + <td>October 11, 2018</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=6.5">changes in 6.5</a></td> + </tr> + <tr> + <td>6.4b1 (Beta)</td> + <td>62.0 (Beta)</td> + <td>2.59</td> + <td>mozilla62</td> + <td>---</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=6.4">changes in 6.4</a></td> + </tr> + <tr> + <td>6.3b1 (Beta)</td> + <td>61.0 (Beta)</td> + <td>2.58</td> + <td>mozilla61</td> + <td>---</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=6.3">changes in 6.3</a></td> + </tr> + <tr> + <td>6.2.3.3</td> + <td>60.3.3</td> + <td>2.57</td> + <td>mozilla60</td> + <td>December 5, 2018</td> + <td> </td> + </tr> + <tr> + <td>6.2.3.2</td> + <td>60.3.2</td> + <td>2.57</td> + <td>mozilla60</td> + <td>November 30, 2018</td> + <td> </td> + </tr> + <tr> + <td>6.2.3.1</td> + <td>60.3.1</td> + <td>2.57</td> + <td>mozilla60</td> + <td>November 15, 2018</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=6.2.3">changes in 6.2.3</a> / <a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=6.2.3.1">changes in 6.2.3.1</a></td> + </tr> + <tr> + <td>6.2.2.1</td> + <td>60.2.1</td> + <td>2.57</td> + <td>mozilla60</td> + <td>October 2, 2018</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=6.2.2.1">changes in 6.2.2.1</a></td> + </tr> + <tr> + <td>6.2</td> + <td>60.0</td> + <td>2.57</td> + <td>mozilla60</td> + <td>August 6, 2018</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=6.2">changes in 6.2</a></td> + </tr> + <tr> + <td>6.1b2 (Beta)</td> + <td>59.0 (Beta)</td> + <td>2.56</td> + <td>mozilla59</td> + <td>---</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=6.1">changes in 6.1</a></td> + </tr> + <tr> + <td>6.0b3 (Beta)</td> + <td>58.0 (Beta)</td> + <td>2.55</td> + <td>mozilla58</td> + <td>---</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=6.0">changes in 6.0</a></td> + </tr> + <tr> + <td>5.9b2 (Beta)</td> + <td>57.0 (Beta)</td> + <td>2.54</td> + <td>mozilla57</td> + <td>---</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=5.9">changes in 5.9</a></td> + </tr> + <tr> + <td>5.8b4 (Beta)</td> + <td>56.0 (Beta)</td> + <td>2.53</td> + <td>mozilla56</td> + <td>---</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=5.8">changes in 5.8</a></td> + </tr> + <tr> + <td>5.7b2 (Beta)</td> + <td>55.0 (Beta)</td> + <td>2.52</td> + <td>mozilla55</td> + <td>---</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=5.7">changes in 5.7</a></td> + </tr> + <tr> + <td>5.6b3 (Beta)</td> + <td>54.0 (Beta)</td> + <td>2.51</td> + <td>mozilla54</td> + <td>---</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=5.6">changes in 5.6</a></td> + </tr> + <tr> + <td>5.5b2 (Beta)</td> + <td>53.0 (Beta)</td> + <td>2.50</td> + <td>mozilla53</td> + <td>October 10, 2017</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=5.5">changes in 5.5</a></td> + </tr> + <tr> + <td>5.4.9.1</td> + <td>52.9.1</td> + <td>---</td> + <td>mozilla52</td> + <td>July 10, 2018</td> + <td>---</td> + </tr> + <tr> + <td>5.4.8</td> + <td>52.8.0</td> + <td>---</td> + <td>mozilla52</td> + <td>May 18, 2018</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=5.4.8">changes in 5.4.8</a></td> + </tr> + <tr> + <td>5.4.7</td> + <td>52.7.0</td> + <td>---</td> + <td>mozilla52</td> + <td>March 23, 2018</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=5.4.7">changes in 5.4.7</a></td> + </tr> + <tr> + <td>5.4.6</td> + <td>52.6.0</td> + <td>---</td> + <td>mozilla52</td> + <td>January 25, 2018</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=5.4.6">changes in 5.4.6</a></td> + </tr> + <tr> + <td>5.4.5.2</td> + <td>52.5.2</td> + <td>---</td> + <td>mozilla52</td> + <td>December 22, 2017</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=5.4.5">changes in 5.4.5</a></td> + </tr> + <tr> + <td>5.4.4</td> + <td>52.4.0</td> + <td>---</td> + <td>mozilla52</td> + <td>October 6, 2017</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=5.4.4">changes in 5.4.4</a></td> + </tr> + <tr> + <td>5.4.3</td> + <td>52.3.0</td> + <td>---</td> + <td>mozilla52</td> + <td>August 16, 2017</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=5.4.3">changes in 5.4.3</a></td> + </tr> + <tr> + <td>5.4.2.1</td> + <td>52.2.1</td> + <td>----</td> + <td>mozilla52</td> + <td>June 23, 2017</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=5.4.2">changes in 5.4.2</a> / <a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=5.4.2.1">changes in 5.4.2.1</a></td> + </tr> + <tr> + <td>5.4.1.1</td> + <td>52.1.1</td> + <td>---</td> + <td>mozilla52</td> + <td>May 15, 2017</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=5.4.1">changes in 5.4.1</a> / <a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=5.4.1.1">changes in 5.4.1.1</a></td> + </tr> + <tr> + <td>5.4.0.1</td> + <td>52.0.1</td> + <td>---</td> + <td>mozilla52</td> + <td>April 14, 2017</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=5.4.0.1">changes in 5.4.0.1</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/5.4">5.4</a></td> + <td>52.0</td> + <td>2.49</td> + <td>mozilla52</td> + <td>April 4, 2017</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=5.4">changes in 5.4</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/5.3b2">5.3b2</a> (Beta)</td> + <td>51.0 (Beta)</td> + <td>2.48</td> + <td>mozilla51</td> + <td>March 19, 2017</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=5.3">changes in 5.3</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/5.2b1">5.2b1</a> (Beta)</td> + <td>50.0 (Beta)</td> + <td>2.47</td> + <td>mozilla50</td> + <td>October 16, 2016</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=5.2">changes in 5.2</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/5.1b1">5.1b1</a> (Beta)</td> + <td>49.0 (Beta)</td> + <td>2.46</td> + <td>mozilla49</td> + <td>October 16, 2016</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=5.1">changes in 5.1</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/5.0b1">5.0b1</a> (Beta)</td> + <td>48.0 (Beta)</td> + <td>2.45</td> + <td>mozilla48</td> + <td>October 16, 2016</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=5.0">changes in 5.0</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/4.9b2">4.9b2</a> (Beta)</td> + <td>47.0 (Beta)</td> + <td>2.44</td> + <td>mozilla47</td> + <td>July 1, 2016</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=4.9">changes in 4.9</a></td> + </tr> + <tr> + <td>4.8b1 (Beta)</td> + <td>46.0 (Beta)</td> + <td>2.43</td> + <td>mozilla46</td> + <td>---</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=4.8">changes in 4.8</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/4.7.8">4.7.8</a></td> + <td>45.8.0</td> + <td>2.42</td> + <td>mozilla45</td> + <td>March, 7 2017</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=4.7.8">changes in 4.7.8</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/4.7.7">4.7.7.1</a></td> + <td>45.7.1</td> + <td>2.42</td> + <td>mozilla45</td> + <td>February 7, 2017</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=4.7.7">changes in 4.7.7</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/4.7.6">4.7.6</a></td> + <td>45.6.0</td> + <td>2.42</td> + <td>mozilla45</td> + <td>December 28, 2016</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=4.7.6">changes in 4.7.6</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/4.7.5">4.7.5.1</a></td> + <td>45.5.1</td> + <td>2.42</td> + <td>mozilla45</td> + <td>November 30, 2016</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=4.7.5">changes in 4.7.5</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/4.7.4">4.7.4</a></td> + <td>45.4.0</td> + <td>2.42</td> + <td>mozilla45</td> + <td>October 3, 2016</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=4.7.4">changes in 4.7.4</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/4.7.3">4.7.3</a></td> + <td>45.3.0</td> + <td>2.42</td> + <td>mozilla45</td> + <td>August 30, 2016</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=4.7.3">changes in 4.7.3</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/4.7.2">4.7.2</a></td> + <td>45.2.0</td> + <td>2.42</td> + <td>mozilla45</td> + <td>June 30, 2016</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=4.7.2">changes in 4.7.2</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/4.7.1">4.7.1.1</a></td> + <td>45.1.1</td> + <td>2.42</td> + <td>mozilla45</td> + <td>May 31, 2016</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=4.7.1.1">changes in 4.7.1.1</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/4.7">4.7</a></td> + <td>45.0</td> + <td>2.42</td> + <td>mozilla45</td> + <td>April 25, 2016</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=4.7">changes in 4.7</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/4.6b1">4.6b1</a> (Beta)</td> + <td>44.0 (Beta)</td> + <td>2.41</td> + <td>mozilla44</td> + <td>January 21, 2016</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=4.6">changes in 4.6</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/4.5b1">4.5b1</a> (Beta)</td> + <td>43.0 (Beta)</td> + <td>2.40</td> + <td>mozilla43</td> + <td>January 8, 2016</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=4.5">changes in 4.5</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/4.4b2">4.4b2</a> (Beta)</td> + <td>42.0 (Beta)</td> + <td>2.39</td> + <td>mozilla42</td> + <td>October 14, 2015</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=4.4">changes in 4.4</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/4.3b2">4.3b2</a> (Beta)</td> + <td>41.0 (Beta)</td> + <td>2.38</td> + <td>mozilla41</td> + <td>September 16, 2015</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=4.3">changes in 4.3</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/4.2b1">4.2b1</a> (Beta)</td> + <td>40.0 (Beta)</td> + <td>2.37</td> + <td>mozilla40</td> + <td>July 30, 2015</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=4.2">changes in 4.2</a></td> + </tr> + <tr> + <td>4.1b1 (Beta)</td> + <td>39.0 (Beta)</td> + <td>2.36</td> + <td>mozilla39</td> + <td>---</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=4.1">changes in 4.1</a></td> + </tr> + <tr> + <td>4.0.7.2</td> + <td>38.7.2</td> + <td>---</td> + <td>mozilla38</td> + <td>April 4, 2016</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=4.0.7">changes in 4.0.7</a> / <a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=4.0.7.1">changes in 4.0.7.1</a></td> + </tr> + <tr> + <td>4.0.6</td> + <td>38.6.0</td> + <td>---</td> + <td>mozilla38</td> + <td>February 16, 2016</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=4.0.6">changes in 4.0.6</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/4.0.5.2">4.0.5.2</a></td> + <td>38.5.1</td> + <td>2.35</td> + <td>mozilla38</td> + <td>January 21, 2016</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=4.0.5">changes in 4.0.5</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/4.0.4.1">4.0.4.1</a></td> + <td>38.4.0</td> + <td>2.35</td> + <td>mozilla38</td> + <td>November 30, 2015</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=4.0.4">changes in 4.0.4</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/4.0.3.1">4.0.3.1</a></td> + <td>38.3.0</td> + <td>2.35</td> + <td>mozilla38</td> + <td>October 8, 2015</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&product=Calendar&target_milestone=4.0.3">changes in 4.0.3</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/4.0.2.1">4.0.2.1</a></td> + <td>38.2.0</td> + <td>2.35</td> + <td>mozilla38</td> + <td>September 16, 2015</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:4.0.2.1">changes in 4.0.2.1</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/4.0.2">4.0.2</a></td> + <td>38.2.0</td> + <td>2.35</td> + <td>mozilla38</td> + <td>August 14, 2015</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:4.0.2">changes in 4.0.2</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/4.0.1.2">4.0.1.2</a></td> + <td>38.1.0</td> + <td>2.35</td> + <td>mozilla38</td> + <td>July 23, 2015</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:4.0.1.2">changes in 4.0.1.2</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/4.0.1">4.0.1</a></td> + <td>38.1.0</td> + <td>2.35</td> + <td>mozilla38</td> + <td>July 8, 2015</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:4.0.1">changes in 4.0.1</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/4.0.0.1">4.0.0.1</a></td> + <td>38.0.1</td> + <td>2.35</td> + <td>mozilla38</td> + <td>June 12, 2015</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:4.0.0.1">changes in 4.0.0.1</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/3.9b1">3.9b1</a> (Beta)</td> + <td>37.0 (Beta)</td> + <td>2.34</td> + <td>mozilla37</td> + <td>March 14, 2015</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:3.9">changes in 3.9</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/3.8b2">3.8b2</a> (Beta)</td> + <td>36.0 (Beta)</td> + <td>2.33</td> + <td>mozilla36</td> + <td>March 12, 2015</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:3.8">changes in 3.8</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/3.7b1">3.7b1</a> (en-US only)</td> + <td>---</td> + <td>2.32</td> + <td>mozilla35</td> + <td>January 28, 2015</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:3.7">changes in 3.7</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/3.6b3">3.6b3</a> (Beta)</td> + <td>34.0 (Beta)</td> + <td>2.31</td> + <td>mozilla34</td> + <td>December 17, 2014</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:3.6">changes in 3.6</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/3.5b1">3.5b1</a> (Beta)</td> + <td>33.0 (Beta)</td> + <td>2.30</td> + <td>mozilla33</td> + <td>September 23, 2014</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:3.5">changes in 3.5</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/3.4b1">3.4b1</a> (Beta)</td> + <td>32.0 (Beta)</td> + <td>2.29</td> + <td>mozilla32</td> + <td>August 18, 2014</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:3.4">changes in 3.4</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/3.3.3">3.3.3</a></td> + <td>31.0</td> + <td>2.28</td> + <td>mozilla31</td> + <td>January 28, 2015</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:3.3.3">changes in 3.3.3</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/3.3.2">3.3.2</a></td> + <td>31.0</td> + <td>2.28</td> + <td>mozilla31</td> + <td>December 27, 2014</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:3.3.2">changes in 3.3.2</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/3.3.1">3.3.1</a></td> + <td>31.0</td> + <td>2.28</td> + <td>mozilla31</td> + <td>September 23, 2014</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:3.3.1">changes in 3.3.1</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/3.3">3.3</a></td> + <td>31.0</td> + <td>2.28</td> + <td>mozilla31</td> + <td>July 21, 2014</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:3.3">changes in 3.3</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/3.2b1">3.2b1</a></td> + <td>30.0 (Beta)</td> + <td>2.27</td> + <td>mozilla30</td> + <td>May 9, 2014</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:3.2">changes in 3.2</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/3.1b1">3.1b1</a></td> + <td>29.0 (Beta)</td> + <td>2.26</td> + <td>mozilla29</td> + <td>April 24, 2014</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:3.1">changes in 3.1</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/3.0b1">3.0b1</a></td> + <td>28.0 (Beta)</td> + <td>2.25</td> + <td>mozilla28</td> + <td>March 6, 2014</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:3.0">changes in 3.0</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/2.9b1">2.9b1</a></td> + <td>27.0 (Beta)</td> + <td>2.24</td> + <td>mozilla27</td> + <td>December 19, 2013</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:2.9">changes in 2.9</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/2.8b1">2.8b1</a></td> + <td>26.0 (Beta)</td> + <td>2.23</td> + <td>mozilla26</td> + <td>November 15, 2013</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:2.8">changes in 2.8</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/2.7b1">2.7b1</a></td> + <td>25.0 (Beta)</td> + <td>2.22</td> + <td>mozilla25</td> + <td>October 17, 2013</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:2.7">changes in 2.7</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/2.6.6">2.6.6</a></td> + <td>24.5.0</td> + <td>---</td> + <td>mozilla24.5</td> + <td>June 19, 2014</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:2.6.6">changes in 2.6.6</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/2.6.5">2.6.5</a></td> + <td>24.5.0</td> + <td>---</td> + <td>mozilla24.5</td> + <td>May 13, 2014</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:2.6.5">changes in 2.6.5</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/2.6.4">2.6.4</a></td> + <td>24.2.0</td> + <td>---</td> + <td>mozilla24.2</td> + <td>December 11, 2013</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:2.6.4">changes in 2.6.4</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/2.6.3">2.6.3</a></td> + <td>24.1.1</td> + <td>---</td> + <td>mozilla24.1.1</td> + <td>November 19, 2013</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:2.6.3">changes in 2.6.3</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/2.6.2">2.6.2</a></td> + <td>24.1.0</td> + <td>---</td> + <td>mozilla24.1</td> + <td>October 29, 2013</td> + <td>---</td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/2.6.1">2.6.1</a></td> + <td>24.0.1</td> + <td>---</td> + <td>mozilla24.0.1</td> + <td>October 13, 2013</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:2.6.1">changes in 2.6.1</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/2.6" title="https://addons.mozilla.org/thunderbird/addon/lightning/versions/2.6">2.6</a></td> + <td>24.0</td> + <td>2.21</td> + <td>mozilla24</td> + <td>September 11, 2013</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:2.6">changes in 2.6</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/en-US/thunderbird/addon/lightning/versions/2.5b2" title="https://addons.mozilla.org/en-US/thunderbird/addon/lightning/versions/2.5b2">2.5b2</a></td> + <td>---</td> + <td>2.20</td> + <td>mozilla23</td> + <td>July 8, 2013</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:2.5" title="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:2.5">changes in 2.5</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/en-US/thunderbird/addon/lightning/versions/2.4b1" title="https://addons.mozilla.org/en-US/thunderbird/addon/lightning/#beta-channel">2.4b1</a></td> + <td>---</td> + <td>2.19</td> + <td>mozilla22</td> + <td>May 24, 2013</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:2.4" title="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:2.4">changes in 2.4</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/en-US/thunderbird/addon/lightning/versions/2.3b2" title="https://addons.mozilla.org/en-US/thunderbird/addon/lightning/versions/2.3b2">2.3b2</a></td> + <td>---</td> + <td>2.18</td> + <td>mozilla21</td> + <td>May 8, 2013</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:2.3" title="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:2.3">changes in 2.3</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/en-US/thunderbird/addon/lightning/versions/2.2b1" title="https://addons.mozilla.org/en-US/thunderbird/addon/lightning/versions/2.2b1">2.2b1</a></td> + <td>---</td> + <td>2.17</td> + <td>mozilla20</td> + <td>March 6, 2013</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:2.2+-milestone:1.2.2" title="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:2.2+-milestone:1.2.2">changes in 2.2</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/en-US/thunderbird/addon/lightning/versions/2.1b1" title="https://addons.mozilla.org/en-US/thunderbird/addon/lightning/versions/2.1b1">2.1b1</a></td> + <td>---</td> + <td>2.16</td> + <td>mozilla19</td> + <td>February 12, 2013</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:2.1+-milestone:1.2.1" title="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:2.1+-milestone:1.2.1">changes in 2.1</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/en-US/thunderbird/addon/lightning/versions/2.0b1" title="https://addons.mozilla.org/en-US/thunderbird/addon/lightning/versions/2.0b1">2.0b1</a></td> + <td>---</td> + <td>2.15</td> + <td>mozilla18</td> + <td>November 29, 2012</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:2.0+-milestone:1.2.0" title="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+resolution:FIXED+milestone:2.0+-milestone:1.2.0">changes in 2.0</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.9.1" title="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.9.1">1.9.1</a></td> + <td>17.0</td> + <td>2.14</td> + <td>mozilla17</td> + <td>March 6, 2013</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+milestone:1.9.1+resolution:FIXED" title="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+milestone:1.9.1+resolution:FIXED">changes in 1.9.1</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.9" title="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.9">1.9</a></td> + <td>17.0</td> + <td>2.14</td> + <td>mozilla17</td> + <td>November 20, 2012</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+milestone:1.9+-milestone:1.9.1+resolution:FIXED" title="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+milestone:1.9+-milestone:1.9.1+resolution:FIXED">changes in 1.9</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.8" title="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.8">1.8</a></td> + <td>16.0</td> + <td>2.13</td> + <td>mozilla16</td> + <td>October 09, 2012</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+milestone:1.8+resolution:FIXED" title="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+milestone:1.8+resolution:FIXED">changes in 1.8</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.7" title="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.7">1.7</a></td> + <td>15.0</td> + <td>2.12</td> + <td>mozilla15</td> + <td>August 28, 2012</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+milestone:1.7+resolution:FIXED" title="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+milestone:1.7+resolution:FIXED">changes in 1.7</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.6" title="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.6">1.6</a></td> + <td>14.0</td> + <td>2.11</td> + <td>mozilla14</td> + <td>July 17, 2012</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+milestone:1.6+resolution:FIXED" title="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+milestone:1.6+resolution:FIXED">changes in 1.6</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.5.2" title="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.5.2">1.5.2</a></td> + <td>13.0</td> + <td>2.10</td> + <td>mozilla13</td> + <td>June 21, 2012</td> + <td>---</td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.5.1" title="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.5.1">1.5.1</a></td> + <td>13.0</td> + <td>2.10</td> + <td>mozilla13</td> + <td>June 14, 2012</td> + <td>---</td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.5" title="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.5">1.5</a></td> + <td>13.0</td> + <td>2.10</td> + <td>mozilla13</td> + <td>June 4, 2012</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+milestone:1.5+resolution:FIXED" title="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+milestone:1.5+resolution:FIXED">changes in 1.5</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.4" title="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.4">1.4</a></td> + <td>12.0</td> + <td>2.9</td> + <td>mozilla12</td> + <td>April 23, 2012</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+milestone:1.4+resolution:FIXED" title="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+milestone:1.4+resolution:FIXED">changes in 1.4</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.3" title="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.3">1.3</a></td> + <td>11.0</td> + <td>2.8</td> + <td>mozilla11</td> + <td>March 13, 2012</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+milestone:1.3+resolution:FIXED" title="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+milestone:1.3+resolution:FIXED">changes in 1.3</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.2.3" title="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.2.3">1.2.3</a></td> + <td>10.0</td> + <td>2.7</td> + <td>mozilla10</td> + <td>March 9, 2012</td> + <td>---</td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.2.1" title="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.2.1">1.2.1</a></td> + <td>10.0</td> + <td>2.7</td> + <td>mozilla10</td> + <td>February 3, 2012</td> + <td>---</td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.2" title="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.2">1.2</a></td> + <td>10.0</td> + <td>2.7</td> + <td>mozilla10</td> + <td>January 23, 2012</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+milestone:1.2+resolution:FIXED" title="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+milestone:1.2+resolution:FIXED">changes in 1.2</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.1.1" title="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.1.1">1.1.1</a></td> + <td>9.0</td> + <td>2.6</td> + <td>mozilla9</td> + <td>January 5, 2012</td> + <td><a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+milestone:1.1+resolution:FIXED" title="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=ALL+:calendar+milestone:1.1+resolution:FIXED">changes in 1.1</a></td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.0" title="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.0">1.0</a></td> + <td>8.0</td> + <td>2.5</td> + <td>mozilla8</td> + <td>November 7, 2011</td> + <td> </td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.0b7" title="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.0b7">1.0b7</a></td> + <td>7.0</td> + <td>2.4</td> + <td>mozilla7</td> + <td>September 27, 2011</td> + <td> </td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.0b5" title="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.0b5">1.0b5</a></td> + <td>6.0</td> + <td>2.3</td> + <td>mozilla6</td> + <td>July 29, 2011</td> + <td> </td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.0b4" title="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.0b4">1.0b4</a></td> + <td>5.0</td> + <td>2.2</td> + <td>mozilla5</td> + <td>June 28, 2011</td> + <td> </td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.0b2" title="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.0b2">1.0b2</a></td> + <td>3.1.*</td> + <td>---</td> + <td>mozilla-1.9.2</td> + <td>June 24, 2010</td> + <td> </td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.0b1" title="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.0b1">1.0b1</a></td> + <td>3.0.*</td> + <td>2.0</td> + <td>mozilla-1.9.1</td> + <td>January 12, 2010</td> + <td> </td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/0.9" title="https://addons.mozilla.org/thunderbird/addon/lightning/versions/0.9">0.9</a></td> + <td>2.0.0.*</td> + <td>---</td> + <td>mozilla-1.8.1</td> + <td>September 23, 2008</td> + <td> </td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/0.8" title="https://addons.mozilla.org/thunderbird/addon/lightning/versions/0.8">0.8</a></td> + <td>2.0.0.*</td> + <td>---</td> + <td>mozilla-1.8.1</td> + <td>April 4, 2008</td> + <td> </td> + </tr> + </tbody> +</table> + +<h3 id="Lançamentos_de_ESR_Estáveis">Lançamentos de ESR Estáveis</h3> + +<p>Thunderbird 10 and 17 were considered Extended Support Releases (ESR), which Lightning is compatible with. We followed the ESR policy of Thunderbird and only did releases for security fixes. Additionally, some fixes may have been backported for important regressions related to enterprise features like invitations.</p> + +<table class="standard-table"> + <thead> + <tr> + <th>Lightning<br> + Versão</th> + <th>Thunderbird<br> + Versão</th> + <th>SeaMonkey<br> + Versão</th> + <th>Plataforma Mozilla<br> + Versão</th> + <th>Data de Lançamento</th> + </tr> + </thead> + <tbody> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.9.1" title="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.9">1.9.1</a></td> + <td>17.0esr</td> + <td>2.14</td> + <td>mozilla17</td> + <td>March 6, 2013</td> + </tr> + <tr> + <td><a href="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.2.3" title="https://addons.mozilla.org/thunderbird/addon/lightning/versions/1.2.3">1.2.3</a></td> + <td>10.0esr</td> + <td>2.7</td> + <td>mozilla10</td> + <td>March 9, 2012</td> + </tr> + </tbody> +</table> + +<h2 id="Sunbird">Sunbird</h2> + +<p>Por favor, note que o Sunbird foi descontinuado, consulte este blogue para detalhes. Não haverá mais lançamento do Sunbird até novo aviso.</p> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Sunbird<br> + Versão</th> + <th scope="col">Mozilla Platform<br> + Versão</th> + <th scope="col">Data de Lançamento</th> + </tr> + </thead> + <tbody> + <tr> + <td>1.0b1</td> + <td>1.9.1</td> + <td>March 30, 2010</td> + </tr> + <tr> + <td>0.9</td> + <td>1.8.1</td> + <td>September 23, 2008</td> + </tr> + <tr> + <td>0.8</td> + <td>1.8.1</td> + <td>April 4, 2008</td> + </tr> + </tbody> +</table> diff --git a/files/pt-pt/mozilla/calendar/index.html b/files/pt-pt/mozilla/calendar/index.html new file mode 100644 index 0000000000..17e6540daa --- /dev/null +++ b/files/pt-pt/mozilla/calendar/index.html @@ -0,0 +1,80 @@ +--- +title: Calendar +slug: Mozilla/Calendar +tags: + - Calendar + - NeedsTranslation + - NeedsUpdate + - TopicStub +translation_of: Mozilla/Calendar +--- +<table> + <tbody> + <tr> + <td><img src="/@api/deki/files/3621/=Sunbird-Logo-148x155.png" alt="Sunbird-Logo-148x155.png" style="width: 148px; height: 155px;" class="internal default"></td> + <td> + <p><span class="seoSummary">The Mozilla Calendar Project is a community driven project based on the Mozilla application architecture. The Project's heart is a calendaring backend based on libical. The <a href="http://www.mozilla.org/projects/calendar/lightning/" class="external" title="http://www.mozilla.org/projects/calendar/lightning/">Lightning extension</a> is built on top of this platform and provides integrated calendaring capabilities for Mozilla Messaging's Email client <a href="/en/Thunderbird" class="internal" title="En/Thunderbird">Thunderbird</a>.</span></p> + <p>Mozilla Calendar emphasizes free and open source technology and supports standardized technology like the ical/ics (<a href="http://tools.ietf.org/html/rfc2445" class="external" title="http://tools.ietf.org/html/rfc2445">rfc2445</a>) format and the CalDAV (<a href="http://tools.ietf.org/html/rfc4791" class="external" title="http://tools.ietf.org/html/rfc4791">rfc4791</a>) protocol, which is implemented by many freely available servers and also some commercial providers.</p> + </td> + </tr> + </tbody> +</table> +<table class="topicpage-table"> + <tbody> + <tr> + <td style="vertical-align: top;"> + <h2 id="Development_Topics">Development Topics</h2> + <dl> + <dt> + <a href="/en/Simple_Sunbird_build" class="internal" title="en/Simple Sunbird build">Building Calendar</a></dt> + <dd> + Information about building Calendar with the new <a href="/en/comm-central" class="internal" title="en/comm-central">comm-central</a> repository. There is also a simple build page for <a href="/en/Simple_Thunderbird_build#Building_Thunderbird_and_Lightning" class="internal" title="en/Simple Thunderbird build#Building Thunderbird and Lightning">Thunderbird including Lightning</a> and information about <a href="/en/How_comm-central's_build_system_works" class="internal" title="en/How comm-central's build system works">how comm-central works</a>.</dd> + </dl> + <dl> + <dt> + <a href="https://wiki.mozilla.org/Calendar:Creating_an_Extension" class="link-https" title="https://wiki.mozilla.org/Calendar:Creating_an_Extension">Creating a Calendar extension</a></dt> + <dd> + Tutorial on creating a Calendar extension for Sunbird and Lightning.</dd> + </dl> + <dl> + <dt> + <a href="/en/Calendar/Localization" class="internal" title="En/Calendar/Localization"><strong>Localization</strong></a></dt> + <dd> + How to get started with translating Calendar into your language and how to build Lightning in your language. </dd> + <dt> + Testing Calendar</dt> + <dd> + <a href="/en/Calendar/MozMill_Testing" class="internal" title="En/Calendar/MozMill Testing">CalendarUtils reference</a> for writing <a href="/en/Mozmill_Tests" class="internal" title="en/Mozmill Tests">Mozmill tests</a>, which can automatically test the UI so that regressions can be easily found.</dd> + <dt> + <a href="/en/Calendar/Calendar_Versions" title="en/Calendar/Calendar Versions">Calendar Versions</a></dt> + <dd> + This page will tell you which Calendar version fits with which Mozilla Platform and where current development is being done.</dd> + </dl> + </td> + <td style="vertical-align: top;"> + <h2 id="Tools">Tools</h2> + <dl> + <dt> + <a href="https://bugzilla.mozilla.org/query.cgi?format=specific&product=Calendar" class="link-https" title="https://bugzilla.mozilla.org/query.cgi?format=specific&product=Calendar">Bugzilla</a></dt> + <dd> + The <a href="/en/Bugzilla" class="internal" title="En/Bugzilla">Bugzilla</a> database used to track issues for Mozilla projects.</dd> + <dd> + </dd> + <dt> + <a href="http://mxr.mozilla.org/comm-central/" class="external" title="http://mxr.mozilla.org/comm-central/">MXR</a></dt> + <dd> + Browse and search the Calendar source code repository on the Web.</dd> + <dd> + </dd> + <dt> + <a href="https://wiki.mozilla.org/Calendar:QA_CalDAV_Support" class="link-https" title="https://wiki.mozilla.org/Calendar:QA_CalDAV_Support">Calendar Servers</a></dt> + <dd> + Setup your own calendar server, or check to see how well commercial products are supported.</dd> + <dt> + </dt> + </dl> + </td> + </tr> + </tbody> +</table> +<p> </p> diff --git a/files/pt-pt/mozilla/criacao_barra_lateral_firefox/index.html b/files/pt-pt/mozilla/criacao_barra_lateral_firefox/index.html new file mode 100644 index 0000000000..737ebb5925 --- /dev/null +++ b/files/pt-pt/mozilla/criacao_barra_lateral_firefox/index.html @@ -0,0 +1,40 @@ +--- +title: Criação de uma barra lateral do Firefox +slug: Mozilla/Criacao_barra_lateral_Firefox +tags: + - Extensões + - Extras + - Firefox +translation_of: Mozilla/Creating_a_Firefox_sidebar +--- +<p>Os publicadores da Web podem oferecer aos visitantes uma <strong>barra lateral do Firefox</strong> para encorajar à sua participação. Existem duas maneiras de criar uma barra lateral para os utilizadores do Firefox: a API Social e uma extensão. Pode escolher dependendo das suas necessidades e recursos.</p> + +<h2 id="A_API_Social">A API Social</h2> + +<div class="geckoVersionNote"> +<p>Este conteúdo abrange as funcionalidades introduzidas no <a href="/en-US/docs/Mozilla/Firefox/Releases/17">Firefox 17</a>.</p> +</div> + +<p>A <a href="/pt-PT/docs/Social_API">API Social</a> é uma nova API da Mozilla que permite aos serviços de redes sociais integrar o seu conteúdo na jabela do navegador. De momento, o <a href="https://blog.mozilla.org/blog/2013/05/14/stay-social-with-firefox/">Cliqz, </a><a href="https://blog.mozilla.org/blog/2012/12/03/firefox-gets-social-w-facebook/">Facebook</a>, <a href="https://blog.mozilla.org/blog/2013/05/14/stay-social-with-firefox/">mixi e a MSN</a> têm uma parceria com a Mozilla, como provedores sociais. Agora que a <a href="https://blog.mozilla.org/futurereleases/2013/06/27/social-api-for-all/">API está disponível para todos os programadores da Web</a>, então vale a pena conferir se está a oferecer um serviço social.</p> + +<h2 id="Uma_extensão">Uma extensão</h2> + +<p>An <a href="/en-US/docs/Extensions">extension</a> is a kind of <a href="/en-US/docs/Mozilla/Add-ons">add-ons</a> that adds new functionalities to Firefox. There is a wide range of extensions available, and <a href="https://addons.mozilla.org/en-US/firefox/search/?q=sidebar">some of them provide a sidebar</a>. Such kind of sidebar can be a simple Web panel or a full-featured extension that is completely integrated with the browser. There are some ways to create an extension:</p> + +<ul> + <li>The <a href="/en-US/Add-ons/SDK/Low-Level_APIs/ui_sidebar">new sidebar API</a> has been implemented in Firefox 29 as part of the <a href="/en-US/Add-ons/SDK">Add-on SDK</a>. It's the easiest way to create an extension with a sidebar.</li> + <li>You can also build a <a href="/en-US/Add-ons/Bootstrapped_extensions">restartless extension</a> yourself without the SDK. A <a href="https://github.com/kyoshino/simple-sidebar">sample extension to add a Web panel</a> is available as a starter.</li> + <li>If you'd like to have a deeper integration with the browser to offer more complex features, a <a href="/en-US/docs/Creating_a_Firefox_sidebar_extension">traditional overlay extension</a> can be an option. The document might be obsolete, though.</li> +</ul> + +<h2 id="A_API_window.sidebar">A API <code>window.sidebar</code></h2> + +<p>{{ obsolete_header(23) }}</p> + +<p>As of <a href="/en-US/docs/Mozilla/Firefox/Releases/23">Firefox 23</a>, the <code>addPanel</code> and <code>addPersistentPanel</code> functions have been removed from the deprecated, Netscape-derived {{ domxref("window.sidebar") }} object. That means the ability to add a traditional sidebar panel is no longer available from Web content. The new Social API or an extension can be used instead as described above.</p> + +<h2 id="Consulte_Também">Consulte Também</h2> + +<ul> + <li>Bootstrap addon demo which adds a sidebar with browser for HTML content: <a href="https://gist.github.com/Noitidart/8728393">https://gist.github.com/Noitidart/8728393</a></li> +</ul> diff --git a/files/pt-pt/mozilla/criação_de_um_complemento_de_dicionário_de_verificação_ortográfica/index.html b/files/pt-pt/mozilla/criação_de_um_complemento_de_dicionário_de_verificação_ortográfica/index.html new file mode 100644 index 0000000000..50a536375d --- /dev/null +++ b/files/pt-pt/mozilla/criação_de_um_complemento_de_dicionário_de_verificação_ortográfica/index.html @@ -0,0 +1,95 @@ +--- +title: Criação de um complemento de dicionário de verificação ortográfica +slug: Mozilla/Criação_de_um_complemento_de_dicionário_de_verificação_ortográfica +tags: + - Complemento + - add-on +translation_of: Mozilla/Creating_a_spell_check_dictionary_add-on +--- +<p>Esta página descreve como montar um dicionário de verificação ortográfica Hunspell como um complemento do Firefox, ou como atulizar um complemento existente, e assim, este pode ser instalado, desinstalado e atualizado sem reiniciar.</p> + +<h2 id="Partes_necessárias">Partes necessárias</h2> + +<p>To create a dictionary add-on, you first need two things:</p> + +<ul> + <li>A spell check dictionary in Hunspell or Myspell format, with a license which allows you to use it. Such a dictionary consists of two files, one with a <code>.dic</code> and one with an <code>.aff</code> file extension.</li> + <li>A locale code to describe the language of the dictionary. For example <code>en-US</code>, <code>de-DE</code> or <code>da</code>. It is important to choose the right locale code, or the spell checker will not be able to match the language of your dictionary against the language of a web page in order to select the right dictionary to use.</li> +</ul> + +<p>If you are creating a new dictionary, as opposed to updating an existing one, please make sure that there is not already a <a href="https://addons.mozilla.org/en-US/firefox/language-tools/" title="https://addons.mozilla.org/en-US/firefox/language-tools/">dictionary available</a> for your locale. If there already is one, try contacting the author to get it updated, or contact <a href="https://wiki.mozilla.org/AMO:Editors" title="https://wiki.mozilla.org/AMO:Editors">AMO editors</a> if the author does not respond.</p> + +<h2 id="Packaging">Packaging</h2> + +<p>A Firefox add-on is a ZIP file renamed to use an <code>.xpi</code> file extension instead of the normal <code>.zip</code> file extension. To create a dictionary add-on, simply create a ZIP file which contains the following files and folders:</p> + +<p><code>my-dictionary.xpi</code></p> + +<ul> + <li><code>install.rdf</code></li> + <li><code>dictionaries/</code> + <ul> + <li><em>locale-code</em><code>.dic</code></li> + <li><em>locale-code</em><code>.aff</code></li> + </ul> + </li> +</ul> + +<p>The <code>.dic</code> and <code>.aff</code> files must be placed in a subfolder named <code>dictionaries</code> within the ZIP file. Both files must have the locale code as their file name. You also have to add a file named <code>install.rdf</code> to the root of the ZIP file. This file contains information about your add-on such as name and version number (see below). In addition to these required files, you may add optional files, for example to give your add-on an <a href="/en-US/docs/Install_Manifests#iconURL" title="/en-US/docs/Install_Manifests#iconURL">icon</a> or to describe the license of the dictionary.</p> + +<p>Here is an example of the <code>install.rdf</code> file. You can create and edit it with a plain text editor such as Notepad.</p> + +<p><code><?xml version="1.0"?><br> + <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"<br> + xmlns:em="http://www.mozilla.org/2004/em-rdf#"><br> + <Description about="urn:mozilla:install-manifest"><br> + <em:id><span style="color: #ff0000;"><strong><em>locale-code</em></strong></span>@dictionaries.addons.mozilla.org</em:id><br> + <em:version><em><strong><span style="color: #ff0000;">version number</span></strong></em></em:version><br> + <em:type>64</em:type><br> + <em:unpack>true</em:unpack><br> + <em:name><span style="color: #ff0000;"><em><strong>Name</strong></em></span></em:name><br> + <em><strong><!--<br> + Other <a href="/en-US/docs/Install_Manifests" title="/en-US/docs/Install_Manifests">install.rdf metadata</a> such as em:localized, em:description, em:creator,<br> + em:developer, em:translator, em:contributor or em:homepageURL<br> + --></strong></em><br> + <br> + <!-- Firefox --><br> + <em:targetApplication><br> + <Description><br> + <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id><br> + <em:minVersion>18.0a1</em:minVersion><br> + <em:maxVersion>46.0</em:maxVersion><br> + </Description><br> + </em:targetApplication><br> + <br> + <!-- Thunderbird --><br> + <em:targetApplication><br> + <Description><br> + <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id><br> + <em:minVersion>18.0a1</em:minVersion><br> + <em:maxVersion>22.0</em:maxVersion><br> + </Description><br> + </em:targetApplication><br> + <br> + <!-- SeaMonkey --><br> + <em:targetApplication><br> + <Description><br> + <em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id><br> + <em:minVersion>2.15a1</em:minVersion><br> + <em:maxVersion>2.49</em:maxVersion><br> + </Description><br> + </em:targetApplication><br> + </Description><br> + </RDF></code></p> + +<p>There are some rules about how you should adapt the <code>install.rdf</code> file:</p> + +<ul> + <li>If you are creating a new dictionary add-on, we recommend that the <code>em:id</code> consists of your locale code followed by <code>@dictionaries.addons.mozilla.org</code>, but if there is more than one dictionary for your language (for example the German "old spelling" versus "new spelling" dictionaries), you may need to choose another ID, that follows the <a href="/en-US/docs/Install_Manifests#id" title="/en-US/docs/Install_Manifests#id">rules of em:id</a>. If you update an existing dictionary add-on, you must keep the existing <code>em:id</code>, or your users will not be updated to the latest version.</li> + <li>The <code>em:version</code> should follow the <a href="/en-US/docs/Toolkit_version_format" title="/en-US/docs/Toolkit_version_format">rules of Mozilla add-on version numbers</a>, and if you update an existing dictionary add-on, the new version number must be greater than the old one.</li> + <li>Don't change <code>em:type</code> or <code>em:unpack</code>, and don't add a <code>em:bootstrap</code> element. Type = 64 indicates that the add-on is in the restartless format, and unpack is required for Hunspell to read the dictionary.</li> + <li>Although the restartless format for dictionary add-ons were introduced in Gecko 10, dictionary updates only works starting from Gecko 18. The <code>em:minVersion</code> should therefore be the same as in the example above (or greater). If you set <code>em:minVersion</code> to a lower value, Gecko 10-17 will not be able to update your dictionary add-on once the restartless dictionary is installed (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=782118">bug 782118</a>), and Gecko 10-16 may warn the user that your dictionary is not compatible, when users try to update to a newer version of Firefox/Thunderbird (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=782115" title="https://bugzilla.mozilla.org/show_bug.cgi?id=782115">bug 782115</a>).</li> + <li>Update the <code>em:maxVersion</code> to the <a href="https://addons.mozilla.org/en-us/firefox/pages/appversions/" title="https://addons.mozilla.org/en-us/firefox/pages/appversions/">greatest versions available</a>.</li> +</ul> + +<p>Once you have added these files to your ZIP file and renamed the file to have the <code>.xpi</code> extension, you can install your add-on in Firefox and test it. After a successful test, you can upload your add-on to <a href="https://addons.mozilla.org/" title="https://addons.mozilla.org/">addons.mozilla.org</a> and ask for it to be included in the <a href="https://addons.mozilla.org/en-US/firefox/language-tools/" title="https://addons.mozilla.org/en-US/firefox/language-tools/">Dictionaries & Language Packs</a> page.</p> diff --git a/files/pt-pt/mozilla/developer_guide/source_code/index.html b/files/pt-pt/mozilla/developer_guide/source_code/index.html new file mode 100644 index 0000000000..d4c1fcb601 --- /dev/null +++ b/files/pt-pt/mozilla/developer_guide/source_code/index.html @@ -0,0 +1,54 @@ +--- +title: Working with Mozilla source code +slug: Mozilla/Developer_guide/Source_Code +tags: + - Developing Mozilla + - Firefox + - Intermediate + - Mozilla + - NeedsTranslation + - TopicStub + - thunderbird +translation_of: Mozilla/Developer_guide/Source_Code +--- +<p>The articles below will help you get your hands on the Mozilla source code, learn to navigate the code, and how to get the changes you propose checked into the tree.</p> + +<div class="row topicpage-table"> +<div class="section"> +<dl> + <dt><a class="internal" href="/En/Developer_Guide/Source_Code/Mercurial" title="En/Mozilla Source Code (Mercurial)">Getting the code from the Mercurial repository</a></dt> + <dd>If you plan to contribute to the Mozilla project, the best way to get the code is to check it out from the version control repository. Learn how to do that here.</dd> + <dt><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Using_the_VM">Getting a pre-configured Mozilla build system virtual machine</a></dt> + <dd>This is the easiest way to get started: use a VirtualBox virtual machine which is already configured with a complete build environment for you to use. Just boot the VM and build!</dd> + <dt><a class="internal" href="/En/Developer_Guide/Source_Code/Downloading_Source_Archives" title="En/Mozilla Source Code (HTTP//FTP)">Downloading the code using HTTP or FTP</a></dt> + <dd>If you want to fetch the code for a specific release of a particular Mozilla product, you may prefer to download a source code archive.</dd> + <dt><a class="internal" href="/en/Viewing_and_searching_Mozilla_source_code_online" title="En/Viewing and searching Mozilla source code online">Viewing and searching Mozilla source code online</a></dt> + <dd>Learn how to use MXR, Mozilla's online search and browsing tool for accessing the source code. This isn't a good way to download the code, but is a great way to search it.</dd> + <dt><a class="internal" href="/en/Mozilla_Source_Code_Directory_Structure" title="en/Mozilla Source Code Directory Structure">Navigating the Mozilla source code</a></dt> + <dd>Learn about the various folders in the Mozilla source tree, and how to find what you're looking for.</dd> + <dt><a class="external" href="/en/Introduction#Find_a_bug_we%27ve_identified_as_a_good_fit_for_new_contributors." title="/en/Introduction#Find_a_bug_we%27ve_identified_as_a_good_fit__for_new_contributors.">Bugs for newcomers</a></dt> + <dd>If you are new to the project and want something to work on, look here.</dd> +</dl> +</div> + +<div class="section"> +<dl> + <dt><a class="internal" href="/En/Developer_Guide/Coding_Style" title="En/Mozilla Coding Style Guide">Mozilla Coding Style Guide</a></dt> + <dd>The code style guide provides information about how you should format your source code to ensure that you don't get mocked by the reviewers.</dd> + <dt><a href="/En/Developer_Guide/Interface_development_guide" title="En/Developer Guide/Interface development guide">Interface development guide</a></dt> + <dd>Guidelines and documentation for how to create and update XPCOM interfaces.</dd> + <dt><a href="/en-US/docs/Mozilla/Developer_guide/SVG_Guidelines">SVG Cleanup Guide</a></dt> + <dd>Guidelines and best practices for shipping new SVGs.</dd> + <dt><a class="link-https" href="https://wiki.mozilla.org/Build:TryServer" title="https://wiki.mozilla.org/Build:TryServer">Try Servers</a></dt> + <dd>Mozilla products build on at least three platforms. If you don't have access to them all, you can use the try servers to test your patches and make sure the tests pass.</dd> + <dt><a class="internal" href="/en/Creating_a_patch" title="En/Creating a patch">Creating a patch</a></dt> + <dd>Once you've made a change to the Mozilla code, the next step (after making sure it works) is to create a patch and submit it for review. <em>This article needs to be updated fully for Mercurial.</em></dd> + <dt><a class="external" href="http://www.mozilla.org/hacking/committer/" title="http://www.mozilla.org/hacking/committer/">Getting commit access to the source code</a></dt> + <dd>Feel ready to join the few, the proud, the committers? Find out how to get check-in access to the Mozilla code.</dd> + <dt><a class="internal" href="/En/Developer_Guide/Source_Code/CVS" title="En/Mozilla Source Code (CVS)">Getting older Mozilla code from CVS</a></dt> + <dd>Older versions of the Mozilla source code, as well as the current versions of NSS and NSPR, are kept in a CVS repository. Learn about that in this article.</dd> +</dl> +</div> +</div> + +<p> </p> diff --git a/files/pt-pt/mozilla/firefox/edição_programador/index.html b/files/pt-pt/mozilla/firefox/edição_programador/index.html new file mode 100644 index 0000000000..3f3e7d3c90 --- /dev/null +++ b/files/pt-pt/mozilla/firefox/edição_programador/index.html @@ -0,0 +1,36 @@ +--- +title: Edição do Programador +slug: Mozilla/Firefox/Edição_Programador +tags: + - Beta + - Bugs + - Developer Edition + - Edição de Desenvolvimento + - Edição do Programador + - Erros + - Latest + - Mais Recentes +translation_of: Mozilla/Firefox/Developer_Edition +--- +<div>{{FirefoxSidebar}}</div> + +<p>A 'Edição do Programador' do Firefox é uma versão do Firefox que está preparada para os programadores da Web. Esta inclui:</p> + +<ul> + <li><strong>as funcionalidades mais recentes do Firefox</strong>: a Edição de Desenvolvimento do Firefox substitui o canal antigo Aurora. + + <ul> + <li>Cada nova versão inclui funcionalidades que foram estabilizadas por meio das compilações noturnas</li> + <li>As novas funcionalidades entram no canal do Firefox Beta seis semanas antes de serem lançadas</li> + <li>As novas funcionalidades são estáveis durente 12 semanas antes de aparecerem na versão lançada do Firefox</li> + </ul> + </li> + <li><strong>um perfil do programador separado</strong>: isto significa que pode executar facilmente a 'Edição de Desenvolvimento' com a sua versão Beta ou de lançamento do Firefox.</li> + <li><strong>ferramentas de desenvolvimento experimentais</strong>: nós iremos incluir as ferramentas experimentais que ainda não são prontas para produção. Por exemplo, a 'Edição de Desenvolvimento' inclui o <a href="/en-US/docs/Tools/Firefox_Tools_Adapter">Adaptador de Ferramentas do Firefox</a> (descontinuado), que permite-lhe ligar às <a href="/pt-PT/docs/Tools">Ferramentas de desenvolvimento do Firefox</a> para outros navegadores, tais como Safari no iOS e Chrome no Android.</li> + <li><strong>preferências adaptadas para os programadores da Web</strong>: nós definimos valores de preferência predefinidos personalizados para os programadores da Web. Por exemplo, chrome e a depuração remota estão ativados por predefinição na 'Edição de Desenvolvimento'.</li> + <li><strong>um tema distinto</strong>: isto inclui o acesso mais rápido às ferramentas de programador.</li> +</ul> + +<p><a href="/pt-PT/docs/Mozilla/Firefox/Releases" style="margin: 0 40px 20px 40px; padding: 10px; text-align: center; border-radius: 4px; display: inline-block; background-color: #81BC2E; white-space: nowrap; color: white; text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.25); box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.2), 0px -1px 0px 0px rgba(0, 0, 0, 0.3) inset;">Novidades na Edição do Programador?</a></p> + +<p><a href="https://www.mozilla.org/pt-PT/firefox/developer/" style="float: right; margin: 0 30px 20px 30px; padding: 10px; text-align: center; border-radius: 4px; display: inline-block; background-color: #81BC2E; white-space: nowrap; color: white; text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.25); box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.2), 0px -1px 0px 0px rgba(0, 0, 0, 0.3) inset;">Transferir a Edição do Programador</a></p> diff --git a/files/pt-pt/mozilla/firefox/index.html b/files/pt-pt/mozilla/firefox/index.html new file mode 100644 index 0000000000..2e57b0d4f0 --- /dev/null +++ b/files/pt-pt/mozilla/firefox/index.html @@ -0,0 +1,73 @@ +--- +title: Firefox +slug: Mozilla/Firefox +tags: + - Firefox + - Landing + - Mozilla +translation_of: Mozilla/Firefox +--- +<div>{{FirefoxSidebar}}</div> + +<p><a href="https://www.mozilla.org/firefox/">Firefox</a> é o navegador popular da Web da Mozilla, disponível para múltiplas plataformas, incluindo Linux, OS X e Windows para PC e em todos os dispositivos móveis Android e iOS. Com ampla compatibilidade, as tecnologias da Web mais recentes, e ferramentas de programação poderosas, o Firefox é uma excelente escolha, tanto para os programadores da Web como para os utilizadores finais.</p> + +<p>O Firefox é um projeto de código aberto; a maior parte do código é fornecido pela nossa comunidade enorme de voluntários. Aqui pode aprender sobre como contribuir para o projeto Firefox e irá encontrar também hiperligações para informação sobre a criação de <strong>Extras</strong> do Firefox, utilizando as ferramentas de programador no Firefox, e outros tópicos.</p> + +<div class="summary"> +<p>Aprenda a criar <strong>Extras</strong> para o <a href="https://www.mozilla.org/pt-PT/firefox/">Firefox</a>, como desenvolver e criar o próprio Firefox, e como os internos do Firefox e os respetivos subprojetos funcionam.</p> +</div> + +<ul class="card-grid"> + <li><span>Notas de lançamento do programador</span> + + <p><a href="/en-US/Firefox/Releases">Notas de lançamento focadas no Programador</a>; saiba quais as novas funcionalidades que chegam para ambos os websites e para os extras em cada versão do Firefox.</p> + </li> + <li><span>Documentação do projeto</span> + <p>Obtenha informação detalhada sobre <a href="/en-US/docs/Mozilla">os internos do Firefox</a> e o sistema operativo, para que você se possa orientar no código.</p> + </li> + <li><span>Guia do pogramador</span> + <p>O nosso <a href="/en-US/docs/Developer_Guide">guia do programador</a> fornece detalhes sobre como obter e compilar o código fonte do Firefox, como você se orientar, e como contribuir para o projeto.</p> + </li> +</ul> + +<h2 id="Canais_do_Firefox">Canais do Firefox</h2> + +<p>O Firefox está disponível em cinco <strong>canais</strong>.</p> + +<h3 id="Firefox_Nightly">Firefox Nightly</h3> + +<p>Todas as noites nós contruimos o Firefox a partir do último código disponível em <a href="/en-US/docs/mozilla-central">mozilla-central</a>. Estas configurações destinam-se aos programadores do Firefox ou para aqueles que desejam experimentar as últimas funcionalidades inovadoras enquanto estas estão ainda em fase de desenvolvimento.</p> + +<p><a href="https://download.mozilla.org/?product=firefox-nightly-stub&os=win&lang=pt-PT" style="width: 250px; display: block; margin-left: auto; margin-right: auto; padding: 10px; text-align: center; border-radius: 4px; background-color: #81BC2E; white-space: nowrap; color: white; text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.25); box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.2), 0px -1px 0px 0px rgba(0, 0, 0, 0.3) inset;">Transferir Firefox Nightly</a></p> + +<h3 id="Edição_do_Programador_do_Firefox">Edição do Programador do Firefox</h3> + +<p>Esta é uma versão do Firefox personalizada para programadores. A cada seis semanas, nós selecionamos as funcionalidades do Firefox Nightly que estão estáveis o suficiente e criamos uma nova versão da Edição do Programador do Firefox. Nós adicionamos também algumas funcionalidades extra para programadores, que estão apenas disponíveis neste canal.</p> + +<p><a href="/en-US/Firefox/Developer_Edition">Saiba mais acerca da Edição do Programador do Firefox</a>.</p> + +<p><a href="https://download.mozilla.org/?product=firefox-devedition-stub&os=win&lang=pt-PT" style="width: 250px; display: block; margin-left: auto; margin-right: auto; padding: 10px; text-align: center; border-radius: 4px; background-color: #81BC2E; white-space: nowrap; color: white; text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.25); box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.2), 0px -1px 0px 0px rgba(0, 0, 0, 0.3) inset;">Transferir Firefox Developer Edition</a></p> + +<h3 id="Firefox_Beta">Firefox Beta</h3> + +<p>Após utilizar a Edição do Programador do Firefox por seis semanas, nós selecionamos as funcionalidades que estão estáveis o suficiente e criamos uma nova versão do Firefox Beta. As configurações do Firefox Beta destinam-se a entusiastas do Firefox para testar as funcionalidades destinadas a serem lançadas na próxima versão do Firefox.</p> + +<p><a href="https://download.mozilla.org/?product=firefox-beta-stub&os=win&lang=pt-PT" style="width: 250px; display: block; margin-left: auto; margin-right: auto; padding: 10px; text-align: center; border-radius: 4px; background-color: #81BC2E; white-space: nowrap; color: white; text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.25); box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.2), 0px -1px 0px 0px rgba(0, 0, 0, 0.3) inset;">Transferir Firefox Beta</a></p> + +<h3 id="Firefox">Firefox</h3> + +<p>Após estabilizar para outras seis semanas com a versão Beta, nós estamos prontos para lançar as novas funcionalidades para milhões de utilizadores numa nova versão de lançamento do Firefox.</p> + +<p><a href="https://www.mozilla.org/pt-PT/firefox/" style="width: 250px; display: block; margin-left: auto; margin-right: auto; padding: 10px; text-align: center; border-radius: 4px; background-color: #81BC2E; white-space: nowrap; color: white; text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.25); box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.2), 0px -1px 0px 0px rgba(0, 0, 0, 0.3) inset;">Transferir Firefox</a></p> + +<h3 id="Firefox_Extended_Support_Release_(ESR)">Firefox Extended Support Release (ESR)</h3> + +<p>Firefox ESR is the long-term support edition of Firefox for desktop for use by organizations including schools, universities, businesses and others who need extended support for mass deployments.</p> + +<p><a href="/en-US/Firefox/Firefox_ESR">Learn more about Firefox Extended Support Release</a>.</p> + +<p><a href="https://www.mozilla.org/pt-PT/firefox/organizations/all/" style="width: 250px; display: block; margin-left: auto; margin-right: auto; padding: 10px; text-align: center; border-radius: 4px; background-color: #81BC2E; white-space: nowrap; color: white; text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.25); box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.2), 0px -1px 0px 0px rgba(0, 0, 0, 0.3) inset;">Transferir Firefox ESR</a></p> + +<h2 id="Perfis_do_Firefox">Perfis do Firefox</h2> + +<p>If you find yourself using multiple Firefox channels—or just multiple configurations—on a regular basis, you should read how to <a href="/en-US/docs/Mozilla/Firefox/Multiple_profiles">use multiple Firefox profiles</a> by turning Firefox's Profile Manager and other profile management tools to your advantage.</p> diff --git a/files/pt-pt/mozilla/firefox/multiple_profiles/index.html b/files/pt-pt/mozilla/firefox/multiple_profiles/index.html new file mode 100644 index 0000000000..b7935947d7 --- /dev/null +++ b/files/pt-pt/mozilla/firefox/multiple_profiles/index.html @@ -0,0 +1,244 @@ +--- +title: Múltiplos perfis do Firefox +slug: Mozilla/Firefox/Multiple_profiles +tags: + - Firefox + - Guía + - Perfis + - Perguntas e Respostas + - Principiante +translation_of: Mozilla/Firefox/Multiple_profiles +--- +<div>{{FirefoxSidebar}}</div> + +<p class="summary">Um perfil no Firefox é a coleção de definições. personalizações, extras, e outras personalizações que um utilizador criou ou instalou na sua cópia do Firefox. Pode encontrar mais <a href="https://support.mozilla.org/pt-PT/kb/perfis-onde-firefox-armazena-os-seus-marcadores">detalhes sobre os perfis</a> no site de apoio do utilizador final da Mozilla.</p> + +<h2 id="Razões_para_ter_múltiplos_profiles">Razões para ter múltiplos profiles</h2> + +<p>The casual user may want to have different profiles for different family members. Having different profiles would allow each person to have his or her own set of bookmarks, settings, and add-ons.</p> + +<p>Web developers might want a secondary profile for testing websites, apps, or other projects on different Firefox channels. For example, you might want to have some extensions installed for Web development, but not for general-purpose Web browsing. While using the Nightly channel, you may encounter some add-ons that have become temporarily incompatible with new API changes, until the add-on developer has a chance to update them. You can remove such add-ons from your profile for Nightly use while keeping them for use with other profiles.</p> + +<p>For QA, testing, and bug triaging contributors, you may want to have multiple development versions of Firefox installed, each with its own profile. Creating new profiles for testing can keep you from losing your preferences, bookmarks, and history. It takes little time to set up a new profile, and once it is complete, all of your Firefox versions will update separately and can be run simultaneously.</p> + +<h2 id="Canais_de_desenvolvimento_do_navegador_disponíveis">Canais de desenvolvimento do navegador disponíveis</h2> + +<p>There are four available browser channels, each at a different level of stability and development. The four channels are <a class="link-https" href="https://www.mozilla.org/firefox/new/" title="Firefox Stable">Release</a>, <a class="link-https" href="https://www.mozilla.org/firefox/beta/" title="Firefox Beta">Beta</a>, <a href="https://www.mozilla.org/firefox/aurora/">Developer Edition</a>, and <a class="external" href="https://nightly.mozilla.org/" title="Firefox Nightly">Nightly</a>. The Release channel is recommended for most users, as it is the "official release" channel. However, for those more adventurous, you can try one of the other three channels to see what is coming in Firefox and play around with emerging features. The Beta channel contains the features that are expected to be in the next release of Firefox and are in final stages of testing. Aurora contains experimental features, which are not yet at beta quality. Nightly contains the latest code from Firefox developers and is the least stable channel.</p> + +<h2 id="Ferramentas_de_terceiros">Ferramentas de terceiros</h2> + +<p>In addition to the built-in Profile Manager and the external Profile Manager, there are a few third-party tools that make working with multiple profiles easy.</p> + +<div class="note"> +<p>This list is by no means exhaustive. Please add any helpful tools you discover to the list!</p> +</div> + +<h3 id="Mac_OS_X">Mac OS X</h3> + +<ul> + <li><a href="http://davemartorana.com/multifirefox/">Multifirefox</a> by Dave Martorana</li> +</ul> + +<h2 id="Gestão_de_perfis">Gestão de perfis</h2> + +<h3 id="Determining_the_profile_while_Firefox_is_running">Determining the profile while Firefox is running</h3> + +<p>To determine the profile of a currently-running Firefox instance in Windows, macOS or Linux,</p> + +<ol> + <li>Type about:profiles into the browser URL search bar.</li> + <li>The page presents a list of all of your profiles, each beginning with "Profile: " followed by its name.</li> + <li>The one being run by this Firefox instance will include the bold text "<strong>This is the profile in use</strong>" For example, if you find that text beneath the entry for "Profile: Suzie", then you are running in a profile named <em>Suzie</em>.</li> +</ol> + +<h3 id="Launching_Firefox_into_a_Desired_Profile">Launching Firefox into a Desired Profile</h3> + +<p id="You_cannot_change_the_profile_while_Firefox_is_running._Although_it_is_possible_in_some_cases_to_have_multiple_instances_of_Firefox_running_in_different_profiles_to_avoid_confusion_you_should_first_exitquitterminate_all_running_instances_of_Firefox_FirefoxDeveloperEdition_or_Nightly._Then_follow_the_instructions_below_applicable_to_your_operating_system."><strong>You cannot change the profile while Firefox is running.</strong> Although it is possible in some cases to have multiple instances of Firefox running in different profiles, to avoid confusion, you should first exit/quit/terminate all running instances of <em>Firefox</em>, <em>FirefoxDeveloperEdition</em> or <em>Nightly</em>. Then follow the instructions below, applicable to your operating system.</p> + +<h4 id="Windows">Windows</h4> + +<h5 id="Windows_XP">Windows XP</h5> + +<ol> + <li>Click the Start button.</li> + <li>Click "Run".</li> + <li> + <p>Type <code>firefox --ProfileManager</code>.</p> + </li> +</ol> + +<h5 id="Windows_Vista7">Windows Vista/7</h5> + +<ol> + <li>Click the Start button.</li> + <li>Click the search bar at the bottom.</li> + <li> + <p>Type <code>firefox --ProfileManager</code>.</p> + </li> +</ol> + +<h5 id="Windows_88.1">Windows 8/8.1</h5> + +<ol> + <li>Press "Windows + R" on your keyboard.</li> + <li>Type <code>firefox --ProfileManager</code>.</li> +</ol> + +<p>If the Profile Manager window does not open, Firefox may have been running in the background, even though it was not visible. Close all instances of Firefox, or restart the computer, and then try again.</p> + +<h4 id="Linux">Linux</h4> + +<p>If Firefox is already included in your Linux distribution, or if you have installed Firefox with the package manager of your Linux distribution:</p> + +<ol> + <li>At the top of the Firefox window, click on the File menu and select Quit.</li> + <li>In Terminal run <code>firefox --ProfileManager</code></li> +</ol> + +<p>If the Profile Manager window does not open, Firefox may have been running in the background, even though it was not visible. Close all instances of Firefox, or restart the computer and then try again.</p> + +<h4 id="macOS">macOS</h4> + +<ol> + <li>Run the <em>Terminal</em> application, which is found in Applications/Utilities.</li> + <li>Type or paste in the path to Firefox, followed by <code>.app/Contents/MacOS/firefox</code>. For example, if Firefox is installed in the recommended location, you would enter <code>/Applications/Firefox.app/Contents/MacOS/firefox</code>.</li> + <li>If you have the path to your desired profile handy, enter a space character, followed by <code>-profile</code> followed by another space character, followed by the full path to the profile folder you wish to launch into. This will launch Firefox immediately. Otherwise, enter a space character followed by <code>--profilemanager</code>. This will present the Profile Manager window in which you can make your selection.</li> + <li>Hit <em>return.</em></li> +</ol> + +<p>Here is a complete example Terminal command from steps 2-3:</p> + +<pre>/Applications/Firefox.app/Contents/macOS/firefox -profile /Users/Suzie/Library/Application\ Support/Firefox/Profiles/r99d1z7c.default</pre> + +<p>If you want to do this frequently and more easily, you may wish to create an <em>Automator</em> application, as explained in <a href="http://sonnygill.net/mac/mac-multiple-firefox-profiles/">this tutorial</a>.</p> + +<h3 id="Criar_um_perfil">Criar um perfil</h3> + +<h4 id="Creating_a_profile_through_the_Profile_Manager">Creating a profile through the Profile Manager</h4> + +<p>These instructions should be the same for all operating systems.</p> + +<ol> + <li>To start the Create Profile Wizard, click "Create Profile..." in the Profile Manager.</li> + <li>Click Next and enter the name of the profile. Use a profile name that is descriptive, such as your personal name. This name is not exposed to the Internet.</li> + <li>You can also choose where to store the profile on your computer. To select storage location, click Choose Folder....</li> + <li>If you choose your folder location for the profile, select a new or empty folder. If you choose a folder that isn't empty, and you later remove the profile and choose the \"Delete Files\" option, everything inside that folder will be deleted.</li> + <li>To create the new profile, click Finish.</li> +</ol> + +<h4 id="Creating_a_profile_through_the_Firefox_browser">Creating a profile through the Firefox browser</h4> + +<p>You can create a new Firefox profile directly from the browser.</p> + +<ol> + <li>Type about:profiles into the browser URL search bar</li> + <li>On the page, click Create a New Profile button</li> + <li>Read the introduction, and click Next</li> + <li>Enter a profile name for your new Profile. Use a profile name that is descriptive, such as your personal name. This name is not exposed to the Internet.</li> + <li>Optionally, to change where the profile will be stored on your computer, click Choose Folder...</li> + <li>To create the new profile, click Finish.</li> +</ol> + +<h3 id="Eliminar_um_perfil">Eliminar um perfil</h3> + +<ol> + <li>In the Profile Manager, select the profile to remove, and click Delete Profile....</li> + <li>Confirm that you wish to delete the profile: + <ul> + <li>Don't Delete Files removes the profile from the Profile Manager yet retains the profile data files on your computer in the storage folder so that your information is not lost. "Don't Delete Files" is the preferred option, because it saves the old profile's folder, allowing you to recover the files to a new profile.</li> + <li>Delete Files removes the profile and its files, including the profile bookmarks, settings, passwords, etc.<br> + <br> + {{ warning("If you use the \"Delete Files\" option, the profile folder, and files will be deleted. This action cannot be undone.") }}</li> + <li>Cancel interrupts the profile deletion.</li> + </ul> + </li> +</ol> + +<h3 id="Renomear_um_perfil">Renomear um perfil</h3> + +<ol> + <li>In the Profile Manager, select the profile you want to rename, and then click "Rename Profile".</li> + <li>Enter a new name for the profile and click on OK.</li> +</ol> + +<div class="note"> +<p>Nota: The folder containing the files for the profile is not renamed.</p> +</div> + +<h2 id="Opções">Opções</h2> + +<h3 id="Trabalhar_off-line">Trabalhar off-line</h3> + +<p>Choosing this option loads the selected profile, and starts Firefox offline. You can view previously viewed web pages, and experiment with your profile.</p> + +<h3 id="Não_perguntar_no_arranque">Não perguntar no arranque</h3> + +<p>If you have multiple profiles, Firefox prompts you for the profile to use each time you start Firefox. Select this option to allow Firefox to load the selected profile, without prompting at startup.</p> + +<div class="note"> +<p>Nota: To access other profiles after selecting this option, you must start the Profile Manager first.</p> +</div> + +<h2 id="Utilizar_os_perfis">Utilizar os perfis</h2> + +<h3 id="Windows_2">Windows</h3> + +<p>If you want to have the profile manager to pop up each time you start Firefox, so you can choose a profile, you will need to edit the "Target" of the launch icon. To do this:</p> + +<ol> + <li>Right-click the icon and choose "Properties".</li> + <li>When the properties dialog box pops up, you should see a "Target" text field that you can edit, and it should show the current file path.</li> + <li>After the closing quote, add <code>-ProfileManager</code>.</li> + <li>Click Ok.</li> +</ol> + +<p>Now whenever you double click that icon, the profile manager should appear, allowing you to choose which profile you'd like to use.</p> + +<p>If you want individual icons to launch specific profiles, you will need to edit the "Target" of each icon. To do this:</p> + +<ol> + <li>Right-click the icon and choose "Properties".</li> + <li>When the properties dialog box pops up, you should see a "Target" text field that you can edit, and it should show the current file path.</li> + <li>To permanently set a specific profile, add <code>-p PROFILE_NAME</code> to the target path, but outside of the quotes, replacing "PROFILE_NAME" with the actual profile name you chose.</li> + <li>If you would also like to allow multiple instances of Firefox to run at the same time, add <code>-no-remote</code> after the profile name.</li> +</ol> + +<p>Once you are all done, click Ok. Do this for each icon you'd like to have a specific profile for. Once done, each one should automatically start with the specified profile<code>.</code></p> + +<h3 id="Linux_2">Linux</h3> + +<p>There is no extremely straightforward way to create custom application launchers in Gnome 3 like there was in Gnome 2. The following tutorial will help get you going overall: <a class="external" href="https://blog.randell.ph/how-to-create-custom-application-launchers-in-gnome-3/" title="How to create custom application launchers in gnome 3">Gnome 3 Custom application launcher</a>. Once you get to the point of adding a new item, you can have the profile dialog show up every time or set the launcher to launch a specific profile.</p> + +<p>If you want to have the profile manager to pop up each time you start Firefox, so you can choose a profile, you will need to set the command line for your new launcher.</p> + +<ol> + <li>Set the "command" text field to target the executable file, likely "/usr/bin/firefox", and add the <code>-p</code> parameter.</li> +</ol> + +<p>If you want individual icons to launch specific profiles, you will need to set the command line for your new launcher. To do this:</p> + +<ol> + <li>Set the "command" text field to target the executable file, likely "/usr/bin/firefox", and add the <code>-p PROFILE_NAME</code> parameter, replacing "PROFILE_NAME" with the specific profile.</li> + <li>Repeat as necessary, for each additional profile you want to set.</li> + <li>If you would also like to allow multiple instances of Firefox to run at the same time, add "-no-remote" after the profile name.</li> +</ol> + +<h3 id="Mac_OS_X_2">Mac OS X</h3> + +<p>You can find a useful tutorial to set up custom launchers here: <a href="https://spf13.com/post/managing-multiple-firefox-profiles-in-os-x/" title="Managing Multiple Firefox Profiles in OSX">Managing Multiple Firefox Profiles in OSX</a>. Do note it's best to follow all steps in the "Creating the scripts" section, including the "edit Info.plist" step. Leave off the profile name if you want the profile selector to show up every time you launch.</p> + +<h2 id="Configurar_vários_perfis_para_diferentes_canais_do_Firefox">Configurar vários perfis para diferentes canais do Firefox</h2> + +<p>This section will be especially helpful if you are a developer, wanting to work with multiple channels, and each having their separate launcher.</p> + +<h3 id="Windows_3">Windows</h3> + +<p>In Windows, the Developer and Nightly builds get their own directory in the "Programs" folder, so you don't have to worry about where to store the downloaded files. However, all three will attempt to use the same profile by default. You won't want to keep this behavior, because the different channels have different levels of features. To set each launcher, follow the Windows instructions at <a href="#Windows">Windows Launcher</a>.</p> + +<h3 id="Linux_3">Linux</h3> + +<p>In Linux, things aren't as automatically set up. You will likely get a prompt to download a tar.bz2 file to extract from. Extract the files to a new directory, and use the new launcher instructions from <a href="#Linux">here</a>. The only change you will need to make is the command path. You will want to set it to the directory where you extracted the Firefox channel's tar.bz2 file, and the executable "firefox" file located within this directory. The remaining profile assignment methods will remain the same. You will want to, for sure, add the <code>-no-remote</code> part to the end of the command field, so that you could run multiple instances at the same time.</p> + +<h3 id="Mac_OS_X_3">Mac OS X</h3> + +<p>You can find a useful tutorial to set up custom launchers here: <a href="https://spf13.com/post/managing-multiple-firefox-profiles-in-os-x/" title="Managing Multiple Firefox Profiles in OSX">Managing Multiple Firefox Profiles in OSX</a>. Do note it's best to follow all steps in the "Creating the scripts" section, including the "edit Info.plist" step. Also, you'll want to change the path in the do shell script to point to the correct .app file for the Firefox channel you want to target.</p> diff --git a/files/pt-pt/mozilla/firefox/multiprocess_firefox/cross_process_object_wrappers/index.html b/files/pt-pt/mozilla/firefox/multiprocess_firefox/cross_process_object_wrappers/index.html new file mode 100644 index 0000000000..d6efcd07ea --- /dev/null +++ b/files/pt-pt/mozilla/firefox/multiprocess_firefox/cross_process_object_wrappers/index.html @@ -0,0 +1,157 @@ +--- +title: Cross Process Object Wrappers +slug: Mozilla/Firefox/Multiprocess_Firefox/Cross_Process_Object_Wrappers +translation_of: Mozilla/Firefox/Multiprocess_Firefox/Cross_Process_Object_Wrappers +--- +<div>{{FirefoxSidebar}}</div><div class="summary"> +<p>Este documento descreve <em>Cross Process Object Wrappers</em> (CPOWs), que permite ao código de <em>chrome </em>aceder sincronamente ao conteúdo no 'Multiprocessos do Firefox'.</p> +</div> + +<div class="warning"> +<p>Note that from Firefox 47 onwards, <a href="/en-US/Firefox/Multiprocess_Firefox/Cross_Process_Object_Wrappers#Safe_and_unsafe_CPOWs">unsafe CPOW usage</a> is no longer permitted in browser code. If browser code tries an unsafe CPOW operation, the browser will throw an exception and you'll see an "unsafe CPOW usage forbidden” error in the <a href="/en-US/docs/Tools/Browser_Console">Browser Console</a>.</p> + +<p>Add-on code is still allowed to use CPOWs "unsafely". However, if an add-on passes a CPOW into a platform API, and that platform API then attempts an unsafe operation on it, this will throw an exception. So as a general rule, add-ons should avoid passing CPOWs into non-addon code.</p> +</div> + +<p>In multiprocess Firefox, chrome code runs in a different process from web content. So chrome code can't directly interact with web content: instead, it must factor out the code that interacts with web content into separate scripts that are called frame scripts.</p> + +<p>Chrome code can load frame scripts into the content process using the message manager, and can then communicate with them using a message-passing API. To learn more about this, see the documentation on using the <a href="/en-US/docs/The_message_manager">message manager</a>.</p> + +<p><strong>Chrome to content messaging must be asynchronous</strong>. This is because the chrome process runs the Firefox UI, so if it were blocked by the content process, then a slow content process could cause Firefox to become unresponsive to users.<br> + <br> + Converting synchronous code to be asynchronous can be difficult and time-consuming. As a migration aid, the messaging framework enables frame scripts to make content objects available to chrome through a wrapper called a Cross Process Object Wrapper, also known as a CPOW. However, although CPOWs are convenient, they have <a href="/en-US/docs/Cross_Process_Object_Wrappers#Limitations_of_CPOWs">serious limitations and can cause responsiveness problems</a>, so should only be used when necessary and only as a migration aid.</p> + +<h2 id="Passagem_de_CPOWs_de_frame_scripts">Passagem de CPOWs de <em>frame scripts</em></h2> + +<p>Frame scripts can send messages to chrome using one of two global functions: <a href="/en-US/docs/The_message_manager#Content_to_chrome"><code>sendAsyncMessage()</code> or <code>sendSyncMessage()</code></a>. The optional third parameter to each of these functions is an object whose properties are objects to wrap. For example, this frame script sends a DOM node to chrome when the user clicks it, as the <code>clicked</code> property of the third argument:</p> + +<pre class="brush: js">// frame script +addEventListener("click", function (event) { + sendAsyncMessage("my-e10s-extension-message", {}, { clicked : event.target }); +}, false);</pre> + +<p>In the chrome script, the DOM node is now accessible through a Cross Process Object Wrapper, as a property of the <code>objects</code> property of the message. The chrome script can get and set the wrapped object's properties and call its functions:</p> + +<pre class="brush: js">// chrome script +windowMM.addMessageListener("my-e10s-extension-message", handleMessage); + +function handleMessage(message) { + let wrapper = message.objects.clicked; + console.log(wrapper.innerHTML); + wrapper.innerHTML = "<h2>Modified by chrome!</h2>" + wrapper.setAttribute("align", "center"); +}</pre> + +<h2 id="CPOWs_gerados_automaticamente">CPOWs gerados automaticamente</h2> + +<p>Add-ons that have not declared themselves multiprocess compatible are set up with a number of <a href="/en-US/Firefox/Multiprocess_Firefox/Limitations_of_chrome_scripts#Compatibility_shims">compatibility shims</a>. One of these shims provides the following behavior: whenever chrome code tries to access content directly (for example, through <a href="/en/docs/Working_with_windows_in_chrome_code#The_content_shortcut"><code>window.content</code></a> or <a href="/en-US/docs/Mozilla/Tech/XUL/browser#p-contentDocument"><code>browser.contentDocument</code></a>), it is given back a CPOW that wraps the content object. This means that examples like this will actually work, even in multiprocess Firefox:</p> + +<pre class="brush: js">gBrowser.selectedBrowser.contentDocument.body.innerHTML = "replaced by chrome code";</pre> + +<p>It's still important to keep in mind, though, that this is access through a CPOW and not direct access to content.</p> + +<h2 id="CPOWs_bidirecionais">CPOWs bidirecionais</h2> + +<p>A common pattern is for chrome code to access content objects and add event listeners to them. To deal with this, CPOWs are bidirectional. This means that if content passes a CPOW to the chrome process, the chrome process can synchronously pass objects (such as event listener functions) into functions defined in the CPOW.</p> + +<p>This means you can write code like this:</p> + +<pre class="brush: js">// frame script + +/* +On mouseover, send the button to the chrome script as a CPOW. +*/ + +var button = content.document.getElementById("click-me"); + +button.addEventListener("mouseover", function (event) { + sendAsyncMessage("my-addon-message", {}, { element : event.target }); +}, false);</pre> + +<pre class="brush: js">// chrome script + +/* +Load the frame script, then listen for the message. +When we get the message, extract the CPOW and add +a function as a listener to the button's "click" event. +*/ + + browserMM.loadFrameScript("chrome://my-addon/content/frame-script.js", false); + browserMM.addMessageListener("my-addon-message", function(message) { + let wrapper = message.objects.element; + wrapper.addEventListener("click", function() { + console.log("they clicked"); + }); + }); +</pre> + +<h2 id="Mapear_conteúdo_de_documentos_para_navegadores_XUL">Mapear conteúdo de documentos para navegadores XUL</h2> + +<p>A common pattern is to get the XUL <a href="/en-US/docs/XUL/browser"><code><browser></code></a> that corresponds to a content document. To enable this, <code>gBrowser.getBrowserForDocument</code> and <code>gBrowser.getBrowserForContentWindow</code> can be passed a CPOW for the content document and content window, respectively, and return the XUL <code><browser> </code>that these documents / windows belong to. Both return <code>null</code> if no such browser can be found.</p> + +<h2 id="Limitações_de_CPOWs">Limitações de CPOWs</h2> + +<p>Although CPOWs can be convenient they have several major limitations, which are listed below.</p> + +<h3 id="CPOWs_e_APIs_de_plataforma">CPOWs e APIs de plataforma</h3> + +<p>You can't pass CPOWs into platform APIs that expect to receive DOM objects. For example, you can't pass a CPOW into <a href="http://dxr.mozilla.org/mozilla-central/source/dom/interfaces/base/nsIFocusManager.idl"><code>nsIFocusManager.setFocus()</code></a>.</p> + +<p>Also, from Firefox 47 onwards, browser code can no longer perform <a href="/en-US/Firefox/Multiprocess_Firefox/Cross_Process_Object_Wrappers#Safe_and_unsafe_CPOWs">unsafe CPOW operations</a>. This means that as an add-on developer, you should not pass CPOWs into browser APIs.</p> + +<h3 id="Reação_de_Chrome">Reação de <em>Chrome</em></h3> + +<p>The lack of a synchronous API on the chrome side is intentional: because the chrome process runs the Firefox UI, any responsiveness problems affect the whole browser. By making the chrome process block on the content process, CPOWs break this principle and allow unresponsive content process to make the whole browser unresponsive.</p> + +<p>Consulte em baixo <strong>CPOWs seguros e inseguros</strong> para mais sobre isto.</p> + +<h3 id="Desempenho">Desempenho</h3> + +<p>Although the wrapper looks just like an object completely contained in the chrome script scope, it's really just a reference to an object in the content process. When you access a property of the wrapper, it sends a synchronous message to the content process and returns the result. This means it is many times slower to use than an object.</p> + +<h3 id="Ordenação_de_mensagem">Ordenação de mensagem</h3> + +<p>CPOWs can violate assumptions you might make about message ordering. Consider this code:</p> + +<pre class="brush: js">mm.addMessageListener("GotLoadEvent", function (msg) { + mm.sendAsyncMessage("ChangeDocumentURI", {newURI: "hello.com"}); + let uri = msg.objects.document.documentURI; + dump("Received load event: " + uri + "\n"); +}); +</pre> + +<p>This sends a message asking the frame script to change the current document URI, then accesses the current document URI via a CPOW. You might expect the value of <code>uri</code> to come back as "hello.com". But it might not: in order to avoid deadlocks, CPOW messages can bypass normal messages and be processed first. It’s possible that the request for the documentURI property will be processed before the "ChangeDocumentURI" message, in which case <code>uri</code> will have its previous value.<br> + <br> + For this reason, it’s best not to mix CPOWs with normal message manager messages. It’s also a bad idea to use CPOWs for anything security-related, since you may get results that are not consistent with surrounding code that might use the message manager.</p> + +<h2 id="CPOWs_seguros_e_inseguros">CPOWs seguros e inseguros</h2> + +<p>The main reason CPOWs can be bad for responsiveness is that they make the chrome process block on the content process.</p> + +<p>Essentially, the problem is this: suppose the content process is busy with some long-running operation (for example, garbage collection). In multiprocess Firefox, the browser UI is still responsive, because it's running in a different process. But if the chrome process then tries to use a CPOW, the chrome process will block until the content process is ready to respond. Suddenly, what looked like a simple property access could block the UI for a noticeable amount of time:</p> + +<p><img alt="" src="https://mdn.mozillademos.org/files/12485/unsafe-cpow.svg" style="display: block; height: 579px; margin-left: auto; margin-right: auto; width: 897px;"></p> + +<p>There is one scenario, though, in which this is not a problem: when the content process is already blocking on a synchronous message it sent to the chrome process.</p> + +<p>The content process is blocked anyway waiting for the chrome process, so there's no chance, in this situation, that the CPOW call will block on some long-running activity in the content process. The content process can respond immediately to the CPOW call:</p> + +<p><br> + <img alt="" src="https://mdn.mozillademos.org/files/12481/safe-cpow.svg" style="display: block; height: 472px; margin-left: auto; margin-right: auto; width: 640px;"></p> + +<p>There is still a performance cost to the CPOW in this situation, because the CPOW call is an IPC call instead of a simple property access in the same process. However, the potential impact on responsiveness is much smaller.</p> + +<p>Also, in this situation, the content process is in a known state. We know it's blocked waiting for the synchronous message to return, and we know that won't change during the CPOW call. This makes the CPOW call much safer than it would otherwise be.</p> + +<p>This situation is thus called "safe CPOW usage". All other uses of CPOWs are called "unsafe CPOW usage".</p> + +<p>Consulyat também:</p> + +<ul> + <li><a href="https://mikeconley.ca/blog/2015/02/17/on-unsafe-cpow-usage-in-firefox-desktop-and-why-is-my-nightly-so-sluggish-with-e10s-enabled/">https://mikeconley.ca/blog/2015/02/17/on-unsafe-cpow-usage-in-firefox-desktop-and-why-is-my-nightly-so-sluggish-with-e10s-enabled/</a></li> + <li><a href="http://blog.lassey.us/2015/01/10/unsafe-cpow-usage/">http://blog.lassey.us/2015/01/10/unsafe-cpow-usage/</a></li> +</ul> + +<p> </p> + +<p> </p> diff --git a/files/pt-pt/mozilla/firefox/multiprocess_firefox/depuracao_de_frame_scripts/index.html b/files/pt-pt/mozilla/firefox/multiprocess_firefox/depuracao_de_frame_scripts/index.html new file mode 100644 index 0000000000..6f22e9a0b7 --- /dev/null +++ b/files/pt-pt/mozilla/firefox/multiprocess_firefox/depuracao_de_frame_scripts/index.html @@ -0,0 +1,56 @@ +--- +title: Depuração de frame scripts +slug: Mozilla/Firefox/Multiprocess_Firefox/Depuracao_de_frame_scripts +tags: + - Caixa de ferramentas de Conteúdo de Navegador + - Multiprocessos do Firefox +translation_of: Mozilla/Firefox/Multiprocess_Firefox/Debugging_frame_scripts +--- +<div>{{FirefoxSidebar}}</div><div class="geckoVersionNote"> +<p>A Caixa de Ferramentas de Conteúdo de Navegador só está disponível no Firefox Nightly, e apenas se extiver a executar o Firefox no modo de multiprocessos.</p> +</div> + +<p>You can use the Browser Content Toolbox to debug frame scripts. The Browser Content Toolbox is a separate window that includes some of the standard <a href="/en-US/docs/Tools">Firefox Developer Tools</a> - specifically: the <a href="/en-US/docs/Web/API/Console">console</a>, the <a href="/en-US/docs/Tools/Debugger">JavaScript debugger</a>, and <a href="/en-US/docs/Tools/Scratchpad">Scratchpad</a> - but attaches them to the browser's content process. This means you can debug the frame scripts in your add-on.</p> + +<h2 id="Abrir_a_Caixa_de_Ferrmanetas_de_Conteúdo_de_Navegador">Abrir a Caixa de Ferrmanetas de Conteúdo de Navegador</h2> + +<p>{{EmbedYouTube("Cg6X_zIu7Xk")}}</p> + +<p>To open the Browser Content Toolbox, you'll need to:</p> + +<ul> + <li>be running Firefox Nightly</li> + <li>have multiprocess Firefox enabled: open the "Preferences" page, select "Enable E10S (multi-process)", and restart. As a visual indicator that you're running multiprocess Firefox, the titles of remote tabs are underlined.</li> + <li>enable the <a href="/en-US/docs/Tools/Tools_Toolbox#Settings">"chrome and add-on debugging" and "remote debugging" options in the Firefox Developer Toolbox Options</a></li> +</ul> + +<p>You should now see an item labeled "Browser Content Toolbox" in the Developer submenu in the Firefox Menu (or Tools menu if you display the menu bar or are on OS X). It opens in a separate window:</p> + +<p><img alt="" src="https://mdn.mozillademos.org/files/9761/browser-content-toolbox.png" style="display: block; height: 854px; margin-left: auto; margin-right: auto; width: 723px;">If you've used the <a href="/en-US/docs/Tools/Tools_Toolbox">Firefox Developer Tools</a> before, this should look pretty familiar.</p> + +<p>Along the top is a row of tabs that you can use to switch the active tool. Currently, we only support the <a href="/en-US/docs/Web/API/Console">Console</a>, the <a href="/en-US/docs/Tools/Debugger">Debugger</a>, and <a href="/en-US/docs/Tools/Scratchpad">Scratchpad</a> in the Browser Content Toolbox. At the right of this row are three buttons that activate the <a href="/en-US/docs/Tools/Web_Console#The_split_console">split console</a>, open settings, and close the toolbox.</p> + +<p>The rest of the toolbox is taken up with the tool you've currently selected.</p> + +<h2 id="Utilização">Utilização</h2> + +<p>{{EmbedYouTube("XF0ULNnNOxg")}}</p> + +<h3 id="O_Depurador">O Depurador</h3> + +<p>The Debugger lists all the scripts that are loaded into the content process. You'll find your frame scripts listed under the chrome:// URL you registered for them:</p> + +<p><img alt="" src="https://mdn.mozillademos.org/files/9771/browser-content-toolbox-listing.png" style="display: block; margin-left: auto; margin-right: auto; width: 723px;">You can set breakpoints, of course, and do all the other <a href="/en-US/docs/Tools/Debugger">things supported by the debugger</a>.</p> + +<h3 id="A_Consola">A Consola</h3> + +<p>The Console logs output from your frame scripts. If you want to use it to evaluate JavaScript in your frame script's scope, there's a trick you need to know:</p> + +<ul> + <li>Set a breakpoint in your frame script.</li> + <li>When you hit the breakpoint, switch to the Console, or activate the <a href="/en-US/docs/Tools/Web_Console#The_split_console">split console</a> by pressing "Escape".</li> +</ul> + +<p>Now the console's scope is your frame script's scope, and you can interact directly with it:</p> + +<p><img alt="" src="https://mdn.mozillademos.org/files/9769/browser-content-toolbox-debugging.png" style="display: block; margin-left: auto; margin-right: auto; width: 839px;"></p> diff --git a/files/pt-pt/mozilla/firefox/multiprocess_firefox/gestor_de_mensagens/index.html b/files/pt-pt/mozilla/firefox/multiprocess_firefox/gestor_de_mensagens/index.html new file mode 100644 index 0000000000..88d8419e69 --- /dev/null +++ b/files/pt-pt/mozilla/firefox/multiprocess_firefox/gestor_de_mensagens/index.html @@ -0,0 +1,74 @@ +--- +title: Gestor de mensagens +slug: Mozilla/Firefox/Multiprocess_Firefox/Gestor_de_mensagens +tags: + - API + - Guia(2) + - JavaScript +translation_of: Mozilla/Firefox/Multiprocess_Firefox/Message_Manager +--- +<div>{{FirefoxSidebar}}</div><p>Os gestores de mensagens fornecem uma maneira para o código de <em>JavaScript</em> <em>chrome</em>-privilegiado para comunicar através dos limites de processo. Eles são particularmente úteis para permitir que código do <em>chrome</em>, incluindo o código do navegador e o código de extensão, para aceder ao conteúdo da <em>Web </em>enquanto o navegador está a executar conteúdo da <em>Web</em> num processo separado</p> + +<p>Message managers provide a way for chrome-privileged JavaScript code to communicate across process boundaries. They are particularly useful for allowing chrome code, including the browser's code and extension's code, to access web content while the browser is running web content in a separate process.</p> + +<p>These guides explain how to use message managers in multiprocess Firefox.</p> + +<p>Note that none of this requires multiprocess Firefox: everything described here will work with single-process Firefox, so the same code will work on both variants.</p> + +<hr> +<h2 id="Guias">Guias</h2> + +<div class="column-container"> +<div class="column-half"> +<dl> + <dt><a href="/en-US/Firefox/Multiprocess_Firefox/Message_Manager/Message_manager_overview">Message manager overview</a></dt> + <dd> </dd> + <dt><a href="/en-US/Firefox/Multiprocess_Firefox/Message_Manager/Frame_script_loading_and_lifetime">Frame script loading and lifetime</a></dt> + <dd> </dd> + <dt><a href="/en-US/Firefox/Multiprocess_Firefox/Message_Manager/Communicating_with_frame_scripts">Communicating with frame scripts</a></dt> + <dd> </dd> + <dt><a href="/en-US/Firefox/Multiprocess_Firefox/Message_Manager/Performance">Performance Best Practices</a></dt> + <dd> </dd> +</dl> +</div> + +<div class="column-half"> +<dl> + <dt><a href="/en-US/Firefox/Multiprocess_Firefox/Message_Manager/Frame_script_environment">Frame script environment</a></dt> + <dd> </dd> + <dt><a href="/en-US/Firefox/Multiprocess_Firefox/Message_Manager/_Limitations_of_frame_scripts">Limitations of frame scripts</a></dt> + <dd> </dd> + <dt><a href="/en-US/Firefox/Multiprocess_Firefox/Message_Manager/Process_scripts">Process scripts</a></dt> + <dd> </dd> +</dl> +</div> +</div> + +<hr> +<h2 id="Referência_de_API">Referência de API</h2> + +<div class="column-container"> +<div class="column-half"> +<dl> + <dt><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIFrameScriptLoader">nsIFrameScriptLoader</a></dt> + <dd> </dd> + <dt><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIMessageListenerManager">nsIMessageListenerManager</a></dt> + <dd> </dd> + <dt><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIMessageBroadcaster">nsIMessageBroadcaster</a></dt> + <dd> </dd> + <dt><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIMessageSender">nsIMessageSender</a></dt> + <dd> </dd> +</dl> +</div> + +<div class="column-half"> +<dl> + <dt><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsISyncMessageSender">nsISyncMessageSender</a></dt> + <dd> </dd> + <dt><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIContentFrameMessageManager">nsIContentFrameMessageManager</a></dt> + <dd> </dd> + <dt><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIProcessScriptLoader">nsIProcessScriptLoader</a></dt> + <dd> </dd> +</dl> +</div> +</div> diff --git a/files/pt-pt/mozilla/firefox/multiprocess_firefox/glossario/index.html b/files/pt-pt/mozilla/firefox/multiprocess_firefox/glossario/index.html new file mode 100644 index 0000000000..22bb1b5b57 --- /dev/null +++ b/files/pt-pt/mozilla/firefox/multiprocess_firefox/glossario/index.html @@ -0,0 +1,36 @@ +--- +title: Glossário +slug: Mozilla/Firefox/Multiprocess_Firefox/Glossario +translation_of: Mozilla/Firefox/Multiprocess_Firefox/Glossary +--- +<div>{{FirefoxSidebar}}</div><div class="column-container"> +<div class="column-half"> +<dl> + <dt>Child-to-parent CPOWs</dt> + <dd>CPOWs that refer to objects in the parent (chrome) process.</dd> + <dt>Chrome process (also called the parent process)</dt> + <dd>The operating system process that runs the Firefox UI, including the toolbar, dialog boxes, and features like session restoration. All add-on code that doesn't run in frame scripts runs here.</dd> + <dt>Content process (also called the child process)</dt> + <dd>The operating system process that runs web content, in multiprocess Firefox. Code for frame scripts runs in this process.</dd> + <dt>Content scripts</dt> + <dd>Deprecated term for frame scripts.</dd> + <dt>CPOWs</dt> + <dd>CPOW stands for Cross Process Object Wrapper. A CPOW gives chrome code synchronous access to content objects, as a migration aid. <a href="/en-US/docs/Cross_Process_Object_Wrappers">See more about CPOWs</a>.</dd> +</dl> +</div> + +<div class="column-half"> +<dl> + <dt>Frame scripts</dt> + <dd>When chrome code needs to interact with web content, it factors the code that needs to access content into separate scripts, and loads them into the content process. These separate scripts are called frame scripts. We used to call these scripts "content scripts" but have deprecated that term.</dd> + <dt>Message manager</dt> + <dd>Message managers enable chrome code to load frame scripts into content processes, and communicate with them using a message-passing API. <a href="/en-US/docs/The_message_manager">See more about message managers</a>.</dd> + <dt>Parent-to-child CPOWs</dt> + <dd>CPOWs that refer to objects that live in the child (content) process.</dd> + <dt>Shim</dt> + <dd>...</dd> +</dl> +</div> +</div> + +<p> </p> diff --git a/files/pt-pt/mozilla/firefox/multiprocess_firefox/index.html b/files/pt-pt/mozilla/firefox/multiprocess_firefox/index.html new file mode 100644 index 0000000000..8bf746e32a --- /dev/null +++ b/files/pt-pt/mozilla/firefox/multiprocess_firefox/index.html @@ -0,0 +1,79 @@ +--- +title: Multiprocessos do Firefox +slug: Mozilla/Firefox/Multiprocess_Firefox +tags: + - Firefox +translation_of: Mozilla/Firefox/Multiprocess_Firefox +--- +<div>{{FirefoxSidebar}}</div> + +<p>Nas versões antigas do Firefox para PC, todo o navegador era executado num único processo do sistema operativo. Em particular, o <em>JavaScript </em>que executa a IU do navegador (também conhecido como "código do chrome") executa o mesmo processo como o código nas páginas da <em>Web</em> (também conhecido como "conteúdo" ou "conteúdo da <em>Web</em>").<br> + <br> + As últimas versões do Firefox executam a IU do navegador num processo separado do conteúdo da <em>Web</em>. Na primeira iteração dessa arquitetura, todos os separadores do navegador funcionam no mesmo processo e a IU do navegador é executada num processo diferente. Em iterações futuras, nós esperamos ter mais doque um processo de conteúdo. O projeto que está a distribuir 'Multiprocessos do Firefox' é chamado de <em> Electrolysis</em>, por vezes abreviado para <em>e10s</em>.</p> + +<p>As páginas da <em>Web</em> normais não são afetadas pelo 'Multiprocessos do Firefox'. As pessoas que trabalham no próprio Firefox e os programadores de extras do Firefox não serão afetados se o seu código depende de ser capaz de aceder diretamente ao conteúdo da <em>Web</em>.</p> + +<p>Em vez de aceder ao conteúdo da <em>web</em> diretamente, o código do <em>chrome</em> terá que utilizar o <a href="https://developer.mozilla.org/Firefox/Multiprocess_Firefox/Message_manager">gestor de mensagens</a>. Para ajudar a facilitar esta transição, nós implementamos <em><a href="https://developer.mozilla.org/Firefox/Multiprocess_Firefox/Cross_Process_Object_Wrappers">Cross Process Object Wrappers</a></em> e alguns <a href="/Firefox/Multiprocess_Firefox/Limitations_of_chrome_scripts#Compatibility_shims"><em>shims</em> de compatibilidade para os programadores de extras</a>. Se é um programador de extras perguntando-se a si mesmo se está ou não afetado por esta alteração, consulte o <a href="/pt-PT/docs/Archive/Add-ons/Trabalhar_com_multiprocessos_Firefox">guia para trabalhar com multiprocessos do Firefox</a>.</p> + +<hr> +<div class="column-container"> +<div class="column-half"> +<dl> + <dt><a href="/pt-PT/Firefox/Multiprocess_Firefox/Resumo_técnico">Resumo técnico</a></dt> + <dd>A very high-level view of how multiprocess Firefox is implemented.</dd> + <dt><a href="/en-US/Firefox/Multiprocess_Firefox/Web_content_compatibility">Guia de compatibilidade do conteúdo da Web</a></dt> + <dd>Guidelines and details on potential Web site compatibility issues that may arise due to the transition. Tip: there aren't very many!</dd> + <dt><a href="/pt-PT/Firefox/Multiprocess_Firefox/Glossario">Glossário</a></dt> + <dd>Uma referência para o gíria utilizada em 'Multiprocessos do Firefox'.</dd> + <dt><a href="/Firefox/Multiprocess_Firefox/Message_Manager">Gestor de mensagens</a></dt> + <dd>Complete guide to the objects used to communicate between chrome and content.</dd> + <dt><a href="/en-US/Mozilla/Add-ons/SDK/Guides/Multiprocess_Firefox_and_the_SDK">Extras baseados em SDK</a></dt> + <dd>How to migrate add-ons developed using the Add-on SDK.</dd> + <dt><a href="/pt-PT/Firefox/Multiprocess_Firefox/Quais_os_URIs_que_carregam_e_onde">Quais os URIs que carregam e onde</a></dt> + <dd>A quick guide to which URIs - chrome:, about:, file:, resource: - are loaded into which process.</dd> +</dl> +</div> + +<div class="column-half"> +<dl> + <dt><a href="/Firefox/Multiprocess_Firefox/Motivation">Motivação</a></dt> + <dd>Why we are implementing multiprocess Firefox: performance, security, and stability.</dd> + <dt><a href="/Mozilla/Add-ons/Working_with_multiprocess_Firefox">Guia de migração de extras</a></dt> + <dd>If you are an add-on developer, find out if you are affected and how to update your code.</dd> + <dt><a href="/Firefox/Multiprocess_Firefox/Cross_Process_Object_Wrappers">Cross Process Object Wrappers</a></dt> + <dd>Cross Process Object Wrappers are a migration aid, giving chrome code synchronous access to content.</dd> + <dt><a href="/pt-PT/Firefox/Multiprocess_Firefox/Depuracao_de_frame_scripts">Depuração de processos do conteúdo</a></dt> + <dd>How to debug code running in the content process, including frame and process scripts.</dd> + <dt><a href="/docs/Mozilla/Firefox/Multiprocess_Firefox/Tab_selection_in_multiprocess_Firefox">Seleção de separador nos multiprocessos do Firefox</a></dt> + <dd>How switching tabs works in multiprocess Firefox.</dd> +</dl> +</div> +</div> + +<hr> +<div class="column-container"> +<div class="column-half"> +<dl> + <dt><a href="/pt-PT/Firefox/Multiprocess_Firefox/Limitacoes_de_chrome_scripts">Limitações de chrome scripts</a></dt> + <dd>Práticas que já não irão funcionar no código de <em>chrome</em>, e como as fixar.</dd> +</dl> +</div> + +<div class="column-half"> +<dl> + <dt><a href="/pt-PT/Firefox/Multiprocess_Firefox/Limitacoes_de_frame_scripts">Limitações de frame scripts</a></dt> + <dd>Práticas que já não irão funcionar dentro de <em>frame scripts</em>, e o que fazer.</dd> +</dl> +</div> +</div> + +<hr> +<h2 id="Contacte-nos">Contacte-nos</h2> + +<p>Saiba mais sobre o projeto, participe, ou coloque as suas perguntas.</p> + +<ul> + <li><strong>Página do Projeto de Electrolysis</strong> (EN): <a href="https://wiki.mozilla.org/Electrolysis">https://wiki.mozilla.org/Electrolysis</a></li> + <li><strong>IRC</strong>: #e10s on <a href="https://wiki.mozilla.org/IRC">irc.mozilla.org</a></li> + <li><strong>Lista de endereços/discussão</strong>: <a href="https://groups.google.com/forum/#!forum/mozilla.dev.tech.electrolysis">dev.tech.electrolysis</a></li> +</ul> diff --git a/files/pt-pt/mozilla/firefox/multiprocess_firefox/limitacoes_de_chrome_scripts/index.html b/files/pt-pt/mozilla/firefox/multiprocess_firefox/limitacoes_de_chrome_scripts/index.html new file mode 100644 index 0000000000..f761b2c6f7 --- /dev/null +++ b/files/pt-pt/mozilla/firefox/multiprocess_firefox/limitacoes_de_chrome_scripts/index.html @@ -0,0 +1,215 @@ +--- +title: Limitações de "chrome scripts" +slug: Mozilla/Firefox/Multiprocess_Firefox/Limitacoes_de_chrome_scripts +translation_of: Mozilla/Firefox/Multiprocess_Firefox/Limitations_of_chrome_scripts +--- +<div>{{FirefoxSidebar}}</div><p>This page describes patterns that used to work in the chrome process that will no longer work in multiprocess Firefox. These are the sorts of things that will break an old add-on in multiprocess Firefox. The fix is generally some variant of "do that in a frame script loaded into the content process".</p> + +<p>This is one of a pair of articles: the other one lists <a href="/en-US/Firefox/Multiprocess_Firefox/Limitations_of_frame_scripts">limitations of frame scripts</a>.</p> + +<h2 id="Compatibilidade_de_shims">Compatibilidade de <em>shims</em></h2> + +<p>For many of the patterns described here we've implemented compatibility shims so the patterns still work. For example: whenever extensions try to access web content from the chrome process, the browser will return a <a href="https://developer.mozilla.org/en-US/docs/Cross_Process_Object_Wrappers">Cross Process Object Wrapper</a> that gives the chrome code synchronous access to the content.</p> + +<p>You'll get the shims for your add-on by default, unless you set the <a href="/en-US/Add-ons/Install_Manifests#multiprocessCompatible"><code>multiprocessCompatible</code> flag in your add-on's install manifest</a>.</p> + +<p>However, these shims are not a substitute for migrating extensions:</p> + +<ul> + <li>they are only a temporary measure, and will be removed eventually</li> + <li>they can have a bad effect on responsiveness</li> + <li>there are likely to be edge cases in which they don't work properly</li> +</ul> + +<p>You can see all the places where your add-on uses compatibility shims by setting the <span><code>dom.ipc.shims.enabledWarnings</code> preference and watching the browser console as you use the add-on.</span></p> + +<p>The rest of this page documents patterns that don't work in multiprocess Firefox as well as how are shims try to paper over the problem. For each pattern we've noted:</p> + +<ul> + <li>whether a shim exists and what kind of behavior it provides</li> + <li>how to update your add-on so you don't need the shim</li> +</ul> + +<h2 id="gBrowser.contentWindow_window.content...">gBrowser.contentWindow, window.content...</h2> + +<h3 id="Sem_shim">Sem <em>shim</em></h3> + +<p>All APIs in the chrome process that provide direct access to content objects will no longer work. For example:</p> + +<pre class="brush: js">// chrome code + +gBrowser.contentWindow; // null + +gBrowser.contentDocument; // null + +gBrowser.selectedBrowser.contentWindow; // null + +window.content; // null + +content; // null +</pre> + +<p>As a special note, docshells live in the content process, so they are also inaccessible:</p> + +<pre>gBrowser.docShell; // null + +gBrowser.selectedBrowser.docShell; // null</pre> + +<h3 id="Com_shim">Com <em>shim</em></h3> + +<p>The shim will give you a <a href="/en-US/Firefox/Multiprocess_Firefox/Cross_Process_Object_Wrappers">CPOW</a> for the content object in these situations.</p> + +<p>In some situations, the content process may not be initialized when an add-on asks for access to its content. In this case, the shim will return a JavaScript object that looks somewhat like a window or a document for about:blank. However, this "dummy" object is completely static and only exposes a few of the normal properties that windows and documents have. For this reason, add-ons that try to access content objects in fresh <browser> elements may run into trouble.</p> + +<p>To make the shim unnecessary: factor the code that needs to access content into a separate script, load that script into the content process as a frame script, and communicate between the chrome script and the frame script using the message-passing APIs. See the article on <a href="/en-US/Firefox/Multiprocess_Firefox/The_message_manager">using the message manager</a>.</p> + +<h2 id="Limitações_de_CPOWs">Limitações de CPOWs</h2> + +<p><a href="/en-US/Firefox/Multiprocess_Firefox/Cross_Process_Object_Wrappers">Cross process object wrappers</a> (CPOWs) are a migration aid giving chrome code synchronous access to content objects. However, there are various <a href="/en-US/Firefox/Multiprocess_Firefox/Cross_Process_Object_Wrappers#Limitations_of_CPOWs">limitations on the kinds of things you can do with a CPOW</a>.</p> + +<div class="warning"> +<p>Note that from Firefox 47 onwards, <a href="https://developer.mozilla.org/en-US/Firefox/Multiprocess_Firefox/Cross_Process_Object_Wrappers#Safe_and_unsafe_CPOWs">unsafe CPOW usage</a> is no longer permitted in browser code. If browser code tries an unsafe CPOW operation, the browser will throw an exception and you'll see an "unsafe CPOW usage forbidden” error in the <a href="https://developer.mozilla.org/en-US/docs/Tools/Browser_Console">Browser Console</a>.</p> + +<p>Add-on code is still allowed to use CPOWs "unsafely". However, if an add-on passes a CPOW into a platform API, and that platform API then attempts an unsafe operation on it, this will throw an exception. So as a general rule, add-ons should avoid passing CPOWs into non-addon code.</p> +</div> + +<h2 id="nsIContentPolicy">nsIContentPolicy</h2> + +<h3 id="Sem_shim_2">Sem <em>shim</em></h3> + +<p>In multiprocess Firefox, if you register the <code><a href="http://dxr.mozilla.org/mozilla-central/source/dom/base/nsIContentPolicy.idl">nsIContentPolicy</a></code> in the chrome process then it will never see any attempts to load web content, because they happen in the content process.</p> + +<h3 id="Com_shim_2">Com <em>shim</em></h3> + +<p>The shim enables you to add content policies in the chrome process. It transparently registers an <code>nsIContentPolicy</code> in the content process, whose <code>shouldLoad</code> just forwards to the chrome process. The content to check is forwarded as a <a href="/en-US/Firefox/Multiprocess_Firefox/Cross_Process_Object_Wrappers">CPOW</a>. The chrome process then checks the content against the policy supplied by the add-on, and forwards the response back to the child to be enforced.</p> + +<p>To make the shim unnecessary: define and register <code>nsIContentPolicy</code> in the content process. If you need to ensure that the policy is only registered once, use a <a href="/en-US/docs/User:wbamberg/Multiprocess_Firefox-2/Message_manager/Process_scripts">process script </a>to register the policy.</p> + +<h2 id="nsIWebProgressListener">nsIWebProgressListener</h2> + +<p>This API will work in the chrome process. There is a shim that gives you access to the <code>DOMWindow</code> property of the <a href="http://dxr.mozilla.org/mozilla-central/source/uriloader/base/nsIWebProgress.idl"><code>nsIWebProgress</code></a> object passed into <code>onStateChange</code>. However, the <code>DOMWindow</code> is passed asynchronously, so by the time the chrome process receives it, the DOM might have changed (for example, because code running in the content process modified it or we navigated to a different page). We're working on fixing this issue in <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1118880">bug 1118880</a>.</p> + +<p>Also note that unlike other shims, this shim is always active.</p> + +<p>Alternatively, you can use <code>nsIWebProgressListener</code> in the content process.</p> + +<h2 id="Observadores_no_processo_de_chrome">Observadores no processo de <em>chrome</em></h2> + +<p>Depending on the topic, you need to register observers in either the chrome process or in a frame script.</p> + +<p>For most topics you need to register observers in the chrome process.</p> + +<p>However, you must listen to <a href="/en/docs/Observer_Notifications#Documents"><code>content-document-global-created</code> and <code>document-element-inserted</code></a> in a frame script. <a href="http://dxr.mozilla.org/mozilla-central/source/xpcom/ds/nsIObserver.idl">Observers</a> for these topics get content objects as the <code>aSubject</code> argument to <code>observe()</code>, so notifications are not sent to the chrome process.</p> + +<p>There is a shim that will forward these two topics to the chrome process, sending <a href="/en-US/Firefox/Multiprocess_Firefox/Cross_Process_Object_Wrappers">CPOWs</a> as the <code>aSubject</code> argument.</p> + +<h3 id="Pedidos_de_HTTP">Pedidos de HTTP</h3> + +<p>You can't observe <a href="https://developer.mozilla.org/en/docs/Observer_Notifications#HTTP_requests">HTTP requests</a> in the content process. If you do, you'll get an error.<br> + <br> + If you do so in the chrome process, it will mostly work. The subject for the observer notification will be an <code><a href="http://dxr.mozilla.org/mozilla-central/source/netwerk/protocol/http/nsIHttpChannel.idl">nsIHttpChannel</a></code> as you would expect.</p> + +<p>A common pattern here is to use the <code>notificationCallbacks</code> property of the <code>nsIHttpChannel</code> to get the DOM window that initiated the load, like this:</p> + +<pre class="brush: js">observe: function (subject, topic, data) { + if (topic == "http-on-modify-request") { + var httpChannel = subject.QueryInterface(Ci.nsIHttpChannel); + var domWindow = httpChannel.notificationCallbacks.getInterface(Ci.nsIDOMWindow); + } +}</pre> + +<p>Or this:</p> + +<pre class="brush: js">observe: function (subject, topic, data) { + if (topic == "http-on-modify-request") { + var httpChannel = subject.QueryInterface(Ci.nsIHttpChannel); + var domWindow = httpChannel.notificationCallbacks.getInterface(Ci.nsILoadContext).associatedWindow; + } +}</pre> + +<p>In multiprocess Firefox these patterns will no longer work: the <code>getInterface</code> call will fail.</p> + +<p>In multiprocess Firefox, <code>notificationCallbacks</code> is a special object that tries to emulate the single-process <code>notificationsCallbacks</code> object as best it can. It will return a dummy <code>nsILoadContext</code> when asked, but any attempt to get a window out of it will fail.<br> + <br> + There is an outstanding bug (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1108827">bug 1108827</a>) to implement a shim here that will make <code>notificationCallbacks</code> a <a href="/en-US/Firefox/Multiprocess_Firefox/Cross_Process_Object_Wrappers">CPOW</a> for the objects in the content process.</p> + +<p>The correct way to access the DOM window is through a message manager. In an HTTP observer, you can get the browser message manager for the window using code like this:</p> + +<pre class="brush: js">observe: function (subject, topic, data) { + if (topic == "http-on-modify-request") { + var httpChannel = subject.QueryInterface(Ci.nsIHttpChannel); + var loadContext = httpChannel.notificationCallbacks.getInterface(Ci.nsILoadContext); + // topFrameElement is the <browser> element + var topFrameElement = loadContext.topFrameElement; + var browserMM = topFrameElement.messageManager; + console.log("browserMM: " + browserMM); + } +}</pre> + +<p>However, before Firefox 38, this technique will not work if multiprocess Firefox is disabled: specifically, <code>topFrameElement</code> will be null. This means that if you need to write code that works before Firefox 38 and on both multiprocess and non-multiprocess variants, you need to implement both paths:</p> + +<ul> + <li>test whether <code>topFrameElement</code> is null</li> + <li>if it is, you're running in single-process Firefox, and should use the old way</li> + <li>if it isn't, you're running in multiprocess Firefox and should use the new way</li> +</ul> + +<p>From Firefox 38 onwards, the topFrameElement approach always works.</p> + +<h2 id="Eventos_DOM">Eventos DOM</h2> + +<h3 id="Sem_shim_3">Sem <em>shim</em></h3> + +<p>In multiprocess Firefox, if you want to register an event listener on some content DOM node, that needs to happen in the content process.</p> + +<p>It used to be that if you registered a listener on the <a href="/en-US/docs/XUL/browser">XUL <code><browser></code></a> or <a href="/en-US/docs/XUL/tab"><code><tab></code></a> element that hosted some DOM content, then events in the content would bubble up to the XUL and you could handle them there. This no longer happens in multiprocess Firefox.</p> + +<h3 id="Com_shim_3">Com <em>shim</em></h3> + +<p>The shim intercepts chrome process code that adds listeners to XUL elements and sets up listeners in the content process, relaying the result back to the chrome process. The <a href="/en-US/docs/Web/API/Event"><code>Event</code></a> object itself is relayed to the chrome process as a <a href="/en-US/Firefox/Multiprocess_Firefox/Cross_Process_Object_Wrappers">CPOW</a>.</p> + +<p>To make the shim unnecessary: register event listeners on the global object inside a <a href="/en-US/Firefox/Multiprocess_Firefox/The_message_manager">frame script</a>. For example:</p> + +<pre class="brush: js">addEventListener("load", handler, true) // for example</pre> + +<div>If you need to contact the chrome process when that happens, send it a message.</div> + +<div> </div> + +<h2 id="Sandboxes"><em>Sandboxes</em></h2> + +<div>You can create sandboxes in the chrome or the content process. Sandboxes are often used as a safe way to manipulate web content, and if that's your goal, create the sandbox in the content process.</div> + +<div> </div> + +<div>There is a shim for sandboxes: if you make a sandbox in the chrome process and give it content principals (by passing a CPOW as the first argument to <a href="/en-US/docs/Components.utils.Sandbox">Components.utils.Sandbox</a>) then we'll actually make it in the content process.</div> + +<div> </div> + +<div> +<h2 id="nsIAboutModule">nsIAboutModule</h2> + +<p>By default, custom about: pages registered using <code><a href="/en-US/docs/XPCOM_Interface_Reference/nsIAboutModule">nsIAboutModule</a></code> are loaded in the chrome process. This means that you can't access their content from the content process (via XHR, for example).</p> + +<p>You can change this default in the code you use to register the about: URI. See <a href="/en-US/Firefox/Multiprocess_Firefox/about:_and_chrome:_URIs">about: and chrome: URIs</a>.</p> +</div> + +<h2 id="Módulos_de_código_de_JavaScript_(JSMs)">Módulos de código de <em>JavaScript </em>(JSMs)</h2> + +<div>In single-process Firefox, you can use <a href="/en-US/docs/Mozilla/JavaScript_code_modules">JavaScript code modules (JSMs)</a> to maintain global state. In multiprocess Firefox, a JSM loaded into one process does not share any state with the same JSM loaded into a different process: so you can't use a JSM to share state between the chrome and content processes.</div> + +<div> </div> + +<div>If an add-on wants to use a JSM to share state in this way, it's best to load the JSM in the chrome process, and have frame scripts store and access the JSM's state by sending messages to the chrome process using the message manager.</div> + +<div> </div> + +<h2 id="nsIProtocolHandler">nsIProtocolHandler</h2> + +<div>In multiprocess Firefox, code which registers a custom protocol using <code><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIProtocolHandler">nsIProtocolHandler</a></code> must register the custom protocol in the child content process.</div> + +<div>If the custom protocol is registered only in the chrome process, no iframes or tabs will be able to load any resource from the custom procotol.</div> + +<div> </div> + +<div>The solution is to register the custom protocol in the content process. You can do this by loading a frame script or, with the Add-on SDK, you can use <a href="/en-US/Add-ons/SDK/Low-Level_APIs/remote_parent#Loading_modules_into_the_child_process"><code>remoteRequire()</code> in the "remote/parent" module</a>.</div> diff --git a/files/pt-pt/mozilla/firefox/multiprocess_firefox/limitacoes_de_frame_scripts/index.html b/files/pt-pt/mozilla/firefox/multiprocess_firefox/limitacoes_de_frame_scripts/index.html new file mode 100644 index 0000000000..999472c499 --- /dev/null +++ b/files/pt-pt/mozilla/firefox/multiprocess_firefox/limitacoes_de_frame_scripts/index.html @@ -0,0 +1,103 @@ +--- +title: Limitações de frame scripts +slug: Mozilla/Firefox/Multiprocess_Firefox/Limitacoes_de_frame_scripts +translation_of: Mozilla/Firefox/Multiprocess_Firefox/Limitations_of_frame_scripts +--- +<div>{{FirefoxSidebar}}</div><p>Frame scripts run with <a href="/en-US/docs/Security_check_basics#Principals">system privileges</a> and have access to the <a href="/en-US/docs/Components_object">Components</a> object, enabling them to use <a href="/en-US/docs/Mozilla/Tech/XPCOM">XPCOM</a> objects and <a href="/en-US/docs/Mozilla/JavaScript_code_modules">JSMs</a>. Many privileged APIs will just work in a content process. Anything that just manipulates data structures will just work. XHR and Workers will work. However, some APIs that work in the chrome process will not work in a frame script. This article lists the most important of these APIs.</p> + +<p>This is one of a pair of articles: the other one lists <a href="/en-US/Firefox/Multiprocess_Firefox/Limitations_of_chrome_scripts">limitations of chrome scripts</a>.</p> + +<h2 id="Restrições_de_Segurança_no_Acesso_de_Ficheiro">Restrições de Segurança no Acesso de Ficheiro</h2> + +<p>Processes that host remote content are isolated from the local system through a content security sandbox. One of the functions of the sandbox is to restrict access to the local file system by processes that host remote content. Since frame and process scripts often execute in remote content processes these scripts are subject to the same file access rules placed on remote content. Therefore frame scripts should not attempt to access the local file system directly, as these calls will fail.</p> + +<p>Examples of APIs Add-on authors should avoid in frame scripts:</p> + +<ul> + <li><a href="http://dxr.mozilla.org/mozilla-central/source/netwerk/base/public/nsIFileStreams.idl"><code>nsIFileInputStream</code></a></li> + <li><a href="http://dxr.mozilla.org/mozilla-central/source/netwerk/base/public/nsIFileStreams.idl"><code>nsIFileOutputStream</code></a></li> + <li><a href="/en-US/docs/Extensions/Using_the_DOM_File_API_in_chrome_code">Constructing a <code>File</code> from a string or <code>nsIFile</code></a> (but <code>File</code> objects can be sent via message manager)</li> + <li><code><a href="/en-US/docs/Web/API/HTMLInputElement/mozSetFileNameArray">HTMLInputElement.mozSetFileNameArray</a></code> (alternative: <code>mozSetFileArray</code>)</li> +</ul> + +<h2 id="XUL_e_IU_de_navegador">XUL e IU de navegador</h2> + +<p>Anything that tries to touch the browser UI or anything to do with XUL is likely to not work in the content process. For example:</p> + +<ul> + <li><code><a href="http://dxr.mozilla.org/mozilla-central/source/embedding/components/windowwatcher/nsIPromptService.idl">nsIPromptService</a></code></li> + <li><a href="http://dxr.mozilla.org/mozilla-central/source/widget/nsIFilePicker.idl"><code>nsIFilePicker</code></a></li> + <li><code>nsIXUL*</code></li> + <li><need more examples></li> +</ul> + +<h2 id="Serviços">Serviços</h2> + +<p>Some services will not work in frame scripts.</p> + +<ul> + <li>Services.search</li> + <li>Services.downloads</li> +</ul> + +<h2 id="Janelas_de_Chrome">Janelas de <em>Chrome</em></h2> + +<p>Anything that needs to use chrome windows will not work in the content process. For example:</p> + +<ul> + <li><a href="http://dxr.mozilla.org/mozilla-central/source/mobile/android/components/SessionStore.idl"><code>nsISessionStore</code></a></li> + <li><a href="http://dxr.mozilla.org/mozilla-central/source/xpfe/appshell/nsIWindowMediator.idl"><code>nsIWindowMediator</code></a></li> + <li><need more examples></li> +</ul> + +<h2 id="Places_API">Places API</h2> + +<p>A <a href="/pt-PT/docs/Mozilla/Tech/Places">API de Places</a> não pode ser utilizada dentro de uma <em>frame script</em>. Por exemplo:</p> + +<ul> + <li><a href="http://dxr.mozilla.org/mozilla-central/source/toolkit/components/places/nsINavHistoryService.idl"><code>nsINavHistoryService</code></a></li> + <li><a href="http://dxr.mozilla.org/mozilla-central/source/toolkit/components/places/nsINavBookmarksService.idl"><code>nsINavBookmarksService</code></a></li> +</ul> + +<h2 id="Observadores_no_processo_de_conteúdo">Observadores no processo de conteúdo</h2> + +<p>As noted in <a href="https://developer.mozilla.org/en-US/Firefox/Multiprocess_Firefox/Limitations_of_chrome_scripts#Observers_in_the_chrome_process">Observers in the chrome process</a>, most <a href="http://dxr.mozilla.org/mozilla-central/source/xpcom/ds/nsIObserver.idl">observers</a> should be registered in the chrome process and will not work in the content process. The exceptions are:</p> + +<ul> + <li><code><a href="https://developer.mozilla.org/en-US/docs/Observer_Notifications#Documents">content-document-global-created</a></code></li> + <li><a href="https://developer.mozilla.org/en-US/docs/Observer_Notifications#Documents"><code>document-element-inserted</code></a></li> + <li><a href="https://developer.mozilla.org/en-US/docs/Observer_Notifications#Windows"><code>outer-window-destroyed</code></a></li> + <li><a href="https://developer.mozilla.org/en-US/docs/Observer_Notifications#Windows"><code>inner-window-destroyed</code></a></li> + <li><a href="https://developer.mozilla.org/en-US/docs/Observer_Notifications#Windows"><code>dom-window-destroyed</code></a></li> +</ul> + +<p>These must be registered in the content process.</p> + +<h2 id="QI_from_content_window_to_chrome_window">QI from content window to chrome window</h2> + +<div>There's a particular pattern often used to get from a content window to the associated chrome window. It looks something like this:</div> + +<div> </div> + +<pre class="brush: js">window.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsIDocShellTreeItem) + .rootTreeItem + .QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIDOMWindow);</pre> + +<div>This will no longer work. In the content process the root tree item is an <a href="http://dxr.mozilla.org/mozilla-central/source/dom/interfaces/base/nsITabChild.idl"><code>nsITabChild</code></a>, that cannot be converted to an <code>nsIDOMWindow</code>, so the second <code>getInterface</code> call here will fail.</div> + +<div> </div> + +<p>If you want a chrome window: send a message from the content process using the <a href="/en-US/Firefox/Multiprocess_Firefox/The_message_manager">message manager</a>. The <a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIMessageListener#receiveMessage()"><code>target</code></a> property of the object passed into the message handler in the chrome process is the XUL <a href="/en-US/docs/XUL/browser"><code><browser></code></a> receiving the message, and you can get the chrome window from that (Note: I'm not really sure how...).</p> + +<h2 id="nsIAboutModule">nsIAboutModule</h2> + +<p>By default, custom <code>about:</code> pages registered using <a href="http://dxr.mozilla.org/mozilla-central/source/netwerk/protocol/about/nsIAboutModule.idl"><code>nsIAboutModule</code></a> are loaded in the chrome process. This means that you can't access their content from the content process (via XHR, for example).</p> + +<p>You can change this default in the code you use to register the about: URI. See <a href="/en-US/Firefox/Multiprocess_Firefox/about:_and_chrome:_URIs">about: and chrome: URIs</a>.</p> + +<h2 id="Módulos_de_código_de_JavaScript_(JSMs)">Módulos de código de <em>JavaScript</em> (JSMs)</h2> + +<div>In multiprocess Firefox, a JSM loaded into the content process does not share any state with the same JSM loaded into the chrome process. See the entry in the <a href="/en-US/Firefox/Multiprocess_Firefox/Limitations_of_chrome_scripts#JavaScript_code_modules_%28JSMs%29">Limitations on chrome scripts</a> page.</div> diff --git a/files/pt-pt/mozilla/firefox/multiprocess_firefox/quais_os_uris_que_carregam_e_onde/index.html b/files/pt-pt/mozilla/firefox/multiprocess_firefox/quais_os_uris_que_carregam_e_onde/index.html new file mode 100644 index 0000000000..7a4ae7a993 --- /dev/null +++ b/files/pt-pt/mozilla/firefox/multiprocess_firefox/quais_os_uris_que_carregam_e_onde/index.html @@ -0,0 +1,62 @@ +--- +title: Quais os URIs que carregam e onde +slug: Mozilla/Firefox/Multiprocess_Firefox/Quais_os_URIs_que_carregam_e_onde +tags: + - Processo de Chrome + - Processo de Conteúdo +translation_of: Mozilla/Firefox/Multiprocess_Firefox/Which_URIs_load_where +--- +<div>{{FirefoxSidebar}}</div><p>Baseado inicialmente no esquema de URI da página, o navegador pode decidir se deseja carregar uma página no processo de <em>chrome</em> ou um processo de conteúdo. Para alguns esquemas, pode alterar o comportamento predefinido.</p> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Esquema</th> + <th scope="col">Comportamento</th> + </tr> + </thead> + <tbody> + <tr> + <td><code>about:</code></td> + <td> + <p>By default, <code>about:</code> pages are always loaded in the chrome process. However, when you register a new <code>about:</code> page, you can change this default.</p> + + <p>Two new flags are defined in <code><a href="https://dxr.mozilla.org/mozilla-central/source/netwerk/protocol/about/nsIAboutModule.idl">nsIAboutModule</a></code>:</p> + + <ul> + <li><code>URI_CAN_LOAD_IN_CHILD</code>: the page will be loaded in the same process as the <code><a href="/en-US/docs/XUL/browser">browser</a></code> that has loaded it.</li> + <li><code>URI_MUST_LOAD_IN_CHILD</code>: the page will always be loaded in a child process.</li> + </ul> + + <p>To use one of these flags, return it from your implementation of <code>getURIFlags</code> in the <a href="/en-US/docs/Custom_about:_URLs">code that registers the <code>about:</code> URI</a>.</p> + + <p>If you use these flags, you must register the about page in the framescript for each tab. If you do not set multiprocessCompatible to true in your install.rdf then shims will be used. But the e10s shims will be deprecated soon. Read more here - <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1257201">Bug 1257201</a>.</p> + </td> + </tr> + <tr> + <td><code>chrome:</code></td> + <td> + <p>By default, <code>chrome:</code> pages are always loaded in the chrome process. However, when you register a new <code>chrome:</code> page, you can change this default.</p> + + <p>Two new flags are defined in the <a href="/en-US/docs/Chrome_Registration">chrome.manifest file</a>:</p> + + <ul> + <li>remoteenabled: the page will be loaded in the same process as the <code><a href="/en-US/docs/XUL/browser">browser</a></code> that has loaded it.</li> + <li>remoterequired: the page will always be loaded in a child process.</li> + </ul> + </td> + </tr> + <tr> + <td><code>file:</code></td> + <td> + <p>Carregado sempre num processo de conteúdo.</p> + + <p><strong>Nota:</strong> This does not mean <code>file:</code> URIs can be used freely by code in content processes. Sandboxing may blacklist particular directories and future changes may restrict <code>file:</code> URIs to a separate content process, isolated from regular web content. See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1187099">bug 1187099</a> how this can affect addons attempting to load files from the profile directory.</p> + </td> + </tr> + <tr> + <td><code>resource:</code></td> + <td>Carregado sempre num processo de conteúdo.</td> + </tr> + </tbody> +</table> diff --git a/files/pt-pt/mozilla/firefox/multiprocess_firefox/resumo_técnico/index.html b/files/pt-pt/mozilla/firefox/multiprocess_firefox/resumo_técnico/index.html new file mode 100644 index 0000000000..aa2613a58e --- /dev/null +++ b/files/pt-pt/mozilla/firefox/multiprocess_firefox/resumo_técnico/index.html @@ -0,0 +1,164 @@ +--- +title: Resumo técnico +slug: Mozilla/Firefox/Multiprocess_Firefox/Resumo_técnico +translation_of: Mozilla/Firefox/Multiprocess_Firefox/Technical_overview +--- +<div>{{FirefoxSidebar}}</div><div class="note"> +<p>This page is an edited extract from Bill McCloskey's blog post on multiprocess Firefox: <a class="external external-icon" href="http://billmccloskey.wordpress.com/2013/12/05/multiprocess-firefox/">http://billmccloskey.wordpress.com/2013/12/05/multiprocess-firefox/</a></p> +</div> + +<p>At a very high level, multiprocess Firefox works as follows. The process that starts up when Firefox launches is called the <em>parent process</em>. Initially, this process works similarly to single-process Firefox: it opens a window displaying <a href="http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser.xul"><code>browser.xul</code></a>, which contains all the principal UI elements for Firefox. Firefox has a flexible GUI toolkit called XUL that allows GUI elements to be declared and laid out declaratively, similar to web content. Just like web content, the Firefox UI has a <code>window</code> object, which has a <code>document</code> property, and this document contains all the XML elements from <code>browser.xul</code>. All the Firefox menus, toolbars, sidebars, and tabs are XML elements in this document. Each tab element contains a <code><browser></code> element to display web content.</p> + +<p>The first place where multiprocess Firefox diverges from single-process Firefox is that each <code><browser></code> element has a <code>remote="true"</code> attribute. When such a browser element is added to the document, a new content process is started. This process is called a <em>child process</em>. An IPC channel is created that links the parent and child processes. Initially, the child displays <code>about:blank</code>, but the parent can send the child a command to navigate elsewhere.</p> + +<h2 id="Desenho"><strong id="drawing">Desenho</strong></h2> + +<p>Somehow, displayed web content needs to get from the child process to the parent and then to the screen. Multiprocess Firefox depends on a new Firefox feature called <a href="http://benoitgirard.wordpress.com/2012/05/15/off-main-thread-compositing-omtc-and-why-it-matters/"><em>off main thread compositing</em></a> (OMTC). In brief, each Firefox window is broken into a series of <em>layers</em>, somewhat similar to layers in Photoshop. Each time Firefox draws, these layers are submitted to a compositor thread that clips and translates the layers and combines them together into a single image that is then drawn.</p> + +<p>Layers are structured as a tree. The root layer of the tree is responsible for the entire Firefox window. This layer contains other layers, some of which are responsible for drawing the menus and tabs. One subtree displays all the web content. Web content itself may be broken into multiple layers, but they’re all rooted at a single “content” layer.</p> + +<p>In multiprocess Firefox, the content layer subtree is actually a shim. Most of the time, it contains a placeholder node that simply keeps a reference to the IPC link with the child process. The content process retains the actual layer tree for web content. It builds and draws to this layer tree. When it’s done, it sends the structure of its layer tree to the parent process via IPC. Backing buffers are shared with the parent either through shared memory or GPU memory. References to this memory are sent as part of the layer tree. When the parent receives the layer tree, it removes its placeholder content node and replaces it with the actual tree from content. Then it composites and draws as normal. When it’s done, it puts the placeholder back.</p> + +<p>The basic architecture of how OMTC works with multiple processes has existed for some time, since it is needed for Firefox OS. However, Matt Woodrow and David Anderson have done a lot of work to get everything working properly on Windows, Mac, and Linux. One of the big challenges for multiprocess Firefox will be getting OMTC enabled on all platforms. Right now, only Macs use it by default.</p> + +<h2 id="User_input"><strong id="input">User input</strong></h2> + +<p>Events in Firefox work the same way as they do on the web. Namely, there is a DOM tree for the entire window, and events are threaded through this tree in capture and bubbling phases. Imagine that the user clicks on a button on a web page. In single-process Firefox, the root DOM node of the Firefox window gets the first chance to process the event. Then, nodes lower down in the DOM tree get a chance. The event handling proceeds down through to the XUL <code><browser></code> element. At this point, nodes in the web page’s DOM tree are given a chance to handle the event, all the way down to the button. The bubble phase follows, running in the opposite order, all the way back up to the root node of the Firefox window.</p> + +<p>With multiple processes, event handling works the same way until the <code><browser></code> element is hit. At that point, if the event hasn’t been handled yet, it gets sent to the child process by IPC, where handling starts at the root of the content DOM tree. The parent process then waits to run its bubbling phase until the content process has finished handling the event.</p> + +<h2 id="Inter-process_communication"><strong id="ipc">Inter-process communication</strong></h2> + +<p>All IPC happens using the Chromium IPC libraries. Each child process has its own separate IPC link with the parent. Children cannot communicate directly with each other. To prevent deadlocks and to ensure responsiveness, the parent process is not allowed to sit around waiting for messages from the child. However, the child is allowed to block on messages from the parent.</p> + +<p>Rather than directly sending packets of data over IPC as one might expect, we use code generation to make the process much nicer. The IPC protocol is defined in <a href="https://wiki.mozilla.org/IPDL">IPDL</a>, which sort of stands for “inter-* protocol definition language”. A typical IPDL file is <code><a href="http://mxr.mozilla.org/mozilla-central/source/netwerk/ipc/PNecko.ipdl">PNecko.ipdl</a></code>. It defines a set messages and their parameters. Parameters are serialized and included in the message. To send a message <code>M</code>, C++ code just needs to call the method <code>SendM</code>. To receive the message, it implements the method <code>RecvM</code>.</p> + +<p>IPDL is used in all the low-level C++ parts of Gecko where IPC is required. In many cases, IPC is just used to forward actions from the child to the parent. This is a common pattern in Gecko:</p> + +<pre class="brush: cpp">void AddHistoryEntry(param) { + if (XRE_GetProcessType() == GeckoProcessType_Content) { + // If we're in the child, ask the parent to do this for us. + SendAddHistoryEntry(param); + return; + } + + // Actually add the history entry... +} + +bool RecvAddHistoryEntry(param) { + // Got a message from the child. Do the work for it. + AddHistoryEntry(param); + return true; +} +</pre> + +<p>When <code>AddHistoryEntry</code> is called in the child, we detect that we’re inside the child process and send an IPC message to the parent. When the parent receives that message, it calls <code>AddHistoryEntry</code> on its side.</p> + +<p>For a more realistic illustration, consider the Places database, which stores visited URLs for populating the awesome bar. Whenever the user visits a URL in the content process, we call <a href="http://mxr.mozilla.org/mozilla-central/source/toolkit/components/places/History.cpp?rev=8b9687f6c602#2326">this code</a>. Notice the content process check followed by the <code>SendVisitURI</code> call and an immediate return. The message is received <a href="http://mxr.mozilla.org/mozilla-central/source/dom/ipc/ContentParent.cpp?rev=fecda5f4a0df#2666">here</a>; this code just calls <code>VisitURI</code> in the parent.</p> + +<p>The code for IndexedDB, the places database, and HTTP connections all runs in the parent process, and they all use roughly the same proxying mechanism in the child.</p> + +<h2 id="Frame_scripts"><strong id="contentscripts">Frame scripts</strong></h2> + +<p>IPDL takes care of passing messages in C++, but much of Firefox is actually written in JavaScript. Instead of using IPDL directly, JavaScript code relies on <a href="/en-US/Firefox/Multiprocess_Firefox/The_message_manager">the message manager</a> to communicate between processes. To use the message manager in JS, you need to get hold of a message manager object. There is a global message manager, message managers for each Firefox window, and message managers for each <code><browser></code> element. A message manager can be used to load JS code into the child process and to exchange messages with it.</p> + +<p>As a simple example, imagine that we want to be informed every time a <code>load</code> event triggers in web content. We’re not interested in any particular browser or window, so we use the global message manager. The basic process is as follows:</p> + +<pre class="brush: js">// Get the global message manager. +let mm = Cc["@<span class="skimlinks-unlinked">mozilla.org/globalmessagemanager;1</span>"]. + getService(Ci.nsIMessageListenerManager); + +// Wait for load event. +mm.addMessageListener("GotLoadEvent", function (msg) { + dump("Received load event: " + <span class="skimlinks-unlinked">msg.data.url</span> + "\n"); +}); + +// Load code into the child process to listen for the event. +mm.loadFrameScript("chrome://content/<span class="skimlinks-unlinked">content-script.js</span>", true); +</pre> + +<p>For this to work, we also need to have a file <code>content-script.js</code>:</p> + +<pre class="brush: js">// Listen for the load event. +addEventListener("load", function (e) { + // Inform the parent process. + let docURL = content.document.documentURI; + sendAsyncMessage("GotLoadEvent", {url: docURL}); +}, false); +</pre> + +<p>This file is called a <em>frame script</em>. When the <code>loadFrameScript</code> function call runs, the code for the script is run once for each <code><browser></code> element. This includes both remote browsers and regular ones. If we had used a per-window message manager, the code would only be run for the browser elements in that window. Any time a new browser element is added, the script is run automatically (this is the purpose of the <code>true</code> parameter to <code>loadFrameScript</code>). Since the script is run once per browser, it can access the browser’s window object and docshell via the <code>content</code> and <code>docShell</code> globals.</p> + +<p>The great thing about frame scripts is that they work in both single-process and multiprocess Firefox. To learn more about the message manager, see the <a href="/en-US/Firefox/Multiprocess_Firefox/The_message_manager">message manager guide</a>.</p> + +<h2 id="Cross-process_APIs"><strong id="shims">Cross-process APIs</strong></h2> + +<p>There are a lot of APIs in Firefox that cross between the parent and child processes. An example is the <code>webNavigation</code> property of XUL <code><browser></code> elements. The <code>webNavigation</code> property is an object that provides methods like <code>loadURI</code>, <code>goBack</code>, and <code>goForward</code>. These methods are called in the parent process, but the actions need to happen in the child. First I’ll cover how these methods work in single-process Firefox, and then I’ll describe how we adapted them for multiple processes.</p> + +<p>The <code>webNavigation</code> property is defined using the XML Binding Language (XBL). XBL is a declarative language for customizing how XML elements work. Its syntax is a combination of XML and JavaScript. Firefox uses XBL extensively to customize XUL elements like <code><browser></code> and <code><tabbrowser></code>. The <code><browser></code> customizations reside in <code><a href="http://mxr.mozilla.org/mozilla-central/source/toolkit/content/widgets/browser.xml?rev=754cf7fc84cd">browser.xml</a></code>. <a href="http://mxr.mozilla.org/mozilla-central/source/toolkit/content/widgets/browser.xml?rev=754cf7fc84cd#262">Here</a> is how <code>browser.webNavigation</code> is defined:</p> + +<pre class="brush: xml"><field name="_webNavigation">null</field> + +<property name="webNavigation" readonly="true"> + <getter> + <![CDATA[ + if (!this._webNavigation) + this._webNavigation = this.docShell.QueryInterface(Components.interfaces.nsIWebNavigation); + return this._webNavigation; + ]]> + </getter> +</property> +</pre> + +<p>This code is invoked whenever JavaScript code in Firefox accesses <code>browser.webNavigation</code>, where <code>browser</code> is some <code><browser></code> element. It checks if the result has already been cached in the <code>browser._webNavigation</code> field. If it hasn’t been cached, then it fetches the navigation object based off the browser’s <em>docshell</em>. The docshell is a Firefox-specific object that encapsulates a lot of functionality for loading new pages, navigating back and forth, and saving page history. In multiprocess Firefox, the docshell lives in the child process. Since the <code>webNavigation</code> accessor runs in the parent process, <code>this.docShell</code> above will just return null. As a consequence, this code will fail completely.</p> + +<p>One way to fix this problem would be to create a fake docshell in C++ that could be returned. It would operate by sending IPDL messages to the real docshell in the child to get work done. We may eventually take this route in the future. We decided to do the message passing in JavaScript instead, since it’s easier and faster to prototype things there. Rather than change every docshell-using accessor to test if we’re using multiprocess browsing, we decided to create a new XBL binding that applies only to remote <code><browser></code> elements. It is called <a href="http://mxr.mozilla.org/mozilla-central/source/toolkit/content/widgets/remote-browser.xml?rev=9583bd3099ae"><code>remote-browser.xml</code></a>, and it extends the existing <code>browser.xml</code> binding.</p> + +<p>The <code>remote-browser.xml</code> binding returns a JavaScript <em>shim object</em> whenever anyone uses <code>browser.webNavigation</code> or other similar objects. The shim object is implemented <a href="http://mxr.mozilla.org/mozilla-central/source/toolkit/modules/RemoteWebNavigation.jsm">in its own JavaScript module</a>. It uses the message manager to send messages like <code>"WebNavigation:LoadURI"</code> to <a href="http://mxr.mozilla.org/mozilla-central/source/toolkit/content/browser-child.js?rev=9583bd3099ae#107">a content script loaded by <code>remote-browser.xml</code></a>. The content script performs the actual action.</p> + +<p>The shims we provide emulate their real counterparts imperfectly. They offer enough functionality to make Firefox work, but add-ons that use them may find them insufficient. I’ll discuss strategies for making add-ons work in more detail later.</p> + +<h2 id="Cross-process_object_wrappers"><strong id="cpows">Cross-process object wrappers</strong></h2> + +<p>The message manager API does not allow the parent process to call <code>sendSyncMessage</code>; that is, the parent is not allowed to wait for a response from the child. It’s detrimental for the parent to wait on the child, since we don’t want the browser UI to be unresponsive because of slow content. However, converting Firefox code to be asynchronous (i.e., to use <code>sendAsyncMessage</code> instead) can sometimes be onerous. As an expedient, we’ve introduced a new primitive that allows code in the parent process to access objects in the child process synchronously.</p> + +<p>These objects are called cross-process object wrappers, frequently abbreviated to CPOWs. They’re created using the message manager. Consider this example content script:</p> + +<pre class="brush: js">addEventListener("load", function (e) { + let doc = content.document; + sendAsyncMessage("GotLoadEvent", <strong>{}, {document: doc}</strong>); +}, false); +</pre> + +<p>In this code, we want to be able to send a reference to the document to the parent process. We can’t use the second parameter to <code>sendAsyncMessage</code> to do this: that argument is converted to JSON before it is sent up. The optional third parameter allows us to send object references. Each property of this argument becomes accessible in the parent process as a CPOW. Here’s what the parent code might look like:</p> + +<pre class="brush: js">let mm = Cc["@<span class="skimlinks-unlinked">mozilla.org/globalmessagemanager;1</span>"]. + getService(Ci.nsIMessageListenerManager); + +mm.addMessageListener("GotLoadEvent", function (msg) { + let uri = <strong>msg.objects.document.documentURI</strong>; + dump("Received load event: " + uri + "\n"); +}); +mm.loadFrameScript("chrome://content/<span class="skimlinks-unlinked">content-script.js</span>", true); +</pre> + +<p>It’s important to realize that we’re send object <em>references</em>. The <code>msg.objects.document</code> object is only a wrapper. The access to its <code>documentURI</code> property sends a synchronous message down to the child asking for the value. The dump statement only happens after a reply has come back from the child.</p> + +<p>Because every property access sends a message, CPOWs can be slow to use. There is no caching, so 1,000 accesses to the same property will send 1,000 messages.</p> + +<p>Another problem with CPOWs is that they violate some assumptions people might have about message ordering. Consider this code:</p> + +<pre class="brush: js">mm.addMessageListener("GotLoadEvent", function (msg) { + mm.sendAsyncMessage("ChangeDocumentURI", {newURI: "<span class="skimlinks-unlinked">hello.com</span>"}); + let uri = <strong>msg.objects.document.documentURI</strong>; + dump("Received load event: " + uri + "\n"); +}); +</pre> + +<p>This code sends a message asking the child to change the current document URI. Then it accesses the current document URI via a CPOW. You might expect the value of <code>uri</code> to come back as <code>"hello.com"</code>. But it might not. In order to avoid deadlocks, CPOW messages can bypass normal messages and be processed first. It’s possible that the request for the <code>documentURI</code> property will be processed before the <code>"ChangeDocumentURI"</code> message, in which case <code>uri</code> will have some other value.</p> + +<p>For this reason, it’s best not to mix CPOWs with normal message manager messages. It’s also a bad idea to use CPOWs for anything security-related, since you may not get results that are consistent with surrounding code that might use the message manager.</p> + +<p>Despite these problems, we’ve found CPOWs to be useful for converting certain parts of Firefox to be multiprocess-compatible. It’s best to use them in cases where users are less likely to notice poor responsiveness. As an example, we use CPOWs to implement the context menu that pops up when users right-click on content elements. Whether this code is asynchronous or synchronous, the menu cannot be displayed until content has responded with data about the element that has been clicked. The user is unlikely to notice if, for example, tab animations don’t run while waiting for the menu to pop up. Their only concern is for the menu to come up as quickly as possible, which is entirely gated on the response time of the content process. For this reason, we chose to use CPOWs, since they’re easier than converting the code to be asynchronous.</p> + +<p>It’s possible that CPOWs will be phased out in the future. Asynchronous messaging using the message manager gives a user experience that is at least as good as, and often strictly better than, CPOWs. We strongly recommend that people use the message manager over CPOWs when possible. Nevertheless, CPOWs are sometimes useful.</p> diff --git a/files/pt-pt/mozilla/firefox/releases/3/index.html b/files/pt-pt/mozilla/firefox/releases/3/index.html new file mode 100644 index 0000000000..129fa2fc1e --- /dev/null +++ b/files/pt-pt/mozilla/firefox/releases/3/index.html @@ -0,0 +1,298 @@ +--- +title: Firefox 3 for developers +slug: Mozilla/Firefox/Releases/3 +tags: + - Firefox 3 + - NeedsTranslation + - TopicStub +translation_of: Mozilla/Firefox/Releases/3 +--- +<div>{{FirefoxSidebar}}</div><p>If you're a developer trying to get a handle on all the new features in Firefox 3, this is the perfect place to start. This article provides a list of the new articles covering features added to Firefox 3. While it doesn't necessarily cover every little change, it will help you learn about the major improvements.</p> +<h2 id="New_developer_features_in_Firefox_3" name="New_developer_features_in_Firefox_3">New developer features in Firefox 3</h2> +<h3 id="For_web_site_and_application_developers" name="For_web_site_and_application_developers">For web site and application developers</h3> +<dl> + <dt> + <a href="/en-US/docs/Updating_web_applications_for_Firefox_3" title="en-US/docs/Updating_web_applications_for_Firefox_3">Updating web applications for Firefox 3</a></dt> + <dd> + Provides information about changes you may need to make to your web site or web application to take advantage of new features in Firefox 3.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/Online_and_offline_events" title="en-US/docs/Online_and_offline_events">Online and offline events</a></dt> + <dd> + Firefox 3 supports WHATWG online and offline events, which let applications and extensions detect whether or not there's an active Internet connection, as well as to detect when the connection goes up and down.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/Web-based_protocol_handlers" title="en-US/docs/Web-based_protocol_handlers">Web-based protocol handlers</a></dt> + <dd> + You can now register web applications as protocol handlers using the <code>navigator.registerProtocolHandler()</code> method.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/Drawing_text_using_a_canvas" title="en-US/docs/Drawing_text_using_a_canvas">Drawing text using a canvas</a></dt> + <dd> + You can now draw text in a canvas using a non-standardized API supported by Firefox 3.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/Canvas_tutorial/Transformations#Transforms" title="en-US/docs/Canvas_tutorial/Transformations#Transforms">Transform support for canvas</a></dt> + <dd> + Firefox now supports the <code>transform()</code> and <code>setTransform()</code> methods on canvases.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/Using_microformats" title="en-US/docs/Using_microformats">Using microformats</a></dt> + <dd> + Firefox now has APIs for working with microformats.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/Drag_and_drop_events" title="en-US/docs/Drag_and_drop_events">Drag and drop events</a></dt> + <dd> + Firefox 3 supports new events that are sent to the source node for a drag operation when the drag begins and ends.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/Focus_management_in_HTML" title="en-US/docs/Focus_management_in_HTML">Focus management in HTML</a></dt> + <dd> + The new HTML 5 <code>activeElement</code> and <code>hasFocus</code> attributes are supported.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/Offline_resources_in_Firefox" title="en-US/docs/Offline_resources_in_Firefox">Offline resources in Firefox</a></dt> + <dd> + Firefox now lets web applications request that resources be cached to allow the application to be used while offline.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/CSS_improvements_in_Firefox_3" title="en-US/docs/CSS_improvements_in_Firefox_3">CSS improvements in Firefox 3</a></dt> + <dd> + Firefox 3 features a number of improvements in its CSS support.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/DOM_improvements_in_Firefox_3" title="en-US/docs/DOM_improvements_in_Firefox_3">DOM improvements in Firefox 3</a></dt> + <dd> + Firefox 3 offers a number of new features in Firefox 3's DOM implementation, including support for several Internet Explorer extensions to the DOM.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/New_in_JavaScript_1.8" title="en-US/docs/New_in_JavaScript_1.8">JavaScript 1.8 support</a></dt> + <dd> + Firefox 3 offers JavaScript 1.8.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/EXSLT" title="en-US/docs/EXSLT">EXSLT support</a></dt> + <dd> + Firefox 3 provides support for a substantial subset of the <a href="/en-US/docs/EXSLT" title="en-US/docs/EXSLT">EXSLT</a> extensions to <a href="/en-US/docs/XSLT" title="en-US/docs/XSLT">XSLT</a>.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/SVG_improvements_in_Firefox_3" title="en-US/docs/SVG_improvements_in_Firefox_3">SVG improvements in Firefox 3</a></dt> + <dd> + SVG support in Firefox 3 has been upgraded significantly, with support for over two dozen new filters, several new elements and attributes, and other improvements.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/Animated_PNG_graphics" title="en-US/docs/Animated_PNG_graphics">Animated PNG graphics</a></dt> + <dd> + Firefox 3 supports the animated PNG (APNG) image format.</dd> +</dl> +<h3 id="For_XUL_and_extension_developers" name="For_XUL_and_extension_developers">For XUL and extension developers</h3> +<h4 id="Notable_changes_and_improvements" name="Notable_changes_and_improvements">Notable changes and improvements</h4> +<dl> + <dt> + <a href="/en-US/docs/Updating_extensions_for_Firefox_3" title="en-US/docs/Updating_extensions_for_Firefox_3">Updating extensions for Firefox 3</a></dt> + <dd> + Provides a guide to the things you'll need to do to update your extension to work with Firefox 3.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/XUL_improvements_in_Firefox_3" title="en-US/docs/XUL_improvements_in_Firefox_3">XUL improvements in Firefox 3</a></dt> + <dd> + Firefox 3 offers a number of new XUL elements, including new sliding scales, the date and time pickers, and spin buttons.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/Templates_in_Firefox_3" title="en-US/docs/Templates_in_Firefox_3">Templates in Firefox 3</a></dt> + <dd> + Templates have been significantly improved in Firefox 3. The key improvement allows the use of custom query processors to allow data sources other than RDF to be used.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/Extension_Versioning,_Update_and_Compatibility#Securing_Updates" title="en-US/docs/Extension_Versioning,_Update_and_Compatibility#Securing_Updates">Securing updates</a></dt> + <dd> + In order to provide a more secure add-on upgrade path for users, add-ons are now required to provide a secure method for obtaining updates before they can be installed. Add-ons hosted at <a class="external" href="http://addons.mozilla.org">AMO</a> automatically provide this. Any add-ons installed that do not provide a secure update method when the user upgrades to Firefox 3 will be automatically disabled. Firefox will however continue to check for updates to the extension over the insecure path and attempt to install any update offered (installation will fail if the update also fails to provide a secure update method).</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/Places_Developer_Guide" title="en-US/docs/Places_migration_guide">Places migration guide</a></dt> + <dd> + An article about how to update an existing extension to use the Places API.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/Download_Manager_improvements_in_Firefox_3" title="en-US/docs/Download_Manager_improvements_in_Firefox_3">Download Manager improvements in Firefox 3</a></dt> + <dd> + The Firefox 3 Download Manager features new and improved APIs, including support for multiple progress listeners.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/XPCOM_Interface_Reference/Using_nsILoginManager" title="en-US/docs/Using_nsILoginManager">Using nsILoginManager</a></dt> + <dd> + The Password Manager has been replaced by the new Login Manager.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/XBL/XBL_1.0_Reference/Elements#binding" title="en-US/docs/XBL/XBL_1.0_Reference/Elements#binding">Embedding XBL bindings</a></dt> + <dd> + You can now use the <code>data:</code> URL scheme from chrome code to embed XBL bindings directly instead of having them in separate XML files.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/Localizing_extension_descriptions" title="en-US/docs/Localizing_extension_descriptions">Localizing extension descriptions</a></dt> + <dd> + Firefox 3 offers a new method for localizing add-on metadata. This lets the localized details be available as soon as the add-on has been downloaded, as well as when the add-on is disabled.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/Localization_and_Plurals" title="en-US/docs/Localization_and_Plurals">Localization and Plurals</a></dt> + <dd> + Firefox 3 adds the new PluralForm module, which provides tools to aid in correctly pluralizing words in multiple localizations.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/Theme_changes_in_Firefox_3" title="en-US/docs/Theme_changes_in_Firefox_3">Theme changes in Firefox 3</a></dt> + <dd> + Notes and information of use to people who want to create themes for Firefox 3.</dd> +</dl> +<h4 id="New_components_and_functionality" name="New_components_and_functionality">New components and functionality</h4> +<dl> + <dt> + <a href="/en-US/docs/Toolkit_API/FUEL" title="en-US/docs/FUEL">FUEL Library</a></dt> + <dd> + FUEL is about making it easier for extension developers to be productive, by minimizing some of the XPCOM formality and adding some "modern" JavaScript ideas.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/Places" title="en-US/docs/Places">Places</a></dt> + <dd> + The history and bookmarks APIs have been completely replaced by the new <a href="/en-US/docs/Places" title="en-US/docs/Places">Places</a> API.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/nsIIdleService" title="en-US/docs/nsIIdleService">Idle service</a></dt> + <dd> + Firefox 3 offers the new {{Interface("nsIIdleService")}} interface, which lets extensions determine how long it's been since the user last pressed a key or moved their mouse.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/nsIZipWriter" title="en-US/docs/nsIZipWriter">ZIP writer</a></dt> + <dd> + The new {{Interface("nsIZipWriter")}} interface lets extensions create ZIP archives.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/Full_page_zoom" title="en-US/docs/Full_page_zoom">Full page zoom</a></dt> + <dd> + Firefox 3 improves the user experience by offering full page zoom in addition to text-only zoom.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/Interfacing_with_the_XPCOM_cycle_collector" title="en-US/docs/Interfacing_with_the_XPCOM_cycle_collector">Interfacing with the XPCOM cycle collector</a></dt> + <dd> + XPCOM code can now take advantage of the cycle collector, which helps ensure that unused memory gets released instead of leaking.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/The_Thread_Manager" title="en-US/docs/The_Thread_Manager">The Thread Manager</a></dt> + <dd> + Firefox 3 provides the new {{Interface("nsIThreadManager")}} interface, along with new interfaces for threads and thread events, which provides a convenient way to create and manage threads in your code.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/JavaScript_code_modules" title="en-US/docs/JavaScript_modules">JavaScript modules</a></dt> + <dd> + Firefox 3 now offers a new shared code module mechanism that lets you easily create modules in JavaScript that can be loaded by extensions and applications for use, much like shared libraries.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/nsIJSON" title="en-US/docs/nsIJSON">The <code>nsIJSON</code> interface</a></dt> + <dd> + Firefox 3 offers the new {{Interface("nsIJSON")}} interface, which offers high-performance encoding and decoding of <a href="/en-US/docs/JSON" title="en-US/docs/JSON">JSON</a> strings.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/XPCOM_Interface_Reference/nsIParentalControlsService" title="en-US/docs/nsIParentalControlsService">The nsIParentalControlsService interface</a></dt> + <dd> + Firefox 3 now supports the Microsoft Windows Vista parental controls feature, and allows code to interact with it.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/Using_content_preferences" title="en-US/docs/Using_content_preferences">Using content preferences</a></dt> + <dd> + Firefox 3 includes a new service for getting and setting arbitrary site-specific preferences that extensions as well as core code can use to keep track of their users' preferences for individual sites.</dd> +</dl> +<dl> + <dt> + <a href="/en-US/docs/Monitoring_plugins" title="en-US/docs/Monitoring_plugins">Plug-in Monitoring</a></dt> + <dd> + A new component of the plugin system is now available to measure how long it takes plugins (e.g., Macromedia Flash) to execute their calls.</dd> +</dl> +<h4 id="Fixed_bugs" name="Fixed_bugs">Fixed bugs</h4> +<dl> + <dt> + <a href="/en-US/docs/Notable_bugs_fixed_in_Firefox_3" title="en-US/docs/Notable_bugs_fixed_in_Firefox_3">Notable bugs fixed in Firefox 3</a></dt> + <dd> + This article provides information about bugs that have been fixed in Firefox 3.</dd> +</dl> +<h2 id="New_features_for_end_users" name="New_features_for_end_users">New features for end users</h2> +<h3 id="User_experience" name="User_experience">User experience</h3> +<ul> + <li><strong>Easier password management.</strong> An information bar at the top of the browser window now appears to allow you to save passwords after a successful login.</li> + <li><strong>Simplified add-on installation.</strong> You can now install extensions from third-party download sites in fewer clicks, thanks to the removal of the add-on download site whitelist.</li> + <li><strong>New Download Manager.</strong> The download manager makes it easier to locate your downloaded files.</li> + <li><strong>Resumable downloads.</strong> You can now resume downloads after restarting the browser or resetting your network connection.</li> + <li><strong>Full page zoom.</strong> From the View menu and using keyboard shortcuts, you can now zoom in and out on the content of entire pages -- this scales not just the text but the layout and images as well.</li> + <li><strong>Tab scrolling and quickmenu.</strong> Tabs are easier to locate with the new tab scrolling and tab quickmenu features.</li> + <li><strong>Save what you were doing.</strong> Firefox 3 prompts you to see if you'd like to save your current tabs when you exit Firefox.</li> + <li><strong>Optimized Open in Tabs behavior.</strong> Opening a folder of bookmarks in tabs now appends the new tabs instead of replacing the existing ones.</li> + <li><strong>Easier to resize location and search bars.</strong> You can now easily resize the location and search bars using a simple resize handle between them.</li> + <li><strong>Text selection improvements.</strong> You can now select multiple ranges of text using the Control (Command on Macintosh) key. Double-clicking and dragging now selects in "word-by-word" mode. Triple-clicking selects an entire paragraph.</li> + <li><strong>Find toolbar.</strong> The Find toolbar now opens with the current selection.</li> + <li><strong>Plugin management.</strong> Users can now disable individual plugins in the Add-on Manager.</li> + <li><strong>Integration with Windows Vista.</strong> Firefox's menus now display using Vista's native theme.</li> + <li><strong>Integration with Mac OS X.</strong> Firefox now supports <a class="external" href="http://growl.info/">Growl</a> for notifications of completed downloads and available updates.</li> + <li><strong>Star button.</strong> The new star button in the location bar lets you quickly add a new bookmark with a single click. A second click lets you file and tag your new bookmark.</li> + <li><strong>Tags.</strong> You can now associate keywords with your bookmarks to easily sort them by topic.</li> + <li><strong>Location bar and auto-complete.</strong> Type the title or tag of a page in the location bar to quickly find the site you were looking for in your history and bookmarks. Favicons, bookmark, and tag indicators help you see where the results are coming from.</li> + <li><strong>Smart Bookmarks folder.</strong> Firefox's new Smart Bookmarks folder offers quick access to your recently bookmarked and tagged places, as well as pages you visit frequently.</li> + <li><strong>Bookmarks and History Organizer.</strong> The new unified bookmarks and history organizer lets you easily search your history and bookmarks with multiple views and smart folders for saving your frequent searches.</li> + <li><strong>Web-based protocol handlers.</strong> Web applications, such as your favorite web mail provider, can now be used instead of desktop applications for handling <code>mailto:</code> links from other sites. Similar support is provided for other protocols as well. (Note that web applications do have to register themselves with Firefox before this will work.)</li> + <li><strong>Easy to use Download Actions.</strong> A new Applications preferences pane provides an improved user interface for configuring handlers for various file types and protocol schemes.</li> + <li><strong>Improved look and feel.</strong> Graphics and font handling have been improved to make web sites look better on your screen, including sharper text rendering and better support for fonts with ligatures and complex scripts. In addition, Mac and Linux (Gnome) users will find that Firefox feels more like a native application for their platform than ever, with a new, native, look and feel.</li> + <li><strong>Color management support.</strong> By setting the <code>gfx.color_management.enabled</code> preference in <code>{{mediawiki.external('about:config')}}</code>, you can ask Firefox to use the color profiles embedded in images to adjust the colors to match your computer's display.</li> + <li><strong>Offline support.</strong> Web applications can take advantage of new features to support being used even when you don't have an Internet connection.</li> +</ul> +<h3 id="Security_and_privacy" name="Security_and_privacy">Security and privacy</h3> +<ul> + <li><strong>One-click site information.</strong> Want to know more about the site you're visiting? Click the site's icon in the location bar to see who owns it. Identify information is prominently displayed and easier than ever to understand.</li> + <li><strong>Malware protection.</strong> Firefox 3 warns you if you arrive at a web site that is known to install viruses, spyware, trojans, or other dangerous software (known as malware). You can see what the warning looks like by <a class="link-https" href="https://www.mozilla.com/firefox/its-an-attack.html">clicking here</a>.</li> + <li><strong>Web forgery protection enhanced.</strong> Now when you visit a page that's suspected of being a forgery, you're shown a special page instead of the contents of the page with a warning. <a class="link-https" href="https://www.mozilla.com/firefox/its-a-trap.html">Click here</a> to see what it looks like.</li> + <li><strong>Easier to understand SSL errors.</strong> The errors presented when an invalid SSL certificate is encountered have been clarified to make it easier to understand what the problem is.</li> + <li><strong>Out-of-date add-on protection.</strong> Firefox 3 now automatically checks add-on and plugin versions and disables older, insecure versions.</li> + <li><strong>Secure add-on updates.</strong> Add-on update security has been improved by disallowing add-ons that use an insecure update mechanism.</li> + <li><strong>Anti-virus integration.</strong> Firefox 3 now informs anti-virus software when executable files are downloaded.</li> + <li><strong>Windows Vista parental controls support.</strong> Firefox 3 supports the Vista system-wide parental control setting for disabling file downloads.</li> +</ul> +<h3 id="Performance" name="Performance">Performance</h3> +<ul> + <li><strong>Reliability.</strong> Firefox 3 now stores bookmarks, history, cookies, and preferences in a transactionally secure database format. This means your data is protected against loss even if your system crashes.</li> + <li><strong>Speed.</strong> Firefox 3 has gotten a performance boost by completely replacing the part of the software that handles drawing to your screen, as well as to how page layout work is handled.</li> + <li><strong>Memory use reduced.</strong> Firefox 3 is more memory efficient than ever, with over 300 memory "leak" bugs fixed and new features to help automatically locate and dispose of leaked memory blocks.</li> +</ul> +<h2 id="See_also" name="See_also">See also</h2> + +<div>{{Firefox_for_developers('2')}}</div> diff --git a/files/pt-pt/mozilla/firefox/releases/70/index.html b/files/pt-pt/mozilla/firefox/releases/70/index.html new file mode 100644 index 0000000000..7b67fba949 --- /dev/null +++ b/files/pt-pt/mozilla/firefox/releases/70/index.html @@ -0,0 +1,140 @@ +--- +title: Firefox 70 para programadores +slug: Mozilla/Firefox/Releases/70 +tags: + - '70' + - Firefox + - Lançamento + - Mozilla +translation_of: Mozilla/Firefox/Releases/70 +--- +<p>{{FirefoxSidebar}}{{Draft}}</p> + +<p class="summary">Este artigo fornece informaçaõ acerca das alterações no Firefox 70 que irão afetar od programadores. O Firefox 70 é a <a href="https://www.mozilla.org/en-US/firefox/channel/desktop/#beta">versão Beta atual do Firefox</a>, e irá ser distribuida no dia <a href="https://wiki.mozilla.org/RapidRelease/Calendar#Future_branch_dates" rel="noopener">22 de outubro de 2019</a>.</p> + +<h2 id="Alterações_para_os_programadores_da_Web">Alterações para os programadores da Web</h2> + +<h3 id="Ferramentas_do_programador">Ferramentas do programador</h3> + +<ul> + <li>An icon will be displayed next to invalid or unsupported <a href="/en-US/docs/Tools/Page_Inspector/How_to/Examine_and_edit_CSS#Examine_CSS_rules">CSS rules</a> in the Rules pane of the Page Inspector ({{bug(1306054)}}).</li> +</ul> + +<h4 id="Removals">Removals</h4> + +<h3 id="HTML">HTML</h3> + +<p><em>No changes.</em></p> + +<h4 id="Removals_2"> Removals</h4> + +<h3 id="CSS">CSS</h3> + +<ul> + <li>Opacity values like for {{cssxref("opacity")}} or {{SVGAttr("stop-opacity")}} can now be percentages ({{Bug(1562086)}}).</li> + <li>{{cssxref("grid-auto-columns")}} and {{cssxref("grid-auto-rows")}} now accept multiple track-size values ({{Bug(1339672)}}).</li> + <li>A number of text-related CSS properties have been enabled by default ({{bug(1573631)}}): + <ul> + <li>{{cssxref("text-decoration-thickness")}}.</li> + <li>{{cssxref("text-underline-offset")}}.</li> + <li>{{cssxref("text-decoration-skip-ink")}}. The default value is <code>auto</code>, which means that by default underlines and overlines are now interrupted where they would otherwise cross over a {{Glossary("glyph")}}.</li> + </ul> + </li> + <li>The {{cssxref("display")}} property now accepts two keywords for the inner and the outer display type ({{Bug(1038294)}}, {{Bug(1105868)}} and {{Bug(1557825)}}).</li> + <li>The {{cssxref("font-size")}} property now accepts the new keyword <code>xxx-large</code>. ({{Bug(1553545)}}).</li> + <li>The {{cssxref(":visited")}} pseudo-class no longer matches {{htmlelement("link")}} elements, for logic and performance reasons ({{bug(1572246)}}; see <span class="F0XO1GC-mb-Z" id="t-t"><a href="https://groups.google.com/forum/#!msg/mozilla.dev.platform/1NP6oJzK6zg/ftAz_TajAAAJ">Intent to ship: Make <link> elements always unvisited</a> and </span><a href="https://github.com/w3c/csswg-drafts/issues/3817">[selectors] :link and <link></a> for more reasoning as to why).</li> + <li>We now support an <code>auto</code> value for the {{cssxref("quotes")}} property ({{bug(1421938)}}).</li> + <li>Stylesheets contained in {{htmlelement("style")}} elements are now cached for reuse, to improve performance ({{bug(1480146)}}). Note that this currently doesn't include stylesheets that contain <code>@import</code> rules.</li> + <li>The <code><ratio></code> type now accepts <code><number></code> / <code><number></code> or a single <code><number></code> as a value. ({{bug(1565562)}}).</li> +</ul> + +<h4 id="Removals_3">Removals</h4> + +<ul> + <li>Retiring support for 3-valued <position> (excluding background)({{Bug(1559276)}}). <a href="https://www.fxsitecompat.dev/en-CA/docs/2019/3-valued-css-position-is-no-longer-supported-except-for-background-position/">See site compat note</a>.</li> + <li><code>none</code> is now invalid in {{cssxref("counter")}} / {{cssxref("counters")}} — a change which makes the Level 3 spec match CSS 2.1 {{Bug(1576821)}}).</li> +</ul> + +<h3 id="SVG">SVG</h3> + +<p><em>No changes.</em></p> + +<h4 id="Removals_4">Removals</h4> + +<h3 id="JavaScript">JavaScript</h3> + +<ul> + <li>Add support for numeric separators. {{Bug(1435818)}}.</li> +</ul> + +<h4 id="Removals_5">Removals</h4> + +<h3 id="APIs">APIs</h3> + +<ul> + <li>The {{domxref("History.back","back()")}}, {{domxref("History.forward","forward()")}}, and {{domxref("History.go","go()")}} methods are now asynchronous. Add a listener to the <code>{{domxref("Document/defaultView/popstate_event", "popstate")}}</code> event to get notification that navigation has completed {{Bug(1563587)}}.</li> +</ul> + +<h4 id="Novas_APIs">Novas APIs</h4> + +<h4 id="DOM">DOM</h4> + +<ul> + <li>Add {{DOMxRef("DOMMatrix")}}, {{DOMxRef("DOMPoint")}}, etc. support in web workers ({{bug(1420580)}}).</li> +</ul> + +<h4 id="Eventos_DOM">Eventos DOM</h4> + +<h4 id="Service_workers">Service workers</h4> + +<h4 id="Media_Web_Audio_and_WebRTC">Media, Web Audio, and WebRTC</h4> + +<h4 id="Canvas_and_WebGL">Canvas and WebGL</h4> + +<ul> + <li>We now support {{domxref("CanvasRenderingContext2D.getTransform()")}}, and the newer variant of {{domxref("CanvasRenderingContext2D.setTransform()")}} that accepts a matrix object as a parameter rather than multiple parameters representing the individual components of the matrix ({{bug(928150)}}).</li> +</ul> + +<h4 id="Removals_6">Removals</h4> + +<h3 id="Segurança">Segurança</h3> + +<p><em>No changes.</em></p> + +<h4 id="Removals_7">Removals</h4> + +<h3 id="Plug-ins">Plug-ins</h3> + +<p><em>No changes.</em></p> + +<h4 id="Removals_8">Removals</h4> + +<h3 id="Outros">Outros</h3> + +<p><em>No changes.</em></p> + +<h4 id="Removals_9">Removals</h4> + +<h2 id="Alterações_para_os_programadores_de_extras_add-on">Alterações para os programadores de extras (add-on)</h2> + +<h3 id="Alterações_de_API">Alterações de API</h3> + +<p><em>Sem alterações.</em></p> + +<h4 id="Removals_10">Removals</h4> + +<h3 id="Alfetarções_de_Manifest">Alfetarções de Manifest</h3> + +<p><em>Sem alterações.</em></p> + +<h4 id="Removals_11">Removals</h4> + +<h2 id="Consultar_também">Consultar também:</h2> + +<ul> + <li><a href="https://www.fxsitecompat.com/en-CA/versions/70/">SCompatibilidade de Site para o Firefox 70</a></li> +</ul> + +<h2 id="Versões_antigas">Versões antigas</h2> + +<p>{{Firefox_for_developers(69)}}</p> diff --git a/files/pt-pt/mozilla/firefox/releases/index.html b/files/pt-pt/mozilla/firefox/releases/index.html new file mode 100644 index 0000000000..68bc5d41e9 --- /dev/null +++ b/files/pt-pt/mozilla/firefox/releases/index.html @@ -0,0 +1,25 @@ +--- +title: Firefox - Notas de lançamento do programador +slug: Mozilla/Firefox/Releases +tags: + - Firefox + - Landing + - Lançamento + - Mozilla +translation_of: Mozilla/Firefox/Releases +--- +<div>{{FirefoxSidebar}}</div> + +<p>Esta página fornece hiperligações para os artigos de "Firefox X para programadores" para cada lançamento do Firefox. Estas notas deixam-no ver quais as funcionalidades que foram adicionadas e os erros eliminados em cada versão do Firefox. Tudo escrito para dar aos programadores como você a informação de que eles mais precisam. Seja bem-vindo.</p> + +<div class="multiColumnList">{{ListSubpages("",1,1,1)}}</div> + +<div class="multiColumnList"> </div> + +<p>Ufa! Isso é muito de Firefoxen!</p> + +<h2 id="Consultar_também">Consultar também</h2> + +<ul> + <li><a href="/pt-PT/docs/Mozilla/Thunderbird/Lancamentos">Thunderbird - Notas de lançamento do programador</a></li> +</ul> diff --git a/files/pt-pt/mozilla/firefox_for_android/index.html b/files/pt-pt/mozilla/firefox_for_android/index.html new file mode 100644 index 0000000000..12be7a39c2 --- /dev/null +++ b/files/pt-pt/mozilla/firefox_for_android/index.html @@ -0,0 +1,77 @@ +--- +title: Firefox para Android +slug: Mozilla/Firefox_for_Android +tags: + - Firefox + - Mobile +translation_of: Mozilla/Firefox_for_Android +--- +<p>Para cada vez mais pessoas, os dispositivos móveis são o meio principal, ou até o único meio, para aceder à Internet.<a class="link-https" href="https://www.mozilla.org/en-US/mobile/"> Firefox para Android</a> (nome de código Fennec) é um navegador aberto, personalizável, baseado em padrões, tal como a versão Firefox para pc.</p> + +<p>Firefox para Android cria a sua interface gráfica a partir de widgets nativos do Android em vez de XUL: isto aumenta de forma significativa o seu desempenho, especialmente o tempo de arranque, e o consumo de memória.</p> + +<h2 id="Contribuir_para_o_Firefox_para_Android">Contribuir para o Firefox para Android</h2> + +<p>O ponto de partida para informação acertca do projecto Firefox para Android é a <a class="link-https" href="https://wiki.mozilla.org/Mobile">página Wiki do projecto</a>.</p> + +<p>Podes ajudar a criar e melhorar Firefox para Android:</p> + +<ul> + <li>Ajude-nos com <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_for_Android/Compatibility_Testing">testes de compatibilidade</a></li> + <li>Subscreva a newsletter <a href="https://mail.mozilla.org/listinfo/mobile-firefox-dev">mobile-firefox-dev</a></li> + <li>Contacte a nossa equipa atrvés do <a href="irc://irc.mozilla.org/#mobile">IRC</a></li> + <li>Junte-se no nosso <a href="https://wiki.mozilla.org/Mobile/Notes">Encontro de Desenvolvimente da Quarta-Feira</a></li> + <li>Mantenha-se atualizado com notícias do projeto em <a href="http://planet.firefox.com/mobile/">Planeta Firefox Móvel</a>, <a href="http://fennecnightly.tumblr.com/">Tumblr</a> e <a href="https://twitter.com/FennecNightly">Twitter</a></li> + <li><a href="https://wiki.mozilla.org/Mobile/Fennec/Android">Desenvolva e personalize no Firefox para Android</a> (Fennec)</li> +</ul> + +<h2 id="Programar_para_a_Web_móvel">Programar para a Web móvel</h2> + +<p>Nós começamos a criar um guia para <a href="/En/Mobile" title="En/Mobile">desenhar sites da Web para os dispositivos móveis</a>.</p> + +<p>Com Firefox para Android, pode aceder a um numero of APIs que expoem as capacidades subjacentes do dispositivo, diminuíndo a distância entre a Web e as aplicações nativas:</p> + +<ul> + <li><a href="/pt-PT/docs/Web/API/API_do_Estado_da_Bateria"><u>Bateria</u></a></li> + <li><u><a href="/pt-PT/docs/Archive/B2G_OS/API/Camera_API" title="Using the Camera API">Câmara</a></u></li> + <li><u><a href="/en/API/WebTelephony/Introduction_to_WebTelephony" title="Introduction to WebTelephony">WebTelephony</a></u></li> + <li><u><a href="/en/API/WebSMS/Introduction_to_WebSMS" title="Introduction to WebSMS">WebSMS</a></u></li> + <li><u><a href="/pt-PT/docs/Web/API/Geolocation/Utilizacao_da_geolocalizacao" title="Using geolocation">Geoloca</a><a href="/pt-PT/docs/Web/API/Geolocation/Utilizacao_da_geolocalizacao" title="Using geolocation">lização</a></u></li> + <li><a href="/pt-PT/docs/Web/API/Detetar_orientacao_dispositivo"><u>Orientação</u></a></li> + <li><a href="https://developer.mozilla.org/en/WebAPI/Web_Activities">Atividades Web</a></li> +</ul> + +<p>Para testar o seu site da Web no Firefox para Android, pode instalar o Firefox para Android no seu dispositivo móvel ou pode executá-lo no seu computador utilizando o <a class="link-https" href="https://wiki.mozilla.org/Mobile/Fennec/Android/Emulator">Emulador Android.</a>.</p> + +<h2 id="Desenvolver_extras_para_dispositivos_móveis">Desenvolver extras para dispositivos móveis</h2> + +<p><a href="/en/Extensions/Mobile" title="en/Extensions/Firefox_on_Android">Firefox for Android supports add-ons</a> using the exact same <a href="/en/Extensions" title="en/Extensions">extension system</a> used by all other Gecko-based applications. We did not invent a new add-on system. This means that building an add-on for Firefox on Android is the <a href="/en/Building_an_Extension" title="en/Building_an_Extension">same process</a> that would be used for desktop Firefox. Add-ons that work with desktop Firefox <strong>do not</strong> automatically work in Firefox on Android. The user interfaces are just too different.</p> + +<div class="note">O Firefox no Android tem um identificador de aplicação único que deve ser utilizado em <code>install.rdf</code>. O identificador é <code>{aa3c5121-dab2-40e2-81ca-7ea25febc110}</code></div> + +<p>Both classic restart-required and newer <a href="/en/Extensions/Bootstrapped_extensions" title="en/Extensions/Bootstrapped_extensions">restartless</a> add-on approaches are supported. Using the restartless approach is preferred whenever possible because the user experience is far superior to forcing an application restart when installing or removing an add-on.</p> + +<h3 id="Resumo_Rápido">Resumo Rápido</h3> + +<ul> + <li>There is no visible XUL in the UI, so using overlays to try to add or change UI is useless.</li> + <li>Internal code and objects, like <code>gBrowser</code>, do not exist. Look at the Firefox on Android <a class="external" href="http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/browser.js" title="http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/browser.js"><code>browser.js</code></a> file to learn about the internals. Much of the same fundamental functionality exists.</li> + <li>Services like <code>nsIPromptService</code> and <code>nsIAlertsService</code> are implemented to use native Android UI.</li> + <li>There is a simple JavaScript object, called <a href="/en/Extensions/Mobile/API/NativeWindow" title="en/Extensions/Mobile/NativeWindow"><code>NativeWindow</code></a>, that allows you to manipulate parts of the native Android UI.</li> +</ul> + +<h2 id="Obter_ajuda_com_o_Firefox_para_Android">Obter ajuda com o Firefox para Android</h2> + +<p>A documentação e tutoriais para utilizar e a resolução de problemas do Firefox para Android estão disponíveis no <a class="external" href="https://support.mozilla.org/pt-PT/products/mobile" title="http://support.mozilla.org/mobile">site da Web de Apoio da Mozilla</a>.</p> + +<h2 id="Install_Firefox_for_Android">Install Firefox for Android</h2> + +<p>If you don't already have Firefox installed on your Android device, you can do so at the <a href="https://www.mozilla.org/en-US/firefox/android/">Google Play store</a>. See the SUMO article <a href="https://support.mozilla.org/en-US/kb/install-firefox-android-device-using-google-play">Install Firefox on an Android device using Google Play</a> for detailed instructions.</p> + +<h3 id="Alternate_installs">Alternate installs</h3> + +<p>There are some unofficial builds and specialized installations for devices which don't officially support Firefox for Android. Here are some helpful links for these (keep in mind they are <strong>not supported by Mozilla</strong> and <strong>you are using them at your own risk!</strong>).</p> + +<ul> + <li><a href="https://support.mozilla.org/en-US/kb/installing-firefox-android-amazon-kindle-fire">Installing Firefox for Android on Amazon Kindle Fire</a></li> +</ul> diff --git a/files/pt-pt/mozilla/how_to_get_a_stacktrace_for_a_bug_report/index.html b/files/pt-pt/mozilla/how_to_get_a_stacktrace_for_a_bug_report/index.html new file mode 100644 index 0000000000..0c9d6d4e8d --- /dev/null +++ b/files/pt-pt/mozilla/how_to_get_a_stacktrace_for_a_bug_report/index.html @@ -0,0 +1,97 @@ +--- +title: Como obter um rastreamento para o relatório de erros +slug: Mozilla/How_to_get_a_stacktrace_for_a_bug_report +tags: + - Bugzilla +translation_of: Mozilla/How_to_get_a_stacktrace_for_a_bug_report +--- +<p>Se registar um relatório de crache no Bugzilla sobre um crache, deverá incluir um rastreamento (<em>call stack</em>) no seu relatório. Um rastreamento irá dizer aos programadores da Mozilla o que aconteceu e fornecer um ponto de partida para investigar a sua causa. Este artigo descreve como utilizar o 'relatóriod e Crache' da Mozilla (<em>Breakpad</em>) para obter uma Id. de crache, que os nossos engenheiros podem utilizar para obter um rastreamento, e formas alternativas de obter um rastreamento se não conseguir uma Id. de crache.</p> + +<h2 id="Requisitos">Requisitos</h2> + +<p>You need a binary build of Firefox from <a class="external" href="http://www.mozilla.com/en-US/firefox/">Mozilla.org</a>. SeaMonkey and Thunderbird also support crash reporting.</p> + +<p>Mozilla's crash report server currently only has debug information for Mozilla builds and thus the crash reporter cannot work if you use a build from a Linux distribution or if you compile from source code. In these cases you will need to use one of the <a href="#Alternative_ways_to_get_a_stacktrace">alternative methods</a> listed below.</p> + +<div class="note"><strong>Nota: </strong>When filing a crash report, it is important to know whether the crash occurs with <a class="external" href="http://support.mozilla.com/en-US/kb/Safe+Mode" title="http://support.mozilla.com/en-US/kb/Safe+Mode">Firefox safe mode</a>. This helps engineers determine whether a particular <a class="external" href="http://support.mozilla.com/en-US/kb/Troubleshooting+extensions+and+themes" title="http://support.mozilla.com/en-US/kb/Troubleshooting+extensions+and+themes">extension</a> or <a class="external" href="http://support.mozilla.com/en-US/kb/Troubleshooting+plugins" title="http://support.mozilla.com/en-US/kb/Troubleshooting+plugins">plugin</a> is the cause of the crash.</div> + +<h2 id="Como_obter_uma_Id._de_crache_com_o_'Relat´rio_de_Crache'_da_Mozilla">Como obter uma Id. de crache com o 'Relat´rio de Crache' da Mozilla</h2> + +<table style="width: 100%;"> + <tbody> + <tr> + <td> + <p><strong>1. Crash and submit a report to the system.</strong></p> + + <p>The Mozilla Crash Reporter window should automatically come up after Firefox crashes. If you have any additional information about the crash, such as additional detail on what you were doing at the time that may have triggered the crash, please enter it into the comments box. Be sure that you <strong>check the "Tell Mozilla about this crash"</strong><strong> checkbox</strong> and click the restart button. The crash reporter should now submit the crash report and Firefox should open again.</p> + + <div class="note">The "Details" button gives additional data about the incident, however this is not useful in a bug report.</div> + </td> + <td> + <p style="text-align: center;"><img alt="reporter.jpg" class="internal lwrap" src="../../../../@api/deki/files/2854/=reporter.jpg?size=webview" style="float: left; height: 307px; width: 300px;"></p> + </td> + </tr> + </tbody> +</table> + +<table style="width: 100%;"> + <tbody> + <tr> + <td> + <p><strong>2. Tell us the ID of the report you submitted.</strong></p> + + <p>To access all of your submitted reports<strong> type "about:crashes" into the Firefox address bar</strong> and press enter. Firefox should open a list of IDs for your submitted crash reports. Copy two or three of the IDs for the appropriate crashes and paste them into your Bugzilla report. Please check the listed times to avoid copying the ID of an unrelated crash report.</p> + + <div class="note">You can prefix a "bp-" to the beginning of an ID to make Bugzilla turn it into a link: <strong>bp-</strong>a70759c6-1295-4160-aa30-bc4772090918</div> + </td> + <td> + <p style="text-align: center;"><img alt="crashlist.jpg" class="internal lwrap" src="../../../../@api/deki/files/2855/=crashlist.jpg?size=webview" style="float: left; height: 403px; width: 450px;"></p> + </td> + </tr> + </tbody> +</table> + +<h3 id="How_to_get_the_crash_ID_if_Firefox_crashes_on_startup">How to get the crash ID if Firefox crashes on startup</h3> + +<p>If Firefox crashes on startup you can still access your submitted crash reports. Crash reports are accessible from all Firefox profiles, so if a <a class="external" href="http://support.mozilla.com/en-US/kb/Managing+Profiles" title="http://support.mozilla.com/en-US/kb/Managing+Profiles">new profile</a> does not crash you can use it to access them through "about:crashes" <a class="external" href="/En/How_to_get_a_stacktrace_for_a_bug_report#How_to_get_a_crash_ID_with_the_Mozilla_Crash_Reporter" title="https://developer.mozilla.org/En/How_to_get_a_stacktrace_for_a_bug_report#How_to_get_a_crash_ID_with_the_Mozilla_Crash_Reporter">as above</a>.</p> + +<h4 id="Aceder_às_Ids._do_relatório_de_crache_fora_do_Firefox">Aceder às Ids. do relatório de crache fora do Firefox</h4> + +<p>If you cannot load Firefox at all you can find the crash report files at this location depending on your operating system:</p> + +<p>Windows : <span class="filename">%APPDATA%\Mozilla\Firefox\Crash Reports\submitted\</span><br> + OS X : <span class="filename">~/Library/Application Support/Firefox/Crash Reports/submitted/</span><br> + Linux : <span class="filename">~/.mozilla/firefox/Crash Reports/submitted/</span></p> + +<p>Each file in this folder contains one submitted crash report ID. You can check the modified or creation time for each file to discern which crash reports are relevant to your bug report.</p> + +<h2 id="Modos_alternativos_para_obter_um_rastreamento">Modos alternativos para obter um rastreamento</h2> + +<p>If the Mozilla crash reporter doesn't come up or isn't available you will need to obtain a stacktrace manually:</p> + +<h4 id="Windows">Windows</h4> + +<p>See the article <a class="internal" href="/en/How_to_get_a_stacktrace_with_WinDbg" title="En/How to get a stacktrace with WinDbg">Create a stacktrace with Windbg</a> for information on how to do this.</p> + +<p>For a full process dump, see <a href="/en-US/docs/How_to_get_a_process_dump_with_Windows_Task_Manage" title="/en-US/docs/How_to_get_a_process_dump_with_Windows_Task_Manage">How to get a process dump with Windows Task Manager [en-US]</a></p> + +<h4 id="OS_X">OS X</h4> + +<p>Run /Applications/Utilities/Console.app. Expand "~/Library/Logs" and "CrashReporter", then look for logs for "firefox-bin".</p> + +<h4 id="Linux">Linux</h4> + +<p>Note that for most distros the package you need to get symbols for will be something like "xulrunner", not "firefox".</p> + +<h2 id="Where_did_my_crash_get_submitted.3F" name="Where_did_my_crash_get_submitted.3F">Os ficheiros de relatórios de crache no seu computador</h2> + +<p>When Breakpad initially catches a crash it first writes crash report files (e.g. .dump and .extra files) into the 'pending' subdirectory of its 'Crash Reports' directory.</p> + +<p>If Breakpad successfully sends the crash report to the reporting server then, by default, the files added to the 'pending' subdirectory for the crash are removed, and a .txt file is placed in the 'submitted' directory containing the crash ID that the reporting server recorded the crash under. If you want Breakpad to leave the .dump and .extra files on your computer so that you can examine them locally, then set the MOZ_CRASHREPORTER_NO_DELETE_DUMP environment variable to 1.</p> + +<ul> + <li>Ubuntu: <a class="link-https" href="https://wiki.ubuntu.com/MozillaTeam/Bugs#Obtain%20a%20backtrace%20from%20an%20apport%20crash%20report%20(using%20gdb)" title="https://wiki.ubuntu.com/MozillaTeam/Bugs#Obtain a backtrace from an apport crash report (using gdb)">Instructions from the Ubuntu Team</a></li> + <li>openSUSE: <a class="external" href="http://en.opensuse.org/openSUSE:Bugreport_application_crashed" title="http://en.opensuse.org/openSUSE:Bugreport_application_crashed">General instructions from openSUSE</a></li> + <li>Fedora: <a class="external" href="http://fedoraproject.org/wiki/StackTraces" title="http://fedoraproject.org/wiki/StackTraces">Capturing Stack Traces</a></li> + <li>Gentoo: <a class="external" href="http://www.gentoo.org/doc/en/bugzilla-howto.xml#doc_chap2" title="http://www.gentoo.org/doc/en/bugzilla-howto.xml#doc_chap2">Debugging using GDB</a></li> +</ul> diff --git a/files/pt-pt/mozilla/implementacao_do_pontoon_num_projeto_da_mozilla/index.html b/files/pt-pt/mozilla/implementacao_do_pontoon_num_projeto_da_mozilla/index.html new file mode 100644 index 0000000000..05fb22e5c3 --- /dev/null +++ b/files/pt-pt/mozilla/implementacao_do_pontoon_num_projeto_da_mozilla/index.html @@ -0,0 +1,77 @@ +--- +title: Implementação do Pontoon num projeto da Mozilla +slug: Mozilla/Implementacao_do_Pontoon_num_projeto_da_Mozilla +tags: + - Localização + - Tradução +translation_of: Mozilla/Implementing_Pontoon_in_a_Mozilla_website +--- +<p><a class="external" href="https://pontoon.mozilla.org" title="https://pontoon.mozilla.org">Pontoon</a> é uma ferramenta de localização (l10n), O-Que-Vê-É-O-Que-Obtém (WYSIWYG) baseada na Web. É uma ferramenta muito simples e intuitiva que requer poucos conhecimentos técnicos para os tradutores utilizarem, que irá reduzir o seu tempo para publicar as versões loacalizadas do seu projeto. Aqui, nós iremos discutir como é que pode utilizar o Pontoon com o seu projeto da Mozilla.</p> + +<div class="note"> +<p><strong>Would you like to improve Pontoon?</strong> Learn how to get involved on <a href="https://github.com/mozilla/pontoon">GitHub</a>.</p> +</div> + +<div class="note"> +<p><strong>Just getting started with your project l10n?</strong> Check out the wiki on <a href="https://wiki.mozilla.org/L10n:NewProjects">getting your project localized</a>.</p> +</div> + +<h2 id="A._Make_your_project_localizable">A. Make your project localizable</h2> + +<p>We realize that these are already considered to be standard <a href="http://mozweb.readthedocs.org/en/latest/reference/l10n.html">best practices</a> for localizing projects at Mozilla, but we feel it's good to add them here as a little reminder.</p> + +<ol> + <li>Ensure that your project supports one of the l10n frameworks (<a href="http://www.gnu.org/software/gettext/">gettext</a>, <a href="http://docs.oasis-open.org/xliff/xliff-core/v2.0/xliff-core-v2.0.html">XLIFF</a>, <a href="http://l20n.org/">L20n</a>, <a href="https://github.com/mozilla-l10n/langchecker/wiki/.lang-files-format">lang</a>, <a href="https://en.wikipedia.org/wiki/.properties">properties</a>, etc.).</li> + <li>Extract localizable strings into resource files.</li> + <li>Push resource files to a repository (SVN, HG, Git). + <ul> + <li>Individual locale folders must be located at the same nesting level of the directory tree. Source locale needs to be called <code>templates</code>, <code>en-US</code>, <code>en-us</code> or <code>en</code>. If multiple folders with such name exist in the repository and contain files in a supported file format, the first one will be used. You may want to put all locale folders in a dedicated <code>locales</code> folder for this purpose. Locale code must not be part of the file name.</li> + <li>Correct pattern: + <pre>/locales/{locale_code}/path/to/file.extension</pre> + </li> + <li>Incorrect pattern: + <pre>/locales/{locale_code}/path/to/file.{locale_code}.extension</pre> + </li> + </ul> + </li> + <li>Make sure Pontoon has write access to the repository. + <ul> + <li>If using GitHub, add <a href="https://github.com/mozilla-pontoon">mozilla-pontoon</a> or <a href="https://github.com/orgs/mozilla/teams/pontoon-l10n-robots">pontoon-l10n-robots</a> as collaborator to your project.</li> + </ul> + </li> +</ol> + +<h2 id="B._(optional)_Enable_in-page_localization_of_your_web_project">B. (optional) Enable in-page localization of your web project</h2> + +<ol> + <li>Link a script from your HTML <code><body></code> element, so Pontoon can talk to your site, detect content and make it localizable in place. You only need to do this in the environment that will be used for in-page localization, e.g. staging server: + + <ul> + <li> + <pre id="line1"><span> </span><span><<span class="start-tag">script</span> <span class="attribute-name">src</span>="<a class="attribute-value">https://pontoon.mozilla.org/pontoon.js</a>"</span><span>></<span class="end-tag">script</span>></span></pre> + </li> + </ul> + </li> + <li>If your site uses <a href="/docs/Web/Security/CSP">CSP</a>, please make sure that the following is permitted for domain <code>pontoon.mozilla.org</code>: + <ol> + <li>loading inside iframe</li> + <li>loading remote CSS</li> + <li>loading remote images</li> + </ol> + </li> + <li>If your site uses the <a href="/docs/Web/HTTP/Headers/X-Frame-Options">X-Frame-Options</a> header, please make sure loading inside iframe is permitted for domain <code>pontoon.mozilla.org</code>.</li> + <li>Make sure your site supports HTTPS. It's free, automated and open. <a href="https://letsencrypt.org/">Let's encrypt</a>!</li> +</ol> + +<h2 id="C._Add_your_project_to_Pontoon">C. Add your project to Pontoon</h2> + +<p>Your project is now ready to be set up in Pontoon. Please file a bug in <a href="https://bugzilla.mozilla.org/enter_bug.cgi?product=Localization%20Infrastructure%20and%20Tools&component=Administration%20%2F%20Setup">Localization Infrastructure and Tools :: Administration / Setup</a> and provide the following information:</p> + +<ul> + <li>Project name</li> + <li>Repository URL</li> + <li>List of requested locales</li> + <li>Website URL, including all subpage URLs (only if using in-page localization)</li> +</ul> + +<p>For more details, please get in touch with the <a href="mailto:pontoon-team@mozilla.com">Project Management Team</a>.</p> diff --git a/files/pt-pt/mozilla/index.html b/files/pt-pt/mozilla/index.html new file mode 100644 index 0000000000..347e26f48e --- /dev/null +++ b/files/pt-pt/mozilla/index.html @@ -0,0 +1,16 @@ +--- +title: Mozilla +slug: Mozilla +tags: + - Aplicações + - Apps + - Avançado + - Extras + - Mozilla +translation_of: Mozilla +--- +<div class="boxed translate-rendered"> +<p>Os artigos abaixo, incluem conteúdo sobre transferência e criação de código da Mozilla. Além disso, irá encontrar artigos úteis sobre como o código funciona, como criar extras para as aplicações da Mozilla, etc.</p> + +<p>{{LandingPageListSubpages}}</p> +</div> diff --git a/files/pt-pt/mozilla/ligar/index.html b/files/pt-pt/mozilla/ligar/index.html new file mode 100644 index 0000000000..2fda2a50be --- /dev/null +++ b/files/pt-pt/mozilla/ligar/index.html @@ -0,0 +1,117 @@ +--- +title: Ligar com Mozilla +slug: Mozilla/Ligar +tags: + - Ligar + - Mozilla +translation_of: Mozilla/Connect +--- +<p class="summary">Habilitar, inspirar e colaborar para tornar a Web na plataforma primária mais utilizada, para criar experiências através de todos os dispositivos interligados.</p> + +<div class="column-container dev-program-callouts dev-program-block dev-program-first dev-program-column-wrapper"> +<div class="dev-program-callout"> +<div class="callout-link-container"> +<h2 id="Blogue_de_Hacks">Blogue de Hacks</h2> + +<p>Um recurso chave para as pessoas desenvolverem para a Web Aberta, o blogue de Hacks da Mozilla oferece notícias e discussões sobre as últimas tecnologias da e funcionalidades de navegador.</p> + +<div class="callout-link-wrapper"><a class="callout-link ignore-external" href="https://hacks.mozilla.org/" style="white-space: normal;">Read it now </a></div> +</div> +</div> + +<div class="dev-program-callout"> +<div class="callout-link-container"> +<h2 id="Canais_de_OpiniõesCríticas">Canais de Opiniões/Críticas</h2> + +<p>Teum uma <a href="http://mzl.la/devtools">idea fantástica paras as Ferramentas de Desenvolvimento</a>? Contacte-nos e ajude a moldar as funcionalidades de futuro!</p> +<a class="callout-link ignore-external" href="http://stackoverflow.com/r/mozilla" style="white-space: normal;"> </a></div> +</div> + +<div class="dev-program-callout"> +<div class="callout-link-container"> +<h2 id="Hack_na_MDN">Hack na MDN</h2> + +<p>Whether you hack code or text, we have <a href="/en-US/docs/MDN/Getting_Started">ways you can help make MDN better</a>. When you create an MDN profile, you can show off your work here, and get early access to MDN features over time as we roll them out.</p> + +<div class="callout-link-wrapper"><a class="callout-link" href="/profile/edit" style="white-space: normal;">Join or login </a></div> +</div> +</div> +</div> + +<div class="dev-program-explanation dev-program-block"> +<h2 id="Ligar_com_Mozilla">Ligar com Mozilla</h2> + +<p>Developers are creating the future by building services and apps for people all over the world. The goal of Mozilla Developer Relations is to help developers to use open and standardized web technologies to succeed in achieving their goals. We offer help and other resources towards this goal, through various channels. We invite you to connect, learn, and share your knowledge.</p> + +<p>Reach out to us at devrel@mozilla.com or on the irc.mozilla.org #devrel IRC channel. We also have a newsletter keeping you informed about the latest happenings in the web scene around web apps and more. <a href="https://marketplace.firefox.com/developers/#newsletter-signup">Subscribe to the Apps & Hacks newsletter.</a></p> + +<p>We have a lot of plans and ideas for iteratively expanding our Developer Relations offerings, and we want you involved as we do so! So <a href="https://hacks.mozilla.org/">subscribe to the Hacks blog</a> and <a href="https://marketplace.firefox.com/developers/#newsletter-signup">subscribe to the newsletter</a>!</p> + +<p>If you're on <a href="http://www.twitter.com/MozDevNet">Twitter</a>, <a href="http://www.twitter.com/MozDevNet">follow us</a> and hear about doc updates, jobs, contributor opportunities, and more.</p> + +<h2 id="Aderir_à_Mozilla" style="line-height: 30px;"><strong>Aderir à Mozilla</strong></h2> + +<p>If you want to go beyond connecting with <strong>Mozilla</strong>, you can join <strong>Mozilla </strong>and help realize <a href="https://www.mozilla.org/mission/">Mozilla's mission of building a better Internet</a>. As a developer, you have skills to contribute in many areas, as well as the opportunity to enhance your skills. Mozilla is an open source project, so we "default to open." You can "view source" and contribute to our software development projects, like the Firefox browser for desktop and Android, Firefox OS, and Mozilla's websites. You can become part of an international community and get recognition for your efforts. Here are some of the advantages of contributing to the Mozilla project.</p> + +<h3 id="Oportunidade_para_aprender_qualquer_coisa_nova"><strong>Oportunidade para aprender qualquer coisa nova </strong></h3> + +<div> +<p>In writing code for an open source project, you may face problems you have not encountered before, which present learning opportunities for you. You can try out new tools and techniques in an open source project. For example, if you have never done unit testing, and cannot get permission to do so at work then coding for an open source project would be an excellent place to learn more about it. Contributing to open source gives you the opportunity to collaborate with and get to know many people around the world who have similar interests. Moreover, an open source organization like Mozilla has many contributors who can help you in solving problems you encounter. If you're just getting started contributing, you can look for "mentored" bugs, where an experienced contributor has offered to help a newcomer fix them.</p> + +<h3 id="O_que_eu_obtenho_ao_contribuir"><strong>O que eu obtenho ao contribuir? </strong></h3> + +<p>Exploring many things and gaining recognition in the community -- these are the intangible benefits of contributing to Mozilla. While we can't guarantee specific tangible benefits, many valued contributors receive free Mozilla gear and invitations to Mozilla-related events, and are first in line to be considered for internships. Moreover, your experience in contributing to an open source project might help you find a job. More and more employers of developers are looking at open source contributions. They like to see that you're blogging and contributing to mailing lists, and they like to see you listed as a contributor to an open source project. It may also help with the work experience section of your CV/resumé.</p> + +<h3 id="Como_pode_contribuir_para_a_Mozilla"><strong>Como pode contribuir para a Mozilla</strong></h3> + +<p>There are many project area for which you can contribute to Mozilla. You can find a current, complete list on the main Mozilla <a href="https://www.mozilla.org/contribute">Get Involved</a> page. Some areas that may interest you as a developer include:</p> + +<ul> + <li><a href="http://www.whatcanidoformozilla.org/">Codificação</a></li> + <li><a href="http://www.whatcanidoformozilla.org/">Desenvolvimento da Web</a></li> + <li><a href="/en-US/Firefox_OS/Developing_Gaia">Firefox OS</a></li> + <li><a href="https://quality.mozilla.org/teams/">Perguntas de Respostas</a></li> + <li><a href="https://wiki.mozilla.org/Marketplace/Contributing/Addons">Complementos</a></li> + <li><a href="https://wiki.mozilla.org/Marketplace/Contributing/Apps">Aplicações</a></li> + <li><a href="/en-US/docs/MDN/Getting_started">Documentação de desenvolvimento (aqui na MDN)</a></li> +</ul> +</div> +</div> + +<div class="column-container dev-program-block"> +<div class="column-half" id="Developer_discussions"> </div> + +<div class="column-half dev-program-hacks dev-program-block"> </div> +</div> + +<p class="dev-program-block"><img alt="Developers at a Firefox OS workshop in Madrid." src="https://mdn.mozillademos.org/files/7479/PhonesUp.jpg" style="display: block; height: 359px; margin: 0px auto; max-width: 100%; width: 720px;"></p> + +<div class="column-container dev-program-block"> +<div class="column-7 dev-program-events"> +<h2 id="Onde_está_a_Mozilla">Onde está a Mozilla?</h2> + +<p><a class="heading-link" href="https://www.mozilla.org/en-US/contribute/events/">View attendees and details on our Events page... </a></p> +</div> + +<div class="column-5"> +<h2 id="Outros_recursos">Outros recursos</h2> + +<ul class="no-bullets"> + <li><a href="http://www.youtube.com/user/mozhacks">Hacks da</a> <a href="http://www.youtube.com/user/mozhacks">Mozilla</a> <a href="http://www.youtube.com/user/mozhacks"> no YouTube</a> + + <ul> + <li><a href="http://www.youtube.com/playlist?list=PLo3w8EB99pqIHIUUv08hBCHq1OgPKhdo0">Vídeos do Firefox OS</a></li> + <li><a href="http://www.youtube.com/playlist?list=PLo3w8EB99pqLZNY22xKbTEzMfYo9PXAlm">Vídeos de ferramentas de Desenvolvimento do Firefox</a></li> + </ul> + </li> + <li><strong>Siga-nos no Twitter</strong> + <ul class="no-bullets"> + <li><a href="https://twitter.com/mozdevnet">@MozDevNet</a>: Notícias e notas da MDN</li> + <li><a href="https://twitter.com/mozhacks">@mozhacks</a>: Novidades no blogue de Hacks</li> + <li><a href="https://twitter.com/mozappsdev">@mozappsdev</a>: Para os responsáveis pelo desenvolvimento de aplicação da Web</li> + <li> </li> + </ul> + </li> +</ul> +</div> +</div> diff --git a/files/pt-pt/mozilla/localization/aplicação_tradução_com_mercurial/index.html b/files/pt-pt/mozilla/localization/aplicação_tradução_com_mercurial/index.html new file mode 100644 index 0000000000..ef44aa26fa --- /dev/null +++ b/files/pt-pt/mozilla/localization/aplicação_tradução_com_mercurial/index.html @@ -0,0 +1,282 @@ +--- +title: Tradução da Aplicação com Mercurial +slug: Mozilla/Localization/aplicação_tradução_com_mercurial +translation_of: Mozilla/Localization/Application_Translation_with_Mercurial +--- +<h4 id="draft">{{draft}}</h4> + +<h2 id="Verifique_qual_o_idioma_que_está_disponível_para_tradução">Verifique qual o idioma que está disponível para tradução</h2> + +<ol> + <li>Find out on which branch localization is done for your locale: Read <a href="https://l10n.mozilla.org/teams/">your localization team's page</a> by clicking on the team with your <a href="https://en.wikipedia.org/wiki/Language_code">language code</a> (e.g. "de" for German). The localization lead for your language knows the branch. The <strong>default localization branch</strong> is <strong>aurora</strong>.</li> + <li>Next check what is still untranslated by going to <a href="https://l10n.mozilla.org/teams/">Localization status page</a> and click on the page for your language.</li> + <li>In the section "Applications & Sign-offs", you will find different products and branches which are currently in translation. + <ul> + <li>gaia-* denotes branches of <a href="http://www.mozilla.org/en-US/firefox/os/">Firefox OS</a>, the operating system for mobile devices.</li> + <li>Firefox and fx-* denote branches of <a href="http://www.mozilla.org/firefox">Firefox for Desktop</a>, the browser for desktops and notebooks running, Windows, Mac OS or Linux.</li> + <li>Fennec and fennec-* denote branches of <a href="http://www.mozilla.org/en-US/firefox/fx/">Firefox for Mobile</a>, the Firefox browser for the Android operating system.</li> + <li>Thunderbird and tb-* denote branches of <a href="http://www.mozilla.org/thunderbird">Thunderbird</a>, the mail client, newsgroup and feed reader and chat client. The localization of the <a href="https://www.mozilla.org/en-US/projects/calendar/">Lightning calendar add-on </a>also takes place on these branches.</li> + <li>SeaMonkey and sea-* denote branches of <a href="http://www.seamonkey-project.org/">SeaMonkey</a>, the suite consisting of browser, mail and chat client and more.</li> + <li>Lightning and cal-* denote branches of Lightning, the calendar add-on for Thunderbird. The localization of Lightning now happens on Thunderbird's tb-* branches, the cal-* branches have been retired.<span id="cke_bm_478E" style="display: none;"> </span></li> + </ul> + </li> + <li>In this example, we assume Firefox for Desktop shall be localized and that the localization branch is aurora. Scroll to the <strong>fx_aurora</strong> text.</li> + <li>Read the text next to it. + <ul> + <li>If it is '<strong>Translated</strong>', the branch has already been translated. Either translate a different product now or contact the person responsible for localization from the team's page (see above) so he can notify you by mail when the next strings for translation become available.</li> + <li>If it is a red text consisting of a <strong>number</strong> and the word '<strong>missing</strong>', then there are untranslated texts and you can move on with this guide.<br> + </li> + </ul> + </li> +</ol> + +<h2 id="Ferramentas_Necessárias">Ferramentas Necessárias</h2> + +<h4 id="Pré-requisitos_de_criação">Pré-requisitos de criação</h4> + +<p>First, get the required programs to compile Mozilla applications like Firefox and Thunderbird from <a href="/pt-PT/docs/Guia_do_desenvolvedor/Instruções_de_compilação">Instruções de Compilação</a>. This is only necessary once.</p> + +<div class="warning"> +<p>MozillaBuild deve estar instalado num caminho de ficheiro absoluto sem espaços em branco, senão este será interrompido..</p> +</div> + +<h4 id="Programa_de_comparação_de_ficheiro">Programa de comparação de ficheiro</h4> + +<p>For the translation, it is recommend to use file comparison program to compare the English file (containing the new texts) with the file of your locale (which is still missing the new strings). This example uses <a href="http://winmerge.org/">WinMerge</a>: Download and install it. A comparison of alternatives (e.g. for Linux and Mac OS) is available on <a href="https://en.wikipedia.org/wiki/Comparison_of_file_comparison_tools">Wikipedia</a>.</p> + +<h4 id="Editor_de_ficheiro_e_texto">Editor de ficheiro e texto</h4> + +<p>For editing individual files a text editor can be a better choice than a file comparion program, e.g. because the file is new and everything has to be translated, the file is too customized to compare it to the English one, or special functionality is required (e.g. bookmarking untranslated lines). Use a text editor you are comfortable with. This example uses <a href="http://notepad-plus-plus.org/">Notepad++</a>.</p> + +<h4 id="Ferramenta_de_monitorização_do_progresso">Ferramenta de monitorização do progresso</h4> + +<p>To track which strings and files already have been translated and later also to see which new strings have already been tested in the product as being a good translation for the functionality behind the translated strings and that the translated texts fit into the available, the translation progress should be tracked. This can be done in a text editor or word processor or any other tool in which you can attach different kind of states to the individual texts to translate. The Firefox extension <a href="https://addons.mozilla.org/firefox/addon/scrapbook/">Scrapbook</a> is used in this guide. Install it into your default Firefox profile (you will have more than one profile when following this guide).</p> + +<h2 id="Obter_os_Textos_atuais_em_inglês_e_o_seu_idioma">Obter os Textos atuais em inglês e o seu idioma</h2> + +<h4 id="Obter_os_textos_em_inglês_com_o_código_fonte">Obter os textos em inglês com o código fonte</h4> + +<p>Get the source code by downloading the following file:</p> + +<ul> + <li><strong>Firefox Desktop</strong> or <strong>Firefox for Android</strong>: Download the <strong>mozilla-<branch>.hg</strong> file (e.g. mozilla-aurora.hg) from <a href="https://ftp.mozilla.org/pub/mozilla.org/firefox/bundles/">https://ftp.mozilla.org/pub/mozilla.org/firefox/bundles/</a> The file is not small, but after initially downloading it, you only need to download the latest changes in the future.</li> + <li><strong>Thunderbird</strong>, <strong>Lightning</strong> or <strong>SeaMonkey</strong>: Download the <strong>comm-<branch>.hg</strong> file (e.g. comm-aurora.hg) from <a href="http://ftp.mozilla.org/pub/mozilla.org/thunderbird/bundles/">https://ftp.mozilla.org/pub/mozilla.org/thunderbird/bundles/</a></li> +</ul> + +<p>In the next step, we will unpack the source code:</p> + +<ol> + <li>Open an input shell, e.g. by pressing the Windows key and R on the keyboard <img alt="Screenshot of Windows key + R key" src="https://mdn.mozillademos.org/files/7211/windows%20key%20plus%20r.png" style="height: 30px; width: 82px;"> or by calling the "<code>Run...</code>" command from the Windows "Start" button, and then typing <code><strong>cmd</strong></code> and pressing the Enter key.</li> + <li>Launch the installed MozillaBuild toolset by launching it with its path, e.g. <code>C:\Mozilla\Coding\Buildtools\MozillaBuild\start-shell-msvc2010.bat</code> You can autocomplete the file path after typing a few characters and then pressing the Tabulator key.<br> + If you launch the start-shell-l10n.bat, compiling features will be disabled. You can create translation patches, but creating language packs for the application, binary repacks of the application (changing the localization of the program), and compiling the application likely won't work.</li> + <li>You are now in the Mozilla development environment which emulates a Linux environment. Now go to the directory where you want to put the source code. It's highly recommended to put it onto the fastest hard drive in the device. File paths here work starting with a slash (/) followed by the drive letter, and then the directory structure like on Windows, but using slashes (/) instead of backslashes (\). So let's go to C:\Mozilla by typing<br> + <code>cd /c/Mozilla/</code></li> + <li>Create a new directory for the source code:<br> + <code>mkdir mozilla-aurora</code></li> + <li>Initialize the new directory as new repository:<br> + <code>hg init mozilla-aurora</code></li> + <li>Go into the new directory:<br> + <code>cd mozilla-aurora</code></li> + <li>Unpack the source code:<br> + <code>hg unbundle /path/to/the/downloaded/mozilla-aurora.hg</code><br> + This can take some time, mostly depending on the performance of the hard drive.</li> + <li>Extract the files:<br> + <code>hg update</code></li> +</ol> + +<h4 id="Obter_os_textos_para_a_sua_localização">Obter os textos para a sua localização</h4> + +<ol> + <li>Go back to the parent folder of <code>mozilla-aurora</code>:<br> + <code>cd ..</code></li> + <li>Find the localization repository for your branch and language on <a href="http://hg.mozilla.org/">http://hg.mozilla.org/</a> E.g. for aurora and German (language code 'de'), it is <code>http://hg.mozilla.org/releases/l10n/mozilla-aurora/de/</code> Copy that url to the clipboard.</li> + <li>Copy the repository to your computer by running the following command:<br> + <code>hg clone http://hg.mozilla.org/releases/l10n/mozilla-aurora/de/ de-mozilla-aurora</code><br> + This should proceed pretty fast.<br> + On Windows, you can paste the url by calling the Paste command from the window menu in the upper left corner of the window.</li> +</ol> + +<h2 id="Configurar_as_suas_definições_de_utilizador_do_Mercurial">Configurar as suas definições de utilizador do Mercurial</h2> + +<p>Still in the command prompt, go to your home directory in the file system, e.g. for a Windows user, it looks like C:\Users\MyName , depending on your Windows version:</p> + +<p><code>cd /c/Users/MyName</code></p> + +<p>Now list all the files here:</p> + +<p><code>ls -a</code></p> + +<p>If there is no file called <code>.hgrc</code> , create it with</p> + +<p><code>> .hgrc</code></p> + +<p>This file stores your general Mercurial settings (Mercurial is the tool which manages the source code and its history of changes).</p> + +<p>Now go in the file system to the file and open it in your favorite text editor. Windows users can use e.g. <a href="http://notepad-plus-plus.org/">Notepad++</a>.</p> + +<p>Paste the following content into the file:</p> + +<pre>[ui] +username = Firstname Lastname <mynick@example.com> +merge = internal:merge + +[alias] +qexport = export -g -r qtip +qexportall = diff -r qparent + +[defaults] +commit = -v +diff = -p -U 8 +qdiff = -p -U 8 +qnew = -U + +[diff] +git = 1 +showfunc = 1 +unified = 8 + +[extensions] +hgext.mq = +progress = + +[hooks] + +</pre> + +<p>Put in your name and email address which later will be public on the internet after your translation patch got accepted and uploaded. Save the file and close it.</p> + +<h2 id="Ativar_filas_do_Mercurial_(correções_revertíveis)">Ativar filas do Mercurial (correções revertíveis)</h2> + +<p>Some time will pass between the moment in which you start the localization, finish it, test it, improve it, upload it for review and get review (maybe not approved on first try). Other localizers will likely have done changes to the translation, either adding new texts, removing obsolete ones or improving the current texts. This can cause conflicts between the changes you created and theirs. For this reason, updating patches kann be necessary so Mercurial is still able to find the lines in the files which it has to replace or where it has to add them. <a href="/en-US/docs/Mercurial_Queues">Mercurial queues</a> allow to revert changes and also pull changes and reapply your local changes.</p> + +<p>Go back to the localization directory:</p> + +<p><code>cd /c/Mozilla/de-mozilla-aurora</code></p> + +<p>Initiate Mercurial queues:</p> + +<p><code>hg qinit</code></p> + +<h2 id="Conhecer_o_estilo_de_tradução">Conhecer o estilo de tradução</h2> + +<p>For having good chances that the translation suggestions get accepted, they should match the translation style of the texts in the application already translated. In general, the labels in the applications should have the same style like the operating system, e.g. use the same order of subject, verb and objects; decline verbs or not like the operating system does.</p> + +<p>The following resources can help figuring out the translation style and translate according to them:</p> + +<ul> + <li><a href="https://l10n.mozilla.org/teams/">Check your localization team's page</a> by clicking on the team with your <a href="https://en.wikipedia.org/wiki/Language_code">language code</a> (e.g. "de" for German) for a style guide (e.g. <a href="https://wiki.mozilla.org/L10n:Teams:de/Leitfaden_%C3%9Cbersetzung">style guide</a> for German).</li> + <li><a href="http://transvision.mozfr.org/">Transvision</a> offers searching for texts and text ids ("entities" or "keys"), allowing to quickly find translations for already translated texts.</li> + <li><a href="http://www.microsoft.com/language/de-de/default.aspx">Microsoft's terminology search</a> allows fast lookups of localized technical terms.</li> +</ul> + +<h2 id="Escolher_o_que_traduzir">Escolher o que traduzir</h2> + +<p>Go to the <a href="https://l10n.mozilla.org/teams/">Localization status page</a> and click on the '<number> missing' label of the Firefox branch on which you want to translate, e.g. <strong>fx_aurora</strong>. The page which opens has a bar holding information about how many texts (strings) have already been translated, how many there are in English and your locale and have the same text, and how many are missing in your local. The interesting part follows below as list of missing texts.</p> + +<p><img alt="unchanged localization report" src="https://mdn.mozillademos.org/files/7303/mozilla%20-%20localization%20report%20-%20new.png" style="height: 396px; width: 483px;"></p> + +<p>The first line shows the locale for which the texts are being translated (in this example: de - German). With the second line start the file paths of the files which require changes. The file paths follow the directory structure of the locale repository downloaded for translation. In this example, the file aboutDialog can be found in the folder browser/chrome/browser/. The text striked through are texts which have been removed in the English version and can also be removed from the locale being worked on. In this example we will translate the one new text with the id <strong>privatebrowsingpage.howToStart4</strong> in the file <strong>aboutPrivateBrowsing.dtd</strong>.</p> + +<p>Tips for finding files with usually easily translateable texts:</p> + +<ul> + <li>Look for files in browser/chrome/browser/</li> + <li>Look for a file with only a few changes</li> + <li>Suggestions + <ul> + <li>Files starting with <strong>about</strong>...</li> + <li>Files in the <strong>preferences</strong> directory (browser/chrome/browser/preferences/)</li> + <li>The <strong>browser.dtd</strong> and <strong>browser.properties</strong> files if there aren't too many new strings.</li> + </ul> + </li> +</ul> + +<h2 id="Monotorizar_o_progresso_de_tradução">Monotorizar o progresso de tradução</h2> + +<p>If you translate more than a few strings, you usually want to keep track of what has already been translated (and later if the text has been tested in the product as fitting into the available area and suiting the functionality it describes). This guide achieves this with the Firefox extension <a href="https://addons.mozilla.org/firefox/addon/scrapbook/">Scrapbook</a>.</p> + +<ol> + <li>You installed Scrapbook earlier, now open it in Firefox either by calling it from the Firefox menu bar (press the Alt key to show it if necessary) using "View" > "Sidebar" > "Scrapbook" or by clicking its toolbar button which you likely have to add by toolbar customization if you didn't do this before.</li> + <li>Drag the tab with the localization error showing missing and obsolete strings to the sidebar.</li> + <li>After Scrapbook has saved the web page to your local disk, click with the right mouse button on the page in the sidebar and choose "Properties" from the context menu which gets opened. Rename it something meaningful, e.g. "Firefox <version number> translation".</li> + <li>After you saved the dialog, click with the left mouse button on the page in the sidebar to open the locally saved copy.</li> +</ol> + +<h2 id="Abrir_ficheiros_em_inglês_e_o_idioma_de_destino_lado-a-lado">Abrir ficheiros em inglês e o idioma de destino lado-a-lado</h2> + +<p>The localization report shows the IDs of added or removed texts, but the English text itself is still unknown. We get this by comparing the English version of the file with the one of the locale we are translating in. To do so,</p> + +<ol> + <li>Launch WinMerge.</li> + <li>From its "File" menu, choose "Save project".</li> + <li>For the file path of the left directory, go to the downloaded <code>mozilla-aurora</code> source code and then into its <strong><code>browser/locales/en-US/</code></strong> folder. In this example, the absolute file path is <code>C:\Mozilla\mozilla-aurora\browser\locales\en-US</code>.</li> + <li>Enable read-only mode for the left directory.</li> + <li>For the file path of the right directory, go to the downloaded translation directory <code>de-mozilla-aurora</code> and then into its <code>browser</code> folder. In this example, the absolute file path is <code>C:\Mozilla\de-mozilla-aurora\browser</code>.</li> + <li>Save this comparison as project so you can easily relaunch this comparision without selecting the directories again. A good name is e.g. <code>translation-mozilla-aurora-browser.winmerge</code></li> + <li>Open the comparison you just saved.</li> +</ol> + +<h2 id="A_tradução">A tradução</h2> + +<ol> + <li> + <p>Bring the console with Mercurial to the front.</p> + </li> + <li> + <p class="brush: bash">Start tracking changes you make against the localization repository by telling it that with the <strong><code>qnew</code></strong> subcommand to save these changes as patch in a mercurial queue. This patch needs a name, choose something meaning full like "<code>Firefox-<version number>-more-details</code>". In this example, <code>Firefox-29-aboutPrivateBrowsing</code> will be used.<br> + <code>hg qnew Firefox-29-aboutPrivateBrowsing</code></p> + </li> + <li>Switch back to WinMerge and navigate to <code>browser/chrome/browser/</code> and open the <code>aboutPrivateBrowsing.dtd</code> file. You will see something like this:<br> + <img alt="single file comparision in WinMerge without changes by the user" src="https://mdn.mozillademos.org/files/7305/mozilla%20-%20compare%20-%20unchanged.png"><br> + On the left, you see an overview of the comparison of the English and the non-English file. Gray parts indicate blocks of texts which can't be found in that file, dark yellow represents changed lines and light yellow the parts of text in it which is different.</li> + <li>Below the license header which should never changed, the texts are organized in the following format:<br> + <code><!ENTITY stringid "Text which will be shown in Firefox"></code></li> + <li>As you can see there is a bigger block of text not recognized. This is due to the texts which have in the English versionmoved from below the string with the id <code>privatebrowsingpage.howToStart3</code> to a position above it. Cut and paste these strings in the localized file so their position corresponds to the on in the English file.</li> + <li>Press the F5 key or click the reload button in WinMerge's toolbar to re-compare the files.</li> + <li>Now copy the empty lines below <code>privatebrowsingpage.learnMore</code> and the line <code><!-- TO BE REMOVED POST-AUSTRALIS --></code> to the localized file. This text is a comment (which in .dtd files always can be found between <code><!--</code> and <code>--></code>). There is no need to translate this text.</li> + <li>Now we copy the two missing lines from the English file and insert them in the localized file:<br> + <code><!-- LOCALIZATION NOTE (privatebrowsingpage.howToStart4): please leave &newPrivateWindow.label; intact in the translation --><br> + <!ENTITY privatebrowsingpage.howToStart4 "To start Private Browsing, you can also select &newPrivateWindow.label; from the menu."></code><br> + The first line is a comment providing information on the localization of the text in the following line. <code>&newPrivateWindow.label;</code> has to be left unchanged so it can be replaced with the text of the string id <code>&newPrivateWindow.label;</code> whis is stored elsewhere<code>.</code></li> + <li><strong>Translation time</strong>: Translate the text. Afterwars, the line should look somehow like this:<br> + <code><!ENTITY privatebrowsingpage.howToStart4 "Der private Modus kann auch über den Menü-Eintrag &newPrivateWindow.label; gestartet werden."></code></li> + <li>Save the file.</li> +</ol> + +<h2 id="Exportar_as_alterações_como_correção">Exportar as alterações como correção</h2> + +<p>A patch is a file containing recorded changes to a repository. It can be used to apply these changes to a copy of the repository yet without these changes.</p> + +<ol> + <li>Tell Mercurial to store the changes in the Mercurial queue with the <code>qref</code> command. We also create a commit message which will describe the changes in the patch and later get used when the patched gets checked in ('added') to the official repository with the localized files. For the commit message, we have to use the <code>-m</code> command line flag,<br> + <code>hg qref -m "Firefox 29: Localize missing string in aboutPrivateBrowsing.dtd"</code><br> + You can change the commit message in the Mercurial queue every time by calling <code>hg qref</code> again.</li> + <li>Now export the patch to the file system using the <code>qexport</code> command which is defined in the <code>.hgrc</code> file (see above):<br> + <code>hg qexport > ../firefox-29-aboutPrivateBrowsing-v1.patch</code><br> + This creates a patch file called <code>firefox-29-aboutPrivateBrowsing-v1.patch</code> containing the changes in the parent directory of <code>de-mozilla-aurora</code> (in this example: <code>C:\Mozilla\</code>).</li> +</ol> + +<h2 id="Correção_ortográfica_e_alterar_a_correção_(patch)">Correção ortográfica e alterar a correção (patch)</h2> + +<p>Now proof-read the patch. This detects often more than 90 percent of the possible reasons for the reviewer to not accept the patch. If you find that changes have to be done, edit the real aboutPrivateBrowsing.dtd file from the localization repository, save it and follow the steps from Exporting the changes as patch (see above).</p> + +<h2 id="Validar_a_tradução_no_produto">Validar a tradução no produto</h2> + +<p>This guide hasn't yet a section about the validation of the translation. Please follow the instructions from the <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Quick_start_guide/QA_phase">QA phase section of the Localization quick start guide</a>.</p> + +<h2 id="Submeter_a_correção_(patch)_para_revisão">Submeter a correção (patch) para revisão</h2> + +<p>Now the patch has to be shared so the people currently trusted to change the official translation can review the suggested changes.</p> + +<ol> + <li>File a <a href="https://bugzilla.mozilla.org/enter_bug.cgi?product=Mozilla%20Localizations">bug ("ticket") in the Mozilla Localization product</a> and choose as component the localization for which you have translated.</li> + <li>Choose a meaningful bug summary which will be shown for searches etc. like in this example "Firefox 29: aboutPrivateBrowsing.dtd"</li> + <li>Fill any important and additional information into the description field.</li> + <li>Click the 'Add attachment' button.</li> + <li>Select the exported patch file with the file picker. The checkbox for 'patch' should get automatically checked.</li> + <li>Add a meaningful name for the attachment, e.g. aboutPrivateBrowsing.dtd, patch, v1</li> + <li>Go to the review 'Flags' category and set the one for <strong>review</strong> to <strong>?</strong>, meaning that you request review for the patch.</li> + <li>In the text field next to it, add the mail address of the person leading the translation of the locale. This information can be found on the <a href="https://l10n.mozilla.org/teams/">page of the localization team</a>.</li> + <li>Submit the bug report.</li> + <li>Now you have to wait for the review of that person. This can happen on the same day, on the next weekend or later, but should happen in the timeframe given for the localization of aurora. If the person requests changes, follow the instructions under <strong>Proof-reading and altering the patch</strong>. If the reviewer accepts the changes, the patch will get uploaded and your translation will officially be added to Firefox.</li> +</ol> diff --git a/files/pt-pt/mozilla/localization/guia_iniciação_rápida/configuracao_inicial/index.html b/files/pt-pt/mozilla/localization/guia_iniciação_rápida/configuracao_inicial/index.html new file mode 100644 index 0000000000..abde7e440f --- /dev/null +++ b/files/pt-pt/mozilla/localization/guia_iniciação_rápida/configuracao_inicial/index.html @@ -0,0 +1,81 @@ +--- +title: Configuração Inciail +slug: Mozilla/Localization/Guia_iniciação_rápida/Configuracao_inicial +translation_of: Mozilla/Localization/Quick_start_guide/Initial_setup +--- +<p>Como um pré-requisito para contribuir com o programa de L10n, precisa de ter acesso aos códigos, ferramentas e um ambiente local adequadamente configurado (ou seja, o seu computador pessoal). Também precisa de determinar se já existe um esforço de localização para o seu idioma. Aqui, nós irmos ver as contas de que precisa, bem como as ferramentas e as suas configurações que precisa de configurar antes de contribuir.</p> + +<h3 id="Nova_ou_existente">Nova ou existente</h3> + +<p>Before anything else, you need to know if you will be creating a new localization or joining an existing one. This will determine what information is most applicable to you throughout the rest of this guide.</p> + +<p>Veja o que faz:</p> + +<p>Look through the existing <a class="link-https" href="https://wiki.mozilla.org/L10n:Teams" title="https://wiki.mozilla.org/L10n:Teams">localization community directory</a> to see if one already exists for your locale.</p> + +<ol start="1" style="list-style-type: lower-alpha;"> + <li><span style="color: #0000cd;">If a community already exists, reach out to them and ask how you can help.</span></li> + <li><span style="color: #ff8c00;">If a community doesn't exist, send an <a class="link-https" href="https://groups.google.com/forum/?fromgroups#!forum/mozilla.dev.l10n.new-locales" title="https://groups.google.com/forum/?fromgroups#!forum/mozilla.dev.l10n.new-locales">email to the new-locales newsgroup</a> for additional guidance</span><span style="color: #ff8c00;">.</span></li> +</ol> + +<h3 id="Contas">Contas</h3> + +<p>There are a handful of accounts that you need to be aware of as you begin. They're not required for you to begin contributing, but will be required when you are preparing to produce an official release. For now, simply be aware that these will become important as your efforts progress. These accounts will store your code, contributions, and help you produce an official localization.</p> + +<dl> + <dt style="margin-left: 40px;">hg (Mercurial)</dt> + <dd style="">Mercurial is the revision control environment that houses the main Mozilla source code as well as localized code for each official Mozilla localization. You will need this for localizing Mozilla applications. Hg commit access is <u>not</u> necessary to begin localizing. After you have some experience with hg, you may want to get commit access. At that point, you must visit the <a class="external" href="http://www.mozilla.org/hacking/committer/" title="http://www.mozilla.org/hacking/committer/">Mozilla Committer page</a> and follow the process outlined there. <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=741305" title="https://bugzilla.mozilla.org/show_bug.cgi?id=741305">Here is an example bug</a> that illustrates the process well. Use <a class="link-https" href="https://bugzilla.mozilla.org/enter_bug.cgi?product=mozilla.org&component=Repository%20Account%20Requests&rep_platform=All&op_sys=All&cc=l10n%40mozilla.com&short_desc=l10n%20hg%20account%20for%20John%20Doe%20(ab-CD)" title="https://bugzilla.mozilla.org/enter_bug.cgi?product=mozilla.org&component=Repository%20Account%20Requests&rep_platform=All&op_sys=All&cc=l10n%40mozilla.com&short_desc=l10n%20hg%20account%20for%20John%20Doe%20(ab-CD)">this bug template</a> when filing your hg account registration bug. <span>Add a request about creating your locale's repository to the <a class="external" href="http://groups.google.com/group/mozilla.dev.l10n.new-locales/topics" title="http://groups.google.com/group/mozilla.dev.l10n.new-locales/topics">new locales newsgroup</a>.</span></dd> + <dt style="margin-left: 40px;">SVN</dt> + <dd style="margin-left: 40px;">SVN is a revision control environment that Mozilla uses to house Mozilla source websites and their localizations for each official Mozilla localization. See <a class="link-https" href="https://wiki.mozilla.org/SVN#SVN_account_for_localizers" title="https://wiki.mozilla.org/SVN#SVN_account_for_localizers">this wiki page</a> about how to gain access to SVN. The <a href="https://developer.mozilla.org/en-US/docs/SVN_guide_for_localizers" title="https://developer.mozilla.org/en-US/docs/SVN_guide_for_localizers">SVN for Localizers guide</a> will help you learn the most important SVN commands for l10n. <span>Add a request about creating your locale's repository to the <a class="external" href="http://groups.google.com/group/mozilla.dev.l10n.new-locales/topics" title="http://groups.google.com/group/mozilla.dev.l10n.new-locales/topics">new locales newsgroup</a>.</span></dd> +</dl> + +<dl> + <dt style="margin-left: 40px;">Ferramentas de L10n baseadas na Web</dt> + <dd style="margin-left: 40px;">We'll talk about these in a little bit. For now, just be aware that should you choose to use them, you may need to create a personal account.</dd> + <dt style="margin-left: 40px;">Mozilla LDAP</dt> + <dd style="margin-left: 40px;">You will need a Mozilla LDAP account once you're ready to have your localization registered on the main Mozilla repositories. Add a request about creating your LDAP account to the<a class="external" href="http://groups.google.com/group/mozilla.dev.l10n.new-locales/topics" title="http://groups.google.com/group/mozilla.dev.l10n.new-locales/topics"> new locales newsgroup</a>.</dd> + <dt style="margin-left: 40px;">Componente de Bugzilla específico do local</dt> + <dd style="margin-left: 40px;"><span>Having a Bugzilla component specific to your locale will help us to track your localization's progress from first steps to official release. It will also notify us when you're having problems unique to your localization team's work. Add a request about creating your locale's Bugzilla component to the </span><a class="external" href="http://groups.google.com/group/mozilla.dev.l10n.new-locales/topics" title="http://groups.google.com/group/mozilla.dev.l10n.new-locales/topics"><span>new locales newsgroup</span></a><span>.</span></dd> +</dl> + +<h3 id="Ferramentas_de_ambiente_locais">Ferramentas de ambiente locais</h3> + +<p>Similar to accounts, there is a number of environment tools that you should install on your personal computer. These tools will help you to store your contributions, build Mozilla applications and language packs, and test your work.</p> + +<dl> + <dt style="margin-left: 40px;">Hg (Mercurial)</dt> + <dd style="margin-left: 40px;">As noted above, we use Mercurial for maintaining Mozilla source code and localized code. Not only will you need a localization repository to store your localizations, but you need to have it installed and configured on your personal computer as well. You can find everything you need to know about installing and configuring Mercurial for your localization work <a href="/en/Localizing_with_Mercurial#Install_Mercurial" title="https://developer.mozilla.org/en/L10n_on_Mercurial#Install_Mercurial">here</a>.</dd> +</dl> + +<dl> + <dt style="margin-left: 40px;">comparar-idiomas</dt> + <dd style="margin-left: 40px;">compare-locales is a Python script that helps you check your work without needing to run Firefox or another application. Install intructions are located <a href="/en/Compare-locales" title="https://developer.mozilla.org/en/Compare-locales">here</a>.</dd> + <dt style="margin-left: 40px;">Verificações de L10n</dt> + <dd style="margin-left: 40px;">L10n checks is another Python script that helps you check your work without running an application. Install instructions are located <a href="/en/L10n_Checks" title="https://developer.mozilla.org/en/L10n_Checks">here</a>.</dd> + <dt style="margin-left: 40px;">autoconf 2.13</dt> + <dd style="margin-left: 40px;">autoconf is a utility that is vital to manually creating Mozilla application builds and language packs. We use version 2.13 and higher for these builds. You can find the source files and install instructions <a class="external" href="http://www.gnu.org/software/autoconf/" title="http://www.gnu.org/software/autoconf/">here</a>.</dd> + <dt style="margin-left: 40px;">wget</dt> + <dd style="margin-left: 40px;">wget is a command-line utility that allows you to retrieve files using internet protocols. We use it for retrieving files from repositories. You can find the source files and install instructions <a class="external" href="http://www.gnu.org/s/wget/" title="http://www.gnu.org/s/wget/">here</a>.</dd> + <dt style="margin-left: 40px;">Perl</dt> + <dd style="margin-left: 40px;">Perl is a programming language that will help you create Mozilla application builds and language packs. You can find the source files and install instructions <a class="external" href="http://www.perl.org/" title="http://www.perl.org/">here</a>.</dd> + <dt style="margin-left: 40px;">Python</dt> + <dd style="margin-left: 40px;">Python is a programming language in which many of our L10n testing scripts are written. You can find the source files and install instructions <a class="external" href="http://python.org/" title="http://python.org/">here</a>.</dd> + <dt style="margin-left: 40px;">Locale Switcher ou Quick Locale Switcher</dt> + <dd style="margin-left: 40px;">Ambos o Locale Switcher e o Quick Locale Switcher são extras para as aplicações da Mozilla. Either one is necessary to enable you to see your work within a Mozilla application. You can install either by searching for them in Firefox's add-ons manager or following <a class="link-https" href="https://addons.mozilla.org/en-US/firefox/addon/locale-switcher/" title="https://addons.mozilla.org/en-US/firefox/addon/locale-switcher/">these</a> <a class="link-https" href="https://addons.mozilla.org/en-US/firefox/addon/quick-locale-switcher/" title="https://addons.mozilla.org/en-US/firefox/addon/quick-locale-switcher/">links</a>.</dd> + <dt style="margin-left: 40px;">Um editor de texto sólido, baseado em Unicode</dt> + <dd style="margin-left: 40px;">Here are some suggestions: + <ul> + <li style="margin-left: 40px;">Windows: <a class="external" href="http://notepad-plus.sourceforge.net/uk/site.htm" rel="external nofollow" title="http://notepad-plus.sourceforge.net/uk/site.htm">Notepad++</a> or <a class="external" href="http://www.flos-freeware.ch/notepad2.html" rel="external nofollow" title="http://www.flos-freeware.ch/notepad2.html">Notepad2</a></li> + <li style="margin-left: 40px;">GNU/Linux: <a class="external" href="http://en.wikipedia.org/wiki/Vim_%28text_editor%29" rel="external nofollow" title="http://en.wikipedia.org/wiki/Vim_(text_editor)">vim</a>, <a class="external" href="http://projects.gnome.org/gedit/" rel="external nofollow" title="http://projects.gnome.org/gedit/">gedit</a> or <a class="external" href="http://www.kate-editor.org/kate" rel="external nofollow" title="http://www.kate-editor.org/kate">Kate</a></li> + <li style="margin-left: 40px;">Mac OS X: <a class="external" href="http://www.barebones.com/products/TextWrangler/" rel="external nofollow" title="http://www.barebones.com/products/TextWrangler/">TextWrangler</a></li> + </ul> + </dd> + <dt style="margin-left: 40px;">GNU make</dt> + <dd style="margin-left: 40px;"><span class="external">Make is a tool which controls the generation of executables. You can find version</span> 3.79.1 or higher <a class="external" href="http://www.gnu.org/software/make/" title="http://www.gnu.org/software/make/">here</a>. Unfortunately, other varieties of <code>make</code> won't do.</dd> +</dl> + +<h2 id="Fim_da_configuração_inicial">Fim da configuração inicial</h2> + +<p>Agora que concluiu a configuração inicial, é hora da melhor parte: traduzir!</p> + +<p>{{ PreviousNext("Localization_Quick_Start_Guide", "Localization_Quick_Start_Guide/Translation_phase") }}</p> diff --git a/files/pt-pt/mozilla/localization/guia_iniciação_rápida/fase_da_traducao/index.html b/files/pt-pt/mozilla/localization/guia_iniciação_rápida/fase_da_traducao/index.html new file mode 100644 index 0000000000..cdb31df82a --- /dev/null +++ b/files/pt-pt/mozilla/localization/guia_iniciação_rápida/fase_da_traducao/index.html @@ -0,0 +1,120 @@ +--- +title: Fase da Tradução +slug: Mozilla/Localization/Guia_iniciação_rápida/Fase_da_Traducao +tags: + - Localização + - 'Localização: Ferramentas' + - Tradução +translation_of: Mozilla/Localization/Quick_start_guide/Translation_phase +--- +<p>Parabéns por completar a configuração inicial! Como recompensa pelos seus esforços, você começa a pensar no motivo pelo qual veio até aqui: localizar projetos da Mozilla.</p> + +<p>É onde o aspeto técnico do processo começa a dividir-se. Na Mozilla, nós localizamos muitos projetos diferentes que podem ser categorizados em três grupos diferentes. Cada grupo de projetos emprega um tipo diferente de ferramenta l10n para, você adivinhou, localizar os projetos. As ferramentas do l10n destinam-se a ajudá-lo a manter o seu conteúdo localizado de lançamento a lançamento e aproveitar os materiais já localizados quando localiza novo conteúdo.</p> + +<p>Aqui, nos iremo identificar esses grupos de projetos e as ferramentas de l10n associadas com os mesmo. Ao longo do caminho, nós iremos direcioná-lo para os tutoriais técnicos básicos sobre a localização desse grupo específico de projetos. Cabe a si, e à sua comunidade determinar qual a ferramenta de l10n corresponderá melhor às suas necessidades. À medida que ganha mais experiência, talvez queira localizar independentemente das ferramentas de l10n desenvolvidas pela Mozilla, que nós também discutiremos aqui.</p> + +<h2 id="Projetos">Projetos</h2> + +<p>Os projetos da Mozilla e os ritmos de trabalho de l10n são divididos nestes grupos: aplicações da Mozilla, sites da Web da Mozilla, e Extras. Em baixo, irá encontrar a lista de todos os projetos da Mozilla, as suas ferramentas de l10n associadas, e hiperligações para tutoriais descrevendo os seus ritmos de trabalho.</p> + +<h3 id="Aplicações_da_Mozilla">Aplicações da Mozilla</h3> + +<p>So you're interested in localizing Mozilla applications. Each l10n tool follows a different workflow for localizing Mozilla application projects. We've linked a brief tutorial to each l10n tool name below. Follow the tutorials to help you decide which l10n tool fits your specific needs.</p> + +<p>These are the l10n tools we use to localize Mozilla applications:</p> + +<dl> + <dt style="margin-left: 40px;"><a class="external" href="http://translate.sourceforge.net/wiki/guide/mozilla" title="http://translate.sourceforge.net/wiki/guide/mozilla">Pootle</a></dt> + <dd style="margin-left: 40px;">A user-friendly web portal built on the Translate Toolkit API. This tool includes workspaces for translating strings, reviewing string submissions, and project dashboards. See the <a class="external" href="http://pootle.locamotion.org/" title="http://pootle.locamotion.org/">instance of Pootle used to localize Mozilla applications</a>.</dd> +</dl> + +<dl> + <dt style="margin-left: 40px;"><a href="/en/Localizing_with_Koala" title="https://developer.mozilla.org/en/Localizing_with_Koala">Koala</a></dt> + <dd style="margin-left: 40px;">A l10n add-on for the offline, stand-alone Komodo Edit text editor.</dd> + <dt style="margin-left: 40px;"><a class="external" href="/en/Localizing_with_Mozilla_Translator" title="https://developer.mozilla.org/en/Localizing_with_Mozilla_Translator">Mozilla Translator</a></dt> + <dd style="margin-left: 40px;">Am offline, stand-alone, Java-based l10n tool that helps you translate and integrates with your repositories. Visit the <a class="external" href="http://kenai.com/projects/moztrans/downloads" title="http://kenai.com/projects/moztrans/downloads">Mozilla Translator (MT) download page</a> to get your own MT client. Version 5.26 is the latest version.</dd> + <dt style="margin-left: 40px;">Virtaal</dt> + <dd style="margin-left: 40px;">An offline, stand-alone version of Pootle that is also built on the Translate Toolkit API.</dd> +</dl> + +<p>These are the Mozilla application projects that are localized using the l10n tools above:</p> + +<dl> + <dt style="margin-left: 40px;">Firefox</dt> + <dd style="margin-left: 40px;">The award-winning Firefox® Web browser has security, speed and new features that will change the way you use the Web. <span style="color: #daa520;">See the <a class="external" href="http://zaf.svn.sourceforge.net/viewvc/zaf/trunk/po/fftb/firefox.phaselist" title="http://zaf.svn.sourceforge.net/viewvc/zaf/trunk/po/fftb/firefox.phaselist">list of the most critical strings for localizing in Firefox</a></span><span style="color: #daa520;">, as well as <a class="external" href="http://zaf.svn.sourceforge.net/viewvc/zaf/trunk/po/fftb/phases" title="http://zaf.svn.sourceforge.net/viewvc/zaf/trunk/po/fftb/phases">a guide to understanding how they're organized</a></span><span style="color: #daa520;">.</span></dd> + <dt style="margin-left: 40px;">Thunderbird</dt> + <dd style="margin-left: 40px;">Enjoy safe, fast and easy email, Mozilla-style. The Thunderbird® email client includes intelligent spam filters, powerful search and customizable views.</dd> + <dt style="margin-left: 40px;">Seamonkey</dt> + <dd style="margin-left: 40px;">SeaMonkey® is the all-in-one application formerly known as the "Mozilla Application Suite", containing a web browser, a mail and newsgroups client, an HTML editor, web development tools, and an IRC chat client.</dd> + <dt style="margin-left: 40px;">Firefox Mobile</dt> + <dd style="margin-left: 40px;">By adding Firefox® to your mobile phone, you can access rich Web content and enjoy your favorite Firefox features wherever you go.</dd> + <dt style="margin-left: 40px;">Lightning</dt> + <dd style="margin-left: 40px;">Lightning is a popular calendaring, scheduling and task management extension.</dd> +</dl> + +<p><span style="color: #0000ff;">If your locale has an hg repository hosted on the Mozilla servers, you can track your localization's current progress by visiting the </span><a class="link-https" href="https://l10n.mozilla.org/teams/" title="https://l10n.mozilla.org/teams/"><span style="color: #0000ff;">l10n dashboards</span></a><span style="color: #0000ff;">.</span></p> + +<div class="note"> +<p><strong>Nota:</strong> <span style="color: #ff8c00;">se estiver a iniciar uma nova localização e decidir utilizar uma ferramenta off-line para localizar aplicações da Mozilla, terá que familiarizar-se com a utilização de Mercurial (hg). Visite o tutorial <a href="https://developer.mozilla.org/pt-PT/docs/Mozilla/Localization/Localizar_com_Mercurial" title="https://developer.mozilla.org/en-US/docs/Localizing_with_Mercurial"><span style="color: #ff8c00;">sobre como utilizar "hg" nos seus esforços de localização aqui</span></a><span style="color: #ff8c00;">. </span></span></p> +</div> + +<h3 id="Sites_da_Web_da_Mozilla">Sites da Web da Mozilla</h3> + +<p>So you're interested in localizing Mozilla websites. Each l10n tool follows a different workflow for localizing Mozilla web projects. We've linked a brief tutorial to each l10n tool name below. Follow the tutorials to help you decide which l10n tool fits your specific needs.</p> + +<p>These are the l10n tools we use to localize Mozilla web projects:</p> + +<dl> + <dt style="margin-left: 40px;"><a href="/en-US/docs/Localizing_with_Pontoon" title="/en-US/docs/Localizing_with_Pontoon">Pontoon</a></dt> + <dd style="margin-left: 40px;">A web-based, What-You-See-Is-What-You-Get (WYSIWYG) l10n tool that allows you to localize Mozilla websites within the site itself. Visit <a class="external" href="https://pontoon.mozilla.org" title="http://horv.at/pontoon/">Pontoon</a> here. Please note the Pontoon is not available for all web projects yet.</dd> +</dl> + +<p>These are the Mozilla web projects that are localized using the l10n tools above:</p> + +<dl> + <dt style="margin-left: 40px;">mozilla.org</dt> + <dd style="margin-left: 40px;">Every user's first Mozilla experience.</dd> + <dt style="margin-left: 40px;">addons.mozilla.org (AMO)</dt> + <dd style="margin-left: 40px;">A portal for all users interested in finding add-ons for their local Mozilla applications. Read the <a class="link-https" href="https://addons.mozilla.org/en-US/localizers/" title="https://addons.mozilla.org/en-US/localizers/">guidelines on localizing AMO</a>, straight from the AMO team.</dd> + <dt style="margin-left: 40px;">developer.mozilla.org (MDN)</dt> + <dd style="margin-left: 40px;">Where you are now! Help localize the MDN user interface for everyone in your region.</dd> + <dt style="margin-left: 40px;">support.mozilla.com (SUMO)</dt> + <dd style="margin-left: 40px;">A portal for anyone who needs technical support for their Mozilla applications. Help localize the SUMO user interface for everyone in your region.</dd> + <dt style="margin-left: 40px;">Mozilla Engagement Campaigns</dt> + <dd style="margin-left: 40px;">Individual campaigns created by Mozilla to attract new contributors.</dd> + <dt style="margin-left: 40px;">hacks.mozilla.org</dt> + <dd style="margin-left: 40px;">For everyone interested in the leading-edge stuff that people are doing with Mozilla Firefox and the open web.</dd> + <dt style="margin-left: 40px;">In-product pages</dt> + <dd style="margin-left: 40px;">A set of pages used to interact with and give information to the end-user as part of their first experience with their Mozilla applications.</dd> +</dl> + +<p><span style="color: #ff8c00;">Se está a criar a sua própria localização, existem vários sites da Web da Mozilla que precisam de ser localizados antes que os seus esforços se tornem numa localização lançada oficialmente. Consulte a</span><span style="color: #ff8c00;"> <a class="link-https" href="https://wiki.mozilla.org/L10n:Web_parts#Firefox_in-product_pages" title="https://wiki.mozilla.org/L10n:Web_parts#Firefox_in-product_pages">lista de sites da Web localizados da Mozilla</a>. </span></p> + +<p>Também deveria ler <a class="link-https" href="https://wiki.mozilla.org/L10n:Web_parts" title="https://wiki.mozilla.org/L10n:Web_parts">mais informação sobre a localização de projetos da web da Mozilla</a>.</p> + +<dl> + <dt> </dt> +</dl> + +<h3 id="Extras_(Add-ons)">Extras (Add-ons)</h3> + +<p>l10n for add-ons is handled by at least two other organizations/services called Babelzilla and Adofex. They both have created comprehensive programs and l10n tools for localizing any and all third-party add-ons for Mozilla applications. Visit their websites to learn how to get involved.</p> + +<ul> + <li><a class="external" href="http://babelzilla.org" title="http://babelzilla.org">Babelzilla</a></li> + <li><a class="external" href="http://adofex.clear.com.ua/" title="http://adofex.clear.com.ua/">Adofex</a></li> +</ul> + +<h2 id="Ferramenta_de_localização_independente">Ferramenta de localização independente</h2> + +<p>Are you a command-line master? Do you prefer Unicode text editors to any other applications on Earth? Do you have a pet CAT (computer-assisted translation) tool, like OmegaT? Then you may not be interested in using any of the tools listed above for your localizations. If that is the case, then this section is for you!</p> + +<p>For localizers who prefer localizing without a specialized tool the workflows for localizing Mozilla applications and Mozilla websites are essentially the same.<a href="/en/Localizing_without_a_specialized_tool" title="https://developer.mozilla.org/en/Localizing_without_a_specialized_tool"> This tutorial</a> should provide you with all of the technical information you need to secure and maintain your tool independence.</p> + +<h2 id="Produtibilidade">Produtibilidade</h2> + +<p>Productization is an essential part of localizing Mozilla products. This is where you research and select the search plugins, content and protocol handlers, bookmarks, and links to recommended sites on the in-product pages that your locale's users will find in their Mozilla products.</p> + +<p><a href="https://developer.mozilla.org/en-US/docs/Productization_guide" title="https://developer.mozilla.org/en/Productization_patches">This tutorial will walk you through performing these productization tasks</a>, creating productization patches, and submitting them for review.</p> + +<p>{{ PreviousNext("Localization_Quick_Start_Guide/Initial_setup", "Localization_Quick_Start_Guide/QA_phase") }}</p> diff --git a/files/pt-pt/mozilla/localization/guia_iniciação_rápida/fase_de_lancamento/index.html b/files/pt-pt/mozilla/localization/guia_iniciação_rápida/fase_de_lancamento/index.html new file mode 100644 index 0000000000..310ec4344e --- /dev/null +++ b/files/pt-pt/mozilla/localization/guia_iniciação_rápida/fase_de_lancamento/index.html @@ -0,0 +1,177 @@ +--- +title: Fase de Lançamento +slug: Mozilla/Localization/Guia_iniciação_rápida/Fase_de_lancamento +translation_of: Mozilla/Localization/Quick_start_guide/Release_phase +--- +<p>Você conseguiu! Configurou os seus ambientes locais e remotos, selecionou as suas ferramentas e projetos de L10n, efetuou algumas traduções e até mesmo alguns testes! Agora está pronto para a fase final: ser parte de um lançamento oficial da L10n. Aqui, nós continuaremos a ser fiéis à intenção original deste guia e apresentaremos apenas a informação técnica necessária para se tornar num lançamento oficial. Nós vamos concentrar-nos principalmente em obter a configuração do seu repositório de lançamento e comandos do Mercurial que precisa de saber para utilizar este repositório.</p> + +<p>Para obter mais informação sobre a parte de lançamento do processo L10n, visite o site da <a class="link-https" href="https://wiki.mozilla.org/L10n:Becoming_an_Official_Localization" title="https://wiki.mozilla.org/L10n:Becoming_an_Official_Localization">wiki da Mozilla a</a>qui.</p> + +<h2 id="O_seu_repositório_oficial_de_lançamentos">O seu repositório oficial de lançamentos</h2> + +<p>Now that your locale has been registered, the localization files will live on Mozilla Mercurial server at <code>hg.mozilla.org</code>. Depending on which branch you work on, the URL of your repository might look like this:</p> + +<pre>http://hg.mozilla.org/releases/l10n-central/x-testing +</pre> + +<p>If you followed the <a href="Localizing_with_Koala" rel="internal" title="en/Localizing with Koala">Koala</a> or <a href="Localizing_without_a_specialized_tool" rel="internal" title="en/Localizing without a specialized tool">plain text</a> approach, you probably already have a local clone of the repository. Otherwise, in order to be able to make any changes to the localization files, you will need to clone the repository on your local machine and work in the <em>local clone</em>.</p> + +<p>There are two different protocols you can use to connet with your Mercurial repository: HTTP and SSH. Be advised that there's an important distinction between them. You can <code>pull</code> using both, but you can only <code>push</code> through SSH. Consequently, if you already have a local clone that you pulled using HTTP, you'll need to modify a config file to tell Mercurial to push through SSH. Let's go over configuring your connection protocols.</p> + +<h3 class="editable" id="Configuração">Configuração</h3> + +<p>Before you try pushing, you need to tell SSH which username you wish to use for connecting with hg.mozilla.org. This should be your Mozilla LDAP account name.</p> + +<ol> + <li>Add the following lines to your <code>~/.ssh/config</code> file, replacing <a class="link-mailto" href="mailto:user@host.domain" rel="external" title="mailto:user@host.domain">user@host.domain</a> with your Mozilla LDAP account name:</li> +</ol> + +<pre class="eval">Host hg.mozilla.org +User <a class="link-mailto" href="mailto:user@host.domain" rel="external" title="mailto:user@host.domain">user@host.domain</a></pre> + +<ol start="2" style="list-style-type: decimal;"> + <li>If you have already cloned the remote repository using the HTTP protocol using this command:<code> $ hg clone <strong>http</strong>://hg.mozilla.org/releases/l10n-central/x-testing</code> then you will need to edit the <code>.hg/hgrc</code> file (inside the <code>x-testing</code> local clone) to tell Mercurial to push using SSH. Your <code>.hg/hgrc</code> file shoud look like this (add the emphasized line):</li> +</ol> + +<pre class="eval">[paths] +default = hg.mozilla.org/releases/l10n-central/x-testing +<strong>default-push = <a class="external" href="ssh://hg.mozilla.org/releases/l10n-central/x-testing" rel="external" title="ssh://hg.mozilla.org/releases/l10n-central/x-testing">ssh://hg.mozilla.org/releases/l10n-central/x-testing</a></strong> +</pre> + +<ol start="3" style="list-style-type: decimal;"> + <li>If you haven't already cloned the remote repository, enter this command: <code>hg clone <strong>ssh</strong>://hg.mozilla.org/releases/l10n-central/x-testing</code></li> +</ol> + +<p style="margin-left: 40px;">Mercurial will let you know that it's cloning the repository:</p> + +<pre style="margin-left: 40px;">destination directory: x-testing +requesting all changes +adding changesets +adding manifests +adding file changes +added 4 changesets with 242 changes to 239 files +updating to branch default +239 files updated, 0 files merged, 0 files removed, 0 files unresolved +</pre> + +<p>The default <code>push</code> URL is the same as the default <code>pull</code> URL (i.e., <code><a class="external" href="ssh://hg.mozilla.org/releases/l10n-central/x-testing" rel="external" title="ssh://hg.mozilla.org/releases/l10n-central/x-testing">ssh://hg.mozilla.org/releases/l10n-central/x-testing</a></code>).</p> + +<p>You should now be able to <code>push</code> to the remote repository!</p> + +<h3 class="editable" id="Commit_outgoing_and_push">Commit, outgoing, and push</h3> + +<p>You should try to <code>commit</code> your work regularly as you progress through the localization files. Keep in mind that the <code>hg commit</code> command will save your changes locally (in the local clone). With the <code>hg push</code> command you can send the changesets to the remote server. Here's how that's done:</p> + +<ol> + <li>Run this command to see recent commits in your local clone: <code>$ hg log -l 3</code></li> +</ol> + +<p style="margin-left: 40px;">You should a list of the most recent commits, similar to this one:</p> + +<pre style="margin-left: 40px;">changeset: 0:7c543e8f3a6a +tag: tip +user: Your Name <email@example.com> +date: Mon Nov 23 18:08:25 2009 +0100 +summary: Added search bar strings +</pre> + +<ol start="2" style="list-style-type: decimal;"> + <li>Now run the <code>hg outgoing</code> command to compare the local repository on your machine with the remote repository on hg.mozilla.org.</li> +</ol> + +<p style="margin-left: 40px;">The <code>hg outgoing</code> command compares the two repositories and lists all changesets that are present locally, but not in the remote repository. These changesets will need to be pushed to the remote repository. The output will look something like this:</p> + +<pre style="margin-left: 40px;">comparing with ssh://hg.mozilla.org/releases/l10n-central/x-testing +searching for changes + +changeset: 0:7c543e8f3a6a +tag: tip +user: Your Name <email@example.com> +date: Mon Nov 23 18:08:25 2009 +0100 +summary: Added search bar strings +</pre> + +<ol start="3" style="list-style-type: decimal;"> + <li>Make sure this output is accurate before continuing.</li> + <li>Once you've made sure the outgoing output is accurate, push this changeset to hg.mozilla.org by running the <code>hg push</code> command.</li> +</ol> + +<p style="margin-left: 40px;">Mercurial will connect to the remote repository, authenticate through SSH and send the changesets. The output should look something like this:</p> + +<pre style="margin-left: 40px;">pushing to ssh://hg.mozilla.org/releases/l10n-central/x-testing +searching for changes +adding changesets +adding manifests +adding file changes +added 1 changesets with 2 changes to 2 files +</pre> + +<p>Congratulations! Your changeset has been successfully pushed to hg.mozilla.org! You can now visit <span style="font-family: monospace;">http</span><code>://hg.mozilla.org/releases/l10n-central/x-testing</code> in your browser to see the new changeset in the remote repository.</p> + +<h3 class="editable" id="Resolução_de_problemas_de_SSH">Resolução de problemas de SSH</h3> + +<p>If pushing fails, make sure your <code>~/.ssh/config </code>has the correct <code>User</code> set under the <code>hg.mozilla.org</code> host. This should be your Mozilla LDAP account name. Next, try issuing the following command: <code>$ ssh hg.mozilla.org</code></p> + +<p>If SSH is working fine, you should see the following message:</p> + +<pre>No interactive shells allowed here! +Connection to hg.mozilla.org closed. +</pre> + +<p>If you don't see this message, try running the same command in a more verbose mode (with the debugging information): <code>$ ssh -vvv hg.mozilla.org</code></p> + +<p>This should tell you why your connection is not succeeding. If you can't figure it out on your own, copy the output of the above command, paste it on <a class="external" href="http://pastebin.mozilla.org/" rel="external" title="http://pastebin.mozilla.org/">http://pastebin.mozilla.org</a> and ask in #l10n on the irc.mozilla.org server.</p> + +<h2 id="Revisões_técnicas_e_assinadas">Revisões técnicas e assinadas</h2> + +<p>You've done some localization work and your ready for it to be released. The merge date for migrating from one product release channel to the next is rapidly approaching. You need to make sure that your work can effectively be compiled into a build for the next release channel. Do you know whether to ask for technical review of your work or a sign-off review? Do you know what what exactly is reviewed in each process? Technical and sign-off reviews apply to different localizations in different ways. Here's the basic difference between the two.</p> + +<table style="width: 100%;"> + <thead> + <tr> + <th scope="col" style="text-align: center;"><strong>Revisão Técnica</strong></th> + <th scope="col" style="text-align: center;"><strong>Revisão Assinada</strong></th> + </tr> + </thead> + <tbody> + <tr> + <td> + <ul> + <li>Performed as a QA measure on a revision pushed to a new locale's L10n aurora repo in Mercurial.</li> + <li>Very comprehensive. Covers the entire product.</li> + <li>Focus is on technical accuracy and completion of L10n work; not translation quality.</li> + <li>Only performed on the first revision a new locale wants to have released to the public.</li> + <li>Must be approved prior to migrating your revision from one release channel to the next (e.g., Aurora to Beta).</li> + </ul> + </td> + <td> + <ul> + <li>Performed as a QA measure for maintaining a localization from release-to-release.</li> + <li>Only new L10n work is evaluated. This is done by generating a diff between the new release revision being considered and the previously approved release revision.</li> + <li>Focus is still on technical accuracy and completion of L10n work; not translation quality.</li> + <li>Release revisions are evaluated, not entire L10n repos.</li> + <li>Sign-offs do not need to be approved before revision merge between release channels, although it is recommended.</li> + </ul> + </td> + </tr> + </tbody> +</table> + +<p>There is a specific process to follow in Bugzilla for requesting these reviews:<a href="/@api/deki/files/6034/=technical_review.png" title="technical review.png"><img alt="technical review.png" class="internal rwrap" src="/@api/deki/files/6034/=technical_review.png?size=webview" style="float: right; height: 189px; width: 350px;"></a></p> + +<ol> + <li>File a bug requesting the review.</li> + <li>Attach your files to the bug. Once attached, open the attachment details.</li> + <li>In the attachment details, select the <strong>?</strong> from the dropdown menu next to the <span style="color: #daa520;">review flag</span> or the <span style="color: #0000ff;">appropriate approval flags</span> (see image). This will display a text box to assign the review to someone.</li> + <li>Enter <strong>:Pike</strong> as the <strong>Requestee</strong>.</li> +</ol> + +<p>We will perform a technical review of your work and provide you with feedback. We're happy to work with you to make sure that your work is fully functional.</p> + +<p>For more detailed information about reviews for new localizations and sign-offs for maintenance releases, visit the <a href="/en/Localization_technical_reviews" title="https://developer.mozilla.org/en/Localization_technical_reviews">technical review</a> and <a href="/en/Localization_sign-off_reviews" title="https://developer.mozilla.org/en/Localization_sign-off_reviews">sign-off review</a> pages.</p> + +<h2 id="Tah_dah!">Tah dah!</h2> + +<p>Mais uma vez, parabéns! Chegou ao final! Sinta-se à vontade para voltar a este tutorial sempre que necessário. Nós estamos felizes em o ter como um novo colaborador da Mozilla L10n e nós esperamos trabalhar de perto consigo.</p> + +<p>{{ Previous("Localization_Quick_Start_Guide/QA_phase") }}</p> diff --git a/files/pt-pt/mozilla/localization/guia_iniciação_rápida/fase_pr/index.html b/files/pt-pt/mozilla/localization/guia_iniciação_rápida/fase_pr/index.html new file mode 100644 index 0000000000..48e5d343d5 --- /dev/null +++ b/files/pt-pt/mozilla/localization/guia_iniciação_rápida/fase_pr/index.html @@ -0,0 +1,212 @@ +--- +title: Fase de PR +slug: Mozilla/Localization/Guia_iniciação_rápida/Fase_PR +tags: + - Localização +translation_of: Mozilla/Localization/Quick_start_guide/QA_phase +--- +<p>Depois de todo o trabalho duro de localização, nós temos a certeza de que não quer ver apenas o seu trabalho, mas quer ter a certeza de que está preciso! Se não tem muita experiência com código, pode até preocupar-se que tenha efetuado algo de errado (Ups!). Nós agora vamos orientá-lo na realização de alguns testes de garantia de qualidade no seu trabalho para garantir que esteja no caminho certo.</p> + +<p>If you're localizing Mozilla websites, your work will display soon after you've committed it without needing a language pack. Since such is the case, this part of the guide may not be entirely applicable to you. Feel free to skip ahead to the next section by clicking on the <strong>Next</strong> link at the bottom of the page.</p> + +<p>In order to see your work on Firefox (or another Mozilla application), you'll need to have a built language pack to install on your local instance.</p> + +<h2 id="Criações_automatizadas_e_manual">Criações automatizadas e manual</h2> + +<p>With the click of a button, some L10n tools (like Narro and Koala) automatically create language pack builds for you. If you're using one of these tools, feel free to skip ahead to the <a href="/en/Localization_Quick_Start_Guide:_QA#Seeing_your_work" title="https://developer.mozilla.org/en/Localization_Quick_Start_Guide:_Part_3#Seeing_your_work">Seeing your work</a> section. If you're not using one of these tools, let's walk you through building your own language pack manually.</p> + +<div class="note"><strong>Nota</strong>: Remember all of those pre-requisite tools we asked you to install in the <a href="/en/Localization_Quick_Start_Guide#Local_environment_tools" title="https://developer.mozilla.org/en/Localization_Quick_Start_Guide#Local_environment_tools">initial setup</a>? Here's where you'll need almost all of them. If you haven't installed them yet, <em>now</em> is the time to do it.</div> + +<h3 id="Instruções_preliminares">Instruções preliminares</h3> + +<p>We will be using the following file directories for this example:</p> + +<pre style="margin-left: 40px;">your working directory <em>(root)/</em> + mozilla-aurora <em>(en-US source, pulled from <a class="external" href="http://hg.mozilla.org/releases/mozilla-aurora" rel="external" title="http://hg.mozilla.org/releases/mozilla-aurora">http://hg.mozilla.org/releases/mozilla-aurora</a></em> <em>)</em>/ + l10n-central <em>(directory for L10n directories, one per L10n; often referred to as "l10n base")/</em> + your-locale-code <em>(a directory with your L10n files, in this example we'll use x-testing)</em> + +<strong>Example</strong>: <code>root/mozilla-aurora</code> & <code>root/l10n-central/x-testing</code> +</pre> + +<p>Additionally, you will need to copy and translate the <code>toolkit/defines.inc</code> file directly from en-US before you can build. This is due to a bug in the build logic.</p> + +<p>Please either follow the above structure closely or adjust the commands below according to your custom setup.</p> + +<p>To copy this file to the appropriate directory, do the following:</p> + +<ol> + <li>Navigate to your working directory from your command-line terminal (i.e., where you created the folder structure described above).</li> + <li>Enter the following commands:</li> +</ol> + +<pre style="margin-left: 40px;">mkdir -p l10n-central/x-testing/toolkit/ + +cp mozilla-aurora/toolkit/locales/en-US/defines.inc l10n-central/x-testing/toolkit/defines.inc +</pre> + +<p>Tah-dah! Copied!</p> + +<p>Finally, you will need a file called <code>.mozconfig</code> to proceed with manual builds. This file contains the necessary build instructions.</p> + +<p>To create and configure this file, follow these instructions:</p> + +<div class="warning"> +<p>Until the fix for <a href="https://bugzil.la/1063880">bug 1063880</a> lands on mozilla-aurora and mozilla-beta when building language packs against those two trees you should:</p> + +<ol> + <li> + <p>remove <code>ac_add_options --disable-compile-environment</code> from <code>.mozconfig</code> in step 3</p> + </li> + <li> + <p>use <code>./mach build config</code> after step 4</p> + </li> +</ol> +</div> + +<ol> + <li>Update the Mozilla source code:</li> +</ol> + +<p style="margin-left: 40px;"><code>$ cd mozilla-aurora<br> + $ hg pull -u</code></p> + +<ol start="2" style="list-style-type: decimal;"> + <li>Enter the following command to create the <code>.mozconfig</code> file: <code>$ nano -w .mozconfig</code></li> + <li>Enter the following lines in your <code>.mozconfig</code> file:</li> +</ol> + +<pre style="margin-left: 40px;">mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../firefox-build +ac_add_options --disable-compile-environment +ac_add_options --with-l10n-base=../l10n-central # path relative to MOZ_OBJDIR +ac_add_options --enable-application=[<em>browser or mail</em>] +</pre> + +<p style="margin-left: 40px;">You will need to specify which application you're localizing in the fourth line (e.g., for Firefox, that's <code>browser</code>, Thunderbird would be <code>mail</code>).</p> + +<ol start="4" style="list-style-type: decimal;"> + <li>Enter the following command to perform the configuration: <code>$ ./mach configure</code></li> + <li>Once your command-line finishes spitting out the config command's output, navigate to the newly created directory:<code> $ cd ../firefox-build/browser/locales</code></li> +</ol> + +<p>Now you're ready to build! At this point you can choose between two build options. You can either:</p> + +<ul> + <li><a href="/en/Creating_a_Language_Pack#Creating_a_langpack" title="https://developer.mozilla.org/en/Creating_a_Language_Pack#Creating_a_langpack">Create a langpack</a>, which is installed <em>on top of</em> your Mozilla application, or</li> + <li><a href="/en/Creating_a_Language_Pack#L10n_binary_repack" title="https://developer.mozilla.org/en/Creating_a_Language_Pack#L10n_binary_repack">Repack the application's binary</a> (aka, a L10n repack), which allows you to install <em>next</em> to your existing Mozilla application installation and use separately.</li> +</ul> + +<p>Visit the links above to learn how to make these testing builds.</p> + +<h2 id="Testar_a_sua_L10n_e_ver_o_seu_trabalho">Testar a sua L10n e ver o seu trabalho</h2> + +<p>Now that you have your langpack or L10n repack, let's discuss seeing your work and testing it in the application.</p> + +<p>Testing the langpack will put you one step closer to having your localization added to the L10n releases. Follow the steps below to test your localization:</p> + +<ol> + <li>Install Aurora in your preferred language.</li> + <li>Install the <code>.xpi</code> langpack you just created (or exported).</li> + <li>Set your language using the Quick Locale Switcher or Locale Switcher add-ons by navigating to Tools->Language->Your localization's language code.</li> + <li>Restart your browser and start testing!</li> +</ol> + +<p>Now you should be able to see all of your work up to this point. Click <a class="link-https" href="https://wiki.mozilla.org/MozillaQualityAssurance:l10n_checklist" title="https://wiki.mozilla.org/MozillaQualityAssurance:l10n_checklist">here</a> for guidelines on how to test your localization.</p> + +<h2 id="Não_perca_o_seu_trabalho!">Não perca o seu trabalho!</h2> + +<p>Your work is <em>SO</em> important! We would really hate to see you lose any of it. After you test your localization, you should send it to a remote repository, which will serve as a backup for your work and will let others follow your progress. We're going to go through the process below.</p> + +<p>The official localization teams use repositories at <a class="external" href="http://hg.mozilla.org/" rel="external" title="http://hg.mozilla.org/">hg.mozilla.org</a>. Before a team becomes official, we like to get the localizers comfortable with the Hg commands that allow for cloning, pulling, committing, and pushing work to an experimental repository. We use a web service called <a class="external" href="http://www.bitbucket.org/" rel="external" title="http://www.bitbucket.org/">Bit Bucket</a> to start the learning process.</p> + +<div class="note"><strong>Nota</strong>: You must have Mercurial configured before you begin. That step is back on the initial setup page. If you haven't done that yet, don't worry, we'll wait for you!</div> + +<h3 class="note" id="Envio_(Pushing)_para_o_seu_repositório">Envio (Pushing) para o seu repositório</h3> + +<p>There are a couple of things you should take note of before you push to your repository:</p> + +<ul> + <li>Make sure that your files have been encoded in Unicode without BOM (byte order mark).</li> + <li>Remember that here you are pushing an entire directory, not a <code>.zip</code> archive file or an <code>.xpi</code> lang pack.</li> +</ul> + +<p>The instructions below will help you learn how to use your Hg repository.</p> + +<ol> + <li><span style="color: #daa520;">After your new repository is created by the l10n-drivers</span>, please visit the URL for your repo. We'll use x-testing here for our example. You can do this by entering the following URL into your browser: <code><a class="external" href="http://hg.mozilla.org/l10n-central/x-testing" rel="freelink">http://hg.mozilla.org/l10n-central/x-testing</a></code></li> + <li>Now, navigate to your locale's directory on your local machine.</li> +</ol> + +<p style="margin-left: 40px;">If you're using Koala, this should be located at <code>/path/to/your/koala.project/locale/3.6/x-testing</code>, otherwise, it should be located at <code>/path/to/your/working_dir/l10n_base/x-testing</code>.</p> + +<p style="margin-left: 40px;">In this directory, you should have an hg repository. You might have created it yourself by running <code>hg init</code> or <code>hg clone</code> or you might have had it created by Koala when you were setting up a new localization project. Also at this point, you shouldn't have any uncommitted changes (i.e., running the <code>hg status </code>command should show nothing). Let's see what the last revision in this repository is.</p> + +<ol start="3" style="list-style-type: decimal;"> + <li>Enter the following command: <code>$ hg log -l 1</code></li> +</ol> + +<p style="margin-left: 40px;">You should see an output similar to the one below:</p> + +<pre style="margin-left: 40px;">changeset: 0:7c543e8f3a6a +tag: tip +user: Your Name <email@example.com> +date: Mon Nov 23 18:08:25 2009 +0100 +summary: Added search bar strings +</pre> + +<ol start="4" style="list-style-type: decimal;"> + <li>Now compare the local repository on your machine with the remote Hg repository by entering this command: <code>$ hg outgoing <a class="external" href="http://hg.mozilla.org/l10n-central/x-testing" rel="freelink">http://hg.mozilla.org/l10n-central/x-testing</a></code></li> +</ol> + +<p style="margin-left: 40px;">The <code>hg outgoing</code> command compares the two repositories and lists all changesets that are present locally, but not in the remote repository. These changesets will need to be "pushed" to the remote repository. You can expect to see output like this:</p> + +<pre style="margin-left: 40px;">comparing with http://hg.mozilla.org/l10n-central/x-testing +searching for changes + +changeset: 0:7c543e8f3a6a +tag: tip +user: Your Name <email@example.com> +date: Mon Nov 23 18:08:25 2009 +0100 +summary: Added search bar strings +</pre> + +<ol start="5" style="list-style-type: decimal;"> + <li>Let's now push this changeset. Enter the following command:<code> hg push <a class="external" href="http://hg.mozilla.org/l10n-central/x-testing" rel="freelink">http://hg.mozilla.org/l10n-central/x-testing</a></code></li> + <li>Mercurial will connect to your repo and ask you to provide your account information (i.e., the username and the password).</li> +</ol> + +<pre style="margin-left: 40px;">real URL is http://hg.mozilla.org/l10n-central/x-testing +pushing to http://hg.mozilla.org/l10n-central/x-testing +searching for changes +http authorization required +realm: hg.mozilla.org HTTP +user: your_id +password: +</pre> + +<p style="margin-left: 40px;">After you enter your account information, the changeset will be pushed.</p> + +<pre style="margin-left: 40px;">adding changesets +adding manifests +adding file changes +added 1 changesets with 2 changes to 2 files +bb/acl: your_id is allowed. accepted payload. +quota: 979.7 KB in use, 150.0 MB available (0.64% used) +</pre> + +<p>Your changeset has been successfully pushed to your repository!</p> + +<p>As you begin to move through your translations, you should <code>commit</code> the changes locally and <code>push</code> your work to this experimental repository. For instance, if you have finished translating all the <code>.dtd</code> and <code>.properties</code> files in your <code>x-testing/browser/chrome/browser/</code> directory, then you should run these commands:</p> + +<pre>$ hg status +$ hg commit -m "Translated browser/chrome/browser/" +$ hg outgoing +$ hg push http://hg.mozilla.org/l10n-central/x-testing</pre> + +<p>Note that due to the distributed nature of Hg, <code>hg commit</code> saves the changes locally (i.e., in your computer's Hg repository). You can see the history of commits with <code>hg log</code>. After doing <code>hg commit</code>, you still need to send the changes to the remote repository. This is where <code>hg push</code> comes in. This sends your commits to the remote repository.</p> + +<p>Now you're ready to proceed to the release phase!</p> + +<p> </p> + +<p>{{ PreviousNext("Localization_Quick_Start_Guide/Translation_phase", "Localization_Quick_Start_Guide/Release_phase") }}</p> diff --git a/files/pt-pt/mozilla/localization/guia_iniciação_rápida/index.html b/files/pt-pt/mozilla/localization/guia_iniciação_rápida/index.html new file mode 100644 index 0000000000..7135cec329 --- /dev/null +++ b/files/pt-pt/mozilla/localization/guia_iniciação_rápida/index.html @@ -0,0 +1,41 @@ +--- +title: Guia de Iniciação Rápida da Localização +slug: Mozilla/Localization/Guia_iniciação_rápida +tags: + - Guía + - Tradução +translation_of: Mozilla/Localization/Quick_start_guide +--- +<p>Bem-vindo à localização da Mozilla (abreviado em inglês L10n)!</p> + +<p>Se está aqui para iniciar a sua própria localização no projeto Mozilla ou para se juntar aos esforços de uma localização existente, veio ao lugar certo. Este guia é preenchido com todas as informações técnicas básicas que precisa para se envolver no programa Mozilla l10n. Nós iremos guiá-lo através dos passos para começar, desde a configuração inicial do ambiente até ao teste e lançamento da sua própria localização. Ao longo do caminho, irá aprender sobre a variedade de projetos para os quais pode contribuir e as ferramentas utilizadas para localizá-los.</p> + +<p>Quando alcamçamos exemplos específicos, nós iremos removê-los do projeto Firefox, já que é o projeto mais amplamente localizado dentro da Mozilla. Ao aproximar-se do final deste guia, poderá fazer uma alteração no Firefox na sua configuração local e, depois ver essa alteração na interface do Firefox. Para encerrar, quando terminar este guia, terá todas as ferramentas necessárias para começar a contribuir!</p> + +<p>Lembre-se, este guia irá instruí-lo apenas sobre os aspetos técnicos de L10n da Mozilla. Visite a página do <a class="link-https" href="https://wiki.mozilla.org/L10n:Localization_Process" title="https://wiki.mozilla.org/L10n:Overview">Processo de L10n</a> para saber mais sobre todo o processo.</p> + +<div style="width: 25%; background-color: #4AA02C; float: left; display: block; margin: 1.5%; border: 1px solid #C4C295; text-align: center; padding: 2.5%; padding-top: 0px;"> +<h2 id="Configuração_Inicial"><a href="https://developer.mozilla.org/pt-PT/docs/Mozilla/Localization/Guia_inicia%C3%A7%C3%A3o_r%C3%A1pida/Configuracao_inicial" title="en/Localization_Quick_Start_Guide/Initial_setup">Configuração Inicial</a></h2> +Preparação da tecnologia antes de localizar.</div> + +<div style="width: 25%; background-color: #A2BFF4; float: left; display: block; margin: 1.5%; border: 1px solid #C4C295; text-align: center; padding: 2.5%; padding-top: 0px;"> +<h2 id="Fase_da_tradução"><a href="https://developer.mozilla.org/pt-PT/docs/Mozilla/Localization/Guia_inicia%C3%A7%C3%A3o_r%C3%A1pida/Fase_da_Traducao" title="en/Localization_Quick_Start_Guide/Translation_phase">Fase da tradução</a></h2> +Tutoriais das ferramentas de L10n para tradução.</div> + +<div style="width: 25%; background-color: orange; float: left; display: block; margin: 1.5%; border: 1px solid #C4C295; text-align: center; padding: 2.5%; padding-top: 0px;"> +<h2 id="Fase_de_PR"><a href="/pt-PT/docs/Mozilla/Localization/Guia_inicia%C3%A7%C3%A3o_r%C3%A1pida/Fase_PR" title="en/Localization_Quick_Start_Guide/QA_phase">Fase de PR</a></h2> +Tutoriais de teste de L10n.</div> + +<div style="width: 92%; background-color: #C0C0C0; float: left; display: block; margin: 1.5%; border: 1px solid #C4C295; text-align: center; padding: 2.5%; padding-top: 0px;"> +<h2 id="Fase_de_Lançamento"><a href="https://developer.mozilla.org/pt-PT/docs/Mozilla/Localization/Guia_inicia%C3%A7%C3%A3o_r%C3%A1pida/Fase_de_lancamento" title="en/Localization_Quick_Start_Guide/Release_phase">Fase de Lançamento</a></h2> +Passos para submeter o seu trabalho de tradução.</div> + +<div style="background-color: white; border: 3px solid; display: block; padding: 20px; margin-top: 20px;">Esses quatro estágios formam o lado técnico do programa de l10n. Para saber mais sobre qualquer um deles, clique em quaisquer das hiperligações acima. Para obter uma visão geral, nós sugerimos que comece com a bolha verde e mova de um estágio para outro.</div> + +<p> </p> + +<div class="note"><strong>Nota</strong>: este guia foi escrito para dois tipos de colaboradores: os que iniciam uma nova localização e os que se juntam a uma localização existente. É importante saber que informação se aplica ao tipo de colaborador. Para ajudá-lo a filtrar a informação mais aplicável, note que toda a informação que é única das que iniciam uma nova localização estarão com <span style="color: #daa520;">letra em cor de laranja</span>. Toda a informação que é única para aqueles que se juntam a uma localização existente estará em <span style="color: #0000ff;">letra azul</span>.</div> + +<p class="note"> </p> + +<p>{{ Next("Localization_Quick_Start_Guide/Initial_setup") }}</p> diff --git a/files/pt-pt/mozilla/localization/index.html b/files/pt-pt/mozilla/localization/index.html new file mode 100644 index 0000000000..049ddf8e95 --- /dev/null +++ b/files/pt-pt/mozilla/localization/index.html @@ -0,0 +1,23 @@ +--- +title: Localização na Mozilla +slug: Mozilla/Localization +tags: + - Landing + - Localização + - Mozilla + - Tradução + - l10n +translation_of: Mozilla/Localization +--- +<p><span class="seoSummary"><strong>Localização</strong> (L10n) é o processo de tradução das interfaces do utilizador do software de um idioma para outro e a adaptação para o ajustar a uma cultura estrangeira. Estes recursos são para qualquer um com interesse nos aspetos técnicos involvidos na localização.</span> Estes são para os responsáveis pelo desenvolvimento e todos os colaboradores.</p> + +<h2 id="Consultar_também">Consultar também</h2> + +<dl> + <dt><a href="/pt-PT/docs/MDN/Contribute/Localize" title="/en-US/docs/Project:MDN/Localizing">Localizar MDN</a></dt> + <dd>Este recurso abrange a localização da documentação aqui na MDN.</dd> + <dt><a href="/pt-PT/docs/Archive/B2G_OS/Firefox_OS_apps/Localiza%C3%A7%C3%A3o">Localização de aplicação</a></dt> + <dd>Este conjunto de documentos aplica-se mais especificamente à localização de aplicações, incluindo as aplicações do Firefox OS.</dd> + <dt><a href="/en-US/docs/Web/API/L10n">L10n</a></dt> + <dd>Documentos de referência para a API de L10n que a Mozilla utilzia para localizar o sistema operativo Firefox.</dd> +</dl> diff --git a/files/pt-pt/mozilla/localization/index/index.html b/files/pt-pt/mozilla/localization/index/index.html new file mode 100644 index 0000000000..3b35d9f58b --- /dev/null +++ b/files/pt-pt/mozilla/localization/index/index.html @@ -0,0 +1,9 @@ +--- +title: Índex +slug: Mozilla/Localization/Index +tags: + - Localização + - Tradução +translation_of: Mozilla/Localization/Index +--- +<p>{{Index("/pt-PT/docs/Mozilla/Localization")}}</p> diff --git a/files/pt-pt/mozilla/localization/localizacao_e_plurais/index.html b/files/pt-pt/mozilla/localization/localizacao_e_plurais/index.html new file mode 100644 index 0000000000..207f94128f --- /dev/null +++ b/files/pt-pt/mozilla/localization/localizacao_e_plurais/index.html @@ -0,0 +1,384 @@ +--- +title: Tradução e Plurais +slug: Mozilla/Localization/Localizacao_e_Plurais +tags: + - Internacionalização + - Localização + - Tradução +translation_of: Mozilla/Localization/Localization_and_Plurals +--- +<p>Provavelmente está aqui porque está a traduzir um ficheiro .properties e este tinha uma hiperligação para esta página. Esta página é para ajudar a explicar como localizar essas entradas de carateres para que a forma correta do plural seja mostrada ao utilizador. Por exemplo, "1 página" vs. "2 páginas".</p> + +<p>Se está aqui para criar o seu código (por exemplo, extensões) localizável para as formas de plural, pode ir diretamente para <a href="#Developing_with_PluralForm">Programar com <em>PluralForm</em></a>. Também poderá ter que localizar as entradas iniciais para o seu código, por isso também seria bom que lê-se pelo menos a secção 'Utilização'.</p> + +<h2 id="Utilização">Utilização</h2> + +<p>Aqui tem alguns termos utilizados nesta página para o ajudar a manter as coisas simples:</p> + +<ul> + <li><strong>regra de plural</strong>: para um determinado idioma, existe uma regra gramatical sobre como alterar as palavras, dependendo do número que qualifica a palavra. Idiomas diferentes podem ter regras diferentes.</li> + <li><strong>forma de plural</strong>: para uma regra de plural específica, pode haver várias formas de uma palavra, como "página" e "páginas". Neste caso, existem 2 formulários, mas outros idiomas podem ter 1 ou mais.</li> +</ul> + +<p>If you're here for <code>pluralRule</code> in the <code>chrome/global/intl.properties</code> file, you'll need to figure out what <em>plural rule</em> to choose for your localization. This plural rule is used to determine how many <em>plural forms</em> are needed for each word that needs to be localized, with plurals in mind.</p> + +<p>For all other properties files that link to this page, you'll need to provide enough plural forms of the desired word, and separate them with semi-colons (;). If you don't know how many plural forms you need, check the <code>pluralRule</code> number in <code>chrome/global/intl.properties</code>, and look up the corresponding entry in the following list of plural rules.</p> + +<h2 id="Lista_das_Regras_de_Plural">Lista das Regras de Plural</h2> + +<p>Esta secção contém uma lista de regras plurais ordenadas pelo seu número de regra de plural. Cada entrada indica quantas formas de plural são necessárias ao localizar uma palavra. Para cada entrada, há uma lista de famílias e idiomas nessas famílias, para ajudá-lo a descobrir se é a regra que deve escolher para <code>pluralRule</code>. Além disso, há uma breve descrição de cada forma de plural, seguida por alguns números de amostra que se enquadram nessa forma específica.</p> + +<p>For a given plural rule, the order in which the plural forms are listed is the same order you need to localize a word, separated by semi-colons. For example, English uses plural rule 1, and localizing <code>plurals</code> would require a string of "plural;plurals" where the first word is the singular form and the second is the general plural form.</p> + +<h3 id="Regra_de_plural_0_1_forma">Regra de plural #<em><strong>0</strong></em> (1 forma)</h3> + +<p><strong>Famílias</strong>: Asiáticas (chinês, japonês, coreano), persa, turco/altaico (turco), Thai, Lao<br> + <strong>tudo</strong>: <small>0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, …</small></p> + +<h3 id="Regra_de_plural_1_2_formas">Regra de plural #<em><strong>1</strong></em> (2 formas)</h3> + +<p><strong>Famílias</strong>: Germânico (dinarmaquês, holandês, inglês, Faroese, Frisian, alemão, norueguês, sueco ), Finno-Ugric (Estonian, Finnish, Hungarian), Language isolate (Basque), Latin/Greek (Greek), Semitic (Hebrew), Românico (italiano, português, espanhol, catalão), e vietnamita<br> + <strong>é 1</strong>: <small>1</small><br> + <strong>tudo o resto</strong>: <small>0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, …</small></p> + +<h3 id="Regra_de_plural_2_2_formas">Regra de plural #<em><strong>2</strong></em> (2 formas)</h3> + +<p><strong>Famílias</strong>: Românico (francês, português (Brasil)), Lingala<br> + <strong>é 0 ou 1</strong>: <small>0, 1</small><br> + <strong>tudo o resto</strong>: <small>2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, …</small></p> + +<h3 id="Regra_de_plural_3_3_formas">Regra de plural #<strong><em>3</em></strong> (3 formas)</h3> + +<p><strong>Famílias</strong>: Baltic (Latvian, Latgalian)<br> + <strong>termina em 0</strong>: <small>0</small><br> + <strong>termina em 1, excluindo 11</strong>: <small>1, 21, 31, 41, 51, 61, 71, 81, 91, 101, 121, 131, 141, 151, 161, 171, 181, 191, 201, 221, 231, 241, 251, 261, 271, 281, 291, …</small><br> + <strong>tudo o resto</strong>: <small>2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 32, 33, 34, 35, 36, 37, 38, 39, 42, 43, 44, 45, 46, 47, 48, 49, 52, 53, …</small></p> + +<h3 id="Regra_de_plural_4_4_formas">Regra de plural #<em><strong>4</strong></em> (4 formas)</h3> + +<p><strong>Famílias</strong>: Celtic (Scottish Gaelic)<br> + <strong>é 1 ou 11</strong>: <small>1, 11</small><br> + <strong>é 2 ou 12</strong>: <small>2, 12</small><br> + <strong>is 3-10 ou 13-19</strong>: <small>3, 4, 5, 6, 7, 8, 9, 10, 13, 14, 15, 16, 17, 18, 19</small><br> + <strong>tudo o resto</strong>: <small>0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, …</small></p> + +<h3 id="Regra_de_plural_5_3_formas">Regra de plural #<em><strong>5</strong></em> (3 formas)</h3> + +<p><strong>Famílias</strong>: Romanic (Romanian)<br> + <strong>é 1</strong>: <small>1</small><br> + <strong>é 0 ou termina em 01-19, excluindo 1</strong>: <small>0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, …</small><br> + <strong>tudo o resto</strong>: <small>20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, …</small></p> + +<h3 id="Regra_de_plural_6_3_formas">Regra de plural #<em><strong>6</strong></em> (3 formas)</h3> + +<p><strong>Famílias</strong>: Baltic (Lithuanian)<br> + <strong>termina em 1, excluindo 11</strong>: <small>1, 21, 31, 41, 51, 61, 71, 81, 91, 101, 121, 131, 141, 151, 161, 171, 181, 191, 201, 221, 231, 241, 251, 261, 271, 281, 291, …</small><br> + <strong>termina em 0 ou termina em 11-19</strong>: <small>0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, …</small><br> + <strong>tudo o resto</strong>: <small>2, 3, 4, 5, 6, 7, 8, 9, 22, 23, 24, 25, 26, 27, 28, 29, 32, 33, 34, 35, 36, 37, 38, 39, 42, 43, 44, 45, 46, 47, 48, 49, 52, 53, 54, 55, 56, 57, 58, 59, 62, 63, 64, 65, 66, 67, 68, 69, 72, 73, …</small></p> + +<h3 id="Regra_de_plural_7_3_formas">Regra de plural #<em><strong>7</strong></em> (3 formas)</h3> + +<p><strong>Famílias</strong>: Belarusian, Russian, Ukrainian<br> + <strong>termina em 1, excluindo 11</strong>: <small>1, 21, 31, 41, 51, 61, 71, 81, 91, 101, 121, 131, 141, 151, 161, 171, 181, 191, 201, 221, 231, 241, 251, 261, 271, 281, 291, …</small><br> + <strong>termina em 2-4, excluindo 12-14</strong>: <small>2, 3, 4, 22, 23, 24, 32, 33, 34, 42, 43, 44, 52, 53, 54, 62, 63, 64, 72, 73, 74, 82, 83, 84, 92, 93, 94, 102, 103, 104, 122, 123, 124, 132, 133, 134, 142, 143, 144, 152, 153, 154, 162, 163, 164, 172, 173, 174, 182, 183, …</small><br> + <strong>tudo o resto</strong>: <small>0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 26, 27, 28, 29, 30, 35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 49, 50, 55, 56, 57, 58, 59, 60, 65, 66, 67, 68, 69, 70, 75, 76, 77, …, 112, 113, ..., 212, 213, ...</small></p> + +<h3 id="Regra_de_plural_8_3_formas">Regra de plural #<em><strong>8</strong></em> (3 formas)</h3> + +<p><strong>Famílias</strong>: Eslavo (eslovaco, checo)<br> + <strong>é 1</strong>: <small>1</small><br> + <strong>é 2-4</strong>: <small>2, 3, 4</small><br> + <strong>tudo o resto</strong>: <small>0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, …</small></p> + +<h3 id="Regra_de_plural_9_3_formas">Regra de plural #<em><strong>9</strong></em> (3 formas)</h3> + +<p><strong>Famílias</strong>: Eslavo (polaco)<br> + <strong>é 1</strong>: <small>1</small><br> + <strong>termina em 2-4, excluindo 12-14</strong>: <small>2, 3, 4, 22, 23, 24, 32, 33, 34, 42, 43, 44, 52, 53, 54, 62, 63, 64, 72, 73, 74, 82, 83, 84, 92, 93, 94, 102, 103, 104, 122, 123, 124, 132, 133, 134, 142, 143, 144, 152, 153, 154, 162, 163, 164, 172, 173, 174, 182, 183, …</small><br> + <strong>tudo o resto</strong>: <small>0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 25, 26, 27, 28, 29, 30, 31, 35, 36, 37, 38, 39, 40, 41, 45, 46, 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 65, 66, 67, 68, …</small></p> + +<h3 id="Plural_rule_10_4_forms">Plural rule #<em><strong>10</strong></em> (4 forms)</h3> + +<p><strong>Famílias</strong>: Eslavo (esloveno, sérbio)<br> + <strong>termina em 01</strong>: <small>1, 101, 201, …</small><br> + <strong>termina em 02</strong>: <small>2, 102, 202, …</small><br> + <strong>termina em 03-04</strong>: <small>3, 4, 103, 104, 203, 204, …</small><br> + <strong>tudo o resto</strong>: <small>0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, …</small></p> + +<h3 id="Plural_rule_11_5_forms">Plural rule #<em><strong>11</strong></em> (5 forms)</h3> + +<p><strong>Famílias</strong>: Celtic (Irish Gaelic)<br> + <strong>é 1</strong>: <small>1</small><br> + <strong>é 2</strong>: <small>2</small><br> + <strong>is 3-6</strong>: <small>3, 4, 5, 6</small><br> + <strong>is 7-10</strong>: <small>7, 8, 9, 10</small><br> + <strong>tudo o resto</strong>: <small>0, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, …</small></p> + +<h3 id="Plural_rule_12_6_forms">Plural rule #<em><strong>12</strong></em> (6 forms)</h3> + +<p><strong>Famílias</strong>: Semitic (Arabic)<br> + <strong>é 1</strong>: <small>1</small><br> + <strong>é 2</strong>: <small>2</small><br> + <strong>termina em 03-10</strong>: <small>3, 4, 5, 6, 7, 8, 9, 10, 103, 104, 105, 106, 107, 108, 109, 110, 2</small><small>03, 204, 205, 206, 207, 208, 209, 210, </small><small>…</small><br> + <strong>tudo o resto but é 0 and termina em 00-02, excluding 0-2</strong>: <small>11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, … </small><br> + <strong>termina em 00-02, excluding 0-2</strong>: <small>100, 101, 102, 200, 201, 202, …</small><br> + <strong>é 0</strong>: <small>0</small></p> + +<h3 id="Plural_rule_13_4_forms">Plural rule #<em><strong>13</strong></em> (4 forms)</h3> + +<p><strong>Famílias</strong>: Semitic (Maltese)<br> + <strong>é 1</strong>: <small>1</small><br> + <strong>é 0 ou termina em 01-10, excluindo 1</strong>: <small>0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, …</small><br> + <strong>termina em 11-19</strong>: <small>11, 12, 13, 14, 15, 16, 17, 18, 19, 111, 112, 113, 114, 115, 116, 117, 118, 119, 211, 212, 213, 214, 215, 216, 217, 218, 219, …</small><br> + <strong>tudo o resto</strong>: <small>20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, …</small></p> + +<h3 id="Plural_rule_14_3_forms">Plural rule #<em><strong>14</strong></em> (3 forms)</h3> + +<p><strong>Famílias</strong>: unused<br> + <strong>ends in 1</strong>: <small>1, 11, 21, 31, 41, 51, 61, 71, 81, 91, 101, 111, 121, 131, 141, 151, 161, 171, 181, 191, 201, 211, 221, 231, 241, 251, 261, 271, 281, 291, …</small><br> + <strong>ends in 2</strong>: <small>2, 12, 22, 32, 42, 52, 62, 72, 82, 92, 102, 112, 122, 132, 142, 152, 162, 172, 182, 192, 202, 212, 222, 232, 242, 252, 262, 272, 282, 292, …</small><br> + <strong>tudo o resto</strong>: <small>0, 3, 4, 5, 6, 7, 8, 9, 10, 13, 14, 15, 16, 17, 18, 19, 20, 23, 24, 25, 26, 27, 28, 29, 30, 33, 34, 35, 36, 37, 38, 39, 40, 43, 44, 45, 46, 47, 48, 49, 50, 53, 54, 55, 56, 57, 58, 59, 60, 63, …</small></p> + +<h3 id="Plural_rule_15_2_forms">Plural rule #<em><strong>15</strong></em> (2 forms)</h3> + +<p><strong>Famílias</strong>: Icelandic, Macedonian<br> + <strong>termina em 1, excluindo 11</strong>: <small>1, 21, 31, 41, 51, 61, 71, 81, 91, 101, 121, 131, 141, 151, 161, 171, 181, 191, 201, 221, 231, 241, 251, 261, 271, 281, 291, …</small><br> + <strong>tudo o resto</strong>: <small>0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 42, 43, 44, 45, 46, 47, 48, 49, 50, 52, 53, 54, …</small></p> + +<h3 id="Plural_rule_16_5_forms">Plural rule #<em><strong>16</strong></em> (5 forms)</h3> + +<p><strong>Famílias</strong>: Celtic (Breton)<br> + <strong>termina em 1, excluindo 11, 71, 91</strong>: <small>21, 31, 41, 51, 61, 81, 101, 121, 131, 141, 151, 161, 181, 201, 221, 231, 241, 251, 261, 281, ...</small><br> + <strong>ends in 2, excluindo 12, 72, 92</strong>: <small>2, 22, 32, 42, 52, 62, 82, 102, 122, 132, 142, 152, 162, 182, 202, 222, 232, 242, 252, 262, 282, ...</small><br> + <strong>ends in 3, 4 or 9 excluindo 13, 14, 19, 73, 74, 79, 93, 94, 99</strong>: <small>3, 4, 9, 23, 24, 29, 33, 34, 39, 43, 44, 49, 53, 54, 59, ...</small><br> + <strong>termina em 1000000</strong>: <small>1000000: 1000000, 2000000, 3000000, 4000000, 5000000, 6000000, 7000000, 8000000, 9000000, 10000000, ...</small><br> + <strong>tudo o resto</strong>: <small>0, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 26, 27, 28, 30, 35, 36, 37, 38, 40, ...</small></p> + +<h3 id="Plural_rule_17_2_forms">Plural rule #17 (2 forms)</h3> + +<p><strong>Famílias</strong>: Ecuador indigenous languages (Shuar)<br> + <strong>é 0</strong>: <small>0</small><br> + <strong>tudo o resto</strong>: <small>1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, …</small></p> + +<h3 id="Plural_rule_18_6_forms">Plural rule #18 (6 forms)</h3> + +<p><strong>Famílias</strong>: Welsh<br> + <strong>é 0</strong>: <small>0</small><br> + <strong>é 1</strong>: <small>1</small><br> + <strong>é 2</strong>: <small>2</small><br> + <strong>is 3</strong>: <small>3</small><br> + <strong>é 6</strong>: <small>6</small><br> + <strong>tudo o resto</strong>: <small>4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, …</small></p> + +<h3 id="Plural_rule_19_3_forms">Plural rule #<em><strong>19</strong></em> (3 forms)</h3> + +<p><strong>Famílias</strong>: Slavic (bósnio, croata, sérvio)<br> + <strong>termina em 1, excluindo 11</strong>: <small>1, 21, 31, 41, 51, 61, 71, 81, 91, 101, 121, 131, 141, 151, 161, 171, 181, 191, 201, 221, 231, 241, 251, 261, 271, 281, 291, …</small><br> + <strong>termina em 2-4, excluindo 12-14</strong>: <small>2, 3, 4, 22, 23, 24, 32, 33, 34, 42, 43, 44, 52, 53, 54, 62, 63, 64, 72, 73, 74, 82, 83, 84, 92, 93, 94, 102, 103, 104, 122, 123, 124, 132, 133, 134, 142, 143, 144, 152, 153, 154, 162, 163, 164, 172, 173, 174, 182, 183, …</small><br> + <strong>tudo o resto</strong>: <small>0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 26, 27, 28, 29, 30, 35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 49, 50, 55, 56, 57, 58, 59, 60, 65, 66, 67, 68, 69, 70, 75, 76, 77, …, 112, 113, ..., 212, 213, ...</small></p> + +<h2 id="Exemplos">Exemplos</h2> + +<p>A seguir tem alguns exemplos para vários idiomas e um breve processo de reflexão.</p> + +<h3 id="Francês">Francês</h3> + +<p>Some French speaking places treat 0 as plural while others treat it as singular. The only other singular é 1 while tudo o resto is plural. So pick either plural rule #1 or #2.</p> + +<p><code>pluralRule=2<br> + seconds=seconde;secondes<br> + minutes=minute;minutes<br> + hours=heure;heures<br> + days=jour;jours </code></p> + +<p>Like many other times when localizing words, gender agreement might force you to rearrange words in a way that the gender is always the same. (seconde vs jour)</p> + +<h3 id="Chinês">Chinês</h3> + +<p>A word doesn't change if there is a different number in front of it, so all numbers use the same plural form. With just one plural form, it has to be plural rule #0. For each word to localize, it's just like localizing a single word with no semi-colons needed.</p> + +<p><code>pluralRule=0<br> + seconds=秒<br> + minutes=分<br> + hours=時<br> + days=日 </code></p> + +<h3 id="Polaco">Polaco</h3> + +<p>There's a singular form fou 1, a plural form for 2-4, and another for 5-21 at which point 22 is the same as 2. Plural rule #7 has a "termina em 2-4, not 12-14" but the singular form includes everything ending in 1 except 11. Plural rule #9 has the correct singular form for only 1.</p> + +<p><code>pluralRule=9<br> + seconds=sekunda;sekundy;sekund<br> + minutes=minuta;minuty;minut<br> + hours=godzina;godziny;godzin<br> + days=dzień;dni;dni </code></p> + +<p>Even though the last 2 plural forms of "day" are the same, both are still needed, because there needs to be 3 plural forms for each word.</p> + +<h3 id="Sérbio">Sérbio</h3> + +<p>There are 4 plural forms: nominative singular, nominative dual, nominative plural, genitive plural. These match up with plural rule #10.</p> + +<p><code>pluralRule=10<br> + seconds=sekunda;sekundźe;sekundy;sekundow<br> + minutes=mjeńšina;mjeńšinje;mjeńšiny;mjeńšin<br> + hours=hodźina;hodźinje;hodźiny;hodźin<br> + days=dźeń;dnjej;dny;dnjow </code></p> + +<h2 id="Extensão_de_Teste">Extensão de Teste</h2> + +<p>Para ajudar a ter a certeza de que escolhe a regra de plural correta e fornecer formas de plural suficientes para as sequências de carateres, deveria utilizar a extensão "pluralForm Checker". Depois de instalar a extensão, esta deverá estar disponível no menu de "Ferramentas".</p> + +<p>To use it, list off the property files and properties that you want to check and click the button. The extension will load each property and display the plural forms in a table. Selecting a table entry will populate the bottom box with sample uses of the word for some numbers.</p> + +<p><img alt="Image:pluralForm-checker.0.3.png" class="internal" src="/@api/deki/files/804/=PluralForm-checker.0.3.png"></p> + +<p><a class="external" href="https://ed.agadak.net/firefox/pluralForm-checker.xpi">Instalar a extensão Checker v0.3 de <em>pluralForm</em></a></p> + +<h3 id="Entrada_de_extensão">Entrada de extensão</h3> + +<p>Seria bom manter esta lista atualizada com todas as palavras que precisam de formas plurais. As pessoas que utilizam a extensão podem copiar/colar esta entrada.</p> + +<p><code><small><a class="external" rel="freelink">chrome://mozapps/locale/downloads/do...tes,hours,days</a><br> + <a class="external" rel="freelink">chrome://mozapps/locale/downloads/do...dsTitlePercent</a><br> + <a class="external" rel="freelink">chrome://browser/locale/browser.prop...ausedDownloads</a> </small></code></p> + +<h3 id="Histórico_de_versão">Histórico de versão</h3> + +<p>0.1: Initial version with pluralRule check, properties input loading, table generation, sample output display<br> + 0.2: Use PluralForm.numForms() to get the number of forms instead of figuring out locally to better support future rules - <strong>Requires build from 2007/01/27 or later</strong><br> + 0.3: Generate a list of what numbers fall into which plural form to minimize the sample output to at most 3 of each form</p> + +<h2 id="Programar_com_PluralForm">Programar com <em>PluralForm</em></h2> + +<p>The functionality for getting the correct plural forms is provided by a JavaScript Module, <code>PluralForm.jsm</code>. This module provides a couple methods for localizing to the browser's current locale as well as getting methods to localize to a desired plural rule. The latter ability of specifying a plural rule is useful for extensions because the extension doesn't necessarily have to be localized to the browser's locale.</p> + +<h3 id="Carregar_PluralForm.jsm">Carregar <code>PluralForm.jsm</code></h3> + +<p>Loading the PluralForm module from JavaScript is simple with <a href="/en-US/docs/Mozilla/Tech/XPCOM/Language_Bindings/Components.utils.import" title="Components.utils.import">Components.utils.import</a>. Just put the following line somewhere that will be evaluated before you want to use PluralForm. At the top of your JavaScript file is fine.</p> + +<pre>Components.utils.import("resource://gre/modules/PluralForm.jsm");</pre> + +<h3 id="Métodos_get">Métodos: <em><code>get</code></em></h3> + +<p>Estes métodos utilizam o idioma atual do navegador especificado pelo valor <code><a class="external" rel="freelink">chrome://global/locale/intl.properties</a></code>'s <code>pluralRule</code>.</p> + +<pre>/** + * Get the correct plural form of a word based on the number + * + * @param aNum + * The number to decide which plural form to use + * @param aWords + * A semi-colon (;) separated string of words to pick the plural form + * @return The appropriate plural form of the word + */ +string pluralForm +get(int aNum, string aWords)</pre> + +<p>Aqui tem um exemplo de utilização deste método:</p> + +<pre>// Load PluralForm and for this example, assume English +Components.utils.import("resource://gre/modules/PluralForm.jsm"); + +// PluralForm.get expects a semi-colon separated list of words +let downloads = "download;downloads"; +// Pretend this number came from somewhere else +let num = 10; + +// Display the correct plural form fou 10 downloads: "You have 10 downloads.") +print("You have " + num + " " + PluralForm.get(num, downloads) + "."); + +// Try again with a different value: "You have 1 download." +num = 1; +print("You have " + num + " " + PluralForm.get(num, downloads) + ".")</pre> + +<p>The above example works, but is still difficult to localize, because we're concatenating strings assuming a particular grammatical structure. The following would be better:</p> + +<pre>Components.utils.import("resource://gre/modules/PluralForm.jsm"); + +let downloads = "You have one download.;You have #1 downloads."; +let num = 10; + +// For English, this would display "You have 10 downloads." +print(PluralForm.get(num, downloads).replace("#1", num);</pre> + +<p>Notice in the above example that the code can be written to support placeholders or not use placeholders in some forms of the string. Additionally, the localizer has control over where the placeholder is, in relation to the rest of the text.</p> + +<p>Of course, the strings to be localized will be placed in a separate file, such as yourextension.properties, instead of being hardcoded in the JavaScript code file.</p> + +<p>The following 3 file snippets show how to use PluralForm with your <code>.xul</code>, <code>.properties</code>, <code>.js</code> files.</p> + +<p><code>downloads.xul</code>:</p> + +<pre><stringbundleset> + <stringbundle id="strings" src="chrome://downloads.properties"/> +</stringbundleset></pre> + +<p><code>downloads.properties</code>:</p> + +<pre># LOCALIZATION NOTE (downloadsTitleFiles): Semi-colon list of plural forms. +# See: https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_and_Plurals +# #1 number of files +# example: 111 files - Downloads +downloadsTitleFiles=#1 file - Downloads;#1 files - Downloads + +# LOCALIZATION NOTE (timePair): #1 time number; #2 time unit +# example: 1 second; 11 seconds +timePair=#1 #2 +seconds=second;seconds +minutes=minute;minutes +hours=hour;hours +</pre> + +<p><code>downloads.js</code>:</p> + +<pre>Components.utils.import("resource://gre/modules/PluralForm.jsm"); +let getStr = function(string) document.getElementById("strings").getString(string); + +// Get the correct plural form for the title +let numDownloads = 3; +let title = PluralForm.get(numDownloads, getStr("downloadsTitleFiles")); +// Put in the correct number of downloads +print(title.replace("#1", numDownloads)); + +// Get the correct plural form of seconds +let timeLeft = 55; +let seconds = PluralForm.get(timeLeft, getStr("seconds")); +// Print the localized string for "55 seconds" +print(getStr("timePair").replace("#1", timeLeft).replace("#2", seconds));</pre> + +<h3 id="Método_makeGetter">Método: <code>makeGetter</code></h3> + +<p>If you're writing an extension, you'll want to use <code>makeGetter</code> instead of <code>PluralForm.get()</code> or <code>PluralForm.numForms()</code>. This is because someone installing the extension on a different locale will be using the strings provided by your default extension locale. For example, your extension localized for English with plural rule #1, which expects 2 plural forms, is installed on a localized version of Firefox with plural rule #4, which expects 3 forms:</p> + +<pre>/** + * Create a pair of plural form functions for the given plural rule number. + * + * @param aRuleNum + * The plural rule number to create functions + * @return A pair: [function that gets the right plural form, + * function that returns the number of plural forms] + */ +[string pluralForm get(int aNum, string aWords), int numForms numForms()] +makeGetter(int aRuleNum)</pre> + +<p>Aqui tem um exemplo de utilização de <code>makeGetter</code>:</p> + +<pre>Components.utils.import("resource://gre/modules/PluralForm.jsm"); + +// Let's get Irish (plural rule #11) +let [get, numForms] = PluralForm.makeGetter(11); + +// Make up some values to use with "get" +let dummyText = "form 1;form 2;form 3;form 4;form 5"; +let dummyNum = 10; + +// In the case of Irish, the value 10 uses plural form #4, so "form 4" is printed +print(get(dummyNum, dummyText));</pre> + +<p>In this example, the Irish plural rule was hardcoded, but this could be a value specified in the .properties file. So for your extension, specify a pluralRule value in the .properties, and call <code>PluralForm.makeGetter(pluralRuleFromProperties),</code> making sure to save the 2 returned functions. (You can use <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment" title="Destructuring assignment">destructured assignment</a> in JavaScript 1.7 to keep things clean.) The returned functions act just like <code>PluralForm.get()</code> and <code>PluralForm.numForms()</code>, except for the specified plural rule instead of the default plural rule.</p> + +<h2 id="Créditos">Créditos</h2> + +<p>Inicialmente, o código da "Forma de Plural" foi implementado por {{ Bug(394516) }} - <em>Figure out a remaining-time rounding scheme for minutes -> hours/days</em><br> + As regras de plural e as familias derivadas da <a class="external" href="https://www.gnu.org/software/gettext/manual/html_node/gettext_150.html#Plural-forms">documentação <code>gettext</code> da GNU</a>.</p> diff --git a/files/pt-pt/mozilla/localization/localizar_com_mercurial/index.html b/files/pt-pt/mozilla/localization/localizar_com_mercurial/index.html new file mode 100644 index 0000000000..de4a09643f --- /dev/null +++ b/files/pt-pt/mozilla/localization/localizar_com_mercurial/index.html @@ -0,0 +1,256 @@ +--- +title: Localizar com Mercurial +slug: Mozilla/Localization/Localizar_com_Mercurial +tags: + - Documentação de criação + - Internacionalização + - Localização + - Tradução +translation_of: Mozilla/Localization/Localizing_with_Mercurial +--- +<p>In Mozilla, we use the the <a href="../../../../en/Mercurial_basics" rel="internal">Mercurial</a> version control system (Hg) to manage our source code and localizations. Mercurial allows localizers to work locally (on their machines) and then <code style="font-size: 14px;">push</code> (an Hg term) changes to a remote repository, which usually is hosted on the Mozilla servers (<a class="external" href="http://hg.mozilla.org/" title="http://hg.mozilla.org/">hg.mozilla.org</a>). Localizing current versions of Firefox, Thunderbird and SeaMonkey includes working with Mercurial. If the documentation is incomplete or you have questions, please drop by the <a href="irc://irc.mozilla.org/l10n" title="irc://irc.mozilla.org/l10n">#l10n</a> or <a href="irc://irc.mozilla.org/hg" title="irc://irc.mozilla.org/hg">#hg</a> channels on irc.mozilla.org. The <a class="internal" href="/en/Mercurial_FAQ" title="En/Mercurial FAQ">Mercurial FAQ</a> are also worth a read, should you run into trouble.</p> + +<p>For the eager and quick, below you'll find instructions on installing and configuring Mercurial, instructions on receiving an Hg account commit priviledges, as well as a few tasks you can complete without account priviledges.</p> + +<h2 id="Instalar_Mercurial">Instalar Mercurial</h2> + +<p>Follow the instructions below to install Mercurial on your system. Once you've installed Mercurial, we'll walk through the steps to <a href="/en/Mercurial_FAQ#Configuration" title="en/Mercurial FAQ#Configuration">configure</a> it.</p> + +<h3 id="Mercurial_no_Linux">Mercurial no Linux</h3> + +<p>You can easily install Mercurial from the command line by issuing one of the following commands. Choose the appropriate command for your distribution and make sure to run <em>as root</em>.</p> + +<pre># Debian/ubuntu +$ apt-get install mercurial + +# Fedora +$ yum install mercurial + +# Gentoo +$ emerge mercurial + +# Arch Linux +$ pacman -S mercurial + +# OpenSolaris +$ pkg install SUNWmercurial +</pre> + +<p>Se preferir uma interface gráfica, pode <a href="http://javaforge.com/project/HGE" title="http://javaforge.com/project/HGE">transferir e instalar o MercurialEclips e aqui</a>.</p> + +<h4 id="Este_funcionou">Este funcionou?</h4> + +<p>Open a Terminal window and enter <code>hg --version</code>. If you see a message about the version of Mercurial (e.g. <code>Mercurial Distributed SCM (version 1.3.1)</code>), you have installed Mercurial successfully!</p> + +<h4 id="Mais_detalhes">Mais detalhes</h4> + +<p>For more details on installing Hg on Linux systems, refer to the <a class="external" href="http://mercurial.selenic.com/downloads/" title="http://mercurial.selenic.com/downloads/">instructions on Mercurial's Download page</a>.</p> + +<h3 id="Mercurial_no_Windows">Mercurial no Windows</h3> + +<p>With Windows, you have a couple of install options:</p> + +<ul> + <li>For a <strong>command line interface</strong>, download and install {{ interwiki("wikimo", "MozillaBuild") }} package. This will not only install Hg, but also all the tools required to build Mozilla products on Windows. Trust us, you'll want this eventually.</li> + <li><a href="/@api/deki/files/3863/=TortoiseHg.png" title="TortoiseHg.png"><img alt="TortoiseHg.png" class="internal rwrap" src="/@api/deki/files/3863/=TortoiseHg.png?size=thumb" style="float: right; height: 115px; width: 160px;"></a>For a <strong>graphical interface</strong>, you may want to <a class="external" href="http://tortoisehg.bitbucket.org/" title="http://tortoisehg.bitbucket.org/">install TortoiseHg</a>, which integrates with your Windows Explorer shell. It also installs the command line utility.</li> +</ul> + +<p><a href="/@api/deki/files/3861/=Mercurial_Installer.png" title="Mercurial Installer.png"><img alt="Mercurial Installer.png" class="internal rwrap" src="/@api/deki/files/3861/=Mercurial_Installer.png?size=thumb" style="float: right; height: 125px; width: 160px;"></a>Part of the command line Hg install for Windows involves making sure the <code>hg </code>executable is in the system's <code>%PATH%</code> variable (TortoiseHg doesn't need this step). Use the <code>add_path.exe</code> utility found in <code>C:\mozilla-build\hg</code> to do this.</p> + +<pre>PS C:\Users\your_id> cd C:\mozilla-build\hg +PS C:\mozilla-build\hg> .\add_path.exe /result . +</pre> + +<p>Note the dot ("<code>.</code>") at the end of the second command, which means <em>the current directory</em>. If the utility modified your <code>%PATH%</code> successfully, a dialog will open saying, "<code><em>%PATH%</em></code><em> has been updated correctly</em>."</p> + +<p>Alternatively, you can edit the <code>%PATH%</code> variable manually. In order to do so, right-click on your computer icon, choose <code>Properties > Advanced > Environmental Variables</code>, select <code>PATH </code>and click <code>Edit</code>. If you don't see <code>PATH</code> among the options, you'll have to click <code>Add</code> and edit it within the <strong>Add</strong> dialog. See the screenshot for an example.<a href="/@api/deki/files/3862/=PATH.jpg" title="PATH.jpg"><img alt="PATH.jpg" class="internal rwrap" src="/@api/deki/files/3862/=PATH.jpg?size=thumb" style="float: right; height: 71px; width: 160px;"></a></p> + +<h4 id="Este_funcionou_2">Este funcionou?</h4> + +<ol> + <li>Go to <code>Start > Run...</code></li> + <li>Type <code>cmd.exe </code>and click <code>OK</code>. A new shell window should appear. </li> + <li>Type <code>hg --version</code> in the new shell window. If you see a message about the version of Mercurial (e.g. <code>Mercurial Distributed SCM (version 1.3.1)</code>), you have installed Mercurial successfully!</li> +</ol> + +<h4 id="Mais_detalhes_2" style="font-size: 14px;">Mais detalhes</h4> + +<p>For more details on installing Hg on Windows, refer to the <a class="external" href="http://mercurial.selenic.com/downloads/" title="http://mercurial.selenic.com/downloads/">instructions on Mercurial's Download page</a>.</p> + +<h3 id="Mercurial_no_Mac_OSX">Mercurial no Mac OSX</h3> + +<p>Installing Hg on Mac OSX is super easy. You can install Mercurial via <a class="external" href="http://www.macports.org/" title="http://www.macports.org/">MacPorts</a> through the Terminal, like so:</p> + +<p><code>$ sudo port install mercurial</code></p> + +<p>You can also install it by downloading the dmg package from the <a href="http://mercurial.selenic.com/wiki/Download#Mac_OS_X" title="http://mercurial.selenic.com/wiki/Download#Mac_OS_X">Hg download page</a>. It has an install dialog that will walk you through the process.</p> + +<p>If you prefer a graphical interface, you can <a href="http://javaforge.com/project/HGE" title="http://javaforge.com/project/HGE">download and install MercurialEclipse here</a>.</p> + +<h4 id="Este_funcionou_3">Este funcionou?</h4> + +<p>Open a Terminal window and type <code>hg --version</code>. If you see a message about the version of Mercurial (e.g. <code>Mercurial Distributed SCM (version 1.3.1)</code>), you have installed Mercurial successfully!</p> + +<h4 id="Mais_detalhes_3" style="font-size: 14px;">Mais detalhes</h4> + +<p>For more details on installing Hg on Mac OSX, refer to the <a class="external" href="http://mercurial.selenic.com/downloads/" title="http://mercurial.selenic.com/downloads/">instructions on Mercurial's Download page</a>.</p> + +<h2 id="Configurar_o_Mercurial">Configurar o Mercurial</h2> + +<p>Once you've installed Mercurial, you'll need to configure it before you can use it successfully.</p> + +<p>Your Mercurial configuration is contained within a config file which you must create yourself. Your config file is called either <code style="font-size: 14px; color: rgb(51, 51, 51);">~/.hgrc</code> (UNIX systems) or <code style="font-size: 14px; color: rgb(51, 51, 51);">Mercurial.ini</code> (Windows), depending on your operating system.</p> + +<p>Your config file should have the following settings:</p> + +<pre class="eval">[ui] +username = Your Real Name <<a class="link-mailto" href="mailto:user@example.com" rel="external" title="mailto:user@example.com">user@example.com</a>> +merge = internal:merge + +[defaults] +commit = -v + +[diff] +git = 1 +showfunc = 1 +unified = 8</pre> + +<p>To configure Hg, follow these steps:</p> + +<ol> + <li>Create a new file in your favorite text editor.</li> + <li>Copy the settings above and paste them into your new file.</li> + <li>Save the file as either <code>.hgrc</code> (UNIX systems) or <code>Mercurial.ini</code> (Windows) and save it in either <code>$HOME/</code> or <code>C:\mozilla-build\hg\</code> or <code>C:\Program Files\Mercurial\</code>.</li> +</ol> + +<p>Now that you've installed and configured Mercurial, here are a few tasks you can do without Hg commit access priviledges.</p> + +<h2 id="Clonar_e_atualizar_os_repositórios">Clonar e atualizar os repositórios</h2> + +<p>There are a couple of repostiories that contain en-US source files that most locales will want to deal with.</p> + +<ul> + <li><a class="external" href="https://hg.mozilla.org/mozilla-central/" title="https://hg.mozilla.org/mozilla-central/">mozilla-central</a> contains the files for Firefox Nightly.</li> + <li><a class="external" href="https://hg.mozilla.org/comm-central/" title="https://hg.mozilla.org/comm-central">comm-central</a> contains the files for SeaMonkey and Thunderbird which are not already part of Firefox.</li> + <li><a href="https://hg.mozilla.org/l10n-central/" title="https://hg.mozilla.org/l10n-central/">l10n-central</a> contains all of the L10n repos for Firefox Nightly.</li> +</ul> + +<div class="note"> +<p>When you get the comm-central repository, this will include the mozilla-central repository as well. You can therefore use the one set up for developing Firefox, SeaMonkey and Thunderbird without having to pull mozilla-central a second time.</p> +</div> + +<p>Here's how to get (or clone) your en-US source files for the first time:</p> + +<ul> + <li>Run the following command in the command line to get the source en-US files for Firefox:</li> +</ul> + +<pre class="eval">hg clone https://hg.mozilla.org/mozilla-central/ +</pre> + +<p>This will create a clone of the mozilla-central repository in the directory mozilla-central.</p> + +<ul> + <li>Run the following commands in the command line to get the source en-US files for any combination of Firefox, SeaMonkey, Thunderbird:</li> +</ul> + +<pre>hg clone https://hg.mozilla.org/comm-central/ +cd comm-central +python client.py checkout +</pre> + +<p>The first command will create a clone of the comm-central repository. The second command will move you into that directory. The third command will do a clone of mozilla-central, and pull some other hg repositories. The other directories are required for SeaMonkey and Thunderbird.</p> + +<ul> + <li>Cloning your localization repository for the first time is just as easy. For example, to clone your Firefox Nightly L10n repo, run the following command, replacing ab-CD with your locale code:</li> +</ul> + +<pre class="eval" style="font-size: 14px;">hg clone https://hg.mozilla.org/l10n-central/ab-CD/</pre> + +<h3 id="Atualizar_os_seus_repositórios_locais">Atualizar os seus repositórios locais</h3> + +<ul> + <li>To update your working copy of mozilla-central, go to your local mozilla-central directory and run:</li> +</ul> + +<pre class="eval">hg pull -u +</pre> + +<p>This will both get new changesets from mozilla-central and apply those changes in your working copy.</p> + +<ul> + <li>To update your working copy of comm-central, go to your comm-central directory and run:</li> +</ul> + +<pre>python client.py checkout</pre> + +<p>This will both get new changesets from comm-central, mozilla-central and the other appropriate locations and apply those changes in your working copy.</p> + +<ul> + <li>To update your local L10n repo after your first clone, run this command from your local L10n directory:</li> +</ul> + +<pre style="font-size: 14px;">hg pull -u</pre> + +<h2 id="Criar_correções_(patches)_de_L10n">Criar correções (patches) de L10n</h2> + +<p>Another thing you can do with Hg without needing account priviledges is creating L10n patches of your work for someone else to commit to your remote L10n repo on the Mozilla servers. Doing this ensures that your dashboards are always accurate, as they look at your remote repo.</p> + +<p>Here's how to create a L10n patch with Hg and the <a href="http://mercurial.selenic.com/wiki/MqExtension" title="http://mercurial.selenic.com/wiki/MqExtension">Mq extension</a>:</p> + +<ol> + <li>Enable Mq by adding <code>hg.ext = </code> to your Mercurial config file (<code>~/.hgrc</code> on Unix-like systems or <code>Mercurial.ini</code> on Windows) under the <code>[extensions]</code> section.</li> + <li>Open your command line tool and navigate to your L10n directory.</li> + <li>Inside your L10n directory, init your repo with Mq by running <code>hg init --mq</code>.</li> + <li>To create a new patch, run <code>hg qnew -m "Your commit message" patch-name.patch</code>. The commit message should take the form of "Bug 123456 - Change this thing to work better by doing something; r=reviewers" if you are to fix a bug.</li> + <li>Make your change.</li> + <li>Once you finish making your change, run <code>hg qrefresh</code> to commit your changes to the patch.</li> + <li>Navigate to your <code><repository>/.hg/patches</code> to find your <code>.patch</code>.</li> + <li>You may repeat from step 4 to create another patch. Your patches will be incremental, i.e. new patches are created based on old patches. If you want to commit all the patches to the repository and cleanup the patch queue, run <code>hg qfinish</code>.</li> +</ol> + +<p>Please refer to <a href="http://mercurial.selenic.com/wiki/MqTutorial" title="http://mercurial.selenic.com/wiki/MqTutorial">MqTutorial</a> and <a href="http://mercurial.selenic.com/wiki/MqExtension" title="http://mercurial.selenic.com/wiki/MqExtension">Mq documentation</a> for further uses of Mq extension to manage patches.</p> + +<h2 id="Privilégios_da_Conta_Mercurial">Privilégios da Conta Mercurial</h2> + +<p>Eventually, you or your team leader will need Hg account priviledges. Let's face it, it's just more convenient to commit and push your work to the remote repo yourself, rather than creating patches and asking someone else to push them for you.</p> + +<p>To get write access to the l10n hg repositories on the Mozilla server,<a class="external" href="http://www.mozilla.org/hacking/commit-access-policy/" title="http://www.mozilla.org/hacking/commit-access-policy/"> there's a bit of paper work to be done</a>. The localization team owner needs to <a class="link-https" href="https://bugzilla.mozilla.org/enter_bug.cgi?product=mozilla.org&component=Repository%20Account%20Requests&rep_platform=All&op_sys=All&cc=l10n%40mozilla.com&short_desc=l10n%20hg%20account%20for%20John%20Doe%20(ab-CD)" title="https://bugzilla.mozilla.org/enter_bug.cgi?product=mozilla.org&component=Repository%20Account%20Requests&rep_platform=All&op_sys=All&cc=l10n%40mozilla.com&short_desc=l10n%20hg%20account%20for%20John%20Doe%20(ab-CD)">file a bug requesting an hg account</a>. This bug will request level 1 L10n priviledges. You need to follow the instructions regarding the <a class="external" href="http://www.mozilla.org/hacking/committer/" title="http://www.mozilla.org/hacking/committer/">contributor form</a>. Write access to the hg repositories requires a ''voucher'', which, for the owner, will be done based on the review by Mozilla. For peers of a localization, the owner can vouch (once she or he is registered).</p> + +<h2 id="Pull_your_locale" name="Pull_your_locale">Enviar alterações para a Mozilla</h2> + +<p>Now that you have Hg account privileges, you can send your work to Mozilla all by yourself. Here are the steps to send your L10n work using Mercurial:</p> + +<ol> + <li>Since your L10n work takes place in your own local repository, you should ensure that there are no changes made to the remote repository before committing your work. To do this, <a href="https://developer.mozilla.org/en-US/docs/Localizing_with_Mercurial#Updating_your_local_repos" title="https://developer.mozilla.org/en-US/docs/Localizing_with_Mercurial#Updating_your_local_repos">update your locale, as per the section above</a>.</li> + <li>After finishing a change or set of changes and checking you have updated to the latest, you should commit by entering this command:</li> +</ol> + +<pre class="eval">hg commit -m "your message identifying the change (bug 555)"</pre> + +<p>Committing won’t send your changes to Mozilla’s repository, but prepares them for it. The next step will send your changes to your remote repo via <code>push</code>.</p> + +<ol start="3"> + <li>To push to mozilla-hosted repositories, you have to have committer access, and you must edit the file <code><em>(your-local-hg-root AKA the directory you pulled your locale into)</em>/.hg/hgrc</code> (note, this is <strong>NOT</strong> your <code>~/.hgrc</code>) to add these lines (replacing ab-CD with your locale code):</li> +</ol> + +<pre class="eval">[paths] +default = https://hg.mozilla.org/l10n-central/ab-CD/ +default-push = ssh://hg.mozilla.org/l10n-central/ab-CD/ +</pre> + +<ol start="4"> + <li>You’ll also need to tell ssh which account to use for your pushes, too, by editing <code>~/.ssh/config</code> and adding these lines, where <code style="font-size: 14px; color: rgb(51, 51, 51);">user@host.domain</code> is your account:</li> +</ol> + +<pre>Host hg.mozilla.org +User user@host.domain +</pre> + +<ol start="5"> + <li>Now you can push your work to the repository (and check the result on the dashboard) by entering this command from your local directory:</li> +</ol> + +<pre class="eval">hg push</pre> + +<p id="A_.mozconfig">And tah dah! You're done! Congratulations on finishing the tutorial. Take a break and grab a snack, you deserve it</p> diff --git a/files/pt-pt/mozilla/localization/localização_com_pontoon/index.html b/files/pt-pt/mozilla/localization/localização_com_pontoon/index.html new file mode 100644 index 0000000000..05fa58b1d6 --- /dev/null +++ b/files/pt-pt/mozilla/localization/localização_com_pontoon/index.html @@ -0,0 +1,138 @@ +--- +title: Traduzir com Pontoon +slug: Mozilla/Localization/Localização_com_Pontoon +tags: + - Localização + - Tradução +translation_of: Mozilla/Localization/Localizing_with_Pontoon +--- +<p><a href="https://pontoon.mozilla.org/pt-PT/" title="https://pontoon.mozilla.org">Pontoon</a> é uma ferramenta de localização (l10n), O-Que-Vê-É-O-Que-Obtém (WYSIWYG) baseada na Web. Na Mozilla, nós utilizamos o Pontoon para localizar todos os produtos e sites da Web da Mozilla, desde o Firefox até Mozilla.org. Pontoon é uma ferramenta muito simples e intuitiva que requer poucos conhecimentos técnicos para utilizar no ritmo de trabalho de l10n. Aqui, nós iremos discutir como utilizar o Pontoon para localizar projetos, desde o primeiro início de sessão até concluir as suas contribuições. Ao longo do caminho, nós iremos sugerir algumas funcionalidades que irão tornar mais eficiente e facilitar as suas contribuições no seu l10n.</p> + +<div class="note"> +<p><strong>É um programador?</strong> Leia sobre a <a href="/pt-PT/docs/Mozilla/Implementacao_do_Pontoon_num_projeto_da_Mozilla">implementação do Pontoon no seu projet</a>o ou saiba como participar no <a href="https://github.com/mozilla/pontoon">GitHub</a>.</p> +</div> + +<h2 id="Primeiros_passos">Primeiros passos</h2> + +<p><a href="https://pontoon.mozilla.org" title="https://pontoon.mozilla.org">Pontoon's home page</a> is very easy to use. To begin localizing the project, click on the Persona icon and sign in. Next, simply select the project you want to work on and your locale from the dropdown menus. Pontoon will automatically open that locale's project for you to get started. Note that for our purposes here, we'll be using <a href="https://affiliates.mozilla.org/">Firefox Affiliates</a> website to demo Pontoon's functionality and workflow. And there it is, opened inside Pontoon:</p> + +<p><em><img alt="Browser app and workspace" src="https://mdn.mozillademos.org/files/8323/affiliates.png" style="height: 558px;"></em></p> + +<h3 id="Barra_de_ferramentas_principal">Barra de ferramentas principal</h3> + +<p>As you can see, most of the interface is taken by the website being translated. Only the toolbar on top belongs to Pontoon, containing the following items (from left to right):</p> + +<p><img alt="Main toolbar" src="https://mdn.mozillademos.org/files/8325/toolbar.png"></p> + +<h4 id="Lista_de_textos">Lista de textos</h4> + +<p>Opens a sidebar with a list of all strings to localize.</p> + +<h4 id="Seletor_de_projeto_(Afiliados)"><span id="cke_bm_939S" style="display: none;"> </span>Seletor de projeto (Afiliados)</h4> + +<p>Switches between projects to localize.</p> + +<h4 id="Seletor_de_recursos_(Página_Inicial)"><span id="cke_bm_940S" style="display: none;"> </span>Seletor de recursos (Página Inicial)</h4> + +<p>Switches between project resources to localize, like subpages or localization files. Hidden if no resources available for project.</p> + +<h4 id="sect1"><span id="cke_bm_941S" style="display: none;"> </span></h4> + +<dl> +</dl> + +<h4 id="Seletor_de_idioma_(Esloveno)">Seletor de idioma (Esloveno)</h4> + +<p>Switches between languages to localize.</p> + +<h4 id="Ir">Ir</h4> + +<p>Opens project-resource-locale selection.</p> + +<h4 id="Indicado_do_progresso">Indicado do progresso</h4> + +<p>Displays your progress on the resource being localized. More details are available in the popup.</p> + +<dl> +</dl> + +<h4 id="Menu_do_utilizador"><span id="cke_bm_943S" style="display: none;"> </span>Menu do utilizador</h4> + +<p>Allows for user-specific tasks, like commiting to repository, downloading files and signing out.</p> + +<h4 id="Menu_da_informação">Menu da informação</h4> + +<p>Gives important information, like the anticipated project timeline and a list of keyboard shortcuts.</p> + +<dl> +</dl> + +<p>Alright, how about we do some translating now?<span id="cke_bm_608E" style="display: none;"> </span></p> + +<dl> +</dl> + +<h2 id="Traduzir_texto">Traduzir texto</h2> + +<p>When using Pontoon for localization, you have a couple of options to translate your strings. You can translate in-context, out-of-context, or a combination of the two. We'll start with looking at in-context translation.</p> + +<h3 id="In-context">In-context</h3> + +<p>Pontoon's in-context translation mode is what puts it above others. It opens a web page (or web app) and enables real-time editing of that page. Here's how you translate your first string:</p> + +<p><img alt="In-context localization" src="https://mdn.mozillademos.org/files/8331/in-context.png"></p> + +<ol> + <li>Hover over the text you want to translate with your mouse.</li> + <li>An edit button appears over that text. Click on it to enable the translate mode.</li> + <li>Replace the original text with its translation into your language.</li> + <li>Click the save button to save your translation.</li> +</ol> + +<div> +<h3 id="Out-of-context">Out-of-context</h3> + +<p>Some strings are impossible to translate in-context, e.g. the contents of the <title> tag in websites and strings with placeables or different plural forms. By clicking on the hamburger icon in the main toolbar, a list of all strings and available translations will open in the sidebar. You can also use the sidebar for out-of-context localization:</p> + +<p><img alt="Out-of-context localization: list" src="https://mdn.mozillademos.org/files/8337/out-of-context-1.png"> <img alt="Out-of-context localization: translate" src="https://mdn.mozillademos.org/files/8335/out-of-context-2.png"></p> + +<ol> + <li>Click on the string you'd like to translate.</li> + <li>Translation panel with original string and its details (e.g. comments) opens.</li> + <li>Translate the string in the translation area below.</li> + <li>Click the save button to save your translation.</li> +</ol> + +<p>As you translate strings out-of-context, translations will also appear in website, if they could also be translated in-context.</p> + +<h3 id="Ajudas_de_tradução">Ajudas de tradução</h3> +</div> + +<p>As you can see, suggestions from history, translation memory, machine translation and other locales are also available in the out-of-context translation panel. We call all of these translation helpers and here's how each of them will help you as you translate strings:</p> + +<p><img alt="Translation helpers: History" src="https://mdn.mozillademos.org/files/8339/helpers-history.png"> <img alt="Translation helpers: Machinery" src="https://mdn.mozillademos.org/files/8341/helpers-machinery.png"> <img alt="Translation helpers: Other locales" src="https://mdn.mozillademos.org/files/8343/helpers-locales.png"> <img alt="Translation helpers: Search" src="https://mdn.mozillademos.org/files/8345/helpers-menu.png"></p> + +<h4 id="Histórico">Histórico</h4> + +<p>Displays previously suggested translations, including from other users.</p> + +<h4 id="Máquina">Máquina</h4> + +<p>Displays matches from various services: internal translation memory, <a href="http://transvision.mozfr.org/">Mozilla Transvision</a>, <a href="https://amagama-live.translatehouse.org/">open source translation memory</a>, <a href="http://www.microsoft.com/Language/">Microsoft terminology</a> and <a href="http://www.bing.com/translator">machine translation</a>.</p> + +<h4 id="Outros_idiomas">Outros idiomas</h4> + +<p>Displays matching translations from other locales.</p> + +<h4 id="Pesquisar">Pesquisar</h4> + +<p>Almost like machinery, but takes provided keyword as input parameter instead of the original string.</p> + +<p>By clicking a suggestion, it gets copied into translation area.</p> + +<dl> +</dl> + +<h2 id="Publicar_a_sua_localização">Publicar a sua localização</h2> + +<p>Suppose you now want to publish your l10n work by committing it to a repo. Pontoon lets you do that too! Actually, it does that for you by automatically syncing with repositories on hourly basis. You can now pat yourself on the back, do a little dance, go to sleep or do something else to celebrate your work!</p> diff --git a/files/pt-pt/mozilla/mercurial/basicos/index.html b/files/pt-pt/mozilla/mercurial/basicos/index.html new file mode 100644 index 0000000000..a57f7a3778 --- /dev/null +++ b/files/pt-pt/mozilla/mercurial/basicos/index.html @@ -0,0 +1,61 @@ +--- +title: Básicos sobre Mercurial +slug: Mozilla/Mercurial/Basicos +tags: + - Desenvolvendo o Mozilla + - Mercurial +translation_of: Mozilla/Mercurial/Basics +--- +<p>I am about to tell you some stuff about <a href="/en/Mercurial" title="en/Mercurial">Mercurial</a> that will save you a lot of frustration. This page is cynical and survival-oriented. But I still claim Mercurial is a lot better than CVS. —<a href="/User:Jorend" title="User:Jorend">jorendorff</a> 16:06, 12 May 2008 (PDT)</p> + +<h3 id="Expectations" name="Expectations">Expetativas</h3> + +<p><strong>Mercurial não é CVS.</strong> Os comandos não são os mesmos. Os conceitos não são os mesmos. <a href="/en/Mozilla/Mercurial/How_Is_Mercurial_different_from_CVS" title="en/Mozilla/Mercurial/How_Is_Mercurial_different_from_CVS">Como é Mercurial diferente de CVS?</a></p> + +<p><strong>This gun is loaded.</strong> You can shoot yourself in the foot. You can lose work. The tool tries to protect you, but it can happen anyway. The two common failure modes are: (a) you run a command without knowing what it's going to do; (b) you <code>hg commit</code> or <code>hg qrefresh</code> with a mistaken understanding of the state of your working directory. So you accidentally commit changes that you didn't want to commit; or you accidentally commit a broken merge; etc. Often it's not immediately obvious that anything is wrong.</p> + +<p>Forewarned is forearmed. Don't do these things. Don't run commands without knowing what they're going to do—<code>hg help</code> is your friend. Don't commit without diffing and thinking. And don't let yourself get into "play mode" and stop paying attention to the fact that what you're playing with is your own uncommitted work.</p> + +<p><strong>Mercurial is not magic dust.</strong> Mercurial is flexible, powerful, and fun. It lets you attempt stuff you never would have tried in CVS. But of course not everything turns out to have been a good idea. (For example, we tried sharing patch queues. It sort of sucked.)</p> + +<h3 id="Avoiding_trouble" name="Avoiding_trouble">Evite problemas</h3> + +<p><strong>Utilize o último lançamento estável do Mercurial.</strong></p> + +<p><strong>Learn how to get your bearings.</strong> Use read-only commands (like <code>hg status</code>, <code>hg head</code>, <code>hg parents</code>, <code>hg log</code>, <code>hg diff</code>, <code>hg outgoing</code>) to check the status of your repository. This is a key skill.</p> + +<p><strong>Configure a <a class="external" href="http://mercurial.selenic.com/wiki/MergeToolConfiguration">merge program</a> and make sure you know how to use it. DO IT NOW.</strong> Otherwise you will likely screw up your repository at some point.</p> + +<p>Mercurial doesn't leaves conflict markers in your files; instead, it wants you to fix the conflicts <em>immediately</em>, using a merge program (like <code>kdiff3</code>) which it can launch for you.</p> + +<p>This can be error-prone. By default, Mercurial uses the first merge program it finds on your system, and merge programs can have a learning curve. Mercurial does not do a good job of detecting busted merges and refusing to proceed, so just by closing a window you can unwittingly put yourself in a bad state. Bad merges may lead to seemingly inexplicable Mercurial behavior in the future.</p> + +<p><strong>If a merge fails, make sure Mercurial knows that it has failed.</strong> When you're first learning the ropes, merges often go wrong. You might see this message:</p> + +<pre class="eval">0 files updated, 0 files merged, 0 files removed, 1 files unresolved +There are unresolved merges, you can redo the full merge using: + hg update -C 2 + hg merge 1 +</pre> + +<p>This means some conflicts weren't resolved during the merge. If you don't know exactly what they are and how to fix them, use that <code>hg update -C</code> command to tell Mercurial that you've given up on that merge.</p> + +<p>If you don't, Mercurial won't know, and the next time you commit, it'll make a merge changeset. This is bad. The result can look a lot like accidentally destroying a bunch of work, actually, but the damage can be undone.</p> + +<p>If <code>hg parents</code> shows two parents, you're merging.</p> + +<p><strong>If you use <a href="/en/Mercurial_Queues" title="Mercurial_Queues">Mercurial Queues</a>, back up your work.</strong> <code>hg qrefresh</code> destructively replaces the old patch with the new one! Use <code>hg qinit -c</code> to create a separate backup repository for your patches and <code>hg commit --mq -m backup</code> regularly.</p> + +<p><strong>Don't use Mercurial Queues in a repository that someone might pull from since applied (non-public) patches would also be pulled.</strong></p> + +<h3 id="Recovering" name="Recovering">Recuperação</h3> + +<p>Ups! Mercurial cortou o seu braço!</p> + +<p><strong>Don't randomly try stuff to see if it'll magically fix it.</strong> Remember what you stand to lose, and <em>set down the chainsaw</em> while you still have one good arm.</p> + +<p><strong>Obtenha ajuda no IRC.</strong> Tente <a class="link-irc" href="irc://irc.mozilla.org/hg">#hg</a> ou <a class="link-irc" href="irc://irc.mozilla.org/developers">#developers</a> no Mozilla IRC ou <a class="link-irc" href="irc://irc.freenode.net/mercurial">#mercurial no freenode</a>.</p> + +<p> </p> + +<p>{{ languages( { "es": "es/Lo_b\u00e1sico_de_Mercurial", "fr": "fr/Les_bases_de_Mercurial", "ja": "ja/Mercurial_basics" } ) }}</p> diff --git a/files/pt-pt/mozilla/mercurial/index.html b/files/pt-pt/mozilla/mercurial/index.html new file mode 100644 index 0000000000..4f54ee5312 --- /dev/null +++ b/files/pt-pt/mozilla/mercurial/index.html @@ -0,0 +1,41 @@ +--- +title: Mercurial +slug: Mozilla/Mercurial +tags: + - Desenvolvendo a Mozilla + - Mercurial +translation_of: Mozilla/Mercurial +--- +<div class="note"> +<p><a href="https://mozilla-version-control-tools.readthedocs.org/en/latest/hgmozilla/index.html">Por favor, consulte Mercurial para Mozillians em ReadTheDocs</a> para as melhores práticas atuais à volta do Mercurial, including many helpful extra tools and guidelines that make using Mercurial fast and easy.</p> +</div> + +<p><a class="external" href="https://www.mercurial-scm.org/"><strong>Mercurial</strong></a> (também conhecido como "hg"), é um <a class="external" href="https://en.wikipedia.org/wiki/Distributed_revision_control">controlo de versões distribuido </a>de software, utilizado para o desenvolvimento do Firefox, Thunderbird, e o núcleo de Gecko partilhado. Este substituiu <a href="/en-US/docs/Developer_Guide/Source_Code/CVS" title="en-US/docs/Developer_Guide/Source_Code/CVS">CVS</a> depois da ramificação 1.9 da Mozilla.</p> + +<p><strong><code>hg</code></strong> is the Mercurial command-line tool, Hg being the chemical symbol for the element mercury.</p> + +<h2 id="Learning_to_use_Mercurial" name="Learning_to_use_Mercurial">Instalação, configuração e obtenção da fonte</h2> + +<p>See <a href="/en-US/docs/Installing_Mercurial" title="/en-US/docs/Installing_Mercurial">Installing Mercurial</a> for installation and configuration tips.</p> + +<p>See <a href="/en-US/docs/Developer_Guide/Source_Code/Mercurial" title="en-US/docs/Developer_Guide/Source_Code/Mercurial">Getting Mozilla Source Code Using Mercurial</a> for getting a tree to build.</p> + +<h2 id="Learning_to_use_Mercurial" name="Learning_to_use_Mercurial">Aprender a utilizar o Mercurial</h2> + +<p>If you are new to Mercurial, you should start with the <a href="https://www.mercurial-scm.org/guide">official guide</a>.</p> + +<p>Then, move on to <a href="/en-US/docs/Mercurial_basics" title="en-US/docs/Mercurial_basics">Mercurial basics</a> and <a href="/en-US/docs/Mercurial_FAQ" title="en-US/docs/Mercurial_FAQ">Mercurial FAQ</a> and the <a href="https://mozilla-version-control-tools.readthedocs.org/en/latest/hgmozilla/">version control tool docs</a> for Mozilla-centric Mercurial information.</p> + +<h2 id="Further_reading" name="Further_reading">Leitura adicional</h2> + +<p>The <a href="https://developer.mozilla.org/en-US/docs/tag/Mercurial" title="https://developer.mozilla.org/en-US/docs/tag/Mercurial">Mercurial tag</a> lists the Mercurial-related articles on MDN.</p> + +<p>And on wiki.mozilla.org, these helpful pages:</p> + +<ul> + <li>{{ interwiki('wikimo', 'Using_Mercurial_locally_with_CVS', 'Using Mercurial locally with CVS') }}, a how-to. (Note that this is only useful for code that's still exclusively in CVS.)</li> + <li>{{ interwiki('wikimo', 'Mercurial_on_Windows', 'Mercurial on Windows') }}</li> + <li><a href="/en-US/docs/Creating_Mercurial_User_Repositories" title="en-US/docs/Creating_Mercurial_User_Repositories">Creating Mercurial User Repositories</a> - If you have a LDAP account that allows you to push to hg.mozilla.org you can also create your own user repositories on the server to share work.</li> +</ul> + +<p>{{ languages( { "es": "es/Mercurial", "fr": "fr/Mercurial", "ja": "ja/Mercurial" } ) }}</p> diff --git a/files/pt-pt/mozilla/mercurial/instaacao_mercurial/index.html b/files/pt-pt/mozilla/mercurial/instaacao_mercurial/index.html new file mode 100644 index 0000000000..b5bf466bca --- /dev/null +++ b/files/pt-pt/mozilla/mercurial/instaacao_mercurial/index.html @@ -0,0 +1,151 @@ +--- +title: Instalação de Mercurial +slug: Mozilla/Mercurial/Instaacao_Mercurial +tags: + - Desenvolvendo a Mozilla + - Mercurial + - Precisa de Atualização +translation_of: Mozilla/Mercurial/Installing_Mercurial +--- +<p>{{Note('Se ainda não leu os <a href="/pt-PT/docs/Mozilla/Mercurial/Basicos">básicos sobre Mercurial</a>, faça-o agora ou consulte <a href="/pt-PT/docs/Mozilla/Mercurial">Mercurial</a> para outros recursos.')}}</p> + +<div class="note"> +<p>Please refer to <a href="https://mozilla-version-control-tools.readthedocs.org/en/latest/hgmozilla/index.html"> Mercurial para Mozillians em ReadTheDocs</a> for current best-practices around Mercurial, including many helpful extra tools and guidelines that make using Mercurial fast and easy.</p> +</div> + +<h2 id="Installing" name="Installing">Instalação</h2> + +<p>See <a href="http://mozilla-version-control-tools.readthedocs.org/en/latest/hgmozilla/installing.html">Installing Mercurial</a> from the Mozilla Version Control Guide.</p> + +<h2 id="Configuração_básica">Configuração básica</h2> + +<p>You should configure Mercurial before submitting patches to Mozilla.</p> + +<p>If you will be pulling the Firefox source code or one of the derived repositories, the easiest way to configure Mercurial is to run the <em>mercurial-setup</em> mach command:</p> + +<pre>./mach mercurial-setup</pre> + +<p>This command starts an interactive wizard that will help ensure your Mercurial is configured with the latest recommended settings. This command will not change any files on your machine without your consent.</p> + +<p>If you don't have the Firefox source code available, you should edit your Mercurial configuration file to look like the following:</p> + +<pre class="eval">[ui] +username = Your Real Name <<a class="link-mailto" href="mailto:user@example.com" rel="freelink">user@example.com</a>> +merge = <em>your-merge-program</em> (or internal:merge) + +[diff] +git = 1 +showfunc = 1 +unified = 8 + +[defaults] +commit = -v +</pre> + +<p>On Windows, these settings can be added to <code>$HOME\.hgrc</code> or <code>$HOME\Mercurial.ini</code>, or, if you'd like global settings, <code>C:\mozilla-build\hg\Mercurial.ini</code> or <code>C:\Program Files\Mercurial\Mercurial.ini</code>. On UNIX-like systems, they should be in your <code>$HOME/.hgrc</code> file.</p> + +<p>You can configure the editor to use for commit messages using the <code>editor</code> option in the <code>[ui]</code> section or by setting the <code>EDITOR</code> environment variable.</p> + +<p>If you are trying to access the repository through a proxy server, see <a class="external" href="http://www.selenic.com/mercurial/hgrc.5.html#http-proxy" title="http://www.selenic.com/mercurial/hgrc.5.html#http-proxy">these instructions</a>.</p> + +<h2 id="Outras_dicas_de_configuração">Outras dicas de configuração</h2> + +<h3 id="Merge_program" name="Merge_program">Unir programa</h3> + +<p>After installing, <strong>choose a <a class="external" href="http://mercurial.selenic.com/wiki/MergeToolConfiguration">merge program</a></strong>. Seriously. Do it now. If you don't, Mercurial will choose one for you and spring it on you when you least expect it.</p> + +<p>A reasonable thing to do is to set <code>ui.merge=internal:merge</code> in the Mercurial configuration file (see below), which makes Mercurial try to merge changes and add the conflict markers (a la CVS) to the files that couldn't be merged.</p> + +<p>Under Ubuntu, you can install meld package, then in in the Mercurial configuration file (see below) set <code>ui.merge=meld</code></p> + +<p>You can see the list of merge conflicts by looking for "merging ... failed!" in the update output.</p> + +<h4 id="Configuring_kdiff3_as_a_merge_tool">Configuring kdiff3 as a merge tool</h4> + +<p>If you're on Linux and you have kdiff3 installed, you probably want to configure kdiff3 as a merge tool. (It's better than meld because it will actually resolve a bunch of the conflicts without prompting you, generally quite accurately.) You can do this by adding the following lines (which come from <code>contrib/mergetools.hgrc</code> in the Mercurial distribution):</p> + +<pre>[merge-tools] +kdiff3.args=--auto -L1 base --L2 local --L3 other $base $local $other -o $output +kdiff3.regkey=Software\KDiff3 +kdiff3.regappend=\kdiff3.exe +kdiff3.fixeol=True +kdiff3.gui=True + +</pre> + +<h3 id="Extensões">Extensões</h3> + +<p>There's a number of extensions you can enable. See <a href="http://mercurial.selenic.com/wiki/UsingExtensions" title="http://mercurial.selenic.com/wiki/UsingExtensions">http://mercurial.selenic.com/wiki/UsingExtensions</a>. Almost everyone should probably enable the following:</p> + +<ul> + <li>color - Colorize terminal output</li> + <li>histedit - Provides <em>git rebase --interactive</em> behavior.</li> + <li>pager - Feed command output into a pager (like <em>less</em>)</li> + <li>progress - Draw progress bars on long-running operations.</li> + <li>rebase - Ability to easily rebase patches on top of other heads.</li> + <li>transplant - Easily move patches between repositories, branches, etc.</li> +</ul> + +<p>These can all be turned on by just adding this to your .hgrc file:</p> + +<pre>[extensions] +color = +rebase = +histedit = +progress = +transplant = +pager = +</pre> + +<p>In addition, there are some 3rd party extensions that are incredibly useful for basic development:</p> + +<dl> + <dt><a href="https://hg.mozilla.org/hgcustom/version-control-tools/file/default/hgext/mozext" title="https://hg.mozilla.org/users/gszorc_mozilla.com/hgext-gecko-dev">mozext</a></dt> + <dd>Mozilla-specific functionality to aid in developing Firefox/Gecko.</dd> + <dt><a href="https://github.com/pbiggar/trychooser">trychooser</a></dt> + <dd>Automatically creates a try commit message and then pushes changes to Mozilla's Try infrastructure. Just run: + <pre>hg trychooser</pre> + </dd> + <dt><a href="https://hg.mozilla.org/users/robarnold_cmu.edu/qimportbz">qimportbz</a></dt> + <dd>Import patches from Bugzilla. Creates a filename and commit message for you based on the bug's metadata. + <pre>hg qimport bz://1234567 + </pre> + </dd> + <dt><a href="https://hg.mozilla.org/users/tmielczarek_mozilla.com/bzexport">bzexport</a></dt> + <dd>Export patches to Bugzilla. There are quite a few optional arguments here to create new or update existing bugs with the attment, as well as auto matically request reviews. Type hg help bzexport for a full list but the basic syntax is: + <pre>hg bzexport -i 1234567</pre> + </dd> +</dl> + +<p>Installing these is fairly easy. You'll just need to find a place on your system to store the extensions, and clone the extension repos into it:</p> + +<pre>hg clone https://bitbucket.org/edgimar/crecord +hg clone https://bitbucket.org/sfink/mqext +hg clone https://hg.mozilla.org/users/robarnold_cmu.edu/qimportbz +git clone https://github.com/pbiggar/trychooser +</pre> + +<p>And then add then to your .hgrc file</p> + +<pre>[extensions] +qcrecord = /path/to/crecord/crecord +mqext = path/to/mqext +qimportbz = path/to/qimportbz +trychooser = path/to/trychooser/trychooser +</pre> + +<h3 id="Configuração_do_repositório_de_testes">Configuração do repositório de testes</h3> + +<p>If you have access to the <a class="link-https" href="https://wiki.mozilla.org/Build:TryServer" title="https://wiki.mozilla.org/Build:TryServer">try server</a> you may want to configure Mercurial so you can refer to it simply as "try", since it can be useful from all your trees. This can be done by adding this to your ~/.hgrc (or Mercurial.ini):</p> + +<p> </p> + +<pre>[paths] +try = ssh://hg.mozilla.org/try/ +</pre> + +<p>You can also configure short names like this that are specific to a particular repository by adding a [paths] section to the .hg/hgrc file within a repository. There are two magic names, "default" and "default-push", which are used as the default push/pull targets. (If "default" is specified and "default-push" is not, "default" is used for both.)</p> + +<p>Alternativamente, pode instalar a <a class="link-https" href="https://bitbucket.org/sfink/trychooser" title="https://bitbucket.org/sfink/trychooser">extensão trychooser</a> (<a class="link-https" href="https://github.com/pbiggar/trychooser" title="https://github.com/pbiggar/trychooser">versão antiga</a>).</p> + +<p>{{ languages( { "fr": "fr/Installation_de_Mercurial" } ) }}</p> diff --git a/files/pt-pt/mozilla/o0coes_linha_comandos/index.html b/files/pt-pt/mozilla/o0coes_linha_comandos/index.html new file mode 100644 index 0000000000..57a1511c23 --- /dev/null +++ b/files/pt-pt/mozilla/o0coes_linha_comandos/index.html @@ -0,0 +1,486 @@ +--- +title: Opções da Linha de Comandos +slug: Mozilla/O0coes_Linha_Comandos +tags: + - Administração + - Desenvolvimento da Mozilla + - Documentação do Utilizador + - Extensões + - Extras + - Firefox + - Linha de Comandos + - Mozilla + - Perguntas e Respostas + - Precisa de Atualização +translation_of: Mozilla/Command_Line_Options +--- +<p>{{FirefoxSidebar}}</p> + +<p><span class="seoSummary">As opções da linha de comandos são utilizadas para especificar várias opções de arranque para as aplicações da Mozilla. Por exemplo, pode utilizar as opções de configuração da linha de comandos para ignorar o 'Gestor de Perfis' e abrir um perfil específico (se tiver vários perfis). Também pode controlar como as aplicações da Mozilla são abertas, quais os componentes que são abertos inicialmente, e o que os componentes fazem quando são abertos. Esta página descreve as opções mais utilizadas e como utilizá-las. Pode abrir a interface da linha de comandos pressionando "Shift + F2".</span></p> + +<h2 id="Syntax_Rules" name="Syntax_Rules">Regras de Sintaxe</h2> + +<p>But first, let's describe the syntax rules that apply for all options.</p> + +<ul> + <li>Command parameters containing spaces must be enclosed in quotes; for example, "Joel User".</li> + <li>Command actions are not case sensitive.</li> + <li>Command parameters except profile names are not case sensitive.</li> + <li>Blank spaces ( ) separate commands and parameters.</li> + <li>Each message option follows the syntax <code><var>field</var>=<var>value</var></code>, for example: + <ul> + <li><code>to=</code><span class="nowiki"><code>foo@nowhere.net</code></span></li> + <li><code>subject=cool page</code></li> + <li><code>attachment=www.mozilla.org</code></li> + <li><code>attachment='<span class="nowiki">file:///c:/test.txt</span>'</code></li> + <li><code>body=check this page or also in Thunderbird 52 and newer: body=c:\path\to\file.txt</code></li> + </ul> + </li> + <li>Multiple message options are separated by comma (,), for example: <code>"<span class="nowiki">to=foo@nowhere.net,subject=cool page</span>"</code> . Comma separators must not follow or precede spaces ( ). To assign multiple values to a field, enclose the values in single quotes ('), for example: <code>"<span class="nowiki">to='foo@nowhere.net,foo@foo.de',subject=cool page</span>"</code> .</li> +</ul> + +<h2 id="How_to_use_command_options" name="How_to_use_command_options">Utilizar as opções da linha de comandos</h2> + +<p>Command line options are entered after the command to start the application. Some options have arguments. These are entered after the command line option. Some options have abbreviations. For example, the command line option "-editor" can be abbreviated as "-edit". (Where abbreviations are available, they are described in the text below.) In some cases option arguments must be enclosed in quotation marks. (This is noted in the option descriptions below.) Multiple command line options can be specified. In general, the syntax is as follows:</p> + +<pre class="brush: bash;">application -option -option "argument" -option argument +</pre> + +<h3 id="Exemplos">Exemplos</h3> + +<p>The following examples show the use of the "-ProfileManager" command, which will open the Profile Manager prior to starting Firefox or Thunderbird:</p> + +<h4 id="Windows">Windows</h4> + +<p>Select Run from Windows Start menu. Type:</p> + +<pre class="brush: bash;">firefox -ProfileManager +</pre> + +<h4 id="Mac_OS_X">Mac OS X</h4> + +<p>Go to Applications > Utilities. Open Terminal and type:</p> + +<pre class="brush: bash;">cd /Applications/Firefox.app/Contents/MacOS +./firefox -ProfileManager +</pre> + +<p>If you use Firefox Nightly, you can type:</p> + +<pre class="brush: bash;">cd /Applications/FirefoxNightly.app/Contents/MacOS +./firefox -ProfileManager +</pre> + +<h4 id="Linux">Linux</h4> + +<p>Open Terminal and type:</p> + +<pre class="brush: bash;">cd <em>Thunderbird</em><var> installation directory</var> +./thunderbird -ProfileManager +</pre> + +<p>The example above invokes the "-ProfileManager" command line option with Mozilla's Thunderbird mail client.</p> + +<h2 id="User_Profile" name="User_Profile">Perfil do Utilizador</h2> + +<h3 id="-CreateProfile_profile_name" name="-CreateProfile_profile_name"><code>-CreateProfile <var>profile_name</var></code></h3> + +<p>Create a new profile in the default directory, but do not start application. The profile will be named <code><var>profile_name</var></code> in the profile manager. <var>profile_name</var> must not contain spaces ( ). To use this successfully no instance of the application must be running, or the <code>-no-remote</code> options must be used.</p> + +<pre class="brush: bash;">firefox -CreateProfile JoelUser +</pre> + +<h3 id="-CreateProfile_.22profile_name_profile_dir.22" name="-CreateProfile_.22profile_name_profile_dir.22"><code>-CreateProfile "<var>profile_name</var> <var>profile_dir</var>"</code></h3> + +<p>Creates a new profile in the <code><var>profile_dir</var></code> directory, but do not start application. The profile will be named <code>profile_name</code> in the profile manager. Note <code><var>profile_name</var></code> and <code><var>profile_dir</var></code> are quoted together, and are separated by exactly 1 space (as with the previous syntax, <code>profile_name</code> must not contain spaces).</p> + +<p>To use this successfully no instance of the application must be running, or the <code>-no-remote</code> options must be used.</p> + +<p>NOTE: <code><var>profile_dir</var></code> must not exist and you must not already have a profile called <code><var>profile_name</var></code>.</p> + +<pre class="brush: bash;">firefox -CreateProfile "JoelUser c:\internet\joelusers-moz-profile" +</pre> + +<h3 id="-migration" name="-migration"><code>-migration</code></h3> + +<p>Start with Import Wizard.</p> + +<h3 id="-new-instance" name="-new-instance"><code>-new-instance</code></h3> + +<p>Open new instance, not a new window in running instance, which allows multiple copies of application to be open at a time.</p> + +<pre class="brush: bash;">firefox -new-instance -P "Another Profile" +</pre> + +<div class="blockIndicator note"> +<p><strong>Nota: </strong>Not available for Windows, see {{bug(855899)}}.</p> +</div> + +<h3 id="-no-remote" name="-no-remote"><code>-no-remote</code></h3> + +<p></p> + +<p>Do not accept or send remote commands; implies -new-instance.</p> + +<pre class="brush: bash;">firefox -no-remote -P "Another Profile" +</pre> + +<div class="blockIndicator note"> +<p><strong>Nota: </strong>Since Firefox 9, this does really mean what its name implies on all platforms, i.e. instances created with this parameter do not accept or send remote commands, see {{bug(650078)}}. That means that such instances won't be re-used. Also when using this argument a new instance is created in any case.</p> +</div> + +<h3 id="-override_.2Fpath.2Fto.2Foverride.ini" name="-override_.2Fpath.2Fto.2Foverride.ini"><code>-override <em>/path/to/</em>override.ini</code></h3> + +<p>Load the specified <code>override.ini</code> file to override <code>application.ini</code> ({{Source("browser/app/application.ini")}}). This can be used to suppress the Migration Wizard at startup by loading the following <code>override.ini</code>. <strong>Firefox</strong> only.</p> + +<pre class="brush: ini;">[XRE] +EnableProfileMigrator=0</pre> + +<h3 id="-ProfileManager_or_-P" name="-ProfileManager_or_-P"><code>-ProfileManager</code></h3> + +<p>Start with Profile Manager. Short form: <strong>-P</strong> without a profile name.</p> + +<h3 id="-P_.22profile_name.22" name="-P_.22profile_name.22"><code>-P "<var>profile_name</var>"</code></h3> + +<p>Bypass Profile Manager and launch application with the profile named <var>profile_name</var>. Useful for dealing with multiple profiles. Note <var>profile_name</var> is case sensitive. If you don't specify a profile name then the profile manager is opened instead. You must use an upper case P on Linux with versions older than 7.x, as there lower case invokes Purify mode (memory and leak detection). Other platforms accept both upper and lower case.</p> + +<pre class="brush: bash;">firefox -P "Joel User" +</pre> + +<h3 id="-profile_.22.2Fpath.2Fto.2Fprofile.22" name="-profile_.22.2Fpath.2Fto.2Fprofile.22"><code>-profile "<var>profile_path</var>"</code></h3> + +<p>Start with the profile with the given path. <strong>Firefox</strong>, <strong>Thunderbird</strong> and <strong>SeaMonkey2.x</strong> only.</p> + +<p><code>"profile_path"</code> can either be an absolute path (<code>"<var>/path/to/profile</var>"</code>) or a relative path <code>("<var>path/to/profile</var>"</code>).</p> + +<div class="blockIndicator note"> +<p><strong>Nota: </strong>On Mac OS X specifying a relative path is not supported anymore from Firefox 4.0 and up due to a regression, see {{bug(673955)}}.</p> +</div> + + +<h2 id="Browser" name="Browser">Navegador</h2> + +<h3 id="-browser" name="-browser"><code>-browser</code></h3> + +<p>Start with the browser component. <strong>Firefox</strong> and <strong>SeaMonkey</strong> only.</p> + +<h3 id="-foreground" name="-foreground"><code>-foreground</code></h3> + +<p>Make this instance the active application.</p> + +<h3 id="-headless"><code>-headless</code></h3> + +<p>Runs Firefox in <a href="/en-US/docs/Mozilla/Firefox/Headless_mode">headless mode</a>, which is very useful for purposes such as debugging and automated testing. Available in Firefox 55+ on Linux, and Firefox 56+ on Windows/Mac OS X.</p> + +<h3 id="-new-tab_URL" name="-new-tab_URL"><code>-new-tab <var>URL</var></code></h3> + +<p>Open <var>URL</var> in a new tab. <strong>Firefox</strong> and <strong>SeaMonkey2.x</strong> only.</p> + +<h3 id="-new-window_URL" name="-new-window_URL"><code>-new-window <var>URL</var></code></h3> + +<p>Open <var>URL</var> in a new window. <strong>Firefox</strong> and <strong>SeaMonkey2.x</strong> only.</p> + +<h3 id="-preferences" name="-preferences"><code>-preferences</code></h3> + +<p>Open Options/Preferences window. <strong>Firefox</strong> and <strong>SeaMonkey2.x</strong> only.</p> + +<h3 id="-private" name="-private"><code>-private</code></h3> + +<p>Opens Firefox in permanent private browsing mode. <strong>Firefox 3.6</strong> and later only.</p> + +<p>May not be applicable in older Ubuntu for <strong>Firefox 20 </strong>and later, confirmed to work in 14.04</p> + +<h3 id="-private-toggle" name="-private-toggle"><code>-private-window</code></h3> + +<p>Opens a new private browsing window in an existing instance of Firefox. <strong>Firefox 20</strong> and later only.</p> + +<h3 id="-private-toggle_URL" name="-private-toggle_URL"><code>-private-window URL</code></h3> + +<p>Open URL in a new private browsing window. If a private browsing window is already open, a new tab is opened in the existing window.<strong> Firefox 29 </strong>and later only. Does not work in <strong>Firefox 31</strong> on linux mint 17 nor on <strong>Firefox 48</strong> on Windows 7. URL opens in a non-private window.</p> + +<h3 id="-search_term" name="-search_term"><code>-search <var>term</var></code></h3> + +<p>Search <var>term</var> with your default search engine. <strong>Firefox</strong> and <strong>SeaMonkey 2.1</strong> and later only.</p> + +<h3 id="-setDefaultBrowser" name="-setDefaultBrowser"><code>-setDefaultBrowser</code></h3> + +<p>Set the application as the default browser. <strong>Firefox</strong> only.</p> + +<h3 id="-url_URL" name="-url_URL"><code>-url <var>URL</var></code></h3> + +<p>Open <var>URL</var> in a new tab or window, depend on the browser option. <code>-url</code> can be omitted. You may list multiple URLs, separated by spaces. <strong>Firefox</strong> and <strong>SeaMonkey</strong> only.</p> + +<div class="blockIndicator note"> +<p><strong>Note: </strong>When opening multiple URLs, Firefox always opens them as tabs in a new window.</p> +</div> + +<pre class="brush: bash;">firefox www.mozilla.com +firefox www.mozilla.com developer.mozilla.org</pre> + +<h2 id="Mail.2FNews" name="Mail.2FNews">Correio/Notícias</h2> + +<h3 id="-addressbook" name="-addressbook"><code>-addressbook</code></h3> + +<p>Start with address book. <strong>Thunderbird</strong> and <strong>SeaMonkey</strong> only.</p> + +<h3 id="-compose_message_options" name="-compose_message_options"><code>-compose <var>message_options</var></code></h3> + +<p>Start with mail composer. See <a href="#Syntax_Rules">syntax rules</a>. <strong>Thunderbird</strong> and <strong>SeaMonkey</strong> only.</p> + +<pre class="brush: bash;">thunderbird -compose "<span class="nowiki">to=foo@nowhere.net</span>"</pre> + +<h3 id="-mail" name="-mail"><code>-mail</code></h3> + +<p>Start with the mail client. <strong>Thunderbird</strong> and <strong>SeaMonkey</strong> only.</p> + +<h3 id="-news_news_URL" name="-news_news_URL"><code>-news</code> <var>news_URL</var></h3> + +<p>Start with the news client. If <var>news_URL</var> (optional) is given, open the specified newsgroup. <strong>Thunderbird</strong> and <strong>SeaMonkey</strong> only.</p> + +<pre class="brush: bash;">thunderbird -news <span class="nowiki">news://server/group</span> +</pre> + +<h3 id="-options" name="-options"><code>-options</code></h3> + +<p>Open Options/Preferences window. <strong>Thunderbird</strong> only.</p> + +<h3 id="-offline" name="-offline"><code>-offline</code></h3> + +<p>Start with the offline mode. <strong>Thunderbird</strong> and <strong>SeaMonkey</strong> only.</p> + +<h3 id="-setDefaultMail" name="-setDefaultMail"><code>-setDefaultMail</code></h3> + +<p>Set the application as the default email client. <strong>Thunderbird</strong> only.</p> + +<h2 id="Calendar" name="Calendar">Calendário</h2> + +<h3 id="-calendar" name="-calendar"><code>-calendar</code></h3> + +<p>Start with the calendar client. <strong>Sunbird</strong> only.</p> + +<h3 id="-showdate_date" name="-showdate_date"><code>-showdate <var>date</var></code></h3> + +<p>Show your schedule of the given <var>date</var>. <strong>Sunbird</strong> only.</p> + +<pre class="brush: bash;">sunbird -showdate 08/04/2008 +</pre> + +<h3 id="-subscribe_URL_or_-url_URL" name="-subscribe_URL_or_-url_URL"><code>-subscribe <var>URL</var></code> or <code>-url <var>URL</var></code></h3> + +<p>Subscribe to the given <var>URL</var>. <strong>Sunbird</strong> only.</p> + +<h2 id="Other_Components" name="Other_Components">Outros Componentes</h2> + +<h3 id="-chat"><code>-chat</code></h3> + +<p>Start with the IRC client, <a class="link-https" href="https://addons.mozilla.org/en-US/firefox/addon/16">ChatZilla</a>, if installed.</p> + +<h3 id="-devtools" name="-devtools"><code>-devtools</code></h3> + +<p>Start with native <a href="/en-US/docs/Tools">Developer Tools</a> opened.</p> + +<h3 id="-editor_URL_or_-edit_URL" name="-editor_URL_or_-edit_URL"><code>-editor <var>URL</var></code> or <code>-edit <var>URL</var></code></h3> + +<p>Start with editor (Composer) for the given <var>URL</var> (where <var>URL</var> is optional). <strong>SeaMonkey</strong> only.</p> + +<pre class="brush: bash;">seamonkey -edit www.mozilla.org +</pre> + +<h3 id="-inspector_URL" name="-inspector_URL"><code>-inspector <var>URL</var></code></h3> + +<p>Start with the <a href="/en-US/docs/DOM_Inspector" title="DOM_Inspector">DOM Inspector</a>, if installed, and inspect the given <var>URL</var> (where <var>URL</var> is optional).</p> + +<h3 id="-jsconsole" name="-jsconsole"><code>-jsdebugger</code></h3> + +<p>Start application with <a href="/en-US/docs/Tools/Browser_Toolbox">Browser Toolbox</a> (formerly Browser Debugger). That is different to Venkman debugger (see option -venkman).</p> + +<h3 id="-jsconsole" name="-jsconsole"><code>-jsconsole</code></h3> + +<p>Start application with the <a href="/en-US/docs/Error_Console" title="Error_Console">Error Console</a>, or, in Firefox, the <a href="/en-US/docs/Tools/Browser_Console">Browser Console</a>.</p> + +<h3 id="-purgecaches"><code>-purgecaches</code></h3> + +<p>Gecko (layout engine) has a javascript cache, which is not reset on startup. This clears it.</p> + +<h3 id="-start-debugger-server_port"><code>-start-debugger-server port</code></h3> + +<p>Firefox only. Start the debugger server on <code>port</code>. This will enable another instance of Firefox to connect the Firefox Developer Tools to this Firefox instance. See the article on <a href="/en-US/docs/Tools/Remote_Debugging/Debugging_Firefox_Desktop">remotely debugging Firefox Desktop</a>.</p> + +<p>The <code>port</code> argument is optional, and if it is omitted, the server will listen on port 6000.</p> + +<h3 id="-venkman" name="-venkman"><code>-venkman</code></h3> + +<p>Start with the JavaScript debugger, <a href="/en-US/docs/Venkman" title="Venkman">Venkman</a>, if installed.</p> + +<h2 id="XULRunner" name="XULRunner">XULRunner</h2> + +<h3 id="-app_.2Fpath.2Fto.2Fapplication.ini" name="-app_.2Fpath.2Fto.2Fapplication.ini"><code>-app <em>/path/to/</em>application.ini</code></h3> + +<p>Start a new process running the <a href="/en-US/docs/XULRunner" title="XULRunner">XULRunner</a> application at <em>path/to</em>. Also works with Firefox version 3 and above.</p> + +<h3 id="--install-app_pathtomyapplication.(xpixulapp)"><code>--install-app path/to/myapplication.(xpi|xulapp)</code></h3> + +<p>Installs the XULRunner application at path/to onto the system. Applications are installed into the default location for your system (program files|Applications|usr/lib) at vendorname/applicationName. Applications may be uninstalled per usual methods for your system.</p> + +<pre class="brush: bash;">"C:\Program Files\Mozilla XULRunner\1.8.0.4\xulrunner\xulrunner.exe" --install-app "C:\Users\Billdo\Desktop\myapplication.xpi"</pre> + +<pre class="brush: bash;">/opt/xulrunner/1.8.0.4/xulrunner/xulrunner --install-app ~/Desktop/myapplication.xulapp</pre> + +<pre class="brush: bash;">/Library/Frameworks/XUL.framework/xulrunner-bin --install-app ~/Desktop/myapplication.xpi</pre> + +<h3 id="--register-global"><code>--register-global</code></h3> + +<p>Registers XULRunner on the system for all users. Must be run as admin / root.</p> + +<h3 id="--register-user"><code>--register-user</code></h3> + +<p>Registers XULRunner for a single user.</p> + +<h3 id="--unregister-global"><code>--unregister-global</code></h3> + +<p>Unregisters XULRunner for all users.</p> + +<h3 id="--unregister-user"><code>--unregister-user</code></h3> + +<p>Unregisters XULRunner for a single user.</p> + +<h2 id="Chrome" name="Chrome">Chrome</h2> + +<h3 id="-chrome_chrome_URL" name="-chrome_chrome_URL"><code>-chrome <var>chrome_URL</var></code></h3> + +<p>Load the specified chrome.</p> + +<pre class="brush: bash;">firefox -chrome chrome://inspector/content +</pre> + +<h3 id="-register_chrome_URL" name="-register_chrome_URL"><code>-register <var>chrome_URL</var></code></h3> + +<p>Register the specified chrome, but do not start application.</p> + +<h2 id="Add-ons" name="Add-ons">Extras</h2> + +<p>{{Gecko_MinVersion_Note(1.9.2, "-install-global-extension and -install-global-theme have been removed from Gecko 1.9.2 and upwards.")}}</p> + +<h3 id="-install-global-extension_.2Fpath.2Fto.2Fextension" name="-install-global-extension_.2Fpath.2Fto.2Fextension"><code>-install-global-extension <var>/path/to/extension</var></code></h3> + +<p>Installs the extension into the application directory. The parameter is the path to the extension. You must have administrative privileges.</p> + +<h3 id="-install-global-theme_.2Fpath.2Fto.2Ftheme" name="-install-global-theme_.2Fpath.2Fto.2Ftheme"><code>-install-global-theme <var>/path/to/theme</var></code></h3> + +<p>Same as above, but for themes. You must have administrative privileges.</p> + +<div class="blockIndicator note"> +<p><strong>Note: </strong>Since Firefox 2.0.0.7, use of the <code>-install-global-extension</code> and <code>-install-global-theme</code> command line arguments have been restricted to only allow installing add-ons that are on local disks or mapped drives. Installing from a network share directly will no longer succeed.</p> +</div> + +<h3 id="-safe-mode" name="-safe-mode"><code>-safe-mode</code></h3> + +<p>Launches the application with all extensions disabled, for that launch only. (Extensions are not loaded, but are not permanently disabled in the Extension Manager data source).</p> + +<h2 id="Remote_Control" name="Remote_Control">Controlo remoto</h2> + +<h3 id="-remote_remote_command" name="-remote_remote_command"><code>-remote <var>remote_command</var></code><var> {{Obsolete_Inline}}</var></h3> + +<div class="blockIndicator note"> +<p><var>This feature was removed in Firefox 36.0, restored in 36.0.1 and removed again in 39.0. S</var>ee {{bug(1080319)}}.</p> +</div> + +<p>Execute the specified <code><var>remote_command</var></code> in an already running application process.</p> + +<pre class="brush: bash;">firefox -remote "openURL(www.mozilla.org, new-tab)" +</pre> + +<div class="blockIndicator note"> +<p>This option is only available on X-Windows Unix platforms.</p> +</div> + +<h2 id="Miscellaneous" name="Miscellaneous">Diversos</h2> + +<h3 id="-attach-console"><code>-attach-console</code></h3> + +<p>Write messages for the debugging console into the window which launched the application instead of opening a new window for the debugging messages. Only supported on the Windows operating system.</p> + +<h3 id="-console" name="-console"><code>-console</code></h3> + +<p>Start application with a debugging console. Note: Windows only.</p> + +<h3 id="-h_or_-help_or_-.3F" name="-h_or_-help_or_-.3F"><code>-h</code> or <code>-help</code> or <code>-?</code></h3> + +<p>Print the list of all available command line options. Note that on Windows this only works with a redirection such as <code><span class="nowiki">|more</span></code> ({{Bug(355889)}}). This option is available only in a command console.</p> + +<h3 id="-osint" name="-osint"><code>-osint</code></h3> + +<p>Tells the application that it is being launched by the OS shell. This should not be specified unless the caller provides all of the functionality provided by the OS shell when launching the application ({{Bug(384384)}}).</p> + +<h3 id="-requestPending" name="-requestPending"><code>-requestPending</code></h3> + +<p>Tells the application that there will be a Windows DDE request to open the same url specified on the command line. This should not be specified unless the caller provides all of the functionality provided by the OS shell when launching the application ({{Bug(354005)}}).</p> + +<h3 id="-silent" name="-silent"><code>-silent</code></h3> + +<p>Don't open default windows. Useful with those command-line arguments that open their own windows but don't already prevent default windows from opening. <strong>Firefox</strong>, <strong>Thunderbird3.x</strong> and <strong>SeaMonkey2.x</strong> only.</p> + +<h3 id="-tray" name="-tray"><code><strong>-tray</strong></code></h3> + +<p>Start application minimized to system tray. Useful with autorun.</p> + +<h3 id="-v_or_-version" name="-v_or_-version"><code>-v</code> or <code>-version</code></h3> + +<p>Print application version. Note that on Windows this only works with a redirection such as <code><span class="nowiki">|more</span></code> ({{Bug(355889)}}). This option is available only in a command console.</p> + +<h3 id="X11_options">X11 options</h3> + +<p>These options are only available for an application build for and running atop the X11/X.org display and window system to be found on Linux and other Unix-based systems.</p> + +<h4 id="--classWM_CLASS"><code>--class=WM_CLASS</code></h4> + +<p>Set the WM_CLASS resource class of the X11 windows created by the application.</p> + +<h4 id="--displayDISPLAY"><code>--display=DISPLAY</code></h4> + +<p>Set the X display to use.</p> + +<h4 id="--g-fatal-warnings"><code>--g-fatal-warnings</code></h4> + +<p>Make all warnings fatal.</p> + +<h4 id="--sync"><code>--sync</code></h4> + +<p>Make X calls synchronous.</p> + +<h2 id="Other_options_need_to_be_documented" name="Other_options_need_to_be_documented">Outras opções que precisam de ser documentadas</h2> + +<ul> + <li><code>-print-xpcom-dir</code></li> + <li><code>-print-xpcom-dirlist</code></li> + <li><code>-kill</code></li> + <li><code>-killAll</code></li> + <li><code>-f</code></li> + <li><code>-ftimeout</code></li> + <li><code>-fwait</code></li> + <li><code>-unsetDefaultMail</code></li> + <li>GTK options</li> +</ul> + +<h2 id="References" name="References">Referências</h2> + +<ul> + <li><a href="/en-US/docs/Chrome/Command_Line" title="Chrome/Command_Line">Chrome: Command Line</a></li> + <li><a class="external" href="http://www-archive.mozilla.org/quality/browser/front-end/testcases/cmd-line/">Test Documentation for Command-line Features</a> (mozilla.org)</li> + <li>{{Source("toolkit/xre/nsAppRunner.cpp")}}</li> + <li>{{Source("browser/components/nsBrowserContentHandler.js")}}</li> + <li>{{Source("suite/browser/nsBrowserContentHandler.js")}}</li> + <li>{{Source("mail/components/nsMailDefaultHandler.js")}}</li> + <li><a class="link-https" href="https://wiki.mozilla.org/Installer:Command_Line_Arguments">Installer command line options</a></li> +</ul> + +<div class="originaldocinfo"> +<h2 id="Original_Document_Information" name="Original_Document_Information">Informação do Documento Original</h2> + +<ul> + <li>Author(s): Ben Goodger, Steffen Wilberg, Seth Spitzer, Daniel Wang</li> + <li>Copyright Information: Portions of this content are © 1998–2007 by individual mozilla.org contributors; content available under a Creative Commons license | <a class="external" href="http://www.mozilla.org/foundation/licensing/website-content.html">Details</a>.</li> +</ul> +</div> + +<p> </p> diff --git a/files/pt-pt/mozilla/performance/about_colon_memory/index.html b/files/pt-pt/mozilla/performance/about_colon_memory/index.html new file mode 100644 index 0000000000..02878e1d31 --- /dev/null +++ b/files/pt-pt/mozilla/performance/about_colon_memory/index.html @@ -0,0 +1,187 @@ +--- +title: 'about:memory' +slug: 'Mozilla/Performance/about:memory' +tags: + - Desempenho + - Relatório + - diagnóstico + - memoria +translation_of: 'Mozilla/Performance/about:memory' +--- +<p>about:memory is a special page within Firefox that lets you view, save, load, and diff detailed measurements of Firefox's memory usage. It also lets you do other memory-related operations like trigger GC and CC, dump GC & CC logs, and dump DMD reports. It is present in all builds and does not require any preparation to be used.</p> + +<h2 id="Como_gerar_relatórios_de_memória">Como gerar relatórios de memória</h2> + +<p>Let's assume that you want to measure Firefox's memory usage. Perhaps you want to investigate it yourself, or perhaps someone has asked you to use about:memory to generate "memory reports" so they can investigate a problem you are having. Follow these steps.</p> + +<ul> + <li>At the moment of interest (e.g. once Firefox's memory usage has gotten high) open a new tab and type "about:memory" into the address bar and hit "Enter".</li> + <li>If you are using a communication channel where files can be sent, such as Bugzilla or email, click on the "Measure and save..." button. This will open a file dialog that lets you save the memory reports to a file of your choosing. (The filename will have a <code>.json.gz</code> suffix.) You can then attach or upload the file appropriately. The recipients will be able to view the contents of this file within about:memory in their own Firefox instance.</li> + <li>If you are using a communication channel where only text can be sent, such as a comment thread on a website, click on the "Measure..." button. This will cause a tree-like structure to be generated text within about:memory. This structure is just text, so you can copy and paste some or all of this text into any kind of text buffer. (You don't need to take a screenshot.) This text contains fewer measurements than a memory reports file, but is often good enough to diagnose problems. Don't click "Measure..." repeatedly, because that will cause the memory usage of about:memory itself to rise, due to it discarding and regenerating large numbers of DOM nodes.</li> +</ul> + +<p>Note that in both cases the generated data contains privacy-sensitive details such as the full list of the web pages you have open in other tabs. If you do not wish to share this information, you can select the "anonymize" checkbox before clicking on "Measure and save..." or "Measure...". This will cause the privacy-sensitive data to be stripped out, but it may also make it harder for others to investigate the memory usage.</p> + +<h2 id="Carregar_relatórios_de_memória_de_um_ficheiro">Carregar relatórios de memória de um ficheiro</h2> + +<p>The easiest way to load memory reports from file is to use the "Load..." button. You can also use the "Load and diff..." button to get the difference between two memory report files.</p> + +<p>Single memory report files can also be loaded automatically when about:memory is loaded by appending a <code>file</code> query string, for example:</p> + +<pre>about:memory?file=/home/username/reports.json.gz +</pre> + +<p>This is most useful when loading memory reports files obtained from a Firefox OS device.</p> + +<p>Memory reports are saved to file as gzipped JSON. These files can be loaded as is, but they can also be loaded after unzipping.</p> + +<h2 id="Interpretar_os_relatórios_de_memória">Interpretar os relatórios de memória</h2> + +<p>Almost everything you see in about:memory has an explanatory tool-tip. Hover over any button to see a description of what it does. Hover over any measurement to see a description of what it means.</p> + +<h3 id="Básico_de_cálculo"><span class="mw-headline" id="Basics">Básico de cálculo</span></h3> + +<p>Most measurements use bytes as their unit, but some are counts or percentages.</p> + +<p>Most measurements are presented within trees. For example:</p> + +<pre> 585 (100.0%) -- preference-service + └──585 (100.0%) -- referent + ├──493 (84.27%) ── strong + └───92 (15.73%) -- weak + ├──92 (15.73%) ── alive + └───0 (00.00%) ── dead +</pre> + +<p>Leaf nodes represent actual measurements; the value of each internal node is the sum of all its children.</p> + +<p>The use of trees allows measurements to be broken down into further categories, sub-categories, sub-sub-categories, etc., to arbitrary depth, as needed. All the measurements within a single tree are non-overlapping.</p> + +<p>Tree paths can be written using '/' as a separator. For example, <code>preference/referent/weak/dead</code> represents the path to the final leaf node in the example tree above.</p> + +<p>Sub-trees can be collapsed or expanded by clicking on them. If you find any particular tree overwhelming, it can be helpful to collapse all the sub-trees immediately below the root, and then gradually expand the sub-trees of interest.</p> + +<h3 id="Secções"><span class="mw-headline" id="Sections">Secções</span></h3> + +<p>Memory reports are displayed on a per-process basis, with one process per section. Within each process's measurements, there are the following subsections.</p> + +<h4 id="Alocação_Explícitas">Alocação Explícitas</h4> + +<p>This section contains a single tree, called "explicit", that measures all the memory allocated via explicit calls to heap allocation functions (such as <code>malloc</code> and <code>new</code>) and to non-heap allocations functions (such as <code>mmap</code> and <code>VirtualAlloc</code>).</p> + +<p>Here is an example for a browser session where tabs were open to cnn.com, techcrunch.com, and arstechnica.com. Various sub-trees have been expanded and others collapsed for the sake of presentation.</p> + +<pre>191.89 MB (100.0%) -- explicit +├───63.15 MB (32.91%) -- window-objects +│ ├──24.57 MB (12.80%) -- top(http://edition.cnn.com/, id=8) +│ │ ├──20.18 MB (10.52%) -- active +│ │ │ ├──10.57 MB (05.51%) -- window(http://edition.cnn.com/) +│ │ │ │ ├───4.55 MB (02.37%) ++ js-compartment(http://edition.cnn.com/) +│ │ │ │ ├───2.60 MB (01.36%) ++ layout +│ │ │ │ ├───1.94 MB (01.01%) ── style-sheets +│ │ │ │ └───1.48 MB (00.77%) -- (2 tiny) +│ │ │ │ ├──1.43 MB (00.75%) ++ dom +│ │ │ │ └──0.05 MB (00.02%) ── property-tables +│ │ │ └───9.61 MB (05.01%) ++ (18 tiny) +│ │ └───4.39 MB (02.29%) -- js-zone(0x7f69425b5800) +│ ├──15.75 MB (08.21%) ++ top(http://techcrunch.com/, id=20) +│ ├──12.85 MB (06.69%) ++ top(http://arstechnica.com/, id=14) +│ ├───6.40 MB (03.33%) ++ top(chrome://browser/content/browser.xul, id=3) +│ └───3.59 MB (01.87%) ++ (4 tiny) +├───45.74 MB (23.84%) ++ js-non-window +├───33.73 MB (17.58%) ── heap-unclassified +├───22.51 MB (11.73%) ++ heap-overhead +├────6.62 MB (03.45%) ++ images +├────5.82 MB (03.03%) ++ workers/workers(chrome) +├────5.36 MB (02.80%) ++ (16 tiny) +├────4.07 MB (02.12%) ++ storage +├────2.74 MB (01.43%) ++ startup-cache +└────2.16 MB (01.12%) ++ xpconnect</pre> + +<p>Some expertise is required to understand the full details here, but there are various things worth pointing out.</p> + +<ul> + <li>This "explicit" value at the root of the tree represents all the memory allocated via explicit calls to allocation functions.</li> + <li>The "window-objects" sub-tree represents all JavaScript <code>window</code> objects, which includes the browser tabs and UI windows. For example, the "top(http://edition.cnn.com/, id=8)" sub-tree represents the tab open to cnn.com, and "top(chrome://browser/content/browser.xul, id=3)" represents the main browser UI window.</li> + <li>Within each window's measurements are sub-trees for JavaScript ("js-compartment(...)" and "js-zone(...)"), layout, style-sheets, the DOM, and other things.</li> + <li>It's clear that the cnn.com tab is using more memory than the techcrunch.com tab, which is using more than the arstechnica.com tab.</li> + <li>Sub-trees with names like "(2 tiny)" are artificial nodes inserted to allow insignificant sub-trees to be collapsed by default. If you select the "verbose" checkbox before measuring, all trees will be shown fully expanded and no artificial nodes will be inserted.</li> + <li>The "js-non-window" sub-tree represents JavaScript memory usage that doesn't come from windows, but from the browser core.</li> + <li>The "heap-unclassified" value represents heap-allocated memory that is not measured by any memory reporter. This is typically 10--20% of "explicit". If it gets higher, it indicates that additional memory reporters should be added. <a href="/en-US/docs/Mozilla/Performance/DMD" title="Performance/MemShrink/DMD">DMD</a> can be used to determine where these memory reporters should be added.</li> + <li>There are measurements for other content such as images and workers, and for browser subsystems such as the startup cache and XPConnect.</li> +</ul> + +<p>Some add-on memory usage is identified, as the following example shows.</p> + +<pre>├───40,214,384 B (04.17%) -- add-ons +│ ├──21,184,320 B (02.20%) ++ {d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}/js-non-window/zones/zone(0x100496800)/compartment([System Principal], jar:file:///Users/njn/Library/Application%20Support/Firefox/Profiles/puna0zr8.new/extensions/%7Bd10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d%7D.xpi!/bootstrap.js (from: resource://gre/modules/addons/XPIProvider.jsm:4307)) +│ ├──11,583,312 B (01.20%) ++ jid1-xUfzOsOFlzSOXg@jetpack/js-non-window/zones/zone(0x100496800) +│ ├───5,574,608 B (00.58%) -- {59c81df5-4b7a-477b-912d-4e0fdf64e5f2} +│ │ ├──5,529,280 B (00.57%) -- window-objects +│ │ │ ├──4,175,584 B (00.43%) ++ top(chrome://chatzilla/content/chatzilla.xul, id=4293) +│ │ │ └──1,353,696 B (00.14%) ++ top(chrome://chatzilla/content/output-window.html, id=4298) +│ │ └─────45,328 B (00.00%) ++ js-non-window/zones/zone(0x100496800)/compartment([System Principal], file:///Users/njn/Library/Application%20Support/Firefox/Profiles/puna0zr8.new/extensions/%7B59c81df5-4b7a-477b-912d-4e0fdf64e5f2%7D/components/chatzilla-service.js) +│ └───1,872,144 B (00.19%) ++ treestyletab@piro.sakura.ne.jp/js-non-window/zones/zone(0x100496800)</pre> + +<p>More things worth pointing out are as follows.</p> + +<ul> + <li>Some add-ons are identified by a name, such as Tree Style Tab. Others are identified only by a hexadecimal identifier. You can look in about:support to see which add-on a particular identifier belongs to. For example, <code>59c81df5-4b7a-477b-912d-4e0fdf64e5f2</code> is Chatzilla.</li> + <li>All JavaScript memory usage for an add-on is measured separately and shown in this sub-tree.</li> + <li>For add-ons that use separate windows, such as Chatzilla, the memory usage of those windows will show up in this sub-tree.</li> + <li>For add-ons that use XUL overlays, such as AdBlock Plus, the memory usage of those overlays will not show up in this sub-tree; it will instead be in the non-add-on sub-trees and won't be identifiable as being caused by the add-on.</li> +</ul> + +<h4 id="Outros_Cálculos">Outros Cálculos</h4> + +<p>This section contains multiple trees, includes many that cross-cut the measurements in the "explicit" tree. For example, in the "explicit" tree all DOM and layout measurements are broken down by window by window, but in "Other Measurements" those measurements are aggregated into totals for the whole browser, as the following example shows.</p> + +<pre>26.77 MB (100.0%) -- window-objects +├──14.59 MB (54.52%) -- layout +│ ├───6.22 MB (23.24%) ── style-sets +│ ├───4.00 MB (14.95%) ── pres-shell +│ ├───1.79 MB (06.68%) ── frames +│ ├───0.89 MB (03.33%) ── style-contexts +│ ├───0.62 MB (02.33%) ── rule-nodes +│ ├───0.56 MB (02.10%) ── pres-contexts +│ ├───0.47 MB (01.75%) ── line-boxes +│ └───0.04 MB (00.14%) ── text-runs +├───6.53 MB (24.39%) ── style-sheets +├───5.59 MB (20.89%) -- dom +│ ├──3.39 MB (12.66%) ── element-nodes +│ ├──1.56 MB (05.84%) ── text-nodes +│ ├──0.54 MB (02.03%) ── other +│ └──0.10 MB (00.36%) ++ (4 tiny) +└───0.06 MB (00.21%) ── property-tables</pre> + +<p>Some of the trees in this section measure things that do not cross-cut the measurements in the "explicit" tree, such as those in the "preference-service" example above.</p> + +<p>Finally, at the end of this section are individual measurements, as the following example shows.</p> + +<pre> 0.00 MB ── canvas-2d-pixels + 5.38 MB ── gfx-surface-xlib + 0.00 MB ── gfx-textures + 0.00 MB ── gfx-tiles-waste + 0 ── ghost-windows + 109.22 MB ── heap-allocated + 164 ── heap-chunks + 1.00 MB ── heap-chunksize + 114.51 MB ── heap-committed + 164.00 MB ── heap-mapped + 4.84% ── heap-overhead-ratio + 1 ── host-object-urls + 0.00 MB ── imagelib-surface-cache + 5.27 MB ── js-main-runtime-temporary-peak + 0 ── page-faults-hard + 203,349 ── page-faults-soft + 274.99 MB ── resident + 251.47 MB ── resident-unique +1,103.64 MB ── vsize</pre> + +<p>Some measurements of note are as follows.</p> + +<ul> + <li>"resident". Physical memory usage. If you want a single measurement to summarize memory usage, this is probably the best one.</li> + <li>"vsize". Virtual memory usage. This is often much higher than any other measurement (particularly on Mac). It only really matters on 32-bit platforms such as Win32. There is also "vsize-max-contiguous" (not measured on all platforms, and not shown in this example), which indicates the largest single chunk of available virtual address space. If this number is low, it's likely that memory allocations will fail due to lack of virtual address space quite soon.</li> + <li>Various graphics-related measurements ("gfx-*"). The measurements taken vary between platforms. Graphics is often a source of high memory usage, and so these measurements can be helpful for detecting such cases.</li> +</ul> diff --git a/files/pt-pt/mozilla/performance/comunicacao_de_um_problema_de_desempenho/index.html b/files/pt-pt/mozilla/performance/comunicacao_de_um_problema_de_desempenho/index.html new file mode 100644 index 0000000000..a641730856 --- /dev/null +++ b/files/pt-pt/mozilla/performance/comunicacao_de_um_problema_de_desempenho/index.html @@ -0,0 +1,53 @@ +--- +title: Comunicação de um Problema de Desempenho +slug: Mozilla/Performance/Comunicacao_de_um_problema_de_desempenho +tags: + - Desempenho + - Perfilar + - QA + - Testes +translation_of: Mozilla/Performance/Reporting_a_Performance_Problem +--- +<p>Este artigo irá guiá-lo na comunicação de um problema de desempenho utilizando a <a href="/pt-PT/docs/Mozilla/Performance/Perfilar_com_o_Profiler_integrado">extensão do Gecko Profiler</a>. Se preferir, também existe um<a href="https://www.youtube.com/watch?v=kGBs0BQsoQg"> tutorial em vídeo</a>, em vez da leitura.</p> + +<h2 id="Configurar_a_extensão_Gecko_Profiler">Configurar a extensão Gecko Profiler</h2> + +<ol> + <li>Transferir e instalar a ú<a class="external" href="https://perf-html.io/" title="geckoprofiler.xpi">ltima versão da extensão Gecko Profiler</a></li> + <li>A exntensção de perfilar irá aparecer no topo à direita da barra do URL como um ícone globo (se não, <a href="https://support.mozilla.org/pt-PT/kb/como-personalizar-barras-ferramentas#Como_é_que_personalizo_ou_reorganizo_os_itens_da_barra_de_ferramentas">arraste-a para lá da janela de Personalizar</a>).<br> + <br> + <img alt="The Gecko Profiler Add-on installed and visible within the Nightly toolbar." src="https://mdn.mozillademos.org/files/14859/Gecko%20Profiler%20Toolbar%20Button.PNG" style="height: 139px; width: 254px;"></li> + <li><strong>Lembre-se de desativar ou desinstalar a extensão se a não estiver a utilizar.</strong></li> +</ol> + +<p><em>Apenas macOS, </em>ou para verificar se um problema foi corrigido numa versão posterior do Firefox (as compilações do macOS atualmente irão produzir informação importante dos perfis em falta)<em>:</em></p> + +<ol> + <li>Transferir e instalar a <a class="external" href="http://nightly.mozilla.org/" title="http://nightly.mozilla.org/">compilação <em>nightly</em></a> para a sua platforma. Terá de fechar todas as instâncias do Firefox antes de executar <em>nightly</em>.</li> + <li><em>Nightly</em> é uma versão de desenvolvimento, que pode conter erros, por isso, <a href="https://support.mozilla.org/en-US/kb/profile-manager-create-and-remove-firefox-profiles">teste com um novo perfil ou efetue uma cópia de segurança dos seus dados</a>.</li> + <li>Verifique se está a funcionar corretamente, indo até 'Sobre Nightly' procurando por 'nightly' como o canal de atualização (3ª. linha). O ícone deverá ser um globo azul .</li> +</ol> + +<h2 id="Using_the_Add-on">Using the Add-on</h2> + +<p>Once installed, the profiler becomes active immediately (the icon being blue indicates it is active). The profiler uses a fixed size buffer to store sample data. When it runs out of space in its buffer, it discards old entries so you may want to increase the buffer size if you find you are unable to capture the profile quickly enough after you notice a performance problem. In the Settings part of the UI you can adjust the size of the buffer (presently defaults to 9 MB) and the time interval between data collection (presently defaults to 1 ms). Note that increasing the buffer size uses more memory and can make capturing a profile take longer.</p> + +<p><img alt="Profiler UI" src="https://perf-html.io/e9a699daa7c33fcf80c361278055c65d.png" style="height: 376px; width: 546px;"></p> + +<p>Using the keyboard shortcuts is often more convenient than using the mouse to interact with the UI:</p> + +<ul> + <li><code>Ctrl+Shift+1</code> - Start/Stop the profiler</li> + <li><code>Ctrl+Shift+2</code> - Take a profile and launch Cleopatra to view it</li> +</ul> + +<h2 id="Capturing_and_sharing_a_profile">Capturing and sharing a profile</h2> + +<ol> + <li>Reproduce the performance problem. If possible let the problem manifest itself for 5-10 seconds.</li> + <li>Press <code>Ctrl+Shift+2</code> or click on the 'Globe' icon in the top right and select 'Capture Profile'. Try to do this within a few seconds from reproducing the performance problem as only the last few seconds are recorded. If the timeline has a large red block it's a good sign.<br> + <img alt="Jank markers appearing in the Perf.html profile analysis tool." src="https://mdn.mozillademos.org/files/14861/Perf%20Dot%20HTML%20Red%20Lines.PNG" style="height: 238px; width: 558px;"></li> + <li>The data will open in a new tab. Wait until the "Waiting for symbol tables for library libxul.pdb..." notification disappears before sharing the profile.</li> + <li>There will be a button in the top right labeled 'Share' which will upload this profile and once completed will write out a link. Copy this URL to your clipboard by right clicking and add the profile URL to the bug for your performance problem and/or send it to the appropriate person. Try to give some context about what you were doing when the performance problem arose such as the URL you were viewing and what actions were you doing (ex. scrolling on gmail.com).<br> + <img alt="The button for sharing a profile." src="https://mdn.mozillademos.org/files/14863/Share.PNG" style="height: 142px; width: 329px;"></li> +</ol> diff --git a/files/pt-pt/mozilla/performance/index.html b/files/pt-pt/mozilla/performance/index.html new file mode 100644 index 0000000000..44fcdebce2 --- /dev/null +++ b/files/pt-pt/mozilla/performance/index.html @@ -0,0 +1,145 @@ +--- +title: Performance +slug: Mozilla/Performance +tags: + - Add-ons + - Debugging + - Depuração + - Desempenho + - Desenvolvimento + - Development + - Extras + - Mozilla + - Performance +translation_of: Mozilla/Performance +--- +<p>The articles linked to from here will help you improve performance, whether you're developing core Mozilla code or an add-on.</p> + +<table class="topicpage-table"> + <tbody> + <tr> + <td> + <h3 id="Documentação">Documentação</h3> + + <dl> + <dt><a href="/en/Performance/Reporting_a_Performance_Problem" title="en/Performance/Reporting_a_Performance_Problem">Reporting a Performance Problem</a></dt> + <dd>A user friendly guide to reporting a performance problem. A development environment is not required.</dd> + <dt><a href="Benchmarking" title="Performance/Benchmarking advice">Benchmarking</a></dt> + <dd>Tips on generating valid performance metrics.</dd> + <dt><a href="/en/Extensions/Performance_best_practices_in_extensions" title="en/Extensions/Performance best practices in extensions">Performance best practices in extensions</a></dt> + <dd>A performance "best practices" guide for extension developers.</dd> + <dt><a href="/en/Performance/Measuring_add-on_startup_performance" title="en/Measuring Add-on Startup Performance">Measuring Add-on Startup Performance</a></dt> + <dd>A guide for add-on developers on how to set up a performance testing environment.</dd> + <dt><a href="/en/XUL_School/Appendix_A:_Add-on_Performance" title="en/XUL School/Appendix A: Add-on Performance">XUL School: Add-on Performance</a></dt> + <dd>Tips for add-on developers to help them avoid impairing application performance.</dd> + <dt><a href="/en/Performance/GPU_performance" title="en/GPU performance">GPU performance</a></dt> + <dd>Tips for profiling and improving performance when using a GPU.</dd> + <dt><a href="/en-US/docs/Mozilla/Performance/ScrollLinkedEffects">Scroll-Linked Effects</a></dt> + <dd>Information on scroll-linked effects, their effect on performance, related tools, and possible mitigation techniques.</dd> + <dt><a href="/en-US/docs/Mozilla/Performance/Automated_Performance_Testing_and_Sheriffing">Automated Performance Testing and Sheriffing</a></dt> + <dd>Information on automated performance testing and sheriffing at Mozilla.</dd> + <dt><a href="https://wiki.developer.mozilla.org/en-US/docs/Mozilla/Firefox/Performance_best_practices_for_Firefox_fe_engineers">Best practices for Front-end Engineers</a></dt> + <dd>Tips for reducing impacts on browser performance in front-end code.</dd> + </dl> + + <p><span class="alllinks"><a class="internal" href="/Special:Tags?tag=Performance" title="Special:Tags?tag=Performance">View all pages tagged with "Performance"...</a></span></p> + + <h3 id="Memory_profiling_and_leak_detection_tools">Memory profiling and leak detection tools</h3> + + <dl> + <dt><a href="https://developer.mozilla.org/en-US/docs/Tools/Memory" title="en/Performance/Profiling with the Built-in Profiler">The Developer Tools "Memory" panel</a></dt> + <dd>The memory panel in the devtools supports taking heap snapshots, diffing them, computing dominator trees to surface "heavy retainers", and recording allocation stacks.</dd> + </dl> + + <dl> + <dt><a href="/en-US/docs/Mozilla/Performance/about:memory">about:memory</a></dt> + <dd>about:memory is the easiest-to-use tool for measuring memory usage in Mozilla code, and is the best place to start. It also lets you do other memory-related operations like trigger GC and CC, dump GC & CC logs, and dump DMD reports. about:memory is built on top of Firefox's <a href="/en-US/docs/Mozilla/Performance/Memory_reporting">memory reporting</a> infrastructure.</dd> + <dt><a href="/en-US/docs/Mozilla/Performance/DMD">DMD</a></dt> + <dd>DMD is a tool that identifies shortcomings in about:memory's measurements, and can also do multiple kinds of general heap profiling.</dd> + <dt><a href="/en-US/docs/Mozilla/Performance/AWSY">Are We Slim Yet</a></dt> + <dd>areweslimyet.com (a.k.a. AWSY) is a memory usage and regression tracker.</dd> + <dt><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Performance/BloatView">BloatView</a></dt> + <dd>BloatView prints per-class statistics on allocations and refcounts, and provides gross numbers on the amount of memory being leaked broken down by class. It is used as part of Mozilla's continuous integration testing.</dd> + <dt><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Performance/Refcount_tracing_and_balancing">Refcount tracing and balancing</a></dt> + <dd>Refcount tracing and balancing are ways to track down leaks caused by incorrect uses of reference counting. They are slow and not particular easy to use, and thus most suitable for use by expert developers.</dd> + <dt><a href="/en-US/docs/Mozilla/Performance/GC_and_CC_logs">GC and CC logs</a></dt> + <dd>GC and CC logs can be generated and analyzed to in various ways. In particular, they can help you understand why a particular object is being kept alive.</dd> + <dt><a href="/en-US/docs/Mozilla/Testing/Valgrind">Valgrind</a></dt> + <dd><a class="external text" href="http://valgrind.org/" rel="nofollow">Valgrind</a> is a tool that detects various memory-related problems at runtime, including leaks. Valgrind is used as <a class="external text" href="/en-US/docs/Valgrind_test_job" rel="nofollow">part</a> of Mozilla's continuous integration testing, though the coverage is limited because Valgrind is slow.</dd> + <dt><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Testing/Firefox_and_Address_Sanitizer#LeakSanitizer">LeakSanitizer</a></dt> + <dd><span class="external text">LeakSanitizer</span> (a.k.a. LSAN) is similar to Valgrind, but it runs faster because it uses static source code instrumentation. LSAN is part of Mozilla's continuous integration testing, with most tests running through it as part of the AddressSanitizer (a.k.a. ASAN) test jobs.</dd> + <dt><a href="https://developer.apple.com/documentation/Performance/Conceptual/ManagingMemory/Articles/FindingLeaks.html">Apple tools</a></dt> + <dd>Apple provides <span class="external text">some tools</span> for Mac OS X that report similar problems to those reported by LSAN and Valgrind. The "leaks" tool is not recommended for use with SpiderMonkey or Firefox, because it gets confused by tagged pointers and thinks objects have leaked when they have not (see <a class="external text" href="https://bugzilla.mozilla.org/show_bug.cgi?id=390944" rel="nofollow">bug 390944</a>).</dd> + <dt><a href="/en-US/docs/Mozilla/Performance/Leak_Gauge">Leak Gauge</a></dt> + <dd>Leak Gauge is a tool that can be used to detect certain kinds of leaks in Gecko, including those involving documents, window objects, and docshells.</dd> + <dt><a href="https://dxr.mozilla.org/mozilla-central/source/memory/replace/logalloc/README">LogAlloc</a></dt> + <dd>LogAlloc is a tool that dumps a log of memory allocations in Gecko. That log can then be replayed against Firefox's default memory allocator independently or through another replace-malloc library, allowing the testing of other allocators under the exact same workload.</dd> + <dt><a href="/en-US/docs/Mozilla/Performance/Memory_Profiler">Memory Profiler</a></dt> + <dd>The memory profiler samples allocation events and provides different views to analyze the allocation characteristic.</dd> + </dl> + + <p>See also the documentation on <a href="/en-US/docs/Mozilla/Performance/Leak-hunting_strategies_and_tips">Leak-hunting strategies and tips.</a></p> + </td> + <td> + <h3 id="Profiling_and_performance_tools">Profiling and performance tools</h3> + + <dl> + <dt><a href="https://developer.mozilla.org/en-US/docs/Tools/Performance" title="en/Performance/Profiling with the Built-in Profiler">Profiling with the Developer Tools Profiler</a></dt> + <dd>The profiler built into the developer tools has a high-level waterfall, detailed call tree, allocations and GC profiling, and flame graphs. It is available on all platforms and release channels, and also supports remote profiling b2g and Fennec.</dd> + </dl> + + <dl> + <dt><a href="/en/Performance/Profiling_with_the_Built-in_Profiler" title="en/Performance/Profiling with the Built-in Profiler">Profiling with the Gecko Profiler</a> {{ gecko_minversion_inline("16.0") }}</dt> + <dd>The Gecko Profiler is a good tool to start with, particularly for understanding where time is spent within C++ code in Firefox.</dd> + <dt><a href="/en/Performance/Profiling_with_Instruments" title="en/Performance/Profiling with Instruments">Profiling with Instruments</a></dt> + <dd>How to use Apple's Instruments tool to profile Mozilla code.</dd> + <dt><a href="/en/Performance/Profiling_with_Xperf" title="en/Performance/Profiling with Xperf">Profiling with Xperf</a></dt> + <dd>How to use Microsoft's Xperf tool to profile Mozilla code.</dd> + <dt><a href="/en-US/docs/Performance/Profiling_with_Concurrency_Visualizer" title="en/Performance/Profiling with Concurrency Visualizer">Profiling with Concurrency Visualizer</a></dt> + <dd>How to use Visual Studio's Concurrency Visualizer tool to profile Mozilla code.</dd> + <dt><a href="/en/Performance/Profiling_with_Zoom" title="en/Performance/Profiling with Zoom">Profiling with Zoom</a></dt> + <dd>Zoom is a profiler for Linux done by the people who made Shark</dd> + <dt><a href="/en/Performance/Measuring_performance_using_the_PerfMeasurement.jsm_code_module" title="en/Performance/Measuring performance using the PerfMeasurement.jsm code module">Measuring performance using the PerfMeasurement.jsm code module</a> {{ gecko_minversion_inline("2.0") }}</dt> + <dd>Using <a href="/en/JavaScript_code_modules/PerfMeasurement.jsm" title="en/JavaScript code modules/PerfMeasurement.jsm"><code>PerfMeasurement.jsm</code></a> to measure performance data in your JavaScript code.</dd> + <dt><a href="/en-US/docs/Performance/Adding_a_new_Telemetry_probe" title="https://developer.mozilla.org/en-US/docs/Performance/Adding_a_new_Telemetry_probe">Adding a new Telemetry probe</a></dt> + <dd>Information on how to add a new measurement to the Telemetry performance-reporting system</dd> + <dt><a href="/en/Performance/Profiling_JavaScript_with_Shark" title="en/Performance/Profiling JavaScript with Shark">Profiling JavaScript with Shark</a> (obsolete - replaced by Instruments)</dt> + <dd>How to use the Mac OS X Shark profiler to profile JavaScript code in Firefox 3.5 or later.</dd> + <dt><a href="/en/Performance/Profiling_with_Shark" title="en/Performance/Profiling with Shark">Profiling with Shark</a> (obsolete - replaced by Instruments)</dt> + <dd>How to use Apple's Shark tool to profile Mozilla code.</dd> + <dt><a href="/en-US/docs/Mozilla/Performance/Investigating_CSS_Performance">Investigating CSS Performance</a></dt> + <dd>How to figure out why restyle is taking so long</dd> + </dl> + + <h3 id="Power_profiling">Power profiling</h3> + + <dl> + <dt><a href="/en-US/docs/Mozilla/Performance/Power_profiling_overview">Power profiling overview</a></dt> + <dd>This page provides an overview of relevant information, including details about hardware, what can be measured, and recommended approaches. It should be the starting point for anybody new to power profiling.</dd> + <dt><code><a href="/en-US/docs/Mozilla/Performance/tools_power_rapl">tools/power/rapl</a></code> (Mac, Linux)</dt> + <dd><code>tools/power/rapl</code> is a command-line utility in the Mozilla codebase that uses the Intel RAPL interface to gather direct power estimates for the package, cores, GPU and memory.</dd> + <dt><code><a href="/en-US/docs/Mozilla/Performance/powermetrics">powermetrics</a></code> (Mac-only)</dt> + <dd><code>powermetrics</code> is a command-line utility that gathers and displays a wide range of global and per-process measurements, including CPU usage, GPU usage, and various wakeups frequencies.</dd> + <dt><a href="/en-US/docs/Mozilla/Performance/TimerFirings_logging">TimerFirings logging</a> (All platforms)</dt> + <dd>TimerFirings logging is a built-in logging mechanism that prints data on every time fired.</dd> + <dt><a href="/en-US/docs/Mozilla/Performance/Activity_Monitor_and_top">Activity Monitor, Battery Status Menu and <code>top</code></a> (Mac-only)</dt> + <dd>The battery status menu, Activity Monitor and <code>top</code> are three related Mac tools that have major flaws but often consulted by users, and so are worth understanding.</dd> + <dt><a href="/en-US/docs/Mozilla/Performance/Intel_Power_Gadget">Intel Power Gadget</a> (Windows, Mac, Linux)</dt> + <dd>Intel Power Gadget provides real-time graphs for package and processor RAPL estimates. It also provides an API through which those estimates can be obtained.</dd> + <dt><code><a href="/en-US/docs/Mozilla/Performance/perf">perf</a></code> (Linux-only)</dt> + <dd><code>perf</code> is a powerful command-line utility that can measure many different things, including energy estimates and high-context measurements of things such as wakeups.</dd> + <dt><code><a href="/en-US/docs/Mozilla/Performance/turbostat">turbostat</a></code> (Linux-only)</dt> + <dd><code>turbostat</code> is a command-line utility that gathers and displays various power-related measurements, with a focus on per-CPU measurements such as frequencies and C-states.</dd> + <dt><code><a href="https://01.org/powertop">powertop</a></code> (Linux-only)</dt> + <dd><code>powertop</code> is an interactive command-line utility that gathers and displays various power-related measurements.</dd> + </dl> + + <h3 id="Rópicos_Relacionados">Rópicos Relacionados</h3> + + <dl> + <dd><a href="/en/JavaScript" title="en/JavaScript">JavaScript</a>, <a href="/en/XPCOM" title="en/XPCOM">XPCOM</a>, <a href="/En/Developer_Guide" title="en/Developing_Mozilla">Developing Mozilla</a>, <a href="/en/Extensions" title="en/Extensions">Extensions</a>, <a href="/en/Addons" title="en/Addons">Addons</a></dd> + </dl> + </td> + </tr> + </tbody> +</table> diff --git a/files/pt-pt/mozilla/performance/perfilar_com_o_profiler_integrado/index.html b/files/pt-pt/mozilla/performance/perfilar_com_o_profiler_integrado/index.html new file mode 100644 index 0000000000..0a34c2bc64 --- /dev/null +++ b/files/pt-pt/mozilla/performance/perfilar_com_o_profiler_integrado/index.html @@ -0,0 +1,356 @@ +--- +title: Perfilar com o Gecko Profiler +slug: Mozilla/Performance/Perfilar_com_o_Profiler_integrado +tags: + - Desempenho + - Desenvolvimento da Mozilla + - Perfilar +translation_of: Mozilla/Performance/Profiling_with_the_Built-in_Profiler +--- +<p>{{ gecko_minversion_header("16.0") }}</p> + +<div class="summary"> +<p><span class="seoSummary">O Gecko Profiler é um <em>profiler</em> que está integrado no Firefox. </span>Possui uma integração mais apertada com o Firefox do que os <em>profilers</em> externos, e também pode ser utilizado em situações em que os <em>profilers</em> externos não estão disponíveis, tal como numa máquina de não desenvolvimento ou num dispositivo Android bloqueado<span class="seoSummary">. </span></p> +</div> + +<div class="note"> +<p>The Gecko Profiler has been previously known as "SPS" and "the built-in profiler". We have changed as many references to the old names as possible, but there may still be some around.</p> +</div> + +<h2 id="Obter_o_Extra_Gecko_Profiler">Obter o Extra Gecko Profiler</h2> + +<p>First things first, you want to make sure you are using the correct build of Firefox. An official Nightly or Beta or Release build would work. If you are using a local build, make sure you have the --enable-profiling option turned on in your mozconfig.</p> + +<p>The Gecko Profiler has two interfaces:</p> + +<ol> + <li>for Web developers there is a simplified profiler that can be opened from the menu Tools > Web Developer > Performance.</li> + <li>a more advanced interface for developers of Mozilla's internals can be accessed by installing the <a href="https://perf-html.io/">Gecko Profiler add-on</a> (more <a href="/en-US/docs/Mozilla/Performance/Reporting_a_Performance_Problem#Setting_up_the_Gecko_Profiler_extension">details on installation are available</a>).</li> +</ol> + +<div class="note"> +<p><a href="/en-US/docs/Performance/Reporting_a_Performance_Problem">Reporting a Performance Problem</a> has a step-by-step guide for obtaining a profile when requested by Firefox developers.</p> + +<p><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Performance/Reporting_a_Thunderbird_Performance_Problem_with_G">Reporting a Thunderbird Performance Problem</a> has a step-by-step guide for obtaining a profile when requested by Thunderbird developers.</p> +</div> + +<h2 id="Compreender_os_Perfis">Compreender os Perfis</h2> + +<p>You can check out some <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Performance/Gecko_Profiler_FAQ">frequently asked questions</a> about the Gecko Profilers.</p> + +<p>Here's a video of Ehsan examining some profiles:</p> + +<p> + <video controls src="https://vid.ly/e6v7s4?content=video&format=hd_webm">Your browser doesn't appear to support WebM video playback.</video> +</p> + +<div class="note"> +<p>If there are features you would find helpful, please <a href="https://github.com/mstange/Gecko-Profiler-Addon/">file a bug with details</a>.</p> +</div> + +<h3 id="Interface">Interface</h3> + +<h4 id="1._Timeline">1. Timeline</h4> + +<p><img alt="" src="https://mdn.mozillademos.org/files/14877/profiler-timeline.png" style="height: 327px; width: 1751px;"></p> + +<p>The timeline has several rows of tracing markers (colored segments) which indicate interesting events. Hover over them to see more information. Below the tracing markers are rows corresponding with activity on a variety of threads.</p> + +<div class="note"> +<p><strong>Tip</strong>: Threads that are annotated with "[default]" are in the parent (aka "UI", aka "browser chrome", aka "main") process and those annotated with "[tab]" are in the Web content (aka "child") processes.</p> +</div> + +<div class="note"> +<p><strong>Tip</strong>: Long-running tasks in the parent process will block all input or drawing with the browser UI (aka "UI jank") whereas long-running tasks in the content process will block interactivity with the page but still allowing the user to pan and zoom around thanks to APZ.</p> +</div> + +<h5 id="Tracing_markers">Tracing markers</h5> + +<ul> + <li>Red: These indicate that the event loop is being unresponsive. Note that high priority events such as vsync are not included here. Also note that this indicates what would have happened had there been an event waiting and not necessarily that there was an event pending for that long.</li> + <li>Black: These indicate synchronous IPC calls.</li> +</ul> + +<h5 id="Ranges">Ranges</h5> + +<p><img alt="Timeline showing ranged breadcrumbs and zoom icon" src="https://mdn.mozillademos.org/files/14893/profiler-breadcrumbsandzoom.png" style="height: 490px; width: 2450px;"></p> + +<p>Ranges of time can be zoomed in on by clicking and dragging anywhere in the tracing marker or thread areas. Once a range is selected, a magnifying glass appears which zooms into that range. Clicking on a tracing marker will create a selection corresponding with its duration allowing for easy zooming in on interesting time ranges. As you zoom in on ranges, breadcrumbs are created allowing you to easily navigate back to previously-selected ranges or the entire profile (denoted as "Full Range").</p> + +<div class="note"> +<p><strong>Tip</strong>: While zooming out to a previously-selected range deletes the narrower range, the browser back button can be used to restore the narrower range.</p> +</div> + +<h5 id="Thread_Timeline(s)">Thread Timeline(s)</h5> + +<p><strong>Thread/Process Timelines</strong>: Below the tracing markers we have a list of profiled threads. These threads may come from different processes. In this case, we have the 'GeckoMain [default]' process' main thread, a content process' main thread, and the main thread of the compositor process. Each of these timelines is aligned with wall clock time. So, for example, when a thread is blocked, like 'GeckoMain [tab]', on a thread like 'GeckoMain [default]', we can see what's occurring on the latter thread that is preventing it from responding to the former.</p> + +<p><strong>X (Time) axis</strong>: The timelines go from left to right as wall clock time increases along the X axis. Elements in the timeline are spaced at the sampling frequency with an attempt to align them with time. Factors such as sampling or stack-walking variance and system load can lead to sampling delays which manifest as gaps in the timeline.</p> + +<div class="note"> +<p><strong>Nota:</strong> because this is a sampling profiler, be cautious when examining running time that is equal to the sampling interval. For very time-sensitive profiling, you may want to consider a non-sampling profiler.</p> +</div> + +<p><strong>Y (Stack) axis: </strong>The Y axis is the stack depth, not the CPU activity. The change in stack height is useful to find patterns like long blocking calls (long flatlines) or very tall spiky blocks (recursive calls and JS). With more experience you can read profiles faster by recognizing patterns. Also note that you can click on timeline elements (the selected element gets darker when selected) and the tree view (see below) reflects the selected element.</p> + +<ul> +</ul> + +<h4 id="2._Call_Tree">2. Call Tree</h4> + +<p><img alt="" src="https://mdn.mozillademos.org/files/14895/profiler-calltree.png" style="height: 726px; width: 1751px;"></p> + +<p>The Call Tree shows the samples organized by 'Running Time' which will show the data by wall clock time. There are lighter grey names to the right of tree elements that indicate where the code comes from. Be aware that elements can be from JavaScript, Gecko, or system libraries. Note that if some functions are not yet named properly, symbolication may not yet be finished.</p> + +<div class="note"> +<p>Dica: You can right-click on a function name to get an option to copy its name to the clipboard.</p> +</div> + +<p>A significant portion of time can be spent in idle, blocking calls like waiting for events. This is ideal for a responsive application to be ready to service incoming events. There are OS-specific waiting functions like <code>NtWaitForMultipleObjects </code>seen in the example above taken on Windows or <code>mach_msg_trap</code> on macOS.</p> + +<div class="note"> +<p>Dica: You can quickly go deeper into the call tree by holding down your right arrow key. Alternatively, expand an entire tree segment by holding Alt and clicking on the arrow to the left of the collapsed tree segment.</p> +</div> + +<p>As we progress into a more specific part of the tree, you'll notice that the 'Running time' decreases. This happens when a function has 2 or more non-trivial calls: the running time will be split between its children.</p> + +<div class="note"> +<p>Dica: Focus on one section of the tree by clicking on the "arrow-in-a-circle" icon that appears to the right of the tree element as you hover over it. A "tree breadcrumb" will appear similar to the range breadcrumbs noted above.</p> +</div> + +<p>Clicking the "JavaScript only" option will only show JavaScript code in the Call Tree. You could compare the time with this option checked and the total time to get an idea of how much time was spent running JS. Note that long-running JS function execution may not actually be taking as long as you think because further down the call stack there may be something like painting happening.</p> + +<p>Clicking the "Invert call stack" option will sort by the time spent in a function in descending order. Note that the running time here is only the running time of that particular frame and not the total of all called instances of that function. You can see the samples in the Timeline get darker as you select different functions in the Call Tree; these are samples that were taken when the selected function was running.</p> + +<p>"Filter stacks" will allow you to search for functions by name. One of the easiest ways to find slowness caused by a page's JS is to type its URL into the "Filter stacks" box. You can then select corresponding Call Tree entries and watch the Timeline for entries in the content process main thread that get darker as you select Call Tree entries.</p> + +<div class="note"> +<p>Tip: If things are blank elsewhere in the UI, you may have text entered into the "Filter stacks" box.</p> +</div> + +<h5 id="Custom_Annotations">Custom Annotations</h5> + +<p>In <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1334218">bug 1334218</a> an annotation was added to <code>PresShell::Paint</code> to show the URL of the document being painted. These annotations are not too complex to add so if you would like something added, <a href="https://bugzilla.mozilla.org/enter_bug.cgi">file a bug</a>.</p> + +<h4 id="3._Partilhar_o_perfil">3. Partilhar o perfil</h4> + +<p>Click "Share..." > Share acknowledging that the URLs you had open and your Firefox extensions will be included in the profile data sent to the server. If you select a different time range, the URL revealed by pressing "Permalink" will change so that you can be sure the recipient of the URL will see the same things you are seeing.</p> + +<h3 id="Dicas">Dicas</h3> + +<p>Understanding profiles can be difficult. If you're unfamiliar with Gecko's internals, you can click the <em>JavaScript only</em> button to see where your JavaScript code is slow. Each entry in the Call Tree shows a call stack and how much time is spent in that call stack. For example:<img alt="" src="https://mdn.mozillademos.org/files/14905/profiler-timespent.png" style="display: block; height: 382px; margin: 0px auto; width: 1180px;">In the results above we can see that we're spending ~287 milliseconds in <code>Startup::XRE_InitChildProcess</code>, 194 ms of which are spent in <code>PVsync::Msg_Notify</code> and <strong>all</strong> child functions that it calls. It is useful to scan down the "Running Time" column and look for when the time changes. While looking for performance problems, you're looking for the processes that are taking the most time; then you can figure out how to optimize them.</p> + +<h3 id="Erros_(Bugs)_de_Desempenho_Comuns_no_Firefox">Erros (Bugs) de Desempenho Comuns no Firefox</h3> + +<p>Inefficient code that is on the reflow or restyle paths is often to blame for jank. So is code that is run often in the parent process or in parts of the codebase that apply to many users.</p> + +<p>Synchronous re-flow can be caused by JS that, for example, makes changes to the page content in a loop and queries about the layout of the page in that same loop.</p> + +<p>A PresShell:Flush means that we are either recomputing styles or recomputing layout. These sorts of flushes should be avoided if possible, as they can be quite expensive. Keep your eyes out for flushes like this that are blocking the main thread for a long time. If you notice these things happening in a loop, that's a bug to be fixed, since we're likely "layout thrashing".</p> + +<p>Some more tips and answers to common questions are available in a <a href="/en-US/docs/Mozilla/Performance/Gecko_Profiler_FAQ">mid-2017 FAQ document</a>.</p> + +<p>It's a good idea to search <a href="https://bugzilla.mozilla.org/">bugzilla</a> before filing a bug about a performance problem in Firefox but sometimes it's hard to find issues that have already been reported. Therefore, it's usually a good idea to <a href="https://bugzilla.mozilla.org/enter_bug.cgi">file a bug</a>.</p> + +<h2 id="Perfilar_compilações_(builds)_locais_do_Windows">Perfilar compilações (builds) locais do Windows</h2> + +<p>If you built Firefox for Windows <strong>locally</strong> and you would like to use the local symbols with the profiler, you will need to run an additional tool; see <a href="/en-US/docs/Performance/Profiling_with_the_Built-in_Profiler_and_Local_Symbols_on_Windows" title="/en-US/docs/Performance/Profiling_with_the_Built-in_Profiler_and_Local_Symbols_on_Windows">Profiling with the Gecko Profiler and Local Symbols on Windows</a>.</p> + +<h2 id="Perfilar_compilações_(builds)_Try">Perfilar compilações (builds) Try</h2> + +<p>The profiler currently doesn't really support symbolication for profiles from Try builds. For Linux builds, there seem to be symbols inside the binaries, which the profiler should pick up correctly. But on Windows and macOS, you'll have to do some tricks to make it work:</p> + +<ol> + <li><span>Put your firefox build into a directory with the name <code>dist</code>.</span></li> + <li><span>Download the crashreporter symbols zip for your build. It should be one of the "artifacts" of the build job of your try build.</span></li> + <li><span>Unzip the crashreporter symbols into <code>dist/crashreporter-symbols/</code>.</span></li> + <li><span>Now profile as usual.</span></li> +</ol> + +<p>(This abuses the symbolication logic for local builds. It's at <a href="http://searchfox.org/mozilla-central/rev/51b3d67a5ec1758bd2fe7d7b6e75ad6b6b5da223/browser/components/extensions/ext-geckoProfiler.js#172">ext-geckoProfiler.js</a> and may stop working at any time.)</p> + +<h2 id="Perfilar_móvel_Firefox">Perfilar móvel Firefox</h2> + +<ol> + <li>For local builds of Fennec, you should build with optimization and <code>STRIP_FLAGS="--strip-debug"</code> but <strong>NOT</strong> with <code>--enable-profiling</code>. Nightly builds are already built with the appropriate flags.</li> + <li>You'll need to have <code>adb</code> and <code>arm-eabi-addr2line</code> (which is part of the <a href="http://developer.android.com/tools/sdk/ndk/index.html#Installing" title="http://developer.android.com/tools/sdk/ndk/index.html#Installing">Android NDK</a>) in your bash <code>PATH</code>, so use <code>locate arm-eabi-addr2line</code> (on Linux) or<code> mdfind name:arm-eabi-addr2line</code> (on OS X) and stick an export to its location in <code>~/.bash_profile</code>. The extension will invoke bash to use <code>adb</code> and <code>addr2line</code>.</li> + <li>Install the <a href="https://github.com/bgirard/Gecko-Profiler-Addon/raw/master/geckoprofiler.xpi" title="https://github.com/bgirard/Gecko-Profiler-Addon/raw/master/geckoprofiler.xpi">latest pre-release build</a> in your host machine's Firefox browser that has your phone reachable via <a href="/en-US/Firefox_OS/Debugging/Installing_ADB">ADB</a>. This will add a icon in the top right of the browser.</li> + <li>Set <code>devtools.debugger.remote-enabled</code> to <code>true</code> in <code>about:config</code> for Fennec.</li> + <li>Select target <em>Mobile USB</em> and press <em>Connect</em>. The first run will take an additional 1 minute or so to pull in the required system libraries.</li> +</ol> + +<h2 id="Profiling_Firefox_Startup">Profiling Firefox Startup</h2> + +<ol> + <li>Start your Firefox with the environment variable <code>MOZ_PROFILER_STARTUP=1</code> set. This way the profiler is started as early as possible during startup.</li> + <li>Then capture the profile using the add-on as usual.</li> +</ol> + +<p>Startup profiling does not use the settings that you configured in the add-on's panel. It uses settings that can be configured with the environment variables <code>MOZ_PROFILER_STARTUP_ENTRIES</code> and <code>MOZ_PROFILER_STARTUP_INTERVAL</code>:</p> + +<ul> + <li>If it looks like the buffer is not large enough, you can tweak the buffer size with the env var <code>MOZ_PROFILER_STARTUP_ENTRIES</code>. This defaults to 1000000, which is 9MB. If you want 90MB use 10000000, and 20000000 for 180MB, which are good values to debug long startups.</li> + <li>If you'd like a coarser resolution, you can also choose a different interval using <code>MOZ_PROFILER_STARTUP_INTERVAL</code>, which defaults to 1 (unit is millisecond). You can't go below 1 ms but you can use e.g. 10 ms.</li> +</ul> + +<h2 id="Profiling_JS_benchmark_(xpcshell)">Profiling JS benchmark (xpcshell)</h2> + +<ol> + <li>To profile the script <code>run.js</code> with IonMonkey (<code>-I</code>), type inference (<code>-n</code>) and JäegerMonkey (<code>-m</code>). Thgis requires the following command: + + <pre><code class="brush: bash">$ xpcshell -m -I -n -e ' + const Ci = Components.interfaces; + const Cc = Components.classes; + var profiler = Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler); + profiler.StartProfiler( + 10000000 /* = profiler memory */, + 1 /* = sample rate: 100µs with patch, 1ms without */, + ["stackwalk", "js"], 2 /* = features, and number of features. */ + ); + ' -f ./run.js -e ' + var profileObj = profiler.getProfileData(); + print(JSON.stringify(profileObj)); + ' | tail -n 1 > run.cleo</code></pre> + The xpcshell output all benchmark information and on its last line it output the result of the profiling, you can filter it with <code>tail -n 1</code> and redirect it to a file to prevent printing it in your shell. The expected size of the output is around 100 of MB.</li> + <li>To add symbols to your build, you need to call <code>./scripts/profile-symbolicate.py</code> available in B2G repository. + <pre><code>$ GECKO_OBJDIR=<objdir> PRODUCT_OUT=<objdir> TARGET_TOOLS_PREFIX= \ + ./scripts/profile-symbolicate.py -o run.symb.cleo run.cleo</code></pre> + </li> + <li><a href="https://github.com/bgirard/cleopatra" title="https://github.com/bgirard/cleopatra">Clone Cleopatra</a> and start the server with <code>./run_webserver.sh</code>.</li> + <li>Access Cleopatra from your web browser by loading the page <code>localhost:8000</code>, and upload <code>run.symb.cleo</code> to render the profile with most of the symbol information.</li> +</ol> + +<h2 id="Native_stack_vs._Pseudo_stack">Native stack vs. Pseudo stack</h2> + +<p>The profiler periodically samples the stack(s) of thread(s) in Firefox, collecting a stack trace, and presents the aggregated results using the Cleopatra UI. Stack traces can be collected into two different ways: Pseudostack (the default) or Nativestack.</p> + +<h3 id="Native_stack">Native stack</h3> + +<p>Native stacks are the normal stacks most developers are used. They are the default.</p> + +<h3 id="Pseudostack">Pseudostack</h3> + +<p>The pseudostack uses function entry/exit tags added by hand to important points in the code base. The stacks you see in the UI are chains of these tags. This is good for highlighting particularly interesting parts of the code, but they miss out on un-annotated areas of the code base, and give no visibility into system libraries or drivers.</p> + +<p>Tagging is done by adding macros of the form <code>AUTO_PROFILER_LABEL("NAMESPACE", "NAME")</code>. These add RAII helpers, which are used by the profiler to track entries/exits of the annotated functions. For this to be effective, you need to liberally use <code>AUTO_PROFILER_LABEL</code> throughout the code. See <code>GeckoProfiler.h</code> for more variations like <code>AUTO_PROFILER_LABEL_DYNAMIC</code>.</p> + +<p>Because of the non-zero overhead of the instrumentation, the sample label shouldn't be placed inside hot loops. A profile reporting that a large portion is spent in "Unknown" code indicates that the area being executed doesn't have any sample labels. As we focus on using this tool and add additional sample labels coverage should improve.</p> + +<h2 id="Sharing_saving_and_loading_profiles">Sharing, saving and loading profiles</h2> + +<p>After capturing and viewing a profile you will see "Share..." and "Save as file..." buttons in the top-right of the window. Sharing will upload your profile to perf-html.io and make it public. More <a href="/en-US/docs/Mozilla/Performance/Reporting_a_Performance_Problem#Capturing_and_sharing_a_profile">information on sharing profiles</a> is available.</p> + +<h2 id="Profiling_a_hung_process">Profiling a hung process</h2> + +<p>It is possible to get profiles from hung Firefox processes using lldb<sup><a href="http://mikeconley.ca/blog/2015/04/04/things-ive-learned-this-week-march-30-april-3-2015/#fn1-2699" rel="footnote" title="Unfortunately, this technique will not work for Windows. ">1</a></sup>.</p> + +<ol> + <li>After the process has hung, <a href="https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-terminal-workflow-tutorial.html#//apple_ref/doc/uid/TP40012917-CH4-SW5">attach lldb</a>.</li> + <li>Type in<sup><a href="http://mikeconley.ca/blog/2015/04/04/things-ive-learned-this-week-march-30-april-3-2015/#fn2-2699" rel="footnote" title="Assuming you’re running a build after this revision landed.">2</a></sup>, : + <pre>p (void)<code id="line-232">profiler_save_profile_to_file</code>("somepath/profile.txt")</pre> + </li> + <li><a href="https://github.com/mstange/analyze-tryserver-profiles">Clone mstange’s handy profile analysis repository.</a></li> + <li>Run: + <pre>python symbolicate_profile.py somepath/profile.txt</pre> + + <p>To graft symbols into the profile. mstange’s scripts do some fairly clever things to get those symbols – if your Firefox was built by Mozilla, then it will retrieve the symbols from the Mozilla symbol server. If you built Firefox yourself, it will attempt to use some cleverness<sup><a href="http://mikeconley.ca/blog/2015/04/04/things-ive-learned-this-week-march-30-april-3-2015/#fn3-2699" rel="footnote" title="A binary called dump_syms_mac in mstange’s toolkit, and nm on Linux">3</a></sup> to grab the symbols from your binary.</p> + + <p>Your profile will now, hopefully, be updated with symbols. Upload it for further analysis!</p> + + <p>I haven’t yet had the opportunity to try this, but I hope to next week. I’d be eager to hear people’s experience giving this a go – it might be a great tool in determining what’s going on in Firefox when it’s hung!</p> + </li> +</ol> + +<h2 id="Profiling_Threads">Profiling Threads</h2> + +<p>The Gecko Profiler has rudimentary support for profiling multiple threads. To enable it, check the 'Multi-Thread' box then enter one or more thread names into the textbox beside it. Thread names are the strings passed to the base::Thread class at initialization. At present there is no central list of these thread names, but you can find them by grepping the source.</p> + +<p>Examples: <a href="http://mxr.mozilla.org/mozilla-central/source/ipc/glue/BrowserProcessSubThread.cpp#24">1</a> <a href="http://mxr.mozilla.org/mozilla-central/source/gfx/layers/ipc/CompositorParent.cpp#133">2</a></p> + +<p>If the filter you entered is invalid, no threads will be profiled. You can identify this by hitting Analyze (Cleopatra will show you an error message). If the filter is left empty, only the main thread is captured (as if you had not enabled Multi-Thread.)</p> + +<h2 id="Profiler_Features">Profiler Features</h2> + +<p>The profiler supports several features. These are options to gather additional data in your profiles. Each option will increase the performance overhead of profiling so it's important to activate only options that will provide useful information for your particular problem to reduce the distortion.</p> + +<h3 id="Stackwalk">Stackwalk</h3> + +<p>When taking a sample the profiler will attempt to unwind the stack using platform specific code appropriate for the ABI. This will provide an accurate callstack for most samples. On ABIs where framepointers are not avaiable this will cause a significant performance impact.</p> + +<h3 id="JS_Profiling">JS Profiling</h3> + +<p>Javascript callstacks will be generated and interleaved with the c++ callstacks. This will introduce an overhead when running JS.</p> + +<h3 id="GC_Stats">GC Stats</h3> + +<p>Will embed GC stats from 'javascript.options.mem.notify' in the profile.</p> + +<h3 id="Main_Thread_IO">Main Thread IO</h3> + +<p>This will interpose file I/O and report them in the profiles.</p> + +<h3 id="Multi-Thread">Multi-Thread</h3> + +<p>This will sample other threads. This fields accept a comma seperated list of thread names. A thread can only be profiled if it is registered to the profiler.</p> + +<h3 id="GPU">GPU</h3> + +<p>This will insert a timer query during compositing and show the result in the Frames view. This will appropriate how much GPU time was spent compositing each frame.</p> + +<h3 id="Layers_Texture">Layers & Texture</h3> + +<p>The profiler can be used to view the layer tree at each composite, optionally with texture data. This can be used to debug correctness problems.</p> + +<h4 id="Viewing_the_Layer_Tree">Viewing the Layer Tree</h4> + +<p>To view the layer tree, the <code>layers.dump</code> pref must be set to <code>true</code> in the Firefox or B2G program being profiled.</p> + +<p>In addition, both the compositor thread and the content thread (in the case of B2G, the content thread of whichever app you're interested in) must be profiled. For example, on B2G, when profiling the Homescreen app, you might start the profiler with:</p> + +<pre>./profile.sh start -p b2g -t Compositor && ./profile.sh start -p Homescreen +</pre> + +<p>Having gotten a profile this way, the layer tree for a composite can be seen by clicking on a composite in the "Frames" section of Cleopatra (you may need to a sub-range of samples to make individual composites large enough to be clicked). This will activate the "LayerTree" tab:</p> + +<p><img alt="Screenshot of layer tree view in Cleopatra, with no textures." src="https://mdn.mozillademos.org/files/10327/cleopatra-layer-tree-hilite.png" style="height: 1029px; width: 1923px;"></p> + +<p>In this screenshot, Composite #143 has been selected. The layer tree structure can be seen in the left panel. It contains, for each layer, the type of the layer, and various metrics about the layer, such as the visible region and any transforms. In the right panel, a visualization of the layer tree (based entirely on the aforementioned metrics) is shown. Hovering over a layer in the left panel highlights the layer in the right panel. This is useful for identifying what content each layer corresponds to. Here, I'm hovering over the last layer in the layer tree (a PaintedLayerComposite), and a strip at the top of the right panel is highlighted, telling me that this layer is for the system notification bar in B2G.</p> + +<h4 id="Viewing_Textures">Viewing Textures</h4> + +<p>Sometimes, it's useful to see not only the structure of the layer tree for each composite, but also the rendered textures for each layer. This can be achieved by additionally setting the <code>layers.dump-texture</code> pref to <code>true</code>, or by adding <code>-f layersdump </code>to the profiler command line (the latter implies both the <code>layers.dump</code> and <code>layers.dump-texture</code> prefs).</p> + +<div class="warning"> +<p><strong>Warning</strong>: Dumping texture data slows performance considerably, and requires a lot of storage for the profile files. Expect rendering to happen at a significantly reduced frame rate when profiling this way, and keep the duration of the capture short, to ensure the samples of interest aren't overwritten.</p> +</div> + +<p>Here's how the Layer Tree view looks in Cleopatra with texture data:</p> + +<p><img alt="Screenshot of layer tree view in Cleopatra, with textures." src="https://mdn.mozillademos.org/files/10329/cleopatra-layer-tree-textures.png" style="height: 1037px; width: 1920px;"></p> + +<p>This time, the visualization in right panel shows the actual textures rather than just the outlines of the layers. This can be very useful for debugging correctness problems such as a temporary visual/rendering glitch, because it allows you to find the precise composite that shows the glitch, and look at the layer tree for that composite.</p> + +<h4 id="Visualizing_a_layer_tree_without_a_profile">Visualizing a layer tree without a profile</h4> + +<p>If you have a layer dump from somewhere (such as from <code>adb logcat</code> on B2G), you can get Cleopatra to visualize it (just the structure of course, not textures) without needing a profile. To do so, paste the layer dump into the "Enter your profile data here" text field on the front page of Cleopatra:</p> + +<p><img alt="Screenshot of front page of Cleopatra, with pasted layer dump." src="https://mdn.mozillademos.org/files/10331/cleopatra-layer-tree-noprofile.png" style="height: 596px; width: 1020px;"></p> + +<p>The resulting "profile" will have the Layer Tree view enabled (but nothing else). This is useful in cases where you want to gain a quick visual understanding of a layer dump without having to take a profile.</p> + +<div class="note"> +<p>On B2G, each line of a layer dump in <code>adb logcat</code> output is prefixed with something like <code>I/Gecko (30593):</code>. Cleopatra doesn't currently understand this prefix, so it needs to be removed before pasting.</p> +</div> + +<h3 id="Display_List">Display List</h3> + +<p>Dump the display list after each refresh with the texture data. This can be used to debug correctness problems.</p> + +<h2 id="Contribuir">Contribuir</h2> + +<ul> + <li>Source is located in {{ Source("tools/profiler") }}.</li> + <li>The Bugzilla component is Core::Gecko Profile.</li> + <li>The profiler add-on repository can be found here: <a class="link-https" href="https://github.com/bgirard/Gecko-Profiler-Addon" rel="freelink">https://github.com/mstange/Gecko-Profiler-Addon</a>.</li> + <li>The Cleopatra repository can be found here: <a class="link-https" href="https://github.com/devtools-html/perf.html" rel="freelink">https://github.com/devtools-html/perf.html</a></li> +</ul> diff --git a/files/pt-pt/mozilla/persona/index.html b/files/pt-pt/mozilla/persona/index.html new file mode 100644 index 0000000000..12a9d58796 --- /dev/null +++ b/files/pt-pt/mozilla/persona/index.html @@ -0,0 +1,153 @@ +--- +title: Persona +slug: Mozilla/Persona +translation_of: Archive/Mozilla/Persona +--- +<div class="callout-box"> + <p><strong>Acompanhe ou peça ajuda!</strong></p> + <p>Siga <a class="external" href="http://identity.mozilla.com/" title="http://identity.mozilla.com/">nosso blog</a>, join <a class="link-https" href="https://lists.mozilla.org/listinfo/dev-identity" title="https://lists.mozilla.org/listinfo/dev-identity">our mailing list</a>, or find us in <a class="link-irc" href="irc://irc.mozilla.org/identity" title="irc://irc.mozilla.org/identity">#identity</a> on <a class="link-https" href="https://wiki.mozilla.org/IRC" title="https://wiki.mozilla.org/IRC"> IRC</a>.</p> +</div> +<p><a class="link-https" href="https://www.mozilla.org/en-US/persona/" title="https://www.mozilla.org/en-US/persona/">Mozilla Persona</a> é um sistema de autenticação completamente descentralizado e seguro para a web baseado no protocolo aberto BrowserId. Para garantir que Persona funcione em todo lugar e para todos, Mozilla atualmente opera uma pequena suíte de <a href="/en-US/docs/Persona/Bootstrapping_Persona" title="/en-US/docs/Persona/Bootstrapping_Persona">serviços opcionais, centralizados</a>.</p> +<p>Por quê você e seu site deveriam usar Persona?</p> +<ol> + <li><strong>Persona elimina completamente senhas para sites específicos</strong>, libertando usuários e sites do fardo de criar, gerir e armazenar seguramente senhas.</li> + <li><strong>Persona é fácil de usar.</strong> Com apenas dois cliques um usuário Persona pode se cadastrar em um novo site, como <a href="http://voo.st" title="http://voo.st">Voost</a> ou <a href="http://crossword.thetimes.co.uk/" title="http://crossword.thetimes.co.uk/">The Times Crossword</a>, ignorando o desgaste associado à criação de contas.</li> + <li><strong>Persona é fácil de implementar</strong><strong>. </strong>Desenvolvedores podem adicionar Persona à um site em uma única tarde.</li> + <li>Melhor de tudo, <strong>não há bloqueio</strong>. Desenvolvedores adquirem um endereço de email para todos seus usuários, e usuários podem usar qualquer endereço de email com Persona.</li> + <li><strong>Persona é baseado no protocolo BrowserID. </strong>Quando os navegadores populares implementarem BrowserID, <b>eles não irão precisar depender da Mozilla para logar.</b></li> +</ol> +<p>Leia e comece!</p> +<div class="note"> + <strong>Note:</strong> Persona is in active development. Follow <a class="external" href="http://identity.mozilla.com/" title="http://identity.mozilla.com/">our blog</a> to learn about new features, or join <a class="link-https" href="https://lists.mozilla.org/listinfo/dev-identity" title="https://lists.mozilla.org/listinfo/dev-identity">our mailing list</a> and offer your feedback!</div> +<h2 id="Using_Persona_on_your_site">Using Persona on your site</h2> +<table class="topicpage-table"> + <tbody> + <tr> + <td> + <h3 id="Getting_started">Getting started</h3> + <dl> + <dt> + <a href="/en-US/docs/Persona/Why_Persona" title="en/BrowserID/Why_BrowserID">Why Persona?</a></dt> + <dd> + Learn about reasons to support Persona on your site, and how it compares to other identity and authentication systems.</dd> + <dt> + <a href="/en/Persona/Quick_Setup" title="BrowserID/Quick setup">Quick setup</a></dt> + <dd> + A quick walkthrough showing how to add Persona to your website.</dd> + </dl> + </td> + <td> + <h3 id="Persona_API_reference">Persona API reference</h3> + <dl> + <dt> + <a href="/en/DOM/navigator.id" title="navigator.id">The navigator.id API reference</a></dt> + <dd> + Reference for the <code>navigator.id</code> object, which web developers can use to integrate Persona into sites.</dd> + <dt> + <a href="/en/Persona/Remote_Verification_API" title="en/BrowserID/Remote_Verification_API">Verification API reference</a></dt> + <dd> + Reference for the remote verification API hosted at <code>https://verifier.login.persona.org/verify</code>.</dd> + </dl> + </td> + </tr> + <tr> + <td> + <h3 id="Guides">Guides</h3> + <dl> + <dt> + <a href="/en/Persona/Security_Considerations" title="BrowserID/Security considerations">Security considerations</a></dt> + <dd> + Practices and techniques to make sure your Persona deployment is secure.</dd> + <dt> + <a href="/en/Persona/Browser_compatibility" title="/Browser_compatibility">Browser compatibility</a></dt> + <dd> + Learn exactly which browsers support Persona.</dd> + <dt> + <a href="/en/Persona/Internationalization" title="/Internationalization">Internationalization</a></dt> + <dd> + Learn how Persona handles different languages.</dd> + </dl> + </td> + <td> + <h3 id="Resources">Resources</h3> + <dl> + <dt> + <a class="link-https" href="https://github.com/mozilla/browserid/wiki/Persona-Libraries" title="https://github.com/mozilla/browserid/wiki/BrowserID-Libraries">Libraries and plugins</a></dt> + <dd> + Find a drop-in library for your favorite programming language, web framework, blog, or content management system.</dd> + <dt> + <a class="link-https" href="https://github.com/mozilla/browserid-cookbook" title="https://github.com/mozilla/browserid-cookbook">The Persona cookbook</a></dt> + <dd> + Example source code for Persona sites. Includes snippets in PHP, Node.JS, and more.</dd> + <dt> + <a href="/en-US/docs/persona/branding" title="/en-US/docs/persona/branding">Branding resources</a></dt> + <dd> + Sign in buttons and other graphics to help present Persona to your users.</dd> + </dl> + </td> + </tr> + </tbody> +</table> +<p> </p> +<table class="topicpage-table"> + <tbody> + <tr> + <td> + <h2 id="Information_for_Identity_Providers">Information for Identity Providers</h2> + <p>If you're an email provider or another identity-providing service, check out the links below to learn about becoming a Persona Identity Provider.</p> + <dl> + <dt> + <a href="/en-US/docs/Persona/Identity_Provider_Overview" title="IdP">IdP Overview</a></dt> + <dd> + A high level view of Persona Identity Providers.</dd> + <dt> + <a href="/en/Persona/Implementing_a_Persona_IdP" title="Guide to Implementing a Persona IdP">Implementing an IdP</a></dt> + <dd> + A detailed guide to the technical details of becoming an IdP.</dd> + <dt> + <a href="/en-US/Persona/IdP_Development_tips" title="Developer tips">Development tips</a></dt> + <dd> + A set of tips and tricks useful while developing a new Identity Provider.</dd> + <dt> + <a href="/en-US/docs/Persona/.well-known-browserid" title="https://developer.mozilla.org/en-US/docs/Persona/.well-known-browserid">.well-known/browserid</a></dt> + <dd> + An overview of the structure and purpose of the <code>.well-known/browserid</code> file, which IdPs use to advertise their support for the protocol.</dd> + </dl> + </td> + <td> + <h2 id="The_Persona_Project">The Persona Project</h2> + <dl> + <dt> + <a href="/en/Persona/Glossary" title="navigator.id">Glossary</a></dt> + <dd> + BrowserID and Persona terminology defined.</dd> + <dt> + <a href="/en/Persona/FAQ" title="en/BrowserID/FAQ">FAQ</a></dt> + <dd> + Answers to common questions.</dd> + <dt> + <a href="/en/Persona/Protocol_Overview" title="BrowserID/Protocol overview">Protocol overview</a></dt> + <dd> + A mid-level technical overview of the underlying BrowserID protocol.</dd> + <dt> + <a href="/en/persona/Crypto" title="MDN">Crypto</a></dt> + <dd> + A look at the cryptographic concepts behind Persona and BrowserID.</dd> + <dt> + <a class="link-https" href="https://github.com/mozilla/id-specs/blob/master/browserid/index.md" title="https://github.com/mozilla/id-specs/blob/master/browserid/index.md">The Spec</a></dt> + <dd> + Deep technical details live here.</dd> + <dt> + <a href="/Persona/Bootstrapping_Persona" title="en/BrowserID/Bootstrapping_BrowserID">The Persona Website</a></dt> + <dd> + To get Persona going, we're hosting three services at <a class="link-https" href="https://login.persona.org" rel="freelink">https://login.persona.org</a>: a fallback Identity Provider, a portable implementation of the {{ domxref("navigator.id") }} APIs, and an identity assertion verification service.</dd> + <dt> + <a href="https://github.com/mozilla/browserid">The Persona Source Code</a></dt> + <dd> + The code behind the Persona website lives in a repository on GitHub. Patches welcome!</dd> + </dl> + </td> + </tr> + </tbody> +</table> +<p> </p> diff --git a/files/pt-pt/mozilla/phishing/index.html b/files/pt-pt/mozilla/phishing/index.html new file mode 100644 index 0000000000..e553586c69 --- /dev/null +++ b/files/pt-pt/mozilla/phishing/index.html @@ -0,0 +1,50 @@ +--- +title: 'Phishing: uma breve definição' +slug: Mozilla/Phishing +tags: + - Segurança +translation_of: Mozilla/Phishing +--- +<p>Em 2014, a MSCI <a href="https://news.microsoft.com/en-sg/2014/02/11/microsoft-consumer-safety-index-reveals-impact-of-poor-online-safety-behaviours-in-singapore/">estimatou</a> um impacto global anual do phishing e várias formas de roubo de identidade, chegando a US $5 bilhões. O impacto não melhorou desde então.</p> + +<p>Phishing is an attempt to collect sensitive information, such as usernames, passwords, and financial details by disguising as a trustworthy entity online.</p> + +<p>A relatively simple, yet effective, phishing scheme is sending an email with a fake invoice of a person’s favorite shopping site. This email will usually contain a link pretending to lead to the original service, but in reality, taking the victim to an attacker-controlled website. The login portal might resemble the trusted website's login page very closely, and convince users to enter their credentials, letting others hijack their account.</p> + +<h1 id="Contramedidas_passadas_e_atuais">Contramedidas passadas e atuais</h1> + +<p>Various technical, and social approaches, exist to combat phishing attacks. None of these are sufficient by themselves, so we see a mix of these deployed by various services. The following is a non-exhaustive list of the most common approaches.</p> + +<h2 id="Deitando_a_culpa_aos_utilizadores">Deitando a culpa aos utilizadores</h2> + +<p>Some quick-to-implement, and cost-effective solutions, hold users accountable for their actions instead of restricting what’s technically possible. Earlier responses by affected banks, and payment providers, was to attempt educating users to not click links in emails, along with requesting to verify email legitimacy through checking for relevant personal information.</p> + +<p>Another solution is to strengthen logins with pictures, or colored words, often chosen when signing up for a service. Users look for these when logging in, and only enter their credentials when they recognize the user defined pictures or words.</p> + +<p>A study on the efficacy of security indicators, presented at the 2007 IEEE Symposium on Security and Privacy, <a href="http://www.usablesecurity.org/emperor/emperor.pdf">suggests</a> that the above countermeasures fail to protect the majority of users. This too, includes missing HTTPS or EV certificate indicators in a browser’s navigation bar.</p> + +<h2 id="Serviços_assumindo_responsabilidade">Serviços assumindo responsabilidade</h2> + +<p>Technical solutions can be more efficient if implemented to protect millions of users automatically. As most phishing attacks start with unsolicited email messages, a clear starting point is improving spam filters, thus reducing the number of fraudulent messages reaching users.</p> + +<p>Web browser vendors too, are interested in protecting their users from phishing. After all, the browser plays an essential role in the scheme: a fake website is loaded in a browser and here is the maker’s last chance to preventing fraud. Since version 2.0, Firefox has used Google’s <a href="https://safebrowsing.google.com/">SafeBrowsing</a> service, to detect known web forgeries, and display an alert instead of the fraudulent website.</p> + +<h1 id="Autenticação_de_Dois_Fatores">Autenticação de Dois Fatores</h1> + +<p>None of the above anti-phishing measures address the basic problem: username/password combinations are often enough to impersonate users.</p> + +<p>Enter the world of second factors. A second factor is something a user possesses to further authenticate with a service. For example, a USB token, Bluetooth device, mobile phone, or simply a key stored on a separate device. The first factor is usually the password and username. If both factors don’t match, the service will reject authentication requests.</p> + +<h2 id="Criptografia_de_Chave_Pública">Criptografia de Chave Pública</h2> + +<p>Many services will soon support <a href="https://w3c.github.io/webauthn/">W3C Web Authentication</a>, a powerful technology to evade phishing, based on public key cryptography. Web Authentication supports millions of readily avilable FIDO U2F USB security keys, and will support the more advanced FIDO 2.0 keys, once made available.</p> + +<h2 id="Verificação_via_Mensagem_de_Texto">Verificação via Mensagem de Texto</h2> + +<p>If a service supports verification, via SMS, it sends a text message with a one-time PIN to the user’s phone number. The user then enter this PIN after the Web service verifies the username and password. This was chosen as an early second factor 'protocol' as text messages are widely supported, however, even NIST <a href="https://techcrunch.com/2016/07/25/nist-declares-the-age-of-sms-based-2-factor-authentication-over/">no longer recommends SMS verification</a>. The SS7 telephony system is vulnerable, making eavesdropping, or rerouting text messages quite trivial.</p> + +<h2 id="Algoritmos_de_Palavra-passe_Única">Algoritmos de Palavra-passe Única</h2> + +<p>A better way to use phones as second factor, are One-Time Password (OTP) protocols, like <a href="https://tools.ietf.org/html/rfc6238">TOTP</a> and <a href="https://tools.ietf.org/html/rfc4226">HOTP</a>. At service registration, the provider will often generate a QR code to be read by an OTP app. This QR code is nothing more than a random, secret key, that is stored on the user’s phone. After verifying username and password, the user is prompted to open the OTP app and enter the corresponding 6-digit code, representing a hashed version of the secret key and a <a href="https://en.wikipedia.org/wiki/Cryptographic_nonce">nonce</a> - potentially time-based.</p> + +<p>OTP is the most widely supported second factor schemes and can be used to secure your most important accounts. Unfortunately, some users still feel it's too tedious unlocking a phone, opening the OTP app, and manually typing a few digits each time a provider requests a new token. This can be phished by an attacker, though with TOTP apps the attacker has limited time to make their unauthorized login.</p> diff --git a/files/pt-pt/mozilla/projects/emscripten/index.html b/files/pt-pt/mozilla/projects/emscripten/index.html new file mode 100644 index 0000000000..c2c6e1a2dc --- /dev/null +++ b/files/pt-pt/mozilla/projects/emscripten/index.html @@ -0,0 +1,42 @@ +--- +title: Emscripten +slug: Mozilla/Projects/Emscripten +tags: + - C++ + - Emscripten + - JavaScript + - LLVM +translation_of: Mozilla/Projects/Emscripten +--- +<p><span class="seoSummary">Emscripten é um compilador LLVM para JavaScript. </span>Este utiliza <em>bytecode</em> do LLVM (por exemplo, gerado a partir de C/C++, utilizando Clang, ou de outra linguagem) e o compila no JavaScript, que pode ser executado na Web<span class="seoSummary">.</span></p> + +<div class="warning"> +<p><strong>Importante</strong>: esta página fornece uma breve introdução sobre o que Emscripten é. Para começar com Emscripten, vá para a <a href="http://kripken.github.io/emscripten-site/index.html">Wiki oficial do Emscripten</a>.</p> +</div> + +<p>Ao utilizar o Emscripten, pode</p> + +<ul> + <li>Compilar código C e C++ para JavaScript</li> + <li>Compilar qualquer tipo de código que consegue ser traduzido para LLVM <em>bytecode</em>para JavaScript.</li> + <li>Compilar <em>runtimes</em> de C/C++ de outras linguagens para JavaScript e depois correr código nessas outras linguagens de uma maneira indireta (Isto foi feito para Python e Lua)!</li> +</ul> + +<p>Emscripten produz código nativo imediatamente disponível na Web: uma plataforma que é padrão, tem inúmeras implementações independentes e é interpretada em todo o lado desde PC's a iPad's.</p> + +<p>Com Emscripten, programadores de C/C++ não têm o alto custo de transcrever o código manualmente para JavaScript — ou ter que aprender JavaScript sequer. Programadores web também beneficiam, dado que podem usar milhares de bibliotecas nativas já existentes nos seus sites.</p> + +<p>Praticamente qualquer base de código portátil de C ou C++ pode ser compilada para JavaScript usando Emscripten, variando desde jogos de alto performance que precisam de renderizar gráficos, tocar sons, carregar e processar ficheiros até aplicações de <em>frameworks</em> como Qt.</p> + +<p>Emscripten gera código rápido — o formato de saída é <a href="/en-US/docs/Games/Tools/asm.js">asm.js</a>, um <em>subset</em> de JavaScript que consegue executar perto de velocidades nativas em muitos casos.</p> + +<div class="note"> +<p><strong>Nota</strong>: Parece interessante? <a href="http://kripken.github.io/emscripten-site/docs/introducing_emscripten/about_emscripten.html">Ler mais sobre Emscripten e experimentar algumas demonstrações</a>, e depois <a href="http://kripken.github.io/emscripten-site/docs/getting_started/index.html">começar a usar</a>.</p> +</div> + +<h2 id="Outros_artigos_de_interesse_na_MDN">Outros artigos de interesse na MDN</h2> + +<ul> + <li>A nossa <a href="/en-US/docs/Games">zona de jogos </a>contém conteúdo útil relacionado com o desenvolvimento de jogos, que é um caso de uso comum para o Emscripten.</li> + <li>A nossa página com <a href="/en-US/docs/Mozilla/Projects/Emscripten/Techniques">técnicas de Emscripten</a> é um lugar para guardar ideias úteis relacionadas com Emscripten, que conseguiram ser introduzidas na Wiki do Emscripten.</li> +</ul> diff --git a/files/pt-pt/mozilla/projects/index.html b/files/pt-pt/mozilla/projects/index.html new file mode 100644 index 0000000000..7e832a9616 --- /dev/null +++ b/files/pt-pt/mozilla/projects/index.html @@ -0,0 +1,14 @@ +--- +title: Projects +slug: Mozilla/Projects +tags: + - Landing + - Mozilla + - NeedsContent + - NeedsTranslation + - Projects + - TopicStub +translation_of: Mozilla/Projects +--- +<p>Below you'll find links to documentation about various Mozilla projects; these are often parts of Firefox or other products, but may also be used in other projects as well.</p> +<p>{{ LandingPageListSubpages() }}</p> diff --git a/files/pt-pt/mozilla/projects/mailnews/index.html b/files/pt-pt/mozilla/projects/mailnews/index.html new file mode 100644 index 0000000000..79fc847667 --- /dev/null +++ b/files/pt-pt/mozilla/projects/mailnews/index.html @@ -0,0 +1,42 @@ +--- +title: MailNews +slug: Mozilla/Projects/MailNews +translation_of: Mozilla/Projects/MailNews +--- +<p>MailNews significa "Correio e Listas de Notícias". MailNews é o <em>back end</em> de partes de mensagem do <a class="external" href="http://www.seamonkey-project.org/" title="http://www.seamonkey-project.org/">SeaMonkey</a> e <a class="internal" href="/pt-PT/docs/Mozilla/Thunderbird" title="en/Thunderbird">Thunderbird</a>. Este fornece um número de funções e capacidades, incluindo:</p> + +<ul> + <li>Protocolos de comunicação - SMTP, POP3, IMAP, NNTP</li> + <li>Gestão de Mensagens, incluindo procura e filtragem</li> + <li>Composição de Mensagem</li> + <li>Livro de Endereços</li> +</ul> + +<p>O código de MailNews reside na diretoria / mailnews/ de <a class="internal" href="/en/comm-central" title="en/comm-central">comm-central</a>.</p> + +<p> </p> + +<div class="row topicpage-table"> +<div class="section"> +<dl> + <dt class="landingPageList"><a href="/en-US/docs/Mozilla/Projects/MailNews/AsyncTestUtils_Extended_Framework">AsyncTestUtils extended framework</a></dt> + <dd class="landingPageList">The AsyncTestUtils Extended Framework is one mechanism for testing the MailNews component of Thunderbird. See <a href="/en/MailNews/MailNews_Automated_Testing" title="en/MailNews/MailNews Automated Testing">MailNews automated testing</a> for a description of the other testing mechanisms.</dd> + <dt class="landingPageList"><a href="/en-US/docs/Mozilla/Projects/MailNews/Leak_And_Bloat_Tests">Leak And Bloat Tests</a></dt> + <dd class="landingPageList">This page describes how to perform tests that measure memory leaks and bloat for MailNews and its sub-components.</dd> +</dl> + +<dl> +</dl> +</div> + +<div class="section"> +<dl> + <dt class="landingPageList"><a href="/en-US/docs/Mozilla/Projects/MailNews/MailNews_Automated_Testing">MailNews automated testing</a></dt> + <dd class="landingPageList">Automated testing is an increasingly significant and important part of <a class="internal" href="/en/MailNews" title="en/MailNews">MailNews</a> development. It allows reviewers to quickly pick up regressions in patches and helps developers to think about different cases.</dd> +</dl> +</div> +</div> + +<p> </p> + +<p>Consulte as páginas etiquetadas de <a class="internal" href="/Special:Tags?tag=MailNews" title="Special:Tags?tag=MailNews">MailNews</a> para informação additional especifica de MailNews.</p> diff --git a/files/pt-pt/mozilla/projects/rhino/index.html b/files/pt-pt/mozilla/projects/rhino/index.html new file mode 100644 index 0000000000..b84b26f977 --- /dev/null +++ b/files/pt-pt/mozilla/projects/rhino/index.html @@ -0,0 +1,24 @@ +--- +title: Rhino +slug: Mozilla/Projects/Rhino +tags: + - JavaScript + - Mozilla + - Rhino +translation_of: Mozilla/Projects/Rhino +--- +<p><img alt="Image:rhino.jpg" class="internal" src="/@api/deki/files/832/=Rhino.jpg"></p> + +<p><span class="seoSummary"><strong>Rhino</strong> é uma implementação de código fonte aberto da linguagem <a href="/en/JavaScript" title="en/JavaScript">JavaScript</a> inteiramente desenvolvida em Java. Tipicamente, destina-se a ser incluída em aplicações Java como forma de providenciar funcionalidades de <em>scripting </em>ao utilizador final. Foi incluída no pacote J2SE como o <em>scripting engine</em> disponível por defeito.</span></p> + +<h4 id="Rhino_downloads" name="Rhino_downloads">Baixar Rhino</h4> + +<p>Como <a class="internal" href="/en/RhinoDownload" title="en/RhinoDownload">obter código fonte e ficheiros binários</a>. </p> + +<h4 id="Rhino_documentation" name="Rhino_documentation">Documentação Rhino</h4> + +<p><a href="/en/Rhino_documentation" title="en/Rhino_documentation">Informação sobre Rhino</a> para desenvolvedores de scripts.</p> + +<h4 id="Rhino_help" name="Rhino_help">Ajuda Rhino</h4> + +<p><a href="/en/Rhino/Community" title="en/Rhino/Community">Alguns recursos</a> para o caso de entrar em dificuldades.</p> diff --git a/files/pt-pt/mozilla/projects/thunderbird/localizacao_thunderbird/index.html b/files/pt-pt/mozilla/projects/thunderbird/localizacao_thunderbird/index.html new file mode 100644 index 0000000000..b639359af3 --- /dev/null +++ b/files/pt-pt/mozilla/projects/thunderbird/localizacao_thunderbird/index.html @@ -0,0 +1,100 @@ +--- +title: Localização do Thunderbird +slug: Mozilla/Projects/Thunderbird/Localizacao_Thunderbird +tags: + - Localização + - Thunderbird 3 + - Tradução + - thunderbird +translation_of: Mozilla/Projects/Thunderbird/Thunderbird_Localization +--- +<p>Esta página é destinada aos tradutores atuais e futuros do Thunderbird, o cliente de e-mail e <em>usenet</em> da Mozilla Messaging. Abrange muitos aspetos que um tradutor do Thunderbird deverá conhecer como ferramentas necessárias, como obter informação sobre eventos relevantes à localização e vários outros itens de interesse.</p> + +<h2 id="Criar_uma_localização_do_Thunderbird"><span class="mw-headline">Criar uma localização do Thunderbird</span></h2> + +<p><a href="/en/Bootstrapping_a_New_Locale" title="En/Creating_a_new_localization_(Mercurial)">Creating a new localization (Mercurial)</a> - This article describes how you can create a new localization for Thunderbird.</p> + +<h3 id="Sobre_repositórios_e_ramificações">Sobre repositórios e ramificações</h3> + +<p>There are 3 active repositories for Thunderbird development. Thunderbird development work is merged from one branch to the next every six weeks.</p> + +<ul> + <li>comm-central - also known as Trunk or "Daily". + <ul> + <li>This is where regular Thunderbird development takes place. Strings change at any time.</li> + <li>Only a few locales are expected to translate on this branch.</li> + </ul> + </li> + <li>comm-aurora - also known as "Earlybird" + <ul> + <li>This is where development for a particular release starts to be stabilised.</li> + <li>No new features are allowed, and strings are frozen.</li> + <li>Locales should do as much of their work as possible on this branch and achieve sign-off.</li> + <li>Work done here will automatically be merged to beta and release every 6 weeks.</li> + </ul> + </li> + <li>comm-beta - "Beta" channel + <ul> + <li>This is where we preview Thunderbird development to a large amount of users.</li> + <li>Final stabilisations are performed.</li> + <li>Little or no l10n work is done here.</li> + </ul> + </li> +</ul> + +<p>Most locales will being working on comm-aurora. This repository/branch is stable with respect to strings for each six week period. Completing work here means it is ready for the first beta, and you won't need to work on beta branch. Your work will also automatically be carried forward.</p> + +<h3 id="Requisitos_da_Localização">Requisitos da Localização</h3> + +<p>There are not significant restrictions on what locales can change. However, we need to work together on providing search engines for Thunderbird users to use to get the right balance of search engines and the correct options set. For further information <a href="/en/Thunderbird_Localization/Productization" title="en/Thunderbird_Localization/Productization">see this page</a>.</p> + +<h3 id="Painel_da_Localização"><span class="mw-headline">Painel da </span>Localização<span class="mw-headline"> </span></h3> + +<p>The <a class="external text" href="https://l10n.mozilla.org/teams/" rel="nofollow" title="https://l10n.mozilla.org/teams/">localization dashboard</a> for Thunderbird gives localizers a precise overview of the current status of their localization. Detailed information is available on the <a class="link-https" href="https://wiki.mozilla.org/Thunderbird:Localization:Dashboard" title="https://wiki.mozilla.org/Thunderbird:Localization:Dashboard">l10n dashboard page</a>.</p> + +<p>A localization will added to the l10n dashboard on request when it has reached a high-level of completion (> 80%) as shown by the <a href="/en/Compare-locales" title="En/Compare-locales">compare-locales</a> output. To request the addition of your locale to the dashboard, <a class="external text" href="https://bugzilla.mozilla.org/enter_bug.cgi?product=Thunderbird&component=Build%20Config" rel="nofollow" title="https://bugzilla.mozilla.org/enter_bug.cgi?product=Thunderbird&component=Build%20Config">file a bug</a> in the Thunderbird product/Build Config component.</p> + +<h2 id="Obter_informação_relevante_de_l10n"><span class="mw-headline">Obter informação relevante de l10n</span></h2> + +<h3 id="Fóruns_de_Discussão_e_Listas_de_Discussão"><span class="mw-headline">Fóruns de Discussão e Listas de Discussão</span></h3> + +<p>Localizers of Thunderbird should read the localization newsgroups (<a class="external" href="http://groups.google.de/group/mozilla.dev.l10n.announce" title="http://groups.google.de/group/mozilla.dev.l10n.announce">mozilla.dev.l10n.announce</a> <a class="external text" href="http://groups.google.de/group/mozilla.dev.l10n" rel="nofollow" title="http://groups.google.de/group/mozilla.dev.l10n">mozilla.dev.l10n</a>) to stay informed of Thunderbird-specific and general l10n-related items of interest to them. They are further encouraged to read the Thunderbird development newsgroup (<a class="external text" href="http://groups.google.de/group/mozilla.dev.apps.thunderbird" rel="nofollow" title="http://groups.google.de/group/mozilla.dev.apps.thunderbird">mozilla.dev.apps.thunderbird</a>) to stay informed of recent Thunderbird-related developments.</p> + +<p>These newsgroups can also be accessed via the <a class="link-https" href="https://lists.mozilla.org/listinfo/dev-l10n-announce" title="https://lists.mozilla.org/listinfo/dev-l10n-announce">dev-l10n-announce@lists.mozilla.org</a>, <a class="link-https" href="https://lists.mozilla.org/listinfo/dev-l10n" title="https://lists.mozilla.org/listinfo/dev-l10n">dev-l10n@lists.mozilla.org</a> (localization mailinglist) or <a class="link-https" href="https://lists.mozilla.org/listinfo/dev-apps-thunderbird" title="https://lists.mozilla.org/listinfo/dev-apps-thunderbird">dev-apps-thunderbird@lists.mozilla.org</a> (Thunderbird development mailinglist) mailinglists, which mirror the newsgroups mentioned above. You can subscribe to or unsubscribe from these mailinglists via the web interface at <a class="link-https" href="https://lists.mozilla.org/listinfo" title="https://lists.mozilla.org/listinfo">lists.mozilla.org</a>.</p> + +<h3 id="Bugzilla"><span class="mw-headline">Bugzilla </span></h3> + +<p>Localizers should watch the <a class="link-mailto" href="mailto:thunderbird@localization.bugs" rel="freelink">thunderbird@localization.bugs</a> mail address (or its alias :tb-l10n) to stay current on bugs that might affect Thunderbird localizers. This can be done by adding this mail address to the "User Watching" section of your <a class="link-https" href="https://bugzilla.mozilla.org/userprefs.cgi?tab=email" title="https://bugzilla.mozilla.org/userprefs.cgi?tab=email">Email preferences in bugzilla</a>.</p> + +<h3 id="Algumas_hiperligações_úteis"><span class="mw-headline">Algumas hiperligações úteis</span></h3> + +<ul> + <li><a class="external text" href="https://bugzilla.mozilla.org/buglist.cgi?product=MailNews+Core&product=Thunderbird&keywords_type=allwords&keywords=l12y&bug_status=UNCONFIRMED,NEW,ASSIGNED,REOPENED" rel="nofollow" title="https://bugzilla.mozilla.org/buglist.cgi?product=MailNews+Core&product=Thunderbird&keywords_type=allwords&keywords=l12y&bug_status=UNCONFIRMED,NEW,ASSIGNED,REOPENED">Open bugs with the l12y (localizability) keyword</a></li> + <li><a class="external text" href="https://bugzilla.mozilla.org/buglist.cgi?product=MailNews+Core&product=Thunderbird&bug_status=UNCONFIRMED,NEW,ASSIGNED,REOPENED&emailcc1=1&emailtype1=exact&email1=thunderbird@localization.bugs" rel="nofollow" title="https://bugzilla.mozilla.org/buglist.cgi?product=MailNews+Core&product=Thunderbird&bug_status=UNCONFIRMED,NEW,ASSIGNED,REOPENED&emailcc1=1&emailtype1=exact&email1=thunderbird%40localization.bugs">Open bugs which need localizer attention (thunderbird@localization.bugs has been CC'ed on that bug)</a></li> +</ul> + +<h2 id="Tiers_de_Idioma"><span class="mw-headline"><em>Tiers</em> de Idioma</span></h2> + +<p>Locale tiers reflect locales that we need to have in a good state for release. There are 10 locales in tier 1, which are the most important for Thunderbird, because of their number of Thunderbird users or potential for growth.</p> + +<p>These locales are being treated as first-class citizens, as important as en-US, which is to say that any Tier 1 locale that does not meet the requirements may block a final release of Thunderbird.</p> + +<h3 id="Tier_1"><span class="mw-headline"><em>Tier </em>1 </span></h3> + +<p>The following are P1 (priority 1) locales in order of priority:</p> + +<pre>* de - alemão +* fr - francês +* ja, ja-JP-mac - japonês +* en-GB - inglês (UK) +* es-ES - espanhol (continente Europeu) +* it - italiano +* pl - polaco +* ru - russo +* nl - holandês +* pt-BR - português (Brasil) +</pre> + +<h3 id="Tier_2"><span class="mw-headline"><em>Tier</em> 2 </span></h3> + +<p>Todas as outras localidades suportadas que estão na categoria do <em>Tier </em>2.</p> diff --git a/files/pt-pt/mozilla/tech/index.html b/files/pt-pt/mozilla/tech/index.html new file mode 100644 index 0000000000..36bcd94c3a --- /dev/null +++ b/files/pt-pt/mozilla/tech/index.html @@ -0,0 +1,14 @@ +--- +title: Tecnologias da Mozilla +slug: Mozilla/Tech +tags: + - Landing + - Mozilla + - Referencia + - TopicStub + - XUL +translation_of: Mozilla/Tech +--- +<p>A Mozilla tem várias tecnologias, utilizadas como componentes dos seus projetos. Estas estão documentadas aqui.</p> + +<p>{{LandingPageListSubpages}}</p> diff --git a/files/pt-pt/mozilla/tech/places/index.html b/files/pt-pt/mozilla/tech/places/index.html new file mode 100644 index 0000000000..18e2e0cd95 --- /dev/null +++ b/files/pt-pt/mozilla/tech/places/index.html @@ -0,0 +1,75 @@ +--- +title: Places +slug: Mozilla/Tech/Places +tags: + - Desenvolvimento da Mozilla + - Extensões + - Extras + - Places +translation_of: Mozilla/Tech/Places +--- +<p>{{ Fx_minversion_header(3) }}</p> + +<p><strong>Places</strong> é o sistema de gestão de marcadores e histórico introduzido no Firefox 3. It offers increased flexibility and complex querying to make handling the places the user goes easier and more convenient. It also includes new features including favicon storage and the ability to annotate pages with arbitrary information. It also introduces new user interfaces for managing all this information; see {{ interwiki('wikimo', 'Places', 'Places on the Mozilla wiki') }}.</p> + +<p>Places armazena os seus dados numa base de dados <a class="external" href="http://sqlite.org/">SQLite</a>, utilizando as interfaces de <a href="/pt-PT/docs/Mozilla/Tech/XPCOM/Armazenamento" title="Storage">mozStorage</a>.</p> + +<table class="topicpage-table"> + <tbody> + <tr> + <td> + <h2 class="Documentation" id="Documentation" name="Documentation">Documentação</h2> + + <dl> + <dt><a href="/en-US/docs/Places_Developer_Guide" title="Places_Developer_Guide">Places migration guide</a></dt> + <dd>Migrating existing code to use the Places API.</dd> + <dt><a href="/en-US/docs/Manipulating_bookmarks_using_Places" title="Manipulating_bookmarks_using_Places">Manipulating bookmarks using Places</a></dt> + <dd>Examples for how to work with bookmarks using the Places API.</dd> + <dt><a href="/en-US/docs/Using_the_Places_tagging_service" title="Using_the_Places_tagging_service">Using the Places tagging service</a></dt> + <dd>How to use the tagging service.</dd> + <dt><a href="/en-US/docs/Using_the_Places_history_service" title="Using_the_Places_history_service">Using the Places history service</a></dt> + <dd>How to access history information using the Places API.</dd> + <dt><a href="/en-US/docs/Using_the_Places_favicon_service" title="Using_the_Places_favicon_service">Using the Places favicon service</a></dt> + <dd>How to manipulate favicons using the Places API.</dd> + <dt><a href="/en-US/docs/Using_the_Places_livemark_service" title="Using_the_Places_livemark_service">Using the Places livemark service</a></dt> + <dd>How to create and manage livemarks.</dd> + <dt><a href="/en-US/docs/Using_the_Places_annotation_service" title="Using_the_Places_annotation_service">Using the Places annotation service</a></dt> + <dd>How to work with the annotation service.</dd> + <dt><a href="/en-US/docs/Mozilla/Tech/Places/Using_the_Places_keywords_API">Using the Places keywords API</a></dt> + <dd>How to manage Places keywords</dd> + </dl> + + <dl> + <dt><a href="/en-US/docs/Querying_Places" title="Querying_Places">Querying Places</a></dt> + <dd>How to query the bookmarks and history system with specific parameters.</dd> + <dt><a href="/en-US/docs/Retrieving_part_of_the_bookmarks_tree" title="Retrieving_part_of_the_bookmarks_tree">Retrieving part of the bookmarks tree</a></dt> + <dd>How to fetch a section of the bookmarks tree using queries.</dd> + <dt><a href="/en-US/docs/Displaying_Places_information_using_views" title="Displaying_Places_information_using_views">Displaying Places information using views</a></dt> + <dd>How to use Places views to display Places data in your own applications or extensions.</dd> + <dt><a href="/en-US/docs/Places_utilities_for_JavaScript" title="Places_utilities_for_JavaScript">Places utilities for JavaScript</a></dt> + <dd>A library of convenient routines that make it easier to work with Places.</dd> + <dt><a href="/en-US/docs/Mozilla/Tech/Places/places.sqlite_Database_Troubleshooting">Places Database troubleshooting</a></dt> + <dd>How to deal with a corrupt places.sqlite database.</dd> + </dl> + + <p><span class="alllinks"><a href="/en-US/docs/tag/Places" title="tag/Places">View All...</a></span></p> + </td> + <td> + <h2 class="Related_Topics" id="Design_documents" name="Design_documents">Design documents</h2> + + <dl> + <dt><a href="/en-US/docs/The_Places_database" title="The_Places_database">The Places database</a></dt> + <dd>High-level overview of the Places database design.</dd> + <dt><a href="/en-US/docs/Places/History_Service_Design" title="Places/History_Service_Design">History Service Design</a></dt> + <dd>Design of the history service.</dd> + <dt><a href="/en-US/docs/Places/Bookmarks_Service/Design" title="Places/Bookmarks_Service/Design">Bookmark Service Design</a></dt> + <dd>Design of the bookmarks service.</dd> + <dt><a href="/en-US/docs/Places/Annotation_Service/Design" title="Places/Annotation_Service/Design">Annotation Service Design</a></dt> + <dd>Design of the annotation service.</dd> + <dt><a href="/en-US/docs/The_Places_frecency_algorithm" title="The_Places_frecency_algorithm">The Places "frecency" algorithm</a></dt> + <dd>The algorithm behind the Places location bar (sometimes called the "awesomebar").</dd> + </dl> + </td> + </tr> + </tbody> +</table> diff --git a/files/pt-pt/mozilla/tech/xpcom/armazenamento/index.html b/files/pt-pt/mozilla/tech/xpcom/armazenamento/index.html new file mode 100644 index 0000000000..2410a763e4 --- /dev/null +++ b/files/pt-pt/mozilla/tech/xpcom/armazenamento/index.html @@ -0,0 +1,372 @@ +--- +title: Armazenamento +slug: Mozilla/Tech/XPCOM/Armazenamento +tags: + - API de Kit de Ferramentas + - Armazenamento + - Guia(2) + - Interfaces +translation_of: Mozilla/Tech/XPCOM/Storage +--- +<p><strong>Armazenamento</strong> é uma API de base de dados <a class="external" href="http://www.sqlite.org/">SQLite</a>. Está disponível para os <em>callers </em>de confiança, ou seja, apenas extensões e componentes do Firefox.</p> + +<p>The API is currently "unfrozen", which means it is subject to change at any time; in fact, it has changed somewhat with each release of Firefox since it was introduced, and will likely continue to do so for a while.</p> + +<div class="note"><strong>Nota:</strong> Storage is not the same as the <a href="/en/DOM/Storage" title="en/DOM/Storage">DOM:Storage</a> feature which can be used by web pages to store persistent data or the <a href="/en/Session_store_API" title="en/Session_store_API">Session store API</a> (an <a href="/en/XPCOM" title="en/XPCOM">XPCOM</a> storage utility for use by extensions).</div> + +<h2 id="Iniciação">Iniciação</h2> + +<p>This document covers the Storage API and some peculiarities of SQLite. It does <em>not</em> cover SQL or "regular" SQLite. You can find some very useful links in the <a href="#See_also">See also section</a> however. For Storage API help, you can post to mozilla.dev.apps.platform on the news server news.mozilla.org. To report bugs, use <a class="link-https" href="https://bugzilla.mozilla.org/enter_bug.cgi?product=Toolkit&component=Storage">Bugzilla</a>.</p> + +<p>The overall procedure for use is:</p> + +<ol> + <li>Get the Storage service - {{ interface("mozIStorageService") }}.</li> + <li>Open a connection to the database of your choice - {{ interface("mozIStorageConnection") }}.</li> + <li>Create statements to execute on the connection - {{ interface("mozIStorageStatement") }}.</li> + <li>Bind parameters to a statement as necessary.</li> + <li>Execute the statement.</li> + <li>Check for errors.</li> + <li>Reset the statement.</li> +</ol> + +<h2 id="Opening_a_connection" name="Opening_a_connection">Abrir uma ligação</h2> + +<p>JavaScript example of opening <code>my_db_file_name.sqlite</code> in the profile directory:</p> + +<pre class="brush: js">Components.utils.import("resource://gre/modules/Services.jsm"); +Components.utils.import("resource://gre/modules/FileUtils.jsm"); + +let file = FileUtils.getFile("ProfD", ["my_db_file_name.sqlite"]); +let dbConn = Services.storage.openDatabase(file); // Will also create the file if it does not exist +</pre> + +<p>Likewise, the C++ would look like this:</p> + +<pre class="brush: cpp">nsCOMPtr<nsIFile> dbFile; +rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, + getter_AddRefs(dbFile)); +NS_ENSURE_SUCCESS(rv, rv); +rv = dbFile->Append(NS_LITERAL_STRING("my_db_file_name.sqlite")); +NS_ENSURE_SUCCESS(rv, rv); +nsCOMPtr<mozIStorageService> dbService = + do_GetService(MOZ_STORAGE_SERVICE_CONTRACTID, &rv); +NS_ENSURE_SUCCESS(rv, rv); + +nsCOMPtr<mozIStorageConnection> dbConn; +rv = dbService->OpenDatabase(dbFile, getter_AddRefs(dbConn)); +NS_ENSURE_SUCCESS(rv, rv); +</pre> + +<div class="note">Note: <code>MOZ_STORAGE_SERVICE_CONTRACTID</code> is defined in {{ Source("storage/build/mozStorageCID.h") }}.</div> + +<p>{{ Warning("It may be tempting to give your database a name ending in '.sdb' for <strong>s</strong>qlite <strong>d</strong>ata<strong>b</strong>ase, but this is <em>not recommended.</em> This extension is treated specially by Windows as a known extension for an 'Application Compatibility Database' and changes are backed up by the system automatically as part of system restore functionality. This can result in significantly higher overhead file operation.") }}</p> + +<h2 id="Statements" name="Statements">Fechar uma ligação</h2> + +<p>To close a connection on which only synchronous transactions were performed, use the <a href="/en-US/docs/mozIStorageConnection#close()" title="/en-US/docs/mozIStorageConnection#close()"><code>mozIStorageConnection.close()</code></a> method. If you performed any asynchronous transactions, you should instead use the <a href="/en-US/docs/mozIStorageConnection#asyncClose()" title="/en-US/docs/mozIStorageConnection#asyncClose()"><code>mozIStorageConnection.asyncClose()</code></a> method. The latter will allow all ongoing transactions to complete before closing the connection, and will optionally notify you via callback when the connection is closed.</p> + +<h2 id="Statements" name="Statements">Statements</h2> + +<p>This section demonstrates how you can execute SQL statements on your database. For a complete reference see {{ interface("mozIStorageStatement") }}.</p> + +<h3 id="Creating_a_statement" name="Creating_a_statement">Creating a Statement</h3> + +<p>There are actually two ways to execute a statement. You should choose the right one based on your needs.</p> + +<h4 id="No_Results_to_be_Returned">No Results to be Returned</h4> + +<p>If you do not need to get any results back, you can use {{ ifmethod("mozIStorageConnection", "executeSimpleSQL") }} API like this in JavaScript:</p> + +<pre class="brush: js">dbConn.executeSimpleSQL("CREATE TEMP TABLE table_name (column_name INTEGER)"); +</pre> + +<p>Similarly, the C++ looks like this:</p> + +<pre class="brush: cpp">rv = mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING("CREATE TEMP TABLE table_name (column_name INTEGER)")); +NS_ENSURE_SUCCESS(rv, rv);</pre> + +<h4 id="Results_to_be_Returned">Results to be Returned</h4> + +<p>However, if you need to get results back, you should create the statement with the {{ ifmethod("mozIStorageConnection", "createStatement") }} API like this in JavaScript:</p> + +<pre class="brush: js">var statement = dbConn.createStatement("SELECT * FROM table_name WHERE column_name = :parameter"); +</pre> + +<p>This example uses a named placeholder called "parameter" to be bound later (described in {{ anch("Binding Parameters") }}). Similarly, the C++ looks like this:</p> + +<pre class="brush: cpp">nsCOMPtr<mozIStorageStatement> statement; +rv = dbConn->CreateStatement(NS_LITERAL_CSTRING("SELECT * FROM table_name WHERE column_name = ?1"), + getter_AddRefs(statement)); +NS_ENSURE_SUCCESS(rv, rv); +</pre> + +<p>This example uses the numbered placeholder indexed by zero for a parameter to be bound later (described in {{ anch("Binding Parameters") }}).</p> + +<p>{{ Note("Numerical indexes for parameters are always one less than the number you write in the SQL. The use of numerical indexes for parameters is strongly discouraged in JavaScript where named parameters are much easier to use.") }}</p> + +<p>{{ Note("If you need to execute a statement multiple times, caching the result of createStatement will give you a noticeable performance improvement because the SQL query does not need to be parsed each time.") }}</p> + +<h3 id="Binding_parameters" name="Binding_parameters">Binding Parameters</h3> + +<p>In order to effectively use the statements that you create, you have to bind values to the parameters you placed in the statement. A given placeholder can appear multiple times in the same statement, and all instances of it will be replaced with the bound value. If you neglect to bind a value to a parameter, it will be interpreted as <code>NULL</code>.</p> + +<div class="warning">You should never try to construct SQL statements on the fly with values inserted in them. By binding the parameters, you prevent possible SQL injection attacks since a bound parameter can never be executed as SQL.</div> + +<h4 id="Binding_One_Set_of_Parameters">Binding One Set of Parameters</h4> + +<p>If you only have one row to insert, or are using the synchronous API you'll need to use this method. In JavaScript, there is a useful helper object ({{ interface("mozIStorageStatementParams") }}) available ({{ gecko_minversion_inline("1.9.1") }}) that makes binding parameters much easier:</p> + +<pre class="brush: js">var statement = dbConn.createStatement("SELECT * FROM table_name WHERE id = :row_id"); +statement.params.row_id = 1234; +</pre> + +<p>Use :boundParameterName the same way for numeric and non-numeric columns. Do not put the :boundParameterName within apostrophes, because that the binding mechanism does that for you. You can still use this helper object by manually creating the statement wrapper, {{ interface("mozIStorageStatementWrapper") }}, which is provided in Gecko 1.9.1 and later.</p> + +<p>Using named parameters in C++ is a lot more difficult, so it's generally accepted to use numerical placeholders instead. The example below uses {{ ifmethod("mozIStorageStatement", "bindInt32Parameter") }}.<code><span style="font-family: Verdana,Tahoma,sans-serif;"> The full list of </span></code>binding functions can be found with the {{ interface("mozIStorageStatement") }} documentation.</p> + +<p>C++ example:</p> + +<pre class="brush: cpp">nsCOMPtr<mozIStorageStatement> statement; +rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING("SELECT * FROM table_name WHERE id = ?1"), + getter_AddRefs(statement)); +NS_ENSURE_SUCCESS(rv, rv); + +rv = statement->BindInt32Parameter(0, 1234); +NS_ENSURE_SUCCESS(rv, rv); +</pre> + +<p>{{ Note("Numerical indexes for parameters are always one less than the number you write in the SQL. The use of numerical indexes for parameters is strongly discouraged in JavaScript where named parameters are much easier to use.") }}</p> + +<h4 id="Binding_Multiple_Sets_of_Parameters">Binding Multiple Sets of Parameters</h4> + +<p>{{ gecko_minversion_header("1.9.2") }}</p> + +<p>Starting in Gecko 1.9.2 (Firefox 3.6), there's a new, more convenient way to bind multiple sets of parameters at once prior to executing your statement asynchronously. This API is only available for asynchronous execution.</p> + +<pre class="brush: js">let stmt = dbConn.createStatement("INSERT INTO table_name (value) VALUES(:value)"); +let params = stmt.newBindingParamsArray(); +for (let i = 0; i < 10; i++) { + let bp = params.newBindingParams(); + bp.bindByName("value", i); + params.addParams(bp); +} +stmt.bindParameters(params); +</pre> + +<p>You can attach multiple sets of bindings to a statement by adding multiple {{ interface("mozIStorageBindingParams") }} objects to the array of parameter lists, adding each one through calls to the {{ ifmethod("mozIStorageBindingParamsArray", "addParams") }}. Once all the parameters are set up, a single call to {{ ifmethod("mozIStorageStatement", "bindParameters") }} will ensure that the parameters are bound before execution. You can then <a href="/en/Storage#Asynchronously" title="en/Storage#Asynchronously">execute the statement asynchronously</a>, and the statement will get each set of bindings bound to it before execution asynchronously.</p> + +<h3 id="Executing_a_statement" name="Executing_a_statement">Executing a Statement</h3> + +<p>You may execute statements either synchronously (which is supported in Firefox Gecko 1.8 and 1.9) or asynchronously (starting in Gecko 1.9.1). If your code needs to work with applications based on Gecko 1.8 or 1.9, you should the technique covered in the section {{ anch("Synchronously") }} below. Otherwise, it's strongly recommended that you use asynchronous execution, for performance reasons.</p> + +<h4 id="Asynchronously">Asynchronously</h4> + +<p>{{ gecko_minversion_header("1.9.1") }}</p> + +<p>Gecko 1.9.1 introduced support for asynchronous execution of a statement by calling {{ ifmethod("mozIStorageStatement", "executeAsync") }} on the statement. Multiple statements can be executed in a transaction by calling {{ ifmethod("mozIStorageConnection", "executeAsync") }} on the connection and passing in an array of statements. Both of these methods have similar signatures that accept an object as input that receives notifications the execution of the statement(s). A C++ example is omitted here because it would be verbose, but real-world code can be found in the Mozilla source tree ({{ lxrsearch("ident", "i", "mozIStorageStatementCallback") }}).</p> + +<p>After you create and bind a statement, your JavaScript should look something like this to execute a statement asynchronously:</p> + +<pre class="brush: js">statement.executeAsync({ + handleResult: function(aResultSet) { + for (let row = aResultSet.getNextRow(); + row; + row = aResultSet.getNextRow()) { + + let value = row.getResultByName("column_name"); + } + }, + + handleError: function(aError) { + print("Error: " + aError.message); + }, + + handleCompletion: function(aReason) { + if (aReason != Components.interfaces.mozIStorageStatementCallback.REASON_FINISHED) + print("Query canceled or aborted!"); + } +}); +</pre> + +<p>The call to <code>executeAsync</code> takes an object that implements <a href="/en-US/docs/MozIStorageStatementCallback" title="/en-US/docs/MozIStorageStatementCallback">mozIStorageStatementCallback</a>. See its documentation for more details on each method. The callback is optional, however, so if you do not want to receive feedback, you can pass nothing.</p> + +<h4 id="Synchronously">Synchronously</h4> + +<p>If you are OK with the possibility of locking up your user interface, or if you are running on a background thread, you can use {{ ifmethod("mozIStorageStatement", "executeStep") }}. This function allows you to enumerate all the results produced by the statement.</p> + +<p>As you step through each row, you can obtain each parameter by name through a helper object ({{ interface("mozIStorageStatementRow") }}) in JavaScript ( {{ gecko_minversion_inline("1.9.1") }}) like so:</p> + +<pre class="brush: js">while (statement.executeStep()) { + let value = statement.row.column_name; +} +</pre> + +<p>You can create this helper object yourself if it's not available in your version of Gecko. See {{ interface("mozIStorageStatementWrapper") }} for details.</p> + +<p>In C++, the code would look something like this:</p> + +<pre class="brush: cpp">bool hasMoreData; +while (NS_SUCCEEDED(statement->ExecuteStep(&hasMoreData)) && hasMoreData) { + PRInt32 value; + rv = statement->GetInt32(0, &value); + NS_ENSURE_SUCCESS(rv, rv); +} +</pre> + +<p>You can obtain other types of data by using the various methods available on {{ interface("mozIStorageValueArray") }}.</p> + +<p>Alternatively, if you do not expect any results but still need to execute a bound statement, you can simply call {{ ifmethod("mozIStorageStatement", "execute") }}. This is equivalent to calling {{ ifmethod("mozIStorageStatement", "executeStep") }} and then {{ ifmethod("mozIStorageStatement", "reset") }}.</p> + +<h3 id="Resetting_a_Statement">Resetting a Statement</h3> + +<p>When you execute a statement synchronously, it is important to make sure you reset your statement. You can accomplish this by calling {{ ifmethod("mozIStorageStatement", "reset") }} on the statement. If you end up finalizing the statement (see {{ ifmethod("mozIStorageStatement", "finalize") }}) you do not need to worry about calling {{ ifmethod("mozIStorageStatement", "reset") }}. You should do this before you reuse the statement.</p> + +<p>{{ Warning("If you fail to reset a write statement, it will continue to hold a lock on the database preventing future writes or reads. Additionally, if you fail to reset a read statement, it will prevent any future writes to the database.") }}</p> + +<p>In JavaScript, the language makes it pretty easy to ensure that you always reset a statement. Be aware that you should always reset even if an exception is thrown, so your code should look something like this:</p> + +<pre class="brush: js">var statement = dbConn.createStatement("SELECT * FROM table_name"); +try { + while (statement.step()) { + // Use the results... + } +} +finally { + statement.reset(); +} +</pre> + +<p>In C++, Storage provides a helper object in {{ Source("storage/public/mozStorageHelper.h") }}, <code>mozStorageStatementScoper</code>, which ensures that the statement object is reset when the object falls out of scope. Of course, if your statement is local only to the function, you do not have to worry about calling reset since the object will be destroyed.</p> + +<pre class="brush: cpp">nsresult +myClass::myFunction() +{ + // mSpecialStatement is a member variable of the class that contains a statement. + mozStorageStatementScoper scoper(mSpecialStatement); + // You can use mSpecialStatement without concern now. + + nsCOMPtr<mozIStorageStatement> statement; + // mDBConn is a database connection that is stored a member variable of the class. + nsresult rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING("DELETE FROM table_name"), + getter_AddRefs(statement)); + NS_ENSURE_SUCCESS(rv, rv); + return statement->Execute(); + // Once this function returns, mSpecialStatement will be reset, and statement will + // be destroyed. +} +</pre> + +<p>{{ Note("Calling reset is not an expensive operation, and nothing bad happens if you call reset more than once.") }}</p> + +<h2 id="Transactions" name="Transactions">Transações</h2> + +<p>Transactions can be used to either improve performance, or group statements together as an atomic operation. In both cases, you execute more than one statement inside of a transaction.</p> + +<p>In JavaScript, managing transactions can be difficult when you are using the same connection on different threads, or are using a combination of asynchronous and synchronous statement execution. The best way to deal with this is to only execute your statements asynchronously using {{ ifmethod("mozIStorageConnection", "executeAsync") }}. This method will manage the transactions for you, so you don't have to worry about them.</p> + +<p>{{ Note("The database engine does not support nested transactions, so attempting to start a transaction when one is already active will throw an exception.") }}</p> + +<p>Transactions can be started with {{ ifmethod("mozIStorageConnection", "beginTransaction") }} or {{ ifmethod("mozIStorageConnection", "beginTransactionAs") }}. The latter takes one of three constants to describe the type of transaction:</p> + +<ul> + <li><code><a href="https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/mozIStorageConnection#TRANSACTION_DEFERRED">mozIStorageConnection.TRANSACTION_DEFERRED</a></code></li> + <li><code><a href="https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/mozIStorageConnection#TRANSACTION_IMMEDIATE">mozIStorageConnection.TRANSACTION_IMMEDIATE</a></code></li> + <li><code><a href="https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/mozIStorageConnection#TRANSACTION_EXCLUSIVE">mozIStorageConnection.TRANSACTION_EXCLUSIVE</a></code></li> +</ul> + +<p>{{ ifmethod("mozIStorageConnection", "beginTransaction") }} is equivalent to calling {{ ifmethod("mozIStorageConnection", "beginTransactionAs") }} and passing <code><a href="https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/mozIStorageConnection#TRANSACTION_DEFERRED">mozIStorageConnection.TRANSACTION_DEFERRED</a></code> In general, this is the method you want to use.</p> + +<p>Once you start a transaction, you can either commit the changes by calling {{ ifmethod("mozIStorageConnection", "commitTransaction") }}, or rollback the changes by calling {{ ifmethod("mozIStorageConnection", "rollbackTransaction") }}.</p> + +<p>In C++ code, there is a helper class defined in {{ Source("storage/public/mozStorageHelper.h") }}, <code>mozStorageTransaction</code>, that will attempt to get a transaction for you, and handle it appropriately when it falls out of scope. If a transaction is already in progress, no transaction is obtained. If your function returns without calling <code>Commit</code> on the helper object, the transaction will be rolled back.</p> + +<pre class="brush: cpp">nsresult +myClass::myFunction() +{ + // mDBConn is a member variable of our mozIStorageConnection. + mozStorageTransaction transaction(mDBConn); + + // Execute some statements. If we encounter an error, the transaction will + // be rolled back. + + return transaction.Commit(); +} +</pre> + +<h2 id="Colação_(ordenação)">Colação (ordenação)</h2> + +<p>SQLite provides several collation methods (<code>BINARY</code>, <code>NOCASE</code>, and <code>RTRIM</code>), but these are all very simple and have no support for various text encodings or the user's locale.</p> + +<p>{{ gecko_minversion_header("1.9.2") }}</p> + +<p>{{ Gecko("1.9.2") }} added support for several new collation methods:</p> + +<dl> + <dt><code>locale</code></dt> + <dd>Case- and accent-insensitive collation.</dd> + <dt><code>locale_case_sensitive</code></dt> + <dd>Case-sensitive, accent-insensitive collation.</dd> + <dt><code>locale_accent_sensitive</code></dt> + <dd>Case-insensitive, accent-sensitive collation.</dd> + <dt><code>locale_case_accent_sensitive</code></dt> + <dd>Case- and accent-sensitive collation.</dd> +</dl> + +<p>You can use them quite simply in your <code>SELECT</code> queries, like this:</p> + +<pre>var stmt = aConn.createStatement("SELECT * FROM foo ORDER BY name COLLATE locale ASC"); +var results = []; + +while (stmt.executeStep()) { + results.push(stmt.row.t); +} +stmt.finalize(); +</pre> + +<h2 id="How_to_corrupt_your_database" name="How_to_corrupt_your_database">How to Corrupt a Database</h2> + +<p>SQLite is very good about maintaining database integrity, but there are a few things you can do that can lead to database corruption. You can find out more by reading <a class="external" href="http://www.sqlite.org/lockingv3.html" title="http://www.sqlite.org/lockingv3.html">SQLite's documentation on this</a>. These are a few simple things you can <strong>avoid </strong>to help make sure this doesn't happen:</p> + +<ul> + <li>Open more than one connection to the same file with names that aren't exactly the same as determined by <code>strcmp</code>. This includes "my.db" and "../dir/my.db" or, on Windows (case-insensitive) "my.db" and "My.db". Sqlite tries to handle many of these cases, but you shouldn't count on it.</li> +</ul> + +<ul> + <li>Access a database from a symbolic or hard link.</li> +</ul> + +<ul> + <li>Access a statement from more than one thread (discussed in {{ Anch("Thread safety") }}).</li> +</ul> + +<ul> + <li>Call {{ ifmethod("mozIStorageService", "backupDatabaseFile") }} on a locked database, assuming this will leave your database locked. Due to {{ bug(626193) }}, locked databases get unlocked when you call this.</li> +</ul> + +<h2 id="Thread_safety" name="Thread_safety">Thread Safety</h2> + +<p>{{ interface("mozIStorageService") }} and {{ interface("mozIStorageConnection") }} are thread safe. However, no other interface or method is, so do not use them on different threads at the same time!</p> + +<p>If you want to use concurrency to work on your database, you should use the asynchronous APIs provided by Storage.</p> + +<h2 id="See_also" name="See_also">Consultar também</h2> + +<ul> + <li>{{ interface("mozIStorageConnection") }} Database connection to a specific file or in-memory data storage</li> + <li>{{ interface("mozIStorageStatement") }} Create and execute SQL statements on a SQLite database.</li> + <li>{{ interface("mozIStorageValueArray") }} Wraps an array of SQL values, such as a result row.</li> + <li>{{ interface("mozIStorageFunction") }} Create a new SQLite function.</li> + <li>{{ interface("mozIStorageAggregateFunction") }} Create a new SQLite aggregate function.</li> + <li>{{ interface("mozIStorageProgressHandler") }} Monitor progress during the execution of a statement.</li> + <li>{{ interface("mozIStorageStatementWrapper") }} Storage statement wrapper</li> + <li>{{ interface("mozIStorageService") }} Storage Service</li> +</ul> + +<ul> + <li><a href="/en/Storage/Performance" title="en/Storage/Performance">Storage:Performance</a> How to get your database connection performing well.</li> + <li><a class="link-https" href="https://addons.mozilla.org/en-US/firefox/addon/3072">Storage Inspector Extension</a> Makes it easy to view any sqlite database files in the current profile.</li> + <li><a class="external" href="http://www.sqlite.org/lang.html">SQLite Syntax</a> Query language understood by SQLite</li> + <li><a class="external" href="http://sqlitebrowser.sourceforge.net/">SQLite Database Browser</a> is a capable free tool available for many platforms. It can be handy for examining existing databases and testing SQL statements.</li> + <li><a class="link-https" href="https://addons.mozilla.org/en-US/firefox/addon/5817">SQLite Manager Extension</a> helps manage sqlite database files on your computer.</li> +</ul> diff --git a/files/pt-pt/mozilla/tech/xpcom/guide/alterações_xpcom_gecko_2.0/index.html b/files/pt-pt/mozilla/tech/xpcom/guide/alterações_xpcom_gecko_2.0/index.html new file mode 100644 index 0000000000..ac8d2a2583 --- /dev/null +++ b/files/pt-pt/mozilla/tech/xpcom/guide/alterações_xpcom_gecko_2.0/index.html @@ -0,0 +1,222 @@ +--- +title: Alterações de XPCOM no Gecko 2.0 +slug: Mozilla/Tech/XPCOM/Guide/Alterações_XPCOM_Gecko_2.0 +tags: + - Gecko 2.0 + - XPCOM +translation_of: Mozilla/Tech/XPCOM/Guide/Changes_in_Gecko_2.0 +--- +<p>{{ gecko_minversion_header("2") }}</p> + +<p>Várias alterações que afetam a compatibilidade do componente XPCOM estão a ser realizadas no Gecko 2. Este artigo detalha essas alterações, e proporciona sugestões sobre como atualizar o seu código.</p> + +<h2 id="No_more_frozen_interfaces">No more frozen interfaces</h2> + +<p>There are no longer any frozen interfaces; from now on, all interfaces are subject to change. Documentation will be updated as time allows to remove references to interfaces being "frozen" or "unfrozen."</p> + +<h2 id="Component_registration">Component registration</h2> + +<p>The way XPCOM components are registered changed in Gecko 2. Prior to Gecko 2, during component registration, all binary and JavaScript component files were loaded and called, asking them to register themselves. If you used <a href="/en/JavaScript_code_modules/XPCOMUtils.jsm" title="en/JavaScript code modules/XPCOMUtils.jsm">XPCOMUtils.jsm</a>, some of this was hidden from you, but it was still there.</p> + +<p>Starting in Gecko 2, however, components are registered using manifest files, similarly to how chrome is registered. In fact, the same <a href="/en/Chrome_Registration" title="en/chrome.manifest">chrome manifest</a> file will be used to register components.</p> + +<p><strong>All existing XPCOM components</strong> will need to be updated to support this. However, it's very easy to do, and you can actually support both types of registration for backward compatibility.</p> + +<h3 id="Component_manifests">Component manifests</h3> + +<p>All component registration is now handled through manifest files. For extensions, this is the same <code>chrome.manifest</code> currently used to register chrome.</p> + +<h3 id="XPT_files">XPT files</h3> + +<p>The path of any XPT files must be listed explicitly in a manifest using an <code>interfaces</code> directive:</p> + +<pre>interfaces components/mycomponent.xpt</pre> + +<h3 id="JavaScript_components">JavaScript components</h3> + +<p>The registration information for JavaScript components is no longer located in the component itself; instead, it's located in the manifest. The component is loaded only when the XPCOM component manager needs to create a component.</p> + +<p><code>chrome.manifest</code>:</p> + +<pre># The {classID} here must match the classID in mycomponent.js +component {e6b866e3-41b2-4f05-a4d2-3d4bde0f7ef8} components/mycomponent.js +contract @foobar/mycomponent;1 {e6b866e3-41b2-4f05-a4d2-3d4bde0f7ef8} +category profile-after-change MyComponent @foobar/mycomponent;1 +</pre> + +<p>The JavaScript code no longer exports a <code><a href="/en/NSGetModule" title="en/NSGetModule">NSGetModule()</a></code> function. It now must export a <a href="/en/NSGetFactory" title="en/NSGetFactory"><code>NSGetFactory()</code></a> function, which accepts a class ID (CID) as a parameter.</p> + +<p>For example, in your component's JavaScript code :</p> + +<pre class="brush: js">Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); + +function myComponent() { +} +myComponent.prototype = { + // this must match whatever is in chrome.manifest! + classID: Components.ID("{e6b866e3-41b2-4f05-a4d2-3d4bde0f7ef8}"), + + QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIMyComponent]), + + /* nsIMyComponent implementation goes here */ + ... +}; + +// The following line is what XPCOM uses to create components. Each component prototype +// must have a .classID which is used to create it. +const NSGetFactory = XPCOMUtils.generateNSGetFactory([myComponent]); +</pre> + +<p>A component may implement backwards compatibility with Gecko 1.9.2 by dynamically detecting which symbols are exported by XPCOMUtils.jsm and exporting the correct function:</p> + +<pre class="brush: js">/** +* XPCOMUtils.generateNSGetFactory was introduced in Mozilla 2 (Firefox 4, SeaMonkey 2.1). +* XPCOMUtils.generateNSGetModule was introduced in Mozilla 1.9 (Firefox 3.0). +*/ +if (XPCOMUtils.generateNSGetFactory) + var NSGetFactory = XPCOMUtils.generateNSGetFactory([myComponent]); +else + var NSGetModule = XPCOMUtils.generateNSGetModule([myComponent]);</pre> + +<h3 id="Binary_components">Binary components</h3> + +<p>Binary components must be listed explicitly in a manifest using a <code>binary-component</code> directive:</p> + +<pre>binary-component components/mycomponent.dll +</pre> + +<p>C++ in the component must be changed: a binary component no longer exports a <code><a href="/en/NSGetModule" title="en/NSGetModule">NSGetModule()</a></code> function. Instead, it exports an <a href="/en/XPCOM/NSModule" title="en/XPCOM/NSModule"><code>NSModule</code></a> data symbol which points to a <code>mozilla::Module</code> structure. For more information about the <code>mozilla::Module</code> structure, see the <a class="external" href="http://mxr.mozilla.org/mozilla-central/source/xpcom/components/Module.h" title="http://mxr.mozilla.org/mozilla-central/source/xpcom/components/Module.h">Module.h</a> header file. For an up-to-date example of implementing a dynamic modules, see <a class="external" href="http://mxr.mozilla.org/mozilla-central/source/xpcom/sample/nsSampleModule.cpp" title="http://mxr.mozilla.org/mozilla-central/source/xpcom/sample/nsSampleModule.cpp">nsSampleModule.cpp</a>.</p> + +<p>Note that <code>nsIGenericFactory.h</code> has been removed. References to <code>nsIGenericFactory.h</code> should be replaced with <code>mozilla/ModuleUtils.h</code>.</p> + +<p>It is possible for a binary component to be compatible with Mozilla 1.9.2 and Mozilla 2.0 by using the extra macro <code>NS_IMPL_MOZILLA192_NSGETMODULE</code>. See <a class="external" href="http://mxr.mozilla.org/mozilla-central/source/xpcom/sample/nsSampleModule.cpp" title="http://mxr.mozilla.org/mozilla-central/source/xpcom/sample/nsSampleModule.cpp">nsSampleModule.cpp</a> for more details.</p> + +<div class="note"><strong>Note:</strong> Binary XPCOM components <em>must</em> be recompiled for every new major release of Firefox starting with Firefox 4. Your life would be much easier over the long term if you switch to using <a href="/en/js-ctypes" title="https://developer.mozilla.org/en/js-ctypes">js-ctypes</a> instead.</div> + +<p>Also note that extensions using binary components must now use the <a href="/en/Install_Manifests#unpack" title="https://developer.mozilla.org/en/Install_Manifests#unpack">unpack</a> property in the install manifest.</p> + +<h3 id="Platform-specific_directories">Platform-specific directories</h3> + +<p>The component/chrome system used to look in platform-specific subdirectories of an extension, such as <code>platform/WINNT_x86-msvc/chrome.manifest</code> on Windows. This is no longer supported. You can use the <a href="/en/Chrome_Registration#os" title="en/chrome registration#os">OS</a> and <a href="/en/Chrome_Registration#abi" title="en/chrome registration#abi">ABI</a> chrome registration directives to achieve the same effect:</p> + +<pre>binary-component components/windows/mycomponent.dll ABI=WINNT_x86-msvc +binary-component components/mac/mycomponent.dylib ABI=Darwin_x86-gcc3 +binary-component components/mac/mycomponent64.dylib ABI=Darwin_x86_64-gcc3 +binary-component components/linux/mycomponent.so ABI=Linux_x86-gcc3 +</pre> + +<p>This also means that platform-specific preferences are no longer possible. If you need to adjust default preferences based on platform, you can do so at first run by looking up what platform you're on and changing the preferences at that time.</p> + +<h2 id="Category_registration">Category registration</h2> + +<p>Prior to Gecko 2, extensions could listen for the <code>xpcom-startup</code> and <code>app-startup</code> <a href="/en/Observer_Notifications" title="en/Observer Notifications">notifications</a> during startup, and perform actions during those. This is no longer the case. The earliest startup notification extensions can receive now is <code>profile-after-change</code>, which has always been the recommended notification to observe. That's because it's among the earliest notifications that occurs after the profile folder (and therefore preferences and other services) is available.</p> + +<h3 id="What_you_need_to_change">What you need to change</h3> + +<p>If your extension currently observes either <code>xpcom-startup</code> or <code>app-startup</code>, you need to update your code to observe <code>profile-after-change</code> instead.</p> + +<p>Typically, extensions observed <code>app-startup</code> because in the past, you needed to load for <code>app-startup</code> in order to be able to register to observe <code>profile-after-change</code> in the first place. As of {{ gecko("1.9.1") }}, this is no longer the case, however; you can now register for <code>profile-after-change</code> using the Category Manager. See <a href="/en/XPCOM/Receiving_startup_notifications" title="en/XPCOM/Receiving startup notifications">Receiving startup notifications</a> for details.</p> + +<p>To add a category entry, you must insert the following line to your chrome.manifest:</p> + +<pre>category profile-after-change MyComponent @foobar/mycomponent;1 +</pre> + +<div class="warning"><strong>Important</strong>: Formerly, the contract id of the category entry was prefixed with "<code>service,"</code> if the component was implemented as a service. This prefix needs to be dropped when migrating to chrome.manifest.</div> + +<h3 id="Changed_category_names">Changed category names</h3> + +<p>The XPCOM category manager is used to register certain global helper objects. Because chrome.manifest is a space-delimited format, category names with spaces cannot be registered. Therefore the following categories have changed:</p> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Old name</th> + <th scope="col">New name</th> + </tr> + <tr> + <td><code>JavaScript global constructor</code></td> + <td><code>JavaScript-global-constructor</code></td> + </tr> + <tr> + <td><code>JavaScript global constructor prototype alias</code></td> + <td><code>JavaScript-global-constructor-prototype-alias</code></td> + </tr> + </thead> + <tbody> + <tr> + <td><code>JavaScript global property</code></td> + <td><code>JavaScript-global-property</code></td> + </tr> + <tr> + <td><code>JavaScript global privileged property</code></td> + <td><code>JavaScript-global-privileged-property</code></td> + </tr> + <tr> + <td><code>JavaScript global static nameset</code></td> + <td><code>JavaScript-global-static-nameset</code></td> + </tr> + <tr> + <td><code>JavaScript global dynamic nameset</code></td> + <td><code>JavaScript-global-dynamic-nameset</code></td> + </tr> + <tr> + <td><code>JavaScript DOM class</code></td> + <td><code>JavaScript-DOM-class</code></td> + </tr> + <tr> + <td><code>JavaScript DOM interface</code></td> + <td><code>JavaScript-DOM-interface</code></td> + </tr> + <tr> + <td><code>XSLT extension functions</code></td> + <td><code>XSLT-extension-functions</code></td> + </tr> + </tbody> +</table> + +<h3 id="But_why">But why?</h3> + +<p>Previously, whenever Gecko detected that the application version had changed, or one or more extensions was added, removed, enabled, or disabled, it was necessary to throw away all existing component registrations, then restart the application (what we call the "Extension Manager restart") during its startup process. This was necessary in order to ensure that any components that should no longer be available are disposed of properly, and to re-register everything, loading any new components that may be needed.</p> + +<p>In theory, this is invisible to the user, but it's a costly process, since every component needs to be loaded and executed, then unloaded, then reloaded again during the restart.</p> + +<p>On top of that, with the ongoing work to make Firefox multithreaded, content processes either need to register components on a per-process basis, or somehow share a component cache with the chrome process.</p> + +<p>The changes to the component registration model let this so-called Extension Manager restart become a thing of the past. Instead of relying on a potentially stale component cache on startup, we read the application's component registrations out of its manifest file and load those components. This gets enough of XPCOM loaded and running that we can then load the Extension Manager and perform the necessary installing, uninstalling, and updating of any installed extensions.</p> + +<p>Once that's done, the extensions can then be loaded by simply reading their manifests, loading their components, and continuing the startup process, all without having to restart the browser.</p> + +<p>Electrolysis content processes can simply read the component registrations during startup.</p> + +<h2 id="XPCNativeWrapper_changes">XPCNativeWrapper changes</h2> + +<h3 id="You_can't_disable_XPCNativeWrappers_from_your_manifest">You can't disable XPCNativeWrappers from your manifest</h3> + +<p>Specifying <code>xpcnativewrappers=no</code> in your manifest (that is, XPCNativeWrapper automation) is no longer supported. This was always intended to be a short-term workaround to allow extensions to continue to work while their authors updated their code to use XPCNativeWrappers.</p> + +<p>If your add-on depends upon XBL bindings attached to content objects—for example, the ability to call functions or get and set properties created by the XBL binding—you will need to use the XPCNativeWrapper property <code>wrappedJSObject</code> to access wrapped objects.</p> + +<p>If you need to be able to call functions or access properties defined by web content, you'll need to do this as well. This may be the case if, for example, you've written an extension that adds a delete button to a web mail service, and the service defines a <code>window.delete()</code> function that you need to call.</p> + +<p>If, on the other hand, all you're doing with content is accessing DOM methods and properties, you've never needed to be using <code>xpcnativewrappers=no</code> in the first place, and should simply remove it from your manifest.</p> + +<h3 id="Miscellaneous_XPCNativeWrapper_changes">Miscellaneous XPCNativeWrapper changes</h3> + +<ul> + <li>Using the <a href="../../../../en/JavaScript/Reference/Operators/Special_Operators/delete_Operator" rel="internal"><code>delete</code></a> operator on "expando" properties of an XPCNativeWrapper no longer throws a security exception.</li> +</ul> + +<h2 id="XPCOMUtils.jsm_changes">XPCOMUtils.jsm changes</h2> + +<p>The <a href="/en/JavaScript_code_modules/XPCOMUtils.jsm" title="en/JavaScript/Code modules/XPCOMUtils.jsm"><code>XPCOMUtils.jsm</code></a> code module has been updated to let you specify the application IDs of the applications you wish to register your component in.</p> + +<h2 id="XPCOM_service_getters">XPCOM service getters</h2> + +<p>A number of commonly used XPCOM services now have service getter functions available in the <a href="/en/XPCOM/mozilla::services_namespace" title="en/XPCOM/mozilla::services namespace">mozilla::services namespace</a>; these make it much easier to get access to these services from C++ code.</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li><a class="external" href="http://blog.mozilla.com/addons/2010/06/14/multiple-breaking-changes-are-coming-for-components-in-extensions/" title="http://blog.mozilla.com/addons/2010/06/14/multiple-breaking-changes-are-coming-for-components-in-extensions/">Multiple breaking changes are coming for components in extensions</a></li> +</ul> diff --git a/files/pt-pt/mozilla/tech/xpcom/guide/index.html b/files/pt-pt/mozilla/tech/xpcom/guide/index.html new file mode 100644 index 0000000000..63fcce03c0 --- /dev/null +++ b/files/pt-pt/mozilla/tech/xpcom/guide/index.html @@ -0,0 +1,21 @@ +--- +title: XPCOM guide +slug: Mozilla/Tech/XPCOM/Guide +tags: + - Add-ons + - Extensions + - Guide + - Landing + - Mozilla + - NeedsTranslation + - TopicStub + - XPCOM +translation_of: Mozilla/Tech/XPCOM/Guide +--- +<p><span class="seoSummary">These articles provide tutorials and usage documentation for XPCOM, including how to use it in your own projects and how to build XPCOM components for your Firefox add-ons and the like.</span></p> + +<div class="warning"> +<p><strong>WebExtensions are becoming the new standard for creating add-ons. </strong>Eventually support for XPCOM add-ons will be deprecated, so you should begin to investigate porting your add-ons to use the <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions">WebExtensions</a> API, and <a href="https://mzl.la/webext-feature-needed">report any missing functionality</a> so we can be sure to address your concerns. Work is ongoing on WebExtension capabilities, so your input will help prioritize and plan the work. To learn more about the kinds of changes that will be needed, see <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Comparison_with_XUL_XPCOM_extensions">Comparison with XUL/XPCOM extensions</a>. In addition, any binaries you use will then need to be converted for use with the WebExtensions <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_messaging">native messaging</a> API, or compiled using <a href="https://webassembly.github.io/">WebAssembly</a> or <a href="/en-US/docs/Mozilla/Projects/Emscripten">Emscripten</a>.</p> +</div> + +<p>{{LandingPageListSubpages}}</p> diff --git a/files/pt-pt/mozilla/tech/xpcom/index.html b/files/pt-pt/mozilla/tech/xpcom/index.html new file mode 100644 index 0000000000..4aad9d4fe0 --- /dev/null +++ b/files/pt-pt/mozilla/tech/xpcom/index.html @@ -0,0 +1,52 @@ +--- +title: XPCOM +slug: Mozilla/Tech/XPCOM +tags: + - Add-ons + - Extensions + - Extensões + - Extras + - Landing + - Mozilla + - NeedsTranslation + - Precisa de Tradução + - TopicStub + - XPCOM +translation_of: Mozilla/Tech/XPCOM +--- +<p><span class="seoSummary"><strong>XPCOM</strong> é um modelo de objeto componente de plataforma cruzada, similar a Microsoft COM. Este tem múltiplas <a href="/en-US/docs/XPCOM/Language_Bindings" title="XPCOM/Language_Bindings">ligações de l</a>inguagem, permitindo que os componentes XPCOM sejam utilizados e implementados no Java, JavaScript e Python, além das interfaces em C++.</span> As interfaces no XPCOM são definidas num dialeto de IDL, nomeado de <a href="/en-US/docs/XPIDL" title="XPIDL">XPIDL</a>.</p> + +<div class="warning"> +<p><strong>WebExtensions are becoming the new standard for creating add-ons. </strong>Eventually support for XPCOM add-ons will be deprecated, so you should begin to investigate porting your add-ons to use the <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions">WebExtensions</a> API, and <a href="https://mzl.la/webext-feature-needed">report any missing functionality</a> so we can be sure to address your concerns. Work is ongoing on WebExtension capabilities, so your input will help prioritize and plan the work. To learn more about the kinds of changes that will be needed, see <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Comparison_with_XUL_XPCOM_extensions">Comparison with XUL/XPCOM extensions</a>. In addition, any binaries you use will then need to be converted for use with the WebExtensions <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_messaging">native messaging</a> API, or compiled using <a href="https://webassembly.github.io/">WebAssembly</a> or <a href="/en-US/docs/Mozilla/Projects/Emscripten">Emscripten</a>.</p> +</div> + +<p>XPCOM itself provides a set of core components and classes, e.g. file and memory management, threads, basic data structures (strings, arrays, variants), etc. The majority of XPCOM components are not part of this core set and are provided by other parts of the platform (e.g. <a href="/en-US/docs/Gecko" title="Gecko">Gecko</a> or <a href="/en-US/docs/Necko" title="Necko">Necko</a>) or by an application or even by an extension.</p> + +<div class="row topicpage-table"> + <div class="section"><dl><dl><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Accessing_the_Windows_Registry_Using_XPCOm">Accessing the Windows Registry Using XPCOM</a></dt><dd class="landingPageList">When implementing Windows-specific functionality, it is often useful to access the Windows registry for information about the environment or other installed programs. To this end, there exist <a href="/en/XPCOM" title="en/XPCOM">XPCOM</a> interfaces to read and write registry data. This article will show you how to use the available interfaces in several Mozilla products.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Aggregating_the_In-Memory_Datasource">Aggregating the In-Memory Datasource</a></dt><dd class="landingPageList"></dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/already_AddRefed">already_AddRefed</a></dt><dd class="landingPageList"><code>already_AddRefed</code> in association with <code><a href="/en-US/docs/NsCOMPtr">nsCOMPtr</a></code> allows you to assign in a pointer <strong>without</strong> <code>AddRef</code>ing it.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Binary_compatibility">Binary compatibility</a></dt><dd class="landingPageList">If Mozilla decides to upgrade to a compiler that does not have the same ABI as the current version, any built component may fail. It is a possiblity that is introduced when upgrading to a new compiler without recompiling everything. Effectively, it is a different platform.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Bundling_multiple_binary_components">Bundling multiple binary components</a></dt><dd class="landingPageList">Binary XPCOM components are sometimes required to implement low-level features for extensions. Since binary components are linked against a single Gecko SDK, a dependency to a particular version of Gecko is created. If the component uses only "frozen" XPCOM interfaces, there is a good chance the same binary component will work with different versions of Gecko (version 1.8 and 1.9, for example). The more likely case is that the component uses "unfrozen" interfaces and those interfaces can change between Gecko versions. This can create a difficult situation for extension developers trying to support multiple Gecko versions (Firefox 2 and 3, for example).</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Creating_a_Python_XPCOM_component">Creating a Python XPCOM component</a></dt><dd class="landingPageList"><a href="http://books.mozdev.org/html"><em>Creating Applications with Mozilla</em></a> already provides <a href="http://books.mozdev.org/html/mozilla-chp-8-sect-2.html">a tutorial</a> for making a simple JavaScript or C++ component (implementing the <code>nsISimple</code> interface). Here is how to make the same component in Python using <a href="/en-US/docs/PyXPCOM" title="PyXPCOM">PyXPCOM</a>.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Fun_with_XBL_and_XPConnect">Fun With XBL and XPConnect</a></dt><dd class="landingPageList"></dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Generating_GUIDs">Generating GUIDs</a></dt><dd class="landingPageList"><strong>GUID</strong>s are used in Mozilla programming for identifying several types of entities, including XPCOM <a href="/en-US/docs/Interfaces">Interfaces</a> (this type of GUIDs is callled IID), components (CID), and legacy add-ons—like <a href="/en-US/docs/Extensions">extensions</a> and <a href="/en-US/docs/Themes">themes</a>—that were created prior to Firefox 1.5. <a href="/en-US/docs/Install_Manifests#id">Add-ons can (and should) be identified with IDs of the form <code><var>extensionname</var>@<var>organization</var>.<var>tld</var></code></a> since <a href="/en-US/docs/Firefox_1.5_for_developers">Firefox 1.5</a>.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Generic_factory">Generic factory</a></dt><dd class="landingPageList">Most XPCOM factories can be very simple. Rick Potts wrote a templated-based generic factory (nsFactory<t>) that simplifies the factory creation process that just requires writing a CreateInstance() method. The new nsIGenericFactory interface takes this a step further, by providing a single interface that can be reused anytime a simple implementation of nsIFactory is needed. Here is the interface, and a description of its use.</t></dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/How_to_build_a_binary_XPCOM_component_using_Visual_Studio">How to build a binary XPCOM component using Visual Studio</a></dt><dd class="landingPageList">This is a simple tutorial for building XPCOM objects in C++ using Visual Studio. XPCOM is Mozilla’s cross platform component object model, similar to Microsoft’s COM technology. XPCOM components can be implemented in C, C++, and JavaScript, and can be used from C, C++, and JavaScript. That means you can call JavaScript methods from C++ and vice versa. For more information on the workings of XPCOM look <a href="en/XPCOM">elsewhere</a>.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/How_to_pass_an_XPCOM_object_to_a_new_window">How To Pass an XPCOM Object to a New Window</a></dt><dd class="landingPageList">If you want to be able to call functions within an XPCOM object from a XUL window's code, you can do so if you pass the XPCOM object as one of the arguments to the window creation method.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Interfacing_with_the_XPCOM_cycle_collector">Interfacing with the XPCOM cycle collector</a></dt><dd class="landingPageList">This is a quick overview of the cycle collector introduced into XPCOM for Firefox 3, including a description of the steps involved in modifying an existing C++ class to participate in XPCOM cycle collection. If you have a class that you think is involved in a cyclical-ownership leak, this page is for you.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Introduction_to_XPCOM_for_the_DOM">Introduction to XPCOM for the DOM</a></dt><dd class="landingPageList">Warning: this document has not yet been reviewed by the DOM gurus, it might contain some errors.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Language_Bindings">Language bindings</a></dt><dd class="landingPageList">An <strong>XPCOM Language Binding</strong> is a bridge between a particular language and <a href="/en/XPCOM" title="en/XPCOM">XPCOM</a> to provide access to XPCOM objects from that language, and to let modules written in that language be used as XPCOM objects by all other languages for which there are XPCOM bindings.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Monitoring_HTTP_activity">Monitoring HTTP activity</a></dt><dd class="landingPageList">Gecko includes the <code><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIHttpActivityObserver" title="">nsIHttpActivityObserver</a></code> interface, which you can implement in your code to monitor <a href="/en/HTTP" title="en/HTTP">HTTP</a> transactions in real time, receiving a callback as the transactions take place.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/nsCOMPtr_versus_RefPtr">nsCOMPtr versus RefPtr</a></dt><dd class="landingPageList">Gecko code uses both <code>nsCOMPtr</code> and <code>RefPtr</code> as smart pointers. This guide provides some explanation and advice on how to choose between them.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Observer_Notifications">Observer Notifications</a></dt><dd class="landingPageList">The following are topics that you can observe during the course of an application. Unless otherwise noted you register for the topics using the <code><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIObserverService" title="">nsIObserverService</a></code>.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Setting_HTTP_request_headers">Setting HTTP request headers</a></dt><dd class="landingPageList"><a href="/en-US/docs/HTTP">HTTP</a> is one of the core technologies behind the Web. In addition to the actual content, <a href="/en-US/docs/HTTP/Headers">some important information</a> is passed with HTTP headers for both HTTP requests and responses.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Storage">Storage</a></dt><dd class="landingPageList"><strong>Storage</strong> is a <a class="external" href="http://www.sqlite.org/">SQLite</a> database API. It is available to trusted callers, meaning extensions and Firefox components only.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/The_Thread_Manager">The Thread Manager</a></dt><dd class="landingPageList">The Thread Manager, introduced in Firefox 3, offers an easy to use mechanism for creating threads and dispatching events to them for processing.</dd></dl></dl></div> + <div class="section"><dl><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Troubleshooting_XPCOM_components_registration">Troubleshooting XPCOM components registration</a></dt><dd class="landingPageList">Often the first time you create an XPCOM component, it may fail to register correctly.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Using_nsCOMPtr">Using nsCOMPtr</a></dt><dd class="landingPageList">This document is the sum total of everything written down about <code>nsCOMPtr</code>. If you have a question about <code>nsCOMPtr</code>, and this document doesn't answer it, there probably isn't a document that answers it. You'll have to turn to <a class="external" href="news:mozilla.dev.tech.xpcom">the XPCOM newsgroup</a> or another experienced <code>nsCOMPtr</code> user, or find the answer by experimentation.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Using_nsIClassInfo">Using nsIClassInfo</a></dt><dd class="landingPageList">If you use a C++ class which implements <code>nsIClassInfo</code> from JavaScript, then you don't have to explicitly call <code>QueryInterface</code> on the JavaScript object to access the object's interfaces.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Using_nsIDirectoryService">Using nsIDirectoryService</a></dt><dd class="landingPageList">nsDirectoryService implements the <code><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIProperties" title="">nsIProperties</a></code> interface. This implementation will allow you to <code>Get()</code>, <code>Set()</code>, <code>Define()</code>, and <code>Undefine()</code> <code><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIFile" title="">nsIFile</a></code>.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Using_nsIPasswordManager">Using nsIPasswordManager</a></dt><dd class="landingPageList">Technical review completed.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Using_nsISimpleEnumerator">Using nsISimpleEnumerator</a></dt><dd class="landingPageList"></dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Using_the_clipboard">Using the clipboard</a></dt><dd class="landingPageList">This section provides information about cutting, copying, and pasting to and from the clipboard.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Using_the_Gecko_SDK">Using the Gecko SDK</a></dt><dd class="landingPageList"></dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Weak_reference">Weak reference</a></dt><dd class="landingPageList">In <a href="/en-US/docs/XPCOM">XPCOM</a>, a <strong>weak reference</strong> is a special object that contains a pointer to an XPCOM object, but does<em>not</em> keep that object alive. If the referent object is destroyed before the weak reference, the pointer inside the weak reference is set to <code>nsnull</code>.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Working_with_multiple_versions_of_interfaces">Working with Multiple Versions of Interfaces</a></dt><dd class="landingPageList">In this short note we illustrate how one can update an XPCOM module in +order for it to work in both Firefox 2 and Firefox 3, even if the interfaces have +changed in the interim.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Working_with_out_parameters">Working with out parameters</a></dt><dd class="landingPageList"></dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/wrappedJSObject">wrappedJSObject</a></dt><dd class="landingPageList"><code>wrappedJSObject</code> is a property sometimes available on <a href="en/XPConnect">XPConnect</a> wrappers. When available, it lets you access the JavaScript object hidden by the wrapper.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/XPCOM_ABI">XPCOM ABI</a></dt><dd class="landingPageList"><a href="/en/XPCOM" title="en/XPCOM">XPCOM</a> <abbr title="Application Binary Interface">ABI</abbr> is the binary interface of XPCOM components. While XPCOM components written in a scripting language (such as <a href="/en/JavaScript" title="en/JavaScript">JavaScript</a>) can be moved across platforms (such as Windows and OS X) without adaptation, those written in a compiled language (such as C++) require recompilation when moving to a different platform. Often, compiled XPCOM components are called 'binary' or 'native'.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/XPCOM_category_image-sniffing-services">XPCOM category image-sniffing-services</a></dt><dd class="landingPageList">In versions of Firefox prior to Firefox 3, extensions could add decoders for new image types. However, such decoders relied on servers sending correct MIME types; images sent with incorrect MIME types would not be correctly displayed.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Glue">XPCOM glue</a></dt><dd class="landingPageList">The XPCOM Glue is a static library which component developers and embedders can link against. It allows developers to link only against the frozen XPCOM method symbols and maintain compatibility with multiple versions of XPCOM.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Guide">XPCOM guide</a></dt><dd class="landingPageList">These articles provide tutorials and usage documentation for XPCOM, including how to use it in your own projects and how to build XPCOM components for your Firefox add-ons and the like.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/XPCOM_ownership_guidelines">XPCOM ownership guidelines</a></dt><dd class="landingPageList">...naturally. If you create a temporary object, obviously it's up to you to destroy it. That's a sure sign of ownership. If you create an object with a longer lifespan, you will own it until you give ownership away.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference">XPCOM reference</a></dt><dd class="landingPageList">This reference describes the interfaces and functions provided by the <a href="/en-US/docs/Mozilla/Tech/XPCOM">XPCOM</a> library. In addition, it details the various helper classes and functions, as well as the components, provided by the <a href="/en-US/docs/Mozilla/Tech/XPCOM/Glue">XPCOM glue</a> library. The contents herein are oriented primarily toward extension developers and people embedding XPCOM in other projects.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/XPCOM_tasks">XPCOM tasks</a></dt><dd class="landingPageList">The XPCOM module roughly parallels the C/C++ standard libraries. It overlaps them significantly, but goes beyond them in capabilities. XPCOM sits above the standard libraries. Its role is to extend them with facilities tailored to XPCOM development in general, and specifically the needs of Mozilla. Like the standard libraries, XPCOM must be a fairly self-contained library, so as not to encumber clients with any unnecessary external dependencies.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Thread_synchronization">XPCOM Thread Synchronization</a></dt><dd class="landingPageList">XPCOM thread synchronization primitives have the same semantics as those in NSPR, and each method of these synchronization objects (e.g. <code>Mutex::Lock()</code>) has a matching function in NSPR (<code>PR_Lock()</code>). This is no accident, as mozilla:: primitives are merely bare-minimum wrappers around NSPR's.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/xptcall_FAQ">xptcall FAQ</a></dt><dd class="landingPageList"><code>xptcall</code> is a small low level XPCOM method call library. It is implemented using platform specific C/C++ and assembly language code. It is used to facilitate cross language and cross thread method calls. Porting this code is required in order to make Mozilla run on any given platform.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/xptcall_porting_guide">Xptcall Porting Guide</a></dt><dd class="landingPageList">Original Author: John Bandhauer, 31 May 1999.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/xptcall_porting_status">Xptcall Porting Status</a></dt><dd class="landingPageList">This is a status page for the multiplatform porting of xptcall. xptcall has a <a href="/En/Xptcall_FAQ">FAQ</a> and a <a href="/En/Xptcall_Porting_Guide">Porting Guide</a>.</dd></dl></div> + </div> + +<div class="blockIndicator communitybox" dir="ltr"> + + <div class="column-container"> + <h2 id="Join_the_XPCOM_community">Join the XPCOM community</h2> + <div class="column-half"> + <div class="communitysubhead">Choose your preferred method for joining the discussion:</div> + <ul class="communitymailinglist"> + <li><a href="https://lists.mozilla.org/listinfo/dev-tech-xpcom">Mailing list</a></li> + + + <li><a href="http://groups.google.com/group/mozilla.dev.tech.xpcom">Newsgroup</a></li> + <li><a href="http://groups.google.com/group/mozilla.dev.tech.xpcom/feeds">RSS feed</a></li> +</ul> + </div> + <div class="column-half"> + <ul class="communitycontact"><li><strong>IRC: </strong><a href="irc://irc.mozilla.org/developers">#developers</a> <span class="smaller">(<a href="https://wiki.mozilla.org/IRC">learn more</a>)</span></li><li><strong>Tools: </strong><a href="http://ted.mielczarek.org/code/mozilla/jscomponentwiz/">JavaScript Component Wizard</a>, <a href="http://www.mytools360.com-a.googlepages.com/home#XPComPro">Visual C++ Component Wizard</a>, <a href="http://www.yutools.com/wp/tools/yuxpcomwizard/?lang=en">Visual C++ Component Wizard for Visual Studio 2010</a>, <a href="https://addons.mozilla.org/en-US/firefox/addon/xpcomviewer/">XPCOMViewer addon: browse XPCOM interfaces easily</a></li></ul> + </div> + </div> +</div> + +<section id="Quick_Links"><ol><li><a href="http://www.ibm.com/developerworks/library/os-xpcomfirefox/">Tutorial from IBM DeveloperWorks</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Creating_Custom_Firefox_Extensions_with_the_Mozilla_Build_System">Binary components tutorial</a></li><li><a href="http://www.iosart.com/firefox/xpcom/">Linux and Windows how-to guide</a></li><li><a href="http://starkravingfinkle.org/blog/2006/10/mozilla-platform-xpcom-in-c/">Windows example blog post</a></li><li><a href="http://wanderingstan.com/2007-11-16/geekout_how_to_make_a_c_xpcom_component">Another Windows example</a></li><li><a href="http://rcrowley.org/2007/07/17/cross-platform-xpcom-a-howto.html">Mac OS X example</a></li><li><a href="/en-US/docs/Web/JavaScript" title="JavaScript (JS) is a lightweight interpreted or JIT-compiled programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat.">JavaScript</a></li></ol></section> diff --git a/files/pt-pt/mozilla/tech/xpcom/reference/glue_classes/index.html b/files/pt-pt/mozilla/tech/xpcom/reference/glue_classes/index.html new file mode 100644 index 0000000000..e98aa51571 --- /dev/null +++ b/files/pt-pt/mozilla/tech/xpcom/reference/glue_classes/index.html @@ -0,0 +1,13 @@ +--- +title: XPCOM glue classes +slug: Mozilla/Tech/XPCOM/Reference/Glue_classes +tags: + - Classes + - Landing + - NeedsTranslation + - TopicStub + - XPCOM +translation_of: Mozilla/Tech/XPCOM/Reference/Glue_classes +--- +<p><span class="seoSummary">These "glue" classes are provided to make it easier to use XPCOM from C++ code.</span> When these classes are used by a component, you may need to link the component against the XPCOM glue library.</p> +<p>{{LandingPageListSubpages}}</p> diff --git a/files/pt-pt/mozilla/tech/xpcom/reference/index.html b/files/pt-pt/mozilla/tech/xpcom/reference/index.html new file mode 100644 index 0000000000..29d07953d6 --- /dev/null +++ b/files/pt-pt/mozilla/tech/xpcom/reference/index.html @@ -0,0 +1,27 @@ +--- +title: XPCOM reference +slug: Mozilla/Tech/XPCOM/Reference +tags: + - Add-ons + - Extensions + - Landing + - Mozilla + - NeedsTranslation + - Reference + - TopicStub + - XPCOM +translation_of: Mozilla/Tech/XPCOM/Reference +--- +<p>This reference describes the interfaces and functions provided by the <a href="/en-US/docs/Mozilla/Tech/XPCOM">XPCOM</a> library. In addition, it details the various helper classes and functions, as well as the components, provided by the <a href="/en-US/docs/Mozilla/Tech/XPCOM/Glue">XPCOM glue</a> library. The contents herein are oriented primarily toward extension developers and people embedding XPCOM in other projects.</p> + +<div class="warning"> +<p><strong>WebExtensions are becoming the new standard for creating add-ons. </strong>Eventually support for XPCOM add-ons will be deprecated, so you should begin to investigate porting your add-ons to use the <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions">WebExtensions</a> API, and <a href="https://mzl.la/webext-feature-needed">report any missing functionality</a> so we can be sure to address your concerns. Work is ongoing on WebExtension capabilities, so your input will help prioritize and plan the work. To learn more about the kinds of changes that will be needed, see <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Comparison_with_XUL_XPCOM_extensions">Comparison with XUL/XPCOM extensions</a>. In addition, any binaries you use will then need to be converted for use with the WebExtensions <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_messaging">native messaging</a> API, or compiled using <a href="https://webassembly.github.io/">WebAssembly</a> or <a href="/en-US/docs/Mozilla/Projects/Emscripten">Emscripten</a>.</p> +</div> + +<div class="note"> +<p>If you're working on a module in the Mozilla codebase that's compiled with the <code>MOZILLA_INTERNAL_API</code> flag set, some of these APIs -- the string functions and classes in particular -- are not the ones you should be using. See the <a href="/en-US/docs/Mozilla/Tech/XPCOM/Guide/Internal_strings">XPCOM internal string guide</a> for documentation of the internal string API used within the Mozilla codebase.</p> +</div> + +<p>{{LandingPageListSubpages}}</p> + +<p>Many XPCOM pages return an <code><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference/Core_functions/nsresult">nsresult</a></code>. Prior to Gecko 19 {{geckoRelease(19)}}, this was an integer that simply returned an error code. It is now a strongly typed <code>enum</code> when XPCOM is built using a C++11 compiler. This causes compile-time errors to occur when improper values are returned as nsresult values, thereby making it easier to catch many bugs.</p> diff --git a/files/pt-pt/mozilla/tech/xul/attribute/textbox.type/index.html b/files/pt-pt/mozilla/tech/xul/attribute/textbox.type/index.html new file mode 100644 index 0000000000..e30799ed4b --- /dev/null +++ b/files/pt-pt/mozilla/tech/xul/attribute/textbox.type/index.html @@ -0,0 +1,5 @@ +--- +title: textbox.type +slug: Mozilla/Tech/XUL/Attribute/textbox.type +--- +<p>no redirect</p> diff --git a/files/pt-pt/mozilla/thunderbird/autoconfiguration/fileformat/como/index.html b/files/pt-pt/mozilla/thunderbird/autoconfiguration/fileformat/como/index.html new file mode 100644 index 0000000000..06056d13df --- /dev/null +++ b/files/pt-pt/mozilla/thunderbird/autoconfiguration/fileformat/como/index.html @@ -0,0 +1,243 @@ +--- +title: 'Configuração automática: Como criar um ficheiro de configuração' +slug: Mozilla/Thunderbird/Autoconfiguration/FileFormat/Como +tags: + - Configuração Automática + - thunderbird +translation_of: Mozilla/Thunderbird/Autoconfiguration/FileFormat/HowTo +--- +<h2 id="Definição">Definição</h2> + +<p><a class="link-https" href="https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat" title="https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat">Authoritative definition</a></p> + +<h2 id="Exemplo">Exemplo</h2> + +<p><a class="link-https" href="https://live.mozillamessaging.com/autoconfig/v1.1/freenet.de" title="https://live.mozillamessaging.com/autoconfig/v1.1/freenet.de">Exemplo do mundo real</a></p> + +<pre><?xml version="1.0" encoding="UTF-8"?> + +<<span class="start-tag">clientConfig</span><span class="attribute-name"> version</span>=<span class="attribute-value">"1.1"</span>> + <<span class="start-tag">emailProvider</span><span class="attribute-name"> id</span>=<span class="attribute-value">"freenet.de"</span>> + <<span class="start-tag">domain</span>>freenet.de</<span class="end-tag">domain</span>> + <<span class="start-tag">displayName</span>>Freenet Mail</<span class="end-tag">displayName</span>> + <<span class="start-tag">displayShortName</span>>Freenet</<span class="end-tag">displayShortName</span>> + <<span class="start-tag">incomingServer</span><span class="attribute-name"> type</span>=<span class="attribute-value">"imap"</span>> + <<span class="start-tag">hostname</span>>imap.freenet.de</<span class="end-tag">hostname</span>> + <<span class="start-tag">port</span>>993</<span class="end-tag">port</span>> + <<span class="start-tag">socketType</span>>SSL</<span class="end-tag">socketType</span>> + <<span class="start-tag">authentication</span>>password-encrypted</<span class="end-tag">authentication</span>> + <<span class="start-tag">username</span>>%EMAILADDRESS%</<span class="end-tag">username</span>> + </<span class="end-tag">incomingServer</span>> + <<span class="start-tag">incomingServer</span><span class="attribute-name"> type</span>=<span class="attribute-value">"imap"</span>> + <<span class="start-tag">hostname</span>>imap.freenet.de</<span class="end-tag">hostname</span>> + <<span class="start-tag">port</span>>143</<span class="end-tag">port</span>> + <<span class="start-tag">socketType</span>>STARTTLS</<span class="end-tag">socketType</span>> + <<span class="start-tag">authentication</span>>password-encrypted</<span class="end-tag">authentication</span>> + <<span class="start-tag">username</span>>%EMAILADDRESS%</<span class="end-tag">username</span>> + </<span class="end-tag">incomingServer</span>> + <<span class="start-tag">incomingServer</span><span class="attribute-name"> type</span>=<span class="attribute-value">"pop3"</span>> + <<span class="start-tag">hostname</span>>pop.freenet.de</<span class="end-tag">hostname</span>> + <<span class="start-tag">port</span>>995</<span class="end-tag">port</span>> + <<span class="start-tag">socketType</span>>SSL</<span class="end-tag">socketType</span>> + <<span class="start-tag">authentication</span>>password-cleartext</<span class="end-tag">authentication</span>> + <<span class="start-tag">username</span>>%EMAILADDRESS%</<span class="end-tag">username</span>> + </<span class="end-tag">incomingServer</span>> + <<span class="start-tag">incomingServer</span><span class="attribute-name"> type</span>=<span class="attribute-value">"pop3"</span>> + <<span class="start-tag">hostname</span>>pop.freenet.de</<span class="end-tag">hostname</span>> + <<span class="start-tag">port</span>>110</<span class="end-tag">port</span>> + <<span class="start-tag">socketType</span>>STARTTLS</<span class="end-tag">socketType</span>> + <<span class="start-tag">authentication</span>>password-cleartext</<span class="end-tag">authentication</span>> + <<span class="start-tag">username</span>>%EMAILADDRESS%</<span class="end-tag">username</span>> + </<span class="end-tag">incomingServer</span>> + <<span class="start-tag">outgoingServer</span><span class="attribute-name"> type</span>=<span class="attribute-value">"smtp"</span>> + <<span class="start-tag">hostname</span>>smtp.freenet.de</<span class="end-tag">hostname</span>> + <<span class="start-tag">port</span>>587</<span class="end-tag">port</span>> + <<span class="start-tag">socketType</span>>SSL</<span class="end-tag">socketType</span>> + <<span class="start-tag">authentication</span>>password-encrypted</<span class="end-tag">authentication</span>> + <<span class="start-tag">username</span>>%EMAILADDRESS%</<span class="end-tag">username</span>> + </<span class="end-tag">outgoingServer</span>> + <<span class="start-tag">outgoingServer</span><span class="attribute-name"> type</span>=<span class="attribute-value">"smtp"</span>> + <<span class="start-tag">hostname</span>>smtp.freenet.de</<span class="end-tag">hostname</span>> + <<span class="start-tag">port</span>>587</<span class="end-tag">port</span>> + <<span class="start-tag">socketType</span>>STARTTLS</<span class="end-tag">socketType</span>> + <<span class="start-tag">authentication</span>>password-encrypted</<span class="end-tag">authentication</span>> + <<span class="start-tag">username</span>>%EMAILADDRESS%</<span class="end-tag">username</span>> + </<span class="end-tag">outgoingServer</span>> + <<span class="start-tag">documentation</span><span class="attribute-name"> url</span>=<span class="attribute-value">"http://kundenservice.freenet.de/hilfe/email/programme/config/index.html"</span>> + <<span class="start-tag">descr</span><span class="attribute-name"> lang</span>=<span class="attribute-value">"de"</span>>Allgemeine Beschreibung der Einstellungen</<span class="end-tag">descr</span>> + <<span class="start-tag">descr</span><span class="attribute-name"> lang</span>=<span class="attribute-value">"en"</span>>Generic settings page</<span class="end-tag">descr</span>> + </<span class="end-tag">documentation</span>> + <<span class="start-tag">documentation</span><span class="attribute-name"> url</span>=<span class="attribute-value">"http://kundenservice.freenet.de/hilfe/email/programme/config/thunderbird/imap-thunderbird/imap/index.html"</span>> + <<span class="start-tag">descr</span><span class="attribute-name"> lang</span>=<span class="attribute-value">"de"</span>>TB 2.0 IMAP-Einstellungen</<span class="end-tag">descr</span>> + <<span class="start-tag">descr</span><span class="attribute-name"> lang</span>=<span class="attribute-value">"en"</span>>TB 2.0 IMAP settings</<span class="end-tag">descr</span>> + </<span class="end-tag">documentation</span>> + </<span class="end-tag">emailProvider</span>> +</<span class="end-tag">clientConfig</span>> +</pre> + +<h2 id="Como_examinar_os_servidores_de_correio_eletrónico">Como examinar os servidores de correio eletrónico</h2> + +<p>To determine a server's capabilities, you can contact the server directly and talk the POP/IMAP/SMTP protocol manually (assuming you already know the hostname).<br> + For non-SSL, use <strong><code>netcat -v <em>hostname</em> <em>port</em></code></strong> (preferred) or <code>telnet <em>hostname</em> <em>port</em></code> as "client".</p> + +<ul> + <li>POP3, port 110: when you see <code>+OK WEB.DE POP3-Server</code> or similar, enter <code><strong>CAPA</strong></code>, hit return.</li> + <li>IMAP, port 143: when you see <code>* OK mwinf2j04 IMAP4 server ready</code> or similar, enter <code><strong>1 CAPABILITY</strong></code>, hit return.</li> + <li>SMTP, port 587 or 25: when you see <code>220 mail.gmx.net GMX Mailservices ESMTP</code> or similar, enter <code><strong>EHLO example.net</strong></code>, hit return.</li> +</ul> + +<p>In all cases, the server should respond with a list of capabilities.</p> + +<h2 id="SSL_STARTTLS">SSL / STARTTLS</h2> + +<p>There are 2 SSL variants: normal SSL and STARTTLS.</p> + +<h3 id="SSL_normal">SSL normal</h3> + +<p>The old-style SSL (including TLS, which is just the new name for SSL) has a special port:</p> + +<ul> + <li>POP3 via SSL: port 995</li> + <li>IMAP via SSL: port 993</li> + <li>SMTP via SSL: port 465</li> +</ul> + +<p>On Linux, you can contact the server via</p> + +<pre><strong>openssl s_client -connect <em>hostname</em>:<em>port</em></strong></pre> + +<p>You should see output about the SSL handshake and the certificate. Important is what is listed as "CN=". This must be the same as the hostname that you contacted, otherwise the certificate is not valid (or you need to use another hostname).<br> + If you see nothing, then probably the server does not support SSL.<br> + After that, you can have the same protocol exchange as with netcat on standard ports, as listed above.</p> + +<h3 id="STARTTLS">STARTTLS</h3> + +<p>STARTTLS is a special, new form of SSL, which works on the standard ports (e.g. port 143 for IMAP). You can contact the server via netcat as mentioned above. If you see "STARTTLS" (for IMAP, SMTP) or "STLS" (for POP) listed as one of the capabilities, the server should support STARTTLS.<br> + To try it out, on Linux, you can contact the server via</p> + +<pre>openssl s_client -connect <em>hostname</em>:<em>port</em> -starttls <em>proto</em></pre> + +<p>...where "proto" is <code>imap</code>, <code>pop3</code> or <code>smtp</code>. For example:</p> + +<pre><strong>openssl s_client -connect <em>imap.example.com</em>:<em>143</em> -starttls <em>imap</em></strong></pre> + +<p>You should get the same response as described above for openssl.</p> + +<h3 id="Formato_do_ficheiro_de_configuração">Formato do ficheiro de configuração</h3> + +<p>Add the appropriate port and socket type for each server, depending on protocol and SSL support. For example,<br> + for IMAP with SSL:</p> + +<pre><port>993<port> + +<socketType>SSL</socketType></pre> + +<p>for IMAP with STARTTLS:</p> + +<pre><port>143<port> +<socketType>STARTTLS</socketType></pre> + +<p>for IMAP without any SSL (deprecated!):</p> + +<pre><port>143<port> + +<socketType>plain</socketType></pre> + +<h3 id="Utilizar_SSL">Utilizar SSL</h3> + +<p>Please do not submit or serve any configurations without SSL! There's no reason in 2010 why users still need to read mail entirely unprotected.<br> + If you are an ISP and think the server load is too high, try adding an SSL accelerator. They are cheap and widely used. In fact, even most freemail (!) providers these days support SSL, so if users pay you money for ISP service, that's all the more reason to give them proper service. But first simply try to enable software SSL - small servers may be fine with SSL and without any additional installations.</p> + +<h3 id="Certificado_válido">Certificado válido</h3> + +<p>Either way, be sure to use a valid certificate:</p> + +<ul> + <li>issued by a CA recognized by Firefox / Thunderbird</li> + <li>not expired</li> + <li>the CN in the cert must match the hostname that Thunderbird contacts and that is listed as <hostname> in the configuration file. If they don't match, Thunderbird must assume that the user may be under attack, otherwise the SSL guarantees no longer hold. Thunderbird either warns the user or ignores the server. (Note that you can get certificates for free these days, for example from startssl.com.)</li> +</ul> + +<h2 id="Autenticação">Autenticação</h2> + +<p><span class="external free">Probe the mail server, as explained above for STARTTLS.</span> If you see <code>CRAM-MD5</code> or <code>APOP</code> in the response, the server should support encrypted passwords. If you <em>only</em> see <code>AUTH</code> <code>LOGIN</code> and/or <code>PLAIN</code>, or no <code>AUTH</code> at all, the server probably does not support secure authentication. In the former case, select "Encrypted passwords" as "Authentication method" (in Thunderbird Account Settings UI, incoming server and SMTP server), and test whether you can actually log in with a real account (because some servers are unfortunately broken with regards to authentication, often due to a wrong or misconfigured SASL installation).</p> + +<h3 id="Formato_do_ficheiro_de_configuração_2">Formato do ficheiro de configuração</h3> + +<p>In the configuration file, for each IMAP, POP and SMTP server, you need to specify the authentication method.<br> + <br> + For plaintext passwords:</p> + +<pre><authentication>password-cleartext</authentication></pre> + +<p>For CRAM-MD5:</p> + +<pre><authentication>password-encrypted</authentication></pre> + +<p><br> + Discouraged settings (SMTP only):<br> + If the SMTP server can only be used after checking incoming mail, please use</p> + +<pre><authentication>smtp-after-pop</authentication></pre> + +<p>Note that RFC 4409 disallows that and requires the customer-facing SMTP server to support proper authentication via AUTH.<br> + If the SMTP server can only be used within the ISP's network, and requires no authentication, use:</p> + +<pre><authentication>client-IP-address</authentication></pre> + +<p>or, if it requires authentication in addition to the user being in the ISP network, use e.g.:</p> + +<pre><authentication>password-cleartext</authentication> + +<restriction>client-IP-address</restriction> +</pre> + +<p>However, that means that users on the road or in the office are unable to send mail, which is a real problem for many of our users. This violates RFC 4409 as well and is an outdated configuration. Please try find a configuration that works in all cases, for the sake of the users.</p> + +<h3 id="Por_favor_suporte_as_palavras-passe_MD5">Por favor, suporte as palavras-passe MD5</h3> + +<p>Please support authentication with CRAM-MD5. It is simple to implement, and to set up, and you can still use RADIUS or a database that stores passwords in plaintext, so you don't need to make changes to your mail server or authentication infrastructure apart from installing some software and configuring it correctly. CRAM-MD5 is particularly important when no SSL is used: Never make users send their passwords in plaintext over the network! (Not even in your ISP network.) We warn users in the Mail Account Creation dialog about such insecure configurations, and we reserve the right to block them in the future.<br> + <br> + <span class="external free">As an ISP, you should ideally store passwords in encrypted format, which removes the risk of mass password theft (and possibly reuse on other sites) if somebody hacks your servers. You can still support plaintext passwords in this case, and encrypt passwords on the fly before comparing. (Users who use plaintext passwords would still be somewhat exposed, but at least you don't have the risk of the whole plaintext password database being stolen.) You can use both plaintext and encrypted authentication transmission with plaintext or encrypted password databases - the two issues are independent.</span></p> + +<h2 id="Nome_de_utilizador">Nome de utilizador</h2> + +<p>If the user's IMAP login name is the same as his email address (for example, if "<a class="link-mailto" href="mailto:fred@example.com" rel="freelink">fred@example.com</a>" is the login name), add:</p> + +<pre><username>%EMAILADDRESS%</username></pre> + +<p><span class="external free">Note: Use</span> %EMAILADDRESS% as literal. Thunderbird will replace it with the email address that the user entered. Same for %EMAILLOCALPART% and other placeholders.</p> + +<p><span class="external free">If the login name is the same as the first segment before the @ of the email address (for example, "fred" for "<a class="link-mailto" href="mailto:fred@example.com" rel="freelink">fred@example.com</a>"), use:</span></p> + +<pre><username>%EMAILLOCALPART%</username></pre> + +<h3 id="Pseudónimos_ou_nome_de_utilziador_não_são_parte_do_endereço_de_e-mail">Pseudónimos, ou nome de utilziador não são parte do endereço de e-mail</h3> + +<p><span class="external free">Note that the above must be true for any email address that the user would set up - even for aliases.<br> + <br> + You can ignore aliases like info@, if that's an alias for fred@ (or both fred@ and wilma@) and Fred would set up <a class="link-mailto" href="mailto:fred@example.com" rel="freelink">fred@example.com</a> in Thunderbird, not info@.<br> + <br> + If, however, Fred can set up <a class="link-mailto" href="mailto:hero@example.com" rel="freelink">hero@example.com</a> as alias for <a class="link-mailto" href="mailto:fred@example.com" rel="freelink">fred@example.com</a>, and neither "hero" nor "<a class="link-mailto" href="mailto:hero@example.com" rel="freelink">hero@example.com</a>" would work as login name on your IMAP server, you need to set up a lookup of alias -> username on your autoconfig server. So, if you get a request for <<a class="external" href="http://autoconfig.example.com/mail/config-v1.1.xml?emailaddress=hero@example.com" rel="freelink">http://autoconfig.example.com/mail/c...ro@example.com</a>>, your autconfig server must have a script which responds to /mail/config-v1.1.xml and returns the concrete username, for example:</span></p> + +<pre><username>fred</username></pre> + +<p>... (or <username><a class="link-mailto" href="mailto:fred@example.com" rel="freelink">fred@example.com</a></username>, as appropriate) for <a class="link-mailto" href="mailto:hero@example.com" rel="freelink">hero@example.com</a>. This is the only way to enable automatic configuration without users having to remember what their primary login name was, which is a serious problem in practical experience. Even if you have told them all the necessary information in your welcome letter, they usually cannot find the letter. That's exactly where autoconfiguration tries to help.</p> + +<h2 id="Ativar_visiturl">Ativar visiturl</h2> + +<p>Some providers do not provide IMAP or POP service by default, but require it to be enabled via a web UI. If that is the case, add the URL that a logged-in user would use into this field, and the application can prompt the user to visit it.</p> + +<p>This is <a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=586364" title="https://bugzilla.mozilla.org/show_bug.cgi?id=586364">not yet supported</a> by Thunderbird 3.1, but should be in the future, so please add this critical information where it applies.</p> + +<p>If you are an ISP, please by all means avoid this. It's one of those "walls" against which users run the hard way.</p> + +<h2 id="URL_da_documentação">URL da documentação</h2> + +<p>If the configuration is (partially) based on a help webpage of the ISP that describes the configuration that end users should use, you can record its URL here. You may add several of them, as several elements. It is for informational purposes only and mainly for the maintenance of the config file, the client currently does not use them at all.</p> + +<div class="syntaxbox">If your URL contains ampersands (<code>&</code>), please remember to replace them with HTML entities (<code>&amp;</code>). For example:</div> + +<pre><<span class="start-tag">documentation</span><span class="attribute-name"> url</span>="http://example.com/help.php?client=thunderbird<span style="color: #b22222;"><strong>&amp;</strong></span>lang=en"/></pre> + +<div class="syntaxbox">Otherwise your XML file will be incorrect and Thunderbird will neither be able to parse it, nor to return any error message.</div> diff --git a/files/pt-pt/mozilla/thunderbird/autoconfiguration/fileformat/definicao/index.html b/files/pt-pt/mozilla/thunderbird/autoconfiguration/fileformat/definicao/index.html new file mode 100644 index 0000000000..2df3fcc731 --- /dev/null +++ b/files/pt-pt/mozilla/thunderbird/autoconfiguration/fileformat/definicao/index.html @@ -0,0 +1,6 @@ +--- +title: Definição do formato de ficheiro da configuração automática +slug: Mozilla/Thunderbird/Autoconfiguration/FileFormat/Definicao +translation_of: Mozilla/Thunderbird/Autoconfiguration/FileFormat/Definition +--- +<p>Por favor, consulte <a href="https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat" class="link-https" title="https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat">https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat</a> (inglês).</p> diff --git a/files/pt-pt/mozilla/thunderbird/autoconfiguration/fileformat/index.html b/files/pt-pt/mozilla/thunderbird/autoconfiguration/fileformat/index.html new file mode 100644 index 0000000000..76a90f2777 --- /dev/null +++ b/files/pt-pt/mozilla/thunderbird/autoconfiguration/fileformat/index.html @@ -0,0 +1,10 @@ +--- +title: Autoconfig file format +slug: Mozilla/Thunderbird/Autoconfiguration/FileFormat +tags: + - NeedsTranslation + - TopicStub +translation_of: Mozilla/Thunderbird/Autoconfiguration/FileFormat +--- +<ul> <li><a href="/en/Thunderbird/Autoconfiguration/FileFormat/HowTo" title="en/Thunderbird/Autoconfiguration/FileFormat/HowTo">How to create a config file</a></li> <li><a href="/en/Thunderbird/Autoconfiguration/FileFormat/Definition" title="en/Thunderbird/Autoconfiguration/FileFormat/Definition">File format definition</a></li> +</ul> diff --git a/files/pt-pt/mozilla/thunderbird/configuracao_automática/index.html b/files/pt-pt/mozilla/thunderbird/configuracao_automática/index.html new file mode 100644 index 0000000000..f0a647cc98 --- /dev/null +++ b/files/pt-pt/mozilla/thunderbird/configuracao_automática/index.html @@ -0,0 +1,162 @@ +--- +title: Configuração Automática no Thunderbird +slug: Mozilla/Thunderbird/Configuracao_automática +tags: + - Administração + - empresa +translation_of: Mozilla/Thunderbird/Autoconfiguration +--- +<p>Autor: Ben Bucksch<br> + Por favor, não altere este documento sem consultar o autor.</p> + +<p>Thunderbird 3.1 and later (and 3.0 to some degree) includes mail account autoconfiguration functionality. The goal of autoconfiguration is to make it very easy for users to configure the connection of Thunderbird to their email servers. In many cases, people should be able to download and install Thunderbird, enter their real name, email address and password in the Account Setup Wizard and have a fully functioning mail client and get and send their mail as securely as possible.</p> + +<p>Consulte também:</p> + +<ul> + <li>the <a class="link-https" href="https://wiki.mozilla.org/Thunderbird:Autoconfiguration" title="https://wiki.mozilla.org/Thunderbird:Autoconfiguration">project page on the Mozilla wiki</a> for background, design, implementation and project details</li> + <li>for instructions for users, see <a class="external" href="http://support.mozillamessaging.com/en-US/kb/Automatic-Account-Configuration" title="http://support.mozillamessaging.com/en-US/kb/Automatic+Account+Configuration">Automatic Account Configuration</a> on the Thunderbird Knowledge Base.</li> + <li>the configuration file <a href="/en/Thunderbird/Autoconfiguration/FileFormat/HowTo" title="en/Thunderbird/Autoconfiguration/FileFormat/HowTo">description</a> and <a href="https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat" title="en/Thunderbird/Autoconfiguration/FileFormat/Definition">definition</a></li> +</ul> + +<p>This document describes how Autoconfiguration in Thunderbird works, and what to do to allow mail servers to be autoconfigured.</p> + +<h1 id="Mecanismos">Mecanismos</h1> + +<p>Thunderbird gets the server settings via different means, each of which is intended for different cases:</p> + +<ul> + <li>ISPDB<br> + The ISPDB is a central database, currently hosted by Mozilla Messaging, but free to use for any client. It contains settings for the world's largest ISPs. We hope that the database will soon have enough information to autoconfigure approximately 50% of our user's email accounts.<br> + It was added merely because we cannot assume that all big ISPs (including Microsoft) will immediately set up a configuration server for Thunderbird.</li> + <li>Configuration server at ISP<br> + ISPs have the option to provide their configuration information themselves directly to users, by setting up a web server at autoconfig.<domain>, which simply returns a static XML file with the configuration, as described below. For more complicated setups, for example when the login name does not appear in the email address, the XML file can also be generated by the ISP. In such complicated cases, this is the only way to allow an automatic setup.</li> + <li>Configuration file on harddisk<br> + Administrators may place a configuration file in the Thunderbird installation folder. This is mainly intended for companies who install Thunderbird on their employees' computers and want to enable easy account setup without having to set up a configuration server. This method is not practical for other use cases, because it is difficult to update the configuration file. Therefore, public ISPs should use a configuration server.</li> + <li>Guessing<br> + If all other mechanisms failed, Thunderbird tries to guess the configuration, by trying common server names like imap.<domain>, smtp.<domain>, mail.<domain> etc., and, when a mail server answers, checking whether it supports SSL, STARTTLS and encrypted passwords (CRAM-MD5).</li> + <li>Manual configuration<br> + If guessing fails the user must manually enter the configuration information. Users may also manually modify the account settings even if configuration information is successfully obtained by the methods described above.</li> +</ul> + +<p>All the lookup mechanisms use the email address domain as base for the lookup. For example, for the email address <a class="moz-txt-link-abbreviated link-mailto" href="mailto:fred@example.com">fred@example.com</a> , the lookup is performed as (in this order):</p> + +<ol> + <li><em>tb-install-dir</em>/isp/example.com.xml on the harddisk</li> + <li>check for autoconfig.example.com</li> + <li>look up of "example.com" in the ISPDB</li> + <li>look up "MX example.com" in DNS, and for mx1.mail.hoster.com, look up "hoster.com" in the ISPDB</li> + <li>try to guess (imap.example.com, smtp.example.com etc.)</li> +</ol> + +<p>We may add DNS SRV records as supported mechanism in the future, but we currently do not.</p> + +<h1 id="Como_adicionar_suporte_para_o_seu_domínio">Como adicionar suporte para o seu domínio</h1> + +<h2 id="Classificação">Classificação</h2> + +<p>If you are a big ISP (> 100,000 users) providing email addresses solely under a few domains like "example.com" and "example.de", you may either submit the configuration to the ISPDB or set up a configuration server.<br> + <br> + If you support email aliases and the user's login name is not part of the email address (for example, users may have <a class="moz-txt-link-rfc2396E link-mailto" href="mailto:hero@example.com">"hero@example.com"</a> as email address, but the IMAP/POP/SMTP login name is neither "hero" nor <a class="moz-txt-link-rfc2396E link-mailto" href="mailto:hero@example.com">"hero@example.com"</a>, but "u67578"), you need to set up a configuration server, which does the email address -> login name lookup.<br> + <br> + If you host customer domains, i.e. you are "hoster.com", but your customers have <a class="moz-txt-link-rfc2396E link-mailto" href="mailto:fred@flintstone.com">"fred@flintstone.com"</a> and <a class="moz-txt-link-rfc2396E link-mailto" href="mailto:louis@kent.com">"louis@kent.com"</a> as domains, with only a few users per domain, you need to set up a configuration server (or rely on DNS MX).<br> + <br> + If you are a small company installing Thunderbird on your employees' desktops, you can place a configuration file in the Thunderbird installation folder.</p> + +<h2 id="ISPDB">ISPDB</h2> + +<p>Database URL is <a class="moz-txt-link-rfc2396E link-https" href="https://live.mozillamessaging.com/autoconfig/v1.1/" title="https://live.mozillamessaging.com/autoconfig/v1.1/"><https://live.mozillamessaging.com/autoconfig/v1.1/></a>, append domain name, e.g. <a class="moz-txt-link-rfc2396E link-https" href="https://live.mozillamessaging.com/autoconfig/v1.1/freenet.de" title="https://live.mozillamessaging.com/autoconfig/v1.1/freenet.de"><https://live.mozillamessaging.com/autoconfig/v1.1/freenet.de></a>.<br> + <br> + Current process: File a bug in <a class="link-https" href="https://bugzilla.mozilla.org/enter_bug.cgi?product=Webtools&component=ISPDB%20Database%20Entries&op_sys=All&rep_platform=All">Bugzilla</a>, Product "Webtools", Component "ISPDB Database Entries", with a configuration file that matches the requirements described below. The component is actively watched for new bugs (as of November 2015) so there is no need to request review on the file.</p> + +<h2 id="Configuração_do_servidor_no_ISP">Configuração do servidor no ISP</h2> + +<p>Given the email address <a class="moz-txt-link-rfc2396E link-mailto" href="mailto:fred@example.com">"fred@example.com"</a>, Thunderbird first checks <<span class="external free"><a class="moz-txt-link-freetext external" href="http://autoconfig.example.com/mail/config-v1.xml?emailaddress=fred@example.com">http://autoconfig.example.com/mail/config-v1.1.xml?emailaddress=fred@example.com</a></span>> and then <a class="moz-txt-link-rfc2396E external" href="http://example.com/.well-known/autoconfig/mail/config-v1.1.xml" title="http://example.com/.well-known/autoconfig/mail/config-v1.1.xml"><http://example.com/.well-known/autoconfig/mail/config-v1.1.xml></a>.</p> + +<h3 id="Empresa_pequena">Empresa pequena</h3> + +<p>If you are a small company, you can put the XML configuration file on your web server, at URL <a class="moz-txt-link-rfc2396E external" href="http://example.com/.well-known/autoconfig/mail/config-v1.1.xml"><http://example.com/.well-known/autoconfig/mail/config-v1.1.xml></a>. (This is not yet finalized and subject to change.)</p> + +<h3 id="Hospedeiro_do_domínio">Hospedeiro do domínio</h3> + +<p>If you are an ISP that hosts domains for your customers - for example, you are hoster.com and your customer registers fancy.com or example.com, and your servers accept and serve the mail for example.com -, you should set up an autoconfig server.</p> + +<h4 id="DNS">DNS</h4> + +<p>For each customer domain, you add a DNS record (in addition to the existing MX, A www etc. DNS records):<br> + <code>autoconfig IN A 10.2.3.4</code><br> + or<br> + <code>autoconfig IN CNAME autoconfig.hoster.com</code>.<br> + ... where 10.2.3.4 and autoconfig.hoster.com are IP addresses / hostnames you own.<br> + This allows Thunderbird to find you as hoster.</p> + +<p>To make the Version without an autoconfig DNS Entry work you have to make sure that example.com points to the Webserver you will place the config-v1.1.xml on.</p> + +<p>Example: <span style="font-family: courier new,andale mono,monospace; line-height: normal;">example.com A 10.2.3.4</span></p> + +<h4 id="Servidor_da_Web">Servidor da Web</h4> + +<p>You set up a web server bound to a physical IP address. This may be on the same machine as other web servers, but the web server must be configured to the content to any requested domain.<br> + <br> + You must use a virtual host that match all autoconfig.* domains of your customers. In Apache terms, you can use a "ip-based virtual host". In the Apache configuration files, that means something like: Listen 10.2.3.4:80 (of course, you use a public IP address that you own)</p> + +<pre><VirtualHost 10.2.3.4:80> #Must be the first and only virtual host with this ip! + DocumentRoot /var/www/autoconfig/ + ServerName autoconfig.hoster.com + <Directory /var/www/autoconfig> + Order allow,deny + allow from all + </Directory> +</VirtualHost></pre> + +<p>Place the configuration file at the URL /mail/config-v1.1.xml on that host.</p> + +<p>All config files must be served as <code>Content-Type: text/xml</code> (or <code>application/xml</code>), otherwise the file will be ignored. Also, they must use charset UTF-8 (esp. if there are any non-ASCII-characters).</p> + +<p>If you like to use name-based virtual hosts you probably don't want to setup the autoconfig subdomain for every domain of your customers.<br> + You can add a Rewriterule in the default virtual host (on debian /etc/apache2/sites-enabled/000-default) to match all autoconfig.* subdomains:</p> + +<pre><VirtualHost *:80> #Must be the first Virtual host + ServerAdmin webmaster@hoster.com + ServerName www + DocumentRoot /var/www + RewriteEngine On + RewriteCond %{HTTP_HOST} ^autoconfig\. [NC] + RewriteRule ^/(.*) http://autoconfig.hoster.com/$1 [L,R=301,NE] + #... +</VirtualHost> +<VirtualHost *:80> + DocumentRoot /var/www/autoconfig/ + ServerName autoconfig.hoster.com + <Directory /var/www/autoconfig> + Order allow,deny + allow from all + </Directory> +</VirtualHost> +</pre> + +<p>If you use nginx, you can easily add a subdomain to all your Domains, which does the same as above. Either, you can redirect them to a common hostname:</p> + +<pre>server { + listen 10.2.3.4:80; #use your server's public IP here! + server_name autoconfig.*; + return 301 http://autoconfig.hoster.com$request_uri; +} +</pre> + +<p>Or serve them directly from a common directory:</p> + +<pre>server { + listen 10.2.3.4:80; #again, use your server's public IP here! + server_name autoconfig.*; + location / { + root /var/www/autoconfig; + } +} +</pre> + +<p> </p> + +<h2 id="Ficheiro_de_configuração">Ficheiro de configuração</h2> + +<p>Isto é descrito em <a href="/pt-PT/docs/Mozilla/Thunderbird/Autoconfiguration/FileFormat/Como" title="en/Thunderbird/Autoconfiguration/FileFormat/HowTo">Como criar um ficheiro de configuração</a> e <a href="/pt-PT/docs/Mozilla/Thunderbird/Autoconfiguration/FileFormat/Definicao" title="en/Thunderbird/Autoconfiguration/FileFormat/Definition">definido</a> nas sub páginas.</p> diff --git a/files/pt-pt/mozilla/thunderbird/index.html b/files/pt-pt/mozilla/thunderbird/index.html new file mode 100644 index 0000000000..0ca93f176b --- /dev/null +++ b/files/pt-pt/mozilla/thunderbird/index.html @@ -0,0 +1,69 @@ +--- +title: Thunderbird +slug: Mozilla/Thunderbird +tags: + - NeedsTranslation + - TopicStub + - thunderbird +translation_of: Mozilla/Thunderbird +--- +<p><span class="seoSummary"><strong>Thunderbird</strong> is Mozilla's mail/messaging application. These pages document Thunderbird and also provide links to documentation about the <a href="/en-US/docs/tag/MailNews" title="tag/MailNews">MailNews</a> backend which is also used in other projects such as <a href="http://wiki.mozilla.org/Penelope">Eudora/Penelope</a>, <a href="http://www.seamonkey-project.org/">Seamonkey</a>, <a href="http://www.mozillazine.org/talkback.html?article=22774">Correo</a>, etc.</span></p> + +<p>Thunderbird is Firefox's kid sibling, and is built on the same technical platform as the web browser. In development for many years, and currently one of the most popular open source email clients, it is used by millions of people around the world to bring together all their email accounts, newsgroup and feed reading in a familiar high-productivity environment. (From early 2007 to early 2011 Thunderbird was developed by <a class="link-https" href="https://en.wikipedia.org/wiki/Mozilla_Messaging" title="https://en.wikipedia.org/wiki/Mozilla_Messaging">Mozilla Messaging</a>, a subsidiary that was owned by Mozilla.)</p> + +<table class="topicpage-table"> + <tbody> + <tr> + <td> + <h2 class="Documentation" id="Documentation" name="Documentation">Documentation</h2> + + <dl> + <dt><a href="https://developer.mozilla.org/en-US/docs/Simple_Thunderbird_build" title="Simple Thunderbird build">Building Thunderbird</a></dt> + <dd>Information about building Thunderbird with the <a href="/en-US/docs/comm-central" title="comm-central">comm-central</a> repository. There's also information about <a href="/en-US/docs/How_comm-central%27s_build_system_works" title="How_comm-central's_build_system_works">how comm-central works</a>, how the <a href="/en-US/docs/Mailnews_and_Mail_code_review_requirements" title="Mailnews and Mail code review requirements">review process works</a> and how to use the <a href="/en-US/docs/Using_the_Mozilla_symbol_server" title="Using the Mozilla symbol server">Mozilla symbol server</a> to help with debugging.</dd> + <dt><a href="/en-US/docs/MailNews_Protocols" title="MailNews_Protocols">MailNews Protocols</a></dt> + <dd>Rough documentation about mail protocols..</dd> + <dt><a href="/en-US/docs/DB_Views_%28message_lists%29" title="DB_Views_(message_lists)">Database views</a></dt> + <dd>Backend information about {{ Interface("nsIMsgDBView") }} and related interfaces..</dd> + <dt><a href="/en-US/docs/Thunderbird/Thunderbird_API_documentation" title="Thunderbird API documentation">Thunderbird API documentation</a></dt> + <dd><a href="/en-US/docs/Thunderbird/Thunderbird_API_documentation" title="Thunderbird API documentation">Thunderbird API documentation</a></dd> + <dt><a href="/en-US/docs/Extensions/Thunderbird" title="Extensions/Thunderbird/">Extension documentation</a></dt> + <dd>Tutorials and tips for building Thunderbird extensions</dd> + <dt><a href="/en-US/docs/Thunderbird/Thunderbird_Automated_Testing" title="Thunderbird Automated Testing">Automated Testing</a></dt> + <dd>Details of Thunderbird's automated testing facilities</dd> + <dt><a href="/en-US/docs/Thunderbird/Thunderbird_in_the_Enterprise" title="Thunderbird in the Enterprise">Thunderbird in the Enterprise</a></dt> + <dd>Help with deploying Thunderbird in large organizations</dd> + </dl> + + <p><span class="alllinks"><a href="/en-US/docs/tag/Thunderbird" title="tag/Thunderbird">View All...</a></span></p> + </td> + <td> + <h2 class="Community" id="Community" name="Community">Community</h2> + + <ul> + <li>Support is handled at <a href="https://support.mozilla.org/en-US/products/thunderbird">Mozilla Support</a></li> + <li>Extensions questions are frequently discussed on the dev-apps-thunderbird group: {{ DiscussionList("dev-apps-thunderbird", "mozilla.dev.apps.thunderbird") }}</li> + <li>Development discussion happens on the tb-planning mailing list: + <ul> + <li><a class="link-https" href="https://mail.mozilla.org/listinfo/tb-planning" title="https://mail.mozilla.org/listinfo/tb-planning">subscribe</a></li> + <li><a class="link-https" href="https://mail.mozilla.org/pipermail/tb-planning/" title="https://mail.mozilla.org/pipermail/tb-planning/">archives</a></li> + </ul> + </li> + <li><a href="http://forums.mozillazine.org/viewforum.php?f=50">Mozillazine forums</a></li> + <li><a href="http://www.mozillamessaging.com/">Mozilla Messaging web page</a></li> + <li><a class="link-irc" href="irc://irc.mozilla.org/thunderbird">#thunderbird on irc.mozilla.org</a> (for Users)</li> + <li><a class="link-irc" href="irc://irc.mozilla.org/maildev">#maildev on irc.mozilla.org</a> (for Developers)</li> + <li>a list of all <a href="http://wiki.mozilla.org/Thunderbird/CommunicationChannels" title="Thunderbird communication channels">Thunderbird communication channels</a></li> + </ul> + + <h2 class="Tools" id="Tools" name="Tools">Tools</h2> + + <ul> + <li><a href="http://ted.mielczarek.org/code/mozilla/extensiondev/">Extension developer's extension</a></li> + <li><a href="/en-US/docs/DOM_Inspector" title="DOM_Inspector">DOM Inspector</a></li> + </ul> + </td> + </tr> + </tbody> +</table> + +<p> </p> diff --git a/files/pt-pt/mozilla/thunderbird/lancamentos/index.html b/files/pt-pt/mozilla/thunderbird/lancamentos/index.html new file mode 100644 index 0000000000..354a6d7335 --- /dev/null +++ b/files/pt-pt/mozilla/thunderbird/lancamentos/index.html @@ -0,0 +1,19 @@ +--- +title: Thunderbird - Notas de lançamento de programador +slug: Mozilla/Thunderbird/Lancamentos +tags: + - Landing + - Lançamento + - Mozilla + - thunderbird +translation_of: Mozilla/Thunderbird/Releases +--- +<p class="summary">Esta página fornece hiperligações para os artigos do "Thunderbird X para programadores" para cada lançamento do Thunderbird. Estas notas deixam-no ver quais as funcionalidades que foram adicionadas e os erros eliminados em cada versão do Thunderbird.</p> + +<div class="multiColumnList">{{ListSubpages("/pt-PT/docs/Mozilla/Thunderbird/Releases",1,1,1)}}</div> + +<h2 class="multiColumnList" id="Ver_também">Ver também</h2> + +<ul> + <li><a href="/pt-PT/docs/Mozilla/Firefox/Releases">Firefox - Notas de lançamento do programador</a></li> +</ul> diff --git a/files/pt-pt/mozilla/trabalhar_com_janelas_no_codigo_chrome/index.html b/files/pt-pt/mozilla/trabalhar_com_janelas_no_codigo_chrome/index.html new file mode 100644 index 0000000000..a3f012eb7a --- /dev/null +++ b/files/pt-pt/mozilla/trabalhar_com_janelas_no_codigo_chrome/index.html @@ -0,0 +1,397 @@ +--- +title: Trabalhar com janelas no código chrome +slug: Mozilla/trabalhar_com_janelas_no_codigo_chrome +tags: + - Add-ons + - Extensões + - Extras + - Guía +translation_of: Mozilla/Working_with_windows_in_chrome_code +--- +<p>Este artigo descreve o trabalho com várias janelas no código da Mozilla (aplicações <a href="/en-US/docs/XUL" title="XUL">XUL</a> e <a href="/en-US/docs/Extensions" title="Extensions">Extensões</a>). Este contém dicas e código exemplo em como abrir novas janelas, encontrar uma janela já aberta, e passar dados entre diferentes janelas.</p> + +<h2 id="Opening_windows" name="Opening_windows">Abertura de janelas</h2> + +<h3 id="From_a_<script>_in_a_window_or_an_overlay">From a <script> in a window or an overlay</h3> + +<p>To open a new window, we usually use a <code><a href="/en-US/docs/DOM/window.open" title="DOM/window.open">window.open</a></code> or <code><a href="/en-US/docs/DOM/window.openDialog" title="DOM/window.openDialog">window.openDialog</a></code> DOM call, like this:</p> + +<div style="overflow: hidden;"> +<pre class="brush:js;auto-links:false;">var win = window.open("chrome://myextension/content/about.xul", + "aboutMyExtension", "chrome,centerscreen"); +</pre> +</div> + +<p>The first parameter to <code>window.open</code> is the URI of the XUL file that describes the window and its contents.</p> + +<p>The second parameter is the window's name; the name can be used in links or forms as the <code>target</code> attribute. This is different from the user-visible window title, which is specified using XUL.</p> + +<p>The third, and optional, parameter is a list of special window features the window should have.</p> + +<p>The <code>window.openDialog</code> function works similarly, but lets you specify optional arguments that can be referenced from the JavaScript code. It also handles window features a little differently, including always assuming the <code>dialog</code> feature is specified.</p> + +<h3 id="From_XPCOM_components_and_modules">From XPCOM components and modules</h3> + +<p>If the <code>Window</code> object is unavailable (for example, when opening a window from XPCOM component code), you might want to use <a href="/en-US/docs/XPCOM_Interface_Reference/nsIWindowWatcher" title="nsIWindowWatcher">nsIWindowWatcher</a> interface. Its parameters are similar to <code>window.open</code>; in fact, <code>window.open</code>'s implementation calls <code>nsIWindowWatcher</code>'s methods.</p> + +<div style="overflow: hidden;"> +<pre class="brush:js;auto-links:false;">var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"] + .getService(Components.interfaces.nsIWindowWatcher); +var win = ww.openWindow(null, "chrome://myextension/content/about.xul", + "aboutMyExtension", "chrome,centerscreen", null);</pre> +</div> + +<h2 id="Window_object" name="Window_object">Objeto de janela</h2> + +<p>Note the <code>win</code> variable in the above section, which is assigned the return value of <code>window.open</code>. It can be used to access the opened window. The return value of <code>window.open</code> (and similar methods) is a <code>Window</code> object (usually <code>ChromeWindow</code>) – the same type as the <code>window</code> variable.</p> + +<p>Technically speaking, it implements a number of interfaces, including {{ interface("nsIDOMJSWindow") }} and {{ interface("nsIDOMWindow") }}, but it also contains the user-defined properties for global variables and functions of the window. So, for example, to access the DOM document corresponding to the window, you can use <code><a href="/en-US/docs/DOM/window.document" title="DOM/window.document">win.document</a></code>.</p> + +<p>Note however, that the <code>open()</code> call returns <em>before</em> the window is fully loaded, so some calls, like <code><a href="/en-US/docs/DOM/document.getElementById" title="DOM/document.getElementById">win.document.getElementById()</a></code> will fail. To overcome this difficulty, you can move the initialization code to a <code>load</code> handler of the window being opened or pass a callback function, as described <a href="#callback">below</a>.</p> + +<p>You can get a <code>Window</code> object from a document using <code><a href="/en-US/docs/DOM/document.defaultView" title="DOM/document.defaultView">document.defaultView</a></code>.</p> + +<h2 id="Content_windows" name="Content_windows">Janelas de conteúdo</h2> + +<p>When a XUL window contains a widget capable of displaying a page, such as <code><browser></code> or <code><iframe></code>, the document in that widget is, naturally, separate from the document of the chrome window itself. There also is a <code>Window</code> object for each sub-document, although there's no window in a common sense for the sub-document.</p> + +<p>The same holds for chrome windows opened inside a tab of <code><tabbrowser></code>. The elements above the chrome document opened in the tab are separate from your chrome document.</p> + +<p>The following two subsections describe how to cross chrome-content boundaries in either way, i.e. accessing elements which are ancestors of your chrome document, or accessing elements which are descendants of your chrome document (but nevertheless in a different context).</p> + +<h3 id="Accessing_content_documents" name="Accessing_content_documents">Accessing content documents</h3> + +<p>Assume you have a document loaded in a <code><tabbrowser></code>, <code><browser></code>, or <code><iframe></code> element inside your document. You can use <code>browser.contentDocument</code> to access that document and <code>browser.contentWindow</code> to access the <code>Window</code> object of that document.</p> + +<p>You should be aware of <a href="/en-US/docs/XPCNativeWrapper" title="XPCNativeWrapper">XPCNativeWrappers</a> when working with <a href="/en-US/docs/XPCNativeWrapper#What_is_a_trusted_window.3F" title="XPCNativeWrapper#What_is_a_trusted_window.3F">untrusted content</a>. With XPCNativeWrappers turned on (which is the default in Firefox 1.5+), your extension can safely access the DOM of the content document, but not the content JavaScript. Bypassing XPCNativeWrapper to work with content JavaScript directly can lead to security problems.</p> + +<p>See <a href="/en-US/docs/Code_snippets/Interaction_between_privileged_and_non-privileged_pages" title="Code_snippets/Interaction_between_privileged_and_non-privileged_pages">Interaction between privileged and non-privileged pages</a> if you need to interact with the content page.</p> + +<h4 id="The_content_shortcut" name="The_content_shortcut">The <code>content</code> shortcut</h4> + +<p>In case of <code><browser type="content-primary" /></code>, you can use the <a href="/en-US/docs/DOM/window.content" title="DOM/window.content">content</a> shortcut property to accesss the <code>Window</code> object of the content document. For example:</p> + +<pre class="brush:js">// alerts the title of the document displayed in the content-primary widget + +alert(content.document.title);</pre> + +<p>For example, you can use <code>content.document</code> in a <code>browser.xul</code> overlay to access the web page in the selected tab in a Firefox window.</p> + +<div class="note">Some examples use <code>_content</code> instead of <code>content</code>. The former has been deprecated for a while, and you should use <code>content</code> in the new code.</div> + +<h3 id="Accessing_a_document_in_the_sidebar" name="Accessing_a_document_in_the_sidebar">Accessing a document in the sidebar</h3> + +<p>Firefox has a sidebar, which is implemented as a <code><browser></code> element with id="sidebar". To access the elements and variables inside the sidebar, you need to use <code>document.getElementById("sidebar").contentDocument</code> or <code>.contentWindow</code>, like when {{ Anch("Accessing content documents") }}.</p> + +<p>For more sidebar tips, see <a href="/en-US/docs/Code_snippets/Sidebar" title="Code_snippets/Sidebar">Code snippets:Sidebar</a>.</p> + +<h3 id="Accessing_the_elements_of_the_top-level_document_from_a_child_window" name="Accessing_the_elements_of_the_top-level_document_from_a_child_window">Accessing the elements of the top-level document from a child window</h3> + +<p>The opposite case is when you want to access the chrome document from a privileged script loaded in a <code><browser></code> or an <code><iframe></code>.</p> + +<p>A typical case when this can be useful is when your code runs in the sidebar in the main Firefox window and you want to access the elements in the main browser window.</p> + +<p>The DOM tree, as shown by the <a href="/en-US/docs/DOM_Inspector" title="DOM_Inspector">DOM Inspector</a>, can look like this:</p> + +<pre>#document + window main-window + ... + browser + #document + window myExtensionWindow +</pre> + +<p>where the child window is where your code runs in.</p> + +<p>Your task is to access elements above your chrome document, i.e. to break out of your chrome window and access the ancestors. This can be done using the following statement:</p> + +<pre class="brush:js">var mainWindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor) + .getInterface(Components.interfaces.nsIWebNavigation) + .QueryInterface(Components.interfaces.nsIDocShellTreeItem) + .rootTreeItem + .QueryInterface(Components.interfaces.nsIInterfaceRequestor) + .getInterface(Components.interfaces.nsIDOMWindow);</pre> + +<p>This allows you to cross the chrome-content boundaries, and returns the main window object.</p> + +<h2 id="Finding_already_opened_windows" name="Finding_already_opened_windows">Encontrar janelas já abertas</h2> + +<p>The window mediator XPCOM component (<a href="/en-US/docs/XPCOM_Interface_Reference/nsIWindowMediator" title="nsIWindowMediator">nsIWindowMediator</a> interface) provides information about existing windows. Two of its methods are often used to obtain information about currently open windows: <code>getMostRecentWindow</code> and <code>getEnumerator</code>. Please refer to the <a href="/en-US/docs/XPCOM_Interface_Reference/nsIWindowMediator" title="nsIWindowMediator">nsIWindowMediator</a> page for more information and examples of using <code>nsIWindowMediator</code>. <span class="comment">=== Example: Opening a window only if it's not opened already === XXX TBD</span></p> + +<h2 id="Passing_data_between_windows" name="Passing_data_between_windows">Passar dados entre janelas</h2> + +<p>When working with multiple windows, you often need to pass information from one window to another. Since different windows have separate DOM documents and global objects for scripts, you can't just use one global JavaScript variable in scripts from different windows.</p> + +<p>There are several techniques of varying power and simplicity that can be used to share data. We'll demonstrate them from the simplest to the most complex in the next few sections.</p> + +<p>Note: if you want to pass data between privileged (chrome) and non-privileged (web page) windows, or vice-versa, <a href="/en-US/docs/Code_snippets/Interaction_between_privileged_and_non-privileged_pages" title="Code snippets/Interaction between privileged and non-privileged pages">read this instead.</a></p> + +<h3 id="Example_1:_Passing_data_to_window_when_opening_it_with_openDialog" name="Example_1:_Passing_data_to_window_when_opening_it_with_openDialog">Example 1: Passing data to window when opening it with <code>openDialog</code></h3> + +<p>When you open a window using <code><a href="/en-US/docs/DOM/window.openDialog" title="DOM/window.openDialog">window.openDialog</a></code> or <code>nsIWindowWatcher.openWindow</code>, you can pass an arbitrary number of <em>arguments</em> to that window. Arguments are simple JavaScript objects, accessible through <code><a href="/en-US/docs/DOM/window.arguments" title="DOM/window.arguments">window.arguments</a></code> property in the opened window.</p> + +<p>In this example, we're using <code>window.openDialog</code> to open a progress dialog. We pass in the current status text as well as the maximum and current progress values. Note that using <code>nsIWindowWatcher.openWindow</code> is a bit less trivial . <span class="comment">TODO: link to <a href="/en-US/docs/How_To_Pass_an_XPCOM_Object_to_a_New_Window" title="How_To_Pass_an_XPCOM_Object_to_a_New_Window">How To Pass an XPCOM Object to a New Window</a> when it has a more useful example</span></p> + +<p>Opener code:</p> + +<pre class="brush:js">window.openDialog("chrome://test/content/progress.xul", + "myProgress", "chrome,centerscreen", + {status: "Reading remote data", maxProgress: 50, progress: 10} );</pre> + +<p><code>progress.xul</code>:</p> + +<pre class="brush:xml"><?xml version="1.0"?> +<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> + +<window onload="onLoad();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> +<script><![CDATA[ + +var gStatus, gProgressMeter; +var maxProgress = 100; + +function onLoad() { + gStatus = document.getElementById("status"); + gProgressMeter = document.getElementById("progressmeter"); + + if("arguments" in window && window.arguments.length > 0) { + maxProgress = window.arguments[0].maxProgress; + setProgress(window.arguments[0].progress); + setStatus(window.arguments[0].status); + } +} + +function setProgress(value) { + gProgressMeter.value = 100 * value / maxProgress; +} + +function setStatus(text) { + gStatus.value = "Status: " + text + "..."; +} + +]]></script> + +<label id="status" value="(No status)" /> +<hbox> + <progressmeter id="progressmeter" mode="determined" /> + <button label="Cancel" oncommand="close();" /> +</hbox> + +</window></pre> + +<h3 id="Example_2:_Interacting_with_the_opener" name="Example_2:_Interacting_with_the_opener">Example 2: Interacting with the opener</h3> + +<p>Sometimes an opened window needs to interact with its opener; for example, it might do so in order to give notice that the user has made changes in the window. You can find the window's opener using its <a href="/en-US/docs/DOM/window.opener" title="DOM/window.opener">window.opener</a> property or via a callback function passed to the window in a way described in the previous section.</p> + +<p>Let's add code to the previous example to notify the opener when the user presses Cancel on the progress dialog.</p> + +<ul> + <li><strong>Using <code>window.opener</code>.</strong> The <code>opener</code> property returns its window's opener; that is, the {{ Anch("Window object") }} that opened it.</li> +</ul> + +<p>If we're sure the window that opened the progress dialog declares the <code>cancelOperation</code> function, we can use <code>window.opener.cancelOperation()</code> to notify it, like this:</p> + +<pre class="brush:xml;"><button label="Cancel" oncommand="opener.cancelOperation(); close();" /> +</pre> + +<ul> + <li><strong>Using a callback function.</strong> Alternatively, the opener window can pass a callback function to the progress dialog in the same way we passed the status string in the previous example:</li> +</ul> + +<pre class="brush:js">function onCancel() { + alert("Operation canceled!"); +} + +... + +window.openDialog( + "chrome://test/content/progress.xul", + "myProgress", "chrome,centerscreen", + {status: "Reading remote data", maxProgress: 50, progress: 10}, + onCancel +); +</pre> + +<p>The progress dialog can then run the callback like this:</p> + +<pre class="brush:xml;"><button label="Cancel" oncommand="window.arguments[1](); close();" /> +</pre> + +<h3 id="Example_3:_Using_nsIWindowMediator_when_opener_is_not_enough" name="Example_3:_Using_nsIWindowMediator_when_opener_is_not_enough">Example 3: Using <code>nsIWindowMediator</code> when <code>opener</code> is not enough</h3> + +<p>The <code>window.opener</code> property is very easy to use, but it's only useful when you're sure that your window was opened from one of a few well-known places. In more complicated cases you need to use the <code><a href="/en-US/docs/XPCOM_Interface_Reference/nsIWindowMediator" title="nsIWindowMediator">nsIWindowMediator</a></code> interface, introduced above.</p> + +<p>One case in which you might want to use <code>nsIWindowMediator</code> is in an extension's Options window. Suppose you're developing a browser extension that consists of a browser.xul overlay and an Options window. Suppose the overlay contains a button to open the extension's Options window which needs to read some data from the browser window. As you may remember, Firefox's Extension Manager can also be used to open your Options dialog.</p> + +<p>This means the value of <code>window.opener</code> in your Options dialog is not necessarily the browser window -- instead, it might be the Extension Manager window. You could check the <code>location</code> property of the <code>opener</code> and use <code>opener.opener</code> in case it's the Extension Manager window, but a better way is to use <code>nsIWindowMediator</code>:</p> + +<pre class="brush:js;">var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] + .getService(Components.interfaces.nsIWindowMediator); +var browserWindow = wm.getMostRecentWindow("navigator:browser"); +// read values from |browserWindow|</pre> + +<p>You might be tempted to use a similar technique to apply the changes the user made in the Options dialog, but a better way to do that is to use <a href="/en-US/docs/Code_snippets/Preferences#Using_preference_observers" title="Code snippets/Preferences#Using preference observers">preferences observers</a>.</p> + +<h3 id="Example_4_Using_nsIWindowWatcher_when_you_don't_have_a_window_(primitives_only)">Example 4: Using nsIWindowWatcher when you don't have a window (primitives only)</h3> + +<p>For those times when you don't have access to a <code>window</code> object (such as a JavaScript XPCOM object), you can use <a href="/en-US/docs/XPCOM_Interface_Reference/nsIWindowWatcher#openWindow()" title="nsIWindowWatcher#openWindow()"><code>nsIWindowWatcher.openWindow</code></a> to open a XUL window. The problem is passing the data. It's a bit harder than using <code>window.openDialog</code>. Here is helper function that will package the data correctly and pass it to the newly opened window:</p> + +<pre class="brush:js">function openDialog(parentWindow, url, windowName, features) { + var array = Components.classes["@mozilla.org/array;1"] + .createInstance(Components.interfaces.nsIMutableArray); + for (var i = 4; i < arguments.length; i++) { + var variant = Components.classes["@mozilla.org/variant;1"] + .createInstance(Components.interfaces.nsIWritableVariant); + variant.setFromVariant(arguments[i]); + array.appendElement(variant, false); + } + + var watcher = Components.classes["@mozilla.org/embedcomp/window-watcher;1"] + .getService(Components.interfaces.nsIWindowWatcher); + return watcher.openWindow(parentWindow, url, windowName, features, array); +} +</pre> + +<p>The function almost works the same as <code>window.openDialog</code> but accepts an optional parent window as first parameter. The parent window can be null. The only data types that can be passed to the new window are primitives and arrays. JavaScript objects cannot be passed. All of the arguments are passed by value, that is to say that any changes made to the values in the new window will not affect the calling code.</p> + +<h3 id="Example_5_Using_nsIWindowWatcher_for_passing_an_arbritrary_JavaScript_object">Example 5: Using nsIWindowWatcher for passing an arbritrary JavaScript object</h3> + +<p>It is still possible to pass any JavaScript object using nsIWindowWatcher, it just takes a little more effort. In this example a single object is passed, though it is possible to pass multiple objects and primitives using a combination of this and the example above.</p> + +<pre class="brush:js">// In the calling code +var args = { + param1: true, + param2: 42 +}; + +args.wrappedJSObject = args; + +var watcher = Components.classes["@mozilla.org/embedcomp/window-watcher;1"] + .getService(Components.interfaces.nsIWindowWatcher); + +watcher.openWindow(null, url, windowName, features, args);</pre> + +<pre class="brush:js">// In the window code +var args = window.arguments[0].wrappedJSObject; +</pre> + +<p>This uses the <a href="/en-US/docs/wrappedJSObject" title="WrappedJSObject">wrappedJSObject</a> trick. By passing args to openWindow xpconnect will automatically wrap it as a generic nsISupports. The opened window can then just get at the underlying JavaScript object using wrappedJSObject.</p> + +<h2 id="Advanced_data_sharing" name="Advanced_data_sharing">Partilha de dados avançada</h2> + +<p>The above code is useful when you need to pass data from one window to another or to a set of windows, but sometimes you just want to share a JavaScript variable in common between different windows. You could declare a local variable in each window along with corresponding setter functions to keep the "instances" of the variable in sync across windows, but fortunately, there's a better way.</p> + +<p>To declare a shared variable, we need to find a place that exists while the application is running and is easily accessible from the code in different chrome windows. There are actually a few such places.</p> + +<h3 id="Using_JavaScript_code_modules" name="Using_JavaScript_code_modules">Using JavaScript code modules</h3> + +<p><a href="/en-US/docs/JavaScript_code_modules/Using" title="Using_JavaScript_code_modules">JavaScript code modules</a> {{ Fx_minversion_inline(3) }} is a simple method for creating shared global singleton objects that can be imported into any other JavaScript scope. The importing scope will have access to the objects and data in the code module. Since the code module is cached, all scopes get the same instance of the code module and can share the data in the module. See <a href="/en-US/docs/Components.utils.import" title="Components.utils.import">Components.utils.import</a> for more information.</p> + +<ul> + <li>Pros: + <ul> + <li>It's the "right way"</li> + <li>Very simple to make and import.</li> + <li>No need to build an XPCOM component.</li> + </ul> + </li> + <li>Cons: + <ul> + <li>Only works in Firefox 3 or newer.</li> + <li>The scope is shared between modules and the importing scope, so you have to worry about name collisions.</li> + <li>You can't use the <code><a href="/en-US/docs/DOM/window" title="DOM/window">window</a></code> object, its members, like <code>alert</code> and <code>open</code>, and many other objects available from inside a window. The functionality isn't lost, however -- you just have to use the XPCOM components directly instead of using convenient shortcuts. Of course, this doesn't matter if you just store data in the component.</li> + </ul> + </li> +</ul> + +<h3 id="Using_an_XPCOM_singleton_component" name="Using_an_XPCOM_singleton_component">Using an XPCOM singleton component</h3> + +<p>The cleanest and most powerful way to share data is to define your own XPCOM component (you can <a href="/en-US/docs/How_to_Build_an_XPCOM_Component_in_Javascript" title="How_to_Build_an_XPCOM_Component_in_Javascript">write one in JavaScript</a>) and access it from anywhere using a <code>getService</code> call:</p> + +<pre class="brush:js">Components.classes["@domain.org/mycomponent;1"].getService(); +</pre> + +<ul> + <li>Pros: + <ul> + <li>It's the "right way".</li> + <li>You can store arbitrary JavaScript objects in the component.</li> + <li>The scope is not shared between components, so you don't have to worry about name collisions.</li> + <li>Works in older versions of Firefox.</li> + </ul> + </li> + <li>Cons: + <ul> + <li>You can't use the <code><a href="/en-US/docs/DOM/window" title="DOM/window">window</a></code> object, its members, like <code>alert</code> and <code>open</code>, and many other objects available from inside a window. The functionality isn't lost, however -- you just have to use the XPCOM components directly instead of using convenient shortcuts. Of course, this doesn't matter if you just store data in the component.</li> + <li>Learning to create XPCOM components takes time.</li> + </ul> + </li> +</ul> + +<p>There are several articles and books about creating XPCOM components online.</p> + +<h3 id="Using_FUEL_Application_object" name="Using_FUEL_Application_object">Using FUEL Application object</h3> + +<div class="warning"> +<p>The FUEL library has been deprecated as of Firefox 41</p> +</div> + +<p>The <a href="/en-US/docs/Toolkit_API/FUEL">FUEL</a> JavaScript library {{ Fx_minversion_inline(3) }} has a simple method for sharing data between windows. The <code>Application</code> object supports a <a href="/en-US/docs/Toolkit_API/extISessionStorage"><code>storage</code></a> property which can be used to store data globally. This method is a simplified form of the XPCOM singleton method.</p> + +<pre class="brush:js">Application.storage.set(keyname, data); + +var data = Application.storage.get(keyname, default); + +where: keyname is a string used to identify the data + data is the data + default is the data value to return if keyname does not exists +</pre> + +<ul> + <li>Pros: + <ul> + <li>Its the "right way".</li> + <li>You can store arbitrary JavaScript objects in the component.</li> + <li>The scope is not shared between components, so you don't have to worry about name collisions.</li> + <li>No need to build an XPCOM component.</li> + </ul> + </li> + <li>Cons: + <ul> + <li>Only works in Firefox 3 or newer.</li> + <li>You can't use the <code><a href="/en-US/docs/DOM/window" title="DOM/window">window</a></code> object, its members, like <code>alert</code> and <code>open</code>, and many other objects available from inside a window. The functionality isn't lost, however -- you just have to use the XPCOM components directly instead of using convenient shortcuts. Of course, this doesn't matter if you just store data in the component.</li> + </ul> + </li> +</ul> + +<h3 id="Storing_shared_data_in_preferences" name="Storing_shared_data_in_preferences">Storing shared data in preferences</h3> + +<p>If you just need to store a string or a number, writing a whole XPCOM component may be an unnecessary complication. You can use the <a class="external" href="http://www.xulplanet.com/references/xpcomref/ifaces/nsIPrefService.html">preferences service</a> in such cases.</p> + +<ul> + <li>Pros: + <ul> + <li>Quite easy to use for storing simple data.</li> + </ul> + </li> + <li>Cons: + <ul> + <li>Can't easily be used to store complex data.</li> + <li>Abusing the preferences service and not cleaning up after yourself can cause <code>prefs.js</code> to grow large and slow down application startup.</li> + </ul> + </li> +</ul> + +<p>See <a href="/en-US/docs/Code_snippets/Preferences" title="Code_snippets/Preferences">Code snippets:Preferences</a> for detailed description of the preferences system and example code.</p> + +<p>Example:</p> + +<pre class="brush:js">var prefs = Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefService); +var branch = prefs.getBranch("extensions.myext."); +var var1 = branch.getBoolPref("var1"); // get a pref</pre> + +<h2 id="See_also" name="See_also">Consulte também</h2> + +<ul> + <li><a href="/en-US/docs/Code_snippets/Dialogs_and_Prompts" title="Code_snippets/Dialogs_and_Prompts">Code snippets:Dialogs</a></li> +</ul> diff --git a/files/pt-pt/mozilla/utilização_cxx_no_código_da_mozilla/index.html b/files/pt-pt/mozilla/utilização_cxx_no_código_da_mozilla/index.html new file mode 100644 index 0000000000..02ec29e2a2 --- /dev/null +++ b/files/pt-pt/mozilla/utilização_cxx_no_código_da_mozilla/index.html @@ -0,0 +1,552 @@ +--- +title: Utilização de C++ no código da Mozilla +slug: Mozilla/Utilização_CXX_no_código_da_Mozilla +translation_of: Mozilla/Using_CXX_in_Mozilla_code +--- +<h2 id="Caraterísticas_da_linguagem_C">Caraterísticas da linguagem C++</h2> + +<p>Mozilla code only uses a subset of C++. Runtime type information (RTTI) is disabled, as it tends to cause a very large increase in codesize. This means that <code>dynamic_cast</code>, <code>typeid()</code> and <code><typeinfo></code> cannot be used in Mozilla code. Also disabled are exceptions; do not use <code>try</code>/<code>catch</code> or throw any exceptions. Libraries that throw exceptions may be used if you are willing to have the throw instead be treated as an abort.</p> + +<p>As of Mozilla 25, C++11 mode is required to build Mozilla. As of Mozilla 37, MSVC 2013 Update 3 is required on Windows; as of Mozilla 38, gcc 4.7 is required on all platforms. As of Mozilla 48, gcc 4.8 is required on all platforms. This means that C++11 can be used where supported on all platforms. The list of acceptable features is given below:</p> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col"> </th> + <th scope="col">MSVC</th> + <th scope="col">GCC</th> + <th scope="col">Clang</th> + <th scope="col"> </th> + </tr> + <tr> + <td>Requisito mínimo atual</td> + <td>2013</td> + <td>4.8</td> + <td>3.4</td> + <td> </td> + </tr> + <tr> + <th scope="col">Funcionalidade</th> + <th scope="col">MSVC</th> + <th scope="col">GCC</th> + <th scope="col">Clang</th> + <th scope="col">Pode ser utilizada no código</th> + </tr> + </thead> + <tbody> + <tr> + <td><code>type_t &&</code></td> + <td style="background-color: rgb(204, 255, 153);">2010</td> + <td style="background-color: rgb(204, 255, 153);">4.3</td> + <td style="background-color: rgb(204, 255, 153);">2.9</td> + <td style="background-color: rgb(204, 255, 153);">Sim (consultar notas)</td> + </tr> + <tr> + <td>ref qualifiers on methods</td> + <td style="background-color: rgb(255, 204, 204);">2015</td> + <td style="background-color: rgb(204, 255, 153);">4.8.1</td> + <td style="background-color: rgb(204, 255, 153);">2.9</td> + <td style="background-color: rgb(255, 204, 204);">Não</td> + </tr> + <tr> + <td>member initializers</td> + <td style="background-color: rgb(204, 255, 153);">2013</td> + <td style="background-color: rgb(204, 255, 153);">4.7</td> + <td style="background-color: rgb(204, 255, 153);">3.0</td> + <td style="background-color: rgb(204, 255, 153);">Sim</td> + </tr> + <tr> + <td>variadic templates</td> + <td style="background-color: rgb(204, 255, 153);">2013</td> + <td style="background-color: rgb(204, 255, 153);">4.3</td> + <td style="background-color: rgb(204, 255, 153);">2.9</td> + <td style="background-color: rgb(204, 255, 153);">Sim</td> + </tr> + <tr> + <td>Initializer lists</td> + <td style="background-color: rgb(204, 255, 153);">2013</td> + <td style="background-color: rgb(204, 255, 153);">4.4</td> + <td style="background-color: rgb(204, 255, 153);">3.1</td> + <td style="background-color: rgb(204, 255, 153);">Sim</td> + </tr> + <tr> + <td><code>static_assert</code></td> + <td style="background-color: rgb(204, 255, 153);">2010</td> + <td style="background-color: rgb(204, 255, 153);">4.3</td> + <td style="background-color: rgb(204, 255, 153);">2.9</td> + <td style="background-color: rgb(204, 255, 153);">Sim</td> + </tr> + <tr> + <td><code>auto</code></td> + <td style="background-color: rgb(204, 255, 153);">2010</td> + <td style="background-color: rgb(204, 255, 153);">4.4</td> + <td style="background-color: rgb(204, 255, 153);">2.9</td> + <td style="background-color: rgb(204, 255, 153);">Sim</td> + </tr> + <tr> + <td>lambdas</td> + <td style="background-color: rgb(204, 255, 153);">2010</td> + <td style="background-color: rgb(204, 255, 153);">4.5</td> + <td style="background-color: rgb(204, 255, 153);">3.1</td> + <td style="background-color: rgb(204, 255, 153);">Sim</td> + </tr> + <tr> + <td><code>decltype</code></td> + <td style="background-color: rgb(204, 255, 153);">2010</td> + <td style="background-color: rgb(204, 255, 153);">4.3</td> + <td style="background-color: rgb(204, 255, 153);">2.9</td> + <td style="background-color: rgb(204, 255, 153);">Sim</td> + </tr> + <tr> + <td><code>Foo<Bar<T>></code></td> + <td style="background-color: rgb(204, 255, 153);">2010</td> + <td style="background-color: rgb(204, 255, 153);">4.3</td> + <td style="background-color: rgb(204, 255, 153);">2.9</td> + <td style="background-color: rgb(204, 255, 153);">Sim</td> + </tr> + <tr> + <td><code>auto func() -> int</code></td> + <td style="background-color: rgb(204, 255, 153);">2010</td> + <td style="background-color: rgb(204, 255, 153);">4.4</td> + <td style="background-color: rgb(204, 255, 153);">3.1</td> + <td style="background-color: rgb(204, 255, 153);">Sim</td> + </tr> + <tr> + <td>Templated aliasing</td> + <td style="background-color: rgb(204, 255, 153);">2013</td> + <td style="background-color: rgb(204, 255, 153);">4.7</td> + <td style="background-color: rgb(204, 255, 153);">3.0</td> + <td style="background-color: rgb(204, 255, 153);">Sim</td> + </tr> + <tr> + <td style="vertical-align: middle;"><code>nullptr</code></td> + <td style="vertical-align: middle; background-color: rgb(204, 255, 153);">2010</td> + <td style="vertical-align: middle; background-color: rgb(204, 255, 153);">4.6</td> + <td style="vertical-align: middle; background-color: rgb(204, 255, 153);">3.0</td> + <td style="background-color: rgb(204, 255, 153);">Yes, but use <code>decltype(nullptr)</code> instead of <code>std::nullptr_t</code>.</td> + </tr> + <tr> + <td><code>enum foo : int16_t</code> {};</td> + <td style="background-color: rgb(204, 255, 153);">2008</td> + <td style="background-color: rgb(204, 255, 153);">4.4</td> + <td style="background-color: rgb(204, 255, 153);">2.9</td> + <td style="background-color: rgb(204, 255, 153);">Sim</td> + </tr> + <tr> + <td><code>enum class foo {}</code>;</td> + <td style="background-color: rgb(204, 255, 153);">2012</td> + <td style="background-color: rgb(204, 255, 153);">4.4</td> + <td style="background-color: rgb(204, 255, 153);">2.9</td> + <td style="background-color: rgb(204, 255, 153);">Sim</td> + </tr> + <tr> + <td><code>enum foo;</code></td> + <td style="background-color: rgb(204, 255, 153);">2012</td> + <td style="background-color: rgb(204, 255, 153);">4.6</td> + <td style="background-color: rgb(204, 255, 153);">3.1</td> + <td style="background-color: rgb(204, 255, 153);">Sim</td> + </tr> + <tr> + <td><code>[[attributes]]</code></td> + <td style="background-color: rgb(255, 204, 204);">2015</td> + <td style="background-color: rgb(204, 255, 153);">4.8</td> + <td style="background-color: rgb(204, 255, 153);">3.3</td> + <td style="background-color: rgb(255, 204, 204);">Não (consultar notas)</td> + </tr> + <tr> + <td><code>constexpr</code></td> + <td style="background-color: rgb(255, 204, 204);">2015</td> + <td style="background-color: rgb(204, 255, 153);">4.6</td> + <td style="background-color: rgb(204, 255, 153);">3.1</td> + <td style="background-color: rgb(255, 255, 153);">Use <code>MOZ_CONSTEXPR </code>from <a href="http://dxr.mozilla.org/mozilla-central/source/mfbt/Attributes.h" title="http://dxr.mozilla.org/mozilla-central/source/mfbt/Attributes.h">mozilla/Attributes.h</a></td> + </tr> + <tr> + <td><code>alignof</code>/<code>alignas</code></td> + <td style="background-color: rgb(255, 204, 204);">2015</td> + <td style="background-color: rgb(204, 255, 153);">4.8</td> + <td style="background-color: rgb(255, 204, 204);">3.3</td> + <td style="background-color: rgb(255, 204, 204);">No (see notes) ; only clang 3.6 claims __has_feature(cxx_alignof)</td> + </tr> + <tr> + <td>Delegated constructors</td> + <td style="background-color: rgb(204, 255, 153);">2013</td> + <td style="background-color: rgb(204, 255, 153);">4.7</td> + <td style="background-color: rgb(204, 255, 153);">3.0</td> + <td style="background-color: rgb(204, 255, 153);">Sim</td> + </tr> + <tr> + <td>Inherited constructors</td> + <td style="background-color: rgb(255, 204, 204);">2015</td> + <td style="background-color: rgb(204, 255, 153);">4.8</td> + <td style="background-color: rgb(204, 255, 153);">3.3</td> + <td style="background-color: rgb(255, 204, 204);">Não</td> + </tr> + <tr> + <td><code>explicit operator bool()</code></td> + <td style="background-color: rgb(204, 255, 153);">2013</td> + <td style="background-color: rgb(204, 255, 153);">4.5</td> + <td style="background-color: rgb(204, 255, 153);">3.0</td> + <td style="background-color: rgb(204, 255, 153);">Sim</td> + </tr> + <tr> + <td style="vertical-align: middle;"><code>char16_t/u"string"</code></td> + <td style="background-color: rgb(255, 204, 204); vertical-align: middle;">2015</td> + <td style="background-color: rgb(204, 255, 153); vertical-align: middle;">4.4</td> + <td style="background-color: rgb(204, 255, 153); vertical-align: middle;">3.0</td> + <td style="background-color: rgb(255, 255, 153);">Use <code>MOZ_UTF16("string")</code> instead of u"string".</td> + </tr> + <tr> + <td><code>R"(string)"</code></td> + <td style="background-color: rgb(204, 255, 153);">2013</td> + <td style="background-color: rgb(204, 255, 153);">4.5</td> + <td style="background-color: rgb(204, 255, 153);">3.0</td> + <td style="background-color: rgb(204, 255, 153);">Sim</td> + </tr> + <tr> + <td><code>operator""()</code></td> + <td style="background-color: rgb(255, 204, 204);">2015</td> + <td style="background-color: rgb(204, 255, 153);">4.7</td> + <td style="background-color: rgb(204, 255, 153);">3.1</td> + <td style="background-color: rgb(255, 204, 204);">Não</td> + </tr> + <tr> + <td><code>=delete</code></td> + <td style="background-color: rgb(204, 255, 153);">2013</td> + <td style="background-color: rgb(204, 255, 153);">4.4</td> + <td style="background-color: rgb(204, 255, 153);">2.9</td> + <td style="background-color: rgb(204, 255, 153);">Sim</td> + </tr> + <tr> + <td><code>=default</code></td> + <td style="background-color: rgb(204, 255, 153);">2013</td> + <td style="background-color: rgb(204, 255, 153);">4.4</td> + <td style="background-color: rgb(204, 255, 153);">3.0</td> + <td style="background-color: rgb(204, 255, 153);">Sim</td> + </tr> + <tr> + <td>unrestricted unions</td> + <td style="background-color: rgb(255, 204, 204);">2015</td> + <td style="background-color: rgb(204, 255, 153);">4.6</td> + <td style="background-color: rgb(204, 255, 153);">3.1</td> + <td style="background-color: rgb(255, 204, 204);">Não</td> + </tr> + <tr> + <td><code>for (auto x : vec)</code></td> + <td style="background-color: rgb(204, 255, 153);">2012</td> + <td style="background-color: rgb(204, 255, 153);">4.6</td> + <td style="background-color: rgb(204, 255, 153);">3.0</td> + <td style="background-color: rgb(204, 255, 153);">Yes (<a href="http://stackoverflow.com/questions/15176104/c11-range-based-loop-get-item-by-value-or-reference-to-const">be careful about the type of the iterator</a>)</td> + </tr> + <tr> + <td><code>override</code>/<code>final</code></td> + <td style="background-color: rgb(204, 255, 153);">2012</td> + <td style="background-color: rgb(204, 255, 153);">4.7</td> + <td style="background-color: rgb(204, 255, 153);">3.0</td> + <td style="background-color: rgb(204, 255, 153);">Sim</td> + </tr> + <tr> + <td><code>thread_local</code></td> + <td style="background-color: rgb(255, 204, 204);">2015</td> + <td style="background-color: rgb(204, 255, 153);">4.8</td> + <td style="background-color: rgb(204, 255, 153);">3.3</td> + <td style="background-color: rgb(255, 204, 204);">Não (consultar notas)</td> + </tr> + <tr> + <td>function template default arguments</td> + <td style="background-color: rgb(204, 255, 153);">2013</td> + <td style="background-color: rgb(204, 255, 153);">4.3</td> + <td style="background-color: rgb(204, 255, 153);">2.9</td> + <td style="background-color: rgb(204, 255, 153);">Sim</td> + </tr> + <tr> + <td>local structs as template parameters</td> + <td style="background-color: rgb(204, 255, 153);">2010</td> + <td style="background-color: rgb(204, 255, 153);">4.5</td> + <td style="background-color: rgb(204, 255, 153);">2.9</td> + <td style="background-color: rgb(204, 255, 153);">Sim</td> + </tr> + <tr> + <td>extended friend declarations</td> + <td style="background-color: rgb(204, 255, 153);">2010</td> + <td style="background-color: rgb(204, 255, 153);">4.7</td> + <td style="background-color: rgb(204, 255, 153);">2.9</td> + <td style="background-color: rgb(204, 255, 153);">Sim</td> + </tr> + <tr> + <td><code>0b100</code> (C++14)</td> + <td style="background-color: rgb(255, 204, 204);">2015</td> + <td style="background-color: rgb(255, 204, 204);">4.9</td> + <td style="background-color: rgb(204, 255, 153);">2.9</td> + <td style="background-color: rgb(255, 204, 204);">Não</td> + </tr> + <tr> + <td>Return type deduction (C++14)</td> + <td style="background-color: rgb(255, 204, 204);">2015</td> + <td style="background-color: rgb(255, 204, 204);">4.9</td> + <td style="background-color: rgb(204, 255, 153);">3.4</td> + <td style="background-color: rgb(255, 204, 204);">Não</td> + </tr> + <tr> + <td>Generic lambdas (C++14)</td> + <td style="background-color: rgb(255, 204, 204);">2015</td> + <td style="background-color: rgb(255, 204, 204);">4.9</td> + <td style="background-color: rgb(204, 255, 153);">3.4</td> + <td style="background-color: rgb(255, 204, 204);">Não</td> + </tr> + <tr> + <td>Initialized lambda captures (C++14)</td> + <td style="background-color: rgb(255, 204, 204);">2015</td> + <td style="background-color: rgb(255, 204, 204);">4.9</td> + <td style="background-color: rgb(204, 255, 153);">3.4</td> + <td style="background-color: rgb(255, 204, 204);">Não</td> + </tr> + <tr> + <td>Digit separator (C++14)</td> + <td style="background-color: rgb(255, 204, 204);">2015</td> + <td style="background-color: rgb(255, 204, 204);">4.9</td> + <td style="background-color: rgb(204, 255, 153);">3.4</td> + <td style="background-color: rgb(255, 204, 204);">Não</td> + </tr> + <tr> + <td>Variable templates (C++14)</td> + <td style="background-color: rgb(255, 204, 204);">—</td> + <td style="background-color: rgb(255, 204, 204);">5.0</td> + <td style="background-color: rgb(204, 255, 153);">3.4</td> + <td style="background-color: rgb(255, 204, 204);">Não</td> + </tr> + <tr> + <td>Relaxed constexpr (C++14)</td> + <td style="background-color: rgb(255, 204, 204);">—</td> + <td style="background-color: rgb(255, 204, 204);">5.0</td> + <td style="background-color: rgb(204, 255, 153);">3.4</td> + <td style="background-color: rgb(255, 204, 204);">Não</td> + </tr> + <tr> + <td>Concepts (Concepts TS)</td> + <td style="background-color: rgb(255, 204, 204);">—</td> + <td style="background-color: rgb(255, 204, 204);">6.0</td> + <td style="background-color: rgb(255, 204, 204);">—</td> + <td style="background-color: rgb(255, 204, 204);">Não</td> + </tr> + <tr> + <td>Inline variables (C++17)</td> + <td style="background-color: rgb(255, 204, 204);">—</td> + <td style="background-color: rgb(255, 204, 204);">—</td> + <td style="background-color: rgb(255, 204, 204);">—</td> + <td style="background-color: rgb(255, 204, 204);">Não</td> + </tr> + <tr> + <td>constexpr_if (C++17)</td> + <td style="background-color: rgb(255, 204, 204);">—</td> + <td style="background-color: rgb(255, 204, 204);">—</td> + <td style="background-color: rgb(255, 204, 204);">—</td> + <td style="background-color: rgb(255, 204, 204);">Não</td> + </tr> + <tr> + <td>constexpr lambdas (C++17)</td> + <td style="background-color: rgb(255, 204, 204);">—</td> + <td style="background-color: rgb(255, 204, 204);">—</td> + <td style="background-color: rgb(255, 204, 204);">—</td> + <td style="background-color: rgb(255, 204, 204);">Não</td> + </tr> + </tbody> +</table> + +<h3 id="Notas">Notas</h3> + +<p>rvalue references: Implicit move method generation cannot be used.</p> + +<p>Attributes: Several common attributes are defined in <a href="http://dxr.mozilla.org/mozilla-central/source/mfbt/Attributes.h">mozilla/Attributes.h</a> or nscore.h.</p> + +<p>Alignment: Some alignment utilities are defined in <a href="http://dxr.mozilla.org/mozilla-central/source/mfbt/Alignment.h">mozilla/Alignment.h</a>.</p> + +<p>Thread locals: There is a thread-local variable helper in <a href="http://dxr.mozilla.org/mozilla-central/source/mfbt/ThreadLocal.h">mozilla/ThreadLocal.h</a>. In addition, the native thread_local of MSVC2015 may break Windows XP support. See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1204752#c7">bug 1204752</a>. The native thread_local of clang may break OSX 10.6, too, but support for OSX 10.6 has been retired.</p> + +<p>C++14: C++14 is not enabled on compilers that support it.</p> + +<h2 id="Blibliotecas_padrão_de_C_e_Mozilla">Blibliotecas padrão de C++ e Mozilla</h2> + +<p>The Mozilla codebase contains within it several subprojects which follow different rules for which libraries can and can't be used it. The rules listed here apply to normal platform code, and assume unrestricted usability of MFBT or XPCOM APIs.</p> + +<div class="warning"> +<p>The rest of this section is a draft for expository and exploratory purposes. Do not trust the information listed here.</p> +</div> + +<p>What follows is a list of standard library components provided by Mozilla or the C++ standard. If an API is not listed here, then it is not permissible to use it in Mozilla code. Deprecated APIs are not listed here. In general, prefer Mozilla variants of data structures to standard C++ ones, even when permitted to use the latter, since Mozilla variants tend to have features not found in the standard library (e.g., memory size tracking) or have more controllable performance characteristics.</p> + +<h3 id="Estruturas_de_dados">Estruturas de dados</h3> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Nome</th> + <th scope="col">Cabeçalho</th> + <th scope="col">STL equivalente</th> + <th scope="col">Notes</th> + </tr> + </thead> + <tbody> + <tr> + <td><code>nsAutoTArray</code></td> + <td><code><a href="http://dxr.mozilla.org/mozilla-central/source/xpcom/glue/nsTArray.h">nsTArray.h</a></code></td> + <td> </td> + <td>Like <code>nsTArray</code>, but will store a small amount as stack storage</td> + </tr> + <tr> + <td><code>nsAutoTObserverArray</code></td> + <td><code><a href="http://dxr.mozilla.org/mozilla-central/source/xpcom/glue/nsTObserverArray.h">nsTObserverArray.h</a></code></td> + <td> </td> + <td>Like <code>nsTObserverArray</code>, but will store a small amount as stack storage</td> + </tr> + <tr> + <td><code>mozilla::BloomFilter</code></td> + <td><code><a href="http://dxr.mozilla.org/mozilla-central/source/mfbt/BloomFilter.h">mozilla/BloomFilter.h</a></code></td> + <td> </td> + <td>Probabilistic set membership (see <a href="http://en.wikipedia.org/wiki/Bloom_filter#Counting_filters">Wikipedia</a>)</td> + </tr> + <tr> + <td><code>nsClassHashtable</code></td> + <td><code><a href="http://dxr.mozilla.org/mozilla-central/source/xpcom/glue/nsClassHashtable.h">nsClassHashtable.h</a></code></td> + <td> </td> + <td>Adaptation of nsTHashtable, see <a href="/en-US/docs/XPCOM_hashtable_guide">XPCOM hashtable guide</a></td> + </tr> + <tr> + <td><code>nsCOMArray</code></td> + <td><code><a href="http://dxr.mozilla.org/mozilla-central/source/xpcom/glue/nsCOMArray.h">nsCOMArray.h</a></code></td> + <td> </td> + <td>Like <code>nsTArray<nsCOMPtr<T>></code></td> + </tr> + <tr> + <td><code>nsDataHashtable</code></td> + <td><code><a href="http://dxr.mozilla.org/mozilla-central/source/xpcom/glue/nsDataHashtable.h">nsClassHashtable.h</a></code></td> + <td><code>std::unordered_map</code></td> + <td>Adaptation of <code>nsTHashtable</code>, see <a href="/en-US/docs/XPCOM_hashtable_guide">XPCOM hashtable guide</a></td> + </tr> + <tr> + <td><code>nsDeque</code></td> + <td><code><a href="http://dxr.mozilla.org/mozilla-central/source/xpcom/glue/nsDeque.h">nsDeque.h</a></code></td> + <td><code>std::deque</code></td> + <td> </td> + </tr> + <tr> + <td><code>mozilla::EnumSet</code></td> + <td><code><a href="http://dxr.mozilla.org/mozilla-central/source/mfbt/EnumSet.h">mozilla/EnumSet.h</a></code></td> + <td> </td> + <td>Like <code>std::set</code>, but for enum classes.</td> + </tr> + <tr> + <td><code>nsInterfaceHashtable</code></td> + <td><code><a href="http://dxr.mozilla.org/mozilla-central/source/xpcom/glue/nsInterfaceHashtable.h">nsInterfaceHashtable.h</a></code></td> + <td><code>std::unordered_map</code></td> + <td>Adaptation of <code>nsTHashtable</code>, see <a href="/en-US/docs/XPCOM_hashtable_guide">XPCOM hashtable guide</a></td> + </tr> + <tr> + <td><code>nsJSThingHashtable</code></td> + <td><code><a href="http://dxr.mozilla.org/mozilla-central/source/xpcom/glue/nsJSThingHashtable.h">nsJSThingHashtable.h</a></code></td> + <td> </td> + <td>Adaptation of <code>nsTHashtable</code>, see <a href="/en-US/docs/XPCOM_hashtable_guide">XPCOM hashtable guide</a></td> + </tr> + <tr> + <td><code>mozilla::LinkedList</code></td> + <td><code><a href="http://dxr.mozilla.org/mozilla-central/source/mfbt/LinkedList.h">mozilla/LinkedList.h</a></code></td> + <td><code>std::list</code></td> + <td>Doubly-linked list</td> + </tr> + <tr> + <td><code>nsRefPtrHashtable</code></td> + <td><code><a href="http://dxr.mozilla.org/mozilla-central/source/xpcom/glue/nsRefPtrHashtable.h">nsRefPtrHashtable.h</a></code></td> + <td><code>std::unordered_map</code></td> + <td>Adaptation of <code>nsTHashtable</code>, see <a href="/en-US/docs/XPCOM_hashtable_guide">XPCOM hashtable guide</a></td> + </tr> + <tr> + <td><code>mozilla::SegmentedVector</code></td> + <td><code><a href="http://dxr.mozilla.org/mozilla-central/source/mfbt/SegmentedVector.h">mozilla/SegmentedVector.h</a></code></td> + <td><code>std::deque</code></td> + <td>Doubly-linked list of vector elements</td> + </tr> + <tr> + <td><code>mozilla::SplayTree</code></td> + <td><code><a href="http://dxr.mozilla.org/mozilla-central/source/mfbt/SplayTree.h">mozilla/SplayTree.h</a></code></td> + <td> </td> + <td>Quick access to recently-accessed elements (see <a href="http://en.wikipedia.org/wiki/Splay_tree">Wikipedia</a>)</td> + </tr> + <tr> + <td><code>nsTArray</code></td> + <td><code><a href="http://dxr.mozilla.org/mozilla-central/source/xpcom/glue/nsTArray.h">nsTArray.h</a></code></td> + <td><code>std::vector</code></td> + <td> </td> + </tr> + <tr> + <td><code>nsTHashtable</code></td> + <td><code><a href="http://dxr.mozilla.org/mozilla-central/source/xpcom/glue/nsTHashtable.h">nsTHashtable.h</a></code></td> + <td><code>std::unordered_map</code></td> + <td>See <a href="/en-US/docs/XPCOM_hashtable_guide">XPCOM hashtable guide</a>, you probably want a subclass</td> + </tr> + <tr> + <td><code>nsTObserverArray</code></td> + <td><code><a href="http://dxr.mozilla.org/mozilla-central/source/xpcom/glue/nsTObserverArray.h">nsTObserverArray.h</a></code></td> + <td> </td> + <td>Like <code>nsTArray</code>, but iteration is stable even through mutation</td> + </tr> + <tr> + <td><code>nsTPriorityQueue</code></td> + <td><code><a href="http://dxr.mozilla.org/mozilla-central/source/xpcom/glue/nsTPriorityQueue.h">nsTPriorityQueue.h</a></code></td> + <td><code>std::priority_queue</code></td> + <td>Unlike the STL class, not a container adapter</td> + </tr> + <tr> + <td><code>mozilla::Vector</code></td> + <td><code><a href="http://dxr.mozilla.org/mozilla-central/source/mfbt/Vector.h">mozilla/Vector.h</a></code></td> + <td><code>std::vector</code></td> + <td> </td> + </tr> + </tbody> +</table> + +<p>Untranslated notes:</p> + +<p>ns*String - too complicated to explain</p> + +<p>Safety utilities:<br> + mozilla::Array mfbt/Array.h (safe array index)<br> + mozilla::AssertedCast mfbt/Casting.h (casts)<br> + mozilla::CheckedInt mfbt/CheckedInt.h (avoids overflow)<br> + nsCOMPtr xpcom/glue/nsCOMPtr.h (~= std::shared_ptr)<br> + mozilla::EnumeratedArray mfbt/EnumeratedArray.h (mozilla::Array, for enum types)<br> + mozilla::RangedPtr mfbt/RangedPtr.h (prevents out-of-bounds)<br> + mozilla::RefPtr mfbt/RefPtr.h (~= std::shared_ptr)<br> + nsRefPtr xpcom/base/nsRefPtr.h (~= std::shared_ptr)<br> + StaticRefPtr xpcom/base/StaticPtr.h (nsRefPtr w/o static constructor)<br> + mozilla::UniquePtr mfbt/UniquePtr.h (~= std::unique_ptr)<br> + mozilla::WeakPtr mfbt/WeakPtr.h (~= std::weak_ptr)<br> + nsWeakPtr xpcom/base/nsWeakPtr.h (~= std::weak_ptr)</p> + +<p>Algos:<br> + mozilla::BinarySearch mfbt/BinarySearch.h<br> + mozilla::BitwiseCast mfbt/Casting.h (strict aliasing-safe cast)<br> + mozilla/MathAlgorithms.h (rotate, ctlz, popcount, gcd, abs, lcm)<br> + mozilla::RollingMean mfbt/RollingMean.h ()</p> + +<p>Misc:<br> + mozilla::AlignedStorage mfbt/Alignment.h (replacement for std::aligned_storage)<br> + mozilla::Atomic mfbt/Atomic.h (replacement for std::atomic)<br> + mozilla::CondVar xpcom/glue/CondVar.h<br> + mozilla::Maybe mfbt/Maybe.h (std::optional)<br> + mozilla::MaybeOneOf mfbt/MaybeOneOf.h (~mozilla::Maybe<union {T1, T2}>)<br> + mozilla::Monitor xpcom/glue/Monitor.h<br> + mozilla::Mutex xpcom/glue/Mutex.h<br> + mozilla::Pair mfbt/Pair.h (~= std::tuple<T1, T2> -- minimal space!)<br> + mozilla::ReentrantMonitor xpcom/glue/ReentrantMonitor.h<br> + mozilla::StaticMutex xpcom/base/StaticMutex.h<br> + mozilla::TimeStamp xpcom/ds/TimeStamp.h (~= std::chrono::time_point)</p> + +<p>mozilla/ArrayUtils.h<br> + mozilla/Compression.h<br> + mozilla/Endian.h<br> + mozilla/FloatingPoint.h<br> + mozilla/HashFunctions.h (~= std::hash)<br> + mozilla/Move.h (std::move, std::swp, std::Forward)<br> + mozilla/PodOperations.h (C++ versions of memset, memcpy, etc.)<br> + mozilla/TypeTraits.h (replacement for <type_traits>)</p> + +<p>(TODO: make list of STL usability here)</p> |