From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- files/pt-pt/mozilla/add-ons/amo/index.html | 9 + .../add-ons/amo/policy/em_destaque/index.html | 85 ++ files/pt-pt/mozilla/add-ons/amo/policy/index.html | 19 + .../add-ons/amo/policy/revis\303\265es/index.html" | 160 +++ .../index.html" | 518 ++++++++++ .../pt-pt/mozilla/add-ons/distribuicao/index.html | 78 ++ files/pt-pt/mozilla/add-ons/index.html | 111 +++ .../linhas_diretrizes_para_extras/index.html | 8 + files/pt-pt/mozilla/add-ons/sdk/index.html | 97 ++ .../add-ons/themes/conceitos_tema/index.html | 230 +++++ files/pt-pt/mozilla/add-ons/themes/index.html | 49 + .../creating_a_skin_for_firefox/index.html | 33 + .../mozilla/add-ons/themes/obsolete/index.html | 10 + files/pt-pt/mozilla/add-ons/thunderbird/index.html | 135 +++ .../a_sua_primeira_extensao/index.html | 153 +++ .../a_sua_segunda_extensao/index.html | 460 +++++++++ .../anatomia_de_uma_extensao/index.html | 135 +++ .../webextensions/api/armazenamento/index.html | 105 ++ .../webextensions/api/browseraction/index.html | 127 +++ .../webextensions/api/browsingdata/index.html | 130 +++ .../api/browsingdata/removeplugindata/index.html | 124 +++ .../webextensions/api/devtools.panels/index.html | 103 ++ .../add-ons/webextensions/api/i18n/index.html | 93 ++ .../mozilla/add-ons/webextensions/api/index.html | 13 + .../webextensions/api/pageaction/index.html | 108 ++ .../webextensions/api/sidebaraction/index.html | 182 ++++ .../index.html | 159 +++ .../index.html | 81 ++ .../webextensions/dubla_padr\303\265es/index.html" | 430 ++++++++ .../add-ons/webextensions/e_a_seguir/index.html | 60 ++ .../webextensions/exemplos_extensoes/index.html | 28 + .../extennsoesweb_e_a_id_do_extra/index.html | 78 ++ .../index.html" | 156 +++ .../pt-pt/mozilla/add-ons/webextensions/index.html | 135 +++ .../instalacao_temporaria_no_firefox/index.html | 50 + .../interceptar_pedidos_http/index.html | 160 +++ .../acoes_pagina/index.html | 50 + .../a\303\247\303\243o_navegador/index.html" | 50 + .../barras_laterais/index.html | 57 ++ .../devtools_panels/index.html | 62 ++ .../estilos_de_navegador/index.html | 453 +++++++++ .../interface_do_utilizador/index.html | 93 ++ .../itens_do_menu_de_contexto/index.html | 51 + .../notificacoes/index.html | 50 + .../interface_do_utilizador/omnibox/index.html | 70 ++ .../options_pages/index.html | 64 ++ .../paginas_de_extens\303\243o/index.html" | 64 ++ .../interface_do_utilizador/popups/index.html | 60 ++ .../webextensions/internationalization/index.html | 417 ++++++++ .../manifest.json/browser_action/index.html | 236 +++++ .../browser_specific_settings/index.html | 107 ++ .../manifest.json/devtools_page/index.html | 42 + .../webextensions/manifest.json/icones/index.html | 78 ++ .../add-ons/webextensions/manifest.json/index.html | 132 +++ .../o_que_sao_webextensions/index.html | 59 ++ .../primeiros_passos_com_web-ext/index.html | 304 ++++++ .../publicar_a_sua_extensao/index.html | 62 ++ .../webextensions/scripts_conteudo/index.html | 446 +++++++++ .../suporte_navegador_apis_javascript/index.html | 19 + .../mozilla/add-ons/webextensions/tips/index.html | 50 + .../trasnsferir_extensao_google_chrome/index.html | 22 + .../mozilla/calendar/calendar_versions/index.html | 1037 ++++++++++++++++++++ files/pt-pt/mozilla/calendar/index.html | 80 ++ .../criacao_barra_lateral_firefox/index.html | 40 + .../index.html" | 95 ++ .../mozilla/developer_guide/source_code/index.html | 54 + .../edi\303\247\303\243o_programador/index.html" | 36 + files/pt-pt/mozilla/firefox/index.html | 73 ++ .../mozilla/firefox/multiple_profiles/index.html | 244 +++++ .../cross_process_object_wrappers/index.html | 157 +++ .../depuracao_de_frame_scripts/index.html | 56 ++ .../gestor_de_mensagens/index.html | 74 ++ .../multiprocess_firefox/glossario/index.html | 36 + .../firefox/multiprocess_firefox/index.html | 79 ++ .../limitacoes_de_chrome_scripts/index.html | 215 ++++ .../limitacoes_de_frame_scripts/index.html | 103 ++ .../quais_os_uris_que_carregam_e_onde/index.html | 62 ++ .../resumo_t\303\251cnico/index.html" | 164 ++++ files/pt-pt/mozilla/firefox/releases/3/index.html | 298 ++++++ files/pt-pt/mozilla/firefox/releases/70/index.html | 140 +++ files/pt-pt/mozilla/firefox/releases/index.html | 25 + files/pt-pt/mozilla/firefox_for_android/index.html | 77 ++ .../index.html | 97 ++ .../index.html | 77 ++ files/pt-pt/mozilla/index.html | 16 + files/pt-pt/mozilla/ligar/index.html | 117 +++ .../index.html" | 282 ++++++ .../configuracao_inicial/index.html" | 81 ++ .../fase_da_traducao/index.html" | 120 +++ .../fase_de_lancamento/index.html" | 177 ++++ .../fase_pr/index.html" | 212 ++++ .../index.html" | 41 + files/pt-pt/mozilla/localization/index.html | 23 + files/pt-pt/mozilla/localization/index/index.html | 9 + .../localization/localizacao_e_plurais/index.html | 384 ++++++++ .../localizar_com_mercurial/index.html | 256 +++++ .../index.html" | 138 +++ files/pt-pt/mozilla/mercurial/basicos/index.html | 61 ++ files/pt-pt/mozilla/mercurial/index.html | 41 + .../mercurial/instaacao_mercurial/index.html | 151 +++ .../pt-pt/mozilla/o0coes_linha_comandos/index.html | 486 +++++++++ .../performance/about_colon_memory/index.html | 187 ++++ .../index.html | 53 + files/pt-pt/mozilla/performance/index.html | 145 +++ .../perfilar_com_o_profiler_integrado/index.html | 356 +++++++ files/pt-pt/mozilla/persona/index.html | 153 +++ files/pt-pt/mozilla/phishing/index.html | 50 + files/pt-pt/mozilla/projects/emscripten/index.html | 42 + files/pt-pt/mozilla/projects/index.html | 14 + files/pt-pt/mozilla/projects/mailnews/index.html | 42 + files/pt-pt/mozilla/projects/rhino/index.html | 24 + .../thunderbird/localizacao_thunderbird/index.html | 100 ++ files/pt-pt/mozilla/tech/index.html | 14 + files/pt-pt/mozilla/tech/places/index.html | 75 ++ .../mozilla/tech/xpcom/armazenamento/index.html | 372 +++++++ .../index.html" | 222 +++++ files/pt-pt/mozilla/tech/xpcom/guide/index.html | 21 + files/pt-pt/mozilla/tech/xpcom/index.html | 52 + .../tech/xpcom/reference/glue_classes/index.html | 13 + .../pt-pt/mozilla/tech/xpcom/reference/index.html | 27 + .../tech/xul/attribute/textbox.type/index.html | 5 + .../autoconfiguration/fileformat/como/index.html | 243 +++++ .../fileformat/definicao/index.html | 6 + .../autoconfiguration/fileformat/index.html | 10 + .../configuracao_autom\303\241tica/index.html" | 162 +++ files/pt-pt/mozilla/thunderbird/index.html | 69 ++ .../mozilla/thunderbird/lancamentos/index.html | 19 + .../index.html | 397 ++++++++ .../index.html" | 552 +++++++++++ 129 files changed, 17049 insertions(+) create mode 100644 files/pt-pt/mozilla/add-ons/amo/index.html create mode 100644 files/pt-pt/mozilla/add-ons/amo/policy/em_destaque/index.html create mode 100644 files/pt-pt/mozilla/add-ons/amo/policy/index.html create mode 100644 "files/pt-pt/mozilla/add-ons/amo/policy/revis\303\265es/index.html" create mode 100644 "files/pt-pt/mozilla/add-ons/cri\303\247\303\243o_de_extens\303\265es_firefox_com_sistema_mozilla/index.html" create mode 100644 files/pt-pt/mozilla/add-ons/distribuicao/index.html create mode 100644 files/pt-pt/mozilla/add-ons/index.html create mode 100644 files/pt-pt/mozilla/add-ons/linhas_diretrizes_para_extras/index.html create mode 100644 files/pt-pt/mozilla/add-ons/sdk/index.html create mode 100644 files/pt-pt/mozilla/add-ons/themes/conceitos_tema/index.html create mode 100644 files/pt-pt/mozilla/add-ons/themes/index.html create mode 100644 files/pt-pt/mozilla/add-ons/themes/obsolete/creating_a_skin_for_firefox/index.html create mode 100644 files/pt-pt/mozilla/add-ons/themes/obsolete/index.html create mode 100644 files/pt-pt/mozilla/add-ons/thunderbird/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/a_sua_primeira_extensao/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/a_sua_segunda_extensao/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/anatomia_de_uma_extensao/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/api/armazenamento/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/api/browseraction/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/api/browsingdata/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/api/browsingdata/removeplugindata/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/api/devtools.panels/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/api/i18n/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/api/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/api/pageaction/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/api/sidebaraction/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/as_melhores_praticas_de_experiencia_do_utilizador/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/conversao_de_uma_extensao_legada_do_firefox/index.html create mode 100644 "files/pt-pt/mozilla/add-ons/webextensions/dubla_padr\303\265es/index.html" create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/e_a_seguir/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/exemplos_extensoes/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/extennsoesweb_e_a_id_do_extra/index.html create mode 100644 "files/pt-pt/mozilla/add-ons/webextensions/extens\303\243o_das_ferramentas_de_desenvolvimento/index.html" create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/instalacao_temporaria_no_firefox/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/interceptar_pedidos_http/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/acoes_pagina/index.html create mode 100644 "files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/a\303\247\303\243o_navegador/index.html" create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/barras_laterais/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/devtools_panels/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/estilos_de_navegador/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/itens_do_menu_de_contexto/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/notificacoes/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/omnibox/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/options_pages/index.html create mode 100644 "files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/paginas_de_extens\303\243o/index.html" create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/popups/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/internationalization/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/manifest.json/browser_action/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/manifest.json/browser_specific_settings/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/manifest.json/devtools_page/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/manifest.json/icones/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/manifest.json/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/o_que_sao_webextensions/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/primeiros_passos_com_web-ext/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/publicar_a_sua_extensao/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/scripts_conteudo/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/suporte_navegador_apis_javascript/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/tips/index.html create mode 100644 files/pt-pt/mozilla/add-ons/webextensions/trasnsferir_extensao_google_chrome/index.html create mode 100644 files/pt-pt/mozilla/calendar/calendar_versions/index.html create mode 100644 files/pt-pt/mozilla/calendar/index.html create mode 100644 files/pt-pt/mozilla/criacao_barra_lateral_firefox/index.html create mode 100644 "files/pt-pt/mozilla/cria\303\247\303\243o_de_um_complemento_de_dicion\303\241rio_de_verifica\303\247\303\243o_ortogr\303\241fica/index.html" create mode 100644 files/pt-pt/mozilla/developer_guide/source_code/index.html create mode 100644 "files/pt-pt/mozilla/firefox/edi\303\247\303\243o_programador/index.html" create mode 100644 files/pt-pt/mozilla/firefox/index.html create mode 100644 files/pt-pt/mozilla/firefox/multiple_profiles/index.html create mode 100644 files/pt-pt/mozilla/firefox/multiprocess_firefox/cross_process_object_wrappers/index.html create mode 100644 files/pt-pt/mozilla/firefox/multiprocess_firefox/depuracao_de_frame_scripts/index.html create mode 100644 files/pt-pt/mozilla/firefox/multiprocess_firefox/gestor_de_mensagens/index.html create mode 100644 files/pt-pt/mozilla/firefox/multiprocess_firefox/glossario/index.html create mode 100644 files/pt-pt/mozilla/firefox/multiprocess_firefox/index.html create mode 100644 files/pt-pt/mozilla/firefox/multiprocess_firefox/limitacoes_de_chrome_scripts/index.html create mode 100644 files/pt-pt/mozilla/firefox/multiprocess_firefox/limitacoes_de_frame_scripts/index.html create mode 100644 files/pt-pt/mozilla/firefox/multiprocess_firefox/quais_os_uris_que_carregam_e_onde/index.html create mode 100644 "files/pt-pt/mozilla/firefox/multiprocess_firefox/resumo_t\303\251cnico/index.html" create mode 100644 files/pt-pt/mozilla/firefox/releases/3/index.html create mode 100644 files/pt-pt/mozilla/firefox/releases/70/index.html create mode 100644 files/pt-pt/mozilla/firefox/releases/index.html create mode 100644 files/pt-pt/mozilla/firefox_for_android/index.html create mode 100644 files/pt-pt/mozilla/how_to_get_a_stacktrace_for_a_bug_report/index.html create mode 100644 files/pt-pt/mozilla/implementacao_do_pontoon_num_projeto_da_mozilla/index.html create mode 100644 files/pt-pt/mozilla/index.html create mode 100644 files/pt-pt/mozilla/ligar/index.html create mode 100644 "files/pt-pt/mozilla/localization/aplica\303\247\303\243o_tradu\303\247\303\243o_com_mercurial/index.html" create mode 100644 "files/pt-pt/mozilla/localization/guia_inicia\303\247\303\243o_r\303\241pida/configuracao_inicial/index.html" create mode 100644 "files/pt-pt/mozilla/localization/guia_inicia\303\247\303\243o_r\303\241pida/fase_da_traducao/index.html" create mode 100644 "files/pt-pt/mozilla/localization/guia_inicia\303\247\303\243o_r\303\241pida/fase_de_lancamento/index.html" create mode 100644 "files/pt-pt/mozilla/localization/guia_inicia\303\247\303\243o_r\303\241pida/fase_pr/index.html" create mode 100644 "files/pt-pt/mozilla/localization/guia_inicia\303\247\303\243o_r\303\241pida/index.html" create mode 100644 files/pt-pt/mozilla/localization/index.html create mode 100644 files/pt-pt/mozilla/localization/index/index.html create mode 100644 files/pt-pt/mozilla/localization/localizacao_e_plurais/index.html create mode 100644 files/pt-pt/mozilla/localization/localizar_com_mercurial/index.html create mode 100644 "files/pt-pt/mozilla/localization/localiza\303\247\303\243o_com_pontoon/index.html" create mode 100644 files/pt-pt/mozilla/mercurial/basicos/index.html create mode 100644 files/pt-pt/mozilla/mercurial/index.html create mode 100644 files/pt-pt/mozilla/mercurial/instaacao_mercurial/index.html create mode 100644 files/pt-pt/mozilla/o0coes_linha_comandos/index.html create mode 100644 files/pt-pt/mozilla/performance/about_colon_memory/index.html create mode 100644 files/pt-pt/mozilla/performance/comunicacao_de_um_problema_de_desempenho/index.html create mode 100644 files/pt-pt/mozilla/performance/index.html create mode 100644 files/pt-pt/mozilla/performance/perfilar_com_o_profiler_integrado/index.html create mode 100644 files/pt-pt/mozilla/persona/index.html create mode 100644 files/pt-pt/mozilla/phishing/index.html create mode 100644 files/pt-pt/mozilla/projects/emscripten/index.html create mode 100644 files/pt-pt/mozilla/projects/index.html create mode 100644 files/pt-pt/mozilla/projects/mailnews/index.html create mode 100644 files/pt-pt/mozilla/projects/rhino/index.html create mode 100644 files/pt-pt/mozilla/projects/thunderbird/localizacao_thunderbird/index.html create mode 100644 files/pt-pt/mozilla/tech/index.html create mode 100644 files/pt-pt/mozilla/tech/places/index.html create mode 100644 files/pt-pt/mozilla/tech/xpcom/armazenamento/index.html create mode 100644 "files/pt-pt/mozilla/tech/xpcom/guide/altera\303\247\303\265es_xpcom_gecko_2.0/index.html" create mode 100644 files/pt-pt/mozilla/tech/xpcom/guide/index.html create mode 100644 files/pt-pt/mozilla/tech/xpcom/index.html create mode 100644 files/pt-pt/mozilla/tech/xpcom/reference/glue_classes/index.html create mode 100644 files/pt-pt/mozilla/tech/xpcom/reference/index.html create mode 100644 files/pt-pt/mozilla/tech/xul/attribute/textbox.type/index.html create mode 100644 files/pt-pt/mozilla/thunderbird/autoconfiguration/fileformat/como/index.html create mode 100644 files/pt-pt/mozilla/thunderbird/autoconfiguration/fileformat/definicao/index.html create mode 100644 files/pt-pt/mozilla/thunderbird/autoconfiguration/fileformat/index.html create mode 100644 "files/pt-pt/mozilla/thunderbird/configuracao_autom\303\241tica/index.html" create mode 100644 files/pt-pt/mozilla/thunderbird/index.html create mode 100644 files/pt-pt/mozilla/thunderbird/lancamentos/index.html create mode 100644 files/pt-pt/mozilla/trabalhar_com_janelas_no_codigo_chrome/index.html create mode 100644 "files/pt-pt/mozilla/utiliza\303\247\303\243o_cxx_no_c\303\263digo_da_mozilla/index.html" (limited to 'files/pt-pt/mozilla') 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 +--- +

Content to be added.

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 +--- +

{{AddonSidebar}}

+ +

Featured add-ons are top-quality extensions and themes highlighted on AMO, 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.

+ +

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.

+ +

Todos os meses, são escolhidas novas extensões em destaque.

+ +

Critérios para Extensões em Destaque

+ +

Before nominating an extension to be featured, please ensure it meets the following criteria:

+ +
    +
  1. The extension must have a complete and informative listing on AMO. This means: +
      +
    • a 64-pixel custom icon
    • +
    • a clear and concise name (no lengthy keywords)
    • +
    • a clear and concise summary of the extension's functionality
    • +
    • detailed description and privacy policy, if applicable
    • +
    • updated screenshots of the extension's functionality
    • +
    +
  2. +
  3. The extension must have excellent user reviews and any problems or support requests must be promptly addressed by the developer.
  4. +
  5. The extension must have a minimum of 500 users.
  6. +
  7. The extension must be built with WebExtensions API.
  8. +
  9. The extension must be compatible with the latest release of Firefox.
  10. +
  11. Most importantly, 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.
  12. +
+ +

Painel de Descoberta

+ +

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.

+ +

Only content that is part of AMO’s Featured Extensions collection will be considered for the Discovery Pane; please note that featured content must meet certain criteria.

+ +

Discovery Pane content is updated monthly, though some highly popular extensions may remain on the page for an indefinite period of time.

+ +

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 amo-featured@mozilla.org 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.

+ +

Nomear um Extra

+ +

If you wish to nominate an extension to be featured and it meets the criteria above, send an email to amo-featured@mozilla.org with:

+ + + +

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.

+ +

Rodar Extensões em Destaque

+ +

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:

+ + + +

Aderir ao Conselho Consultivo de Extensões em Destaque

+ +

Every six months a new Advisory Board is chosen based on applications from the add-ons community. Members must:

+ + + +

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.

+ +

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.

+ +

Follow the Add-ons Blog or @mozamo on Twitter to learn when the next application period opens.

+ +

Última atualização: 12 de abril de 2018

+ +

How up-and-coming add-ons become featured and what's involved in the process.

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 +--- +

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.

+ +
+
Developer Agreement
+
Effective January 5, 2016
Review Process
+
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.
Featured Add-ons
+
How up-and-coming add-ons become featured and what's involved in the process.
Contacting us + +

How to get in touch with us regarding these policies or your add-on.

+ +
diff --git "a/files/pt-pt/mozilla/add-ons/amo/policy/revis\303\265es/index.html" "b/files/pt-pt/mozilla/add-ons/amo/policy/revis\303\265es/index.html" new file mode 100644 index 0000000000..96e6d880f5 --- /dev/null +++ "b/files/pt-pt/mozilla/add-ons/amo/policy/revis\303\265es/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 +--- +

{{AddonSidebar}}

+ +

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.

+ +

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.

+ +

Sem Surpresas

+ +

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.

+ +

Funcionalidades Inesperadas

+ +

“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.

+ +

Um extra deveria incluir qualquer funcionalidade inesperada que se enquadre numa das seguintes categorias:

+ + + +

Então, a(s) funcionalidade(s) "inesperada(s)" devem seguir todos os seguintes requisitos:

+ + + +

Conteúdo

+ +

Os extras que utilizarem as marcas registadas da Mozilla devem obedecer à Política de Marcas Registadas da Mozilla. Se o extra utiliza “Firefox” no seu nome, o padrão de nomeação que o extra deve seguir é “<nome do Extra> por Firefox”.

+ +

Além disso, os extras listados em Extras para o Firefox (AMO) devem seguir as seguintes políticas:

+ + + +

Linhas Diretrizes de Submissão

+ +

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 aqui.

+ +

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.

+ +

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.

+ +

Submissão de Código Fonte

+ +

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.

+ +

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.

+ +

Please read our Source Code Submission guidelines to avoid unexpected rejections.

+ +

Práticas de Desenvolvimento

+ +

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.

+ +

While any code, method or practice in a submitted add-on is subject to review and rejection, the following requirements are of particular importance:

+ + + +

Gestão, Recolha e Divulgação de Dados

+ +

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 Lean Data Practices and Mozilla’s Data Privacy Principles, and uses the data only for the purpose for which it was originally collected.

+ +

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.

+ +

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:

+ + + +

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.

+ +

Interações do Utilizador e Dados Técnicos

+ + + +

Cookies

+ + + +

Dados Pessoais

+ + + +

Protocolos de Privacidade Adicionais

+ + + +

Vulnerabilidades de Segurança

+ +

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.

+ +

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.

+ +

Monetização

+ + + +

Conformidade e Lista de Bloqueio

+ +

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.

+ +

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.

+ +

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.

diff --git "a/files/pt-pt/mozilla/add-ons/cri\303\247\303\243o_de_extens\303\265es_firefox_com_sistema_mozilla/index.html" "b/files/pt-pt/mozilla/add-ons/cri\303\247\303\243o_de_extens\303\265es_firefox_com_sistema_mozilla/index.html" new file mode 100644 index 0000000000..35a9c7fbe1 --- /dev/null +++ "b/files/pt-pt/mozilla/add-ons/cri\303\247\303\243o_de_extens\303\265es_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 +--- +

{{AddonSidebar}}

+ +

Existe uma abundância de  material na criação de extensões para Firefox. Todos estes documentos atualmente assumem, contudo, que está a desenvolver a sua extensão utilizando apena JavaScript e XUL. 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:

+ +
+
+
+
+
+
 
+
+
+
+
+
+ + + +
Note: With the modern JIT Javascript Engine in Gecko and js-ctypes 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.
+ +

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 not 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 XPCOM component or two, this is probably overkill, and you might want to take a look at this guide 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.

+ +

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.

+ +

Bambi Cruza-se com Mozilla

+ +

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.

+ +

Nas Plataformas do Windows

+ +

The first time I built Mozilla I used this guide. 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 comprehensive looking guide 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.

+ +

Em Outras Plataformas

+ +

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 here.

+ +

Estruturar o Seu Projeto

+ +

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 extensions/ directory and so forth. So it behooves us to piggyback on this infrastructure to build our extension.

+ +

First of all, think of a catchy name for your extension and create a directory with that name under the /mozilla/extensions/ directory. Use only lowercase letters. You should see a bunch of other directories (inspector/, reporter/ and so forth) at the same level in the build tree.

+ +

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 Makefile.in. 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.

+ +

Anatomia de uma Extensão C++ Simples

+ +

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.

+ +

In the simplest case, a component will consist of a single main directory with two subdirectories, public/ and src/. The main directory and each subdirectory must contain a Makefile.in (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.

+ +

So here’s your basic, plain-vanilla top-level makefile (Makefile.in in the main extension directory):

+ +
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
+
+ +

A detailed description of the make process, describing the key features of this makefile, can be found here. MODULE and XPI_NAME 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). INSTALL_EXTENSION_ID 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 XPI_PKGNAME, but if you do an XPI file, suitable for distribution, is automatically created in the root of the XPI staging area (/mozilla/$(MOZ_OBJDIR)/dist/xpi-stage/).

+ +

Every extension must include an install.rdf file that tells Firefox how to install it. This file should be located in the main extension directory and look something like this:

+ +
<?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>
+
+ +

There's a detailed description of the format of the install.rdf file. Use the DIST_FILES variable in the makefile to tell make to copy the file into the extension directory and (optional) XPI file.

+ +

Interfaces Públicas

+ +

The public/ directory contains any interfaces that need to be accessed by other modules. These can be IDL files describing XPCOM 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.

+ +

The makefile in the public/ directory should follow this model:

+ +
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
+
+ +

XPIDL_MODULE is the name of the generated XPT file that contains type information about your IDL interfaces. If you have multiple modules, make absolutely sure that you use a different value for XPIDL_MODULE for each one. Otherwise the first module’s XPT file will be overwritten by the second and you’ll get NS_ERROR_XPC_BAD_IID errors when you try to access its IDL interfaces from your code. The files under EXPORTS are copied directly to the /mozilla/$(MOZ_OBJDIR)/dist/include/ directory and are thus accessible from other modules (the value of MOZ_OBJDIR is defined in /mozilla/.mozconfig). 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 components/ subdirectory of your extension.

+ +

Ficheiros Fonte

+ +

Now it’s time to create the makefile and source files in the src/ subdirectory. If you're implementing interfaces that you've described using IDL, the easiest way to do this is to leave the src/ directory empty and run make on the public/ directory only; this will be explained shortly.

+ +

Then open the generated header file for your interface from /mozilla/$(MOZ_OBJDIR)/dist/include/. 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.

+ +

Here’s an example of the makefile you need to place into your src directory:

+ +
DEPTH		= ../../..
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+IS_COMPONENT = 1
+MODULE = myextension
+LIBRARY_NAME =  myExtension
+USE_STATIC_LIBS = 1
+
+XPI_NAME = myextension
+
+CPPSRCS	= \
+  myFirstComponent.cpp \
+  mySecondComponent.cpp \
+  myExtension.cpp \
+  $(NULL)
+
+include $(topsrcdir)/config/rules.mk
+
+EXTRA_DSO_LDOPTS += \
+  $(MOZ_COMPONENT_LIBS) \
+  $(NSPR_LIBS) \
+  $(NULL)
+
+ +

In this example, the first two files contain the implementation of the extension’s two components. The final file, myExtension.cpp, contains the code necessary to register these components, as described in the next section.

+ +

Registar os Seus Componentes

+ +

Este artigo explica como registar os componentes XPCOM no Gecko 2.0 e superior.

+ +

Criação de Extensão

+ +

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 firefox.exe. Do not pass go. Do not collect $200.

+ +

Still here? Okay, now we have to modify your .mozconfig (in the /mozilla/ root directory) so that your extension is built along with Mozilla. Add the following line at the end of the file:

+ +
ac_add_options --enable-extensions=default,myextension
+
+ +

Now launch make from the Mozilla root:

+ +
make -f client.mk build
+
+ +

Even if you have an up-to-date Firefox build, you’ll have to wait a while for make 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 /mozilla/$(MOZ_OBJDIR)/:

+ + + +

A lot of this stuff won’t get created on this first pass since make 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 make. If you’re changing the generated files directly, you’re probably doing something wrong.

+ +

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:

+ +
../build/autoconf/make-makefile extensions/myextension
+
+ +

If your $(MOZ_OBJDIR) is located outside your $(TOPSRCDIR), you'll need to do:

+ +
$(TOPSRCDIR)/build/autoconf/make-makefile -t $(TOPSRCDIR) extensions/myextension
+
+ +

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).

+ +

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 /mozilla/$(MOZ_OBJDIR)/extensions/myextension/ 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 /mozilla/$(MOZ_OBJDIR)/dist/bin/extensions. (If something goes wrong, figure out what, fix it and then come back here and add it to this article.)

+ +

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 MOZ_NO_REMOTE environment variable to "1" before running the development version of Firefox. You’ll also need to use a different profile for your development version:

+ +
firefox -P development
+
+ +

Where development 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.

+ +

Nenhum Local Como o Chrome

+ +

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 JavaScript and XUL code. At this point, it would be very helpful to have a bit of experience writing "regular" extensions (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.

+ +

Assuming you know how to write XUL/JavaScript extensions, you’re aware that the most important stuff goes in the chrome/ 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 content/, locale/ and skin/ 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 chrome/ subdirectory or whatever. Let freedom reign!

+ +

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 JAR Manifest. For our simple extension example, this file might look something like this:

+ +
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)
+
+ +

Place this code in a file called jar.mn 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:

+ +
USE_EXTENSION_MANIFEST = 1
+
+ +

This tells make to create a single manifest file called chrome.manifest instead of creating separate manifests with goofy names for each package.

+ +

Now launch make again, and you should see a chrome subdirectory appear in your extension (/mozilla/$(MOZ_OBJDIR)/dist/bin/extensions/myextension@mycompany.com/). Note that the chrome directory contains a JAR (i.e. ZIP) file with all the chrome files listed in jar.mn 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.

+ +

Mantedo-a Complexa

+ +

If you’re developing a really complex extension with lots of XPCOM components, you’ll probably want to divide your code up into smaller modules.

+ +
Kinda, Sorta Complex Extensions
+ +

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 base/ module that defines a bunch of basic XPCOM components and an advanced/ module that defines some chrome as well as other components that use the basic components. Your complete directory structure will look something like this:

+ + + +

Other than that, nothing really changes. The makefiles in the base/ and advanced/ directories should look more or less like your original root makefile, remembering to change the DEPTH variable to account for the fact that they’ve moved a level further away from the Mozilla root. You also need to remove the DIST_FILES variable since that’s going to be in the top-level makefile. Every makefile that generates anything should define the XPI_NAME variable to make sure generated files go into your extension and not into the global components/ directory. In fact, just define this in every makefile to be safe. You can use the same MODULE in both base/ and advanced/ so that all the generated include files go into the same directory, but make sure that you don’t use the same XPIDL_MODULE in the two public/ directories or one of the component type libraries (i.e. XPT files) will overwrite the other one and all hell will break loose.

+ +

Each module must also have a different value for the LIBRARY_NAME variable. This is the name of the generated dynamic library, so if we call the libraries "myBase" and "myAdvanced", we’ll end up with myBase.dll and myAdvanced.dll (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 myExtension.cpp in the original example, say Base.cpp and Advanced.cpp. Finally, each module will obviously have its own jar.mn, 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 install.rdf, which still exists once and only once in the extension root directory.

+ +

As for the top-level makefile, it will now look like this:

+ +
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
+
+ +
Extensões Complexas Sérias
+ +

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 myExtension.cpp 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.

+ +

To split a module into submodules, first create a subdirectory for each submodule. Then create an additional directory called build/. Each submodule will be configured to create a static library, and the build/ directory will pull these libraries together to create a single dynamic component library. Confused? Here’s an example, showing just the advanced/ subbranch of the myextension/ directory:

+ + + +

As you can see, we’ve split advanced/ into two submodules: intricate/ and multifarious/, and we’ve added an additional build/ subdirectory. We’ve left the chrome directories directly under advanced/, since they aren’t tied to any specific submodule. This means that jar.mn will stay in the same place.

+ +

The intricate/ and multifarious/ makefiles will look a lot like the original advanced/ makefile, but we’ll need to tweak them a bit. As always, we have to adjust the DEPTH variable since the makefiles are deeper in the directory structure. And we should change the LIBRARY_NAME 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 FORCE_STATIC_LIB, resulting in a makefile that starts something like this:

+ +
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...
+
+ +

The build makefile pulls together the static libraries generated by the submodules and creates a single (dynamic) component library:

+ +
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)
+
+ +

The makefile in the advanced/ directory should list the intricate/, multifarious/ and build/ directories in its DIRS variable. Make sure that build/ comes last since it can’t create the component library until the other makefiles have completed.

+ +

Outros Tópicos

+ +

Adicionar Ficheiros de Dados às Suas Extensões

+ +

In some cases, you may wish to include additional files in your extension that don’t belong in the chrome/ 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.

+ +
Copiar Ficheiros de Dados para a Diretoria de Destino
+ +

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 stats/ 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:

+ +
export::
+	if test ! -d $(FINAL_TARGET)/stats; then \
+		$(NSINSTALL) -D $(FINAL_TARGET)/stats; \
+	fi
+	$(INSTALL) $(srcdir)/*.txt $(FINAL_TARGET)/stats
+
+ +
Aceder aos Ficheiros de Dados a partir dos Componentes
+ +

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 nsIExtensionManager 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 __LOCATION__ (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.

+ +

This article explains how to create an XPCOM component in JavaScript. You’ll need an IDL file for an interface that looks something like this:

+ +
interface myILocation : nsISupports
+{
+    readonly attribute nsIFile locationFile;
+};
+
+ +

Place the IDL file in the public/ directory of your project or subproject. In the src/ 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:

+ +
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;
+  }
+}
+
+ +

This assumes that the component resides in a subdirectory of the extension directory (by convention, this directory is called components/). The parent property of __LOCATION__ returns the components/, and the parent of this is the extension directory.

+ +

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:

+ +
export::
+	$(INSTALL) $(srcdir)/*.js $(FINAL_TARGET)/components
+
+ +

Now you can instantiate an instance of this component and use the locationFile property to get an nsIFile interface that points to your extension’s home directory.

+ +

Using Third-Party Libraries

+ +

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.

+ +

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 db/sqlite. 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.

+ +

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 acmelib is used inside the multifarious/ subproject in the above example, it would be placed as a subdirectory underneath that subproject (at the same level as public/ and src/).

+ +

Of course, this means that you will have to build acmelib 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.

+ +

Building for Multiple Platforms

+ +

TODO

+ +
+

Original Document Information

+ + +
+ +

 

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 +--- +
{{AddonSidebar}}
+ +

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.

+ +

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.

+ +

Assinar os seus extras

+ +

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.

+ +

Unsigned extensions can be installed in Developer Edition, Nightly, and ESR versions of Firefox, after toggling the xpinstall.signatures.required preference in about:config.

+ +

Mozilla signs add-ons through the AMO website and provides three methods for submitting your add-on for signing:

+ + + +

All the signing options are subject to the Firefox Add-on Distribution Agreement.

+ +

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.

+ +

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 Add-on Policies.

+ +

Distributir o seu extra

+ +

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:

+ + + +

For more information on how to submit an add-on for distribution on AMO or self-distribution, see Submitting an add-on.

+ +

Mais informação sobre AMO

+ +

Propriedade

+ +

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 Hub do Programdor. Não é necessária nenhuma interação com os representantes da Mozilla para uma transferência de propriedade.

+ +

 

+ +

Para transferir propriedade

+ + + +

 

+ +

Disputas de códogo

+ +

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.

+ +

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 found here.

+ +

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.

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 +--- +
{{AddonSidebar}}
+ +

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:

+ + + +

Desenvolver extras

+ +

Existem, de momento, vários conjuntos de  ferramentas utilizadas para desenvolver Aplicações Complementares mas as  chamadas Extensões da Web vão tornar-se o padrão pelo final de 2017. Das restantes a expectativa é de que se tornem obsoletas dentro do mesmo periodo de tempo.

+ +

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.

+ +

Criar um Novo Extra

+ +

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.

+ + + +

Migrar um Extra Existente

+ +

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.

+ +

We've created resources, migration paths, office hours, and more, to ensure you have the support you need to get through the transition.

+ +

To get started, use the add-on compatibility checker to see if your add-on will be affected.

+ +

Publicação de extras

+ +

Addons.mozilla.org, 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.

+ +

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.

+ +

For an overview of the process of publishing your add-on, see Signing and distributing your add-on.

+ +

Outros tipos de extras

+ +

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:

+ + + +
+

Contacte-nos

+ +

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.

+ +

Fórum de extras

+ +

Utilize o fórum de conversação sobre os complementos para discutir todos aspetos do desenvolvimento de complementos e obter ajuda.

+ +

Listas de endereços/discussão

+ +

Use the dev-addons list to discuss development of the add-ons ecosystem, including the development of the WebExtensions system and of AMO:

+ + + +

IRC

+ +

If you're a fan of IRC, you can get in touch at:

+ + 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/' +--- +
+

Este documento já não é válido. Por favor, consulte o documento de Políticas de Revisão para o conjunto atual das políticas de extras.

+
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 +--- +
+

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.

+ +

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 WebExtensions instead. If you maintain an add-on which uses the techniques described here, consider migrating it to use WebExtensions.

+ +

Starting from Firefox 53, no new legacy add-ons will be accepted on addons.mozilla.org (AMO) for desktop Firefox and Firefox for Android.

+ +

Starting from Firefox 57, only extensions developed using WebExtensions APIs will be supported on Desktop Firefox and Firefox for Android.

+ +

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 "Compatibility Milestones" document for more information.

+ +

A wiki page containing resources, migration paths, office hours, and more, is available to help developers transition to the new technologies.

+
+

Pode criar extras do Firefox utilizando Add-on SDK. 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.

+ +
+

Tutoriais

+ +
+
+
+
Getting started
+
How to install the SDK and use the jpm tool to develop, test, and package add-ons.
+
Interact with the browser
+
Open web pages, listen for pages loading and list open pages.
+
Development techniques
+
Learn about common development techniques, such as unit testing, logging, creating reusable modules, localization, and mobile development.
+
+
+ +
+
+
Create user interface components
+
Create user interface components such as toolbar buttons, context menus, menu items, and dialogs.
+
Modify web pages
+
Modify pages matching a URL pattern or dynamically modify a particular tab.
+
Putting it together
+
Walkthrough of the Annotator example add-on.
+
+
+
+ +
+

Guias

+ +
+
+
+
Contributor's guide
+
Learn how to start contributing to the SDK and about the most important idioms used in the SDK code such as modules, classes and inheritance, private properties, and content processes.
+
SDK infrastructure
+
Aspects of the SDK's underlying technology: modules, the Program ID and the rules defining Firefox compatibility.
+
Content scripts
+
A detailed guide to working with content scripts.
+
+
+ +
+
+
SDK idioms
+
The SDK's event framework and the distinction between add-on scripts and content scripts.
+
XUL migration
+
A guide to porting XUL add-ons to the SDK. This guide includes a comparison of the two toolsets and a working example of porting a XUL add-on.
+
Multiprocess Firefox and the SDK
+
How to check whether your add-on is compatible with multiprocess Firefox or not and fix it accordingly.
+
+
+
+ +
+

Referência

+ +
+
+
+
High-Level APIs
+
Reference documentation for the high-level SDK APIs.
+
Tools reference
+
Reference documentation for the jpm tool used to develop, test and package add-ons, the console global used for logging, and the package.json file.
+
+
+ +
+
+
Low-Level APIs
+
Reference documentation for the low-level SDK APIs.
+
+
+
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 +--- +
{{AddonSidebar()}}
+ +

Os temas desenvolvidos utilizando a WebExtensions API 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.

+ +

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.

+ +
+

If you have a lightweight theme 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.

+
+ +

Temas estásticos

+ +

Static themes are specified using the same resources as a browser extension: a manifest.json 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 addons.mozilla.org (AMO).

+ +
+

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 Dynamic themes.

+
+ +

Definir um tema

+ +

To create a theme (in this example a simple, single image theme):

+ + + +

Static theme approaches

+ +

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.

+ +

Single image themes

+ +

This is the basic or minimal theming option, where you define:

+ + + +

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
+ 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.
+ combined with a complementary background color, to create this effect in the header
+ A single image theme using the weta.png image

+ +

See details about this theme in the themes example weta_fade.

+ +

Obviously, you can still provide a single wide image if you prefer.

+ +

Multiple image themes

+ +

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.

+ +

Depending on the effect you want to create you may need to suppress the mandatory "headerURL": 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
+ 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.
+ to create this effect
+ A single image theme using the additional images option to align an image to the center of the heading and tile it.
+ Here you specify the weta image like this:

+ +
"images": {
+  "headerURL": "empty.png",
+  "additional_backgrounds": [ "weta_for_tiling.png"]
+},
+ +

and the images tiling with:

+ +
"properties": {
+  "additional_backgrounds_alignment": [ "top" ],
+  "additional_backgrounds_tiling": [ "repeat"  ]
+},
+ +

Full details of how to setup this theme can be found in the themes example weta_tiled. Full detais of the alignment and tiling options can be found in the "theme" key description.

+ +

Alternatively, you can use multiple images, say combining the original weta image with this one anchored to the left of the header
+ 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.
+ to create this effect
+ A theme using the additional images option to place two mirrored image to the left and right of the browser header.

+ +

Where the images are specified with:

+ +
"images": {
+  "headerURL": "empty.png",
+  "additional_backgrounds": [ "weta.png", "weta-left.png"]
+},
+ +

and their alignment by:

+ +
"properties": {
+  "additional_backgrounds_alignment": [ "right top" , "left top" ]
+},
+ +

Full details of how to setup this theme can be found in the themes example weta_mirror. Full detais of the alignment options can be found in the "theme" key description.

+ +

Static animated themes

+ +

It is possible to create an animated theme using an APNG format image, as in the themes example animated. However, remember that rapid animations, such as the one in the example might be too distracting for a practical theme.

+ +

You can also animate themes programmatically, which we discuss in Dynamic themes.

+ +

Temas dinâmicos

+ +

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:

+ + + +

And, obviously, you can combine the two and bundle a programmatically controlled theme with your extension.

+ +

Using the {{WebExtAPIRef("theme")}} API is straightforward. First, request "theme" permission in the extension's manifest.json 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.

+ +

For example, the following code, from the dynamic theme example defines the content for the day and night elements of the dynamic theme:

+ +
const themes = {
+  'day': {
+    images: {
+     headerURL: 'sun.jpg',
+    },
+    colors: {
+     accentcolor: '#CF723F',
+     textcolor: '#111',
+    }
+  },
+  'night': {
+    images: {
+     headerURL: 'moon.jpg',
+    },
+    colors: {
+     accentcolor: '#000',
+     textcolor: '#fff',
+    }
+  }
+};
+ +

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:

+ +
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]);
+}
+ +

Learn more about dynamic themes and see an additional example in the following video:

+ +

{{EmbedYouTube("ycckyrUN0AY")}}

+ +

 

+ +

If you have not built a browser extension before, check out Your first extension for a step-by-step guide.

+ +

Compatibilidade entre navegadores

+ +

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.

+ +

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:

+ + + +

Noting that "frame": and "tab_text": support RGB color definition only.

+ +

So, in the single image theme example (weta_fade) could be supported in Chrome using the following manifest.json file:

+ +
{
+  "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 ]
+    }
+  }
+}
+ +

However, there will be a couple of differences:

+ + + +

The basic theme example using the Chrome compatible manifest.json keys, showing the differences in how those keys are implemented.

+ +

For more information, see the notes on Chrome compatibility.

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 +--- +

{{AddonSidebar}}

+ +

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!

+ +
+
+

Temas de Navegador

+ +
+
Browser theme concepts
+
Get an introduction to creating themes for the latest versions of Firefox
+
+ +

Temas Simples

+ +
+
Lightweight themes
+
Building lightweight themes for Firefox
+
Lightweight themes FAQ
+
Get answers to commonly asked questions
+
+
+ + +
+ +

 

+ +

 

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 +--- +

Introduction

+ +

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.

+ +

What is a skin?

+ +

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.

+ +

Contents

+ + + +
+

Informações Sobre o Documento Original

+ +
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 +--- +

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.

+

{{ ListSubPages ("/en-US/Add-ons/Themes/Obsolete", 5) }}

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 +--- +
Building a Thunderbird extension
+Step-by-step explanation on how to build an extension for Thunderbird.
+ +
+

{{AddonSidebar}}

+The following documentation provides help for creating extensions for Mozilla's Thunderbird email client. Although there are many similarities with Firefox extensions there are also some differences that may confound the starting developer.
+ +

+Please help! You can add a how-to (a question or an answer or a code snippet), summarize and link to a relevant newsgroup discussion, or create a tutorial. Need help? Contact jenzed.
+ + + + + + + + +
+

Documentation

+ +

Getting started with Thunderbird

+ +

A brave, young developer wants to develop an add-on for Thunderbird. Here's a few links to help them through this journey.

+ +
    +
  • Start by reading the tutorial and learn how to build a Thunderbird extension (Outdated, still talks about overlays and the add-on builder is no longer available but the tutorial has not been updated.)
  • +
  • Read about the main windows so that you know what one means when they say « thread pane », « preview pane », and « folder pane ».
  • + +
  • Want to do some real stuff? See how to inspect a message (demo add-on included!)
  • +
  • Play with our other demo add-on that exercises some more advanced Thunderbird-specific features
  • +
  • Want to do even more stuff? Don't reinvent the wheel: steal functions from the thunderbird-stdlib project (doc here). Functions for dealing with messages (delete them, archive them, change their tags, etc.) are included.
  • +
  • Haven't found what you're looking for? Read the Thunderbird how-tos; they contain a lot of recipes for things extensions want to do.
  • +
  • Still haven't managed to do what you wanted? See the list of all Thunderbird communication channels so that you know where to ask when you get stuck :-).
  • +
  • Feeling really brave? Read the source using a fancy interface; you can often find tests that demonstrate how to do what you're trying to achieve.
  • +
+ +

The Gloda database

+ +

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 (from field, to field) which are themselves part of a Contact: indeed, a contact has multiple identities.

+ +

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.

+ +

Gloda is extremely powerful and is used heavily by add-ons such as Thunderbird Conversations. Learn more about Gloda:

+ + + + + +

Some of these links may be wildly out of date, but they still provide valuable information on the codebase.

+ + + + + + +
+

Community

+ + + +

{{ DiscussionList("dev-extensions", "mozilla.dev.extensions") }}

+ + + +

Tools

+ + + +

... more tools ...

+ +

View All...

+ + + +
+
XUL, JavaScript, XPCOM, Themes, Developing Mozilla
+
+
+ +

Categories

+ +

{{ languages( { "ja": "ja/Extensions/Thunderbird" } ) }}

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 +--- +
{{AddonSidebar}}
+ +

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.

+ +

O código fonte para este exemplo está no GitHub: borderify.

+ +

Primeiro, precisa de ter o Firefox - versão 45 ou superior.

+ +

Escrever a extensão

+ +

Crie uma nova diretoria e vá para a mesma:

+ +
mkdir borderify
+cd borderify
+ +

manifest.json

+ +

Now create a new file called "manifest.json" directly under the "borderify" directory. Give it the following contents:

+ +
{
+
+  "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"]
+    }
+  ]
+
+}
+ + + +

The most interesting key here is content_scripts, 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.

+ + + +
+

In some situations you need to specify an ID for your extension. If you do need to specify an add-on ID, include the  applications key in manifest.json and set its gecko.id property:

+ +
"applications": {
+  "gecko": {
+    "id": "borderify@example.com"
+  }
+}
+
+ +

icons/border-48.png

+ +

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".

+ +

Create the "icons" directory directly under the "borderify" directory. Save an icon there named "border-48.png".  You could use the one from our example, which is taken from the Google Material Design iconset, and is used under the terms of the Creative Commons Attribution-ShareAlike license.

+ +

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 96 property of the icons object in manifest.json:

+ +
"icons": {
+  "48": "icons/border-48.png",
+  "96": "icons/border-96.png"
+}
+ +

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.)

+ + + +

borderify.js

+ +

Finally, create a file called "borderify.js" directly under the "borderify" directory. Give it this content:

+ +
document.body.style.border = "5px solid red";
+ +

This script will be loaded into the pages that match the pattern given in the content_scripts manifest.json key. The script has direct access to the document, just like scripts loaded by the page itself.

+ + + +

Testá-la

+ +

Primeiro, reverifique que tem os ficheiros corretos nos locais certos:

+ +
borderify/
+    icons/
+        border-48.png
+    borderify.js
+    manifest.json
+ +

Instalar

+ +

Open "about:debugging" in Firefox, click "Load Temporary Add-on" and select any file in your extension's directory:

+ +

{{EmbedYouTube("cer9EUKegG4")}}

+ +

The extension will now be installed, and will stay until you restart Firefox.

+ +

Alternatively, you can run the extension from the command line using the web-ext tool.

+ +

Testar

+ +

Now try visiting a page under "mozilla.org", and you should see the red border round the page:

+ +

{{EmbedYouTube("rxBQl2Z9IBQ")}}

+ +
+

Don't try it on addons.mozilla.org, though! Content scripts are currently blocked on that domain.

+
+ +

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:

+ +

{{EmbedYouTube("NuajE60jfGY")}}

+ + + +

Empacotar e publicação

+ +

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 "Publicar a sua extensão".

+ +

E a seguir?

+ +

Agora tem uma idéia do processo de desenvolvimento de uma Extensão da Web para o Firefox, tente:

+ + 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 +--- +
{{AddonSidebar}} +

Se já leu o artigo da A sua primeira extensã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. 
+
+ 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. 
+
+ Para implementar isto, nós iremos:.

+ +

To implement this, we will:

+ + + +

You could visualise the overall structure of the extension like this:

+ +

+ +

It's a simple extension, but shows many of the basic concepts of the WebExtensions API:

+ + + +

You can find complete source code for the extension on GitHub.

+ +

To write this extension, you'll need Firefox 45 or newer.

+ +

Escrever a extensão

+ +

Create a new directory and navigate to it:

+ +
mkdir beastify
+cd beastify
+ +

manifest.json

+ +

Now create a new file called "manifest.json", and give it the following contents:

+ +
{
+
+  "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"
+  ]
+
+}
+
+ + + +

Note that all paths given are relative to manifest.json itself.

+ +

O ícone

+ +

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".

+ +

Create the "icons" directory and save an icon there named "beasts-48.png".  You could use the one from our example, which is taken from the Aha-Soft’s Free Retina iconset, and used under the terms of its license.

+ +

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 96 property of the icons object in manifest.json:

+ +
"icons": {
+  "48": "icons/beasts-48.png",
+  "96": "icons/beasts-96.png"
+}
+ +

O botão de barra de ferramentas

+ +

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".

+ +

Save an icon named "beasts-32.png" in the "icons" directory. You could use the one from our example, which is taken from the IconBeast Lite icon set and used under the terms of its license.

+ +

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.

+ +

A janela (popup)

+ +

The function of the popup is to enable the user to choose one of three beasts.

+ +

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:

+ + + +
mkdir popup
+cd popup
+touch choose_beast.html choose_beast.css choose_beast.js
+
+ +

choose_beast.html

+ +

The HTML file looks like this:

+ +
<!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>
+
+ +

We have a <div> element with an ID of "popup-content" that contains an element for each animal choice. We have another <div> with an ID of "error-content" and a class "hidden". We'll use that in case there's a problem initializing the popup.

+ +

Note that we include the CSS and JS files from this file, just like a web page.

+ +

choose_beast.css

+ +

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 class="hidden": this means that our "error-content" <div> will be hidden by default.

+ +
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;
+}
+
+
+ +

choose_beast.js

+ +

Here's the JavaScript for the popup:

+ +
/**
+ * 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);
+
+
+ +

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 browser.tabs.executeScript() 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.

+ +

A common reason the browser.tabs.executeScript() 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 addons.mozilla.org domain. If it does fail, reportExecuteScriptError() will hide the "popup-content" <div>, show the "error-content" <div>, and log an error to the console.

+ +

If executing the content script is successful, we call listenForClicks(). This listens for clicks on the popup.

+ + + +

The beastify() function does three things:

+ + + +

The reset() function essentially undoes a beastify:

+ + + +

O script de conteúdo

+ +

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:

+ +
(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();
+    }
+  });
+
+})();
+
+ +

The first thing the content script does is to check for a global variable window.hasRun: if it's set the script returns early, otherwise it sets window.hasRun 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.

+ +

After that, the place to start is line 40, where the content script listens for messages from the popup, using the browser.runtime.onMessage API. We saw above that the popup script can send two different sorts of messages: "beastify" and "reset".

+ + + +

As feras

+ +

Finally, we need to include the images of the beasts.

+ +

Create a new directory called "beasts", and add the three images in that directory, with the appropriate names. You can get the images from the GitHub repository, or from here:

+ +

+ +

Testar a extensão

+ +

First, double check that you have the right files in the right places:

+ +
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
+ +

Starting in Firefox 45, you can install extensions temporarily from disk.

+ +

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:

+ +

{{EmbedYouTube("sAM78GU4P34")}}

+ +

Open a web page, then click the icon, select a beast, and see the web page change:

+ +

{{EmbedYouTube("YMQXyAQSiE8")}}

+ +

Programae a partir da linha de comando

+ +

Pode automatizar o passo da instalação temporária utilizando a ferramenta web-ext. Experimente isto:

+ +
cd beastify
+web-ext run
+
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 +--- +
{{AddonSidebar}}
+ +

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.

+ +

manifest.json

+ +

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.

+ +

This manifest can also contain pointers to several other types of files:

+ + + +

+ +

See the manifest.json reference page for all the details.

+ +

Other than those referenced from the manifest, an extension can include additional Extension pages with supporting files.

+ +

Scripts de fundo (segundo plano)

+ +

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.

+ +

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 WebExtension APIs in the script, as long as you have requested the necessary permissions.

+ +

Especificar os scripts de fundo

+ +

You can include a background script using the background key in "manifest.json":

+ +
// manifest.json
+
+"background": {
+  "scripts": ["background-script.js"]
+}
+ +

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.

+ +

Ambiente de script de fundo

+ +

APIS de DOM

+ +

Background scripts run in the context of special pages called background pages. This gives them a window global, along with all the standard DOM APIs provided by that object.

+ +

You do not have to supply your background page. If you include a background script, an empty background page will be created for you.

+ +

However, you can choose to supply your background page as a separate HTML file:

+ +
// manifest.json
+
+"background": {
+  "page": "background-page.html"
+}
+ +

APIs da Extensão da Web

+ +

Background scripts can use any of the WebExtension APIs in the script, as long as their extension has the necessary permissions.

+ +

Acesso cruzado da origem

+ +

Background scripts can make XHR requests to any hosts for which they have host permissions.

+ +

Conteúdo da Web

+ +

Background scripts do not get direct access to web pages. However, they can load content scripts into web pages and can communicate with these content scripts using a message-passing API.

+ +

Política de segurança do conteúdo

+ +

Background scripts are restricted from certain potentially dangerous operations, like the use of eval(), through a Content Security Policy. See Content Security Policy for more details on this.

+ +

Barras laterais, janelas (popups), opções de páginas

+ +

A sua extensão pode inclur vários componentes da interface do utilizador cujo conteúdo é definido utilizando um documento HTML:

+ + + +

For each of these components, you create an HTML file and point to it using a specific property in manifest.json. The HTML file can include CSS and JavaScript files, just like a normal web page.

+ +

All of these are a type of Extension pages, 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áginas de extensão

+ +

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.

+ +

You'd typically load a page like this using {{WebExtAPIRef("windows.create()")}} or {{WebExtAPIRef("tabs.create()")}}.

+ +

See Extension pages to learn more.

+ +

Scripts de conteúdo

+ +

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.

+ +

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.

+ +

Content scripts can see and manipulate the page's DOM, just like normal scripts loaded by the page.

+ +

Unlike normal page scripts, they can:

+ + + +

Content scripts cannot directly access normal page scripts but can exchange messages with them using the standard window.postMessage() API.

+ +

Usually, when we talk about content scripts, we are referring to JavaScript, but you can inject CSS into web pages using the same mechanism.

+ +

See the content scripts article to learn more.

+ +

Recursos de acessibilidade da Web

+ +

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.

+ +

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 img tags which reference the images via the src attribute.

+ +

To learn more, see the documentation for the web_accessible_resources manifest.json key.

+ +

 

+ +

 

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 +--- +
{{AddonSidebar}}
+ +

Permite que as extensões armazenem e recuperem dados, e escutem as alterações aos itens armazenados.

+ +

O sistema de armazenamento é baseado na API de Armazenamento da Web, com algumas diferenças. Entre outras diferençãs, estas incluem:

+ + + +

To use this API you need to include the "storage" permission in your manifest.json file.

+ +

Each extension has its own storage area, which can be split into different types of storage.

+ +

Although this API is similar to {{domxref("Window.localStorage")}} it is recommended that you don't use Window.localStorage 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 storage.local API will be correctly persisted in these scenarios.

+ +

Tipos

+ +
+
{{WebExtAPIRef("storage.StorageArea")}}
+
An object representing a storage area.
+
{{WebExtAPIRef("storage.StorageChange")}}
+
An object representing a change to a storage area.
+
+ +

Propriedades

+ +

storage has three properties, which represent the different types of available storage area.

+ +
+
{{WebExtAPIRef("storage.sync")}}
+
Represents the sync storage area. Items in sync storage are synced by the browser, and are available across all instances of that browser that the user is logged into, across different devices.
+
{{WebExtAPIRef("storage.local")}}
+
Represents the local storage area. Items in local storage are local to the machine the extension was installed on.
+
{{WebExtAPIRef("storage.managed")}}
+
Represents the managed storage area. Items in managed storage are set by the domain administrator and are read-only for the extension. Trying to modify this namespace results in an error.
+
+ +

Eventos

+ +
+
{{WebExtAPIRef("storage.onChanged")}}
+
Fired when one or more items change in a storage area.
+
+ +

Compatibilidade do navegador

+ +

{{Compat("webextensions.api.storage")}}

+ +

{{WebExtExamples("h2")}}

+ +
Reconehcimentos + +

This API is based on Chromium's chrome.storage API. This documentation is derived from storage.json in the Chromium code.

+ +

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

+
+ + 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 +--- +
{{AddonSidebar}}
+ +

Adiciona um botão à barra de ferramentas do navegador.

+ +

Uma ação do navegador é um botão na barra de ferramentas do navegador.

+ +

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 messages.

+ +

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.

+ +

You can define most of a browser action's properties declaratively using the browser_action key in the manifest.json.

+ +

With the browserAction API, you can:

+ + + +

Tipos

+ +
+
{{WebExtAPIRef("browserAction.ColorArray")}}
+
An array of four integers in the range 0-255 defining an RGBA color.
+
{{WebExtAPIRef("browserAction.ImageDataType")}}
+
Pixel data for an image. Must be an ImageData object (for example, from a {{htmlelement("canvas")}} element).
+
+ +

Funções

+ +
+
{{WebExtAPIRef("browserAction.setTitle()")}}
+
Sets the browser action's title. This will be displayed in a tooltip.
+
{{WebExtAPIRef("browserAction.getTitle()")}}
+
Gets the browser action's title.
+
{{WebExtAPIRef("browserAction.setIcon()")}}
+
Sets the browser action's icon.
+
{{WebExtAPIRef("browserAction.setPopup()")}}
+
Sets the HTML document to be opened as a popup when the user clicks on the browser action's icon.
+
{{WebExtAPIRef("browserAction.getPopup()")}}
+
Gets the HTML document set as the browser action's popup.
+
{{WebExtAPIRef("browserAction.openPopup()")}}
+
Open the browser action's popup.
+
{{WebExtAPIRef("browserAction.setBadgeText()")}}
+
Sets the browser action's badge text. The badge is displayed on top of the icon.
+
{{WebExtAPIRef("browserAction.getBadgeText()")}}
+
Gets the browser action's badge text.
+
{{WebExtAPIRef("browserAction.setBadgeBackgroundColor()")}}
+
Sets the badge's background color.
+
{{WebExtAPIRef("browserAction.getBadgeBackgroundColor()")}}
+
Gets the badge's background color.
+
{{WebExtAPIRef("browserAction.enable()")}}
+
Enables the browser action for a tab. By default, browser actions are enabled for all tabs.
+
{{WebExtAPIRef("browserAction.disable()")}}
+
Disables the browser action for a tab, meaning that it cannot be clicked when that tab is active.
+
+ +

Eventos

+ +
+
{{WebExtAPIRef("browserAction.onClicked")}}
+
Fired when a browser action icon is clicked. This event will not fire if the browser action has a popup.
+
+ +

Compatibilidade de navegador

+ +

{{Compat("webextensions.api.browserAction")}}

+ + + +

{{WebExtExamples("h2")}}

+ +
Reconhecimentos + +

This API is based on Chromium's chrome.browserAction API. This documentation is derived from browser_action.json in the Chromium code.

+ +

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

+
+ + 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 +--- +
{{AddonSidebar}}
+ +

Enables extensions to clear the data that is accumulated while the user is browsing.

+ +

In the browsingData API, browsing data is divided into types:

+ + + +

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.

+ +

All the browsingData.remove[X]() functions take a {{WebExtAPIRef("browsingData.RemovalOptions")}} object, which you can use to control two further aspects of data removal:

+ + + +

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.

+ +

To use this API you must have the "browsingData" API permission.

+ +

Types

+ +
+
{{WebExtAPIRef("browsingData.DataTypeSet")}}
+
Object used to specify the type of data to remove: for example, history, downloads, passwords, and so on.
+
{{WebExtAPIRef("browsingData.RemovalOptions")}}
+
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.
+
+ +

Methods

+ +
+
{{WebExtAPIRef("browsingData.remove()")}}
+
Removes browsing data for the data types specified.
+
{{WebExtAPIRef("browsingData.removeCache()")}}
+
Clears the browser's cache.
+
{{WebExtAPIRef("browsingData.removeCookies()")}}
+
Removes cookies.
+
{{WebExtAPIRef("browsingData.removeDownloads()")}}
+
Removes the list of downloaded files.
+
{{WebExtAPIRef("browsingData.removeFormData()")}}
+
Clears saved form data.
+
{{WebExtAPIRef("browsingData.removeHistory()")}}
+
Clears the browser's history.
+
{{WebExtAPIRef("browsingData.removeLocalStorage()")}}
+
Clears any local storage created by websites.
+
{{WebExtAPIRef("browsingData.removePasswords()")}}
+
Clears saved passwords.
+
{{WebExtAPIRef("browsingData.removePluginData()")}}
+
Clears data associated with plugins.
+
{{WebExtAPIRef("browsingData.settings()")}}
+
Gets the current value of settings in the browser's "Clear History" feature.
+
+ +

Browser compatibility

+ + + +

{{Compat("webextensions.api.browsingData", 2)}}

+ + + +

{{WebExtExamples("h2")}}

+ +
Acknowledgements + +

This API is based on Chromium's chrome.browsingData API.

+ +

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

+
+ + 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 +--- +
{{AddonSidebar()}}
+ +

Limpa dados guardados nos plug-ins do navegador.

+ +

Pode utilizar o parâmetro removalOptions, que é um objeto {{WebExtAPIRef("browsingData.RemovalOptions")}}, para:

+ + + +

Esta é uma função assíncrona que retorna um Promise.

+ +

Sintaxe

+ +
var removing = browser.browsingData.removePluginData(
+  removalOptions            // RemovalOptions object
+)
+
+ +

Parâmetros

+ +
+
removalOptions
+
object. 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.
+
+ +

Devolver valor

+ +

A Promise 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.

+ +

Compatibilidade de navegador

+ + + +

{{Compat("webextensions.api.browsingData.removePluginData")}}

+ +

Exemplos

+ +

Remove data stored by plugins in the last week:

+ +
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);
+ +

Remove all data stored by plugins:

+ +
function onRemoved() {
+  console.log("removed");
+}
+
+function onError(error) {
+  console.error(error);
+}
+
+browser.browsingData.removePluginData({}).
+then(onRemoved, onError);
+ +

{{WebExtExamples}}

+ +
Reconhecimentos + +

This API is based on Chromium's chrome.browsingData API.

+ +

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

+
+ + 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 +--- +
{{AddonSidebar}}
+ +
+

Embora as APIs sejam baseadas no Chrome devtools APIs, 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 Limitações das APIs de devtools.

+
+ +

The devtools.panels API lets a devtools extension define its user interface inside the devtools window.

+ +

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".

+ +

With the devtools.panels API you can create new panels in the devtools window.

+ +

Like all the devtools APIs, this API is only available to code running in the document defined in the devtools_page manifest.json key, or in other devtools documents created by the extension (such as the panel's own document). See Extending the developer tools for more.

+ +

Tipos

+ +
+
devtools.panels.ElementsPanel
+
Represents the HTML/CSS inspector in the browser's devtools.
+
devtools.panels.ExtensionPanel
+
Represents a devtools panel created by the extension.
+
devtools.panels.ExtensionSidebarPane
+
Represents a pane that an extension has added to the HTML/CSS inspector in the browser's devtools.
+
+ +

Propriedades

+ +
+
devtools.panels.elements
+
A reference to an ElementsPanel object.
+
devtools.panels.themeName
+
The name of the current devtools theme.
+
+ +

Funções

+ +
+
devtools.panels.create()
+
Creates a new devtools panel.
+
+ +

Eventos

+ +
+
devtools.panels.onThemeChanged
+
Fired when the devtools theme changes.
+
+ +

Compatibilidade do navegador

+ +

{{Compat("webextensions.api.devtools.panels", 2)}}

+ +

{{WebExtExamples("h2")}}

+ +
Reconhecimentos + +

This API is based on Chromium's chrome.devtools.panels API.

+ +

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

+
+ + 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 +--- +
{{AddonSidebar}}
+ +

Funções para a internationalizar a sua extensão. Pode utilizar estas APIs para ter as suas strings traduzidas dos ficheiros de localização empacotados com a sua extensão, descubra o idioma atual do navegador e descubra o valor do seu cabeçalho Accept-Language.

+ +

Para mais detalhes em como utilizar i18n para sua extensão, consulte:

+ + + +

Tipos

+ +
+
{{WebExtAPIRef("i18n.LanguageCode")}}
+
A language tag such as "en-US" or "fr".
+
+ +

Funções

+ +
+
{{WebExtAPIRef("i18n.getAcceptLanguages()")}}
+
Gets the accept-languages of the browser. This is different from the locale used by the browser. To get the locale, use {{WebExtAPIRef('i18n.getUILanguage')}}.
+
{{WebExtAPIRef("i18n.getMessage()")}}
+
Gets the localized string for the specified message.
+
{{WebExtAPIRef("i18n.getUILanguage()")}}
+
Gets the UI language of the browser. This is different from {{WebExtAPIRef('i18n.getAcceptLanguages')}} which returns the preferred user languages.
+
{{WebExtAPIRef("i18n.detectLanguage()")}}
+
Detects the language of the provided text using the Compact Language Detector.
+
+ +
+
+ +

Compatibilidade de navegador

+ +

{{Compat("webextensions.api.i18n")}}

+ +

{{WebExtExamples("h2")}}

+ +
+
+ +
Agradecimentos + +

This API is based on Chromium's chrome.i18n API. This documentation is derived from i18n.json in the Chromium code.

+ +

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

+
+ + 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 +--- +
{{AddonSidebar}}
+ +
{{SubpagesWithSummaries}}
+ +
Agradecimentos + +

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

+
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 +--- +
{{AddonSidebar}}
+ +

Uma ação de página é ícone clicável dentro da barra de endereço do navegador.

+ +

 

+ +

+ +

Pode ouvir cliques no ícone, ou especificar uma janela (popup) que será aberta quando o ícone for clicado.

+ +

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.

+ +

You can define most of a page action's properties declaratively using the page_action key in your manifest.json, but can also redefine them programmatically using this API.

+ +

Page actions are for actions that are only relevant to particular pages. If your icon should always be available, use a browser action instead.

+ +

Tipos

+ +
+
{{WebExtAPIRef("pageAction.ImageDataType")}}
+
Dados de píxel para uma imagem.
+
+ +

Funções

+ +
+
{{WebExtAPIRef("pageAction.show()")}}
+
Shows the page action for a given tab.
+
{{WebExtAPIRef("pageAction.hide()")}}
+
Hides the page action for a given tab.
+
{{WebExtAPIRef("pageAction.setTitle()")}}
+
Sets the page action's title. This is displayed in a tooltip over the page action.
+
{{WebExtAPIRef("pageAction.getTitle()")}}
+
Gets the page action's title.
+
{{WebExtAPIRef("pageAction.setIcon()")}}
+
Sets the page action's icon.
+
{{WebExtAPIRef("pageAction.setPopup()")}}
+
Sets the URL for the page action's popup.
+
{{WebExtAPIRef("pageAction.getPopup()")}}
+
Gets the URL for the page action's popup.
+
{{WebExtAPIRef("pageAction.openPopup()")}}
+
Opens the page action's popup.
+
+ +

Eventos

+ +
+
{{WebExtAPIRef("pageAction.onClicked")}}
+
Fired when a page action icon is clicked. This event will not fire if the page action has a popup.
+
+ +

Compatibilidade de navegador

+ +

{{Compat("webextensions.api.pageAction")}}

+ +

{{WebExtExamples("h2")}}

+ +
Reconhecimentos + +

This API is based on Chromium's chrome.pageAction API. This documentation is derived from page_action.json in the Chromium code.

+ +

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

+
+ + 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 +--- +
{{AddonSidebar}}
+ +

Obtém e define as propriedades da barra lateral de uma extensão.

+ +

Uma barra lateral é um painel que é exibido no lado esquerdo ou direito da janela do navegador, ao lado da página da web. 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 sidebar_action , uma extensão pdoe definir a sua própria barra lateral. Utilizando a API sidebarAction descrita aqui, uma extension pode obter um conjunto de propriedades da barra lateral.

+ +

A API sidebarAction é modelada de perto na API {{WebExtAPIRef("browserAction")}}.

+ +

A API sidebarAction é baseada na API sidebarAction do Opera. Contudo, note que o seguinte ainda não é suportado: setBadgeText(), getBadgeText(), setBadgeBackgroundColor(), getBadgeBackgroundColor(), onFocus, onBlur.

+ +

Tipos

+ +
+
{{WebExtAPIRef("sidebarAction.ImageDataType")}}
+
Dados de pixel para uma imagem. Deve ser um objeto  ImageData (por exemplo, de um elemento {{htmlelement("canvas")}}).
+
+ +

Funções

+ +
+
{{WebExtAPIRef("sidebarAction.setPanel()")}}
+
Define o painel da barra lateral.
+
{{WebExtAPIRef("sidebarAction.getPanel()")}}
+
Obtém o painel da barra lateral.
+
{{WebExtAPIRef("sidebarAction.setTitle()")}}
+
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.
+
{{WebExtAPIRef("sidebarAction.getTitle()")}}
+
Obtém o título da barra lateral.
+
{{WebExtAPIRef("sidebarAction.setIcon()")}}
+
Define o ícone da barra lateral.
+
{{WebExtAPIRef("sidebarAction.open()")}}
+
Abre a abarra lateral.
+
{{WebExtAPIRef("sidebarAction.close()")}}
+
fecha a barra lateral.
+
{{WebExtAPIRef("sidebarAction.isOpen()")}}
+
Verifica sebarra lateral está ou não aberta.
+
+ +

Compatibilidade de navegador

+ +

{{Compat("webextensions.api.sidebarAction")}}

+ +

Exemplo de extras (add-ons)

+ + + +
Reconhecimentos + +

Esta API é baseada na API chrome.sidebarAction do Opera.

+ +

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

+
+ + + +
+ + + + + +
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 +--- +
{{AddonSidebar()}}
+ +

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.

+ +

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 addons.mozilla.org (AMO).

+ +

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 Usability Heuristics. We recommend, whether you are new to extension development or a seasoned pro, using Nielsen’s Heuristics as a checklist when testing your user experience (UX).

+ +

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.

+ +

Seja Firefoxy

+ +

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.

+ +

Design values

+ +

To best meet the needs of Firefox users, align with the Firefox values.

+ +

The Firefox Design Values 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.

+ +

Apresentação e impressão

+ +

To provide your extensions with the best long term fit to Firefox, align with the Firefox Photon Design System. Following Photon will ensure that your extension integrates with the Firefox experience and will make it easier for people to use.

+ +

Mantenha-a focada

+ +

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.

+ +
+

A short summary description of your extension is also very useful when it comes to creating its listing on AMO, see Make sure your summary is just long enough for more details.

+
+ +

Comece agora mesmo

+ +

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.

+ +

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.

+ +

Dê aos utilizadores o que eles precisam, onde eles precisam

+ +

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:

+ +

A minha extensão funciona na maioria dos sites da Web e páginas da Web?

+ +

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 toolbar button using the browser action. This might include providing access to your image editor or opening a page from your website.

+ +

+ +

Where you have several features you want to give the user access, you can add a popup to the button.

+ +

A minha extensão funciona apenas em alguns sites da Web e páginas?

+ +

If your extension offers a feature for a type of web page or specific domains, give the user access to it from an address bar button using a page action. This might include providing access to your RSS reader on pages with RSS feeds or providing an extended feature to pages on your website.

+ +

+ +

Where you have several features you want to give the user access, you can add a popup to the button.

+ +

A minha extensão precisa de mostrar informação ou oferecer ações em paralelo com as páginas da Web?

+ +

If your extension includes information or actions that a user would want immediate access to while viewing any web page, use a sidebar. This might include notes the user can make about a page’s content or a feature offering various font substitutions to improve readability.

+ +



+ +

A minha extensão oferece funcionalidade especifica para o conteúdo da página ou outras funcionalidades do navegador?

+ +

If your extension offers features the user might want to access in context, add them to an appropriate context menu. 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.

+ +

Example of content menu items added by a WebExtension, from the context-menu-demo example

+ +

A minha extensão tem definições que o utilizador pode ajustar?

+ +

If your extension enables the user to change and save settings that affect the behavior of the extension, use an options page to provide a standard Preferences link to settings from the Add-on Manager.

+ +

Typical preferences button, to access an extension's settings, from the Add-on Manager

+ +

A minha extensão precisa de recolher muita informação ou exibir conteúdo em adição aos separadores atuais?

+ +

Where your extension needs to gather or display significant amounts of information (more than is suitable for an alert or would benefit from additional formatting) use bundled web pages to deliver forms and similar content.

+ +

Example of a simple bundled page displayed as a detached panel.

+ +

A minha extensão tenta ajudar o utilizador a entrar as páginas da Web ou conteúdo?

+ +

Where your extension includes a use case to locate web pages or content, for example, offering a site specific search, use address bar suggestions to deliver those recommendations.

+ +

Example showing the result of the firefox_code_search WebExtension's customization of the address bar suggestions.

+ +

A minha extensão oferece ferramentas para os programadores?

+ +

Where you are providing tools for developers, add them to the Firefox developer tools using developer tools panels.

+ +

Mantenha o utilizador informado

+ +

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.

+ +

Diga ao utilizador o que irá acontecer, antes que aconteça

+ +

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.

+ +
+

Do not put the name of the extension alone in the tooltip, unless it is descriptive of the action the button will perform.

+
+ +

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.

+ +

Se é realmente importante e o utilizador afastou-se, notifique-os

+ +

If your extension has completed a critical, long running background task, when the task completes use the operating system’s native notifications 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.

+ +

+ +

Utilizar browserAction badges sparingly

+ +

You can add a badge over the toolbar icon of a browserAction, but do so sparingly to inform users about important events. Do not use them to provide regular or persistent status updates.

+ +

When it comes to coloring a badge, using one of four colors for notifications of different severity is recommended:

+ + + +
+

Use of Firefox colors is suggested, for more details see Firefox Colors. However, for compatibility with Chrome and Opera free color selection is supported.

+
+ +

Testar, testar, e depois testar novamente

+ +

Testing is a vital part of creating an outstanding UX for your extension. There are two key aspects of testing your UX:

+ +
    +
  1. 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.
  2. +
  3. 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.
  4. +
+ +

Dicas de teste:

+ + 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 +--- +
{{AddonSidebar}}
+ +

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 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 Firefox.

+ +

Início rápido

+ +
    +
  1. Get an idea of the main things you'll have to change in your extension: + +
  2. +
  3. 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 Embedded WebExtensions for more information.
  4. +
  5. 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 thoroughly, 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.
  6. +
  7. When you're really 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 applications section of the WebExtension manifest.json file. Then you can submit your extension update to AMO as your normally would.
  8. +
+ +
+

Note that this is a one-way conversion: You cannot 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.

+
+ +

Camnihos de migração

+ +

Extensões SDK

+ +

Here is the comparison chart showing SDK APIs and their WebExtensions format counterparts. 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.

+ +

Extensões XUL/XPCOM

+ +

Here is the comparison chart showing XUL/XPCOM APIs and their WebExtensions format counterparts. 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.

+ +

Migração parcial

+ +

An Embedded WebExtension 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, Embedded WebExtensions 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.

+ +

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.

+ +

Não vê as APIs das Extensões da Web que precisa?

+ +

Develop WebExtension APIs for Firefox - If you're experienced with Mozilla infrastructure and would like to develop WebExtensions APIs directly for Firefox, here is a list of approved APIs that you can start contributing to.

+ +

Experiment with new WebExtension APIs - If you want to prototype and tinker with WebExtensions APIs without having to build Firefox, WebExtensions Experiments is for you!

+ +

Request a new WebExtensions API - If you want to request a new WebExtensions API, please read this page.

+ +

Ferramentas

+ + + +

Documentação

+ + + +

Contactar

+ + diff --git "a/files/pt-pt/mozilla/add-ons/webextensions/dubla_padr\303\265es/index.html" "b/files/pt-pt/mozilla/add-ons/webextensions/dubla_padr\303\265es/index.html" new file mode 100644 index 0000000000..8c0f5e3480 --- /dev/null +++ "b/files/pt-pt/mozilla/add-ons/webextensions/dubla_padr\303\265es/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 +--- +
{{AddonSidebar}}
+ +

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 content scripts into, and to specify which URLs to add webRequest listeners to.

+ +

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 content_scripts key in manifest.json.

+ +

Match pattern structure

+ +
+

Note: Some browsers don’t support certain schemes.
+ Check the Browser compatibility table for details.

+
+ +

All match patterns are specified as strings. Apart from the special <all_urls> pattern, match patterns consist of three parts: scheme, host, and path. The scheme and host are separated by ://.

+ +
<scheme>://<host><path>
+ +

scheme

+ +

The scheme component may take one of two forms:

+ + + + + + + + + + + + + + + + + + +
FormMatches
*Only "http" and "https" and in some browsers also "ws" and "wss".
One of http, https, ws, wss, ftp, ftps, data or file.Only the given scheme.
+ +

host

+ +

The host component may take one of three forms:

+ + + + + + + + + + + + + + + + + + + + + + +
FormMatches
*Any host.
*. followed by part of the hostname.The given host and any of its subdomains.
A complete hostname, without wildcards.Only the given host.
+ +

host must not include a port number.

+ +

host is optional only if the scheme is "file".

+ +

Note that the wildcard may only appear at the start.

+ +

path

+ +

The path component must begin with a /.

+ +

After that, it may subsequently contain any combination of the * wildcard and any of the characters that are allowed in URL paths or query strings. Unlike host, the path component may contain the * wildcard in the middle or at the end, and the * wildcard may appear more than once.

+ +

The value for the path matches against the string which is the URL path plus the URL query string. This includes the ? 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 foo.bar, then you need to use an array of Match Patterns like ['*://*/*foo.bar', '*://*/*foo.bar?*']. The ?* is needed, rather than just bar*, in order to anchor the ending * as applying to the URL query string and not some portion of the URL path.

+ +

Neither the URL fragment identifier, nor the # which precedes it, are considered as part of the path.

+ +
+

Note: The path pattern string should not include a port number. Adding a port, as in: "http://localhost:1234/*" causes the match pattern to be ignored. However, "http://localhost:1234" will match with "http://localhost/*"

+
+ +

<all_urls>

+ +

The special value <all_urls> matches all URLs under any of the supported schemes: that is "http", "https", "ws", "wss", "ftp", "data", and "file".

+ +

Examples

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PatternExample matchesExample non-matches
+

<all_urls>

+ +

Match all URLs.

+
+

http://example.org/

+ +

https://a.org/some/path/

+ +

ws://sockets.somewhere.org/

+ +

wss://ws.example.com/stuff/

+ +

ftp://files.somewhere.org/

+ +

ftps://files.somewhere.org/

+
+

resource://a/b/c/
+ (unsupported scheme)

+
+

*://*/*

+ +

Match all HTTP, HTTPS and WebSocket URLs.

+
+

http://example.org/

+ +

https://a.org/some/path/

+ +

ws://sockets.somewhere.org/

+ +

wss://ws.example.com/stuff/

+
+

ftp://ftp.example.org/
+ (unmatched scheme)

+ +

ftps://ftp.example.org/
+ (unmatched scheme)

+ +

file:///a/
+ (unmatched scheme)

+
+

*://*.mozilla.org/*

+ +

Match all HTTP, HTTPS and WebSocket URLs that are hosted at "mozilla.org" or one of its subdomains.

+
+

http://mozilla.org/

+ +

https://mozilla.org/

+ +

http://a.mozilla.org/

+ +

http://a.b.mozilla.org/

+ +

https://b.mozilla.org/path/

+ +

ws://ws.mozilla.org/

+ +

wss://secure.mozilla.org/something

+
+

ftp://mozilla.org/
+ (unmatched scheme)

+ +

http://mozilla.com/
+ (unmatched host)

+ +

http://firefox.org/
+ (unmatched host)

+
+

*://mozilla.org/

+ +

Match all HTTP, HTTPS and WebSocket URLs that are hosted at exactly "mozilla.org/".

+
+

http://mozilla.org/

+ +

https://mozilla.org/

+ +

ws://mozilla.org/

+ +

wss://mozilla.org/

+
+

ftp://mozilla.org/
+ (unmatched scheme)

+ +

http://a.mozilla.org/
+ (unmatched host)

+ +

http://mozilla.org/a
+ (unmatched path)

+
+

ftp://mozilla.org/

+ +

Match only "ftp://mozilla.org/".

+
ftp://mozilla.org +

http://mozilla.org/
+ (unmatched scheme)

+ +

ftp://sub.mozilla.org/
+ (unmatched host)

+ +

ftp://mozilla.org/path
+ (unmatched path)

+
+

https://*/path

+ +

Match HTTPS URLs on any host, whose path is "path".

+
+

https://mozilla.org/path

+ +

https://a.mozilla.org/path

+ +

https://something.com/path

+
+

http://mozilla.org/path
+ (unmatched scheme)

+ +

https://mozilla.org/path/
+ (unmatched path)

+ +

https://mozilla.org/a
+ (unmatched path)

+ +

https://mozilla.org/
+ (unmatched path)

+ +

https://mozilla.org/path?foo=1
+ (unmatched path due to URL query string)

+
+

https://*/path/

+ +

Match HTTPS URLs on any host, whose path is "path/" and which has no URL query string.

+
+

https://mozilla.org/path/

+ +

https://a.mozilla.org/path/

+ +

https://something.com/path/

+
+

http://mozilla.org/path/
+ (unmatched scheme)

+ +

https://mozilla.org/path
+ (unmatched path)

+ +

https://mozilla.org/a
+ (unmatched path)

+ +

https://mozilla.org/
+ (unmatched path)

+ +

https://mozilla.org/path/?foo=1
+ (unmatched path due to URL query string)

+
+

https://mozilla.org/*

+ +

Match HTTPS URLs only at "mozilla.org", with any URL path and URL query string.

+
+

https://mozilla.org/

+ +

https://mozilla.org/path

+ +

https://mozilla.org/another

+ +

https://mozilla.org/path/to/doc

+ +

https://mozilla.org/path/to/doc?foo=1

+
+

http://mozilla.org/path
+ (unmatched scheme)

+ +

https://mozilla.com/path
+ (unmatched host)

+
+

https://mozilla.org/a/b/c/

+ +

Match only this URL, or this URL with any URL fragment.

+
+

https://mozilla.org/a/b/c/

+ +

https://mozilla.org/a/b/c/#section1

+
Anything else.
+

https://mozilla.org/*/b/*/

+ +

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 /.

+
+

https://mozilla.org/a/b/c/

+ +

https://mozilla.org/d/b/f/

+ +

https://mozilla.org/a/b/c/d/

+ +

https://mozilla.org/a/b/c/d/#section1

+ +

https://mozilla.org/a/b/c/d/?foo=/

+ +

https://mozilla.org/a?foo=21314&bar=/b/&extra=c/

+
+

https://mozilla.org/b/*/
+ (unmatched path)

+ +

https://mozilla.org/a/b/
+ (unmatched path)

+ +

https://mozilla.org/a/b/c/d/?foo=bar
+ (unmatched path due to URL query string)

+
+

file:///blah/*

+ +

Match any FILE URL whose path begins with "blah".

+
+

file:///blah/

+ +

file:///blah/bleh

+
file:///bleh/
+ (unmatched path)
+ +

Invalid match patterns

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Invalid patternReason
resource://path/Unsupported scheme.
https://mozilla.orgNo path.
https://mozilla.*.org/"*" in host must be at the start.
https://*zilla.org/"*" in host must be the only character or be followed by ".".
http*://mozilla.org/"*" in scheme must be the only character.
https://mozilla.org:80/Host must not include a port number.
*://*Empty path: this should be "*://*/*".
file://*Empty path: this should be "file:///*".
+ +

Browser compatibility

+ +

scheme

+ + + +

{{Compat("webextensions.match_patterns.scheme",10)}}

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_ +--- +
{{AddonSidebar}}
+ +

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.

+ +

O seu ambiente de desenvolvimento

+ +

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.

+ +

If you use minification or obfuscation tools to deliver your final code, you’ll need to provide your source code to the AMO review process. 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.

+ +

Learn more about build tools

+ +

Bibliotecas de terceiros

+ +

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 AMO review process, 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.

+ +

Learn more about submitting source code

+ +

O Acordo de Distribuição do Extra do Firefox

+ +

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.

+ +

Leia o acordo

+ +

Learn more about signing

+ +

O processo de revisão

+ +

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.

+ +

Check out the review policy and guidelines

+ +

Extensões do navegador em destaque no AMO

+ +

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.

+ +

Saiba mais sobre como colocar os seus extras em destaque

+ +

Continue a sua experiência de aprendizagem

+ +

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:

+ + 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 +--- +
{{AddonSidebar}}
+ +

Para ajudar a ilustrar como desenvolver extensões, nós mantemos um repositório de exemplos de extensões simples em https://github.com/mdn/webextensions-examples. Este artigo descreve as APIs de Extensão da Web utilizadas nesse repositório.

+ +

Estes exemplos funcionam no Firefox Nightly: a maioria funciona nas versões anteriores do Firefox, mas verifique a chave strict_min_version em manifest.json da extensão para se certificar.

+ +

Se quiser experimentar estes exemplos, tem três opções principais:

+ +
    +
  1. Clone o repositório, depois carregue a extensão diretamente da sua diretoria fonte, utilizando a funcionalidade "Carregar Temporariamente os Extras". A extensão permanecerá carregada até que reinicie o Firefox.
  2. +
  3. Clone o repositório, depois utilize a ferramenta de linha de comando web-ext para executar o Firefox com a extensão instalada.
  4. +
  5. Clone o repositório, depois vá para a diretoria de build. 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 addons.mozilla.org.
  6. +
+ +
+

Importante: 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.

+
+ +

Se desejar contribuir para o repositório, envie-nos um pedido de submissão!

+ +

{{WebExtAllExamples}}

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 +--- +
{{AddonSidebar}}
+ +
+

Os extras do Firefox contêm uma Id. única que é utilziada para distinguir este extra de qualquer outro extra do Firefox.

+ +

Este artigo descreve como as Ids. de extra são tratados para as extensões criadas com APIs WebExtensions.

+
+ +

Firefox add-ons contain a unique identifier which is used both inside Firefox itself and on the addons.mozilla.org (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.

+ +

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 install manifest, while SDK add-ons set it in the package.json.

+ +

However, from Firefox 48 you can develop, debug, publish, and update extensions without needing to set an explicit ID at all.

+ +
+

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 applications key to set an ID explicitly.

+
+ +

Basic workflow with no add-on ID

+ +

Extensions can explicitly set the add-on ID using the applications 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 applications key and will show a warning if you include it.

+ +

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 applications key. See When do you need an Add-on ID?.

+ +

Developing and debugging

+ +

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 install it in Firefox 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.

+ +

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 applications key in manifest.json

+ +

Publishing

+ +

Once you have finished developing the extension, you can package it and submit it to AMO for review and signing. 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.

+ +

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.

+ +

Updating

+ +

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.

+ +
+

It's essential with this workflow that you update the add-on manually using its page on AMO, 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.

+
+ +

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.

+ +

Quando é que precisa de uma Id. de extra?

+ + + +

 

+ +

 

+ +

 

diff --git "a/files/pt-pt/mozilla/add-ons/webextensions/extens\303\243o_das_ferramentas_de_desenvolvimento/index.html" "b/files/pt-pt/mozilla/add-ons/webextensions/extens\303\243o_das_ferramentas_de_desenvolvimento/index.html" new file mode 100644 index 0000000000..dc98e7fd37 --- /dev/null +++ "b/files/pt-pt/mozilla/add-ons/webextensions/extens\303\243o_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 +--- +
{{AddonSidebar}}
+ +
+

Esta página descreve as APIs das devtools  que existem no Firefox 55. Embora as APIs sejam baseadas nas APIs de devtools do Chrome, 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 Limitações das APIs de devtools.

+
+ +

Pode utilizar as APIs das Extensões da Web para ampliar as ferramentas de desenvollvimento integradas no navegador. Para criar a extensão devtools, inclua a chave "devtools_page" no manifest.json:

+ +
"devtools_page": "devtools/devtools-page.html"
+ +

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.

+ +

O ficheiro HTML define uma página especial na extensão, chamada de página devtools.

+ +

A página devtools

+ +

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.

+ +

The devtools page doesn't have any visible DOM, but can include JavaScript sources using <script> tags. The sources must be bundled with the extension itself. The sources get access to:

+ + + +

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 runtime messaging APIs.

+ +

Criar painéis

+ +

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".

+ +

Using the devtools.panels.create() API, you can create your own panel in the devtools window:

+ +
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);
+});
+ +

This takes three mandatory arguments: the panel's title, icon, and content. It returns a Promise which resolves to a devtools.panels.ExtensionPanel object representing the new panel.

+ +

Interagir com a janela de destino

+ +

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 devtools.inspectedWindow API.

+ +

Executar código na janela de destino

+ +

The devtools.inspectedWindow.eval() provides one way to run code in the inspected window.

+ +

This is somewhat like using {{WebExtAPIRef("tabs.executeScript()")}} to inject a content script, but with one important difference:

+ + + +
+

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.

+
+ +

Scripts loaded using devtools.inspectedWindow.eval() also don't see any JavaScript variables defined by content scripts.

+ +

Trabalhar com scripts de conteúdo

+ +

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 devtools.inspectedWindow.tabId 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()")}}:

+ +
// 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
+  });
+});
+ +
// background.js
+
+function handleMessage(request, sender, sendResponse) {
+  browser.tabs.executeScript(request.tabId, {
+    code: request.script
+  });
+}
+
+browser.runtime.onMessage.addListener(handleMessage);
+ +

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.

+ +

+ +

Limitações das APIs de devtools

+ +

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.

+ +

devtools.inspectedWindow

+ +

The following are not supported:

+ + + +

None of the options to inspectedWindow.eval() are supported.

+ +

Scripts injected using inspectedWindow.eval() can't use any of the Console's command-line helper functions, like $0.

+ +

devtools.network

+ +

The following are not supported:

+ + + +

devtools.panels

+ +

O seguinte não é suportado:

+ + + +

Exemplos

+ +

The webextensions-examples repo on GitHub, contains several examples of extensions that use devtools panels:

+ + 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 +--- +
{{AddonSidebar}}
+ +

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 API de extensão suportada pelo Google Chrome, Opera e W3C Draft Community Group.

+ +

As extensões escritas para estes navegadores irão na maioria dos casos ser executadas no Firefox ou Microsoft Edge com apenas algumas alterações. A API também é totalmente compatível com os multiprocessos do Firefox.

+ +

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 lista de discussões dev-addons ou #webextensions no IRC

+ +
+
+

Começar

+ + + +

Conceitos

+ + + +

Interface do utilizador

+ + + +

Como...

+ + + +
    +
+ +

Porting

+ + + +

Fluxo de trabalho do Firefox

+ + +
+ +
+

Referência

+ +

APIS de JavaScript

+ + + +
{{ ListSubpages ("/en-US/Add-ons/WebExtensions/API") }}
+ +

id="Manifest_keys">Manifest keys

+ + + +
{{ ListSubpages ("/en-US/Add-ons/WebExtensions/manifest.json") }}
+
+
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 +--- +
{{AddonSidebar}}
+ +

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 extensões bootstrapped e extras de Add-on SDK.

+ +

Note that this is not 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 Publishing your extension.

+ +

To install an extension temporarily:

+ + + +

The extension will be installed, and will stay installed until you restart Firefox.

+ +

{{EmbedYouTube("cer9EUKegG4")}}

+ +

Recarregar uma extensão temporária

+ +

Starting in Firefox 48, there's a new button labeled "Reload" next to the extension's entry in about:debugging:

+ +

This does what it says:

+ + + +

{{EmbedYouTube("NuajE60jfGY")}}

+ +
+

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.

+
+ +

Utilizar a linha de comando

+ +

If you are already using the command line for development, check out the web-ext tool. It automates the temporary installation step and automatically reloads your extension when its source code changes.

+ +

Detetar instalaçao temporária

+ +

Your extension can detect whether it was installed from about:debugging rather than as a built and signed extension downloaded from addons.mozilla.org. Listen for the {{WebExtAPIRef("runtime.onInstalled")}} event, and check the value of details.temporary.

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 +--- +
{{AddonSidebar}}
+ +

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:

+ + + +

Neste articulo nós vamos dar uma olhada a tres usos diferentes para o modulo webRequest:

+ + + +

Loggar pedidos URLs

+ +

Crie um diretorio chamado "requests". Nesse diretorio crie um ficheiro chamado "manifest.json" com o seguinte conteudo:

+ +
{
+  "description": "Demonstração webRequests",
+  "manifest_version": 2,
+  "name": "webRequest-demo",
+  "version": "1.0",
+
+  "permissions": [
+    "webRequest",
+    "<all_urls>"
+  ],
+
+  "background": {
+    "scripts": ["background.js"]
+  }
+}
+ +

De seguida, crie um ficheiro chamado "background.js" com o seguinte conteudo:

+ +
function logURL(requestDetails) {
+  console.log("A carregar: " + requestDetails.url);
+}
+
+browser.webRequest.onBeforeRequest.addListener(
+  logURL,
+  {urls: ["<all_urls>"]}
+);
+
+
+ +

Here we use {{WebExtAPIRef("webRequest.onBeforeRequest", "onBeforeRequest")}} to call the logURL() function just before starting the request. The logURL() function grabs the URL of the request from the event object and logs it to the browser console. The {urls: ["<all_urls>"]} pattern means we will intercept HTTP requests to all URLs.

+ +

To test it out, install the extension, open the Browser Console, and open some Web pages. In the Browser Console, you should see the URLs for any resources that the browser requests:

+ +

{{EmbedYouTube("X3rMgkRkB1Q")}}

+ +

Redirecting requests

+ +

Now let's use webRequest to redirect HTTP requests. First, replace manifest.json with this:

+ +
{
+
+  "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"]
+  }
+
+}
+ +

The only change here is to add the "webRequestBlocking" permission. We need to ask for this extra permission whenever we are actively modifying a request.

+ +

Next, replace "background.js" with this:

+ +
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"]
+);
+ +

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 redirectUrl specified in the function.

+ +

This time we are not intercepting every request: the {urls:[pattern], types:["image"]} 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.

+ +

Also note that we're passing an option called "blocking": 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 "blocking".

+ +

To test it out, open a page on MDN that contains a lot of images (for example https://developer.mozilla.org/en-US/docs/Tools/Network_Monitor), reload the extension, and then reload the MDN page:

+ +

{{EmbedYouTube("ix5RrXGr0wA")}}

+ +

Modifying request headers

+ +

Finally we'll use webRequest 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/".

+ +

The "manifest.json" can stay the same as in the previous example.

+ +

Replace "background.js" with code like this:

+ +
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"]
+);
+ +

Here we use the {{WebExtAPIRef("webRequest.onBeforeSendHeaders", "onBeforeSendHeaders")}} event listener to run a function just before the request headers are sent.

+ +

The listener function will be called only for requests to URLs matching the targetPage pattern. Also note that we've again passed "blocking" as an option. We've also passed "requestHeaders", 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.

+ +

The listener function looks for the "User-Agent" header in the array of request headers, replaces its value with the value of the ua variable, and returns the modified array. This modified array will now be sent to the server.

+ +

To test it out, open useragentstring.com and check that it identifies the browser as Firefox. Then reload the extension, reload useragentstring.com, and check that Firefox is now identified as Opera:

+ +

{{EmbedYouTube("SrSNS1-FIx0")}}

+ +

Learn more

+ +

To learn about all the things you can do with the webRequest API, see its reference documentation.

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 +--- +
{{AddonSidebar}}
+ +

Normalmente referido como uma ação da página, 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.

+ +

+ +

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 pageAction.show() and pageAction.hide() to show or hide it in specific tabs.

+ +

Compare to the toolbar button, which offers similar behavior but is used in situations where the extension's features are applicable to almost every web page.

+ +

Especificar a ação da página

+ +

You define the page action's properties using the page_action key in manifest.json:

+ +
"page_action": {
+  "browser_style": true,
+  "default_icon": {
+    "19": "button/geo-19.png",
+    "38": "button/geo-38.png"
+  },
+  "default_title": "Whereami?"
+}
+ +

The only mandatory key is default_icon.

+ +

There are two ways to specify a page action: with or without a popup. 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 pageAction.onClicked:

+ +
browser.pageAction.onClicked.addListener(handleClick);
+ +

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 Popup article for more details on creating and managing popups.

+ +

Note that your extension can have one page action only.

+ +

You can change any of the page action properties programmatically using the pageAction API.

+ +

Exemplos

+ +

The webextensions-examples repo on GitHub, contains several examples of extensions that use page action:

+ + diff --git "a/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/a\303\247\303\243o_navegador/index.html" "b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/a\303\247\303\243o_navegador/index.html" new file mode 100644 index 0000000000..c5da78003b --- /dev/null +++ "b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/a\303\247\303\243o_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 +--- +
{{AddonSidebar}}
+ +

Normalmente referido como uma ação do navegador, 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.
+

+ +

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 Page actions and browser actions.

+ +

Especificar a ação do navegador

+ +

Define as propriedades da ação do navegador utilizando a chave browser_action em manifest.json:

+ +
"browser_action": {
+  "default_icon": {
+    "19": "button/geo-19.png",
+    "38": "button/geo-38.png"
+  },
+  "default_title": "Whereami?"
+}
+ +

The only mandatory key is default_icon.

+ +

There are two ways to specify a browser action: with or without a popup. 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 browserAction.onClicked:

+ +
browser.browserAction.onClicked.addListener(handleClick);
+ +

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 Popup article for more details on creating and managing popups.

+ +

Note that your extension can have only one browser action.

+ +

You can change any of the browser action properties programmatically using the browserAction API.

+ +

Ícones

+ +

For details on how to create icons to use with your browser action, see Iconography in the Photon Design System documentation.

+ +

Exemplos

+ +

The webextensions-examples repository on GitHub contains two examples of extensions that implement browser actions:

+ + 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 +--- +
{{AddonSidebar}}
+ +
+

 

+ +

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.

+ +

O navegador poderá incluir uma série de barras laterais integradas. Por exemplo, o Firefox inclui uma barra lateral para interagir com marcadores:

+ +

Using the sidebar_action 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.

+ +

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.

+ +

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:

+ +
// sidebar.js
+browser.windows.getCurrent({populate: true}).then((windowInfo) => {
+  myWindowId = windowInfo.id;
+});
+ +

This is useful if a sidebar wants to display different content for different windows. For an example of this, see the "annotate-page" example.

+ +

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()")}}.

+ +

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.

+ +

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.

+ +

Especificar barras laterais

+ +

To specify a sidebar, define the default document with the sidebar_action manifest.json key, alongside a default title and icon:

+ +
"sidebar_action": {
+  "default_title": "My sidebar",
+  "default_panel": "sidebar.html",
+  "default_icon": "sidebar_icon.png"
+}
+ +

You can change the title, panel, and icon programmatically using the {{WebExtAPIRef("sidebarAction")}} API.

+ +

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.

+ +

Exemplo

+ +

O repositório de exemplos das extensões da Web no GitHub, contém vários exemplos de extensões que utilizam a barra lateral:

+ + +
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 +--- +
{{AddonSidebar}}
+ +
+

Esta funcionalidade está disponível desde o Firefox 54.

+
+ +

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.

+ +

Simple example showing the addition of "My panel" to the Developer Tools tabs.

+ +

Especificar um painel de ferramentas de desenvolvimento

+ +

Um painél das ferramentas de desenvovlimento é adicionado utilizando a API devtools.panels, que precisa de ser executada a partir de uma página de devtools especial.

+ +

Adicione a páginas de devtools, incluindo a chave devtools_page na extensão de manifest.json e forneça a localização do ficheiro HTML da página na extensão:

+ +
"devtools_page": "devtools-page.html"
+ +

From the devtools page, call a script that will add the devtools panel:

+ +
<body>
+  <script src="devtools.js"></script>
+</body>
+ +

In the script, create the devtools panel by specifying the panel's title, icon, and HTML file that provides the panel's content:

+ +
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);
+});
+ +

The extension can now run code in the inspected window using devtools.inspectedWindow.eval() 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 Extending the developer tools.

+ +

Exemplos

+ +

The webextensions-examples repo on GitHub, contains several examples of extensions that use devtools panels:

+ + 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 +--- +
{{AddonSidebar}}
+ +

Certain user interface components - browser and page action popups, sidebars, and options pages - are specified by your extension in essentially the same way:

+ +
    +
  1. create an HTML file defining the structure of the UI element
  2. +
  3. add a manifest.json key (browser_action, page_action, sidebar_action, or options_ui) pointing to that HTML file.
  4. +
+ +

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: browser_style. If this is included and set to true, 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 browser_style property.

+ +

In Firefox, the stylesheet can be seen at chrome://browser/content/extension.css. The extra stylesheet at chrome://browser/content/extension-mac.css is also included on OS X.

+ +

Most styles are automatically applied, but some elements require you to add the non-​standard browser-style class to get their styling since Firefox 55, as detailed in the table below:

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
ElementoExemplo
<button> +
+<button class="browser-style">Click me</button>{{non-standard_inline}}
+
+

<select>

+
+
+<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>
+
<textarea> +
+<textarea class="browser-style">Write here</textarea>
+
Parent of an <input> +
+<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>
+
+ +

Compatibilidade de navegador

+ + + +

{{Compat("webextensions.browser_style")}}

+ +

Componentes de Painel do Firefox

+ +
+

{{NonStandardBadge(1)}} Non-Standard
+ This feature is non-standard and only works in Firefox.

+
+ +

The chrome://browser/content/extension.css stylesheet also contains the styles for the Firefox Panel Components.

+ +

The legacy Firefox Style Guide documents proper usage.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ElementoExemplo
Cabeçalho +
+<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>
+
Rodapé +
+<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>
+
Separadores +
+<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>
+
Form +
+<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>
+
Menu +
+<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>
+
+ +

Exemplo

+ +

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>
+ + + +

Result

+ +

{{EmbedLiveSample("Example","640","360")}}

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 +--- +
{{AddonSidebar}}
+ +

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 .

+ +
+

For advice on using these UI components to create a great user experience in your extension, please see the User experience best practices article.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Opção de UIDescriçãoExemplo
Browser toolbar buttonA button on the browser toolbar that dispatches an event to the extension when clicked. By default, the button is visible in all tabs.Example of a WebExtension toolbar button
Browser toolbar button with a popupA 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.Example of a WebExtension toolbar button with a popup
Address bar buttonA button on the browser address bar that dispatches an event to the extension when clicked. By default, the button is hidden in all tabs.Example showing an address bar button (page action)
Address bar button with a popupA 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.Example of a popup on the address bar button
Context menu itemsMenu 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.
Sidebar +

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.

+
Example of a WebExtension's sidebar
Options pageA 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.Example showing the options page content added in the favorite colors example.
Bundled web pagesUse web pages included in your extension to provide forms, help, or any other content required, within windows or tabs.Example of a simple bundled page displayed as a detached panel.
NotificationsTransient 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).Example notification from a WebExtension
Address bar suggestionsOffer custom address bar suggestions when the user enters a keyword.Example showing the result of the firefox_code_search WebExtension's customization of the address bar suggestions.
Developer tools panelsA tab with an associated HTML document that displays in the browser's developer tools.New panel tab in the Developer Tools tab bar
+ +

The following how-to guides provide step-by-step guidance to creating some of these user interface options:

+ + 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 +--- +
{{AddonSidebar}}
+ +
+

Essa opção da interface do utilizador adiciona um ou mais itens a um menu de contexto do navegador.

+ +

Example of content menu items added by a WebExtension, from the context-menu-demo example

+ +

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")}}.

+ +

Especificar itens do menu de contexto

+ +

You manage context menu items programmatically, using the {{WebExtAPIRef("contextMenus")}} API. However, you need to request the contextMenus permission in your manifest.json to be able to take advantage of the API.

+ +
"permissions": ["contextMenus"]
+ +

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:

+ +
browser.contextMenus.create({
+  id: "log-selection",
+  title: browser.i18n.getMessage("contextMenuItemSelectionLogger"),
+  contexts: ["selection"]
+}, onCreated);
+ +

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.

+ +
browser.contextMenus.onClicked.addListener(function(info, tab) {
+  switch (info.menuItemId) {
+    case "log-selection":
+      console.log(info.selectionText);
+      break;
+    ...
+  }
+})
+ +

Exemplos

+ +

O repositório de wexemplos das Extensões da Web no GitHub, contém vários exemplos de extensões que utilizam os itens do menu de contexto:

+ + +
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 +--- +
{{AddonSidebar}}
+ +
+

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:

+ +

+ +

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.

+ +

Especificar as notificações

+ +

Pode gerir as notificações programaticamente, utilizando a API {{WebExtAPIRef("notifications")}}. Para utilizar esta API deve solicitar a permissão de notifications no seu manifest.json:

+ +
"permissions": ["notifications"]
+ +

Depois, pode utilziar {{WebExtAPIRef("notifications.create")}} para criar as suas notificações, como neste exemplo de notify-link-clicks-i18n:

+ +
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
+});
+ +

Este código cria uma notificação com um ícone, título, e mensagem.

+ +

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:

+ +
browser.notifications.onClicked.addListener(handleClick);
+
+ +

Se estiver a enviar chamadas para ação através das notificações, também irá querer definir a notificação opcional id, e assim, pode saber qual a chamada para ação que o utilizador selecionou.

+ +

Exemplos

+ +

O repositório dos exemplos da extensões da Web no GitHub, contém vários exemplos das extensões que utilizam creates notifications:

+ + +
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 +--- +
{{AddonSidebar()}}
+ +

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.

+ +

Example showing the result of the firefox_code_search WebExtension's customization of the address bar suggestions.

+ +

This enables your extension to, for example, search a library of free ebooks or, as in the example above, a repository of code examples.

+ +

Especificando a personalização de omnibox

+ +

You tell your extension that it is going to customize the address bar suggestions by including the omnibox key and definition of the trigger keyword in its manifest.json file:

+ +
  "omnibox": { "keyword" : "cs" }
+ +

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:

+ +
browser.omnibox.setDefaultSuggestion({
+  description: `Search the firefox codebase
+    (e.g. "hello world" | "path:omnibox.js onInputChanged")`
+});
+ +

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:

+ +
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);
+});
+ +

If the extension set a default suggestion using {{WebExtAPIRef("omnibox.setDefaultSuggestion()")}}, then this will appear first in the drop-down.

+ +

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:

+ +
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;
+  }
+});
+ +

 

+ +

Exemplos

+ +

O repositório dos exemplos das extensões da Web no GitHub inclui o exemplo firefox-code-search que personaliza a barra de pesquisa.

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 +--- +
{{AddonSidebar}}
+ +
+

Uma página de Opções 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:

+ +

{{EmbedYouTube("02oXAcbUv-s")}}

+ +

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.

+ + + +

You can open the page programmatically by calling runtime.openOptionsPage().

+ +

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 eval(). See Content Security Policy for more details.

+ +

Especificar a página de opções

+ +

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 favourite-colour example, includes a JavaScript file:

+ +
<!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>
+ +

JavaScript em execução na página pode utilizar a API das Extensões da Web que o extra tem permissões para. Em particular, pode utilziar a APi de armazenamento para manter as preferências.

+ +

Package the page's files in your extension.

+ +

You also need to include the options_ui key in your manifest.json file, giving it the URL to the page.

+ +
"options_ui": {
+  "page": "options.html",
+  "browser_style": true
+},
+ +

Exemplos

+ +

The webextensions-examples repo on GitHub, contains several examples of extensions that use an options page:

+ + +
diff --git "a/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/paginas_de_extens\303\243o/index.html" "b/files/pt-pt/mozilla/add-ons/webextensions/interface_do_utilizador/paginas_de_extens\303\243o/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\303\243o/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 +--- +
{{AddonSidebar()}}
+ +

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.

+ +

Example of a simple bundled page displayed as a detached panel.

+ +

These pages also get access to the same privileged JavaScript APIs that are available to your extension's background scripts.

+ +

Especificar páginas de extensão

+ +

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.

+ +
/my-extension
+    /manifest.json
+    /my-page.html
+    /my-page.js
+ +

Exibir páginas de extensão

+ +

There are two options for displaying extension pages: {{WebExtAPIRef("windows.create()")}} and {{WebExtAPIRef("tabs.create()")}}.

+ +

Using windows.create(), 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:

+ +
var createData = {
+  type: "detached_panel",
+  url: "panel.html",
+  width: 250,
+  height: 100
+};
+var creating = browser.windows.create(createData);
+ +

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()")}}:

+ +
document.getElementById("closeme").addEventListener("click", function(){
+  var winId = browser.windows.WINDOW_ID_CURRENT;
+  var removing = browser.windows.remove(winId);
+}); 
+ +

Páginas de extensão e histório

+ +

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:

+ +
function onVisited(historyItem) {
+  if (historyItem.url == browser.extension.getURL(myPage)) {
+    browser.history.deleteUrl({url: historyItem.url});
+  }
+}
+
+browser.history.onVisited.addListener(onVisited);
+ +

To use the history API, you must request the "history" permission in your manifest.json file.

+ +

Desenho da página da Web

+ +

For details on how to design your web page's to match the style of Firefox, see the Photon Design System documentation.

+ +

Exemplos

+ +

The webextensions-examples repository on GitHub includes the window-manipulator example, which implements several of the options for creating windows.

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 +--- +
{{AddonSidebar}}
+ +
+

Uma janela (popup) é uma janela que está associada com um botão da barra de ferramentas ou botão da barra de endereço.

+ +

+ +

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 window.close() 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.

+ +

Você pode definir um atalho de teclado que abre o popup usando "_execute_browser_action" and "_execute_page_action". Veja a documentação da chave commands       no manifest.json.

+ +

Especificar uma janela

+ +

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 WebExtension APIs que a extensão tem permissions .

+ +

O documento do popup é carregado toda vez que ele é exibido, e descarregado quando o popup é fechado.

+ +

O arquivo HTML é incluído na extensão e especificado como parte do  browser_action ou chave page_action por "default_popup" no arquivo manifest.json:

+ +
  "browser_action": {
+    "default_icon": "icons/beasts-32.png",
+    "default_title": "Beastify",
+    "default_popup": "popup/choose_beast.html"
+  }
+ +

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 "browser_style": true in the browser_action or page_action key.

+ +

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 eval(). See Content Security Policy for more details on this.

+ +

Depurar janelas

+ +

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. Read about debugging popups.

+ +

Redimensionar janelas

+ +

Popups resize automatically to fit their content. The algorithm for this may differ from one browser to another.

+ +

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 <body> element. For quirks mode, it's the <html> 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 800x600 pixels at most if that fits on the user's screen. If the user moves the extension's button to the menu or it appears in the toolbar overflow, then the popup appears inside the menu's panel and is given a fixed width.

+ +

No Firefox Android 57, popup é mostrada como uma página normal num novo separador.

+ +

Desenho de janela

+ +

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 Photon Design System.

+ +

Exemplos

+ +

The webextensions-examples  repository on GitHub includes the beastify example which implements a browser action with a popup.

+
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 +--- +
{{AddonSidebar}}
+ +

A API das Extensões da Web tem um módulo bastante útil disponível para a internacionalização das extensões — i18n. 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  i18n.js.

+ +
+

The example extension featured in this article — notify-link-clicks-i18n — is available on GitHub. Follow along with the source code as you go through the sections below.

+
+ +

Anatomia de uma extensão internacionalizada

+ +

An internationalized extension can contain the same features as any other extension — background scripts, content scripts, etc. — but it also has some extra parts to allow it to switch between different locales. These are summarized in the following directory tree:

+ + + +

Let's explore each of the new features in turn — each of the below sections represents a step to follow when internationalizing your extension.

+ +

Fornecer strings traduzidas em _locales

+ +
+
You can look up language subtags using the Find tool on the Language subtag lookup page. Note that you need to search for the English name of the language.
+
+ +

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 _locales, placed inside the extension root. Each individual locale has its strings (referred to as messages) contained within a file called messages.json, which is placed inside a subdirectory of _locales, named using the language subtag for that locale's language.

+ +

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 _locales, the separator must be an underscore: "en_US".

+ +

So for example, in our sample app we have directories for "en" (English), "de" (German), "nl" (Dutch), and "ja" (Japanese). Each one of these has a messages.json file inside it.

+ +

Let's now look at the structure of one of these files (_locales/en/messages.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"
+      }
+    }
+  }
+}
+ +

This file is standard JSON — each one of its members is an object with a name, which contains a message and a description. All of these items are strings; $URL$ is a placeholder, which is replaced with a substring at the time the notificationContent member is called by the extension. You'll learn how to do this in the {{anch("Retrieving message strings from JavaScript")}} section.

+ +
+

Note: You can find much more information about the contents of messages.json files in our Locale-Specific Message reference.

+
+ +

Internacionalizar manifest.json

+ +

There are a couple of different tasks to carry out to internationalize your manifest.json.

+ +

Obter as strings traduzidas em manifests

+ +

Your manifest.json 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.

+ +

To internationalize strings, specify them like this:

+ +
"name": "__MSG_extensionName__",
+"description": "__MSG_extensionDescription__",
+ +

Here, we are retrieving message strings dependant on the browser's locale, rather than just including static strings.

+ +

To call a message string like this, you need to specify it like this:

+ +
    +
  1. Two underscores, followed by
  2. +
  3. The string "MSG", followed by
  4. +
  5. One underscore, followed by
  6. +
  7. The name of the message you want to call as defined in messages.json, followed by
  8. +
  9. Two underscores
  10. +
+ +
__MSG_ + messageName + __
+ +

Especificar uma locale predefinida

+ +

Another field you should specify in your manifest.json is default_locale:

+ +
"default_locale": "en"
+ +

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")}}.

+ +

Locale-dependent CSS

+ +

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:

+ +
header {
+  background-image: url(../images/__MSG_extensionName__/header.png);
+}
+ +

This is useful, although you might be better off handling such a situation using {{anch("Predefined messages")}}.

+ +

Obter strings a partir de JavaScript

+ +

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 i18n API is pretty simple, containing just four main methods:

+ + + +

In our notify-link-clicks-i18n example, the background script contains the following lines:

+ +
var title = browser.i18n.getMessage("notificationTitle");
+var content = browser.i18n.getMessage("notificationContent", message.url);
+ +

The first one just retrieves the notificationTitle message field from the available messages.json 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 $URL$ placeholder we see in the notificationContent message field:

+ +
"notificationContent": {
+  "message": "You clicked $URL$.",
+  "description": "Tells the user which link they clicked.",
+  "placeholders": {
+    "url" : {
+      "content" : "$1",
+      "example" : "https://developer.mozilla.org"
+    }
+  }
+}
+
+ +

The "placeholders" member defines all the placeholders, and where they are retrieved from. The "url" placeholder specifies that its content is taken from $1, which is the first value given inside the second parameter of getMessage(). Since the placeholder is called "url", we use $URL$ to call it inside the actual message string (so for "name" you'd use $NAME$, etc.) If you have multiple placeholders, you can provide them inside an array that is given to {{WebExtAPIRef("i18n.getMessage()")}} as the second parameter — [a, b, c] will be available as $1, $2, and $3, and so on, inside messages.json.

+ +

Let's run through an example: the original notificationContent message string in the en/messages.json file is

+ +
You clicked $URL$.
+ +

Let's say the link clicked on points to https://developer.mozilla.org. After the {{WebExtAPIRef("i18n.getMessage()")}} call, the contents of the second parameter are made available in messages.json as $1, which replaces the $URL$ placeholder as defined in the "url" placeholder. So the final message string is

+ +
You clicked https://developer.mozilla.org.
+ +

Direct placeholder usage

+ +

It is possible to insert your variables ($1, $2, $3, etc.) directly into the message strings, for example we could rewrite the above "notificationContent" member like this:

+ +
"notificationContent": {
+  "message": "You clicked $1.",
+  "description": "Tells the user which link they clicked."
+}
+ +

This may seem quicker and less complex, but the other way (using "placeholders") is seen as best practice. This is because having the placeholder name (e.g. "url") and example helps you to remember what the placeholder is for — a week after you write your code, you'll probably forget what $1$8 refer to, but you'll be more likely to know what your placeholder names refer to.

+ +

Hardcoded substitution

+ +

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:

+ +
"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/"
+    }
+  }
+}
+ +

In this case we are just hardcoding the placeholder content, rather than getting it from a variable value like $1. 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.

+ +

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.

+ +

Seleção de string traduzida

+ +

Locales can be specified using only a language code, like fr or en, or they may be further qualified with a region code, like en_US or en_GB, 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:

+ +
    +
  1. if there is a messages.json file for the exact current locale, and it contains the string, return it.
  2. +
  3. Otherwise, if the current locale is qualified with a region (e.g. en_US) and there is a messages.json file for the regionless version of that locale (e.g. en), and that file contains the string, return it.
  4. +
  5. Otherwise, if there is a messages.json file for the default_locale defined in the manifest.json, and it contains the string, return it.
  6. +
  7. Otherwise return an empty string.
  8. +
+ +

Take the following example:

+ + + +

Suppose the default_locale is set to fr, and the browser's current locale is en_GB:

+ + + +

Mensagens predefinidas

+ +

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:

+ +
__MSG_extensionName__
+ +

Predefined messages use exactly the same syntax, except with @@ before the message name, for example

+ +
__MSG_@@ui_locale__
+ +

The following table shows the different available predefined messages:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Nome da mensagemDescrição
@@extension_id +

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.

+ +

You can't use this message in a manifest file.

+ +

Also note that this ID is not the add-on ID returned by {{WebExtAPIRef("runtime.id")}}, and that can be set using the applications 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 extensionId parameter to {{WebExtAPIRef("runtime.sendMessage()")}}, and can't use it to check against the id property of a {{WebExtAPIRef("runtime.MessageSender")}} object.

+
@@ui_localeThe current locale; you might use this string to construct locale-specific URLs.
@@bidi_dirThe 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.
@@bidi_reversed_dirIf the @@bidi_dir is "ltr", then this is "rtl"; otherwise, it's "ltr".
@@bidi_start_edgeIf the @@bidi_dir is "ltr", then this is "left"; otherwise, it's "right".
@@bidi_end_edgeIf the @@bidi_dir is "ltr", then this is "right"; otherwise, it's "left".
+ +

Going back to our earlier example, it would make more sense to write it like this:

+ +
header {
+  background-image: url(../images/__MSG_@@ui_locale__/header.png);
+}
+ +

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.

+ +

Let's look at an example of using @@bidi_* messages in a CSS file:

+ +
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;
+}
+ +

For left-to-right languages such as English, the CSS declarations involving the predefined messages above would translate to the following final code lines:

+ +
direction: ltr;
+padding-left: 0;
+padding-right: 1.5em;
+
+ +

For a right-to-left language like Arabic, you'd get:

+ +
direction: rtl;
+padding-right: 0;
+padding-left: 1.5em;
+ +

Testar a sua extensão

+ +

Starting in Firefox 45, you can install extensions temporarily from disk — see Loading from disk. Do this, and then try testing out our notify-link-clicks-i18n 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.

+ +

Next, change Firefox's locale to one supported in the extension that you want to test.

+ +
    +
  1. Open "about:config" in Firefox, and search for the intl.locale.requested preference (bear in mind that before Firefox 59, this pref is called general.useragent.locale).
  2. +
  3. 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 (""), which will cause the browser to use the OS default locale.
  4. +
  5. If the intl.locale.requested 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 intl.locale.requested for the preference name and, "de", or "nl", etc. for the preference value, as described in step 2 above.
  6. +
  7. Search for intl.locale.matchOS and, if the preference exists and has the value true, double-click it  so that it is set to false.
  8. +
  9. Restart your browser to complete the change.
  10. +
+ +
+

Nota: This works to change the browser's locale, even if you haven't got the language pack installed for that language. You'll just get the browser UI in your default language if this is the case.

+
+ +
    +
+ +
+

Nota: To change the result of getUILanguage the language pack is required, since it reflects the browser UI language and not the language used for extension messages.

+
+ +

Load the extension temporarily from disk again, then test your new locale:

+ + + +

{{EmbedYouTube("R7--fp5pPGg")}}

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 +--- +
{{AddonSidebar}}
+ + + + + + + + + + + + + + + + +
TipoObjeto
ObrigatórioNão
Exemplo +
+"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
+  }]
+}
+
+ +

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.

+ +

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 background scripts when the user clicks the button.

+ +

You can also create and manipulate browser actions programmatically using the browserAction API.

+ +

Sintaxe

+ +

The browser_action key is an object that may have any of the following properties, all optional:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NomeTipoDescrição
browser_styleBooliano +
Novo no Firefox 48
+ +

Optional, defaulting to false.

+ +

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 browser_style property. Although this key defaults to false, it's recommended that you include it and set it to true.

+ +

In Firefox, the stylesheet can be seen at chrome://browser/content/extension.css, or chrome://browser/content/extension-mac.css on OS X.

+ +

The Firefox Style Guide describes the classes you can apply to elements in the popup in order to get particular styles.

+ +

The latest-download example extension uses browser_style in its popup.

+
default_areaString +
Novo no Firefox 54
+ +

Defines the part of the browser in which the button is initially placed. This is a string that may take one of four values:

+ +
    +
  • "navbar": the button is placed in the main browser toolbar, alongside the URL bar.
  • +
  • "menupanel": the button is placed in a popup panel.
  • +
  • "tabstrip": the button is placed in the toolbar that contains browser tabs.
  • +
  • "personaltoolbar": the button is placed in the bookmarks toolbar.
  • +
+ +

This property is only supported in Firefox.

+ +

This property is optional, and defaults to "navbar".

+ +

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.

+
default_iconObject or String +

Use this to specify one or more icons for the browser action. The icon is shown in the browser toolbar by default.

+ +

Icons are specified as URLs relative to the manifest.json file itself.

+ +

You can specify a single icon file by supplying a string here:

+ +
+"default_icon": "path/to/geo.svg"
+ +

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:

+ +
+    "default_icon": {
+      "16": "path/to/geo-16.png",
+      "32": "path/to/geo-32.png"
+    }
+ +

See Choosing icon sizes for more guidance on this.

+
default_popupString +

The path to an HTML file containing the specification of the popup.

+ +

The HTML file may include CSS and JavaScript files using <link> and <script> elements, just like a normal web page.

+ +

Unlike a normal web page, JavaScript running in the popup can access all the WebExtension APIs (subject, of course, to the extension having the appropriate permissions).

+ +

This is a localizable property.

+
default_titleString +

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.

+ +

This is a localizable property.

+
theme_iconsArray +

This property enables you to specify different icons for dark and light themes.

+ +

If this property is present, it's an array containing at least one ThemeIcons object. A ThemeIcons object contains three properties, all mandatory:

+ +
+
"dark"
+
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).
+
"light"
+
A URL pointing to an icon. This icon will be selected when themes with light text are active (e.g. Firefox's Dark theme).
+
"size"
+
The size of the two icons in pixels.
+
+ +

Icons are specified as URLs relative to the manifest.json file itself.

+ +

Providing multiple ThemeIcons objects enables you to supply a set of icon pairs in different sizes.

+
+ +

Escolher os tamanhos do ícone

+ +

The browser action's icon may need to be displayed in different sizes in different contexts:

+ + + +

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.

+ +

There are two main approaches to this. You can supply a single icon as an SVG file, and it will be scaled correctly:

+ +
"default_icon": "path/to/geo.svg"
+ +

Alternatively, you can supply several icons in different sizes, and the browser will pick the best match.

+ +

In Firefox:

+ + + +

So you can specify icons that match exactly, on both normal and Retina displays, by supplying three icon files, and specifying them like this:

+ +
    "default_icon": {
+      "16": "path/to/geo-16.png",
+      "32": "path/to/geo-32.png",
+      "64": "path/to/geo-64.png"
+    }
+ +

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.

+ +

Exemplo

+ +
"browser_action": {
+  "default_icon": {
+    "16": "button/geo-16.png",
+    "32": "button/geo-32.png"
+  }
+}
+ +

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:

+ +
 browser.browserAction.onClicked.addListener(handleClick);
+ +
"browser_action": {
+  "default_icon": {
+    "16": "button/geo-16.png",
+    "32": "button/geo-32.png"
+  },
+  "default_title": "Whereami?",
+  "default_popup": "popup/geo.html"
+}
+ +

A browser action with an icon, a title, and a popup. The popup will be shown when the user clicks the button.

+ +

For a simple, but complete, extension that uses a browser action, see the walkthrough tutorial.

+ +

Compatibilidade de navegador

+ +

{{Compat("webextensions.manifest.browser_action", 10)}}

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 +--- +
{{AddonSidebar}}
+ + + + + + + + + + + + + + + + +
TipoObject
ObrigatórioUsually, no (but see also When do you need an Add-on ID?). Mandatory before Firefox 48 (desktop) and Firefox for Android.
Exemplo +
+"applications": {
+  "gecko": {
+    "id": "addon@example.com",
+    "strict_min_version": "42.0"
+  }
+}
+
+ +

Descrição

+ +

A chave applications contém chaves que são especificas de uma application de um anfitrião em particular.

+ +

Propriedadee (Gecko) do Firefox

+ +

Currently this contains just one key, gecko, which may contain four string attributes:

+ + + +

Consulte a lista das versões válidas de Gecko.

+ +

Formato da Id. da Extensão

+ +

A Id. da extensão deve ser uma das seguintes:

+ + + +

The latter format is easier to generate and manipulate. Be aware that using a real email address here may attract spam.

+ +

Por exemplo:

+ +
"id": "extensionname@example.org",
+
+"id": "{daf44bf7-a45e-4450-979c-91cf07434c3d}"
+ +

Propriedades do Microsoft Edge

+ +

Microsoft Edge stores its browser specific settings in the edge subkey, which has the following properties:

+ +
+
browser_action_next_to_addressbar
+
+

Boolean property which controls the placement of the browser action.

+ + +
+
+ +

Exemplos

+ +

Example with all possible keys. Note that most extensions will omit strict_max_version and update_url.

+ +
"applications": {
+  "gecko": {
+    "id": "addon@example.com",
+    "strict_min_version": "42.0",
+    "strict_max_version": "50.*",
+    "update_url": "https://example.com/updates.json"
+  },
+  "edge": {
+    "browser_action_next_to_addressbar": true
+  }
+}
+ +

Compatibilidade de navegador

+ + + +

{{Compat("webextensions.manifest.browser_specific_settings")}}

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 +--- +
{{AddonSidebar}}
+ + + + + + + + + + + + + + + + +
TipoString
ObrigatórioNão
Exemplo +
+"devtools_page": "devtools/my-page.html"
+
+ +

Utilziae esta chave para permitir que a sua extensão amplie as devtools do navegador integradas.

+ +

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.

+ +

Consulte Extensão das ferramentas de desenvolvimento para saber mais.

+ +

Exemplo

+ +
"devtools_page": "devtools/my-page.html"
+ +

Compatibilidade de navegador

+ + + +

{{Compat("webextensions.manifest.devtools_page")}}

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 +--- +
{{AddonSidebar}}
+ + + + + + + + + + + + + + + + +
TipoObjeto
ObrigatórioNão
Exemplo +
+"icons": {
+  "48": "icon.png",
+  "96": "icon@2x.png"
+}
+
+ +

The icons key specifies icons for your extension. Those icons will be used to represent the extension in components such as the Add-ons Manager.

+ +

It consists of key-value pairs of image size in px and image path relative to the root directory of the extension.

+ +

If icons is not supplied, a standard extension icon will be used by default.

+ +

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.

+ +

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.

+ +

Exemplo

+ +

The keys in the icons 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.

+ +
"icons": {
+  "48": "icon.png",
+  "96": "icon@2x.png"
+}
+ +

SVG

+ +

You can use SVG and the browser will scale your icon appropriately. There are currently two caveats though:

+ +
    +
  1. You need to specify a viewBox in the image. E.g.: +
    <svg viewBox="0 0 48 48" width="48" height="48" ...
    +
  2. +
  3. Even though you can use one file, you still need to specify various size of the icon in your manifest. E.g.: +
    "icons": {
    +  "48": "icon.svg",
    +  "96": "icon.svg"
    +}
    +
  4. +
+ +
+

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.

+
+ +

Compatibilidade de navegador

+ + + +

{{Compat("webextensions.manifest.icons")}}

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 +--- +
{{AddonSidebar}}
+ +

O ficheiro manifest.json é o único ficheiro que deve ser incluído em extensões que usem APIs de WebExtension.

+ +

Com o manifest.json, é possível especificar metadados sobre a extensão a que pertence, tal como o nome, a versão, e funcionalidades como scripts de background, scripts de conteúdo, e ações de browser.

+ +

O manifest.json é um ficheiro em formato JSON, mas também suporta comentários do tipo "//".

+ +

Propriedades do manifest.json

+ +

Seguem-se as propriedades que o manifest.json suporta:

+ +
{{ ListSubpages ("/en-US/Add-ons/WebExtensions/manifest.json") }}
+ +
+ +

Notas sobre propriedades do manifest.json

+ + + +

Como aceder a propriedades manifest.json em runtime

+ +

É possível aceder ao manifest.json de uma extensão a partir de um script da mesma, com a função de JavaScript {{WebExtAPIRef("runtime.getManifest()")}}:

+ +
browser.runtime.getManifest().version;
+ +

Compatibilidade de browsers

+ +

{{Compat("webextensions.manifest")}}

+ +

Exemplo

+ +

Os exemplos seguintes demonstram como funcionam algumas propriedades comuns nos manifest.json.  

+ +
+

Nota: 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

+
+ +

Para ver exemplos completos de extensões, veja a página Exemplos de extensões.

+ +
{
+  "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"]
+}
+ +

Compatibilidade de browsers

+ +

Consulte a tabela de compatibilidade de browsers do manifest.json para saber que browsers suportam cada propriedade do manifest.json.

+ +

Ver também

+ +

{{WebExtAPIRef("permissions")}} JavaScript API

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 +--- +
{{AddonSidebar}}
+ +

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.

+ +

Melhore ou complemente um site da Web: 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.

+ +

+ +

Exemplos: Amazon Assistant para Firefox, OneNote Web Clipper, e Grammarly for Firefox

+ +

Deixe que os utilizadores mostrem a sua personalidade: 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 theme add-ons too).

+ +

+ +

Exemplos: MyWeb New Tab, Tabliss, e VivaldiFox

+ +

Adicionar ou remover conteúdo das páginas da Web: 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.

+ +

+ +

Exemplos: uBlock Origin, Reader, e Toolbox para Google Play Store™

+ +

Adicionar ferramentas e novas funcionalidades de navegação: 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.

+ +

+ +

Examples: QR Code Image Generator, Swimlanes for Trello, and Tomato Clock

+ +

Jogos: Offer traditional computer games, with off-line play features, but also explore new game possibilities, for example, by incorporating gameplay into everyday browsing.

+ +

 

+ +

Examples: Asteroids in Popup, Solitaire Card Game New Tab, and 2048 Prime.

+ +

Adicionar ferramentas de desenvolvimento: 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.

+ +

+ +

Examples: Web Developer, Web React Developer Tools, and aXe Developer Tools

+ +

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 extension API 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 changes. The API is also fully compatible with multiprocess Firefox.

+ +

If you have ideas or questions, or need help migrating a legacy add-on to WebExtensions APIs, you can reach us on the dev-addons mailing list or in #extdev on IRC.

+ +

E a seguir?

+ + 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 +--- +
{{AddonSidebar}}
+ +

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.

+ +

Instalação

+ +

web-ext is a node-based application that you install with the nodejs/npm tool. Install web-ext using the following command:

+ +
npm install --global web-ext
+ +

web-ext requires the current LTS (long-term support) version of NodeJS.

+ +

To test whether the installation worked run the following command, which displays the web-ext version number:

+ +
web-ext --version
+ +

Utilizar web-ext

+ +

Before you start using web-ext, locate an example extension to use—if you don't have one, use one from the webextensions-examples repo.

+ +

Testar uma extensão

+ +

Test an extension in Firefox by cd'ing into your extension's root directory and entering:

+ +
web-ext run
+ +

This starts Firefox and loads the extension temporarily in the browser, just as you can on the about:debugging page.

+ +

See the run reference guide to learn more.

+ +

Recarregamento automático da extensão

+ +

The run 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 name property in your manifest.json 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:

+ +
web-ext run
+ +

You can also press the r key in the web-ext terminal to trigger an extension reload.

+ +

If you experience unexpected behavior with the reloading feature, please file a bug. You can also disable reloading like this:

+ +
web-ext run --no-reload
+ +
+

O reccaregamento da extensão só é suportado a paratir da versão do Firefox 49 ou superior .

+
+ +

Testar em versões diferentes do Firefox

+ +

To run your extension in a version of Firefox Desktop other than the default, use the --firefox option to specify a full path to the binary file. Here is an example for Mac OS:

+ +
web-ext run --firefox=/Applications/FirefoxNightly.app/Contents/MacOS/firefox-bin
+ +

On Windows, the path needs to include firefox.exe, for example:

+ +
web-ext run --firefox="C:\Program Files\Mozilla Firefox\firefox.exe"
+ +

See the run command reference to learn more.

+ +

Testar no Firefox 48

+ +

Firefox 48 was the first stable version to use the WebExtension platform, but it doesn't allow web-ext to install an extension remotely. You need to run your extension in Firefox 48 using:

+ +
web-ext run --pre-install
+ +

Testar no Firefox para Android

+ +

To run your extension in Firefox for Android, follow these instructions to set up your computer and device.

+ +

With your device connected to your development computer, run:

+ +
web-ext run --target=firefox-android
+ +

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.

+ +

Now, add the device ID to the command:

+ +
web-ext run --target=firefox-android --android-device=<device ID>
+ +

If you've multiple versions of Firefox installed, you may need to choose a specific version. For example:

+ +
web-ext run --target=firefox-android ... --firefox-apk=org.mozilla.firefox
+ +

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 web-ext output guides you in how to grant these permissions.

+ +

The web-ext command does not alter any of your existing Firefox for Android preferences or data. To see more information about how web-ext is interacting with your device, run the command with --verbose.

+ +

See the run command reference to learn more.

+ +

Depurar no Firefox para Android

+ +

When using web-ext run to test an extension on Firefox for Android, you'll notice a message like this in the console output:

+ +
You can connect to this Android device on TCP port 51499
+
+ +

This is a remote debugger port that you can connect to with Firefox's developer tools. In this case, you'd connect to host localhost on port 51499.

+ +

See this guide for more information about debugging an extension on Firefox for Android.

+ +

Testar extensões não assinadas

+ +

When you execute web-ext run, the extension gets installed temporarily until you close Firefox. This does not violate any signing restrictions. If instead you create a zip file with web-ext build 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 unbranded build or use a development build to install unsigned extensions.

+ +

Utilizar um perfil personalizado

+ +

By default, the run command will create a temporary Firefox profile. To run your extension with a specific profile use the --firefox-profile option, like this:

+ +
web-ext run --firefox-profile=your-custom-profile
+ +

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 run command.

+ +

Manter alterações de perfil

+ +

The run command does not save any changes made to the custom profile specified by --firefox-profile. To keep changes, add this option:

+ +
web-ext run --keep-profile-changes --firefox-profile=your-custom-profile
+ +

This may be helpful if your extension has many different run states.

+ +
+

This option makes the profile specified by --firefox-profile 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 web-ext to operate.

+
+ +

Empacotar a sua extensão

+ +

Once you've tested your extension and verified that it's working, you can turn it into a package for submitting to addons.mozilla.org using the following command:

+ +
web-ext build
+ +

This outputs a full path to the generated .zip file that can be loaded into a browser.

+ +
+

The generated .zip file doesn't work on Firefox without signing or adding applications.gecko.id key into manifest.json.  For more information, please refer WebExtensions and the Add-on ID page.

+
+ +

web-ext build is designed to ignore files that are commonly not wanted in packages, such as .git, node_modules, and other artifacts.

+ +

See the build reference guide to learn more.

+ +

Assinar a sua extensão para distribuição

+ +

As an alternative to publishing your extension on addons.mozilla.org, you can self-host your package file but it needs to be signed by Mozilla first. The following command packages and signs a ZIP file, then returns it as a signed XPI file for distribution:

+ +
web-ext sign --api-key=$AMO_JWT_ISSUER --api-secret=$AMO_JWT_SECRET 
+ +

The API options are required to specify your addons.mozilla.org credentials.

+ + + +

See the sign reference guide to learn more.

+ +

Assinar as extensões sem uma Id. explicita

+ +

web-ext supports signing extensions that do not declare the applications.gecko.id property in their manifest. The first time you sign an extension without an explicit ID, addons.mozilla.org will generate an ID and web-ext will save it to .web-extension-id 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 applications.gecko.id property or use the --id option when signing, for example:

+ +
web-ext sign --api-key=... --api-secret=... --id="{c23c69a7-f889-447c-9d6b-7694be8035bc}"
+ +

Assinar num ambiente restringido

+ +

If you're working in an environment that restricts access to certain domains, you can try using a proxy when signing:

+ +
web-ext sign --api-key=... --api-secret=... --api-proxy=https://yourproxy:6000
+ +

See the --api-proxy option to learn more.

+ +

The following domains are used for signing and downloading files:

+ + + +

Verificar com o código "lint"

+ +

Before trying out your extension with the run command or submitting your package to addons.mozilla.org, use the lint command to make sure your manifest and other source files do not contain any errors. Example:

+ +
web-ext lint
+ +

This uses the addons-linter library to walk through your source code directory and report any errors, such as the declaration of an unknown permission.

+ +

See the lint reference guide to learn more.

+ +

Definindo as predefinições de opção num ficheiro de configuração

+ +

You can specify --config=my-config.js to set default values for any option. Here is an example with the build command:

+ +
web-ext --config=my-config.js build
+ +

The file should be a CommonJS module as understood by NodeJS and must export each configuration value. Here is how you would set the default value of --verbose to true:

+ +
module.exports = {
+  verbose: true,
+};
+ +

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 --overwrite-dest that only applies to the build command as well as --firefox that only applies to the run command:

+ +
module.exports = {
+  // Global options:
+  verbose: true,
+  // Command options:
+  build: {
+    overwriteDest: true,
+  },
+  run: {
+    firefox: 'nightly',
+  },
+};
+ +

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, --overwrite-dest was converted to overwriteDest.

+ +

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 --ignore-files patterns:

+ +
module.exports = {
+  ignoreFiles: [
+    'package-lock.json',
+    'yarn.lock',
+  ],
+};
+ +

Automatic discovery of configuration files

+ +

web-ext will load existing configuration files in the following order:

+ + + +

If a home directory config and a local directory config define the same option, the value from the latter file will be used.

+ +

To disable automatic loading of configuration files, set this option:

+ +
web-ext --no-config-discovery run
+ +

To diagnose an issue related to config files, re-run your command with --verbose. This will tell you which config file affected which option value.

+ +

Specifying different source and destination directories

+ +

The preceding commands use default directories for the extension source and artifact creation (for example, built .zip files). The defaults are:

+ + + +

You can specify different source and destination directories using the --source-dir and --artifacts-dir 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:

+ +
web-ext build --source-dir=webextension-examples/notify-link-clicks-i18n --artifacts-dir=zips
+ +

Outputting verbose messages

+ +

To see in detail what web-ext is doing when you run a command, include the --verbose option. For example:

+ +
web-ext build --verbose
+ +

Viewing all commands and options

+ +

You can list all commands and options like this:

+ +
web-ext --help
+ +

You can list options for a specific command by adding it as an argument:

+ +
web-ext --help run
+ +

Detecting temporary installation

+ +

Your extension can detect whether it was installed using web-ext run, rather than as a built and signed extension downloaded from addons.mozilla.org. Listen for the {{WebExtAPIRef("runtime.onInstalled")}} event and check the value of details.temporary.

+ +

Using web-ext from a script

+ +

You can use web-ext as a NodeJS module. Here is more information, with example code.

+ +

Consulte também

+ + 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_ +--- +
{{AddonSidebar}}
+ +

 

+ +
+
+

Packaged extensions in Firefox are called "XPI files", which are ZIP files with a different extension.

+ +

You don't have to use the XPI extension when uploading to AMO.

+
+
+ +

 

+ +

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.

+ +

If you're using web-ext, use web-ext build to package your extension. Otherwise, follow the instructions below for your chosen operating system.

+ +
+

Dica: The ZIP file must be a ZIP of the extension's files themselves, not of the directory containing them.

+
+ +

Windows

+ +
    +
  1. Abra a pasta com os seus ficheiros da extensão.
  2. +
  3. Selecione todos os ficheiros.
  4. +
  5. Clique direito e escolha "Enviar para" → Pasta Comprimida (zipped).
  6. +
+ +

+ +

Mac OS X

+ +
    +
  1. Open the folder with your extension's files.
  2. +
  3. Select all of the files.
  4. +
  5. Right click and choose Compress n Items.
  6. +
+ +

+ +
+ +
+ +

Linux / Mac OS X Terminal

+ +
    +
  1. Open Terminal.
  2. +
  3. Open the directory containing your extension's files,  using the command
    + cd path/to/my-extension/
  4. +
  5. ZIP the content of the directory, using the command
    + zip -r -FS ../my-extension.zip *
  6. +
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 +--- +
{{AddonSidebar}}
+ +

Um script de conteúdo é uma parte da sua extensão que é executada no contexto de uma determinada página da Web (em oposição aos scripts de segundo plano que são parte da própria extensão, ou scripts que são parte do próprio site da Web, tal como aqueles carregados utilizando o {{HTMLElement("script")}} elemento.

+ +

Background scripts can access all the WebExtension JavaScript APIs, but they can't directly access the content of web pages. So if your extension needs to do that, you need content scripts.

+ +

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.

+ +

Content scripts can only access a small subset of the WebExtension APIs, but they can communicate with background scripts using a messaging system, and thereby indirectly access the WebExtension APIs.

+ +
+

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 CSP error.

+ +

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 onboarding page that moves users away from addons.mozilla.org.

+
+ +
+

Values added to the global scope of a content script with var foo or window.foo = "bar" may disappear due to bug 1408996.

+
+ +

Carregar scripts de conteúdo

+ +

You can load a content script into a web page in one of three ways:

+ +
    +
  1. at install time, into pages that match URL patterns: using the content_scripts key in your manifest.json, you can ask the browser to load a content script whenever the browser loads a page whose URL matches a given pattern.
  2. +
  3. at runtime, into pages that match URL patterns: using the {{WebExtAPIRef("contentScripts")}} API, you can ask the browser to load a content script whenever the browser loads a page whose URL matches a given pattern. This is just like method (1), except you can add and remove content scripts at runtime.
  4. +
  5. at runtime, into specific tabs: using the tabs.executeScript() API, you can load a content script into a specific tab whenever you want: for example, in response to the user clicking on a browser action.
  6. +
+ +

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.

+ +

Using methods (1) and (2) you can only load scripts into pages whose URLs can be represented using a match pattern. 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".

+ +

Ambiente de script de conteúdo

+ +

Acesso DOM

+ +

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.

+ +

However, content scripts get a "clean view of the DOM". This means:

+ + + +

In Firefox, this behavior is called Xray vision.

+ +

For example, consider a web page like this:

+ +
<!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>
+ +

The script "page-script.js" does this:

+ +
// 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'");
+}
+ +

Now an extension injects a content script into the page:

+ +
// 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()
+ +

The same is true in reverse: page scripts can't see JavaScript properties added by content scripts.

+ +

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.

+ +

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.

+ +

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:

+ +
"content_scripts": [
+  {
+    "matches": ["*://*.mozilla.org/*"],
+    "js": ["jquery.js", "content-script.js"]
+  }
+]
+ +

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 Sharing objects with page scripts for more details.

+ +

APIs da Extensão da Web

+ +

In addition to the standard DOM APIs, content scripts can use the following WebExtension APIs:

+ +

From extension:

+ + + +

From runtime:

+ + + +

From i18n:

+ + + +

From menus:

+ + + +

Everything from storage.

+ +

XHR e Fetch

+ +

Content scripts can make requests using the normal window.XMLHttpRequest and window.fetch() APIs.

+ +

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 permissions key in manifest.json, then its content scripts get access that domain as well.

+ +

This is accomplished by exposing more privileged XHR and fetch instances in the content script, which has the side-effect of not setting the Origin and Referer 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  content.XMLHttpRequest and content.fetch() instead. For cross-browser extensions their presence must be feature-detected.

+ +

Comunicar com scripts de segundo plano

+ +

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.

+ +

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.

+ +

One-off messages

+ +

To send one-off messages, with an optional response, you can use the following APIs:

+ + + + + + + + + + + + + + + + + + + + + +
In content scriptIn background script
Send a messagebrowser.runtime.sendMessage()browser.tabs.sendMessage()
Receive a messagebrowser.runtime.onMessagebrowser.runtime.onMessage
+ +

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:

+ +
// content-script.js
+
+window.addEventListener("click", notifyExtension);
+
+function notifyExtension(e) {
+  if (e.target.tagName != "A") {
+    return;
+  }
+  browser.runtime.sendMessage({"url": e.target.href});
+}
+ +

The background script listens for these messages and displays a notification using the notifications API:

+ +
// 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
+  });
+}
+
+ +

This example code is lightly adapted from the notify-link-clicks-i18n example on GitHub.

+ +

Connection-based messaging

+ +

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.

+ +

Each side has a runtime.Port object, which they can use to exchange messages.

+ +

To create the connection:

+ + + +

Once each side has a port, the two sides can exchange messages using runtime.Port.postMessage() to send a message, and runtime.Port.onMessage to receive messages.

+ +

For example, as soon as it loads, this content script:

+ + + +
// 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!"});
+});
+ +

The corresponding background script:

+ + + +
// 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!"});
+});
+
+ +

Multiple content scripts

+ +

If you have multiple content scripts communicating at the same time, you might want to store each connection in an array.

+ + + + + +
// 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!"})
+    })
+});
+ + + + + +

Comunicar com a página da Web

+ +

Although content scripts don't by default get access to objects created by page scripts, they can communicate with page scripts using the DOM window.postMessage and window.addEventListener APIs.

+ +

For example:

+ +
// 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"
+  }, "*");
+ +
// 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 + "\"");
+  }
+});
+ +

For a complete working example of this, visit the demo page on GitHub and follow the instructions.

+ +
+

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.

+ +

To make a trivial example, suppose the content script code that receives the message does something like this:

+ +
// 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);
+  }
+});
+ +

Now the page script can run any code with all the privileges of the content script.

+
+ +

Using eval() in content scripts

+ +

In Chrome, eval() always runs code in the context of the content script, not in the context of the page.

+ +

In Firefox:

+ + + +

For example, consider a content script like this:

+ +
// 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"
+}, "*");
+ +

This code just creates some variables x and y using window.eval() and eval(), then logs their values, then messages the page.

+ +

On receiving the message, the page script logs the same variables:

+ +
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}`);
+  }
+});
+ +

In Chrome, this will produce output like this:

+ +
In content script, window.x: 1
+In content script, window.y: 2
+In page script, window.x: undefined
+In page script, window.y: undefined
+ +

In Firefox the following output is produced:

+ +
In content script, window.x: undefined
+In content script, window.y: 2
+In page script, window.x: 1
+In page script, window.y: undefined
+ +

The same applies to setTimeout(), setInterval(), and Function().

+ +

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:

+ +
// page.js redefines console.log
+
+var original = console.log;
+
+console.log = function() {
+  original(true);
+}
+
+ +
// content-script.js calls the redefined version
+
+window.eval('console.log(false)');
+
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 +--- +

{{AddonSidebar}}

+ +
{{WebExtAllCompatTables}}
+ +
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.
+ +
 
+ +
Agradecimentos + +

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.

+
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 +--- +

{{AddonSidebar}}

+ +

Esta paginas contêm varias dicas e truques que deve ser útil para muitas pessoas devenvolvendo extensões usando WebExtension APIs.

+ +

Usando recursos avancados do ECMAScript 2015 e 2016.

+ +

Firefox suporta muitos recursos do ECMAScript 2015 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 Babel.

+ +

Cuidado que qualquer coisa abalixo desta linha é informação desatualizada e tem sido removida do Babel 6.

+ +

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 .babelrc, ou uma seção babel em seu arquivo de projeto package.json contendo o seguinte:

+ +
{
+  "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"
+      ]
+    }
+  }
+}
+
+ +

Então, para compilar um script individual simplesmente, execute:

+ +
BABEL_ENV=firefox babel <filename>
+
+ +

Ou, para compilar cada arquivo JavaScript dentro do diretório src e colocar os arquivos compilados em compiled, copiando arquivos não-JavaScript no processo, executadno:

+ +
BABEL_ENV=firefox babel -Dd compiled src
+
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 +--- +
{{AddonSidebar}}
+ +

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 API de extensão 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  APIs de extensão são suportadas, utilizando as funções de chamada sob o espaço de nome  chrome, o mesmo que Chrome. As únicas APIs que não são suportadas no nome de espaço chrome 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 browser . O processo de transferir uma extensão do Chrome para Opera é como isto:

+ +
    +
  1. Reveja a sua utilização das funcionaldiades de manifest.json e APIs da Extensão da Web contra a referência de incompatibilidade do Chrome. 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: Teste de Compatibilidade de Extensão para Firefox (inglês).
  2. +
  3. Instale a sua extensão no Firefox e teste-a.
  4. +
  5. Se tiver quaisquer problemas, contacte-nos em lista de endereços ou #webextensions no IRC.
  6. +
  7. Submeta o seu extra em AMO para assinar e distribuir
  8. +
+ +

Se estava dependente da opção da linha de comando do Chrome para carregar uma extensão descompactada, consulte a ferramenta web-ext que automatiza a instalação temporária no Firefox para desenvolvimento.

+ + 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 +--- +

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.

+ +

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.

+ +

Nota: se estiver a ter problemas e o calendário está em falta, primeiro consulte  calendar update issues, 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..

+ +

Lightning

+ +

Resumo de Desenvolvimento

+ +
+

As compilações do Lightning listadas abaixo devem ser consideradas instáveis ​​e estão disponíveis apenas para fins de desenvolvimento e testes.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Lightning
+ Versão
Thunderbird
+ Versão
SeaMonkey
+ Versão
+

Plataforma Mozilla
+ Versão

+
Build NameChangelog
6.8a166.0a1
+ "Daily"
2.63a1mozilla66"nightly"
+ (comm-central)
changes in 6.8
6.7b165.0b1
+ "Beta"
2.62b1mozilla65"beta"
+ (comm-beta)
changes in 6.7
+ +

Lançamentos Estáveis

+ +

The Lightning releases listed below are considered stable and are recommend for daily usage. 

+ +

If you are having trouble and calendar is missing, first see calendar update issues, because after Thunderbird 52 Lightning is built-in (bundled with Thunderbird) and you should not need to download the extension. 

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Lightning
+ Versão
Thunderbird
+ Versão
SeaMonkey
+ Versão
Plataforma Mozilla
+ Versão
Data de LançamentoRegisto de Alterações
6.7b1 (Beta)65.0 (Beta)2.62mozilla65 changes in 6.7
6.6b4 (Beta)64.0 (Beta)2.61mozilla64December 2, 2018changes in 6.6
6.5b1 (Beta)63.0 (Beta)2.60mozilla63October 11, 2018changes in 6.5
6.4b1 (Beta)62.0 (Beta)2.59mozilla62---changes in 6.4
6.3b1 (Beta)61.0 (Beta)2.58mozilla61---changes in 6.3
6.2.3.360.3.32.57mozilla60December 5, 2018 
6.2.3.260.3.22.57mozilla60November 30, 2018 
6.2.3.160.3.12.57mozilla60November 15, 2018changes in 6.2.3changes in 6.2.3.1
6.2.2.160.2.12.57mozilla60October 2, 2018changes in 6.2.2.1
6.260.02.57mozilla60August 6, 2018changes in 6.2
6.1b2 (Beta)59.0 (Beta)2.56mozilla59---changes in 6.1
6.0b3 (Beta)58.0 (Beta)2.55mozilla58---changes in 6.0
5.9b2 (Beta)57.0 (Beta)2.54mozilla57---changes in 5.9
5.8b4 (Beta)56.0 (Beta)2.53mozilla56---changes in 5.8
5.7b2 (Beta)55.0 (Beta)2.52mozilla55---changes in 5.7
5.6b3 (Beta)54.0 (Beta)2.51mozilla54---changes in 5.6
5.5b2 (Beta)53.0 (Beta)2.50mozilla53October 10, 2017changes in 5.5
5.4.9.152.9.1---mozilla52July 10, 2018---
5.4.852.8.0---mozilla52May 18, 2018changes in 5.4.8
5.4.752.7.0---mozilla52March 23, 2018changes in 5.4.7
5.4.652.6.0---mozilla52January 25, 2018changes in 5.4.6
5.4.5.252.5.2---mozilla52December 22, 2017changes in 5.4.5
5.4.452.4.0---mozilla52October 6, 2017changes in 5.4.4
5.4.352.3.0---mozilla52August 16, 2017changes in 5.4.3
5.4.2.152.2.1----mozilla52June 23, 2017changes in 5.4.2 / changes in 5.4.2.1
5.4.1.152.1.1---mozilla52May 15, 2017changes in 5.4.1 / changes in 5.4.1.1
5.4.0.152.0.1---mozilla52April 14, 2017changes in 5.4.0.1
5.452.02.49mozilla52April 4, 2017changes in 5.4
5.3b2 (Beta)51.0 (Beta)2.48mozilla51March 19, 2017changes in 5.3
5.2b1 (Beta)50.0 (Beta)2.47mozilla50October 16, 2016changes in 5.2
5.1b1 (Beta)49.0 (Beta)2.46mozilla49October 16, 2016changes in 5.1
5.0b1 (Beta)48.0 (Beta)2.45mozilla48October 16, 2016changes in 5.0
4.9b2 (Beta)47.0 (Beta)2.44mozilla47July 1, 2016changes in 4.9
4.8b1 (Beta)46.0 (Beta)2.43mozilla46---changes in 4.8
4.7.845.8.02.42mozilla45March, 7 2017changes in 4.7.8
4.7.7.145.7.12.42mozilla45February 7, 2017changes in 4.7.7
4.7.645.6.02.42mozilla45December 28, 2016changes in 4.7.6
4.7.5.145.5.12.42mozilla45November 30, 2016changes in 4.7.5
4.7.445.4.02.42mozilla45October 3, 2016changes in 4.7.4
4.7.345.3.02.42mozilla45August 30, 2016changes in 4.7.3
4.7.245.2.02.42mozilla45June 30, 2016changes in 4.7.2
4.7.1.145.1.12.42mozilla45May 31, 2016changes in 4.7.1.1
4.745.02.42mozilla45April 25, 2016changes in 4.7
4.6b1 (Beta)44.0 (Beta)2.41mozilla44January 21, 2016changes in 4.6
4.5b1 (Beta)43.0 (Beta)2.40mozilla43January 8, 2016changes in 4.5
4.4b2 (Beta)42.0 (Beta)2.39mozilla42October 14, 2015changes in 4.4
4.3b2 (Beta)41.0 (Beta)2.38mozilla41September 16, 2015changes in 4.3
4.2b1 (Beta)40.0 (Beta)2.37mozilla40July 30, 2015changes in 4.2
4.1b1 (Beta)39.0 (Beta)2.36mozilla39---changes in 4.1
4.0.7.238.7.2---mozilla38April 4, 2016changes in 4.0.7 / changes in 4.0.7.1
4.0.638.6.0---mozilla38February 16, 2016changes in 4.0.6
4.0.5.238.5.12.35mozilla38January 21, 2016changes in 4.0.5
4.0.4.138.4.02.35mozilla38November 30, 2015changes in 4.0.4
4.0.3.138.3.02.35mozilla38October 8, 2015changes in 4.0.3
4.0.2.138.2.02.35mozilla38September 16, 2015changes in 4.0.2.1
4.0.238.2.02.35mozilla38August 14, 2015changes in 4.0.2
4.0.1.238.1.02.35mozilla38July 23, 2015changes in 4.0.1.2
4.0.138.1.02.35mozilla38July 8, 2015changes in 4.0.1
4.0.0.138.0.12.35mozilla38June 12, 2015changes in 4.0.0.1
3.9b1 (Beta)37.0 (Beta)2.34mozilla37March 14, 2015changes in 3.9
3.8b2 (Beta)36.0 (Beta)2.33mozilla36March 12, 2015changes in 3.8
3.7b1 (en-US only)---2.32mozilla35January 28, 2015changes in 3.7
3.6b3 (Beta)34.0 (Beta)2.31mozilla34December 17, 2014changes in 3.6
3.5b1 (Beta)33.0 (Beta)2.30mozilla33September 23, 2014changes in 3.5
3.4b1 (Beta)32.0 (Beta)2.29mozilla32August 18, 2014changes in 3.4
3.3.331.02.28mozilla31January 28, 2015changes in 3.3.3
3.3.231.02.28mozilla31December 27, 2014changes in 3.3.2
3.3.131.02.28mozilla31September 23, 2014changes in 3.3.1
3.331.02.28mozilla31July 21, 2014changes in 3.3
3.2b130.0 (Beta)2.27mozilla30May 9, 2014changes in 3.2
3.1b129.0 (Beta)2.26mozilla29April 24, 2014changes in 3.1
3.0b128.0 (Beta)2.25mozilla28March 6, 2014changes in 3.0
2.9b127.0 (Beta)2.24mozilla27December 19, 2013changes in 2.9
2.8b126.0 (Beta)2.23mozilla26November 15, 2013changes in 2.8
2.7b125.0 (Beta)2.22mozilla25October 17, 2013changes in 2.7
2.6.624.5.0---mozilla24.5June 19, 2014changes in 2.6.6
2.6.524.5.0---mozilla24.5May 13, 2014changes in 2.6.5
2.6.424.2.0---mozilla24.2December 11, 2013changes in 2.6.4
2.6.324.1.1---mozilla24.1.1November 19, 2013changes in 2.6.3
2.6.224.1.0---mozilla24.1October 29, 2013---
2.6.124.0.1---mozilla24.0.1October 13, 2013changes in 2.6.1
2.624.02.21mozilla24September 11, 2013changes in 2.6
2.5b2---2.20mozilla23July 8, 2013changes in 2.5
2.4b1---2.19mozilla22May 24, 2013changes in 2.4
2.3b2---2.18mozilla21May 8, 2013changes in 2.3
2.2b1---2.17mozilla20March 6, 2013changes in 2.2
2.1b1---2.16mozilla19February 12, 2013changes in 2.1
2.0b1---2.15mozilla18November 29, 2012changes in 2.0
1.9.117.02.14mozilla17March 6, 2013changes in 1.9.1
1.917.02.14mozilla17November 20, 2012changes in 1.9
1.816.02.13mozilla16October 09, 2012changes in 1.8
1.715.02.12mozilla15August 28, 2012changes in 1.7
1.614.02.11mozilla14July 17, 2012changes in 1.6
1.5.213.02.10mozilla13June 21, 2012---
1.5.113.02.10mozilla13June 14, 2012---
1.513.02.10mozilla13June 4, 2012changes in 1.5
1.412.02.9mozilla12April 23, 2012changes in 1.4
1.311.02.8mozilla11March 13, 2012changes in 1.3
1.2.310.02.7mozilla10March 9, 2012---
1.2.110.02.7mozilla10February 3, 2012---
1.210.02.7mozilla10January 23, 2012changes in 1.2
1.1.19.02.6mozilla9January 5, 2012changes in 1.1
1.08.02.5mozilla8November 7, 2011 
1.0b77.02.4mozilla7September 27, 2011 
1.0b56.02.3mozilla6July 29, 2011 
1.0b45.02.2mozilla5June 28, 2011 
1.0b23.1.*---mozilla-1.9.2June 24, 2010 
1.0b13.0.*2.0mozilla-1.9.1January 12, 2010 
0.92.0.0.*---mozilla-1.8.1September 23, 2008 
0.82.0.0.*---mozilla-1.8.1April 4, 2008 
+ +

Lançamentos de ESR Estáveis

+ +

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.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Lightning
+ Versão
Thunderbird
+ Versão
SeaMonkey
+ Versão
Plataforma Mozilla
+ Versão
Data de Lançamento
1.9.117.0esr2.14mozilla17March 6, 2013
1.2.310.0esr2.7mozilla10March 9, 2012
+ +

Sunbird

+ +

Por favor, note que o Sunbird foi descontinuado, consulte este blogue para detalhes. Não haverá mais lançamento do Sunbird até novo aviso.

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Sunbird
+ Versão
Mozilla Platform
+ Versão
Data de Lançamento
1.0b11.9.1March 30, 2010
0.91.8.1September 23, 2008
0.81.8.1April 4, 2008
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 +--- + + + + + + + +
Sunbird-Logo-148x155.png +

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 Lightning extension is built on top of this platform and provides integrated calendaring capabilities for Mozilla Messaging's Email client Thunderbird.

+

Mozilla Calendar emphasizes free and open source technology and supports standardized technology like the ical/ics (rfc2445) format and the CalDAV (rfc4791) protocol, which is implemented by many freely available servers and also some commercial providers.

+
+ + + + + + + +
+

Development Topics

+
+
+ Building Calendar
+
+ Information about building Calendar with the new comm-central repository. There is also a simple build page for Thunderbird including Lightning and information about how comm-central works.
+
+
+
+ Creating a Calendar extension
+
+ Tutorial on creating a Calendar extension for Sunbird and Lightning.
+
+
+
+ Localization
+
+ How to get started with translating Calendar into your language and how to build Lightning in your language. 
+
+ Testing Calendar
+
+ CalendarUtils reference for writing Mozmill tests, which can automatically test the UI so that regressions can be easily found.
+
+ Calendar Versions
+
+ This page will tell you which Calendar version fits with which Mozilla Platform and where current development is being done.
+
+
+

Tools

+
+
+ Bugzilla
+
+ The Bugzilla database used to track issues for Mozilla projects.
+
+  
+
+ MXR
+
+ Browse and search the Calendar source code repository on the Web.
+
+  
+
+ Calendar Servers
+
+ Setup your own calendar server, or check to see how well commercial products are supported.
+
+  
+
+
+

 

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 +--- +

Os publicadores da Web podem oferecer aos visitantes uma barra lateral do Firefox 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.

+ +

A API Social

+ +
+

Este conteúdo abrange as funcionalidades introduzidas no Firefox 17.

+
+ +

A API Social é 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 Cliqz, Facebook, mixi e a MSN têm uma parceria com a Mozilla, como provedores sociais. Agora que a API está disponível para todos os programadores da Web, então vale a pena conferir se está a oferecer um serviço social.

+ +

Uma extensão

+ +

An extension is a kind of add-ons that adds new functionalities to Firefox. There is a wide range of extensions available, and some of them provide a sidebar. 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:

+ + + +

A API window.sidebar

+ +

{{ obsolete_header(23) }}

+ +

As of Firefox 23, the addPanel and addPersistentPanel 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.

+ +

Consulte Também

+ + diff --git "a/files/pt-pt/mozilla/cria\303\247\303\243o_de_um_complemento_de_dicion\303\241rio_de_verifica\303\247\303\243o_ortogr\303\241fica/index.html" "b/files/pt-pt/mozilla/cria\303\247\303\243o_de_um_complemento_de_dicion\303\241rio_de_verifica\303\247\303\243o_ortogr\303\241fica/index.html" new file mode 100644 index 0000000000..50a536375d --- /dev/null +++ "b/files/pt-pt/mozilla/cria\303\247\303\243o_de_um_complemento_de_dicion\303\241rio_de_verifica\303\247\303\243o_ortogr\303\241fica/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 +--- +

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.

+ +

Partes necessárias

+ +

To create a dictionary add-on, you first need two things:

+ + + +

If you are creating a new dictionary, as opposed to updating an existing one, please make sure that there is not already a dictionary available for your locale. If there already is one, try contacting the author to get it updated, or contact AMO editors if the author does not respond.

+ +

Packaging

+ +

A Firefox add-on is a ZIP file renamed to use an .xpi file extension instead of the normal .zip file extension. To create a dictionary add-on, simply create a ZIP file which contains the following files and folders:

+ +

my-dictionary.xpi

+ + + +

The .dic and .aff files must be placed in a subfolder named dictionaries within the ZIP file. Both files must have the locale code as their file name. You also have to add a file named install.rdf 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 icon or to describe the license of the dictionary.

+ +

Here is an example of the install.rdf file. You can create and edit it with a plain text editor such as Notepad.

+ +

<?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>locale-code@dictionaries.addons.mozilla.org</em:id>
+     <em:version>version number</em:version>
+     <em:type>64</em:type>
+     <em:unpack>true</em:unpack>
+     <em:name>Name</em:name>
+     <!--
+       Other install.rdf metadata such as em:localized, em:description, em:creator,
+       em:developer, em:translator, em:contributor or em:homepageURL
+     -->

+
+     <!-- Firefox -->
+     <em:targetApplication>
+       <Description>
+         <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+         <em:minVersion>18.0a1</em:minVersion>
+         <em:maxVersion>46.0</em:maxVersion>
+       </Description>
+     </em:targetApplication>
+
+     <!-- Thunderbird -->
+     <em:targetApplication>
+       <Description>
+         <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
+         <em:minVersion>18.0a1</em:minVersion>
+         <em:maxVersion>22.0</em:maxVersion>
+       </Description>
+     </em:targetApplication>
+
+     <!-- SeaMonkey -->
+     <em:targetApplication>
+       <Description>
+         <em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
+         <em:minVersion>2.15a1</em:minVersion>
+         <em:maxVersion>2.49</em:maxVersion>
+       </Description>
+     </em:targetApplication>
+   </Description>
+ </RDF>

+ +

There are some rules about how you should adapt the install.rdf file:

+ + + +

Once you have added these files to your ZIP file and renamed the file to have the .xpi extension, you can install your add-on in Firefox and test it. After a successful test, you can upload your add-on to addons.mozilla.org and ask for it to be included in the Dictionaries & Language Packs page.

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 +--- +

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.

+ +
+
+
+
Getting the code from the Mercurial repository
+
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.
+
Getting a pre-configured Mozilla build system virtual machine
+
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!
+
Downloading the code using HTTP or FTP
+
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.
+
Viewing and searching Mozilla source code online
+
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.
+
Navigating the Mozilla source code
+
Learn about the various folders in the Mozilla source tree, and how to find what you're looking for.
+
Bugs for newcomers
+
If you are new to the project and want something to work on, look here.
+
+
+ +
+
+
Mozilla Coding Style Guide
+
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.
+
Interface development guide
+
Guidelines and documentation for how to create and update XPCOM interfaces.
+
SVG Cleanup Guide
+
Guidelines and best practices for shipping new SVGs.
+
Try Servers
+
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.
+
Creating a patch
+
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. This article needs to be updated fully for Mercurial.
+
Getting commit access to the source code
+
Feel ready to join the few, the proud, the committers?  Find out how to get check-in access to the Mozilla code.
+
Getting older Mozilla code from CVS
+
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.
+
+
+
+ +

 

diff --git "a/files/pt-pt/mozilla/firefox/edi\303\247\303\243o_programador/index.html" "b/files/pt-pt/mozilla/firefox/edi\303\247\303\243o_programador/index.html" new file mode 100644 index 0000000000..3f3e7d3c90 --- /dev/null +++ "b/files/pt-pt/mozilla/firefox/edi\303\247\303\243o_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 +--- +
{{FirefoxSidebar}}
+ +

A 'Edição do Programador' do Firefox é uma versão do Firefox que está preparada para os programadores da Web. Esta inclui:

+ + + +

Novidades na Edição do Programador?

+ +

Transferir a Edição do Programador

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 +--- +
{{FirefoxSidebar}}
+ +

Firefox é 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.

+ +

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 Extras do Firefox, utilizando as ferramentas de programador no Firefox, e outros tópicos.

+ +
+

Aprenda a criar Extras para o Firefox, como desenvolver e criar o próprio Firefox, e como os internos do Firefox e os respetivos subprojetos funcionam.

+
+ + + +

Canais do Firefox

+ +

O Firefox está disponível em cinco canais.

+ +

Firefox Nightly

+ +

Todas as noites nós contruimos o Firefox a partir do último código disponível em mozilla-central. 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.

+ +

Transferir Firefox Nightly

+ +

Edição do Programador do Firefox

+ +

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.

+ +

Saiba mais acerca da Edição do Programador do Firefox.

+ +

Transferir Firefox Developer Edition

+ +

Firefox Beta

+ +

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.

+ +

Transferir Firefox Beta

+ +

Firefox

+ +

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.

+ +

Transferir Firefox

+ +

Firefox Extended Support Release (ESR)

+ +

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.

+ +

Learn more about Firefox Extended Support Release.

+ +

Transferir Firefox ESR

+ +

Perfis do Firefox

+ +

If you find yourself using multiple Firefox channels—or just multiple configurations—on a regular basis, you should read how to use multiple Firefox profiles by turning Firefox's Profile Manager and other profile management tools to your advantage.

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 +--- +
{{FirefoxSidebar}}
+ +

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 detalhes sobre os perfis no site de apoio do utilizador final da Mozilla.

+ +

Razões para ter múltiplos profiles

+ +

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.

+ +

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.

+ +

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.

+ +

Canais de desenvolvimento do navegador disponíveis

+ +

There are four available browser channels, each at a different level of stability and development. The four channels are Release, Beta, Developer Edition, and Nightly. 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.

+ +

Ferramentas de terceiros

+ +

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.

+ +
+

This list is by no means exhaustive. Please add any helpful tools you discover to the list!

+
+ +

Mac OS X

+ + + +

Gestão de perfis

+ +

Determining the profile while Firefox is running

+ +

To determine the profile of a currently-running Firefox instance in Windows, macOS or Linux,

+ +
    +
  1. Type about:profiles into the browser URL search bar.
  2. +
  3. The page presents a list of all of your profiles, each beginning with "Profile: " followed by its name.
  4. +
  5. The one being run by this Firefox instance will include the bold text "This is the profile in use" For example, if you find that text beneath the entry for "Profile: Suzie", then you are running in a profile named Suzie.
  6. +
+ +

Launching Firefox into a Desired Profile

+ +

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 exit/quit/terminate all running instances of Firefox, FirefoxDeveloperEdition or Nightly.  Then follow the instructions below, applicable to your operating system.

+ +

Windows

+ +
Windows XP
+ +
    +
  1. Click the Start button.
  2. +
  3. Click "Run".
  4. +
  5. +

    Type firefox --ProfileManager.

    +
  6. +
+ +
Windows Vista/7
+ +
    +
  1. Click the Start button.
  2. +
  3. Click the search bar at the bottom.
  4. +
  5. +

    Type firefox --ProfileManager.

    +
  6. +
+ +
Windows 8/8.1
+ +
    +
  1. Press "Windows + R" on your keyboard.
  2. +
  3. Type firefox --ProfileManager.
  4. +
+ +

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.

+ +

Linux

+ +

If Firefox is already included in your Linux distribution, or if you have installed Firefox with the package manager of your Linux distribution:

+ +
    +
  1. At the top of the Firefox window, click on the File menu and select Quit.
  2. +
  3. In Terminal run firefox --ProfileManager
  4. +
+ +

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.

+ +

macOS

+ +
    +
  1. Run the Terminal application, which is found in Applications/Utilities.
  2. +
  3. Type or paste in the path to Firefox, followed by .app/Contents/MacOS/firefox.  For example, if Firefox is installed in the recommended location, you would enter /Applications/Firefox.app/Contents/MacOS/firefox.
  4. +
  5. If you have the path to your desired profile handy, enter a space character, followed by -profile 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 --profilemanager.  This will present the Profile Manager window in which you can make your selection.
  6. +
  7. Hit return.
  8. +
+ +

Here is a complete example Terminal command from steps 2-3:

+ +
/Applications/Firefox.app/Contents/macOS/firefox -profile /Users/Suzie/Library/Application\ Support/Firefox/Profiles/r99d1z7c.default
+ +

If you want to do this frequently and more easily, you may wish to create an Automator application, as explained in this tutorial.

+ +

Criar um perfil

+ +

Creating a profile through the Profile Manager

+ +

These instructions should be the same for all operating systems.

+ +
    +
  1. To start the Create Profile Wizard, click "Create Profile..." in the Profile Manager.
  2. +
  3. 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.
  4. +
  5. You can also choose where to store the profile on your computer. To select storage location, click Choose Folder....
  6. +
  7. 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.
  8. +
  9. To create the new profile, click Finish.
  10. +
+ +

Creating a profile through the Firefox browser

+ +

You can create a new Firefox profile directly from the browser.

+ +
    +
  1. Type about:profiles into the browser URL search bar
  2. +
  3. On the page, click Create a New Profile button
  4. +
  5. Read the introduction, and click Next
  6. +
  7. 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.
  8. +
  9. Optionally, to change where the profile will be stored on your computer, click Choose Folder...
  10. +
  11. To create the new profile, click Finish.
  12. +
+ +

Eliminar um perfil

+ +
    +
  1. In the Profile Manager, select the profile to remove, and click Delete Profile....
  2. +
  3. Confirm that you wish to delete the profile: +
      +
    • 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.
    • +
    • Delete Files removes the profile and its files, including the profile bookmarks, settings, passwords, etc.
      +
      + {{ warning("If you use the \"Delete Files\" option, the profile folder, and files will be deleted. This action cannot be undone.") }}
    • +
    • Cancel interrupts the profile deletion.
    • +
    +
  4. +
+ +

Renomear um perfil

+ +
    +
  1. In the Profile Manager, select the profile you want to rename, and then click "Rename Profile".
  2. +
  3. Enter a new name for the profile and click on OK.
  4. +
+ +
+

Nota: The folder containing the files for the profile is not renamed.

+
+ +

Opções

+ +

Trabalhar off-line

+ +

Choosing this option loads the selected profile, and starts Firefox offline. You can view previously viewed web pages, and experiment with your profile.

+ +

Não perguntar no arranque

+ +

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.

+ +
+

Nota: To access other profiles after selecting this option, you must start the Profile Manager first.

+
+ +

Utilizar os perfis

+ +

Windows

+ +

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:

+ +
    +
  1. Right-click the icon and choose "Properties".
  2. +
  3. 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.
  4. +
  5. After the closing quote, add -ProfileManager.
  6. +
  7. Click Ok.
  8. +
+ +

Now whenever you double click that icon, the profile manager should appear, allowing you to choose which profile you'd like to use.

+ +

If you want individual icons to launch specific profiles, you will need to edit the "Target" of each icon. To do this:

+ +
    +
  1. Right-click the icon and choose "Properties".
  2. +
  3. 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.
  4. +
  5. To permanently set a specific profile, add -p PROFILE_NAME to the target path, but outside of the quotes, replacing "PROFILE_NAME" with the actual profile name you chose.
  6. +
  7. If you would also like to allow multiple instances of Firefox to run at the same time, add -no-remote after the profile name.
  8. +
+ +

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.

+ +

Linux

+ +

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: Gnome 3 Custom application launcher. 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.

+ +

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.

+ +
    +
  1. Set the "command" text field to target the executable file, likely "/usr/bin/firefox", and add the -p parameter.
  2. +
+ +

If you want individual icons to launch specific profiles, you will need to set the command line for your new launcher. To do this:

+ +
    +
  1. Set the "command" text field to target the executable file, likely "/usr/bin/firefox", and add the -p PROFILE_NAME parameter, replacing "PROFILE_NAME" with the specific profile.
  2. +
  3. Repeat as necessary, for each additional profile you want to set.
  4. +
  5. If you would also like to allow multiple instances of Firefox to run at the same time, add "-no-remote" after the profile name.
  6. +
+ +

Mac OS X

+ +

You can find a useful tutorial to set up custom launchers here: Managing Multiple Firefox Profiles in OSX. 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.

+ +

Configurar vários perfis para diferentes canais do Firefox

+ +

This section will be especially helpful if you are a developer, wanting to work with multiple channels, and each having their separate launcher.

+ +

Windows

+ +

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 Windows Launcher.

+ +

Linux

+ +

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 here. 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 -no-remote part to the end of the command field, so that you could run multiple instances at the same time.

+ +

Mac OS X

+ +

You can find a useful tutorial to set up custom launchers here: Managing Multiple Firefox Profiles in OSX. 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.

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 +--- +
{{FirefoxSidebar}}
+

Este documento descreve Cross Process Object Wrappers (CPOWs), que permite ao código de chrome aceder sincronamente ao conteúdo no 'Multiprocessos do Firefox'.

+
+ +
+

Note that from Firefox 47 onwards, unsafe CPOW usage 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 Browser Console.

+ +

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.

+
+ +

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.

+ +

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 message manager.

+ +

Chrome to content messaging must be asynchronous. 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.
+
+ 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 serious limitations and can cause responsiveness problems, so should only be used when necessary and only as a migration aid.

+ +

Passagem de CPOWs de frame scripts

+ +

Frame scripts can send messages to chrome using one of two global functions: sendAsyncMessage() or sendSyncMessage(). 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 clicked property of the third argument:

+ +
// frame script
+addEventListener("click", function (event) {
+  sendAsyncMessage("my-e10s-extension-message", {}, { clicked : event.target });
+}, false);
+ +

In the chrome script, the DOM node is now accessible through a Cross Process Object Wrapper, as a property of the objects property of the message. The chrome script can get and set the wrapped object's properties and call its functions:

+ +
// 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");
+}
+ +

CPOWs gerados automaticamente

+ +

Add-ons that have not declared themselves multiprocess compatible are set up with a number of compatibility shims. One of these shims provides the following behavior: whenever chrome code tries to access content directly (for example, through window.content or browser.contentDocument), it is given back a CPOW that wraps the content object. This means that examples like this will actually work, even in multiprocess Firefox:

+ +
gBrowser.selectedBrowser.contentDocument.body.innerHTML = "replaced by chrome code";
+ +

It's still important to keep in mind, though, that this is access through a CPOW and not direct access to content.

+ +

CPOWs bidirecionais

+ +

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.

+ +

This means you can write code like this:

+ +
// 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);
+ +
// 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");
+    });
+  });
+
+ +

Mapear conteúdo de documentos para navegadores XUL

+ +

A common pattern is to get the XUL <browser> that corresponds to a content document. To enable this, gBrowser.getBrowserForDocument and gBrowser.getBrowserForContentWindow can be passed a CPOW for the content document and content window, respectively, and return the XUL  <browser> that these documents / windows belong to. Both return null if no such browser can be found.

+ +

Limitações de CPOWs

+ +

Although CPOWs can be convenient they have several major limitations, which are listed below.

+ +

CPOWs e APIs de plataforma

+ +

You can't pass CPOWs into platform APIs that expect to receive DOM objects. For example, you can't pass a CPOW into nsIFocusManager.setFocus().

+ +

Also, from Firefox 47 onwards, browser code can no longer perform unsafe CPOW operations. This means that as an add-on developer, you should not pass CPOWs into browser APIs.

+ +

Reação de Chrome

+ +

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.

+ +

Consulte em baixo CPOWs seguros e inseguros para mais sobre isto.

+ +

Desempenho

+ +

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.

+ +

Ordenação de mensagem

+ +

CPOWs can violate assumptions you might make about message ordering. Consider this code:

+ +
mm.addMessageListener("GotLoadEvent", function (msg) {
+  mm.sendAsyncMessage("ChangeDocumentURI", {newURI: "hello.com"});
+  let uri = msg.objects.document.documentURI;
+  dump("Received load event: " + uri + "\n");
+});
+
+ +

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 uri 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 uri will have its previous value.
+
+ 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.

+ +

CPOWs seguros e inseguros

+ +

The main reason CPOWs can be bad for responsiveness is that they make the chrome process block on the content process.

+ +

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:

+ +

+ +

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.

+ +

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:

+ +


+

+ +

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.

+ +

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.

+ +

This situation is thus called "safe CPOW usage". All other uses of CPOWs are called "unsafe CPOW usage".

+ +

Consulyat também:

+ + + +

 

+ +

 

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 +--- +
{{FirefoxSidebar}}
+

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.

+
+ +

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 Firefox Developer Tools - specifically: the console, the JavaScript debugger, and Scratchpad - but attaches them to the browser's content process. This means you can debug the frame scripts in your add-on.

+ +

Abrir a Caixa de Ferrmanetas de Conteúdo de Navegador

+ +

{{EmbedYouTube("Cg6X_zIu7Xk")}}

+ +

To open the Browser Content Toolbox, you'll need to:

+ + + +

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:

+ +

If you've used the Firefox Developer Tools before, this should look pretty familiar.

+ +

Along the top is a row of tabs that you can use to switch the active tool. Currently, we only support the Console, the Debugger, and Scratchpad in the Browser Content Toolbox. At the right of this row are three buttons that activate the split console, open settings, and close the toolbox.

+ +

The rest of the toolbox is taken up with the tool you've currently selected.

+ +

Utilização

+ +

{{EmbedYouTube("XF0ULNnNOxg")}}

+ +

O Depurador

+ +

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:

+ +

You can set breakpoints, of course, and do all the other things supported by the debugger.

+ +

A Consola

+ +

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:

+ + + +

Now the console's scope is your frame script's scope, and you can interact directly with it:

+ +

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 +--- +
{{FirefoxSidebar}}

Os gestores de mensagens fornecem uma maneira para o código de JavaScript chrome-privilegiado para comunicar através dos limites de processo. Eles são particularmente úteis para permitir que código do chrome, incluindo o código do navegador e o código de extensão, para aceder ao conteúdo da Web enquanto o navegador está a executar conteúdo da Web num processo separado

+ +

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.

+ +

These guides explain how to use message managers in multiprocess Firefox.

+ +

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.

+ +
+

Guias

+ +
+ + + +
+ +
+

Referência de API

+ +
+ + + +
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 +--- +
{{FirefoxSidebar}}
+
+
+
Child-to-parent CPOWs
+
CPOWs that refer to objects in the parent (chrome) process.
+
Chrome process (also called the parent process)
+
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.
+
Content process (also called the child process)
+
The operating system process that runs web content, in multiprocess Firefox. Code for frame scripts runs in this process.
+
Content scripts
+
Deprecated term for frame scripts.
+
CPOWs
+
CPOW stands for Cross Process Object Wrapper. A CPOW gives chrome code synchronous access to content objects, as a migration aid. See more about CPOWs.
+
+
+ +
+
+
Frame scripts
+
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.
+
Message manager
+
Message managers enable chrome code to load frame scripts into content processes, and communicate with them using a message-passing API. See more about message managers.
+
Parent-to-child CPOWs
+
CPOWs that refer to objects that live in the child (content) process.
+
Shim
+
...
+
+
+
+ +

 

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 +--- +
{{FirefoxSidebar}}
+ +

Nas versões antigas do Firefox para PC, todo o navegador era executado num único processo do sistema operativo. Em particular, o JavaScript 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 Web (também conhecido como "conteúdo" ou "conteúdo da Web").
+
+ As últimas versões do Firefox executam a IU do navegador num processo separado do conteúdo da Web. 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 Electrolysis, por vezes abreviado para e10s.

+ +

As páginas da Web 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 Web.

+ +

Em vez de aceder ao conteúdo da web diretamente, o código do chrome terá que utilizar o gestor de mensagens. Para ajudar a facilitar esta transição, nós implementamos Cross Process Object Wrappers e alguns shims de compatibilidade para os programadores de extras. Se é um programador de extras perguntando-se a si mesmo se está ou não afetado por esta alteração, consulte o guia para trabalhar com multiprocessos do Firefox.

+ +
+
+
+
+
Resumo técnico
+
A very high-level view of how multiprocess Firefox is implemented.
+
Guia de compatibilidade do conteúdo da Web
+
Guidelines and details on potential Web site compatibility issues that may arise due to the transition. Tip: there aren't very many!
+
Glossário
+
Uma referência para o gíria utilizada em 'Multiprocessos do Firefox'.
+
Gestor de mensagens
+
Complete guide to the objects used to communicate between chrome and content.
+
Extras baseados em SDK
+
How to migrate add-ons developed using the Add-on SDK.
+
Quais os URIs que carregam e onde
+
A quick guide to which URIs - chrome:, about:, file:, resource: - are loaded into which process.
+
+
+ +
+
+
Motivação
+
Why we are implementing multiprocess Firefox: performance, security, and stability.
+
Guia de migração de extras
+
If you are an add-on developer, find out if you are affected and how to update your code.
+
Cross Process Object Wrappers
+
Cross Process Object Wrappers are a migration aid, giving chrome code synchronous access to content.
+
Depuração de processos do conteúdo
+
How to debug code running in the content process, including frame and process scripts.
+
Seleção de separador nos multiprocessos do Firefox
+
How switching tabs works in multiprocess Firefox.
+
+
+
+ +
+
+
+
+
Limitações de chrome scripts
+
Práticas que já não irão funcionar no código de chrome, e como as fixar.
+
+
+ +
+
+
Limitações de frame scripts
+
Práticas que já não irão funcionar dentro de frame scripts, e o que fazer.
+
+
+
+ +
+

Contacte-nos

+ +

Saiba mais sobre o projeto, participe, ou coloque as suas perguntas.

+ + 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 +--- +
{{FirefoxSidebar}}

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".

+ +

This is one of a pair of articles: the other one lists limitations of frame scripts.

+ +

Compatibilidade de shims

+ +

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 Cross Process Object Wrapper that gives the chrome code synchronous access to the content.

+ +

You'll get the shims for your add-on by default, unless you set the multiprocessCompatible flag in your add-on's install manifest.

+ +

However, these shims are not a substitute for migrating extensions:

+ + + +

You can see all the places where your add-on uses compatibility shims by setting the dom.ipc.shims.enabledWarnings preference and watching the browser console as you use the add-on.

+ +

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:

+ + + +

gBrowser.contentWindow, window.content...

+ +

Sem shim

+ +

All APIs in the chrome process that provide direct access to content objects will no longer work. For example:

+ +
// chrome code
+
+gBrowser.contentWindow;                    // null
+
+gBrowser.contentDocument;                  // null
+
+gBrowser.selectedBrowser.contentWindow;    // null
+
+window.content;                            // null
+
+content;                                   // null
+
+ +

As a special note, docshells live in the content process, so they are also inaccessible:

+ +
gBrowser.docShell;                         // null
+
+gBrowser.selectedBrowser.docShell;         // null
+ +

Com shim

+ +

The shim will give you a CPOW for the content object in these situations.

+ +

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.

+ +

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 using the message manager.

+ +

Limitações de CPOWs

+ +

Cross process object wrappers (CPOWs) are a migration aid giving chrome code synchronous access to content objects. However, there are various limitations on the kinds of things you can do with a CPOW.

+ +
+

Note that from Firefox 47 onwards, unsafe CPOW usage 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 Browser Console.

+ +

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.

+
+ +

nsIContentPolicy

+ +

Sem shim

+ +

In multiprocess Firefox, if you register the nsIContentPolicy in the chrome process then it will never see any attempts to load web content, because they happen in the content process.

+ +

Com shim

+ +

The shim enables you to add content policies in the chrome process. It transparently registers an nsIContentPolicy in the content process, whose shouldLoad just forwards to the chrome process. The content to check is forwarded as a CPOW. 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.

+ +

To make the shim unnecessary: define and register nsIContentPolicy in the content process. If you need to ensure that the policy is only registered once, use a process script to register the policy.

+ +

nsIWebProgressListener

+ +

This API will work in the chrome process. There is a shim that gives you access to the DOMWindow property of the nsIWebProgress object passed into onStateChange. However, the DOMWindow 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 bug 1118880.

+ +

Also note that unlike other shims, this shim is always active.

+ +

Alternatively, you can use nsIWebProgressListener in the content process.

+ +

Observadores no processo de chrome

+ +

Depending on the topic, you need to register observers in either the chrome process or in a frame script.

+ +

For most topics you need to register observers in the chrome process.

+ +

However, you must listen to content-document-global-created and document-element-inserted in a frame script. Observers for these topics get content objects as the aSubject argument to observe(), so notifications are not sent to the chrome process.

+ +

There is a shim that will forward these two topics to the chrome process, sending CPOWs as the aSubject argument.

+ +

Pedidos de HTTP

+ +

You can't observe HTTP requests in the content process. If you do, you'll get an error.
+
+ If you do so in the chrome process, it will mostly work. The subject for the observer notification will be an nsIHttpChannel as you would expect.

+ +

A common pattern here is to use the notificationCallbacks property of the nsIHttpChannel to get the DOM window that initiated the load, like this:

+ +
observe: function (subject, topic, data) {
+  if (topic == "http-on-modify-request") {
+    var httpChannel = subject.QueryInterface(Ci.nsIHttpChannel);
+    var domWindow = httpChannel.notificationCallbacks.getInterface(Ci.nsIDOMWindow);
+  }
+}
+ +

Or this:

+ +
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;
+  }
+}
+ +

In multiprocess Firefox these patterns will no longer work: the getInterface call will fail.

+ +

In multiprocess Firefox, notificationCallbacks is a special object that tries to emulate the single-process notificationsCallbacks object as best it can. It will return a dummy nsILoadContext when asked, but any attempt to get a window out of it will fail.
+
+ There is an outstanding bug (bug 1108827) to implement a shim here that will make notificationCallbacks a CPOW for the objects in the content process.

+ +

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:

+ +
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);
+  }
+}
+ +

However, before Firefox 38, this technique will not work if multiprocess Firefox is disabled: specifically, topFrameElement 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:

+ + + +

From Firefox 38 onwards, the topFrameElement approach always works.

+ +

Eventos DOM

+ +

Sem shim

+ +

In multiprocess Firefox, if you want to register an event listener on some content DOM node, that needs to happen in the content process.

+ +

It used to be that if you registered a listener on the XUL <browser>  or <tab> 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.

+ +

Com shim

+ +

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 Event object itself is relayed to the chrome process as a CPOW.

+ +

To make the shim unnecessary: register event listeners on the global object inside a frame script. For example:

+ +
addEventListener("load", handler, true) // for example
+ +
If you need to contact the chrome process when that happens, send it a message.
+ +
 
+ +

Sandboxes

+ +
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.
+ +
 
+ +
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 Components.utils.Sandbox) then we'll actually make it in the content process.
+ +
 
+ +
+

nsIAboutModule

+ +

By default, custom about: pages registered using nsIAboutModule are loaded in the chrome process. This means that you can't access their content from the content process (via XHR, for example).

+ +

You can change this default in the code you use to register the about: URI. See about: and chrome: URIs.

+
+ +

Módulos de código de JavaScript (JSMs)

+ +
In single-process Firefox, you can use JavaScript code modules (JSMs) 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.
+ +
 
+ +
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.
+ +
 
+ +

nsIProtocolHandler

+ +
In multiprocess Firefox, code which registers a custom protocol using nsIProtocolHandler must register the custom protocol in the child content process.
+ +
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.
+ +
 
+ +
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 remoteRequire() in the "remote/parent" module.
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 +--- +
{{FirefoxSidebar}}

Frame scripts run with system privileges and have access to the Components object, enabling them to use XPCOM objects and JSMs. 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.

+ +

This is one of a pair of articles: the other one lists limitations of chrome scripts.

+ +

Restrições de Segurança no Acesso de Ficheiro

+ +

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.

+ +

Examples of APIs Add-on authors should avoid in frame scripts:

+ + + +

XUL e IU de navegador

+ +

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:

+ + + +

Serviços

+ +

Some services will not work in frame scripts.

+ + + +

Janelas de Chrome

+ +

Anything that needs to use chrome windows will not work in the content process. For example:

+ + + +

Places API

+ +

A API de Places não pode ser utilizada dentro de uma frame script. Por exemplo:

+ + + +

Observadores no processo de conteúdo

+ +

As noted in Observers in the chrome process, most observers should be registered in the chrome process and will not work in the content process. The exceptions are:

+ + + +

These must be registered in the content process.

+ +

QI from content window to chrome window

+ +
There's a particular pattern often used to get from a content window to the associated chrome window. It looks something like this:
+ +
 
+ +
window.QueryInterface(Ci.nsIInterfaceRequestor)
+                         .getInterface(Ci.nsIWebNavigation)
+                         .QueryInterface(Ci.nsIDocShellTreeItem)
+                         .rootTreeItem
+                         .QueryInterface(Ci.nsIInterfaceRequestor)
+                         .getInterface(Ci.nsIDOMWindow);
+ +
This will no longer work. In the content process the root tree item is an nsITabChild, that cannot be converted to an nsIDOMWindow, so the second getInterface call here will fail.
+ +
 
+ +

If you want a chrome window: send a message from the content process using the message manager. The target property of the object passed into the message handler in the chrome process is the XUL <browser> receiving the message, and you can get the chrome window from that (Note: I'm not really sure how...).

+ +

nsIAboutModule

+ +

By default, custom about: pages registered using nsIAboutModule are loaded in the chrome process. This means that you can't access their content from the content process (via XHR, for example).

+ +

You can change this default in the code you use to register the about: URI. See about: and chrome: URIs.

+ +

Módulos de código de JavaScript (JSMs)

+ +
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 Limitations on chrome scripts page.
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 +--- +
{{FirefoxSidebar}}

Baseado inicialmente no esquema de URI da página, o navegador pode decidir se deseja carregar uma página no processo de chrome ou um processo de conteúdo. Para alguns esquemas, pode alterar o comportamento predefinido.

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
EsquemaComportamento
about: +

By default, about: pages are always loaded in the chrome process. However, when you register a new about: page, you can change this default.

+ +

Two new flags are defined in nsIAboutModule:

+ +
    +
  • URI_CAN_LOAD_IN_CHILD: the page will be loaded in the same process as the browser that has loaded it.
  • +
  • URI_MUST_LOAD_IN_CHILD: the page will always be loaded in a child process.
  • +
+ +

To use one of these flags, return it from your implementation of getURIFlags in the code that registers the about: URI.

+ +

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 - Bug 1257201.

+
chrome: +

By default, chrome: pages are always loaded in the chrome process. However, when you register a new chrome: page, you can change this default.

+ +

Two new flags are defined in the chrome.manifest file:

+ +
    +
  • remoteenabled: the page will be loaded in the same process as the browser that has loaded it.
  • +
  • remoterequired: the page will always be loaded in a child process.
  • +
+
file: +

Carregado sempre num processo de conteúdo.

+ +

Nota: This does not mean file: URIs can be used freely by code in content processes. Sandboxing may blacklist particular directories and future changes may restrict file: URIs to a separate content process, isolated from regular web content. See bug 1187099 how this can affect addons attempting to load files from the profile directory.

+
resource:Carregado sempre num processo de conteúdo.
diff --git "a/files/pt-pt/mozilla/firefox/multiprocess_firefox/resumo_t\303\251cnico/index.html" "b/files/pt-pt/mozilla/firefox/multiprocess_firefox/resumo_t\303\251cnico/index.html" new file mode 100644 index 0000000000..aa2613a58e --- /dev/null +++ "b/files/pt-pt/mozilla/firefox/multiprocess_firefox/resumo_t\303\251cnico/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 +--- +
{{FirefoxSidebar}}
+

This page is an edited extract from Bill McCloskey's blog post on multiprocess Firefox: http://billmccloskey.wordpress.com/2013/12/05/multiprocess-firefox/

+
+ +

At a very high level, multiprocess Firefox works as follows. The process that starts up when Firefox launches is called the parent process. Initially, this process works similarly to single-process Firefox: it opens a window displaying browser.xul, 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 window object, which has a document property, and this document contains all the XML elements from browser.xul. All the Firefox menus, toolbars, sidebars, and tabs are XML elements in this document. Each tab element contains a <browser> element to display web content.

+ +

The first place where multiprocess Firefox diverges from single-process Firefox is that each <browser> element has a remote="true" attribute. When such a browser element is added to the document, a new content process is started. This process is called a child process. An IPC channel is created that links the parent and child processes. Initially, the child displays about:blank, but the parent can send the child a command to navigate elsewhere.

+ +

Desenho

+ +

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 off main thread compositing (OMTC). In brief, each Firefox window is broken into a series of layers, 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.

+ +

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.

+ +

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.

+ +

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.

+ +

User input

+ +

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 <browser> 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.

+ +

With multiple processes, event handling works the same way until the <browser> 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.

+ +

Inter-process communication

+ +

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.

+ +

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 IPDL, which sort of stands for “inter-* protocol definition language”. A typical IPDL file is PNecko.ipdl. It defines a set messages and their parameters. Parameters are serialized and included in the message. To send a message M, C++ code just needs to call the method SendM. To receive the message, it implements the method RecvM.

+ +

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:

+ +
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;
+}
+
+ +

When AddHistoryEntry 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 AddHistoryEntry on its side.

+ +

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 this code. Notice the content process check followed by the SendVisitURI call and an immediate return. The message is received here; this code just calls VisitURI in the parent.

+ +

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.

+ +

Frame scripts

+ +

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 the message manager 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 <browser> element. A message manager can be used to load JS code into the child process and to exchange messages with it.

+ +

As a simple example, imagine that we want to be informed every time a load 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:

+ +
// Get the global message manager.
+let mm = Cc["@mozilla.org/globalmessagemanager;1"].
+         getService(Ci.nsIMessageListenerManager);
+
+// Wait for load event.
+mm.addMessageListener("GotLoadEvent", function (msg) {
+  dump("Received load event: " + msg.data.url + "\n");
+});
+
+// Load code into the child process to listen for the event.
+mm.loadFrameScript("chrome://content/content-script.js", true);
+
+ +

For this to work, we also need to have a file content-script.js:

+ +
// Listen for the load event.
+addEventListener("load", function (e) {
+  // Inform the parent process.
+  let docURL = content.document.documentURI;
+  sendAsyncMessage("GotLoadEvent", {url: docURL});
+}, false);
+
+ +

This file is called a frame script. When the loadFrameScript function call runs, the code for the script is run once for each <browser> 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 true parameter to loadFrameScript). Since the script is run once per browser, it can access the browser’s window object and docshell via the content and docShell globals.

+ +

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 message manager guide.

+ +

Cross-process APIs

+ +

There are a lot of APIs in Firefox that cross between the parent and child processes. An example is the webNavigation property of XUL <browser> elements. The webNavigation property is an object that provides methods like loadURI, goBack, and goForward. 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.

+ +

The webNavigation 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 <browser> and <tabbrowser>. The <browser> customizations reside in browser.xml. Here is how browser.webNavigation is defined:

+ +
<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>
+
+ +

This code is invoked whenever JavaScript code in Firefox accesses browser.webNavigation, where browser is some <browser> element. It checks if the result has already been cached in the browser._webNavigation field. If it hasn’t been cached, then it fetches the navigation object based off the browser’s docshell. 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 webNavigation accessor runs in the parent process, this.docShell above will just return null. As a consequence, this code will fail completely.

+ +

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 <browser> elements. It is called remote-browser.xml, and it extends the existing browser.xml binding.

+ +

The remote-browser.xml binding returns a JavaScript shim object whenever anyone uses browser.webNavigation or other similar objects. The shim object is implemented in its own JavaScript module. It uses the message manager to send messages like "WebNavigation:LoadURI" to a content script loaded by remote-browser.xml. The content script performs the actual action.

+ +

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.

+ +

Cross-process object wrappers

+ +

The message manager API does not allow the parent process to call sendSyncMessage; 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 sendAsyncMessage 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.

+ +

These objects are called cross-process object wrappers, frequently abbreviated to CPOWs. They’re created using the message manager. Consider this example content script:

+ +
addEventListener("load", function (e) {
+  let doc = content.document;
+  sendAsyncMessage("GotLoadEvent", {}, {document: doc});
+}, false);
+
+ +

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 sendAsyncMessage 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:

+ +
let mm = Cc["@mozilla.org/globalmessagemanager;1"].
+         getService(Ci.nsIMessageListenerManager);
+
+mm.addMessageListener("GotLoadEvent", function (msg) {
+  let uri = msg.objects.document.documentURI;
+  dump("Received load event: " + uri + "\n");
+});
+mm.loadFrameScript("chrome://content/content-script.js", true);
+
+ +

It’s important to realize that we’re send object references. The msg.objects.document object is only a wrapper. The access to its documentURI 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.

+ +

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.

+ +

Another problem with CPOWs is that they violate some assumptions people might have about message ordering. Consider this code:

+ +
mm.addMessageListener("GotLoadEvent", function (msg) {
+  mm.sendAsyncMessage("ChangeDocumentURI", {newURI: "hello.com"});
+  let uri = msg.objects.document.documentURI;
+  dump("Received load event: " + uri + "\n");
+});
+
+ +

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 uri 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 uri will have some other value.

+ +

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.

+ +

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.

+ +

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.

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 +--- +
{{FirefoxSidebar}}

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.

+

New developer features in Firefox 3

+

For web site and application developers

+
+
+ Updating web applications for Firefox 3
+
+ 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.
+
+
+
+ Online and offline events
+
+ 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.
+
+
+
+ Web-based protocol handlers
+
+ You can now register web applications as protocol handlers using the navigator.registerProtocolHandler() method.
+
+
+
+ Drawing text using a canvas
+
+ You can now draw text in a canvas using a non-standardized API supported by Firefox 3.
+
+
+
+ Transform support for canvas
+
+ Firefox now supports the transform() and setTransform() methods on canvases.
+
+
+
+ Using microformats
+
+ Firefox now has APIs for working with microformats.
+
+
+
+ Drag and drop events
+
+ Firefox 3 supports new events that are sent to the source node for a drag operation when the drag begins and ends.
+
+
+
+ Focus management in HTML
+
+ The new HTML 5 activeElement and hasFocus attributes are supported.
+
+
+
+ Offline resources in Firefox
+
+ Firefox now lets web applications request that resources be cached to allow the application to be used while offline.
+
+
+
+ CSS improvements in Firefox 3
+
+ Firefox 3 features a number of improvements in its CSS support.
+
+
+
+ DOM improvements in Firefox 3
+
+ Firefox 3 offers a number of new features in Firefox 3's DOM implementation, including support for several Internet Explorer extensions to the DOM.
+
+
+
+ JavaScript 1.8 support
+
+ Firefox 3 offers JavaScript 1.8.
+
+
+
+ EXSLT support
+
+ Firefox 3 provides support for a substantial subset of the EXSLT extensions to XSLT.
+
+
+
+ SVG improvements in Firefox 3
+
+ 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.
+
+
+
+ Animated PNG graphics
+
+ Firefox 3 supports the animated PNG (APNG) image format.
+
+

For XUL and extension developers

+

Notable changes and improvements

+
+
+ Updating extensions for Firefox 3
+
+ Provides a guide to the things you'll need to do to update your extension to work with Firefox 3.
+
+
+
+ XUL improvements in Firefox 3
+
+ Firefox 3 offers a number of new XUL elements, including new sliding scales, the date and time pickers, and spin buttons.
+
+
+
+ Templates in Firefox 3
+
+ 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.
+
+
+
+ Securing updates
+
+ 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 AMO 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).
+
+
+
+ Places migration guide
+
+ An article about how to update an existing extension to use the Places API.
+
+
+
+ Download Manager improvements in Firefox 3
+
+ The Firefox 3 Download Manager features new and improved APIs, including support for multiple progress listeners.
+
+
+
+ Using nsILoginManager
+
+ The Password Manager has been replaced by the new Login Manager.
+
+
+
+ Embedding XBL bindings
+
+ You can now use the data: URL scheme from chrome code to embed XBL bindings directly instead of having them in separate XML files.
+
+
+
+ Localizing extension descriptions
+
+ 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.
+
+
+
+ Localization and Plurals
+
+ Firefox 3 adds the new PluralForm module, which provides tools to aid in correctly pluralizing words in multiple localizations.
+
+
+
+ Theme changes in Firefox 3
+
+ Notes and information of use to people who want to create themes for Firefox 3.
+
+

New components and functionality

+
+
+ FUEL Library
+
+ 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.
+
+
+
+ Places
+
+ The history and bookmarks APIs have been completely replaced by the new Places API.
+
+
+
+ Idle service
+
+ 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.
+
+
+
+ ZIP writer
+
+ The new {{Interface("nsIZipWriter")}} interface lets extensions create ZIP archives.
+
+
+
+ Full page zoom
+
+ Firefox 3 improves the user experience by offering full page zoom in addition to text-only zoom.
+
+
+
+ Interfacing with the XPCOM cycle collector
+
+ XPCOM code can now take advantage of the cycle collector, which helps ensure that unused memory gets released instead of leaking.
+
+
+
+ The Thread Manager
+
+ 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.
+
+
+
+ JavaScript modules
+
+ 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.
+
+
+
+ The nsIJSON interface
+
+ Firefox 3 offers the new {{Interface("nsIJSON")}} interface, which offers high-performance encoding and decoding of JSON strings.
+
+
+
+ The nsIParentalControlsService interface
+
+ Firefox 3 now supports the Microsoft Windows Vista parental controls feature, and allows code to interact with it.
+
+
+
+ Using content preferences
+
+ 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.
+
+
+
+ Plug-in Monitoring
+
+ 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.
+
+

Fixed bugs

+
+
+ Notable bugs fixed in Firefox 3
+
+ This article provides information about bugs that have been fixed in Firefox 3.
+
+

New features for end users

+

User experience

+ +

Security and privacy

+ +

Performance

+ +

See also

+ +
{{Firefox_for_developers('2')}}
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 +--- +

{{FirefoxSidebar}}{{Draft}}

+ +

Este artigo fornece informaçaõ acerca das alterações no Firefox 70 que irão afetar od programadores. O Firefox 70 é a versão Beta atual do Firefox, e irá ser distribuida no dia 22 de outubro de 2019.

+ +

Alterações para os programadores da Web

+ +

Ferramentas do programador

+ + + +

Removals

+ +

HTML

+ +

No changes.

+ +

 Removals

+ +

CSS

+ + + +

Removals

+ + + +

SVG

+ +

No changes.

+ +

Removals

+ +

JavaScript

+ + + +

Removals

+ +

APIs

+ + + +

Novas APIs

+ +

DOM

+ + + +

Eventos DOM

+ +

Service workers

+ +

Media, Web Audio, and WebRTC

+ +

Canvas and WebGL

+ + + +

Removals

+ +

Segurança

+ +

No changes.

+ +

Removals

+ +

Plug-ins

+ +

No changes.

+ +

Removals

+ +

Outros

+ +

No changes.

+ +

Removals

+ +

Alterações para os programadores de extras (add-on)

+ +

Alterações de API

+ +

Sem alterações.

+ +

Removals

+ +

Alfetarções de Manifest

+ +

Sem alterações.

+ +

Removals

+ +

Consultar também:

+ + + +

Versões antigas

+ +

{{Firefox_for_developers(69)}}

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 +--- +
{{FirefoxSidebar}}
+ +

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.

+ +
{{ListSubpages("",1,1,1)}}
+ +
 
+ +

Ufa! Isso é muito de Firefoxen!

+ +

Consultar também

+ + 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 +--- +

Para cada vez mais pessoas, os dispositivos móveis são o meio principal, ou até o único meio, para aceder à Internet. Firefox para Android (nome de código Fennec) é um navegador aberto, personalizável, baseado em padrões, tal como a versão Firefox para pc.

+ +

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.

+ +

Contribuir para o Firefox para Android

+ +

O ponto de partida para informação acertca do projecto Firefox para Android é a página Wiki do projecto.

+ +

Podes ajudar a criar e melhorar Firefox para Android:

+ + + +

Programar para a Web móvel

+ +

Nós começamos a criar um guia para desenhar sites da Web para os dispositivos móveis.

+ +

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:

+ + + +

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 Emulador Android..

+ +

Desenvolver extras para dispositivos móveis

+ +

Firefox for Android supports add-ons using the exact same extension system 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 same process that would be used for desktop Firefox. Add-ons that work with desktop Firefox do not automatically work in Firefox on Android. The user interfaces are just too different.

+ +
O Firefox no Android tem um identificador de aplicação único que deve ser utilizado em install.rdf. O identificador é {aa3c5121-dab2-40e2-81ca-7ea25febc110}
+ +

Both classic restart-required and newer restartless 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.

+ +

Resumo Rápido

+ + + +

Obter ajuda com o Firefox para Android

+ +

A documentação e tutoriais para utilizar e a resolução de problemas do Firefox para Android estão disponíveis no site da Web de Apoio da Mozilla.

+ +

Install Firefox for Android

+ +

If you don't already have Firefox installed on your Android device, you can do so at the Google Play store. See the SUMO article Install Firefox on an Android device using Google Play for detailed instructions.

+ +

Alternate installs

+ +

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 not supported by Mozilla and you are using them at your own risk!).

+ + 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 +--- +

Se registar um relatório de crache no Bugzilla sobre um crache, deverá incluir um rastreamento (call stack) 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 (Breakpad) 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.

+ +

Requisitos

+ +

You need a binary build of Firefox from Mozilla.org. SeaMonkey and Thunderbird also support crash reporting.

+ +

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 alternative methods listed below.

+ +
Nota: When filing a crash report, it is important to know whether the crash occurs with Firefox safe mode. This helps engineers determine whether a particular extension or plugin is the cause of the crash.
+ +

Como obter uma Id. de crache com o 'Relat´rio de Crache' da Mozilla

+ + + + + + + + +
+

1. Crash and submit a report to the system.

+ +

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 check the "Tell Mozilla about this crash" checkbox and click the restart button. The crash reporter should now submit the crash report and Firefox should open again.

+ +
The "Details" button gives additional data about the incident, however this is not useful in a bug report.
+
+

reporter.jpg

+
+ + + + + + + + +
+

2. Tell us the ID of the report you submitted.

+ +

To access all of your submitted reports type "about:crashes" into the Firefox address bar 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.

+ +
You can prefix a "bp-" to the beginning of an ID to make Bugzilla turn it into a link: bp-a70759c6-1295-4160-aa30-bc4772090918
+
+

crashlist.jpg

+
+ +

How to get the crash ID if Firefox crashes on startup

+ +

If Firefox crashes on startup you can still access your submitted crash reports. Crash reports are accessible from all Firefox profiles, so if a new profile does not crash you can use it to access them through "about:crashes" as above.

+ +

Aceder às Ids. do relatório de crache fora do Firefox

+ +

If you cannot load Firefox at all you can find the crash report files at this location depending on your operating system:

+ +

Windows : %APPDATA%\Mozilla\Firefox\Crash Reports\submitted\
+ OS X : ~/Library/Application Support/Firefox/Crash Reports/submitted/
+ Linux : ~/.mozilla/firefox/Crash Reports/submitted/

+ +

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.

+ +

Modos alternativos para obter um rastreamento

+ +

If the Mozilla crash reporter doesn't come up or isn't available you will need to obtain a stacktrace manually:

+ +

Windows

+ +

See the article Create a stacktrace with Windbg for information on how to do this.

+ +

For a full process dump, see How to get a process dump with Windows Task Manager [en-US]

+ +

OS X

+ +

Run /Applications/Utilities/Console.app.  Expand "~/Library/Logs" and "CrashReporter", then look for logs for "firefox-bin".

+ +

Linux

+ +

Note that for most distros the package you need to get symbols for will be something like "xulrunner", not "firefox".

+ +

Os ficheiros de relatórios de crache no seu computador

+ +

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.

+ +

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.

+ + 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 +--- +

Pontoon é 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.

+ +
+

Would you like to improve Pontoon? Learn how to get involved on GitHub.

+
+ +
+

Just getting started with your project l10n? Check out the wiki on getting your project localized.

+
+ +

A. Make your project localizable

+ +

We realize that these are already considered to be standard best practices for localizing projects at Mozilla, but we feel it's good to add them here as a little reminder.

+ +
    +
  1. Ensure that your project supports one of the l10n frameworks (gettext, XLIFF, L20n, lang, properties, etc.).
  2. +
  3. Extract localizable strings into resource files.
  4. +
  5. Push resource files to a repository (SVN, HG, Git). +
      +
    • Individual locale folders must be located at the same nesting level of the directory tree. Source locale needs to be called templates, en-US, en-us or en. 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 locales folder for this purpose. Locale code must not be part of the file name.
    • +
    • Correct pattern: +
      /locales/{locale_code}/path/to/file.extension
      +
    • +
    • Incorrect pattern: +
      /locales/{locale_code}/path/to/file.{locale_code}.extension
      +
    • +
    +
  6. +
  7. Make sure Pontoon has write access to the repository. + +
  8. +
+ +

B. (optional) Enable in-page localization of your web project

+ +
    +
  1. Link a script from your HTML <body> 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: + + +
  2. +
  3. If your site uses CSP, please make sure that the following is permitted for domain pontoon.mozilla.org: +
      +
    1. loading inside iframe
    2. +
    3. loading remote CSS
    4. +
    5. loading remote images
    6. +
    +
  4. +
  5. If your site uses the X-Frame-Options header, please make sure loading inside iframe is permitted for domain pontoon.mozilla.org.
  6. +
  7. Make sure your site supports HTTPS. It's free, automated and open. Let's encrypt!
  8. +
+ +

C. Add your project to Pontoon

+ +

Your project is now ready to be set up in Pontoon. Please file a bug in Localization Infrastructure and Tools :: Administration / Setup and provide the following information:

+ + + +

For more details, please get in touch with the Project Management Team.

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 +--- +
+

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.

+ +

{{LandingPageListSubpages}}

+
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 +--- +

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.

+ +
+
+ +
+ +
+ +
+ +
+ +
+
+ +
+

Ligar com Mozilla

+ +

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.

+ +

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. Subscribe to the Apps & Hacks newsletter.

+ +

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 subscribe to the Hacks blog and subscribe to the newsletter!

+ +

If you're on Twitter, follow us and hear about doc updates, jobs, contributor opportunities, and more.

+ +

Aderir à Mozilla

+ +

If you want to go beyond connecting with Mozilla, you can join Mozilla and help realize Mozilla's mission of building a better Internet. 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.

+ +

Oportunidade para aprender qualquer coisa nova

+ +
+

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.

+ +

O que eu obtenho ao contribuir?

+ +

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é.

+ +

Como pode contribuir para a Mozilla

+ +

There are many project area for which you can contribute to Mozilla. You can find a current, complete list on the main Mozilla Get Involved page. Some areas that may interest you as a developer include:

+ + +
+
+ +
+
 
+ +
 
+
+ +

Developers at a Firefox OS workshop in Madrid.

+ +
+ + +
+

Outros recursos

+ + +
+
diff --git "a/files/pt-pt/mozilla/localization/aplica\303\247\303\243o_tradu\303\247\303\243o_com_mercurial/index.html" "b/files/pt-pt/mozilla/localization/aplica\303\247\303\243o_tradu\303\247\303\243o_com_mercurial/index.html" new file mode 100644 index 0000000000..ef44aa26fa --- /dev/null +++ "b/files/pt-pt/mozilla/localization/aplica\303\247\303\243o_tradu\303\247\303\243o_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 +--- +

{{draft}}

+ +

Verifique qual o idioma que está disponível para tradução

+ +
    +
  1. Find out on which branch localization is done for your locale: Read your localization team's page by clicking on the team with your language code (e.g. "de" for German). The localization lead for your language knows the branch. The default localization branch is aurora.
  2. +
  3. Next check what is still untranslated by going to Localization status page and click on the page for your language.
  4. +
  5. In the section "Applications & Sign-offs", you will find different products and branches which are currently in translation. +
      +
    • gaia-* denotes branches of Firefox OS, the operating system for mobile devices.
    • +
    • Firefox and fx-* denote branches of Firefox for Desktop, the browser for desktops and notebooks running, Windows, Mac OS or Linux.
    • +
    • Fennec and fennec-* denote branches of Firefox for Mobile, the Firefox browser for the Android operating system.
    • +
    • Thunderbird and tb-* denote branches of Thunderbird, the mail client, newsgroup and feed reader and chat client. The localization of the Lightning calendar add-on also takes place on these branches.
    • +
    • SeaMonkey and sea-* denote branches of SeaMonkey, the suite consisting of browser, mail and chat client and more.
    • +
    • 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.
    • +
    +
  6. +
  7. In this example, we assume Firefox for Desktop shall be localized and that the localization branch is aurora. Scroll to the fx_aurora text.
  8. +
  9. Read the text next to it. +
      +
    • If it is 'Translated', 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.
    • +
    • If it is a red text consisting of a number and the word 'missing', then there are untranslated texts and you can move on with this guide.
      +  
    • +
    +
  10. +
+ +

Ferramentas Necessárias

+ +

Pré-requisitos de criação

+ +

First, get the required programs to compile Mozilla applications like Firefox and Thunderbird from Instruções de Compilação. This is only necessary once.

+ +
+

MozillaBuild deve estar instalado num caminho de ficheiro absoluto sem espaços em branco, senão este será interrompido..

+
+ +

Programa de comparação de ficheiro

+ +

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 WinMerge: Download and install it. A comparison of alternatives (e.g. for Linux and Mac OS) is available on Wikipedia.

+ +

Editor de ficheiro e texto

+ +

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 Notepad++.

+ +

Ferramenta de monitorização do progresso

+ +

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 Scrapbook is used in this guide. Install it into your default Firefox profile (you will have more than one profile when following this guide).

+ +

Obter os Textos atuais em inglês e o seu idioma

+ +

Obter os textos em inglês com o código fonte

+ +

Get the source code by downloading the following file:

+ + + +

In the next step, we will unpack the source code:

+ +
    +
  1. Open an input shell, e.g. by pressing the Windows key and R on the keyboard Screenshot of Windows key + R key or by calling the "Run..." command from the Windows "Start" button, and then typing cmd and pressing the Enter key.
  2. +
  3. Launch the installed MozillaBuild toolset by launching it with its path, e.g. C:\Mozilla\Coding\Buildtools\MozillaBuild\start-shell-msvc2010.bat You can autocomplete the file path after typing a few characters and then pressing the Tabulator key.
    + 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.
  4. +
  5. 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
    + cd /c/Mozilla/
  6. +
  7. Create a new directory for the source code:
    + mkdir mozilla-aurora
  8. +
  9. Initialize the new directory as new repository:
    + hg init mozilla-aurora
  10. +
  11. Go into the new directory:
    + cd mozilla-aurora
  12. +
  13. Unpack the source code:
    + hg unbundle /path/to/the/downloaded/mozilla-aurora.hg
    + This can take some time, mostly depending on the performance of the hard drive.
  14. +
  15. Extract the files:
    + hg update
  16. +
+ +

Obter os textos para a sua localização

+ +
    +
  1. Go back to the parent folder of mozilla-aurora:
    + cd ..
  2. +
  3. Find the localization repository for your branch and language on http://hg.mozilla.org/ E.g. for aurora and German (language code 'de'), it is http://hg.mozilla.org/releases/l10n/mozilla-aurora/de/ Copy that url to the clipboard.
  4. +
  5. Copy the repository to your computer by running the following command:
    + hg clone http://hg.mozilla.org/releases/l10n/mozilla-aurora/de/ de-mozilla-aurora
    + This should proceed pretty fast.
    + On Windows, you can paste the url by calling the Paste command from the window menu in the upper left corner of the window.
  6. +
+ +

Configurar as suas definições de utilizador do Mercurial

+ +

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:

+ +

cd /c/Users/MyName

+ +

Now list all the files here:

+ +

ls -a

+ +

If there is no file called .hgrc , create it with

+ +

> .hgrc

+ +

This file stores your general Mercurial settings (Mercurial is the tool which manages the source code and its history of changes).

+ +

Now go in the file system to the file and open it in your favorite text editor. Windows users can use e.g. Notepad++.

+ +

Paste the following content into the file:

+ +
[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]
+
+
+ +

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.

+ +

Ativar filas do Mercurial (correções revertíveis)

+ +

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. Mercurial queues allow to revert changes and also pull changes and reapply your local changes.

+ +

Go back to the localization directory:

+ +

cd /c/Mozilla/de-mozilla-aurora

+ +

Initiate Mercurial queues:

+ +

hg qinit

+ +

Conhecer o estilo de tradução

+ +

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.

+ +

The following resources can help figuring out the translation style and translate according to them:

+ + + +

Escolher o que traduzir

+ +

Go to the Localization status page and click on the '<number> missing' label of the Firefox branch on which you want to translate, e.g. fx_aurora. 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.

+ +

unchanged localization report

+ +

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 privatebrowsingpage.howToStart4 in the file aboutPrivateBrowsing.dtd.

+ +

Tips for finding files with usually easily translateable texts:

+ + + +

Monotorizar o progresso de tradução

+ +

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 Scrapbook.

+ +
    +
  1. 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.
  2. +
  3. Drag the tab with the localization error showing missing and obsolete strings to the sidebar.
  4. +
  5. 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".
  6. +
  7. After you saved the dialog, click with the left mouse button on the page in the sidebar to open the locally saved copy.
  8. +
+ +

Abrir ficheiros em inglês e o idioma de destino lado-a-lado

+ +

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,

+ +
    +
  1. Launch WinMerge.
  2. +
  3. From its "File" menu, choose "Save project".
  4. +
  5. For the file path of the left directory, go to the downloaded mozilla-aurora source code and then into its browser/locales/en-US/ folder. In this example, the absolute file path is C:\Mozilla\mozilla-aurora\browser\locales\en-US.
  6. +
  7. Enable read-only mode for the left directory.
  8. +
  9. For the file path of the right directory, go to the downloaded translation directory de-mozilla-aurora and then into its browser folder. In this example, the absolute file path is C:\Mozilla\de-mozilla-aurora\browser.
  10. +
  11. Save this comparison as project so you can easily relaunch this comparision without selecting the directories again. A good name is e.g. translation-mozilla-aurora-browser.winmerge
  12. +
  13. Open the comparison you just saved.
  14. +
+ +

A tradução

+ +
    +
  1. +

    Bring the console with Mercurial to the front.

    +
  2. +
  3. +

    Start tracking changes you make against the localization repository by telling it that with the qnew subcommand to save these changes as patch in a mercurial queue. This patch needs a name, choose something meaning full like "Firefox-<version number>-more-details". In this example, Firefox-29-aboutPrivateBrowsing will be used.
    + hg qnew Firefox-29-aboutPrivateBrowsing

    +
  4. +
  5. Switch back to WinMerge and navigate to browser/chrome/browser/ and open the aboutPrivateBrowsing.dtd file. You will see something like this:
    + single file comparision in WinMerge without changes by the user
    + 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.
  6. +
  7. Below the license header which should never changed, the texts are organized in the following format:
    + <!ENTITY stringid "Text which will be shown in Firefox">
  8. +
  9. 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 privatebrowsingpage.howToStart3 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.
  10. +
  11. Press the F5 key or click the reload button in WinMerge's toolbar to re-compare the files.
  12. +
  13. Now copy the empty lines below privatebrowsingpage.learnMore and the line <!-- TO BE REMOVED POST-AUSTRALIS --> to the localized file. This text is a comment (which in .dtd files always can be found between <!-- and -->). There is no need to translate this text.
  14. +
  15. Now we copy the two missing lines from the English file and insert them in the localized file:
    + <!-- LOCALIZATION NOTE (privatebrowsingpage.howToStart4): please leave &newPrivateWindow.label; intact in the translation -->
    + <!ENTITY privatebrowsingpage.howToStart4               "To start Private Browsing, you can also select &newPrivateWindow.label; from the menu.">

    + The first line is a comment providing information on the localization of the text in the following line. &newPrivateWindow.label; has to be left unchanged so it can be replaced with the text of the string id &newPrivateWindow.label; whis is stored elsewhere.
  16. +
  17. Translation time: Translate the text. Afterwars, the line should look somehow like this:
    + <!ENTITY privatebrowsingpage.howToStart4               "Der private Modus kann auch über den Menü-Eintrag &newPrivateWindow.label; gestartet werden.">
  18. +
  19. Save the file.
  20. +
+ +

Exportar as alterações como correção

+ +

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.

+ +
    +
  1. Tell Mercurial to store the changes in the Mercurial queue with the qref 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 -m command line flag,
    + hg qref -m "Firefox 29: Localize missing string in aboutPrivateBrowsing.dtd"
    + You can change the commit message in the Mercurial queue every time by calling hg qref again.
  2. +
  3. Now export the patch to the file system using the qexport command which is defined in the .hgrc file (see above):
    + hg qexport > ../firefox-29-aboutPrivateBrowsing-v1.patch
    + This creates a patch file called firefox-29-aboutPrivateBrowsing-v1.patch containing the changes in the parent directory of de-mozilla-aurora (in this example: C:\Mozilla\).
  4. +
+ +

Correção ortográfica e alterar a correção (patch)

+ +

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).

+ +

Validar a tradução no produto

+ +

This guide hasn't yet a section about the validation of the translation. Please follow the instructions from the QA phase section of the Localization quick start guide.

+ +

Submeter a correção (patch) para revisão

+ +

Now the patch has to be shared so the people currently trusted to change the official translation can review the suggested changes.

+ +
    +
  1. File a bug ("ticket") in the Mozilla Localization product and choose as component the localization for which you have translated.
  2. +
  3. Choose a meaningful bug summary which will be shown for searches etc. like in this example "Firefox 29: aboutPrivateBrowsing.dtd"
  4. +
  5. Fill any important and additional information into the description field.
  6. +
  7. Click the 'Add attachment' button.
  8. +
  9. Select the exported patch file with the file picker. The checkbox for 'patch' should get automatically checked.
  10. +
  11. Add a meaningful name for the attachment, e.g. aboutPrivateBrowsing.dtd, patch, v1
  12. +
  13. Go to the review 'Flags' category and set the one for review to ?, meaning that you request review for the patch.
  14. +
  15. 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 page of the localization team.
  16. +
  17. Submit the bug report.
  18. +
  19. 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 Proof-reading and altering the patch. If the reviewer accepts the changes, the patch will get uploaded and your translation will officially be added to Firefox.
  20. +
diff --git "a/files/pt-pt/mozilla/localization/guia_inicia\303\247\303\243o_r\303\241pida/configuracao_inicial/index.html" "b/files/pt-pt/mozilla/localization/guia_inicia\303\247\303\243o_r\303\241pida/configuracao_inicial/index.html" new file mode 100644 index 0000000000..abde7e440f --- /dev/null +++ "b/files/pt-pt/mozilla/localization/guia_inicia\303\247\303\243o_r\303\241pida/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 +--- +

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.

+ +

Nova ou existente

+ +

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.

+ +

Veja o que faz:

+ +

Look through the existing localization community directory to see if one already exists for your locale.

+ +
    +
  1. If a community already exists, reach out to them and ask how you can help.
  2. +
  3. If a community doesn't exist, send an email to the new-locales newsgroup for additional guidance.
  4. +
+ +

Contas

+ +

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.

+ +
+
hg (Mercurial)
+
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 not 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 Mozilla Committer page and follow the process outlined there. Here is an example bug that illustrates the process well. Use this bug template when filing your hg account registration bug. Add a request about creating your locale's repository to the new locales newsgroup.
+
SVN
+
SVN is a revision control environment that Mozilla uses to house Mozilla source websites and their localizations for each official Mozilla localization. See this wiki page about how to gain access to SVN. The SVN for Localizers guide will help you learn the most important SVN commands for l10n. Add a request about creating your locale's repository to the new locales newsgroup.
+
+ +
+
Ferramentas de L10n baseadas na Web
+
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.
+
Mozilla LDAP
+
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 new locales newsgroup.
+
Componente de Bugzilla específico do local
+
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 new locales newsgroup.
+
+ +

Ferramentas de ambiente locais

+ +

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.

+ +
+
Hg (Mercurial)
+
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 here.
+
+ +
+
comparar-idiomas
+
compare-locales is a Python script that helps you check your work without needing to run Firefox or another application. Install intructions are located here.
+
Verificações de L10n
+
L10n checks is another Python script that helps you check your work without running an application. Install instructions are located here.
+
autoconf 2.13
+
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 here.
+
wget
+
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 here.
+
Perl
+
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 here.
+
Python
+
Python is a programming language in which many of our L10n testing scripts are written. You can find the source files and install instructions here.
+
Locale Switcher ou Quick Locale Switcher
+
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 these links.
+
Um editor de texto sólido, baseado em Unicode
+
Here are some suggestions: + +
+
GNU make
+
Make is a tool which controls the generation of executables. You can find version 3.79.1 or higher here. Unfortunately, other varieties of make won't do.
+
+ +

Fim da configuração inicial

+ +

Agora que concluiu a configuração inicial, é hora da melhor parte: traduzir!

+ +

{{ PreviousNext("Localization_Quick_Start_Guide", "Localization_Quick_Start_Guide/Translation_phase") }}

diff --git "a/files/pt-pt/mozilla/localization/guia_inicia\303\247\303\243o_r\303\241pida/fase_da_traducao/index.html" "b/files/pt-pt/mozilla/localization/guia_inicia\303\247\303\243o_r\303\241pida/fase_da_traducao/index.html" new file mode 100644 index 0000000000..cdb31df82a --- /dev/null +++ "b/files/pt-pt/mozilla/localization/guia_inicia\303\247\303\243o_r\303\241pida/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 +--- +

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.

+ +

É 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.

+ +

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.

+ +

Projetos

+ +

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.

+ +

Aplicações da Mozilla

+ +

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.

+ +

These are the l10n tools we use to localize Mozilla applications:

+ +
+
Pootle
+
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 instance of Pootle used to localize Mozilla applications.
+
+ +
+
Koala
+
A l10n add-on for the offline, stand-alone Komodo Edit text editor.
+
Mozilla Translator
+
Am offline, stand-alone, Java-based l10n tool that helps you translate and integrates with your repositories. Visit the Mozilla Translator (MT) download page to get your own MT client. Version 5.26 is the latest version.
+
Virtaal
+
An offline, stand-alone version of Pootle that is also built on the Translate Toolkit API.
+
+ +

These are the Mozilla application projects that are localized using the l10n tools above:

+ +
+
Firefox
+
The award-winning Firefox® Web browser has security, speed and new features that will change the way you use the Web. See the list of the most critical strings for localizing in Firefox, as well as a guide to understanding how they're organized.
+
Thunderbird
+
Enjoy safe, fast and easy email, Mozilla-style. The Thunderbird® email client includes intelligent spam filters, powerful search and customizable views.
+
Seamonkey
+
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.
+
Firefox Mobile
+
By adding Firefox® to your mobile phone, you can access rich Web content and enjoy your favorite Firefox features wherever you go.
+
Lightning
+
Lightning is a popular calendaring, scheduling and task management extension.
+
+ +

If your locale has an hg repository hosted on the Mozilla servers, you can track your localization's current progress by visiting the l10n dashboards.

+ +
+

Nota: 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 sobre como utilizar "hg" nos seus esforços de localização aqui.

+
+ +

Sites da Web da Mozilla

+ +

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.

+ +

These are the l10n tools we use to localize Mozilla web projects:

+ +
+
Pontoon
+
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 Pontoon here. Please note the Pontoon is not available for all web projects yet.
+
+ +

These are the Mozilla web projects that are localized using the l10n tools above:

+ +
+
mozilla.org
+
Every user's first Mozilla experience.
+
addons.mozilla.org (AMO)
+
A portal for all users interested in finding add-ons for their local Mozilla applications. Read the guidelines on localizing AMO, straight from the AMO team.
+
developer.mozilla.org (MDN)
+
Where you are now! Help localize the MDN user interface for everyone in your region.
+
support.mozilla.com (SUMO)
+
A portal for anyone who needs technical support for their Mozilla applications. Help localize the SUMO user interface for everyone in your region.
+
Mozilla Engagement Campaigns
+
Individual campaigns created by Mozilla to attract new contributors.
+
hacks.mozilla.org
+
For everyone interested in the leading-edge stuff that people are doing with Mozilla Firefox and the open web.
+
In-product pages
+
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.
+
+ +

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 lista de sites da Web localizados da Mozilla.

+ +

Também deveria ler mais informação sobre a localização de projetos da web da Mozilla.

+ +
+
 
+
+ +

Extras (Add-ons)

+ +

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.

+ + + +

Ferramenta de localização independente

+ +

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!

+ +

For localizers who prefer localizing without a specialized tool the workflows for localizing Mozilla applications and Mozilla websites are essentially the same. This tutorial should provide you with all of the technical information you need to secure and maintain your tool independence.

+ +

Produtibilidade

+ +

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.

+ +

This tutorial will walk you through performing these productization tasks, creating productization patches, and submitting them for review.

+ +

{{ PreviousNext("Localization_Quick_Start_Guide/Initial_setup", "Localization_Quick_Start_Guide/QA_phase") }}

diff --git "a/files/pt-pt/mozilla/localization/guia_inicia\303\247\303\243o_r\303\241pida/fase_de_lancamento/index.html" "b/files/pt-pt/mozilla/localization/guia_inicia\303\247\303\243o_r\303\241pida/fase_de_lancamento/index.html" new file mode 100644 index 0000000000..310ec4344e --- /dev/null +++ "b/files/pt-pt/mozilla/localization/guia_inicia\303\247\303\243o_r\303\241pida/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 +--- +

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.

+ +

Para obter mais informação sobre a parte de lançamento do processo L10n, visite o site da wiki da Mozilla aqui.

+ +

O seu repositório oficial de lançamentos

+ +

Now that your locale has been registered, the localization files will live on Mozilla Mercurial server at hg.mozilla.org. Depending on which branch you work on, the URL of your repository might look like this:

+ +
http://hg.mozilla.org/releases/l10n-central/x-testing
+
+ +

If you followed the Koala or plain text 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 local clone.

+ +

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 pull using both, but you can only push 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.

+ +

Configuração

+ +

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.

+ +
    +
  1. Add the following lines to your ~/.ssh/config file, replacing user@host.domain with your Mozilla LDAP account name:
  2. +
+ +
Host hg.mozilla.org
+User user@host.domain
+ +
    +
  1. If you have already cloned the remote repository using the HTTP protocol using this command: $ hg clone http://hg.mozilla.org/releases/l10n-central/x-testing then you will need to edit the .hg/hgrc file (inside the x-testing local clone) to tell Mercurial to push using SSH. Your .hg/hgrc file shoud look like this (add the emphasized line):
  2. +
+ +
[paths]
+default = hg.mozilla.org/releases/l10n-central/x-testing
+default-push = ssh://hg.mozilla.org/releases/l10n-central/x-testing
+
+ +
    +
  1. If you haven't already cloned the remote repository, enter this command: hg clone ssh://hg.mozilla.org/releases/l10n-central/x-testing
  2. +
+ +

Mercurial will let you know that it's cloning the repository:

+ +
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
+
+ +

The default push URL is the same as the default pull URL (i.e., ssh://hg.mozilla.org/releases/l10n-central/x-testing).

+ +

You should now be able to push to the remote repository!

+ +

Commit, outgoing, and push

+ +

You should try to commit your work regularly as you progress through the localization files. Keep in mind that the hg commit command will save your changes locally (in the local clone). With the hg push command you can send the changesets to the remote server. Here's how that's done:

+ +
    +
  1. Run this command to see recent commits in your local clone: $ hg log -l 3
  2. +
+ +

You should a list of the most recent commits, similar to this one:

+ +
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
+
+ +
    +
  1. Now run the hg outgoing command to compare the local repository on your machine with the remote repository on hg.mozilla.org.
  2. +
+ +

The hg outgoing 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:

+ +
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
+
+ +
    +
  1. Make sure this output is accurate before continuing.
  2. +
  3. Once you've made sure the outgoing output is accurate, push this changeset to hg.mozilla.org by running the hg push command.
  4. +
+ +

Mercurial will connect to the remote repository, authenticate through SSH and send the changesets. The output should look something like this:

+ +
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
+
+ +

Congratulations! Your changeset has been successfully pushed to hg.mozilla.org! You can now visit http://hg.mozilla.org/releases/l10n-central/x-testing in your browser to see the new changeset in the remote repository.

+ +

Resolução de problemas de SSH

+ +

If pushing fails, make sure your ~/.ssh/config has the correct User set under the hg.mozilla.org host. This should be your Mozilla LDAP account name. Next, try issuing the following command: $ ssh hg.mozilla.org

+ +

If SSH is working fine, you should see the following message:

+ +
No interactive shells allowed here!
+Connection to hg.mozilla.org closed.
+
+ +

If you don't see this message, try running the same command in a more verbose mode (with the debugging information): $ ssh -vvv hg.mozilla.org

+ +

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 http://pastebin.mozilla.org and ask in #l10n on the irc.mozilla.org server.

+ +

Revisões técnicas e assinadas

+ +

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.

+ + + + + + + + + + + + + + +
Revisão TécnicaRevisão Assinada
+
    +
  • Performed as a QA measure on a revision pushed to a new locale's L10n aurora repo in Mercurial.
  • +
  • Very comprehensive. Covers the entire product.
  • +
  • Focus is on technical accuracy and completion of L10n work; not translation quality.
  • +
  • Only performed on the first revision a new locale wants to have released to the public.
  • +
  • Must be approved prior to migrating your revision from one release channel to the next (e.g., Aurora to Beta).
  • +
+
+
    +
  • Performed as a QA measure for maintaining a localization from release-to-release.
  • +
  • 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.
  • +
  • Focus is still on technical accuracy and completion of L10n work; not translation quality.
  • +
  • Release revisions are evaluated, not entire L10n repos.
  • +
  • Sign-offs do not need to be approved before revision merge between release channels, although it is recommended.
  • +
+
+ +

There is a specific process to follow in Bugzilla for requesting these reviews:technical review.png

+ +
    +
  1. File a bug requesting the review.
  2. +
  3. Attach your files to the bug. Once attached, open the attachment details.
  4. +
  5. In the attachment details, select the ? from the dropdown menu next to the review flag or the appropriate approval flags (see image). This will display a text box to assign the review to someone.
  6. +
  7. Enter :Pike as the Requestee.
  8. +
+ +

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.

+ +

For more detailed information about reviews for new localizations and sign-offs for maintenance releases, visit the technical review and sign-off review pages.

+ +

Tah dah!

+ +

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.

+ +

{{ Previous("Localization_Quick_Start_Guide/QA_phase") }}

diff --git "a/files/pt-pt/mozilla/localization/guia_inicia\303\247\303\243o_r\303\241pida/fase_pr/index.html" "b/files/pt-pt/mozilla/localization/guia_inicia\303\247\303\243o_r\303\241pida/fase_pr/index.html" new file mode 100644 index 0000000000..48e5d343d5 --- /dev/null +++ "b/files/pt-pt/mozilla/localization/guia_inicia\303\247\303\243o_r\303\241pida/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 +--- +

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.

+ +

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 Next link at the bottom of the page.

+ +

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.

+ +

Criações automatizadas e manual

+ +

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 Seeing your work section. If you're not using one of these tools, let's walk you through building your own language pack manually.

+ +
Nota: Remember all of those pre-requisite tools we asked you to install in the initial setup? Here's where you'll need almost all of them. If you haven't installed them yet, now is the time to do it.
+ +

Instruções preliminares

+ +

We will be using the following file directories for this example:

+ +
your working directory (root)/
+    mozilla-aurora (en-US source, pulled from http://hg.mozilla.org/releases/mozilla-aurora  )/
+    l10n-central (directory for L10n directories, one per L10n; often referred to as "l10n base")/
+       your-locale-code (a directory with your L10n files, in this example we'll use x-testing)
+
+Example: root/mozilla-aurora & root/l10n-central/x-testing
+
+ +

Additionally, you will need to copy and translate the toolkit/defines.inc file directly from en-US before you can build. This is due to a bug in the build logic.

+ +

Please either follow the above structure closely or adjust the commands below according to your custom setup.

+ +

To copy this file to the appropriate directory, do the following:

+ +
    +
  1. Navigate to your working directory from your command-line terminal (i.e., where you created the folder structure described above).
  2. +
  3. Enter the following commands:
  4. +
+ +
mkdir -p l10n-central/x-testing/toolkit/
+
+cp mozilla-aurora/toolkit/locales/en-US/defines.inc l10n-central/x-testing/toolkit/defines.inc
+
+ +

Tah-dah! Copied!

+ +

Finally, you will need a file called .mozconfig to proceed with manual builds. This file contains the necessary build instructions.

+ +

To create and configure this file, follow these instructions:

+ +
+

Until the fix for bug 1063880 lands on mozilla-aurora and mozilla-beta when building language packs against those two trees you should:

+ +
    +
  1. +

    remove ac_add_options --disable-compile-environment from .mozconfig in step 3

    +
  2. +
  3. +

    use ./mach build config after step 4

    +
  4. +
+
+ +
    +
  1. Update the Mozilla source code:
  2. +
+ +

$ cd mozilla-aurora
+ $ hg pull -u

+ +
    +
  1. Enter the following command to create the .mozconfig file: $ nano -w .mozconfig
  2. +
  3. Enter the following lines in your .mozconfig file:
  4. +
+ +
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=[browser or mail]
+
+ +

You will need to specify which application you're localizing in the fourth line (e.g., for Firefox, that's browser, Thunderbird would be mail).

+ +
    +
  1. Enter the following command to perform the configuration: $ ./mach configure
  2. +
  3. Once your command-line finishes spitting out the config command's output, navigate to the newly created directory: $ cd ../firefox-build/browser/locales
  4. +
+ +

Now you're ready to build! At this point you can choose between two build options. You can either:

+ + + +

Visit the links above to learn how to make these testing builds.

+ +

Testar a sua L10n e ver o seu trabalho

+ +

Now that you have your langpack or L10n repack, let's discuss seeing your work and testing it in the application.

+ +

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:

+ +
    +
  1. Install Aurora in your preferred language.
  2. +
  3. Install the .xpi langpack you just created (or exported).
  4. +
  5. Set your language using the Quick Locale Switcher or Locale Switcher add-ons by navigating to Tools->Language->Your localization's language code.
  6. +
  7. Restart your browser and start testing!
  8. +
+ +

Now you should be able to see all of your work up to this point. Click here for guidelines on how to test your localization.

+ +

Não perca o seu trabalho!

+ +

Your work is SO 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.

+ +

The official localization teams use repositories at hg.mozilla.org. 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 Bit Bucket to start the learning process.

+ +
Nota: 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!
+ +

Envio (Pushing) para o seu repositório

+ +

There are a couple of things you should take note of before you push to your repository:

+ + + +

The instructions below will help you learn how to use your Hg repository.

+ +
    +
  1. After your new repository is created by the l10n-drivers, 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: http://hg.mozilla.org/l10n-central/x-testing
  2. +
  3. Now, navigate to your locale's directory on your local machine.
  4. +
+ +

If you're using Koala, this should be located at /path/to/your/koala.project/locale/3.6/x-testing, otherwise, it should be located at /path/to/your/working_dir/l10n_base/x-testing.

+ +

In this directory, you should have an hg repository. You might have created it yourself by running hg init or hg clone 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 hg status command should show nothing). Let's see what the last revision in this repository is.

+ +
    +
  1. Enter the following command: $ hg log -l 1
  2. +
+ +

You should see an output similar to the one below:

+ +
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
+
+ +
    +
  1. Now compare the local repository on your machine with the remote Hg repository by entering this command: $ hg outgoing http://hg.mozilla.org/l10n-central/x-testing
  2. +
+ +

The hg outgoing 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:

+ +
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
+
+ +
    +
  1. Let's now push this changeset. Enter the following command: hg push http://hg.mozilla.org/l10n-central/x-testing
  2. +
  3. Mercurial will connect to your repo and ask you to provide your account information (i.e., the username and the password).
  4. +
+ +
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:
+
+ +

After you enter your account information, the changeset will be pushed.

+ +
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)
+
+ +

Your changeset has been successfully pushed to your repository!

+ +

As you begin to move through your translations, you should commit the changes locally and push your work to this experimental repository. For instance, if you have finished translating all the .dtd and .properties files in your x-testing/browser/chrome/browser/ directory, then you should run these commands:

+ +
$ hg status
+$ hg commit -m "Translated browser/chrome/browser/"
+$ hg outgoing
+$ hg push http://hg.mozilla.org/l10n-central/x-testing
+ +

Note that due to the distributed nature of Hg, hg commit saves the changes locally (i.e., in your computer's Hg repository). You can see the history of commits with hg log. After doing hg commit, you still need to send the changes to the remote repository. This is where hg push comes in. This sends your commits to the remote repository.

+ +

Now you're ready to proceed to the release phase!

+ +

 

+ +

{{ PreviousNext("Localization_Quick_Start_Guide/Translation_phase", "Localization_Quick_Start_Guide/Release_phase") }}

diff --git "a/files/pt-pt/mozilla/localization/guia_inicia\303\247\303\243o_r\303\241pida/index.html" "b/files/pt-pt/mozilla/localization/guia_inicia\303\247\303\243o_r\303\241pida/index.html" new file mode 100644 index 0000000000..7135cec329 --- /dev/null +++ "b/files/pt-pt/mozilla/localization/guia_inicia\303\247\303\243o_r\303\241pida/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 +--- +

Bem-vindo à localização da Mozilla (abreviado em inglês L10n)!

+ +

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.

+ +

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!

+ +

Lembre-se, este guia irá instruí-lo apenas sobre os aspetos técnicos de L10n da Mozilla. Visite a página do Processo de L10n para saber mais sobre todo o processo.

+ +
+

Configuração Inicial

+Preparação da tecnologia antes de localizar.
+ +
+

Fase da tradução

+Tutoriais das ferramentas de L10n para tradução.
+ +
+

Fase de PR

+Tutoriais de teste de L10n.
+ +
+

Fase de Lançamento

+Passos para submeter o seu trabalho de tradução.
+ +
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.
+ +

 

+ +
Nota: 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 letra em cor de laranja. Toda a informação que é única para aqueles que se juntam a uma localização existente estará em letra azul.
+ +

 

+ +

{{ Next("Localization_Quick_Start_Guide/Initial_setup") }}

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 +--- +

Localização (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. Estes são para os responsáveis pelo desenvolvimento e todos os colaboradores.

+ +

Consultar também

+ +
+
Localizar MDN
+
Este recurso abrange a localização da documentação aqui na MDN.
+
Localização de aplicação
+
Este conjunto de documentos aplica-se mais especificamente à localização de aplicações, incluindo as aplicações do Firefox OS.
+
L10n
+
Documentos de referência para a API de L10n que a Mozilla utilzia para localizar o sistema operativo Firefox.
+
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 +--- +

{{Index("/pt-PT/docs/Mozilla/Localization")}}

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 +--- +

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".

+ +

Se está aqui para criar o seu código (por exemplo, extensões) localizável para as formas de plural, pode ir diretamente para Programar com PluralForm. 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'.

+ +

Utilização

+ +

Aqui tem alguns termos utilizados nesta página para o ajudar a manter as coisas simples:

+ + + +

If you're here for pluralRule in the chrome/global/intl.properties file, you'll need to figure out what plural rule to choose for your localization. This plural rule is used to determine how many plural forms are needed for each word that needs to be localized, with plurals in mind.

+ +

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 pluralRule number in chrome/global/intl.properties, and look up the corresponding entry in the following list of plural rules.

+ +

Lista das Regras de Plural

+ +

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 pluralRule. 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.

+ +

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 plurals would require a string of "plural;plurals" where the first word is the singular form and the second is the general plural form.

+ +

Regra de plural #0 (1 forma)

+ +

Famílias: Asiáticas (chinês, japonês, coreano), persa, turco/altaico (turco), Thai, Lao
+ tudo: 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, …

+ +

Regra de plural #1 (2 formas)

+ +

Famílias: 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
+ é 1: 1
+ tudo o resto: 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, …

+ +

Regra de plural #2 (2 formas)

+ +

Famílias: Românico (francês, português (Brasil)), Lingala
+ é 0 ou 1: 0, 1
+ tudo o resto: 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, …

+ +

Regra de plural #3 (3 formas)

+ +

Famílias: Baltic (Latvian, Latgalian)
+ termina em 0: 0
+ termina em 1, excluindo 11: 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, …
+ tudo o resto: 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, …

+ +

Regra de plural #4 (4 formas)

+ +

Famílias: Celtic (Scottish Gaelic)
+ é 1 ou 11: 1, 11
+ é 2 ou 12: 2, 12
+ is 3-10 ou 13-19: 3, 4, 5, 6, 7, 8, 9, 10, 13, 14, 15, 16, 17, 18, 19
+ tudo o resto: 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, …

+ +

Regra de plural #5 (3 formas)

+ +

Famílias: Romanic (Romanian)
+ é 1: 1
+ é 0 ou termina em 01-19, excluindo 1: 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, …
+ tudo o resto: 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, …

+ +

Regra de plural #6 (3 formas)

+ +

Famílias: Baltic (Lithuanian)
+ termina em 1, excluindo 11: 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, …
+ termina em 0 ou termina em 11-19: 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, …
+ tudo o resto: 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, …

+ +

Regra de plural #7 (3 formas)

+ +

Famílias: Belarusian, Russian, Ukrainian
+ termina em 1, excluindo 11: 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, …
+ termina em 2-4, excluindo 12-14: 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, …
+ tudo o resto: 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, ...

+ +

Regra de plural #8 (3 formas)

+ +

Famílias: Eslavo (eslovaco, checo)
+ é 1: 1
+ é 2-4: 2, 3, 4
+ tudo o resto: 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, …

+ +

Regra de plural #9 (3 formas)

+ +

Famílias: Eslavo (polaco)
+ é 1: 1
+ termina em 2-4, excluindo 12-14: 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, …
+ tudo o resto: 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, …

+ +

Plural rule #10 (4 forms)

+ +

Famílias: Eslavo (esloveno, sérbio)
+ termina em 01: 1, 101, 201, …
+ termina em 02: 2, 102, 202, …
+ termina em 03-04: 3, 4, 103, 104, 203, 204, …
+ tudo o resto: 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, …

+ +

Plural rule #11 (5 forms)

+ +

Famílias: Celtic (Irish Gaelic)
+ é 1: 1
+ é 2: 2
+ is 3-6: 3, 4, 5, 6
+ is 7-10: 7, 8, 9, 10
+ tudo o resto: 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, …

+ +

Plural rule #12 (6 forms)

+ +

Famílias: Semitic (Arabic)
+ é 1: 1
+ é 2: 2
+ termina em 03-10: 3, 4, 5, 6, 7, 8, 9, 10, 103, 104, 105, 106, 107, 108, 109, 110, 203, 204, 205, 206, 207, 208, 209, 210,
+ tudo o resto but é 0 and termina em 00-02, excluding 0-2: 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, …
+ termina em 00-02, excluding 0-2: 100, 101, 102, 200, 201, 202, …
+ é 0: 0

+ +

Plural rule #13 (4 forms)

+ +

Famílias: Semitic (Maltese)
+ é 1: 1
+ é 0 ou termina em 01-10, excluindo 1: 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, …
+ termina em 11-19: 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, …
+ tudo o resto: 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, …

+ +

Plural rule #14 (3 forms)

+ +

Famílias: unused
+ ends in 1: 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, …
+ ends in 2: 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, …
+ tudo o resto: 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, …

+ +

Plural rule #15 (2 forms)

+ +

Famílias: Icelandic, Macedonian
+ termina em 1, excluindo 11: 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, …
+ tudo o resto: 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, …

+ +

Plural rule #16 (5 forms)

+ +

Famílias: Celtic (Breton)
+ termina em 1, excluindo 11, 71, 91: 21, 31, 41, 51, 61, 81, 101, 121, 131, 141, 151, 161, 181, 201, 221, 231, 241, 251, 261, 281, ...
+ ends in 2, excluindo 12, 72, 92: 2, 22, 32, 42, 52, 62, 82, 102, 122, 132, 142, 152, 162, 182, 202, 222, 232, 242, 252, 262, 282, ...
+ ends in 3, 4 or 9 excluindo 13, 14, 19, 73, 74, 79, 93, 94, 99: 3, 4, 9, 23, 24, 29, 33, 34, 39, 43, 44, 49, 53, 54, 59, ...
+ termina em 1000000: 1000000: 1000000, 2000000, 3000000, 4000000, 5000000, 6000000, 7000000, 8000000, 9000000, 10000000, ...
+ tudo o resto: 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, ...

+ +

Plural rule #17 (2 forms)

+ +

Famílias: Ecuador indigenous languages (Shuar)
+ é 0: 0
+ tudo o resto: 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, …

+ +

Plural rule #18 (6 forms)

+ +

Famílias: Welsh
+ é 0: 0
+ é 1: 1
+ é 2: 2
+ is 3: 3
+ é 6: 6
+ tudo o resto: 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, …

+ +

Plural rule #19 (3 forms)

+ +

Famílias: Slavic (bósnio, croata, sérvio)
+ termina em 1, excluindo 11: 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, …
+ termina em 2-4, excluindo 12-14: 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, …
+ tudo o resto: 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, ...

+ +

Exemplos

+ +

A seguir tem alguns exemplos para vários idiomas e um breve processo de reflexão.

+ +

Francês

+ +

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.

+ +

pluralRule=2
+ seconds=seconde;secondes
+ minutes=minute;minutes
+ hours=heure;heures
+ days=jour;jours

+ +

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)

+ +

Chinês

+ +

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.

+ +

pluralRule=0
+ seconds=秒
+ minutes=分
+ hours=時
+ days=日

+ +

Polaco

+ +

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.

+ +

pluralRule=9
+ seconds=sekunda;sekundy;sekund
+ minutes=minuta;minuty;minut
+ hours=godzina;godziny;godzin
+ days=dzień;dni;dni

+ +

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.

+ +

Sérbio

+ +

There are 4 plural forms: nominative singular, nominative dual, nominative plural, genitive plural. These match up with plural rule #10.

+ +

pluralRule=10
+ seconds=sekunda;sekundźe;sekundy;sekundow
+ minutes=mjeńšina;mjeńšinje;mjeńšiny;mjeńšin
+ hours=hodźina;hodźinje;hodźiny;hodźin
+ days=dźeń;dnjej;dny;dnjow

+ +

Extensão de Teste

+ +

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".

+ +

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.

+ +

Image:pluralForm-checker.0.3.png

+ +

Instalar a extensão Checker v0.3 de pluralForm

+ +

Entrada de extensão

+ +

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.

+ +

chrome://mozapps/locale/downloads/do...tes,hours,days
+ chrome://mozapps/locale/downloads/do...dsTitlePercent
+ chrome://browser/locale/browser.prop...ausedDownloads

+ +

Histórico de versão

+ +

0.1: Initial version with pluralRule check, properties input loading, table generation, sample output display
+ 0.2: Use PluralForm.numForms() to get the number of forms instead of figuring out locally to better support future rules - Requires build from 2007/01/27 or later
+ 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

+ +

Programar com PluralForm

+ +

The functionality for getting the correct plural forms is provided by a JavaScript Module, PluralForm.jsm. 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.

+ +

Carregar PluralForm.jsm

+ +

Loading the PluralForm module from JavaScript is simple with Components.utils.import. 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.

+ +
Components.utils.import("resource://gre/modules/PluralForm.jsm");
+ +

Métodos: get

+ +

Estes métodos utilizam o idioma atual do navegador especificado pelo valor chrome://global/locale/intl.properties's pluralRule.

+ +
/**
+ * 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)
+ +

Aqui tem um exemplo de utilização deste método:

+ +
// 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) + ".")
+ +

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:

+ +
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);
+ +

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.

+ +

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.

+ +

The following 3 file snippets show how to use PluralForm with your .xul, .properties, .js files.

+ +

downloads.xul:

+ +
<stringbundleset>
+  <stringbundle id="strings" src="chrome://downloads.properties"/>
+</stringbundleset>
+ +

downloads.properties:

+ +
# 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
+
+ +

downloads.js:

+ +
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));
+ +

Método: makeGetter

+ +

If you're writing an extension, you'll want to use makeGetter instead of PluralForm.get() or PluralForm.numForms(). 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:

+ +
/**
+ * 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)
+ +

Aqui tem um exemplo de utilização de makeGetter:

+ +
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));
+ +

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 PluralForm.makeGetter(pluralRuleFromProperties), making sure to save the 2 returned functions. (You can use destructured assignment in JavaScript 1.7 to keep things clean.) The returned functions act just like PluralForm.get() and PluralForm.numForms(), except for the specified plural rule instead of the default plural rule.

+ +

Créditos

+ +

Inicialmente, o código da "Forma de Plural" foi implementado por {{ Bug(394516) }} - Figure out a remaining-time rounding scheme for minutes -> hours/days
+ As regras de plural e as familias derivadas da documentação gettext da GNU.

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 +--- +

In Mozilla, we use the the Mercurial version control system (Hg) to manage our source code and localizations. Mercurial allows localizers to work locally (on their machines) and then push (an Hg term) changes to a remote repository, which usually is hosted on the Mozilla servers (hg.mozilla.org). 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 #l10n or #hg channels on irc.mozilla.org. The Mercurial FAQ are also worth a read, should you run into trouble.

+ +

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.

+ +

Instalar Mercurial

+ +

Follow the instructions below to install Mercurial on your system. Once you've installed Mercurial, we'll walk through the steps to configure it.

+ +

Mercurial no Linux

+ +

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 as root.

+ +
# Debian/ubuntu
+$ apt-get install mercurial
+
+# Fedora
+$ yum install mercurial
+
+# Gentoo
+$ emerge mercurial
+
+# Arch Linux
+$ pacman -S mercurial
+
+# OpenSolaris
+$ pkg install SUNWmercurial
+
+ +

Se preferir uma interface gráfica, pode transferir e instalar o MercurialEclips e aqui.

+ +

Este funcionou?

+ +

Open a Terminal window and enter hg --version. If you see a message about the version of Mercurial (e.g. Mercurial Distributed SCM (version 1.3.1)), you have installed Mercurial successfully!

+ +

Mais detalhes

+ +

For more details on installing Hg on Linux systems, refer to the instructions on Mercurial's Download page.

+ +

Mercurial no Windows

+ +

With Windows, you have a couple of install options:

+ + + +

Mercurial Installer.pngPart of the command line Hg install for Windows involves making sure the hg executable is in the system's %PATH% variable (TortoiseHg doesn't need this step). Use the add_path.exe utility found in C:\mozilla-build\hg to do this.

+ +
PS C:\Users\your_id> cd C:\mozilla-build\hg
+PS C:\mozilla-build\hg> .\add_path.exe /result .
+
+ +

Note the dot (".") at the end of the second command, which means the current directory. If the utility modified your %PATH% successfully, a dialog will open saying, "%PATH% has been updated correctly."

+ +

Alternatively, you can edit the %PATH% variable manually. In order to do so, right-click on your computer icon, choose Properties > Advanced > Environmental Variables, select PATH and click Edit. If you don't see PATH among the options, you'll have to click Add and edit it within the Add dialog. See the screenshot for an example.PATH.jpg

+ +

Este funcionou?

+ +
    +
  1. Go to Start > Run...
  2. +
  3. Type cmd.exe and click OK. A new shell window should appear. 
  4. +
  5. Type hg --version in the new shell window. If you see a message about the version of Mercurial (e.g. Mercurial Distributed SCM (version 1.3.1)), you have installed Mercurial successfully!
  6. +
+ +

Mais detalhes

+ +

For more details on installing Hg on Windows, refer to the instructions on Mercurial's Download page.

+ +

Mercurial no Mac OSX

+ +

Installing Hg on Mac OSX is super easy. You can install Mercurial via MacPorts through the Terminal, like so:

+ +

$ sudo port install mercurial

+ +

You can also install it by downloading the dmg package from the Hg download page. It has an install dialog that will walk you through the process.

+ +

If you prefer a graphical interface, you can download and install MercurialEclipse here.

+ +

Este funcionou?

+ +

Open a Terminal window and type hg --version. If you see a message about the version of Mercurial (e.g. Mercurial Distributed SCM (version 1.3.1)), you have installed Mercurial successfully!

+ +

Mais detalhes

+ +

For more details on installing Hg on Mac OSX, refer to the instructions on Mercurial's Download page.

+ +

Configurar o Mercurial

+ +

Once you've installed Mercurial, you'll need to configure it before you can use it successfully.

+ +

Your Mercurial configuration is contained within a config file which you must create yourself. Your config file is called either ~/.hgrc (UNIX systems) or Mercurial.ini (Windows), depending on your operating system.

+ +

Your config file should have the following settings:

+ +
[ui]
+username = Your Real Name <user@example.com>
+merge = internal:merge
+
+[defaults]
+commit = -v
+
+[diff]
+git = 1
+showfunc = 1
+unified = 8
+ +

To configure Hg, follow these steps:

+ +
    +
  1. Create a new file in your favorite text editor.
  2. +
  3. Copy the settings above and paste them into your new file.
  4. +
  5. Save the file as either .hgrc (UNIX systems) or Mercurial.ini (Windows) and save it in either $HOME/ or C:\mozilla-build\hg\ or C:\Program Files\Mercurial\.
  6. +
+ +

Now that you've installed and configured Mercurial, here are a few tasks you can do without Hg commit access priviledges.

+ +

Clonar e atualizar os repositórios

+ +

There are a couple of repostiories that contain en-US source files that most locales will want to deal with.

+ + + +
+

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.

+
+ +

Here's how to get (or clone) your en-US source files for the first time:

+ + + +
hg clone https://hg.mozilla.org/mozilla-central/
+
+ +

This will create a clone of the mozilla-central repository in the directory mozilla-central.

+ + + +
hg clone https://hg.mozilla.org/comm-central/
+cd comm-central
+python client.py checkout
+
+ +

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.

+ + + +
hg clone https://hg.mozilla.org/l10n-central/ab-CD/
+ +

Atualizar os seus repositórios locais

+ + + +
hg pull -u
+
+ +

This will both get new changesets from mozilla-central and apply those changes in your working copy.

+ + + +
python client.py checkout
+ +

This will both get new changesets from comm-central, mozilla-central and the other appropriate locations and apply those changes in your working copy.

+ + + +
hg pull -u
+ +

Criar correções (patches) de L10n

+ +

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.

+ +

Here's how to create a L10n patch with Hg and the Mq extension:

+ +
    +
  1. Enable Mq by adding hg.ext =  to your Mercurial config file (~/.hgrc on Unix-like systems or Mercurial.ini on Windows) under the [extensions] section.
  2. +
  3. Open your command line tool and navigate to your L10n directory.
  4. +
  5. Inside your L10n directory, init your repo with Mq by running hg init --mq.
  6. +
  7. To create a new patch, run hg qnew -m "Your commit message" patch-name.patch. 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.
  8. +
  9. Make your change.
  10. +
  11. Once you finish making your change, run hg qrefresh to commit your changes to the patch.
  12. +
  13. Navigate to your <repository>/.hg/patches to find your .patch.
  14. +
  15. 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 hg qfinish.
  16. +
+ +

Please refer to MqTutorial and Mq documentation for further uses of Mq extension to manage patches.

+ +

Privilégios da Conta Mercurial

+ +

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.

+ +

To get write access to the l10n hg repositories on the Mozilla server, there's a bit of paper work to be done. The localization team owner needs to file a bug requesting an hg account. This bug will request level 1 L10n priviledges. You need to follow the instructions regarding the contributor form. 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).

+ +

Enviar alterações para a Mozilla

+ +

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:

+ +
    +
  1. 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, update your locale, as per the section above.
  2. +
  3. After finishing a change or set of changes and checking you have updated to the latest, you should commit by entering this command:
  4. +
+ +
hg commit -m "your message identifying the change (bug 555)"
+ +

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 push.

+ +
    +
  1. To push to mozilla-hosted repositories, you have to have committer access, and you must edit the file (your-local-hg-root AKA the directory you pulled your locale into)/.hg/hgrc (note, this is NOT your ~/.hgrc) to add these lines (replacing ab-CD with your locale code):
  2. +
+ +
[paths]
+default = https://hg.mozilla.org/l10n-central/ab-CD/
+default-push = ssh://hg.mozilla.org/l10n-central/ab-CD/
+
+ +
    +
  1. You’ll also need to tell ssh which account to use for your pushes, too, by editing ~/.ssh/config and adding these lines, where user@host.domain is your account:
  2. +
+ +
Host hg.mozilla.org
+User user@host.domain
+
+ +
    +
  1. Now you can push your work to the repository (and check the result on the dashboard) by entering this command from your local directory:
  2. +
+ +
hg push
+ +

And tah dah! You're done! Congratulations on finishing the tutorial. Take a break and grab a snack, you deserve it

diff --git "a/files/pt-pt/mozilla/localization/localiza\303\247\303\243o_com_pontoon/index.html" "b/files/pt-pt/mozilla/localization/localiza\303\247\303\243o_com_pontoon/index.html" new file mode 100644 index 0000000000..05fa58b1d6 --- /dev/null +++ "b/files/pt-pt/mozilla/localization/localiza\303\247\303\243o_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 +--- +

Pontoon é 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.

+ +
+

É um programador? Leia sobre a implementação do Pontoon no seu projeto ou saiba como participar no GitHub.

+
+ +

Primeiros passos

+ +

Pontoon's home page 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 Firefox Affiliates website to demo Pontoon's functionality and workflow. And there it is, opened inside Pontoon:

+ +

Browser app and workspace

+ +

Barra de ferramentas principal

+ +

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):

+ +

Main toolbar

+ +

Lista de textos

+ +

Opens a sidebar with a list of all strings to localize.

+ +

Seletor de projeto (Afiliados)

+ +

Switches between projects to localize.

+ +

Seletor de recursos (Página Inicial)

+ +

Switches between project resources to localize, like subpages or localization files. Hidden if no resources available for project.

+ +

+ +
+
+ +

Seletor de idioma (Esloveno)

+ +

Switches between languages to localize.

+ +

Ir

+ +

Opens project-resource-locale selection.

+ +

Indicado do progresso

+ +

Displays your progress on the resource being localized. More details are available in the popup.

+ +
+
+ + + +

Allows for user-specific tasks, like commiting to repository, downloading files and signing out.

+ + + +

Gives important information, like the anticipated project timeline and a list of keyboard shortcuts.

+ +
+
+ +

Alright, how about we do some translating now?

+ +
+
+ +

Traduzir texto

+ +

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.

+ +

In-context

+ +

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:

+ +

In-context localization

+ +
    +
  1. Hover over the text you want to translate with your mouse.
  2. +
  3. An edit button appears over that text. Click on it to enable the translate mode.
  4. +
  5. Replace the original text with its translation into your language.
  6. +
  7. Click the save button to save your translation.
  8. +
+ +
+

Out-of-context

+ +

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:

+ +

Out-of-context localization: list Out-of-context localization: translate

+ +
    +
  1. Click on the string you'd like to translate.
  2. +
  3. Translation panel with original string and its details (e.g. comments) opens.
  4. +
  5. Translate the string in the translation area below.
  6. +
  7. Click the save button to save your translation.
  8. +
+ +

As you translate strings out-of-context, translations will also appear in website, if they could also be translated in-context.

+ +

Ajudas de tradução

+
+ +

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:

+ +

Translation helpers: History Translation helpers: Machinery Translation helpers: Other locales Translation helpers: Search

+ +

Histórico

+ +

Displays previously suggested translations, including from other users.

+ +

Máquina

+ +

Displays matches from various services: internal translation memory, Mozilla Transvision, open source translation memory, Microsoft terminology and machine translation.

+ +

Outros idiomas

+ +

Displays matching translations from other locales.

+ +

Pesquisar

+ +

Almost like machinery, but takes provided keyword as input parameter instead of the original string.

+ +

By clicking a suggestion, it gets copied into translation area.

+ +
+
+ +

Publicar a sua localização

+ +

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!

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 +--- +

I am about to tell you some stuff about Mercurial 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. —jorendorff 16:06, 12 May 2008 (PDT)

+ +

Expetativas

+ +

Mercurial não é CVS. Os comandos não são os mesmos. Os conceitos não são os mesmos. Como é Mercurial diferente de CVS?

+ +

This gun is loaded. 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 hg commit or hg qrefresh 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.

+ +

Forewarned is forearmed. Don't do these things. Don't run commands without knowing what they're going to do—hg help 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.

+ +

Mercurial is not magic dust. 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.)

+ +

Evite problemas

+ +

Utilize o último lançamento estável do Mercurial.

+ +

Learn how to get your bearings. Use read-only commands (like hg status, hg head, hg parents, hg log, hg diff, hg outgoing) to check the status of your repository. This is a key skill.

+ +

Configure a merge program and make sure you know how to use it. DO IT NOW. Otherwise you will likely screw up your repository at some point.

+ +

Mercurial doesn't leaves conflict markers in your files; instead, it wants you to fix the conflicts immediately, using a merge program (like kdiff3) which it can launch for you.

+ +

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.

+ +

If a merge fails, make sure Mercurial knows that it has failed. When you're first learning the ropes, merges often go wrong. You might see this message:

+ +
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
+
+ +

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 hg update -C command to tell Mercurial that you've given up on that merge.

+ +

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.

+ +

If hg parents shows two parents, you're merging.

+ +

If you use Mercurial Queues, back up your work. hg qrefresh destructively replaces the old patch with the new one! Use hg qinit -c to create a separate backup repository for your patches and hg commit --mq -m backup regularly.

+ +

Don't use Mercurial Queues in a repository that someone might pull from since applied (non-public) patches would also be pulled.

+ +

Recuperação

+ +

Ups! Mercurial cortou o seu braço!

+ +

Don't randomly try stuff to see if it'll magically fix it. Remember what you stand to lose, and set down the chainsaw while you still have one good arm.

+ +

Obtenha ajuda no IRC. Tente #hg ou #developers no Mozilla IRC ou #mercurial no freenode.

+ +

 

+ +

{{ languages( { "es": "es/Lo_b\u00e1sico_de_Mercurial", "fr": "fr/Les_bases_de_Mercurial", "ja": "ja/Mercurial_basics" } ) }}

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 +--- +
+

Por favor, consulte Mercurial para Mozillians em ReadTheDocs para as melhores práticas atuais à volta do Mercurial, including many helpful extra tools and guidelines that make using Mercurial fast and easy.

+
+ +

Mercurial (também conhecido como "hg"), é um controlo de versões distribuido de software, utilizado para o desenvolvimento do Firefox, Thunderbird, e o núcleo de Gecko partilhado. Este substituiu CVS depois da ramificação 1.9 da Mozilla.

+ +

hg is the Mercurial command-line tool, Hg being the chemical symbol for the element mercury.

+ +

Instalação, configuração e obtenção da fonte

+ +

See Installing Mercurial for installation and configuration tips.

+ +

See Getting Mozilla Source Code Using Mercurial for getting a tree to build.

+ +

Aprender a utilizar o Mercurial

+ +

If you are new to Mercurial, you should start with the official guide.

+ +

Then, move on to Mercurial basics and Mercurial FAQ and the version control tool docs for Mozilla-centric Mercurial information.

+ +

Leitura adicional

+ +

The Mercurial tag lists the Mercurial-related articles on MDN.

+ +

And on wiki.mozilla.org, these helpful pages:

+ + + +

{{ languages( { "es": "es/Mercurial", "fr": "fr/Mercurial", "ja": "ja/Mercurial" } ) }}

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 +--- +

{{Note('Se ainda não leu os básicos sobre Mercurial, faça-o agora ou consulte Mercurial para outros recursos.')}}

+ +
+

Please refer to Mercurial para Mozillians em ReadTheDocs for current best-practices around Mercurial, including many helpful extra tools and guidelines that make using Mercurial fast and easy.

+
+ +

Instalação

+ +

See Installing Mercurial from the Mozilla Version Control Guide.

+ +

Configuração básica

+ +

You should configure Mercurial before submitting patches to Mozilla.

+ +

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 mercurial-setup mach command:

+ +
./mach mercurial-setup
+ +

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.

+ +

If you don't have the Firefox source code available, you should edit your Mercurial configuration file to look like the following:

+ +
[ui]
+username = Your Real Name <user@example.com>
+merge = your-merge-program (or internal:merge)
+
+[diff]
+git = 1
+showfunc = 1
+unified = 8
+
+[defaults]
+commit = -v
+
+ +

On Windows, these settings can be added to $HOME\.hgrc or $HOME\Mercurial.ini, or, if you'd like global settings, C:\mozilla-build\hg\Mercurial.ini or C:\Program Files\Mercurial\Mercurial.ini. On UNIX-like systems, they should be in your $HOME/.hgrc file.

+ +

You can configure the editor to use for commit messages using the editor option in the [ui] section or by setting the EDITOR environment variable.

+ +

If you are trying to access the repository through a proxy server, see these instructions.

+ +

Outras dicas de configuração

+ +

Unir programa

+ +

After installing, choose a merge program. Seriously. Do it now. If you don't, Mercurial will choose one for you and spring it on you when you least expect it.

+ +

A reasonable thing to do is to set ui.merge=internal:merge 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.

+ +

Under Ubuntu, you can install meld package, then in in the Mercurial configuration file (see below) set ui.merge=meld

+ +

You can see the list of merge conflicts by looking for "merging ... failed!" in the update output.

+ +

Configuring kdiff3 as a merge tool

+ +

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 contrib/mergetools.hgrc in the Mercurial distribution):

+ +
[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
+
+
+ +

Extensões

+ +

There's a number of extensions you can enable. See http://mercurial.selenic.com/wiki/UsingExtensions. Almost everyone should probably enable the following:

+ + + +

These can all be turned on by just adding this to your .hgrc file:

+ +
[extensions]
+color =
+rebase =
+histedit =
+progress =
+transplant =
+pager =
+
+ +

In addition, there are some 3rd party extensions that are incredibly useful for basic development:

+ +
+
mozext
+
Mozilla-specific functionality to aid in developing Firefox/Gecko.
+
trychooser
+
Automatically creates a try commit message and then pushes changes to Mozilla's Try infrastructure. Just run: +
hg trychooser
+
+
qimportbz
+
Import patches from Bugzilla. Creates a filename and commit message for you based on the bug's metadata. +
hg qimport bz://1234567
+  
+
+
bzexport
+
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: +
hg bzexport -i 1234567
+
+
+ +

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:

+ +
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
+
+ +

And then add then to your .hgrc file

+ +
[extensions]
+qcrecord =  /path/to/crecord/crecord
+mqext =  path/to/mqext
+qimportbz =  path/to/qimportbz
+trychooser = path/to/trychooser/trychooser
+
+ +

Configuração do repositório de testes

+ +

If you have access to the try server 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):

+ +

 

+ +
[paths]
+try = ssh://hg.mozilla.org/try/
+
+ +

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.)

+ +

Alternativamente, pode instalar a extensão trychooser (versão antiga).

+ +

{{ languages( { "fr": "fr/Installation_de_Mercurial" } ) }}

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 +--- +

{{FirefoxSidebar}}

+ +

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".

+ +

Regras de Sintaxe

+ +

But first, let's describe the syntax rules that apply for all options.

+ + + +

Utilizar as opções da linha de comandos

+ +

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:

+ +
application -option -option "argument" -option argument
+
+ +

Exemplos

+ +

The following examples show the use of the "-ProfileManager" command, which will open the Profile Manager prior to starting Firefox or Thunderbird:

+ +

Windows

+ +

Select Run from Windows Start menu. Type:

+ +
firefox -ProfileManager
+
+ +

Mac OS X

+ +

Go to Applications > Utilities. Open Terminal and type:

+ +
cd /Applications/Firefox.app/Contents/MacOS
+./firefox -ProfileManager
+
+ +

If you use Firefox Nightly, you can type:

+ +
cd /Applications/FirefoxNightly.app/Contents/MacOS
+./firefox -ProfileManager
+
+ +

Linux

+ +

Open Terminal and type:

+ +
cd Thunderbird installation directory
+./thunderbird -ProfileManager
+
+ +

The example above invokes the "-ProfileManager" command line option with Mozilla's Thunderbird mail client.

+ +

Perfil do Utilizador

+ +

-CreateProfile profile_name

+ +

Create a new profile in the default directory, but do not start application. The profile will be named profile_name in the profile manager. profile_name must not contain spaces ( ). To use this successfully no instance of the application must be running, or the -no-remote options must be used.

+ +
firefox -CreateProfile JoelUser
+
+ +

-CreateProfile "profile_name profile_dir"

+ +

Creates a new profile in the profile_dir directory, but do not start application. The profile will be named profile_name in the profile manager. Note profile_name and profile_dir are quoted together, and are separated by exactly 1 space (as with the previous syntax, profile_name must not contain spaces).

+ +

To use this successfully no instance of the application must be running, or the -no-remote options must be used.

+ +

NOTE: profile_dir must not exist and you must not already have a profile called profile_name.

+ +
firefox -CreateProfile "JoelUser c:\internet\joelusers-moz-profile"
+
+ +

-migration

+ +

Start with Import Wizard.

+ +

-new-instance

+ +

Open new instance, not a new window in running instance, which allows multiple copies of application to be open at a time.

+ +
firefox -new-instance -P "Another Profile"
+
+ +
+

Nota: Not available for Windows, see {{bug(855899)}}.

+
+ +

-no-remote

+ +

+ +

Do not accept or send remote commands; implies -new-instance.

+ +
firefox -no-remote -P "Another Profile"
+
+ +
+

Nota: 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.

+
+ +

-override /path/to/override.ini

+ +

Load the specified override.ini file to override application.ini ({{Source("browser/app/application.ini")}}). This can be used to suppress the Migration Wizard at startup by loading the following override.ini. Firefox only.

+ +
[XRE]
+EnableProfileMigrator=0
+ +

-ProfileManager

+ +

Start with Profile Manager. Short form: -P without a profile name.

+ +

-P "profile_name"

+ +

Bypass Profile Manager and launch application with the profile named profile_name. Useful for dealing with multiple profiles. Note profile_name 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.

+ +
firefox -P "Joel User"
+
+ +

-profile "profile_path"

+ +

Start with the profile with the given path. Firefox, Thunderbird and SeaMonkey2.x only.

+ +

"profile_path" can either be an absolute path ("/path/to/profile") or a relative path ("path/to/profile").

+ +
+

Nota: 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)}}.

+
+ + +

Navegador

+ +

-browser

+ +

Start with the browser component. Firefox and SeaMonkey only.

+ +

-foreground

+ +

Make this instance the active application.

+ +

-headless

+ +

Runs Firefox in headless mode, 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.

+ +

-new-tab URL

+ +

Open URL in a new tab. Firefox and SeaMonkey2.x only.

+ +

-new-window URL

+ +

Open URL in a new window. Firefox and SeaMonkey2.x only.

+ +

-preferences

+ +

Open Options/Preferences window. Firefox and SeaMonkey2.x only.

+ +

-private

+ +

Opens Firefox in permanent private browsing mode. Firefox 3.6 and later only.

+ +

May not be applicable in older Ubuntu for Firefox 20 and later, confirmed to work in 14.04

+ +

-private-window

+ +

Opens a new private browsing window in an existing instance of Firefox. Firefox 20 and later only.

+ +

-private-window URL

+ +

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. Firefox 29 and later only. Does not work in Firefox 31 on linux mint 17 nor on Firefox 48 on Windows 7. URL opens in a non-private window.

+ +

-search term

+ +

Search term with your default search engine. Firefox and SeaMonkey 2.1 and later only.

+ +

-setDefaultBrowser

+ +

Set the application as the default browser. Firefox only.

+ +

-url URL

+ +

Open URL in a new tab or window, depend on the browser option. -url can be omitted. You may list multiple URLs, separated by spaces. Firefox and SeaMonkey only.

+ +
+

Note: When opening multiple URLs, Firefox always opens them as tabs in a new window.

+
+ +
firefox www.mozilla.com
+firefox www.mozilla.com developer.mozilla.org
+ +

Correio/Notícias

+ +

-addressbook

+ +

Start with address book. Thunderbird and SeaMonkey only.

+ +

-compose message_options

+ +

Start with mail composer. See syntax rules. Thunderbird and SeaMonkey only.

+ +
thunderbird -compose "to=foo@nowhere.net"
+ +

-mail

+ +

Start with the mail client. Thunderbird and SeaMonkey only.

+ +

-news news_URL

+ +

Start with the news client. If news_URL (optional) is given, open the specified newsgroup. Thunderbird and SeaMonkey only.

+ +
thunderbird -news news://server/group
+
+ +

-options

+ +

Open Options/Preferences window. Thunderbird only.

+ +

-offline

+ +

Start with the offline mode. Thunderbird and SeaMonkey only.

+ +

-setDefaultMail

+ +

Set the application as the default email client. Thunderbird only.

+ +

Calendário

+ +

-calendar

+ +

Start with the calendar client. Sunbird only.

+ +

-showdate date

+ +

Show your schedule of the given date. Sunbird only.

+ +
sunbird -showdate 08/04/2008
+
+ +

-subscribe URL or -url URL

+ +

Subscribe to the given URL. Sunbird only.

+ +

Outros Componentes

+ +

-chat

+ +

Start with the IRC client, ChatZilla, if installed.

+ +

-devtools

+ +

Start with native Developer Tools opened.

+ +

-editor URL or -edit URL

+ +

Start with editor (Composer) for the given URL (where URL is optional). SeaMonkey only.

+ +
seamonkey -edit www.mozilla.org
+
+ +

-inspector URL

+ +

Start with the DOM Inspector, if installed, and inspect the given URL (where URL is optional).

+ +

-jsdebugger

+ +

Start application with Browser Toolbox (formerly Browser Debugger). That is different to Venkman debugger (see option -venkman).

+ +

-jsconsole

+ +

Start application with the Error Console, or, in Firefox, the Browser Console.

+ +

-purgecaches

+ +

Gecko (layout engine) has a javascript cache, which is not reset on startup. This clears it.

+ +

-start-debugger-server port

+ +

Firefox only. Start the debugger server on port. This will enable another instance of Firefox to connect the Firefox Developer Tools to this Firefox instance. See the article on remotely debugging Firefox Desktop.

+ +

The port argument is optional, and if it is omitted, the server will listen on port 6000.

+ +

-venkman

+ +

Start with the JavaScript debugger, Venkman, if installed.

+ +

XULRunner

+ +

-app /path/to/application.ini

+ +

Start a new process running the XULRunner application at path/to. Also works with Firefox version 3 and above.

+ +

--install-app path/to/myapplication.(xpi|xulapp)

+ +

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.

+ +
"C:\Program Files\Mozilla XULRunner\1.8.0.4\xulrunner\xulrunner.exe" --install-app "C:\Users\Billdo\Desktop\myapplication.xpi"
+ +
/opt/xulrunner/1.8.0.4/xulrunner/xulrunner --install-app ~/Desktop/myapplication.xulapp
+ +
/Library/Frameworks/XUL.framework/xulrunner-bin --install-app ~/Desktop/myapplication.xpi
+ +

--register-global

+ +

Registers XULRunner on the system for all users. Must be run as admin / root.

+ +

--register-user

+ +

Registers XULRunner for a single user.

+ +

--unregister-global

+ +

Unregisters XULRunner for all users.

+ +

--unregister-user

+ +

Unregisters XULRunner for a single user.

+ +

Chrome

+ +

-chrome chrome_URL

+ +

Load the specified chrome.

+ +
firefox -chrome chrome://inspector/content
+
+ +

-register chrome_URL

+ +

Register the specified chrome, but do not start application.

+ +

Extras

+ +

{{Gecko_MinVersion_Note(1.9.2, "-install-global-extension and -install-global-theme have been removed from Gecko 1.9.2 and upwards.")}}

+ +

-install-global-extension /path/to/extension

+ +

Installs the extension into the application directory. The parameter is the path to the extension. You must have administrative privileges.

+ +

-install-global-theme /path/to/theme

+ +

Same as above, but for themes. You must have administrative privileges.

+ +
+

Note: Since Firefox 2.0.0.7, use of the -install-global-extension and -install-global-theme 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.

+
+ +

-safe-mode

+ +

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).

+ +

Controlo remoto

+ +

-remote remote_command {{Obsolete_Inline}}

+ +
+

This feature was removed in Firefox 36.0, restored in 36.0.1 and removed again in 39.0. See {{bug(1080319)}}.

+
+ +

Execute the specified remote_command in an already running application process.

+ +
firefox -remote "openURL(www.mozilla.org, new-tab)"
+
+ +
+

This option is only available on X-Windows Unix platforms.

+
+ +

Diversos

+ +

-attach-console

+ +

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.

+ +

-console

+ +

Start application with a debugging console. Note: Windows only.

+ +

-h or -help or -?

+ +

Print the list of all available command line options. Note that on Windows this only works with a redirection such as |more ({{Bug(355889)}}). This option is available only in a command console.

+ +

-osint

+ +

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)}}).

+ +

-requestPending

+ +

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)}}).

+ +

-silent

+ +

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. Firefox, Thunderbird3.x and SeaMonkey2.x only.

+ +

-tray

+ +

Start application minimized to system tray. Useful with autorun.

+ +

-v or -version

+ +

Print application version. Note that on Windows this only works with a redirection such as |more ({{Bug(355889)}}). This option is available only in a command console.

+ +

X11 options

+ +

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.

+ +

--class=WM_CLASS

+ +

Set the WM_CLASS resource class of the X11 windows created by the application.

+ +

--display=DISPLAY

+ +

Set the X display to use.

+ +

--g-fatal-warnings

+ +

Make all warnings fatal.

+ +

--sync

+ +

Make X calls synchronous.

+ +

Outras opções que precisam de ser documentadas

+ + + +

Referências

+ + + +
+

Informação do Documento Original

+ + +
+ +

 

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' +--- +

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.

+ +

Como gerar relatórios de memória

+ +

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.

+ + + +

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.

+ +

Carregar relatórios de memória de um ficheiro

+ +

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.

+ +

Single memory report files can also be loaded automatically when about:memory is loaded by appending a file query string, for example:

+ +
about:memory?file=/home/username/reports.json.gz
+
+ +

This is most useful when loading memory reports files obtained from a Firefox OS device.

+ +

Memory reports are saved to file as gzipped JSON. These files can be loaded as is, but they can also be loaded after unzipping.

+ +

Interpretar os relatórios de memória

+ +

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.

+ +

Básico de cálculo

+ +

Most measurements use bytes as their unit, but some are counts or percentages.

+ +

Most measurements are presented within trees. For example:

+ +
 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
+
+ +

Leaf nodes represent actual measurements; the value of each internal node is the sum of all its children.

+ +

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.

+ +

Tree paths can be written using '/' as a separator. For example, preference/referent/weak/dead represents the path to the final leaf node in the example tree above.

+ +

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.

+ +

Secções

+ +

Memory reports are displayed on a per-process basis, with one process per section. Within each process's measurements, there are the following subsections.

+ +

Alocação Explícitas

+ +

This section contains a single tree, called "explicit", that measures all the memory allocated via explicit calls to heap allocation functions (such as malloc and new) and to non-heap allocations functions (such as mmap and VirtualAlloc).

+ +

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.

+ +
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
+ +

Some expertise is required to understand the full details here, but there are various things worth pointing out.

+ + + +

Some add-on memory usage is identified, as the following example shows.

+ +
├───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)
+ +

More things worth pointing out are as follows.

+ + + +

Outros Cálculos

+ +

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.

+ +
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
+ +

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.

+ +

Finally, at the end of this section are individual measurements, as the following example shows.

+ +
    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
+ +

Some measurements of note are as follows.

+ + 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 +--- +

Este artigo irá guiá-lo na comunicação de um problema de desempenho utilizando a extensão do Gecko Profiler. Se preferir, também existe um tutorial em vídeo, em vez da leitura.

+ +

Configurar a extensão Gecko Profiler

+ +
    +
  1. Transferir e instalar a última versão da extensão Gecko Profiler
  2. +
  3. A exntensção de perfilar irá aparecer no topo à direita da barra do URL como um ícone globo (se não, arraste-a para lá da janela de Personalizar).
    +
    + The Gecko Profiler Add-on installed and visible within the Nightly toolbar.
  4. +
  5. Lembre-se de desativar ou desinstalar a extensão se a não estiver a utilizar.
  6. +
+ +

Apenas macOS, 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):

+ +
    +
  1. Transferir e instalar a compilação nightly para a sua platforma. Terá de fechar todas as instâncias do Firefox antes de executar nightly.
  2. +
  3. Nightly é uma versão de desenvolvimento, que pode conter erros, por isso, teste com um novo perfil ou efetue uma cópia de segurança dos seus dados.
  4. +
  5. 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 .
  6. +
+ +

Using the Add-on

+ +

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.

+ +

Profiler UI

+ +

Using the keyboard shortcuts is often more convenient than using the mouse to interact with the UI:

+ + + +

Capturing and sharing a profile

+ +
    +
  1. Reproduce the performance problem. If possible let the problem manifest itself for 5-10 seconds.
  2. +
  3. Press Ctrl+Shift+2 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.
    + Jank markers appearing in the Perf.html profile analysis tool.
  4. +
  5. 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.
  6. +
  7. 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).
    + The button for sharing a profile.
  8. +
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 +--- +

The articles linked to from here will help you improve performance, whether you're developing core Mozilla code or an add-on.

+ + + + + + + + +
+

Documentação

+ +
+
Reporting a Performance Problem
+
A user friendly guide to reporting a performance problem. A development environment is not required.
+
Benchmarking
+
Tips on generating valid performance metrics.
+
Performance best practices in extensions
+
A performance "best practices" guide for extension developers.
+
Measuring Add-on Startup Performance
+
A guide for add-on developers on how to set up a performance testing environment.
+
XUL School: Add-on Performance
+
Tips for add-on developers to help them avoid impairing application performance.
+
GPU performance
+
Tips for profiling and improving performance when using a GPU.
+
Scroll-Linked Effects
+
Information on scroll-linked effects, their effect on performance, related tools, and possible mitigation techniques.
+
Automated Performance Testing and Sheriffing
+
Information on automated performance testing and sheriffing at Mozilla.
+
Best practices for Front-end Engineers
+
Tips for reducing impacts on browser performance in front-end code.
+
+ +

View all pages tagged with "Performance"...

+ +

Memory profiling and leak detection tools

+ +
+
The Developer Tools "Memory" panel
+
The memory panel in the devtools supports taking heap snapshots, diffing them, computing dominator trees to surface "heavy retainers", and recording allocation stacks.
+
+ +
+
about:memory
+
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 memory reporting infrastructure.
+
DMD
+
DMD is a tool that identifies shortcomings in about:memory's measurements, and can also do multiple kinds of general heap profiling.
+
Are We Slim Yet
+
areweslimyet.com (a.k.a. AWSY) is a memory usage and regression tracker.
+
BloatView
+
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.
+
Refcount tracing and balancing
+
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.
+
GC and CC logs
+
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.
+
Valgrind
+
Valgrind is a tool that detects various memory-related problems at runtime, including leaks. Valgrind is used as part of Mozilla's continuous integration testing, though the coverage is limited because Valgrind is slow.
+
LeakSanitizer
+
LeakSanitizer (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.
+
Apple tools
+
Apple provides some tools 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 bug 390944).
+
Leak Gauge
+
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.
+
LogAlloc
+
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.
+
Memory Profiler
+
The memory profiler samples allocation events and provides different views to analyze the allocation characteristic.
+
+ +

See also the documentation on Leak-hunting strategies and tips.

+
+

Profiling and performance tools

+ +
+
Profiling with the Developer Tools Profiler
+
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.
+
+ +
+
Profiling with the Gecko Profiler {{ gecko_minversion_inline("16.0") }}
+
The Gecko Profiler is a good tool to start with, particularly for understanding where time is spent within C++ code in Firefox.
+
Profiling with Instruments
+
How to use Apple's Instruments tool to profile Mozilla code.
+
Profiling with Xperf
+
How to use Microsoft's Xperf tool to profile Mozilla code.
+
Profiling with Concurrency Visualizer
+
How to use Visual Studio's Concurrency Visualizer tool to profile Mozilla code.
+
Profiling with Zoom
+
Zoom is a profiler for Linux done by the people who made Shark
+
Measuring performance using the PerfMeasurement.jsm code module {{ gecko_minversion_inline("2.0") }}
+
Using PerfMeasurement.jsm to measure performance data in your JavaScript code.
+
Adding a new Telemetry probe
+
Information on how to add a new measurement to the Telemetry performance-reporting system
+
Profiling JavaScript with Shark (obsolete - replaced by Instruments)
+
How to use the Mac OS X Shark profiler to profile JavaScript code in Firefox 3.5 or later.
+
Profiling with Shark (obsolete - replaced by Instruments)
+
How to use Apple's Shark tool to profile Mozilla code.
+
Investigating CSS Performance
+
How to figure out why restyle is taking so long
+
+ +

Power profiling

+ +
+
Power profiling overview
+
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.
+
tools/power/rapl (Mac, Linux)
+
tools/power/rapl 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.
+
powermetrics (Mac-only)
+
powermetrics 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.
+
TimerFirings logging (All platforms)
+
TimerFirings logging is a built-in logging mechanism that prints data on every time fired.
+
Activity Monitor, Battery Status Menu and top (Mac-only)
+
The battery status menu, Activity Monitor and top are three related Mac tools that have major flaws but often consulted by users, and so are worth understanding.
+
Intel Power Gadget (Windows, Mac, Linux)
+
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.
+
perf (Linux-only)
+
perf is a powerful command-line utility that can measure many different things, including energy estimates and high-context measurements of things such as wakeups.
+
turbostat (Linux-only)
+
turbostat 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.
+
powertop (Linux-only)
+
powertop is an interactive command-line utility that gathers and displays various power-related measurements.
+
+ +

Rópicos Relacionados

+ +
+
JavaScript, XPCOM, Developing Mozilla, Extensions, Addons
+
+
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 +--- +

{{ gecko_minversion_header("16.0") }}

+ +
+

O Gecko Profiler é um profiler que está integrado no Firefox. Possui uma integração mais apertada com o Firefox do que os profilers externos, e também pode ser utilizado em situações em que os profilers externos não estão disponíveis, tal como numa máquina de não desenvolvimento ou num dispositivo Android bloqueado

+
+ +
+

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.

+
+ +

Obter o Extra Gecko Profiler

+ +

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.

+ +

The Gecko Profiler has two interfaces:

+ +
    +
  1. for Web developers there is a simplified profiler that can be opened from the menu Tools > Web Developer > Performance.
  2. +
  3. a more advanced interface for developers of Mozilla's internals can be accessed by installing the Gecko Profiler add-on (more details on installation are available).
  4. +
+ +
+

Reporting a Performance Problem has a step-by-step guide for obtaining a profile when requested by Firefox developers.

+ +

Reporting a Thunderbird Performance Problem has a step-by-step guide for obtaining a profile when requested by Thunderbird developers.

+
+ +

Compreender os Perfis

+ +

You can check out some frequently asked questions about the Gecko Profilers.

+ +

Here's a video of Ehsan examining some profiles:

+ +

+ +

+ +
+

If there are features you would find helpful, please file a bug with details.

+
+ +

Interface

+ +

1. Timeline

+ +

+ +

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.

+ +
+

Tip: 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.

+
+ +
+

Tip: 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.

+
+ +
Tracing markers
+ + + +
Ranges
+ +

Timeline showing ranged breadcrumbs and zoom icon

+ +

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").

+ +
+

Tip: While zooming out to a previously-selected range deletes the narrower range, the browser back button can be used to restore the narrower range.

+
+ +
Thread Timeline(s)
+ +

Thread/Process Timelines: 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.

+ +

X (Time) axis: 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.

+ +
+

Nota: 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.

+
+ +

Y (Stack) axis: 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.

+ + + +

2. Call Tree

+ +

+ +

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.

+ +
+

Dica: You can right-click on a function name to get an option to copy its name to the clipboard.

+
+ +

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 NtWaitForMultipleObjects seen in the example above taken on Windows or mach_msg_trap on macOS.

+ +
+

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.

+
+ +

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.

+ +
+

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.

+
+ +

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.

+ +

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.

+ +

"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.

+ +
+

Tip: If things are blank elsewhere in the UI, you may have text entered into the "Filter stacks" box.

+
+ +
Custom Annotations
+ +

In bug 1334218 an annotation was added to PresShell::Paint to show the URL of the document being painted. These annotations are not too complex to add so if you would like something added, file a bug.

+ +

3. Partilhar o perfil

+ +

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.

+ +

Dicas

+ +

Understanding profiles can be difficult. If you're unfamiliar with Gecko's internals, you can click the JavaScript only 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:In the results above we can see that we're spending ~287 milliseconds in Startup::XRE_InitChildProcess, 194 ms of which are spent in PVsync::Msg_Notify and all 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.

+ +

Erros (Bugs) de Desempenho Comuns no Firefox

+ +

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.

+ +

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.

+ +

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".

+ +

Some more tips and answers to common questions are available in a mid-2017 FAQ document.

+ +

It's a good idea to search bugzilla 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 file a bug.

+ +

Perfilar compilações (builds) locais do Windows

+ +

If you built Firefox for Windows locally and you would like to use the local symbols with the profiler, you will need to run an additional tool; see Profiling with the Gecko Profiler and Local Symbols on Windows.

+ +

Perfilar compilações (builds) Try

+ +

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:

+ +
    +
  1. Put your firefox build into a directory with the name dist.
  2. +
  3. Download the crashreporter symbols zip for your build. It should be one of the "artifacts" of the build job of your try build.
  4. +
  5. Unzip the crashreporter symbols into dist/crashreporter-symbols/.
  6. +
  7. Now profile as usual.
  8. +
+ +

(This abuses the symbolication logic for local builds. It's at ext-geckoProfiler.js and may stop working at any time.)

+ +

Perfilar móvel Firefox

+ +
    +
  1. For local builds of Fennec, you should build with optimization and STRIP_FLAGS="--strip-debug" but NOT with --enable-profiling. Nightly builds are already built with the appropriate flags.
  2. +
  3. You'll need to have adb and arm-eabi-addr2line (which is part of the Android NDK) in your bash PATH, so use locate arm-eabi-addr2line (on Linux) or mdfind name:arm-eabi-addr2line (on OS X) and stick an export to its location in ~/.bash_profile. The extension will invoke bash to use adb and addr2line.
  4. +
  5. Install the latest pre-release build in your host machine's Firefox browser that has your phone reachable via ADB. This will add a icon in the top right of the browser.
  6. +
  7. Set devtools.debugger.remote-enabled to true in about:config for Fennec.
  8. +
  9. Select target Mobile USB and press Connect. The first run will take an additional 1 minute or so to pull in the required system libraries.
  10. +
+ +

Profiling Firefox Startup

+ +
    +
  1. Start your Firefox with the environment variable MOZ_PROFILER_STARTUP=1 set. This way the profiler is started as early as possible during startup.
  2. +
  3. Then capture the profile using the add-on as usual.
  4. +
+ +

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 MOZ_PROFILER_STARTUP_ENTRIES and MOZ_PROFILER_STARTUP_INTERVAL:

+ + + +

Profiling JS benchmark (xpcshell)

+ +
    +
  1. To profile the script run.js with IonMonkey (-I), type inference (-n) and JäegerMonkey (-m). Thgis requires the following command: + +
    $ 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
    + The xpcshell output all benchmark information and on its last line it output the result of the profiling, you can filter it with tail -n 1 and redirect it to a file to prevent printing it in your shell.  The expected size of the output is around 100 of MB.
  2. +
  3. To add symbols to your build, you need to call ./scripts/profile-symbolicate.py available in B2G repository. +
    $ GECKO_OBJDIR=<objdir> PRODUCT_OUT=<objdir> TARGET_TOOLS_PREFIX= \
    +    ./scripts/profile-symbolicate.py -o run.symb.cleo run.cleo
    +
  4. +
  5. Clone Cleopatra and start the server with ./run_webserver.sh.
  6. +
  7. Access Cleopatra from your web browser by loading the page localhost:8000, and upload run.symb.cleo to render the profile with most of the symbol information.
  8. +
+ +

Native stack vs. Pseudo stack

+ +

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.

+ +

Native stack

+ +

Native stacks are the normal stacks most developers are used. They are the default.

+ +

Pseudostack

+ +

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.

+ +

Tagging is done by adding macros of the form AUTO_PROFILER_LABEL("NAMESPACE", "NAME"). 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 AUTO_PROFILER_LABEL throughout the code. See GeckoProfiler.h for more variations like AUTO_PROFILER_LABEL_DYNAMIC.

+ +

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.

+ +

Sharing, saving and loading profiles

+ +

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 information on sharing profiles is available.

+ +

Profiling a hung process

+ +

It is possible to get profiles from hung Firefox processes using lldb1.

+ +
    +
  1. After the process has hung, attach lldb.
  2. +
  3. Type in2, : +
    p (void)profiler_save_profile_to_file("somepath/profile.txt")
    +
  4. +
  5. Clone mstange’s handy profile analysis repository.
  6. +
  7. Run: +
    python symbolicate_profile.py somepath/profile.txt
    + +

    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 cleverness3 to grab the symbols from your binary.

    + +

    Your profile will now, hopefully, be updated with symbols. Upload it for further analysis!

    + +

    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!

    +
  8. +
+ +

Profiling Threads

+ +

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.

+ +

Examples: 1 2

+ +

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.)

+ +

Profiler Features

+ +

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.

+ +

Stackwalk

+ +

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.

+ +

JS Profiling

+ +

Javascript callstacks will be generated and interleaved with the c++ callstacks. This will introduce an overhead when running JS.

+ +

GC Stats

+ +

Will embed GC stats from 'javascript.options.mem.notify' in the profile.

+ +

Main Thread IO

+ +

This will interpose file I/O and report them in the profiles.

+ +

Multi-Thread

+ +

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.

+ +

GPU

+ +

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.

+ +

Layers & Texture

+ +

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.

+ +

Viewing the Layer Tree

+ +

To view the layer tree, the layers.dump pref must be set to true in the Firefox or B2G program being profiled.

+ +

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:

+ +
./profile.sh start -p b2g -t Compositor && ./profile.sh start -p Homescreen
+
+ +

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:

+ +

Screenshot of layer tree view in Cleopatra, with no textures.

+ +

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.

+ +

Viewing Textures

+ +

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 layers.dump-texture pref to true, or by adding -f layersdump to the profiler command line (the latter implies both the layers.dump and layers.dump-texture prefs).

+ +
+

Warning: 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.

+
+ +

Here's how the Layer Tree view looks in Cleopatra with texture data:

+ +

Screenshot of layer tree view in Cleopatra, with textures.

+ +

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.

+ +

Visualizing a layer tree without a profile

+ +

If you have a layer dump from somewhere (such as from adb logcat 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:

+ +

Screenshot of front page of Cleopatra, with pasted layer dump.

+ +

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.

+ +
+

On B2G, each line of a layer dump in adb logcat output is prefixed with something like I/Gecko   (30593):. Cleopatra doesn't currently understand this prefix, so it needs to be removed before pasting.

+
+ +

Display List

+ +

Dump the display list after each refresh with the texture data. This can be used to debug correctness problems.

+ +

Contribuir

+ + 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 +--- +
+

Acompanhe ou peça ajuda!

+

Siga nosso blog, join our mailing list, or find us in #identity on IRC.

+
+

Mozilla Persona é 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 serviços opcionais, centralizados.

+

Por quê você e seu site deveriam usar Persona?

+
    +
  1. Persona elimina completamente senhas para sites específicos, libertando usuários e sites do fardo de criar, gerir e armazenar seguramente senhas.
  2. +
  3. Persona é fácil de usar. Com apenas dois cliques um usuário Persona pode se cadastrar em um novo site, como Voost ou The Times Crossword, ignorando o desgaste associado à criação de contas.
  4. +
  5. Persona é fácil de implementar. Desenvolvedores podem adicionar Persona à um site em uma única tarde.
  6. +
  7. Melhor de tudo, não há bloqueio. Desenvolvedores adquirem um endereço de email para todos seus usuários, e usuários podem usar qualquer endereço de email com Persona.
  8. +
  9. Persona é baseado no protocolo BrowserID. Quando os navegadores populares implementarem BrowserID, eles não irão precisar depender da Mozilla para logar.
  10. +
+

Leia e comece!

+
+ Note: Persona is in active development. Follow our blog to learn about new features, or join our mailing list and offer your feedback!
+

Using Persona on your site

+ + + + + + + + + + + +
+

Getting started

+
+
+ Why Persona?
+
+ Learn about reasons to support Persona on your site, and how it compares to other identity and authentication systems.
+
+ Quick setup
+
+ A quick walkthrough showing how to add Persona to your website.
+
+
+

Persona API reference

+
+
+ The navigator.id API reference
+
+ Reference for the navigator.id object, which web developers can use to integrate Persona into sites.
+
+ Verification API reference
+
+ Reference for the remote verification API hosted at https://verifier.login.persona.org/verify.
+
+
+

Guides

+
+
+ Security considerations
+
+ Practices and techniques to make sure your Persona deployment is secure.
+
+ Browser compatibility
+
+ Learn exactly which browsers support Persona.
+
+ Internationalization
+
+ Learn how Persona handles different languages.
+
+
+

Resources

+
+
+ Libraries and plugins
+
+ Find a drop-in library for your favorite programming language, web framework, blog, or content management system.
+
+ The Persona cookbook
+
+ Example source code for Persona sites. Includes snippets in PHP, Node.JS, and more.
+
+ Branding resources
+
+ Sign in buttons and other graphics to help present Persona to your users.
+
+
+

 

+ + + + + + + +
+

Information for Identity Providers

+

If you're an email provider or another identity-providing service, check out the links below to learn about becoming a Persona Identity Provider.

+
+
+ IdP Overview
+
+ A high level view of Persona Identity Providers.
+
+ Implementing an IdP
+
+ A detailed guide to the technical details of becoming an IdP.
+
+ Development tips
+
+ A set of tips and tricks useful while developing a new Identity Provider.
+
+ .well-known/browserid
+
+ An overview of the structure and purpose of the .well-known/browserid file, which IdPs use to advertise their support for the protocol.
+
+
+

The Persona Project

+
+
+ Glossary
+
+ BrowserID and Persona terminology defined.
+
+ FAQ
+
+ Answers to common questions.
+
+ Protocol overview
+
+ A mid-level technical overview of the underlying BrowserID protocol.
+
+ Crypto
+
+ A look at the cryptographic concepts behind Persona and BrowserID.
+
+ The Spec
+
+ Deep technical details live here.
+
+ The Persona Website
+
+ To get Persona going, we're hosting three services at https://login.persona.org: a fallback Identity Provider, a portable implementation of the {{ domxref("navigator.id") }} APIs, and an identity assertion verification service.
+
+ The Persona Source Code
+
+ The code behind the Persona website lives in a repository on GitHub. Patches welcome!
+
+
+

 

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 +--- +

Em 2014, a MSCI estimatou 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.

+ +

Phishing is an attempt to collect sensitive information, such as usernames, passwords, and financial details by disguising as a trustworthy entity online.

+ +

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.

+ +

Contramedidas passadas e atuais

+ +

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.

+ +

Deitando a culpa aos utilizadores

+ +

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.

+ +

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.

+ +

A study on the efficacy of security indicators, presented at the 2007 IEEE Symposium on Security and Privacy, suggests 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.

+ +

Serviços assumindo responsabilidade

+ +

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.

+ +

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 SafeBrowsing service, to detect known web forgeries, and display an alert instead of the fraudulent website.

+ +

Autenticação de Dois Fatores

+ +

None of the above anti-phishing measures address the basic problem: username/password combinations are often enough to impersonate users.

+ +

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.

+ +

Criptografia de Chave Pública

+ +

Many services will soon support W3C Web Authentication, 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.

+ +

Verificação via Mensagem de Texto

+ +

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 no longer recommends SMS verification. The SS7 telephony system is vulnerable, making eavesdropping, or rerouting text messages quite trivial.

+ +

Algoritmos de Palavra-passe Única

+ +

A better way to use phones as second factor, are One-Time Password (OTP) protocols, like TOTP and HOTP. 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 nonce - potentially time-based.

+ +

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.

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 +--- +

Emscripten é um compilador LLVM para JavaScript. Este utiliza bytecode 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.

+ +
+

Importante: esta página fornece uma breve introdução sobre o que Emscripten é. Para começar com Emscripten, vá para a Wiki oficial do Emscripten.

+
+ +

Ao utilizar o Emscripten, pode

+ + + +

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.

+ +

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.

+ +

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 frameworks como Qt.

+ +

Emscripten gera código rápido — o formato de saída é asm.js, um subset de JavaScript que consegue executar perto de velocidades nativas em muitos casos.

+ +
+

Nota: Parece interessante? Ler mais sobre Emscripten e experimentar algumas demonstrações, e depois começar a usar.

+
+ +

Outros artigos de interesse na MDN

+ + 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 +--- +

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.

+

{{ LandingPageListSubpages() }}

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 +--- +

MailNews significa "Correio e Listas de Notícias". MailNews é o back end de partes de mensagem do SeaMonkey e Thunderbird. Este fornece um número de funções e capacidades, incluindo:

+ + + +

O código de MailNews reside na diretoria / mailnews/ de comm-central.

+ +

 

+ +
+
+
+
AsyncTestUtils extended framework
+
The AsyncTestUtils Extended Framework is one mechanism for testing the MailNews component of Thunderbird. See MailNews automated testing for a description of the other testing mechanisms.
+
Leak And Bloat Tests
+
This page describes how to perform tests that measure memory leaks and bloat for MailNews and its sub-components.
+
+ +
+
+
+ +
+
+
MailNews automated testing
+
Automated testing is an increasingly significant and important part of MailNews development. It allows reviewers to quickly pick up regressions in patches and helps developers to think about different cases.
+
+
+
+ +

 

+ +

Consulte as páginas etiquetadas de MailNews para informação additional especifica de MailNews.

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 +--- +

Image:rhino.jpg

+ +

Rhino é uma implementação de código fonte aberto da linguagem JavaScript inteiramente desenvolvida em Java. Tipicamente, destina-se a ser incluída em aplicações Java como forma de providenciar funcionalidades de scripting ao utilizador final. Foi incluída no pacote J2SE como o scripting engine disponível por defeito.

+ +

Baixar Rhino

+ +

Como obter código fonte e ficheiros binários

+ +

Documentação Rhino

+ +

Informação sobre Rhino para desenvolvedores de scripts.

+ +

Ajuda Rhino

+ +

Alguns recursos para o caso de entrar em dificuldades.

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 +--- +

Esta página é destinada aos tradutores atuais e futuros do Thunderbird, o cliente de e-mail e usenet 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.

+ +

Criar uma localização do Thunderbird

+ +

Creating a new localization (Mercurial) - This article describes how you can create a new localization for Thunderbird.

+ +

Sobre repositórios e ramificações

+ +

There are 3 active repositories for Thunderbird development. Thunderbird development work is merged from one branch to the next every six weeks.

+ + + +

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.

+ +

Requisitos da Localização

+ +

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 see this page.

+ +

Painel da Localização

+ +

The localization dashboard for Thunderbird gives localizers a precise overview of the current status of their localization. Detailed information is available on the l10n dashboard page.

+ +

A localization will added to the l10n dashboard on request when it has reached a high-level of completion (> 80%) as shown by the compare-locales output. To request the addition of your locale to the dashboard, file a bug in the Thunderbird product/Build Config component.

+ +

Obter informação relevante de l10n

+ +

Fóruns de Discussão e Listas de Discussão

+ +

Localizers of Thunderbird should read the localization newsgroups (mozilla.dev.l10n.announce mozilla.dev.l10n) 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 (mozilla.dev.apps.thunderbird) to stay informed of recent Thunderbird-related developments.

+ +

These newsgroups can also be accessed via the dev-l10n-announce@lists.mozilla.org, dev-l10n@lists.mozilla.org (localization mailinglist) or dev-apps-thunderbird@lists.mozilla.org (Thunderbird development mailinglist) mailinglists, which mirror the newsgroups mentioned above. You can subscribe to or unsubscribe from these mailinglists via the web interface at lists.mozilla.org.

+ +

Bugzilla

+ +

Localizers should watch the thunderbird@localization.bugs 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 Email preferences in bugzilla.

+ +

Algumas hiperligações úteis

+ + + +

Tiers de Idioma

+ +

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.

+ +

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.

+ +

Tier 1

+ +

The following are P1 (priority 1) locales in order of priority:

+ +
* 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)
+
+ +

Tier 2

+ +

Todas as outras localidades suportadas que estão na categoria do Tier 2.

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 +--- +

A Mozilla tem várias tecnologias, utilizadas como componentes dos seus projetos. Estas estão documentadas aqui.

+ +

{{LandingPageListSubpages}}

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 +--- +

{{ Fx_minversion_header(3) }}

+ +

Places é 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') }}.

+ +

Places armazena os seus dados numa base de dados SQLite, utilizando as interfaces de mozStorage.

+ + + + + + + + +
+

Documentação

+ +
+
Places migration guide
+
Migrating existing code to use the Places API.
+
Manipulating bookmarks using Places
+
Examples for how to work with bookmarks using the Places API.
+
Using the Places tagging service
+
How to use the tagging service.
+
Using the Places history service
+
How to access history information using the Places API.
+
Using the Places favicon service
+
How to manipulate favicons using the Places API.
+
Using the Places livemark service
+
How to create and manage livemarks.
+
Using the Places annotation service
+
How to work with the annotation service.
+
Using the Places keywords API
+
How to manage Places keywords
+
+ +
+
Querying Places
+
How to query the bookmarks and history system with specific parameters.
+
Retrieving part of the bookmarks tree
+
How to fetch a section of the bookmarks tree using queries.
+
Displaying Places information using views
+
How to use Places views to display Places data in your own applications or extensions.
+
Places utilities for JavaScript
+
A library of convenient routines that make it easier to work with Places.
+
Places Database troubleshooting
+
How to deal with a corrupt places.sqlite database.
+
+ +

View All...

+
+ + +
+
The Places database
+
High-level overview of the Places database design.
+
History Service Design
+
Design of the history service.
+
Bookmark Service Design
+
Design of the bookmarks service.
+
Annotation Service Design
+
Design of the annotation service.
+
The Places "frecency" algorithm
+
The algorithm behind the Places location bar (sometimes called the "awesomebar").
+
+
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 +--- +

Armazenamento é uma API de base de dados SQLite. Está disponível para os callers de confiança, ou seja, apenas extensões e componentes do Firefox.

+ +

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.

+ +
Nota: Storage is not the same as the DOM:Storage feature which can be used by web pages to store persistent data or the Session store API (an XPCOM storage utility for use by extensions).
+ +

Iniciação

+ +

This document covers the Storage API and some peculiarities of SQLite. It does not cover SQL or "regular" SQLite. You can find some very useful links in the See also section however. For Storage API help, you can post to mozilla.dev.apps.platform on the news server news.mozilla.org. To report bugs, use Bugzilla.

+ +

The overall procedure for use is:

+ +
    +
  1. Get the Storage service - {{ interface("mozIStorageService") }}.
  2. +
  3. Open a connection to the database of your choice - {{ interface("mozIStorageConnection") }}.
  4. +
  5. Create statements to execute on the connection - {{ interface("mozIStorageStatement") }}.
  6. +
  7. Bind parameters to a statement as necessary.
  8. +
  9. Execute the statement.
  10. +
  11. Check for errors.
  12. +
  13. Reset the statement.
  14. +
+ +

Abrir uma ligação

+ +

JavaScript example of opening my_db_file_name.sqlite in the profile directory:

+ +
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
+
+ +

Likewise, the C++ would look like this:

+ +
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);
+
+ +
Note: MOZ_STORAGE_SERVICE_CONTRACTID is defined in {{ Source("storage/build/mozStorageCID.h") }}.
+ +

{{ Warning("It may be tempting to give your database a name ending in '.sdb' for sqlite database, but this is not recommended. 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.") }}

+ +

Fechar uma ligação

+ +

To close a connection on which only synchronous transactions were performed, use the mozIStorageConnection.close() method. If you performed any asynchronous transactions, you should instead use the mozIStorageConnection.asyncClose() 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.

+ +

Statements

+ +

This section demonstrates how you can execute SQL statements on your database. For a complete reference see {{ interface("mozIStorageStatement") }}.

+ +

Creating a Statement

+ +

There are actually two ways to execute a statement. You should choose the right one based on your needs.

+ +

No Results to be Returned

+ +

If you do not need to get any results back, you can use {{ ifmethod("mozIStorageConnection", "executeSimpleSQL") }} API like this in JavaScript:

+ +
dbConn.executeSimpleSQL("CREATE TEMP TABLE table_name (column_name INTEGER)");
+
+ +

Similarly, the C++ looks like this:

+ +
rv = mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING("CREATE TEMP TABLE table_name (column_name INTEGER)"));
+NS_ENSURE_SUCCESS(rv, rv);
+ +

Results to be Returned

+ +

However, if you need to get results back, you should create the statement with the {{ ifmethod("mozIStorageConnection", "createStatement") }} API like this in JavaScript:

+ +
var statement = dbConn.createStatement("SELECT * FROM table_name WHERE column_name = :parameter");
+
+ +

This example uses a named placeholder called "parameter" to be bound later (described in {{ anch("Binding Parameters") }}). Similarly, the C++ looks like this:

+ +
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);
+
+ +

This example uses the numbered placeholder indexed by zero for a parameter to be bound later (described in {{ anch("Binding Parameters") }}).

+ +

{{ 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.") }}

+ +

{{ 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.") }}

+ +

Binding Parameters

+ +

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 NULL.

+ +
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.
+ +

Binding One Set of Parameters

+ +

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:

+ +
var statement = dbConn.createStatement("SELECT * FROM table_name WHERE id = :row_id");
+statement.params.row_id = 1234;
+
+ +

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.

+ +

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") }}. The full list of binding functions can be found with the {{ interface("mozIStorageStatement") }} documentation.

+ +

C++ example:

+ +
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);
+
+ +

{{ 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.") }}

+ +

Binding Multiple Sets of Parameters

+ +

{{ gecko_minversion_header("1.9.2") }}

+ +

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.

+ +
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);
+
+ +

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 execute the statement asynchronously, and the statement will get each set of bindings bound to it before execution asynchronously.

+ +

Executing a Statement

+ +

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.

+ +

Asynchronously

+ +

{{ gecko_minversion_header("1.9.1") }}

+ +

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") }}).

+ +

After you create and bind a statement, your JavaScript should look something like this to execute a statement asynchronously:

+ +
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!");
+  }
+});
+
+ +

The call to executeAsync takes an object that implements mozIStorageStatementCallback. 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.

+ +

Synchronously

+ +

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.

+ +

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:

+ +
while (statement.executeStep()) {
+  let value = statement.row.column_name;
+}
+
+ +

You can create this helper object yourself if it's not available in your version of Gecko. See {{ interface("mozIStorageStatementWrapper") }} for details.

+ +

In C++, the code would look something like this:

+ +
bool hasMoreData;
+while (NS_SUCCEEDED(statement->ExecuteStep(&hasMoreData)) && hasMoreData) {
+  PRInt32 value;
+  rv = statement->GetInt32(0, &value);
+  NS_ENSURE_SUCCESS(rv, rv);
+}
+
+ +

You can obtain other types of data by using the various methods available on {{ interface("mozIStorageValueArray") }}.

+ +

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") }}.

+ +

Resetting a Statement

+ +

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.

+ +

{{ 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.") }}

+ +

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:

+ +
var statement = dbConn.createStatement("SELECT * FROM table_name");
+try {
+  while (statement.step()) {
+    // Use the results...
+  }
+}
+finally {
+  statement.reset();
+}
+
+ +

In C++, Storage provides a helper object in {{ Source("storage/public/mozStorageHelper.h") }}, mozStorageStatementScoper, 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.

+ +
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.
+}
+
+ +

{{ Note("Calling reset is not an expensive operation, and nothing bad happens if you call reset more than once.") }}

+ +

Transações

+ +

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.

+ +

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.

+ +

{{ Note("The database engine does not support nested transactions, so attempting to start a transaction when one is already active will throw an exception.") }}

+ +

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:

+ + + +

{{ ifmethod("mozIStorageConnection", "beginTransaction") }} is equivalent to calling {{ ifmethod("mozIStorageConnection", "beginTransactionAs") }} and passing mozIStorageConnection.TRANSACTION_DEFERRED In general, this is the method you want to use.

+ +

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") }}.

+ +

In C++ code, there is a helper class defined in {{ Source("storage/public/mozStorageHelper.h") }}, mozStorageTransaction, 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 Commit on the helper object, the transaction will be rolled back.

+ +
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();
+}
+
+ +

Colação (ordenação)

+ +

SQLite provides several collation methods (BINARY, NOCASE, and RTRIM), but these are all very simple and have no support for various text encodings or the user's locale.

+ +

{{ gecko_minversion_header("1.9.2") }}

+ +

{{ Gecko("1.9.2") }} added support for several new collation methods:

+ +
+
locale
+
Case- and accent-insensitive collation.
+
locale_case_sensitive
+
Case-sensitive, accent-insensitive collation.
+
locale_accent_sensitive
+
Case-insensitive, accent-sensitive collation.
+
locale_case_accent_sensitive
+
Case- and accent-sensitive collation.
+
+ +

You can use them quite simply in your SELECT queries, like this:

+ +
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();
+
+ +

How to Corrupt a Database

+ +

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 SQLite's documentation on this. These are a few simple things you can avoid to help make sure this doesn't happen:

+ + + + + + + + + +

Thread Safety

+ +

{{ 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!

+ +

If you want to use concurrency to work on your database, you should use the asynchronous APIs provided by Storage.

+ +

Consultar também

+ + + + diff --git "a/files/pt-pt/mozilla/tech/xpcom/guide/altera\303\247\303\265es_xpcom_gecko_2.0/index.html" "b/files/pt-pt/mozilla/tech/xpcom/guide/altera\303\247\303\265es_xpcom_gecko_2.0/index.html" new file mode 100644 index 0000000000..ac8d2a2583 --- /dev/null +++ "b/files/pt-pt/mozilla/tech/xpcom/guide/altera\303\247\303\265es_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 +--- +

{{ gecko_minversion_header("2") }}

+ +

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.

+ +

No more frozen interfaces

+ +

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."

+ +

Component registration

+ +

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 XPCOMUtils.jsm, some of this was hidden from you, but it was still there.

+ +

Starting in Gecko 2, however, components are registered using manifest files, similarly to how chrome is registered. In fact, the same chrome manifest file will be used to register components.

+ +

All existing XPCOM components 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.

+ +

Component manifests

+ +

All component registration is now handled through manifest files. For extensions, this is the same chrome.manifest currently used to register chrome.

+ +

XPT files

+ +

The path of any XPT files must be listed explicitly in a manifest using an interfaces directive:

+ +
interfaces components/mycomponent.xpt
+ +

JavaScript components

+ +

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.

+ +

chrome.manifest:

+ +
# 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
+
+ +

The JavaScript code no longer exports a NSGetModule() function. It now must export a NSGetFactory() function, which accepts a class ID (CID) as a parameter.

+ +

For example, in your component's JavaScript code :

+ +
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]);
+
+ +

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:

+ +
/**
+* 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]);
+ +

Binary components

+ +

Binary components must be listed explicitly in a manifest using a binary-component directive:

+ +
binary-component components/mycomponent.dll
+
+ +

C++ in the component must be changed: a binary component no longer exports a NSGetModule() function. Instead, it exports an NSModule data symbol which points to a mozilla::Module structure. For more information about the mozilla::Module structure, see the Module.h header file. For an up-to-date example of implementing a dynamic modules, see nsSampleModule.cpp.

+ +

Note that nsIGenericFactory.h has been removed. References to nsIGenericFactory.h should be replaced with mozilla/ModuleUtils.h.

+ +

It is possible for a binary component to be compatible with Mozilla 1.9.2 and Mozilla 2.0 by using the extra macro NS_IMPL_MOZILLA192_NSGETMODULE. See nsSampleModule.cpp for more details.

+ +
Note: Binary XPCOM components must 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 js-ctypes instead.
+ +

Also note that extensions using binary components must now use the unpack property in the install manifest.

+ +

Platform-specific directories

+ +

The component/chrome system used to look in platform-specific subdirectories of an extension, such as platform/WINNT_x86-msvc/chrome.manifest on Windows. This is no longer supported. You can use the OS and ABI chrome registration directives to achieve the same effect:

+ +
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
+
+ +

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.

+ +

Category registration

+ +

Prior to Gecko 2, extensions could listen for the xpcom-startup and app-startup notifications during startup, and perform actions during those. This is no longer the case. The earliest startup notification extensions can receive now is profile-after-change, 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.

+ +

What you need to change

+ +

If your extension currently observes either xpcom-startup or app-startup, you need to update your code to observe profile-after-change instead.

+ +

Typically, extensions observed app-startup because in the past, you needed to load for app-startup in order to be able to register to observe profile-after-change in the first place. As of {{ gecko("1.9.1") }}, this is no longer the case, however; you can now register for profile-after-change using the Category Manager. See Receiving startup notifications for details.

+ +

To add a category entry, you must insert the following line to your chrome.manifest:

+ +
category profile-after-change MyComponent @foobar/mycomponent;1
+
+ +
Important: Formerly, the contract id of the category entry was prefixed with "service," if the component was implemented as a service. This prefix needs to be dropped when migrating to chrome.manifest.
+ +

Changed category names

+ +

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:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Old nameNew name
JavaScript global constructorJavaScript-global-constructor
JavaScript global constructor prototype aliasJavaScript-global-constructor-prototype-alias
JavaScript global propertyJavaScript-global-property
JavaScript global privileged propertyJavaScript-global-privileged-property
JavaScript global static namesetJavaScript-global-static-nameset
JavaScript global dynamic namesetJavaScript-global-dynamic-nameset
JavaScript DOM classJavaScript-DOM-class
JavaScript DOM interfaceJavaScript-DOM-interface
XSLT extension functionsXSLT-extension-functions
+ +

But why?

+ +

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.

+ +

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.

+ +

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.

+ +

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.

+ +

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.

+ +

Electrolysis content processes can simply read the component registrations during startup.

+ +

XPCNativeWrapper changes

+ +

You can't disable XPCNativeWrappers from your manifest

+ +

Specifying xpcnativewrappers=no 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.

+ +

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 wrappedJSObject to access wrapped objects.

+ +

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 window.delete() function that you need to call.

+ +

If, on the other hand, all you're doing with content is accessing DOM methods and properties, you've never needed to be using xpcnativewrappers=no in the first place, and should simply remove it from your manifest.

+ +

Miscellaneous XPCNativeWrapper changes

+ + + +

XPCOMUtils.jsm changes

+ +

The XPCOMUtils.jsm code module has been updated to let you specify the application IDs of the applications you wish to register your component in.

+ +

XPCOM service getters

+ +

A number of commonly used XPCOM services now have service getter functions available in the mozilla::services namespace; these make it much easier to get access to these services from C++ code.

+ +

See also

+ + 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 +--- +

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.

+ +
+

WebExtensions are becoming the new standard for creating add-ons. Eventually support for XPCOM add-ons will be deprecated, so you should begin to investigate porting your add-ons to use the WebExtensions API, and report any missing functionality 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 Comparison with XUL/XPCOM extensions. In addition, any binaries you use will then need to be converted for use with the WebExtensions native messaging API, or compiled using WebAssembly or Emscripten.

+
+ +

{{LandingPageListSubpages}}

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 +--- +

XPCOM é um modelo de objeto componente de plataforma cruzada, similar a Microsoft COM. Este tem múltiplas ligações de linguagem, permitindo que os componentes XPCOM sejam utilizados e implementados no Java, JavaScript e Python, além das interfaces em C++. As interfaces no XPCOM são definidas num dialeto de IDL, nomeado de XPIDL.

+ +
+

WebExtensions are becoming the new standard for creating add-ons. Eventually support for XPCOM add-ons will be deprecated, so you should begin to investigate porting your add-ons to use the WebExtensions API, and report any missing functionality 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 Comparison with XUL/XPCOM extensions. In addition, any binaries you use will then need to be converted for use with the WebExtensions native messaging API, or compiled using WebAssembly or Emscripten.

+
+ +

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. Gecko or Necko) or by an application or even by an extension.

+ +
+
Accessing the Windows Registry Using XPCOM
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 XPCOM interfaces to read and write registry data. This article will show you how to use the available interfaces in several Mozilla products.
Aggregating the In-Memory Datasource
already_AddRefed
already_AddRefed in association with nsCOMPtr allows you to assign in a pointer without AddRefing it.
Binary compatibility
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.
Bundling multiple binary components
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).
Creating a Python XPCOM component
Creating Applications with Mozilla already provides a tutorial for making a simple JavaScript or C++ component (implementing the nsISimple interface). Here is how to make the same component in Python using PyXPCOM.
Fun With XBL and XPConnect
Generating GUIDs
GUIDs are used in Mozilla programming for identifying several types of entities, including XPCOM Interfaces (this type of GUIDs is callled IID), components (CID), and legacy add-ons—like extensions and themes—that were created prior to Firefox 1.5. Add-ons can (and should) be identified with IDs of the form extensionname@organization.tld since Firefox 1.5.
Generic factory
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>
How to build a binary XPCOM component using Visual Studio
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 elsewhere.
How To Pass an XPCOM Object to a New Window
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.
Interfacing with the XPCOM cycle collector
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.
Introduction to XPCOM for the DOM
Warning: this document has not yet been reviewed by the DOM gurus, it might contain some errors.
Language bindings
An XPCOM Language Binding is a bridge between a particular language and XPCOM 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.
Monitoring HTTP activity
Gecko includes the nsIHttpActivityObserver interface, which you can implement in your code to monitor HTTP transactions in real time, receiving a callback as the transactions take place.
nsCOMPtr versus RefPtr
Gecko code uses both nsCOMPtr and RefPtr as smart pointers. This guide provides some explanation and advice on how to choose between them.
Observer Notifications
The following are topics that you can observe during the course of an application. Unless otherwise noted you register for the topics using the nsIObserverService.
Setting HTTP request headers
HTTP is one of the core technologies behind the Web. In addition to the actual content, some important information is passed with HTTP headers for both HTTP requests and responses.
Storage
Storage is a SQLite database API. It is available to trusted callers, meaning extensions and Firefox components only.
The Thread Manager
The Thread Manager, introduced in Firefox 3, offers an easy to use mechanism for creating threads and dispatching events to them for processing.
+
Troubleshooting XPCOM components registration
Often the first time you create an XPCOM component, it may fail to register correctly.
Using nsCOMPtr
This document is the sum total of everything written down about nsCOMPtr. If you have a question about nsCOMPtr, and this document doesn't answer it, there probably isn't a document that answers it. You'll have to turn to the XPCOM newsgroup or another experienced nsCOMPtr user, or find the answer by experimentation.
Using nsIClassInfo
If you use a C++ class which implements nsIClassInfo from JavaScript, then you don't have to explicitly call QueryInterface on the JavaScript object to access the object's interfaces.
Using nsIDirectoryService
nsDirectoryService implements the nsIProperties interface. This implementation will allow you to Get(), Set(), Define(), and Undefine() nsIFile.
Using nsIPasswordManager
Technical review completed.
Using nsISimpleEnumerator
Using the clipboard
This section provides information about cutting, copying, and pasting to and from the clipboard.
Using the Gecko SDK
Weak reference
In XPCOM, a weak reference is a special object that contains a pointer to an XPCOM object, but doesnot keep that object alive. If the referent object is destroyed before the weak reference, the pointer inside the weak reference is set to nsnull.
Working with Multiple Versions of Interfaces
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.
Working with out parameters
wrappedJSObject
wrappedJSObject is a property sometimes available on XPConnect wrappers. When available, it lets you access the JavaScript object hidden by the wrapper.
XPCOM ABI
XPCOM ABI is the binary interface of XPCOM components. While XPCOM components written in a scripting language (such as JavaScript) 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'.
XPCOM category image-sniffing-services
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.
XPCOM glue
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.
XPCOM guide
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.
XPCOM ownership guidelines
...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.
XPCOM reference
This reference describes the interfaces and functions provided by the XPCOM library. In addition, it details the various helper classes and functions, as well as the components, provided by the XPCOM glue library. The contents herein are oriented primarily toward extension developers and people embedding XPCOM in other projects.
XPCOM tasks
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.
XPCOM Thread Synchronization
XPCOM thread synchronization primitives have the same semantics as those in NSPR, and each method of these synchronization objects (e.g. Mutex::Lock()) has a matching function in NSPR (PR_Lock()). This is no accident, as mozilla:: primitives are merely bare-minimum wrappers around NSPR's.
xptcall FAQ
xptcall 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.
Xptcall Porting Guide
Original Author: John Bandhauer, 31 May 1999.
Xptcall Porting Status
This is a status page for the multiplatform porting of xptcall. xptcall has a FAQ and a Porting Guide.
+
+ +
+ +
+

Join the XPCOM community

+
+
Choose your preferred method for joining the discussion:
+ +
+ +
+
+ + 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 +--- +

These "glue" classes are provided to make it easier to use XPCOM from C++ code. When these classes are used by a component, you may need to link the component against the XPCOM glue library.

+

{{LandingPageListSubpages}}

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 +--- +

This reference describes the interfaces and functions provided by the XPCOM library. In addition, it details the various helper classes and functions, as well as the components, provided by the XPCOM glue library. The contents herein are oriented primarily toward extension developers and people embedding XPCOM in other projects.

+ +
+

WebExtensions are becoming the new standard for creating add-ons. Eventually support for XPCOM add-ons will be deprecated, so you should begin to investigate porting your add-ons to use the WebExtensions API, and report any missing functionality 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 Comparison with XUL/XPCOM extensions. In addition, any binaries you use will then need to be converted for use with the WebExtensions native messaging API, or compiled using WebAssembly or Emscripten.

+
+ +
+

If you're working on a module in the Mozilla codebase that's compiled with the MOZILLA_INTERNAL_API flag set, some of these APIs -- the string functions and classes in particular -- are not the ones you should be using. See the XPCOM internal string guide for documentation of the internal string API used within the Mozilla codebase.

+
+ +

{{LandingPageListSubpages}}

+ +

Many XPCOM pages return an nsresult. Prior to Gecko 19 {{geckoRelease(19)}}, this was an integer that simply returned an error code. It is now a strongly typed enum 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.

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 +--- +

no redirect

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 +--- +

Definição

+ +

Authoritative definition

+ +

Exemplo

+ +

Exemplo do mundo real

+ +
<?xml version="1.0" encoding="UTF-8"?>
+
+<clientConfig version="1.1">
+  <emailProvider id="freenet.de">
+    <domain>freenet.de</domain>
+    <displayName>Freenet Mail</displayName>
+    <displayShortName>Freenet</displayShortName>
+    <incomingServer type="imap">
+      <hostname>imap.freenet.de</hostname>
+      <port>993</port>
+      <socketType>SSL</socketType>
+      <authentication>password-encrypted</authentication>
+      <username>%EMAILADDRESS%</username>
+    </incomingServer>
+    <incomingServer type="imap">
+      <hostname>imap.freenet.de</hostname>
+      <port>143</port>
+      <socketType>STARTTLS</socketType>
+      <authentication>password-encrypted</authentication>
+      <username>%EMAILADDRESS%</username>
+    </incomingServer>
+    <incomingServer type="pop3">
+      <hostname>pop.freenet.de</hostname>
+      <port>995</port>
+      <socketType>SSL</socketType>
+      <authentication>password-cleartext</authentication>
+      <username>%EMAILADDRESS%</username>
+    </incomingServer>
+    <incomingServer type="pop3">
+      <hostname>pop.freenet.de</hostname>
+      <port>110</port>
+      <socketType>STARTTLS</socketType>
+      <authentication>password-cleartext</authentication>
+      <username>%EMAILADDRESS%</username>
+    </incomingServer>
+    <outgoingServer type="smtp">
+      <hostname>smtp.freenet.de</hostname>
+      <port>587</port>
+      <socketType>SSL</socketType>
+      <authentication>password-encrypted</authentication>
+      <username>%EMAILADDRESS%</username>
+    </outgoingServer>
+    <outgoingServer type="smtp">
+      <hostname>smtp.freenet.de</hostname>
+      <port>587</port>
+      <socketType>STARTTLS</socketType>
+      <authentication>password-encrypted</authentication>
+      <username>%EMAILADDRESS%</username>
+    </outgoingServer>
+    <documentation url="http://kundenservice.freenet.de/hilfe/email/programme/config/index.html">
+      <descr lang="de">Allgemeine Beschreibung der Einstellungen</descr>
+      <descr lang="en">Generic settings page</descr>
+    </documentation>
+    <documentation url="http://kundenservice.freenet.de/hilfe/email/programme/config/thunderbird/imap-thunderbird/imap/index.html">
+      <descr lang="de">TB 2.0 IMAP-Einstellungen</descr>
+      <descr lang="en">TB 2.0 IMAP settings</descr>
+    </documentation>
+  </emailProvider>
+</clientConfig>
+
+ +

Como examinar os servidores de correio eletrónico

+ +

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).
+ For non-SSL, use netcat -v hostname port (preferred) or telnet hostname port as "client".

+ + + +

In all cases, the server should respond with a list of capabilities.

+ +

SSL / STARTTLS

+ +

There are 2 SSL variants: normal SSL and STARTTLS.

+ +

SSL normal

+ +

The old-style SSL (including TLS, which is just the new name for SSL) has a special port:

+ + + +

On Linux, you can contact the server via

+ +
openssl s_client -connect hostname:port
+ +

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).
+ If you see nothing, then probably the server does not support SSL.
+ After that, you can have the same protocol exchange as with netcat on standard ports, as listed above.

+ +

STARTTLS

+ +

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.
+ To try it out, on Linux, you can contact the server via

+ +
openssl s_client -connect hostname:port -starttls proto
+ +

...where "proto" is imap, pop3 or smtp. For example:

+ +
openssl s_client -connect imap.example.com:143 -starttls imap
+ +

You should get the same response as described above for openssl.

+ +

Formato do ficheiro de configuração

+ +

Add the appropriate port and socket type for each server, depending on protocol and SSL support. For example,
+ for IMAP with SSL:

+ +
<port>993<port>
+
+<socketType>SSL</socketType>
+ +

for IMAP with STARTTLS:

+ +
<port>143<port>
+<socketType>STARTTLS</socketType>
+ +

for IMAP without any SSL (deprecated!):

+ +
<port>143<port>
+
+<socketType>plain</socketType>
+ +

Utilizar SSL

+ +

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.
+ 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.

+ +

Certificado válido

+ +

Either way, be sure to use a valid certificate:

+ + + +

Autenticação

+ +

Probe the mail server, as explained above for STARTTLS. If you see CRAM-MD5 or APOP in the response, the server should support encrypted passwords. If you only see AUTH LOGIN and/or PLAIN, or no AUTH 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).

+ +

Formato do ficheiro de configuração

+ +

In the configuration file, for each IMAP, POP and SMTP server, you need to specify the authentication method.
+
+ For plaintext passwords:

+ +
<authentication>password-cleartext</authentication>
+ +

For CRAM-MD5:

+ +
<authentication>password-encrypted</authentication>
+ +


+ Discouraged settings (SMTP only):
+ If the SMTP server can only be used after checking incoming mail, please use

+ +
<authentication>smtp-after-pop</authentication>
+ +

Note that RFC 4409 disallows that and requires the customer-facing SMTP server to support proper authentication via AUTH.
+ If the SMTP server can only be used within the ISP's network, and requires no authentication, use:

+ +
<authentication>client-IP-address</authentication>
+ +

or, if it requires authentication in addition to the user being in the ISP network, use e.g.:

+ +
<authentication>password-cleartext</authentication>
+
+<restriction>client-IP-address</restriction>
+
+ +

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.

+ +

Por favor, suporte as palavras-passe MD5

+ +

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.
+
+ 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.

+ +

Nome de utilizador

+ +

If the user's IMAP login name is the same as his email address (for example, if "fred@example.com" is the login name), add:

+ +
<username>%EMAILADDRESS%</username>
+ +

Note: Use %EMAILADDRESS% as literal. Thunderbird will replace it with the email address that the user entered. Same for %EMAILLOCALPART% and other placeholders.

+ +

If the login name is the same as the first segment before the @ of the email address (for example, "fred" for "fred@example.com"), use:

+ +
<username>%EMAILLOCALPART%</username>
+ +

Pseudónimos, ou nome de utilziador não são parte do endereço de e-mail

+ +

Note that the above must be true for any email address that the user would set up - even for aliases.
+
+ You can ignore aliases like info@, if that's an alias for fred@ (or both fred@ and wilma@) and Fred would set up fred@example.com in Thunderbird, not info@.
+
+ If, however, Fred can set up hero@example.com as alias for fred@example.com, and neither "hero" nor "hero@example.com" 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 <http://autoconfig.example.com/mail/c...ro@example.com>, your autconfig server must have a script which responds to /mail/config-v1.1.xml and returns the concrete username, for example:

+ +
<username>fred</username>
+ +

... (or <username>fred@example.com</username>, as appropriate) for hero@example.com. 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.

+ +

Ativar visiturl

+ +

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.

+ +

This is not yet supported by Thunderbird 3.1, but should be in the future, so please add this critical information where it applies.

+ +

If you are an ISP, please by all means avoid this. It's one of those "walls" against which users run the hard way.

+ +

URL da documentação

+ +

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.

+ +
If your URL contains ampersands (&), please remember to replace them with HTML entities (&amp;). For example:
+ +
<documentation url="http://example.com/help.php?client=thunderbird&amp;lang=en"/>
+ +
Otherwise your XML file will be incorrect and Thunderbird will neither be able to parse it, nor to return any error message.
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 +--- +

Por favor, consulte https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat (inglês).

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 +--- + diff --git "a/files/pt-pt/mozilla/thunderbird/configuracao_autom\303\241tica/index.html" "b/files/pt-pt/mozilla/thunderbird/configuracao_autom\303\241tica/index.html" new file mode 100644 index 0000000000..f0a647cc98 --- /dev/null +++ "b/files/pt-pt/mozilla/thunderbird/configuracao_autom\303\241tica/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 +--- +

Autor: Ben Bucksch
+ Por favor, não altere este documento sem consultar o autor.

+ +

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.

+ +

Consulte também:

+ + + +

This document describes how Autoconfiguration in Thunderbird works, and what to do to allow mail servers to be autoconfigured.

+ +

Mecanismos

+ +

Thunderbird gets the server settings via different means, each of which is intended for different cases:

+ + + +

All the lookup mechanisms use the email address domain as base for the lookup. For example, for the email address fred@example.com , the lookup is performed as (in this order):

+ +
    +
  1. tb-install-dir/isp/example.com.xml on the harddisk
  2. +
  3. check for autoconfig.example.com
  4. +
  5. look up of "example.com" in the ISPDB
  6. +
  7. look up "MX example.com" in DNS, and for mx1.mail.hoster.com, look up "hoster.com" in the ISPDB
  8. +
  9. try to guess (imap.example.com, smtp.example.com etc.)
  10. +
+ +

We may add DNS SRV records as supported mechanism in the future, but we currently do not.

+ +

Como adicionar suporte para o seu domínio

+ +

Classificação

+ +

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.
+
+ If you support email aliases and the user's login name is not part of the email address (for example, users may have "hero@example.com" as email address, but the IMAP/POP/SMTP login name is neither "hero" nor "hero@example.com", but "u67578"), you need to set up a configuration server, which does the email address -> login name lookup.
+
+ If you host customer domains, i.e. you are "hoster.com", but your customers have "fred@flintstone.com" and "louis@kent.com" as domains, with only a few users per domain, you need to set up a configuration server (or rely on DNS MX).
+
+ If you are a small company installing Thunderbird on your employees' desktops, you can place a configuration file in the Thunderbird installation folder.

+ +

ISPDB

+ +

Database URL is <https://live.mozillamessaging.com/autoconfig/v1.1/>, append domain name, e.g. <https://live.mozillamessaging.com/autoconfig/v1.1/freenet.de>.
+
+ Current process: File a bug in Bugzilla, 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.

+ +

Configuração do servidor no ISP

+ +

Given the email address "fred@example.com", Thunderbird first checks <http://autoconfig.example.com/mail/config-v1.1.xml?emailaddress=fred@example.com> and then <http://example.com/.well-known/autoconfig/mail/config-v1.1.xml>.

+ +

Empresa pequena

+ +

If you are a small company, you can put the XML configuration file on your web server, at URL <http://example.com/.well-known/autoconfig/mail/config-v1.1.xml>. (This is not yet finalized and subject to change.)

+ +

Hospedeiro do domínio

+ +

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.

+ +

DNS

+ +

For each customer domain, you add a DNS record (in addition to the existing MX, A www etc. DNS records):
+ autoconfig IN A 10.2.3.4
+ or
+ autoconfig IN CNAME autoconfig.hoster.com.
+ ... where 10.2.3.4 and autoconfig.hoster.com are IP addresses / hostnames you own.
+ This allows Thunderbird to find you as hoster.

+ +

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.

+ +

Example: example.com A 10.2.3.4

+ +

Servidor da Web

+ +

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.
+
+ 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)

+ +
<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>
+ +

Place the configuration file at the URL /mail/config-v1.1.xml on that host.

+ +

All config files must be served as Content-Type: text/xml (or application/xml), otherwise the file will be ignored. Also, they must use charset UTF-8 (esp. if there are any non-ASCII-characters).

+ +

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.
+ You can add a Rewriterule in the default virtual host (on debian /etc/apache2/sites-enabled/000-default)  to match all autoconfig.* subdomains:

+ +
<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>
+
+ +

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:

+ +
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;
+}
+
+ +

Or serve them directly from a common directory:

+ +
server {
+	listen 10.2.3.4:80; #again, use your server's public IP here!
+	server_name autoconfig.*;
+	location / {
+		root /var/www/autoconfig;
+	}
+}
+
+ +

 

+ +

Ficheiro de configuração

+ +

Isto é descrito em Como criar um ficheiro de configuração e definido nas sub páginas.

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 +--- +

Thunderbird is Mozilla's mail/messaging application. These pages document Thunderbird and also provide links to documentation about the MailNews backend which is also used in other projects such as Eudora/Penelope, Seamonkey, Correo, etc.

+ +

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 Mozilla Messaging, a subsidiary that was owned by Mozilla.)

+ + + + + + + + +
+

Documentation

+ +
+
Building Thunderbird
+
Information about building Thunderbird with the comm-central repository. There's also information about how comm-central works, how the review process works and how to use the Mozilla symbol server to help with debugging.
+
MailNews Protocols
+
Rough documentation about mail protocols..
+
Database views
+
Backend information about {{ Interface("nsIMsgDBView") }} and related interfaces..
+
Thunderbird API documentation
+
Thunderbird API documentation
+
Extension documentation
+
Tutorials and tips for building Thunderbird extensions
+
Automated Testing
+
Details of Thunderbird's automated testing facilities
+
Thunderbird in the Enterprise
+
Help with deploying Thunderbird in large organizations
+
+ +

View All...

+
+

Community

+ + + +

Tools

+ + +
+ +

 

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 +--- +

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.

+ +
{{ListSubpages("/pt-PT/docs/Mozilla/Thunderbird/Releases",1,1,1)}}
+ +

Ver também

+ + 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 +--- +

Este artigo descreve o trabalho com várias janelas no código da Mozilla (aplicações XUL e Extensões). Este contém dicas e código exemplo em como abrir novas janelas, encontrar uma janela já aberta, e passar dados entre diferentes janelas.

+ +

Abertura de janelas

+ +

From a <script> in a window or an overlay

+ +

To open a new window, we usually use a window.open or window.openDialog DOM call, like this:

+ +
+
var win = window.open("chrome://myextension/content/about.xul",
+                      "aboutMyExtension", "chrome,centerscreen");
+
+
+ +

The first parameter to window.open is the URI of the XUL file that describes the window and its contents.

+ +

The second parameter is the window's name; the name can be used in links or forms as the target attribute. This is different from the user-visible window title, which is specified using XUL.

+ +

The third, and optional, parameter is a list of special window features the window should have.

+ +

The window.openDialog 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 dialog feature is specified.

+ +

From XPCOM components and modules

+ +

If the Window object is unavailable (for example, when opening a window from XPCOM component code), you might want to use nsIWindowWatcher interface. Its parameters are similar to window.open; in fact, window.open's implementation calls nsIWindowWatcher's methods.

+ +
+
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);
+
+ +

Objeto de janela

+ +

Note the win variable in the above section, which is assigned the return value of window.open. It can be used to access the opened window. The return value of window.open (and similar methods) is a Window object (usually ChromeWindow) – the same type as the window variable.

+ +

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 win.document.

+ +

Note however, that the open() call returns before the window is fully loaded, so some calls, like win.document.getElementById() will fail. To overcome this difficulty, you can move the initialization code to a load handler of the window being opened or pass a callback function, as described below.

+ +

You can get a Window object from a document using document.defaultView.

+ +

Janelas de conteúdo

+ +

When a XUL window contains a widget capable of displaying a page, such as <browser> or <iframe>, the document in that widget is, naturally, separate from the document of the chrome window itself. There also is a Window object for each sub-document, although there's no window in a common sense for the sub-document.

+ +

The same holds for chrome windows opened inside a tab of <tabbrowser>. The elements above the chrome document opened in the tab are separate from your chrome document.

+ +

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).

+ +

Accessing content documents

+ +

Assume you have a document loaded in a <tabbrowser>, <browser>, or <iframe> element inside your document. You can use browser.contentDocument to access that document and browser.contentWindow to access the Window object of that document.

+ +

You should be aware of XPCNativeWrappers when working with untrusted content. 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.

+ +

See Interaction between privileged and non-privileged pages if you need to interact with the content page.

+ +

The content shortcut

+ +

In case of <browser type="content-primary" />, you can use the content shortcut property to accesss the Window object of the content document. For example:

+ +
// alerts the title of the document displayed in the content-primary widget
+
+alert(content.document.title);
+ +

For example, you can use content.document in a browser.xul overlay to access the web page in the selected tab in a Firefox window.

+ +
Some examples use _content instead of content. The former has been deprecated for a while, and you should use content in the new code.
+ +

Accessing a document in the sidebar

+ +

Firefox has a sidebar, which is implemented as a <browser> element with id="sidebar". To access the elements and variables inside the sidebar, you need to use document.getElementById("sidebar").contentDocument or .contentWindow, like when {{ Anch("Accessing content documents") }}.

+ +

For more sidebar tips, see Code snippets:Sidebar.

+ +

Accessing the elements of the top-level document from a child window

+ +

The opposite case is when you want to access the chrome document from a privileged script loaded in a <browser> or an <iframe>.

+ +

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.

+ +

The DOM tree, as shown by the DOM Inspector, can look like this:

+ +
#document
+  window                 main-window
+    ...
+      browser
+        #document
+          window         myExtensionWindow
+
+ +

where the child window is where your code runs in.

+ +

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:

+ +
var mainWindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
+                   .getInterface(Components.interfaces.nsIWebNavigation)
+                   .QueryInterface(Components.interfaces.nsIDocShellTreeItem)
+                   .rootTreeItem
+                   .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
+                   .getInterface(Components.interfaces.nsIDOMWindow);
+ +

This allows you to cross the chrome-content boundaries, and returns the main window object.

+ +

Encontrar janelas já abertas

+ +

The window mediator XPCOM component (nsIWindowMediator interface) provides information about existing windows. Two of its methods are often used to obtain information about currently open windows: getMostRecentWindow and getEnumerator. Please refer to the nsIWindowMediator page for more information and examples of using nsIWindowMediator. === Example: Opening a window only if it's not opened already === XXX TBD

+ +

Passar dados entre janelas

+ +

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.

+ +

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.

+ +

Note: if you want to pass data between privileged (chrome) and non-privileged (web page) windows, or vice-versa, read this instead.

+ +

Example 1: Passing data to window when opening it with openDialog

+ +

When you open a window using window.openDialog or nsIWindowWatcher.openWindow, you can pass an arbitrary number of arguments to that window. Arguments are simple JavaScript objects, accessible through window.arguments property in the opened window.

+ +

In this example, we're using window.openDialog to open a progress dialog. We pass in the current status text as well as the maximum and current progress values. Note that using nsIWindowWatcher.openWindow is a bit less trivial . TODO: link to How To Pass an XPCOM Object to a New Window when it has a more useful example

+ +

Opener code:

+ +
window.openDialog("chrome://test/content/progress.xul",
+                  "myProgress", "chrome,centerscreen",
+                  {status: "Reading remote data", maxProgress: 50, progress: 10} );
+ +

progress.xul:

+ +
<?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>
+ +

Example 2: Interacting with the opener

+ +

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 window.opener property or via a callback function passed to the window in a way described in the previous section.

+ +

Let's add code to the previous example to notify the opener when the user presses Cancel on the progress dialog.

+ + + +

If we're sure the window that opened the progress dialog declares the cancelOperation function, we can use window.opener.cancelOperation() to notify it, like this:

+ +
<button label="Cancel" oncommand="opener.cancelOperation(); close();" />
+
+ + + +
function onCancel() {
+  alert("Operation canceled!");
+}
+
+...
+
+window.openDialog(
+  "chrome://test/content/progress.xul",
+  "myProgress", "chrome,centerscreen",
+  {status: "Reading remote data", maxProgress: 50, progress: 10},
+  onCancel
+);
+
+ +

The progress dialog can then run the callback like this:

+ +
<button label="Cancel" oncommand="window.arguments[1](); close();" />
+
+ +

Example 3: Using nsIWindowMediator when opener is not enough

+ +

The window.opener 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 nsIWindowMediator interface, introduced above.

+ +

One case in which you might want to use nsIWindowMediator 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.

+ +

This means the value of window.opener in your Options dialog is not necessarily the browser window -- instead, it might be the Extension Manager window. You could check the location property of the opener and use opener.opener in case it's the Extension Manager window, but a better way is to use nsIWindowMediator:

+ +
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+                   .getService(Components.interfaces.nsIWindowMediator);
+var browserWindow = wm.getMostRecentWindow("navigator:browser");
+// read values from |browserWindow|
+ +

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 preferences observers.

+ +

Example 4: Using nsIWindowWatcher when you don't have a window (primitives only)

+ +

For those times when you don't have access to a window object (such as a JavaScript XPCOM object), you can use nsIWindowWatcher.openWindow to open a XUL window. The problem is passing the data. It's a bit harder than using window.openDialog. Here is helper function that will package the data correctly and pass it to the newly opened window:

+ +
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);
+}
+
+ +

The function almost works the same as window.openDialog 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.

+ +

Example 5: Using nsIWindowWatcher for passing an arbritrary JavaScript object

+ +

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.

+ +
// 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);
+ +
// In the window code
+var args = window.arguments[0].wrappedJSObject;
+
+ +

This uses the wrappedJSObject 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.

+ +

Partilha de dados avançada

+ +

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.

+ +

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.

+ +

Using JavaScript code modules

+ +

JavaScript code modules {{ 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 Components.utils.import for more information.

+ + + +

Using an XPCOM singleton component

+ +

The cleanest and most powerful way to share data is to define your own XPCOM component (you can write one in JavaScript) and access it from anywhere using a getService call:

+ +
Components.classes["@domain.org/mycomponent;1"].getService();
+
+ + + +

There are several articles and books about creating XPCOM components online.

+ +

Using FUEL Application object

+ +
+

The FUEL library has been deprecated as of Firefox 41

+
+ +

The FUEL JavaScript library {{ Fx_minversion_inline(3) }} has a simple method for sharing data between windows. The Application object supports a storage property which can be used to store data globally. This method is a simplified form of the XPCOM singleton method.

+ +
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
+
+ + + +

Storing shared data in preferences

+ +

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 preferences service in such cases.

+ + + +

See Code snippets:Preferences for detailed description of the preferences system and example code.

+ +

Example:

+ +
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
+ +

Consulte também

+ + diff --git "a/files/pt-pt/mozilla/utiliza\303\247\303\243o_cxx_no_c\303\263digo_da_mozilla/index.html" "b/files/pt-pt/mozilla/utiliza\303\247\303\243o_cxx_no_c\303\263digo_da_mozilla/index.html" new file mode 100644 index 0000000000..02ec29e2a2 --- /dev/null +++ "b/files/pt-pt/mozilla/utiliza\303\247\303\243o_cxx_no_c\303\263digo_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 +--- +

Caraterísticas da linguagem C++

+ +

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 dynamic_cast, typeid() and <typeinfo> cannot be used in Mozilla code. Also disabled are exceptions; do not use try/catch 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.

+ +

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:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 MSVCGCCClang 
Requisito mínimo atual20134.83.4 
FuncionalidadeMSVCGCCClangPode ser utilizada no código
type_t &&20104.32.9Sim (consultar notas)
ref qualifiers on methods20154.8.12.9Não
member initializers20134.73.0Sim
variadic templates20134.32.9Sim
Initializer lists20134.43.1Sim
static_assert20104.32.9Sim
auto20104.42.9Sim
lambdas20104.53.1Sim
decltype20104.32.9Sim
Foo<Bar<T>>20104.32.9Sim
auto func() -> int20104.43.1Sim
Templated aliasing20134.73.0Sim
nullptr20104.63.0Yes, but use decltype(nullptr) instead of std::nullptr_t.
enum foo : int16_t {};20084.42.9Sim
enum class foo {};20124.42.9Sim
enum foo;20124.63.1Sim
[[attributes]]20154.83.3Não (consultar notas)
constexpr20154.63.1Use MOZ_CONSTEXPR from mozilla/Attributes.h
alignof/alignas20154.83.3No (see notes) ; only clang 3.6 claims __has_feature(cxx_alignof)
Delegated constructors20134.73.0Sim
Inherited constructors20154.83.3Não
explicit operator bool()20134.53.0Sim
char16_t/u"string"20154.43.0Use MOZ_UTF16("string") instead of u"string".
R"(string)"20134.53.0Sim
operator""()20154.73.1Não
=delete20134.42.9Sim
=default20134.43.0Sim
unrestricted unions20154.63.1Não
for (auto x : vec)20124.63.0Yes (be careful about the type of the iterator)
override/final20124.73.0Sim
thread_local20154.83.3Não (consultar notas)
function template default arguments20134.32.9Sim
local structs as template parameters20104.52.9Sim
extended friend declarations20104.72.9Sim
0b100 (C++14)20154.92.9Não
Return type deduction (C++14)20154.93.4Não
Generic lambdas (C++14)20154.93.4Não
Initialized lambda captures (C++14)20154.93.4Não
Digit separator (C++14)20154.93.4Não
Variable templates (C++14)5.03.4Não
Relaxed constexpr (C++14)5.03.4Não
Concepts (Concepts TS)6.0Não
Inline variables (C++17)Não
constexpr_if (C++17)Não
constexpr lambdas (C++17)Não
+ +

Notas

+ +

rvalue references: Implicit move method generation cannot be used.

+ +

Attributes: Several common attributes are defined in mozilla/Attributes.h or nscore.h.

+ +

Alignment: Some alignment utilities are defined in mozilla/Alignment.h.

+ +

Thread locals: There is a thread-local variable helper in mozilla/ThreadLocal.h. In addition, the native thread_local of MSVC2015 may break Windows XP support. See bug 1204752. The native thread_local of clang may break OSX 10.6, too, but support for OSX 10.6 has been retired.

+ +

C++14: C++14 is not enabled on compilers that support it.

+ +

Blibliotecas padrão de C++ e Mozilla

+ +

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.

+ +
+

The rest of this section is a draft for expository and exploratory purposes. Do not trust the information listed here.

+
+ +

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.

+ +

Estruturas de dados

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NomeCabeçalhoSTL equivalenteNotes
nsAutoTArraynsTArray.h Like nsTArray, but will store a small amount as stack storage
nsAutoTObserverArraynsTObserverArray.h Like nsTObserverArray, but will store a small amount as stack storage
mozilla::BloomFiltermozilla/BloomFilter.h Probabilistic set membership (see Wikipedia)
nsClassHashtablensClassHashtable.h Adaptation of nsTHashtable, see XPCOM hashtable guide
nsCOMArraynsCOMArray.h Like nsTArray<nsCOMPtr<T>>
nsDataHashtablensClassHashtable.hstd::unordered_mapAdaptation of nsTHashtable, see XPCOM hashtable guide
nsDequensDeque.hstd::deque 
mozilla::EnumSetmozilla/EnumSet.h Like std::set, but for enum classes.
nsInterfaceHashtablensInterfaceHashtable.hstd::unordered_mapAdaptation of nsTHashtable, see XPCOM hashtable guide
nsJSThingHashtablensJSThingHashtable.h Adaptation of nsTHashtable, see XPCOM hashtable guide
mozilla::LinkedListmozilla/LinkedList.hstd::listDoubly-linked list
nsRefPtrHashtablensRefPtrHashtable.hstd::unordered_mapAdaptation of nsTHashtable, see XPCOM hashtable guide
mozilla::SegmentedVectormozilla/SegmentedVector.hstd::dequeDoubly-linked list of vector elements
mozilla::SplayTreemozilla/SplayTree.h Quick access to recently-accessed elements (see Wikipedia)
nsTArraynsTArray.hstd::vector 
nsTHashtablensTHashtable.hstd::unordered_mapSee XPCOM hashtable guide, you probably want a subclass
nsTObserverArraynsTObserverArray.h Like nsTArray, but iteration is stable even through mutation
nsTPriorityQueuensTPriorityQueue.hstd::priority_queueUnlike the STL class, not a container adapter
mozilla::Vectormozilla/Vector.hstd::vector 
+ +

Untranslated notes:

+ +

ns*String - too complicated to explain

+ +

Safety utilities:
+ mozilla::Array mfbt/Array.h (safe array index)
+ mozilla::AssertedCast mfbt/Casting.h (casts)
+ mozilla::CheckedInt mfbt/CheckedInt.h (avoids overflow)
+ nsCOMPtr xpcom/glue/nsCOMPtr.h (~= std::shared_ptr)
+ mozilla::EnumeratedArray mfbt/EnumeratedArray.h (mozilla::Array, for enum types)
+ mozilla::RangedPtr mfbt/RangedPtr.h (prevents out-of-bounds)
+ mozilla::RefPtr mfbt/RefPtr.h (~= std::shared_ptr)
+ nsRefPtr xpcom/base/nsRefPtr.h (~= std::shared_ptr)
+ StaticRefPtr xpcom/base/StaticPtr.h (nsRefPtr w/o static constructor)
+ mozilla::UniquePtr mfbt/UniquePtr.h (~= std::unique_ptr)
+ mozilla::WeakPtr mfbt/WeakPtr.h (~= std::weak_ptr)
+ nsWeakPtr xpcom/base/nsWeakPtr.h (~= std::weak_ptr)

+ +

Algos:
+ mozilla::BinarySearch mfbt/BinarySearch.h
+ mozilla::BitwiseCast mfbt/Casting.h (strict aliasing-safe cast)
+ mozilla/MathAlgorithms.h (rotate, ctlz, popcount, gcd, abs, lcm)
+ mozilla::RollingMean mfbt/RollingMean.h ()

+ +

Misc:
+ mozilla::AlignedStorage mfbt/Alignment.h (replacement for std::aligned_storage)
+ mozilla::Atomic mfbt/Atomic.h (replacement for std::atomic)
+ mozilla::CondVar xpcom/glue/CondVar.h
+ mozilla::Maybe mfbt/Maybe.h (std::optional)
+ mozilla::MaybeOneOf mfbt/MaybeOneOf.h (~mozilla::Maybe<union {T1, T2}>)
+ mozilla::Monitor xpcom/glue/Monitor.h
+ mozilla::Mutex xpcom/glue/Mutex.h
+ mozilla::Pair mfbt/Pair.h (~= std::tuple<T1, T2> -- minimal space!)
+ mozilla::ReentrantMonitor xpcom/glue/ReentrantMonitor.h
+ mozilla::StaticMutex xpcom/base/StaticMutex.h
+ mozilla::TimeStamp xpcom/ds/TimeStamp.h (~= std::chrono::time_point)

+ +

mozilla/ArrayUtils.h
+ mozilla/Compression.h
+ mozilla/Endian.h
+ mozilla/FloatingPoint.h
+ mozilla/HashFunctions.h (~= std::hash)
+ mozilla/Move.h (std::move, std::swp, std::Forward)
+ mozilla/PodOperations.h (C++ versions of memset, memcpy, etc.)
+ mozilla/TypeTraits.h (replacement for <type_traits>)

+ +

(TODO: make list of STL usability here)

-- cgit v1.2.3-54-g00ecf