From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../firefox/australis_add-on_compat/index.html | 130 +++++ .../mozilla/firefox/developer_edition/index.html | 57 ++ .../firefox/enterprise_deployment/index.html | 138 +++++ .../firefox/experimental_features/index.html | 623 +++++++++++++++++++++ .../zh-cn/mozilla/firefox/headless_mode/index.html | 270 +++++++++ files/zh-cn/mozilla/firefox/index.html | 74 +++ .../cross_process_object_wrappers/index.html | 114 ++++ .../debugging_frame_scripts/index.html | 53 ++ .../firefox/multiprocess_firefox/faq/index.html | 18 + .../firefox/multiprocess_firefox/index.html | 78 +++ .../limitations_of_chrome_scripts/index.html | 197 +++++++ .../limitations_of_frame_scripts/index.html | 101 ++++ .../communicating_with_frame_scripts/index.html | 205 +++++++ .../frame_script_environment/index.html | 104 ++++ .../frame_script_loading_and_lifetime/index.html | 124 ++++ .../message_manager/index.html | 68 +++ .../message_manager_overview/index.html | 442 +++++++++++++++ .../message_manager/performance/index.html | 292 ++++++++++ .../multiprocess_firefox/motivation/index.html | 44 ++ .../index.html | 21 + .../technical_overview/index.html | 164 ++++++ .../which_uris_load_where/index.html | 53 ++ files/zh-cn/mozilla/firefox/privacy/index.html | 22 + .../storage_access_policy/errors/index.html | 24 + .../index.html" | 39 ++ .../privacy/storage_access_policy/index.html | 261 +++++++++ .../firefox/privacy/tracking_protection/index.html | 87 +++ .../zh-cn/mozilla/firefox/releases/1.5/index.html | 123 ++++ .../1.5/using_firefox_1.5_caching/index.html | 184 ++++++ files/zh-cn/mozilla/firefox/releases/12/index.html | 165 ++++++ files/zh-cn/mozilla/firefox/releases/14/index.html | 98 ++++ files/zh-cn/mozilla/firefox/releases/15/index.html | 122 ++++ files/zh-cn/mozilla/firefox/releases/16/index.html | 114 ++++ files/zh-cn/mozilla/firefox/releases/17/index.html | 146 +++++ files/zh-cn/mozilla/firefox/releases/18/index.html | 82 +++ files/zh-cn/mozilla/firefox/releases/19/index.html | 76 +++ files/zh-cn/mozilla/firefox/releases/20/index.html | 47 ++ files/zh-cn/mozilla/firefox/releases/21/index.html | 107 ++++ files/zh-cn/mozilla/firefox/releases/22/index.html | 89 +++ files/zh-cn/mozilla/firefox/releases/23/index.html | 94 ++++ files/zh-cn/mozilla/firefox/releases/24/index.html | 22 + files/zh-cn/mozilla/firefox/releases/25/index.html | 50 ++ .../releases/25/site_compatibility/index.html | 40 ++ files/zh-cn/mozilla/firefox/releases/26/index.html | 41 ++ .../releases/26/site_compatibility/index.html | 104 ++++ files/zh-cn/mozilla/firefox/releases/27/index.html | 45 ++ files/zh-cn/mozilla/firefox/releases/28/index.html | 117 ++++ .../releases/28/site_compatibility/index.html | 56 ++ .../zh-cn/mozilla/firefox/releases/3.6/index.html | 305 ++++++++++ files/zh-cn/mozilla/firefox/releases/3/index.html | 310 ++++++++++ .../releases/3/site_compatibility/index.html | 26 + files/zh-cn/mozilla/firefox/releases/31/index.html | 46 ++ files/zh-cn/mozilla/firefox/releases/32/index.html | 154 +++++ files/zh-cn/mozilla/firefox/releases/33/index.html | 38 ++ files/zh-cn/mozilla/firefox/releases/35/index.html | 213 +++++++ files/zh-cn/mozilla/firefox/releases/41/index.html | 209 +++++++ files/zh-cn/mozilla/firefox/releases/43/index.html | 173 ++++++ files/zh-cn/mozilla/firefox/releases/44/index.html | 222 ++++++++ files/zh-cn/mozilla/firefox/releases/45/index.html | 187 +++++++ files/zh-cn/mozilla/firefox/releases/49/index.html | 348 ++++++++++++ files/zh-cn/mozilla/firefox/releases/56/index.html | 129 +++++ files/zh-cn/mozilla/firefox/releases/59/index.html | 130 +++++ files/zh-cn/mozilla/firefox/releases/62/index.html | 187 +++++++ files/zh-cn/mozilla/firefox/releases/65/index.html | 128 +++++ files/zh-cn/mozilla/firefox/releases/68/index.html | 240 ++++++++ files/zh-cn/mozilla/firefox/releases/69/index.html | 185 ++++++ files/zh-cn/mozilla/firefox/releases/78/index.html | 116 ++++ files/zh-cn/mozilla/firefox/releases/index.html | 12 + .../mozilla/firefox/the_about_protocol/index.html | 163 ++++++ 69 files changed, 9246 insertions(+) create mode 100644 files/zh-cn/mozilla/firefox/australis_add-on_compat/index.html create mode 100644 files/zh-cn/mozilla/firefox/developer_edition/index.html create mode 100644 files/zh-cn/mozilla/firefox/enterprise_deployment/index.html create mode 100644 files/zh-cn/mozilla/firefox/experimental_features/index.html create mode 100644 files/zh-cn/mozilla/firefox/headless_mode/index.html create mode 100644 files/zh-cn/mozilla/firefox/index.html create mode 100644 files/zh-cn/mozilla/firefox/multiprocess_firefox/cross_process_object_wrappers/index.html create mode 100644 files/zh-cn/mozilla/firefox/multiprocess_firefox/debugging_frame_scripts/index.html create mode 100644 files/zh-cn/mozilla/firefox/multiprocess_firefox/faq/index.html create mode 100644 files/zh-cn/mozilla/firefox/multiprocess_firefox/index.html create mode 100644 files/zh-cn/mozilla/firefox/multiprocess_firefox/limitations_of_chrome_scripts/index.html create mode 100644 files/zh-cn/mozilla/firefox/multiprocess_firefox/limitations_of_frame_scripts/index.html create mode 100644 files/zh-cn/mozilla/firefox/multiprocess_firefox/message_manager/communicating_with_frame_scripts/index.html create mode 100644 files/zh-cn/mozilla/firefox/multiprocess_firefox/message_manager/frame_script_environment/index.html create mode 100644 files/zh-cn/mozilla/firefox/multiprocess_firefox/message_manager/frame_script_loading_and_lifetime/index.html create mode 100644 files/zh-cn/mozilla/firefox/multiprocess_firefox/message_manager/index.html create mode 100644 files/zh-cn/mozilla/firefox/multiprocess_firefox/message_manager/message_manager_overview/index.html create mode 100644 files/zh-cn/mozilla/firefox/multiprocess_firefox/message_manager/performance/index.html create mode 100644 files/zh-cn/mozilla/firefox/multiprocess_firefox/motivation/index.html create mode 100644 files/zh-cn/mozilla/firefox/multiprocess_firefox/tab_selection_in_multiprocess_firefox/index.html create mode 100644 files/zh-cn/mozilla/firefox/multiprocess_firefox/technical_overview/index.html create mode 100644 files/zh-cn/mozilla/firefox/multiprocess_firefox/which_uris_load_where/index.html create mode 100644 files/zh-cn/mozilla/firefox/privacy/index.html create mode 100644 files/zh-cn/mozilla/firefox/privacy/storage_access_policy/errors/index.html create mode 100644 "files/zh-cn/mozilla/firefox/privacy/storage_access_policy/errors/\347\246\201\347\224\250\345\244\226\351\203\250cookie/index.html" create mode 100644 files/zh-cn/mozilla/firefox/privacy/storage_access_policy/index.html create mode 100644 files/zh-cn/mozilla/firefox/privacy/tracking_protection/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/1.5/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/1.5/using_firefox_1.5_caching/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/12/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/14/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/15/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/16/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/17/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/18/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/19/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/20/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/21/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/22/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/23/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/24/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/25/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/25/site_compatibility/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/26/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/26/site_compatibility/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/27/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/28/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/28/site_compatibility/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/3.6/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/3/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/3/site_compatibility/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/31/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/32/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/33/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/35/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/41/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/43/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/44/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/45/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/49/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/56/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/59/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/62/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/65/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/68/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/69/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/78/index.html create mode 100644 files/zh-cn/mozilla/firefox/releases/index.html create mode 100644 files/zh-cn/mozilla/firefox/the_about_protocol/index.html (limited to 'files/zh-cn/mozilla/firefox') diff --git a/files/zh-cn/mozilla/firefox/australis_add-on_compat/index.html b/files/zh-cn/mozilla/firefox/australis_add-on_compat/index.html new file mode 100644 index 0000000000..0f0031c0f1 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/australis_add-on_compat/index.html @@ -0,0 +1,130 @@ +--- +title: Australis and add-on compatibility +slug: Mozilla/Firefox/Australis_add-on_compat +tags: + - 扩展 +translation_of: Mozilla/Firefox/Australis_add-on_compat +--- +
{{FirefoxSidebar}}
+ +

扩展程序的改变

+ +

我们已经移除了扩展程序的工具栏(包括状态栏)。您不应再依赖它的存在。已有一个填隙片会尝试迁移您的图标,但它可能不起作用或只能部分起作用。 最好的解决方案是更改按钮的位置。 这也许是一个很好的时机去考虑您的扩展程序是否真的需要在默认情况下对所有用户可见的工具栏按钮。使用扩展程序SDK开发的扩展程序不需要注意这次改变。

+ +

我们已经移除了应用(Firefox)菜单。 取而代之的是一个新的基于面板的菜单,可以用导航栏远端的一个按钮打开它。可以将工具栏项目拖进/拖出这个面板。

+ +

一些默认的工具栏按钮ID已更改,我们添加了一些新的ID,并且后退/前进按钮,URL栏,停止/重新加载按钮的顺序将不再可自定义。这也意味着用户不能用常规的自定义流程在这些按钮中添加新的(扩展程序提供的)按钮。

+ +

独立的暂停刷新按钮已被移除

+ +

我们正在更改工具栏按钮的添加方式。 虽然我们尝试保持某种向后兼容性,但是以下的 the following are deprecated and will be removed in the near future: the toolbar.insertItem 方法, toolbar.currentSet 属性, and the currentset 属性 on toolbars. If possible, please stop relying on them. Instead, you should use the CustomizableUI module.

+ +

CustomizableUI introduces a new API to insert, move and remove toolbar buttons and other toolbar items, as well as creating panels that are anchored to these toolbarbuttons. We believe this will be simpler and more powerful than the previous mix of APIs.

+ +

Because of the new customization APIs, your toolbar buttons may not be direct children of a XUL <toolbar>; they might still be in a toolbar, or they might be in the "customization target" of a toolbar (a descendant node in a toolbar), or they might be in the new menu panel. The customization target of any toolbar (whether the target is a child node, or the toolbar itself) via toolbar.customizationTarget.

+ +

Icon sizes in toolbars have changed, and you should ideally provide a larger icon for your add-on's buttons, should they exist, for use in the menu panel and customization area (palette). The new icon sizes are the same on all platforms and are:

+ + + +

When in the customization area (palette), the button will be wrapped in a toolbarpaletteitem with a place attribute set to palette. Putting it all together, your updated CSS might look like this:

+ +
#my-addon-button {
+    list-style-image: url(icon16.png);
+}
+#my-addon-button[cui-areatype="menu-panel"],
+toolbarpaletteitem[place="palette"] > #my-addon-button {
+    list-style-image: url(icon32.png);
+}
+
+/* High-resolution displays */
+@media (min-resolution: 2dppx) {
+    #my-addon-button {
+        list-style-image: url(icon32.png);
+    }
+    #my-addon-button[cui-areatype="menu-panel"],
+    toolbarpaletteitem[place="palette"] > #my-addon-button {
+        list-style-image: url(icon64.png);
+    }
+}
+
+ +

Tab markup and styling have changed. If your add-on affects the tabstrip or provides alternative visualizations of the tabstrip, changes tab colors, or anything else related to the tabstrip, you may want to verify that it still works.

+ +

The navigation toolbar is always visible (except in popup windows where a reduced navigation toolbar with the urlbar is visible) and can no longer be hidden e.g. for update pages or in-content UI. The related Add-on SDK module addon-page has been removed as it no longer has any effect.

+ +

Items in the navigation toolbar can be overflowed if the browser window is made too small. Items in the toolbar will be moved into the new "overflow panel" when this occurs. The overflow panel is anchored to a button that appears in the navigation toolbar when one or more items are overflowed. If your item should never be overflowed, set an overflows attribute to false on the item. The urlbar-container is not overflowable by default, for example. Items that are overflowed have the overflowedItem attribute set to true.

+ +

The menu panel uses a 3-column grid layout. Items should either fit in a single grid column (toolbarbuttons will be styled to do so automatically) or span the entire width of the panel if they wouldn't fit in a single grid column, e.g. for wide toolbaritems. In order to have the latter work correctly, you should use the panel-wide-item class on your toolbaritem.

+ +

If your add-on provides a <toolbarbutton type="menu"/> or <toolbarbutton type="menu-button"/>, consider moving to a subview-based design, which will work much better in the menu panel. There's some documentation you can look at, as well as the implementation of the history widget.

+ +

If your add-on provides a simple toolbarbutton then it should automatically be styled correctly in the menu panel, overflow panel and palette. If it provides a toolbaritem it is likely you will need to do additional work to make it look nice in places other than a toolbar.

+ +

All items will have context menus allowing users to move the items between the palette, panel and the navigation toolbar. If your add-on uses the contextmenu itself, we will not override or change it (see this bug for a lengthy discussion as to why). You are requested, however, to update your menus yourself so that users do have the possibility of using these options even for your add-on's button.

+ +

The class attribute on tab close buttons has been changed. Extensions shouldn't be relying on the class attribute value since it is a list of tokens and should instead look for the anonid attribute with value "close-button".

+ +

The close-icon class now works cross-platform to provide a close icon with a default, hover, and active state. Previously, this wasn't available on Linux and the GTK close icon (gtk-close) was used instead.

+ +

The BrowserToolboxCustomizeDone, BrowserToolboxCustomizeChange, and BrowserCustomizeToolbar global window functions have been removed. The customize events fired from the toolbox are now the preferred mechanism for hooking new logic into the customization feature.

+ +

Add-on SDK Australis APIs

+ +

If you're using the Add-on SDK, there are several new APIs for building your add-on's user interface in Australis. See the reference documentation. Also note that the widget module has been deprecated in favor of the new APIs.

+ +

Changes for themes

+ +

We've changed the tab markup. If you style these differently, you'll need to check whether it still works.

+ +

We'll be drawing tabs in the titlebar and on top, on all platforms (currently implemented on Windows and OS X), except when not showing tabs at all (in popup windows).

+ +

Support for small icons mode as well as text and icons mode have been removed.

+ +

We've changed the default iconsets, and there are new icon sizes for the menupanel. If you're building on the default theme with new icons, you'll need to rearrange your icons in your Toolbar icon files. In both this case and if you supply a complete theme, you will also need to provide icons for the menu panel. The new icon sizes are the same on all platforms and are:

+ + + +

We've removed the add-on bar, but have a shim in place to migrate icons to other places. Any styles pertaining to should be removed so as not to disturb the migration work.

+ +

We've changed a few toolbarbutton IDs, such as those for the bookmark and history buttons. We also added new ones.

+ +

The application (Firefox) menu has been removed.

+ +

The back, forward, stop and refresh buttons will no longer be movable. They will always remain in their current position next to the urlbar. Your CSS rules can probably be simplified now that this is the case.

+ +

The navigation toolbar can no longer be hidden e.g. for update pages or in-content UI.
+  

+ + + + + +

See Also

+ + diff --git a/files/zh-cn/mozilla/firefox/developer_edition/index.html b/files/zh-cn/mozilla/firefox/developer_edition/index.html new file mode 100644 index 0000000000..8764178a14 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/developer_edition/index.html @@ -0,0 +1,57 @@ +--- +title: 开发者版本 +slug: Mozilla/Firefox/Developer_Edition +translation_of: Mozilla/Firefox/Developer_Edition +--- +
{{FirefoxSidebar}}

+ +

一个为网页开发者量身定制的 Firefox。

+ +

下载 Firefox 开发者版本

+ +
+
+
+

最新的 Firefox 特性

+ +

Firefox 开发者版本会在 Firefox 发布流程中取代 Aurora 通道。像 Aurora 通道一样, 每 6 周新特性当它们在 Nightly 版本中稳定后,会登录到开发者版本中。

+ +

通过使用开发者版本,你将会比常规发布的 Firefox 提前至少 12 周体验到新的工具以及平台特性。

+ +

来看看开发者版本中有什么新的内容

+
+ +
+

实验性开发工具

+ +

我们还包含了一系列没有足够测试的实验性工具。

+ +

例如,开发者版本包含了 Firefox Tools Adapter,它可以帮你将 Firefox 开发工具 连接到其他平台的浏览器上,像 Android 上的 Chrome 以及 iOS 上的 Safari。

+
+
+ +
+
+

单独的配置文件

+ +

Firefox 开发版有自己一套单独的配置文件,这就意味着它不会影响你电脑里已经安装了的稳定版或者 Beta 版的 Firefox。

+
+ +
+

专为网页开发者而设

+ +

我们为网页开发者提供了量身的默认设置。例如,默认开启了 Chrome 以及远程调试功能。

+
+
+ +
+
+

一个独特的主题

+ +

这将让你更迅速地进入开发工具中。

+
+ +
 
+
+ +

 

diff --git a/files/zh-cn/mozilla/firefox/enterprise_deployment/index.html b/files/zh-cn/mozilla/firefox/enterprise_deployment/index.html new file mode 100644 index 0000000000..13d68ed3ce --- /dev/null +++ b/files/zh-cn/mozilla/firefox/enterprise_deployment/index.html @@ -0,0 +1,138 @@ +--- +title: 将火狐部署到企业环境下 +slug: Mozilla/Firefox/Enterprise_deployment +tags: + - 发布 企业环境 火狐 管理员手册 +translation_of: Mozilla/Firefox/Enterprise_deployment_before_60 +--- +
{{FirefoxSidebar}}

本页将为您介绍在企业配置环境下针对Mac OS X、Windows系统中火狐管理的整个流程。如您遇有不清楚的地方,请发送邮件至enterprise@mozilla.org

+ +

选择一个火狐的版本

+ +

 

+ +

快速发布版(RR)

+ +

火狐发布的每一个更新都会将主版本号增加,每6周便会发布新功能、Bug修复信息,如有必要,更新中也会加入额外的安全更新信息。当主版本更新后,Mozilla将不再提供上一版本的Bug修复。

+ +

具体更新发布计划请关注Mozilla wiki的版本更新日程表中的”发布日程”。

+ +

稳定版 (ESR)

+ +

火狐每隔7个主版本都会释出一个稳定版的发布内容。这些稳定发布的版本会将54周(9个“六周”一次的更新周期)以来一系列的bug进行修复。这两个版本中都会共同包含第12周(两个发布版本周期)的ESR更新内容。

+ +

到目前为止,扩展支持发布版本的版本号有10、17、24和31。

+ +

绝大多数企业以及组织机构更倾向与选择ESR版本,主要是因为稳定版发布间隔较长,以让各企业用户有充裕的时间对兼容性进行考核(ESR为42周,而RR则仅为6周),一旦在测试期间发现问题,用户也将拥有12周时间建立解决方案(每12周ESR版本会有重复发布)。

+ +

需要注意的是,如果您先使用RR后转为ESR较旧的版本时,将可能受到一些不利因素的影响。即便假设您此前使用的26RR版本火狐,和现改用24.2ESR版本发布于统一天,不同版本差异也会产生不利的因素。这是因为新功能仅会在RR版本发布前加入快速发布版进行评测,但由于一些原因Mozilla决定待功能到某一特定版本后才触发使用,在这之前都会在用户配置文件重将对应功能关闭。一旦您选择了旧版本火狐,用户文档保存的将是最后一次保存的文件,其中即可能设定新功能为启用的状态,进而导致在ESR版中功能失效。如果您执意要从RR过度到ESR版本,您需要等到最新的ESR发布版本释出后再这样做。

+ +

安装

+ +
    +
  1. http://www.mozilla.org/firefox/all/ (RR)或 https://www.mozilla.org/firefox/organizations/all.html (ESR)处获取发布版本安装包,单击“下载”按钮获取软件包或下载器;
  2. +
  3. 根据您选择的安装模式进行安装,命令行下静默安装的参数为 -ms;
  4. +
  5. 您也可以额外指定一个INI文件用以指定建立快捷方式等维护服务;具体请参照命令行安装参数章节中的相关内容.
  6. +
+ +

设置

+ +
    +
  1. 找到火狐的程序主文件夹,(Win7 64位操作系统默认安装位置是 C:\Program Files (x86)\Mozilla Firefox; OSX 10.8 则是默认安装在 /Applications/Firefox.app/Contents/MacOS。下文提到的这些子文件夹都在此程序主文件夹下;
  2. +
  3. 在defaults/pref子文件夹中新建一个Javascript文件 autoconfig.js 或者别的名字,但是建议您还是选用英文字母组合命名文件。该文件将告诉火狐查询对应的配置信息(具体请参考 自定义火狐的默认选项文件章节重的相关内容),您需要至少写入以下两行:
  4. +
  5. +
    pref("general.config.filename", "mozilla.cfg");
    +pref("general.config.obscure_value", 0);
    +
  6. +
  7. 新建.cfg文件,一般命名为mozilla.cfg,同样的它的文件名也可以用其它名字。它用于匹配识别general.config.filename的内容。将第一个语句跳过或注释掉后便可设置您的选项。具体都有哪些选项,您可参考about:config中的内容写入、或者您也可以参考后面的示例配置选项内容。任何about:config选项都可以通过以下函数之一进行设置: +
    +
     
    +
    pref
    +
    此选项可设置每次打开浏览器都按照此配置内容指定用户使用习惯。因此,即便用户在使用过程中可以随意更改偏好,但每次重新启动浏览器,用户之前的配置都将被抹消。如果您需要此方面的相关设置,请在about:config中查找“user set”。
    +
    defaultPref
    +
    此选项可用于修改默认值,但用户通常可以将其更改并将修改内容保存到用户会话中。如果用户偏好被重置,重置的内容将变为此设定值。此项目在about:config的“default”中。
    +
    lockPref
    +
    此选项可用于锁定指定项目,以防止用户在使用过程中通过界面或about:config对指定的配置选项进行修改。 通常锁定项的表现方式是变灰或移除选项内容。在about:config中则显示为“locked”。有一些选项必须通过lockPref设置比如app.update.enabled。如果只用pref设置该内容,该设置无效。
    +
    clearPref
    +
    此选项可以将某些指定的内容“放空”。此选项可以便于跳过某些网站的浏览器版本号检查功能。
    +
    +
  8. +
+ +

相关内容请您参考自定义火狐的自动配置文件以及继续自定义火狐的自动配置文件中的内容。如果您是倾向于零UI操作的狂热者,您可能需要用到CCK2这个扩展。

+ +

配置文件示例

+ +

如果您倾向于配置“极为复杂的用户偏好”,就请跳过这里。自火狐31版发布起,以下示例为您展示了常用的设置选项示例。如果您有某些指定的配置需求,请自行查询知识库中的信息。

+ +
//关闭更新器
+lockPref("app.update.enabled", false);
+//确认更新起已经绝对关闭
+lockPref("app.update.auto", false);
+lockPref("app.update.mode", 0);
+lockPref("app.update.service.enabled", false);
+
+//取消插件兼容性检查
+clearPref("extensions.lastAppVersion");
+
+//第一次运行火狐时不再提示“了解您的权益”
+pref("browser.rights.3.shown", true);
+
+//每次更新后不再显示更新发布注记
+pref("browser.startup.homepage_override.mstone","ignore");
+
+//修改主页地址(用户可改)
+defaultPref("browser.startup.homepage", "http://home.example.com");
+
+//关闭浏览器内默认的PDF阅读器
+pref("pdfjs.disabled", true);
+
+//关闭flash、js转换
+pref("shumway.disabled", true);
+
+//不再提示安装flash插件
+pref("plugins.notifyMissingFlash", false);
+
+//关闭插件提示
+lockPref("plugins.hide_infobar_for_outdated_plugin", true);
+clearPref("plugins.update.url");
+
+//关闭健康诊断报告
+lockPref("datareporting.healthreport.service.enabled", false);
+
+// Disable all data upload (Telemetry and FHR)
+lockPref("datareporting.policy.dataSubmissionEnabled", false);
+
+//关闭崩溃报告
+lockPref("toolkit.crashreporter.enabled", false);
+Components.classes["@mozilla.org/toolkit/crash-reporter;1"].getService(Components.interfaces.nsICrashReporter).submitReports = false; 
+
+ +

扩展包

+ +
    +
  1. 安装扩展,通过about:support找到该拓展对应的GUID;
  2. +
  3. 找到用户配置文件目录 (如win7的是:%APPDATA%\Mozilla\Firefox\Profiles , 在about:support中单击显示文件夹,然后在“扩展”下找到你需要的插件。插件文件可能是单独的xpi文件,或者是一个包含多个文件的目录。
  4. +
  5. 确定如何发布此扩展。最简单的方式是将xpi直接拽到程序主文件夹/distribution/extensions目录下,但是这仅限于用户配置文件已记录该插件的安装情况。您另外还可以手动打开火狐重新安装。具体请参考让插件与火狐合二为一的相关章节。
  6. +
+ +

Also keep in mind: Add-on scopes redux/

+ +

随时变化

+ +

目录结构的变化

+ +

到目前为止,火狐的目录结构已经变更过两次。如果您需要使用21版本以前的火狐,请注意以下的变化:

+ + + +

自动配置general.config.filenamegeneral.config.obscure_value可以在defaults/pref中完成,但文件名应该以英文字母‘a’开头,比如“autoconfig.js”

+ +

如果您的版本defaults/pref与插件设置相悖,您可以尝试将目录结构改为和新版一样。

+ +

ESR 24.x的变化(有Adobe PDF支持)

+ +

火狐RR19.x起将PDF查看器嵌入到自己内部来, 即便您已经将火狐配置了其它PDF视图软件,但嵌入支持直到24.x版本以后才开始启用。而内容类型描述也与Adobe文档的PDF文件不同,若要取消此功能,请您将前面示例中的pdfjs.disabled改为true即可。

diff --git a/files/zh-cn/mozilla/firefox/experimental_features/index.html b/files/zh-cn/mozilla/firefox/experimental_features/index.html new file mode 100644 index 0000000000..390a652feb --- /dev/null +++ b/files/zh-cn/mozilla/firefox/experimental_features/index.html @@ -0,0 +1,623 @@ +--- +title: Experimental features in Firefox +slug: Mozilla/Firefox/Experimental_features +tags: + - 实验的 + - 火狐 + - 特性 + - 设置 +translation_of: Mozilla/Firefox/Experimental_features +--- +
{{FirefoxSidebar}}

Mozilla发布了测试的nightly版本,用于测试新的浏览器特性。 实验性特性,例如所提议的可用的Web平台标准的实现。这个页面列出了Firefox Nightly中的一些新特性和启用方法等信息。在发布这些功能之前,你可以测试Web站点和应用程序,并确保一切都能与最新的Web技术功能协同工作。

+ +

你需要下载隔夜版或是开发者版,来测试下面这些实验性特性。

+ +

HTML

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
功能Firefox NightlyFirefox 开发者版Firefox 测试版Firefox 发行版Preference
日期和时间输入{{HTMLElement("input")}}为 日期时间 相关的输入类型提供的新用户界面开启
+ (从51开始支持, 从55开始默认开启)
开启
+ (从51开始支持)
关闭
+ (从51开始支持)
---dom.forms.datetime
{{HTMLElement("dialog")}}
+ 包含与之交互的DOM元素的对话框元素。Implementation of modal dialogs and accessibility still missing.
关闭
+ (从53开始支持)
关闭
+ (从53开始支持)
------dom.dialog_element.enabled
+ +

CSS

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
功能Firefox NightlyFirefox Developer EditionFirefox BetaFirefox ReleasePreference
SubgridsDisabledDisabledDisabledDisabledlayout.css.grid-template-subgrid-value.enabled
Display stray control characters in CSS as hex boxes
+ This feature renders control characters (Unicode category Cc) other than tab (U+0009), line feed (U+000A), form feed (U+000C), and carriage return (U+000D) as a hexbox when they are not expected.
4343DisabledDisabledlayout.css.control-characters.enabled or layout.css.control-characters.visible
Positioned CSS Masks
+ A subset of CSS Masks that includes longhand properties of CSS Masks, as well as a change in the shorthand property
515153DisabledControlled by a compile flag (MOZ_ENABLE_MASK_AS_SHORTHAND).
The font-display descriptor for @font-face
+ To improve Web fonts performance, {{cssxref("@font-face")}} has an experimental {{cssxref("@font-face/font-display", "font-display")}} descriptor.
关闭
+ (available since 46)
关闭
+ (available since 46)
关闭
+ (available since 46)
关闭
+ (available since 46)
layout.css.font-display.enabled
+

font-variation-settings 属性
+ {{cssxref("font-variation-settings")}} 提供了OpenType或TrueType字体印刷特点的低级别的控制, by specifying the four letter axis names of the features you want to vary, along with their variation values.

+
关闭
+ (available since 53)
关闭
+ (available since 53)
关闭
+ (available since 53)
关闭
+ (available since 53)
+

layout.css.font-variations.enabled
+ Functions only in Mac OS Sierra (and later).
+
+ For the downloadable fonts on axis-praxis, you also need gfx.downloadable_fonts.keep_variation_tables (in Firefox 54 and later)

+
touch-action CSS 属性
+ The {{cssxref("touch-action")}} CSS property is part of the {{SpecName("Pointer Events")}} specification and allows you to specify how and in what way the user is able to manipulate an object by touch.
50layout.css.touch_action.enabled
+

The shape-outside CSS property
+ The {{cssxref("shape-outside")}} CSS property is part of the {{SpecName("CSS Shapes")}} specification and allows you to specify a float area causing inline contents to wrap around a shape.

+ +

Firefox currently implements the <shape-box> values ({{bug(1309467)}}) as well as the circle() ({{bug(1311244)}}), ellipse() ({{bug(1326406)}}), and polygon() ({{bug(1326409)}}) functions.

+
关闭
+ (available since 53)
layout.css.shape-outside.enabled
The contain CSS property
+ The {{cssxref("contain")}} CSS property is part of the {{SpecName("CSS Containment")}} specification and allows you to indicate that an element and its contents are independent of the rest of the document tree, allowing {{Glossary("User agent", "user agents")}} to optimize the rendering of a page.
关闭
+ (available since 45)
关闭
+ (available since 45)
关闭
+ (available since 45)
关闭
+ (available since 45)
layout.css.contain.enabled
+

The column-span CSS property
+ The {{cssxref("column-span")}} CSS property is part of the {{SpecName("CSS3 Multicol")}} specification and allows you to specify how many columns an element spans across.

+ +

Firefox currently only parses the property ({{bug(1339298)}}), it's not actually implemented yet ({{bug(616436)}}).

+
关闭
+ (recognized since 55, but not implemented yet)
layout.css.column-span.enabled
The frames() timing function
+ See The frames() class of timing-functions for more details.
开启N/A关闭
+ (available since 55)
关闭
+ (available since 55)
None
+ +

JavaScript

+ +

See also ECMAScript Next support for implemented features of ECMAScript 2016 and later, that are not experimental and thus available without preferences in Firefox Release.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureFirefox NightlyFirefox Developer EditionFirefox BetaFirefox ReleasePreference
Additions to the ArrayBuffer object
+ Adds the {{jsxref("ArrayBuffer.transfer()")}} that returns a new ArrayBuffer whose contents have been taken from the oldBuffer's data (spec).
36DisabledDisabledDisabledNone
TypedObject objects (spec)EnabledDisabledDisabledDisabledNone
SIMD (specification and polyfill)EnabledDisabledDisabledDisabledNone
ECMAScript modules
+ Allows you to use native ECMAScript modules, for example defining modules with <script type="module">, defining fallback scripts with <script nomodule>, and importing code features that have been exported from modules.
DisabledDisabledDisabledDisableddom.moduleScripts.enabled
+ +

APIs

+ +

Canvas & WebGL

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureFirefox NightlyFirefox Developer EditionFirefox BetaFirefox ReleasePreference
WEBGL_debug_renderer_info extension
+ The {{domxref("WEBGL_debug_renderer_info")}} extension allows you to transmit information useful to help debugging problems to the server.
4242DisabledDisabledwebgl.enable-debug-renderer-info
OffscreenCanvas
+ The {{domxref("OffscreenCanvas")}} interface provides a canvas that can be rendered off screen. It is available in both the window and worker contexts.
Disabled
+ (available since 44)
Disabled
+ (available since 44)
Disabled
+ (available since 44)
Disabled
+ (available since 44)
gfx.offscreencanvas.enabled
Hit regions
+ Whether the mouse coordinates are within a particular area on the canvas is a common problem to solve. The hit region API allows you define an area of your canvas and provides another possibility to expose interactive content on a canvas to accessibility tools.
Disabled
+ (available since 30)
Disabled
+ (available since 30)
Disabled
+ (available since 30)
Disabled
+ (available since 30)
canvas.hitregions.enabled
+ +

DOM

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureFirefox NightlyFirefox Developer EditionFirefox BetaFirefox ReleasePreference
Mac上的WebVR API 1.1
+ WebVR API 允许你控制并和使用虚拟现实设备。
EnabledDisabledDisabledDisableddom.vr.enabled
游戏手柄扩展
+ The Gamepad Extensions provide access to additional functionality such as pose information in the case of WebVR controllers, and haptic actuator control (e.g. controller vibration hardware).
EnabledEnabledEnabledDisableddom.gamepad-extensions.enabled
Experimental fetch controller/signal/observer interfaces
+ Also known as "cancellable fetch", these interfaces contain functionality to allow fetch request operations to be observed and controlled during their lifetimes.
Disabled
+ (Available since 55)
DisabledDisabledDisableddom.fetchObserver.enabled and dom.fetchController.enabled (not in about:config by default; you must set them yourself).
FlyWeb
+ FlyWeb is a project at Mozilla focused on bringing a new set of APIs to the browser for advertising and discovering local-area web servers.
51DisabledDisabledDisableddom.flyweb.enabled
HTMLMediaElement.seekToNextFrame()
+ Part of an experimentation process around support non-real-time access to media for tasks including filtering, editing, and so forth, the {{domxref("HTMLMediaElement.seekToNextFrame()")}} advances the the current play position to the next frame in the media.
49
+ (Fundamental update in version 50)
49
+ (Fundamental update in version 50)
DisabledDisabledmedia.seekToNextFrame.enabled
GeometryUtils.getBoxQuads() ({{bug(917755)}})3131DisabledDisabledlayout.css.getBoxQuads.enabled
GeometryUtils.convertPointFromNode(),
+ GeometryUtils.RectFromNode(), and
+ GeometryUtils.convertQuadFromNode()
+ ({{bug(918189)}})
3131DisabledDisabledlayout.css.convertFromNode.enabled
Node.rootNode
+ The {{domxref("Node.rootNode")}} property returns a {{domxref("Node")}} object representing the topmost node in the tree, or the current node if it's the topmost node in the tree.
+ This feature is kept experimental as its naming poses Web compatibility problems. It will be renamed in the future.
4848DisabledDisableddom.node.rootNode.enabled
Performance Observer API
+ The {{domxref("PerformanceObserver")}} interface is used to observe performance measurement events and be notified of new performance entries as they are recorded in the browser's performance timeline.
49DisabledDisabledDisableddom.enable_performance_observer
WebVTT Regions API
+ WebVTT regions are parts of the video viewport that provide a rendering area for WebVTT cues. The {{domxref("VTTRegion")}} is the interface exposing the WebVTT cues.
+ This interface is considered to be in flux and isn't therefore activated in any version by default.
Disabled
+ (Experimental implementation since version 30)
DisabledDisabledDisabledmedia.webvtt.regions.enabled
音频和视频轨道支持
+ Implements {{domxref("HTMLMediaElement.audioTracks")}} and {{domxref("HTMLMediaElement.videoTracks")}}.
+ Firefox doesn't support multiple audio or video tracks, preventing the most common use cases for these properties to work properly. That's why these properties are not activated by default in any version.
Disabled
+ (Experimental implementation since version 33)
DisabledDisabledDisabledmedia.track.enabled
Better value for Event.timestamp
+ The property {{domxref("Event.timestamp")}} is returning a {{domxref("DOMHighResTimeStamp")}}, which is now relative to the Unix epoch.
32 (Windows)
+ 43 (Linux)
32 (Windows)
+ 43 (Linux)
DisabledDisabledmedia.track.enabled
指针事件50DisabledDisabledDisableddom.w3c_pointer_events.enabled
Pointer Events {{domxref("PointerEvent.tangentialPressure")}} and {{domxref("PointerEvent.twist")}}54DisabledDisabledDisableddom.w3c_pointer_events.enabled
Intersection Observer API
+ The {{domxref("Intersection Observer API")}} allows you to configure a callback that is called whenever one item, called a target, intersects either the device viewport or a specified element called.
Disabled
+ (available since 53)
dom.IntersectionObserver.enabled
Web Animations API: KeyframeEffect and KeyframeEffectReadOnly
+ The {{domxref("KeyframEffectReadOnly()", "KeyframeEffectReadOnly.KeyframeEffectReadOnly()")}} and {{domxref("KeyframeEffect()", "KeyframeEffect.KeyframeEffect()")}} constructors can be used to clone existing {{domxref("KeyframeEffectReadOnly")}} object instances by being given the object to clone as their only parameter (see {{bug(1273784)}}.)
5252DisabledDisabledNone
{{domxref("PromiseRejectionEvent")}} and related features
+ Providing a way to monitor and more finely control the rejection of Promises.
+  
Disabled
+ (available since 55)
DisabledDisabledDisableddom.promise_rejection_events.enabled
Payment Request API
+ 为网络支付提供的一个API。
Disabled
+ (available since 55)
Disabled
+ (available since 55)
Disabled
+ (available since 55)
Disabled
+ (available since 55)
dom.payments.request.enabled
+ +

WebRTC

+ + + + + + + + + + + + + + + + + + + + + + +
FeatureFirefox NightlyFirefox Developer EditionFirefox BetaFirefox ReleasePreference
TCP ICE candidates
+ ICE candidates that use TCP rather than UDP are considered during ICE negotiation.
+

Disabled
+ 41

+ +

Enabled
+ 54

+
Disabled
+ 41
Disabled
+ 41
Disabled
+ 41
media.peerconnection.ice.tcp
+ +

开发者工具

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureFirefox NightlyFirefox Developer EditionFirefox BetaFirefox ReleasePreference
Debugger rewrite in HTML5252DisabledDisableddevtools.debugger.new-debugger-frontend
Console rewrite in HTML52DisabledDisabledDisableddevtools.webconsole.new-frontend-enabled
Experimental Performance tool options
+ Enables options in the UI for JIT optimizations, memory, etc.
41DisabledDisabledDisableddevtools.performance.ui.experimental
Layout side panel
+ The Layout side panel allows to inspect and manage different CSS layout types like CSS Grid Layout.
Disabled
+ (available since 52)
Disabled
+ (available since 52)
Disabled
+ (available since 52)
Disabled
+ (available since 52)
devtools.layoutview.enabled
+ +

其他

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureFirefox NightlyFirefox Developer EditionFirefox BetaFirefox ReleasePreference
添加到主屏幕
+ The icons, name, short_name, and theme_color fields of the Web App Manifest (if present) can now be as the source of the homescreen/apps window icons, apps window title, homescreen icon title, and apps window color (respectively) for "Add to home screen" (Firefox Mobile only).
关闭
+ (available since 53)
关闭
+ (available since 53)
关闭
+ (available since 53)
关闭
+ (available since 52)
manifest.install.enabled
TLS 1.3开启开启关闭关闭security.tls.version.max to 4
+ +

See also

+ + diff --git a/files/zh-cn/mozilla/firefox/headless_mode/index.html b/files/zh-cn/mozilla/firefox/headless_mode/index.html new file mode 100644 index 0000000000..855339e6d1 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/headless_mode/index.html @@ -0,0 +1,270 @@ +--- +title: Headless mode +slug: Mozilla/Firefox/Headless_mode +translation_of: Mozilla/Firefox/Headless_mode +--- +
{{FirefoxSidebar}}
+ +

Headless模式是运行Firefox的一种非常有用的方式。就像听起来一样,Firefox正常运行,但没有任何可见UI组件。虽然不太适合浏览网页,但它对自动化测试非常有用。本文提供了有关运行 headless Firefox 的所有知识。

+ +

Using headless mode

+ +

This section provide usage instructions for headless mode.

+ +

Basic usage

+ +

You can run Firefox in headless mode from the command line, by including the -headless flag. For example:

+ +
/path/to/firefox -headless
+ +

Taking screenshots

+ +

Since Firefox 57, the -screenshot flag allows you to take screenshots of websites. The basic usage:

+ +
/path/to/firefox -headless -screenshot https://developer.mozilla.com
+ +

This creates a full-height screenshot of https://developer.mozilla.com, in the active directory called screenshot.png, with a viewport width of 800px.

+ +

You can omit -headless when using -screenshot, as it is implied:

+ +
/path/to/firefox -screenshot https://developer.mozilla.com
+ +

To override the default values, mentioned above, you can use the following flags/features:

+ + + +

For example, the following command creates a screenshot of https://developer.mozilla.com, in the active directory called test.jpg, with a viewport width of 800px, and a height of 1000px:

+ +
/path/to/firefox -screenshot test.jpg  https://developer.mozilla.com --window-size=800,1000
+ +

Browser support

+ +

Headless Firefox works on Fx55+ on Linux, and 56+ on Windows/Mac.

+ +

Automated testing with headless mode

+ +

The most useful way to use headless Firefox, is to run automated tests. You can make your testing process much more efficient.

+ +

Selenium in Node.js

+ +

Here we'll create a Selenium test, using Node.js and the selenium-webdriver package. For this guide, we'll assume that you already have basic familiarity with Selenium, Webdriver, and Node, and you already have a testing environment created. If now, work through our Setting up Selenium in Node guide, and return when you have.

+ +

First, confirm you've installed Node and the selenium-webdriver on your system. Then create a new file, called selenium-test.js, and follow the steps below to populate it with test code.

+ +
+

Note: Alternatively, you could clone our headless-examples repo. This also includes a package file, so you can just use npm install to install necessary dependencies.

+
+ +
    +
  1. +

    Let's add some code. Inside this file, start by importing the main selenium-webdriver module, and the firefox submodule:

    + +
    var webdriver = require('selenium-webdriver'),
    +    By = webdriver.By,
    +    until = webdriver.until;
    +
    +var firefox = require('selenium-webdriver/firefox');
    +
  2. +
  3. +

    Next, we create a new binary object representing Firefox Nightly, and add the -headless argument, so it will run in headless mode:

    + +
    var binary = new firefox.Binary(firefox.Channel.NIGHTLY);
    +binary.addArguments("-headless");
    +
  4. +
  5. +

    Now let's create a new driver instance for Firefox, using setFirefoxOptions() to include an options object, which specifies that we want to run the test using the above binary. This step will be unnecessary on Linux, and after headless mode lands in the release channel on Windows/Mac, but it is still useful if you want to test Nightly-specific features:

    + +
    var driver = new webdriver.Builder()
    +    .forBrowser('firefox')
    +    .setFirefoxOptions(new firefox.Options().setBinary(binary))
    +    .build();
    + +

    Alternatively, you can use options to set the binary and the headless arguments:

    + +
    var firefoxOptions = new firefox.Options();
    +firefoxOptions.setBinary('/path/to/binary');
    +firefoxOptions.headless();
    +
    +const driver = new webdriver.Builder()
    +   .forBrowser('firefox')
    +   .setFirefoxOptions(firefoxOptions)
    +   .build();
    +
    +
  6. +
  7. +

    Finally, add the following code, which performs a simple test on the Google search homepage:

    + +
    driver.get('https://www.google.com');
    +driver.findElement(By.name('q')).sendKeys('webdriver');
    +
    +driver.sleep(1000).then(function() {
    +  driver.findElement(By.name('q')).sendKeys(webdriver.Key.TAB);
    +});
    +
    +driver.findElement(By.name('btnK')).click();
    +
    +driver.sleep(2000).then(function() {
    +  driver.getTitle().then(function(title) {
    +    if(title === 'webdriver - Google Search') {
    +      console.log('Test passed');
    +    } else {
    +      console.log('Test failed');
    +    }
    +  });
    +});
    +
    +driver.quit();
    +
  8. +
  9. +

    Finally, run your test with following command:

    + +
    node selenium-test
    +
  10. +
+ +

That's it! After a few seconds, you should see the message "Test passed" returned in the console.

+ +

Headless Firefox in Node.js with selenium-webdriver, by Myk Melez, contains additional useful tips and tricks for running Node.js Selenium tests with headless mode.

+ +

Selenium in Java

+ +
+

Note: Thanks a lot to nicholasdipiazza for writing these instructions!

+
+ +

This guide assumes you already have Geckodriver on your machine, as explained in  Setting up Selenium in Node, and an IDE set up which supports Gradle projects.

+ +
    +
  1. +

    Download our headlessfirefox-gradle.zip archive (see the source here). Extract it, and import the headlessfirefox folder into your IDE, as a gradle project.

    +
  2. +
  3. +

    Edit the build.gradle file, to set selenium to a later version, if needed. At the time of writing, we used 3.5.3.

    + +
    group 'com.mozilla'
    +version '1.0'
    +
    +apply plugin: 'java'
    +
    +sourceCompatibility = 1.8
    +
    +repositories {
    +   mavenCentral()
    +}
    +
    +dependencies {
    +   compile('org.seleniumhq.selenium:selenium-api:3.5.3')
    +   compile('org.seleniumhq.selenium:selenium-remote-driver:3.5.3')
    +   compile('org.seleniumhq.selenium:selenium-server:3.5.3')
    +
    +   testCompile group: 'junit', name: 'junit', version: '4.12'
    +}
    +
  4. +
  5. +

    Edit the webdriver.gecko.driver property, in the HeadlessFirefoxSeleniumExample.java file, to equal the path where you installed geckodriver (see line 15 below).

    + +
    package com.mozilla.example;
    +
    +import org.openqa.selenium.By;
    +import org.openqa.selenium.WebElement;
    +import org.openqa.selenium.firefox.FirefoxBinary;
    +import org.openqa.selenium.firefox.FirefoxDriver;
    +import org.openqa.selenium.firefox.FirefoxOptions;
    +
    +import java.util.concurrent.TimeUnit;
    +
    +public class HeadlessFirefoxSeleniumExample {
    + public static void main(String [] args) {
    +   FirefoxBinary firefoxBinary = new FirefoxBinary();
    +   firefoxBinary.addCommandLineOptions("--headless");
    +   System.setProperty("webdriver.gecko.driver", "/opt/geckodriver");
    +   FirefoxOptions firefoxOptions = new FirefoxOptions();
    +   firefoxOptions.setBinary(firefoxBinary);
    +   FirefoxDriver driver = new FirefoxDriver(firefoxOptions);
    +   try {
    +     driver.get("http://www.google.com");
    +     driver.manage().timeouts().implicitlyWait(4,
    +         TimeUnit.SECONDS);
    +     WebElement queryBox = driver.findElement(By.name("q"));
    +     queryBox.sendKeys("headless firefox");
    +     WebElement searchBtn = driver.findElement(By.name("btnK"));
    +     searchBtn.click();
    +     WebElement iresDiv = driver.findElement(By.id("ires"));
    +     iresDiv.findElements(By.tagName("a")).get(0).click();
    +     System.out.println(driver.getPageSource());
    +   } finally {
    +     driver.quit();
    +   }
    + }
    +}
    +
  6. +
  7. +

    Run the java class, and you should see the HTML content of this page printed in your console/terminal.

    +
  8. +
+ +

Selenium in Python

+ +

This guide assumes you already have geckodriver on your machine, as explained in Setting up Selenium in Node.

+ +
    +
  1. +

    Install the latest version of the Python client for Selenium.

    +
  2. +
  3. +

    Edit the following, to set the executable_path on line 11, to the path where you installed geckodriver:

    + +
    from selenium.webdriver import Firefox
    +from selenium.webdriver.common.by import By
    +from selenium.webdriver.common.keys import Keys
    +from selenium.webdriver.firefox.options import Options
    +from selenium.webdriver.support import expected_conditions as expected
    +from selenium.webdriver.support.wait import WebDriverWait
    +
    +if __name__ == "__main__":
    +    options = Options()
    +    options.add_argument('-headless')
    +    driver = Firefox(executable_path='geckodriver', firefox_options=options)
    +    wait = WebDriverWait(driver, timeout=10)
    +    driver.get('http://www.google.com')
    +    wait.until(expected.visibility_of_element_located((By.NAME, 'q'))).send_keys('headless firefox' + Keys.ENTER)
    +    wait.until(expected.visibility_of_element_located((By.CSS_SELECTOR, '#ires a'))).click()
    +    print(driver.page_source)
    +    driver.quit()
    +
  4. +
  5. +

    Run the Python script, and you should see the HTML content of this page printed in your console/terminal.

    +
  6. +
+ +

Other testing solutions

+ + + +

In addition, you can use headless Firefox to run automated tests written in most other popular testing apps, as long as you are able to set environment variables.

+ +

Troubleshooting and further help

+ +

If you are having trouble getting headless mode to work, then do not worry — we are here to help. This section is designed to be added to as more questions arise, and answers are found.

+ + + +

If you want to ask the engineers a question, the best place to go is the #headless channel on Mozilla IRC. If you are pretty sure you've found a bug, file it on Mozilla Bugzilla.

+ +

See also

+ + diff --git a/files/zh-cn/mozilla/firefox/index.html b/files/zh-cn/mozilla/firefox/index.html new file mode 100644 index 0000000000..b0bc71f5b5 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/index.html @@ -0,0 +1,74 @@ +--- +title: Firefox +slug: Mozilla/Firefox +tags: + - Firefox + - Mozilla + - NeedsTranslation + - TopicStub +translation_of: Mozilla/Firefox +--- +
{{FirefoxSidebar}}
+ +

Firefox(非正式中文名称“火狐”)是Mozilla出品的网页浏览器,可用于Windows、Mac OS X、Linux等桌面操作系统,也可以用于Android等移动操作系统。得益于对最新的网络标准的广泛兼容和强有力的开发工具,Firefox对最终用户和开发者而言都是优秀的浏览器。

+ +

Firefox是一个开源项目,许多代码都是由志愿者社群提供的。在此你将了解如何为Firefox项目做贡献,你也可以找到关于制作附加组件、使用Firefox开发者工具等内容。

+ +
+

了解如何为 Firefox添加附加组件,如何开发和构建Firefox自身,以及了解Firefox以及其他组件内部如何运作。

+
+ + + +

Firefox 发布频道

+ +

Firefox 通过 5 个 发布频道 进行发布。

+ +

Firefox Nightly

+ +

每天晚上,我们都使用 mozilla-central 代码库中的最新代码构建的版本。这些版本适用于开发者或想要尝试最新的、处于活跃开发中的特性的使用者。

+ +

下载 Firefox Nightly

+ +

Firefox Developer Edition

+ +

这是一个为开发者量身定制的版本。每隔六周,我们便选择Firefox Nightly 频道中足够稳定的特性创建一个新版本的Firefox Developer Edition。同时我们还仅仅在该发布频道中为开发者添加一些特有的特性。

+ +

了解关于Firefox Developer Edition的更多信息

+ +

下载 Firefox Developer Edition

+ +

Firefox Beta

+ +

在Firefox Developer Edition停留六周之后,我们将选择足够稳定的特性构建一个新版本的 Firefox Beta 。Firefox Beta 版本适用于热衷于测试将在下一个Firefox 版本中推出的新特性的用户。

+ +

下载 Firefox Beta

+ +

Firefox

+ +

当在Beta频道中稳定六周之后,我们便发布新版本Firefox,将新特性推送至数亿用户。

+ +

下载 Firefox

+ +

Firefox 延长支持版 (ESR)

+ +

Firefox ESR 是在较长周期提供支持的桌面版本Firefox,适用于学校、大学、商业机构等组织以及需要延长支持用以进行大规模部署的用户。

+ +

了解关于 Firefox 延长支持版的更多信息

+ +

下载 Firefox ESR

+ +

Firefox 配置

+ +

如果你在日常中使用多个Firefox发行频道,或者多个不同的配置选项,你应该阅读了解如何通过Firefox的配置管理器与其他管理工具实现使用多个Firefox配置

diff --git a/files/zh-cn/mozilla/firefox/multiprocess_firefox/cross_process_object_wrappers/index.html b/files/zh-cn/mozilla/firefox/multiprocess_firefox/cross_process_object_wrappers/index.html new file mode 100644 index 0000000000..38fde2acbf --- /dev/null +++ b/files/zh-cn/mozilla/firefox/multiprocess_firefox/cross_process_object_wrappers/index.html @@ -0,0 +1,114 @@ +--- +title: 跨进程对象包装器 +slug: Mozilla/Firefox/Multiprocess_Firefox/Cross_Process_Object_Wrappers +translation_of: Mozilla/Firefox/Multiprocess_Firefox/Cross_Process_Object_Wrappers +--- +
{{FirefoxSidebar}}
+

本文档介绍了 Cross Process Object Wrappers (CPOWs),这使 chrome 代码能够同步访问多进程 Firefox 中的内容。

+
+ +

在多进程 Firefox 中,chrome 代码运行在与 Web 内容不同的另一个进程中。因此 chrome 代码不能直接与 Web 内容交互;相反,它必须考虑将与 Web 内容交互的脚本放在单独的脚本中,这被称为框架脚本(frame scripts),也称帧脚本。

+ +

Chrome 代码可以使用消息管理器加载框架脚本到内容进程,然后可以使用消息传递 API 与它们通信。有关于此的更多信息,详见 消息管理器 的使用文档。

+ +

Chrome 到内容的通信必须是异步的。这是因为 chrome 进程运行着 Firefox UI,因此如果被内容进程所影响,缓慢的内容进程可能致使 Firefox 对用户无响应。
+
+ 将同步代码转换成异步可能是困难并且耗时的。作为一个迁移的辅助,消息框架使框架脚本变成了内容对象,通过一个被称为 Cross Process Object Wrapper(简称 CPOW)的包装器,使其在 chrome 中可用。但是,尽管 CPOWs 很方便,它们存在严重的局限性并且可能导致响应性问题,因此只应在必要时使用,并仅作为迁移的辅助。

+ +

从框架脚本传递 CPOWs

+ +

框架脚本可以发送消息到 chrome,使用两个全局函数之一:sendAsyncMessage() 或者 sendSyncMessage()。这些函数的第三个可选参数是被包装的属性对象。举例来说,框架脚本在用户点击它时发送一个 DOM 节点到 chrome,并将 clicked 属性作为第三个参数:

+ +
// frame script
+addEventListener("click", function (event) {
+  sendAsyncMessage("my-e10s-extension-message", {}, { clicked : event.target });
+}, false);
+ +

在 chrome 脚本中,DOM 节点现在是通过 Cross Process Object Wrapper 访问,作为该消息的 objects  属性的个属性。chrome 脚本可以获得和设置包装的对象属性,以及调用它的函数:

+ +
// chrome script
+windowMM.addMessageListener("my-e10s-extension-message", handleMessage);
+
+function handleMessage(message) {
+  let wrapper = message.objects.clicked;
+  console.log(wrapper.innerHTML);
+  wrapper.innerHTML = "<h2>已被 chrome 修改!</h2>"
+  wrapper.setAttribute("align", "center");
+}
+ +

自动生成的 CPOWs

+ +

没有自我声明多进程兼容的附加组件会加载一些兼容性垫片。其中一个垫片提供了以下行为:每当 chrome 代码尝试直接访问内容(例如通过 window.content 或者 browser.contentDocument),提供一个包装了内容的 CPOW。这意味着下面这样的例子在多进程 Firefox 中也能正常工作。

+ +
gBrowser.selectedBrowser.contentDocument.body.innerHTML = "被 chrome 代码替换";
+ +

但仍然要记住,这是通过 CPOW 访问,并不是直接访问内容。

+ +

双向 CPOWs

+ +

一个常见的模式是 chrome 代码访问内容对象并添加事件监听器到那里。为了解决这个问题,CPOWs 是双向的。这意味着如果内容传递了一个 CPOW 到 chrome 进程,chrome 进程可以同步传递对象(如事件监听器函数)到 CPOW 中定义的函数。

+ +

这意味着你可以写这样的代码:

+ +
// frame script
+
+/*
+在 mouseover,发送 button 到 chrome 脚本,以一个CPOW形式。
+*/
+
+var button = content.document.getElementById("click-me");
+
+button.addEventListener("mouseover", function (event) {
+  sendAsyncMessage("my-addon-message", {}, { element : event.target });
+}, false);
+ +
// chrome script
+
+/*
+载入框架脚本,然后监听消息。
+在我们得到消息时,提取 CPOW 并添加一个函数作为监听器到按钮的 "click" 事件。
+*/
+
+  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("被点击了");
+    });
+  });
+
+ +

映射内容文档到 XUL 浏览器

+ +

一个常见的模式是获取 XUL <browser>,它对应一个内容文档。要做到这点, gBrowser.getBrowserForDocument  和 gBrowser.getBrowserForContentWindow 分别可以传递一个内容文档和内容窗口的 CPOW,并且返回这些文档 / 窗口所属的 XUL  <browser>。如果没有找到这样的浏览器,两者都是返回 null。

+ +

CPOWs 的限制

+ +

尽管 CPOWs 可以方便的使用,但它有几个主要的局限性,在下面列出。

+ +

CPOWs 与平台 API

+ +

你不能传递 CPOWs 到预期会收到 DOM 对象的平台 API。举例来说,你不能传递一个 CPOW  nsIFocusManager.setFocus()

+ +

Chrome 响应性

+ +

在 chrome 这边缺少同步 API 是有意的:因为 chrome 进程运行着 Firefox UI,任何响应性问题都将影响整个浏览器。在制成 chrome 进程与内容进程的过程中,CPOWs 打破了这个原则,并且致使内容进程可能使整个浏览器陷入无响应状态。

+ +

性能

+ +

尽管包装器看起来像是一个完全在 chrome 脚本范围下管控的对象,但它实际上只是一个到内容进程中一个对象的引用。在你访问一个包装器的属性时,它发送一个同步消息到内容进程及返回结果。这意味着它比使用一个对象慢很多倍。

+ +

消息顺序

+ +

CPOWs 可能违反你做出的有关消息排序的假设。考虑以下代码:

+ +
mm.addMessageListener("GotLoadEvent", function (msg) {
+  mm.sendAsyncMessage("ChangeDocumentURI", {newURI: "hello.com"});
+  let uri = msg.objects.document.documentURI;
+  dump("收到加载事件: " + uri + "\n");
+});
+
+ +

这发送了一个消息,要求框架脚本更改当前文档的 URI,然后通过一个 CPOW 访问当前的文档 URI。你可能预期 uri 的值得到设置的 "hello.com"。但这不一定:为了避免死锁,CPOW 消息可以绕过正常的消息并且被优先处理。对 documentURI 属性的请求有可能在 "ChangeDocumentURI" 的消息之前被处理,并因而 uri 持有它在更改之前的值。
+
+ 出于这个原因,最好不要混用 CPOWs 和正常的消息管理器消息。还有一个坏主意是将 CPOWs 用于任何安全相关,因为你可能获得不一致的结果,与使用消息管理器的相关代码。

diff --git a/files/zh-cn/mozilla/firefox/multiprocess_firefox/debugging_frame_scripts/index.html b/files/zh-cn/mozilla/firefox/multiprocess_firefox/debugging_frame_scripts/index.html new file mode 100644 index 0000000000..57c1b3412a --- /dev/null +++ b/files/zh-cn/mozilla/firefox/multiprocess_firefox/debugging_frame_scripts/index.html @@ -0,0 +1,53 @@ +--- +title: 调试框架脚本 +slug: Mozilla/Firefox/Multiprocess_Firefox/Debugging_frame_scripts +translation_of: Mozilla/Firefox/Multiprocess_Firefox/Debugging_frame_scripts +--- +
{{FirefoxSidebar}}
+

浏览器内容工具箱仅在 Firefox Nightly 中可用,并且仅在多进程模式下可用。

+
+ +

你可以使用浏览器内容工具箱来调试框架脚本。浏览器内容工具箱是一个单独的窗口,它包括一些共享的 Firefox 开发者工具,具体来说:控制台JavaScript 调试器,以及代码草稿纸 —— 但它们着重于浏览器的内容进程。这意味着你可以调试你的附加组件中的框架脚本。

+ +

打开浏览器内容工具箱

+ +

{{EmbedYouTube("Cg6X_zIu7Xk")}}

+ +

要打开浏览器内容工具箱,你需要:

+ + + +

你应该已经在 Firefox 菜单中 ”Web 开发者“的子菜单中看到”浏览器内容工具箱“(或者工具菜单,如果你显示了菜单栏,或者在 OS X)。它会打开一个单独的窗口:

+ +

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.

+ +

使用

+ +

{{EmbedYouTube("XF0ULNnNOxg")}}

+ +

调试器

+ +

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.

+ +

控制台

+ +

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/zh-cn/mozilla/firefox/multiprocess_firefox/faq/index.html b/files/zh-cn/mozilla/firefox/multiprocess_firefox/faq/index.html new file mode 100644 index 0000000000..3299dd0856 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/multiprocess_firefox/faq/index.html @@ -0,0 +1,18 @@ +--- +title: FAQ +slug: Mozilla/Firefox/Multiprocess_Firefox/FAQ +translation_of: Mozilla/Firefox/Multiprocess_Firefox/FAQ +--- +
{{FirefoxSidebar}}

使命

+ +

 

+ +

历史

+ +

 

+ +

方式

+ +

 

+ +

影响

diff --git a/files/zh-cn/mozilla/firefox/multiprocess_firefox/index.html b/files/zh-cn/mozilla/firefox/multiprocess_firefox/index.html new file mode 100644 index 0000000000..2936128948 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/multiprocess_firefox/index.html @@ -0,0 +1,78 @@ +--- +title: 多进程 Firefox +slug: Mozilla/Firefox/Multiprocess_Firefox +tags: + - NeedsTranslation + - TopicStub +translation_of: Mozilla/Firefox/Multiprocess_Firefox +--- +
{{FirefoxSidebar}}

在目前版本的桌面版 Firefox 中,整个浏览器运行在单个操作系统进程中。尤其是 JavaScript 在同一进程中运行着用户界面(UI,也称 "chrome 代码"),它还搭载着所有网页(也称“内容”,即“标签页”)。
+
+ 未来版本的 Firefox 将在单独的进程中运行浏览器界面,与网页内容的进程分离。这种架构的第一次迭代是所有浏览器标签页在同一个进程中运行,浏览器界面运行在另一个进程中。在未来的迭代中,我们期望有一个以上的内容进程。提供多进程 Firefox 的项目名为 Electrolysis,有时被简称为 e10s。

+ +

普通的网页不会受到多进程 Firefox 的影响。Firefox 本身和 Firefox 附加组件的开发者将受到影响,如果他们的代码依赖于能直接访问 Web 内容。

+ +

不同于此前的直接访问内容,chrome JavaScript 将使用消息管理器来访问内容。为了帮助缓解过渡期,我们实现了跨进程对象包装器(CPOW)和一些面向附加组件开发者的兼容性垫片。如果你是一名附加组件开发者并且想知道自己是否受到影响,参见多进程 Firefox 工作指南

+ +

多进程 Firefox 目前在 开发者版本 默认启用。

+ +
+
+
+
+
技术概述
+
高等层面看待多进程 Firefox 如何被实现。
+
术语表
+
多进程 Firefox 领域相关的术语参考。
+
消息管理器
+
完整的指南,在 chrome 与内容之间通信的对象。
+
基于 SDK 的附加组件
+
如何迁移使用 Add-on SDK 开发的附加组件。
+
各类 URI 在哪里加载
+
各类 URI 的快速指南:chrome:, about:, file:, resource: - 在哪个进程被加载。
+
+
+ +
+
+
动机
+
为什么我们要实现多进程的 Firefox:性能、安全和稳定性。
+
附加组件迁移指南
+
如果你是一名附加组件开发者,看看你的影响,以及如何更新你的代码。
+
跨进程对象包装器(CPOW)
+
Cross Process Object Wrappers 是一个迁移辅助,使 chrome 代码能够访问内容。
+
调试内容进程
+
如何调试运行在内容进程中的代码,包括框架和进程脚本。
+
多进程 Firefox 中的标签选择
+
多进程 Firefox 中如何切换标签页。
+
+
+
+ +
+
+
+
+
chrome 脚本的限制
+
哪些 chrome 代码的做法将不再有效,以及如何解决。
+
+
+ +
+
+
框架脚本的限制
+
哪些框架脚本的做法将不再有效,以及如何代替。
+
+
+
+ +
+

联系我们

+ +

有关此项目的更多信息、参与或提问。

+ + diff --git a/files/zh-cn/mozilla/firefox/multiprocess_firefox/limitations_of_chrome_scripts/index.html b/files/zh-cn/mozilla/firefox/multiprocess_firefox/limitations_of_chrome_scripts/index.html new file mode 100644 index 0000000000..130ce276e3 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/multiprocess_firefox/limitations_of_chrome_scripts/index.html @@ -0,0 +1,197 @@ +--- +title: chrome 脚本的限制 +slug: Mozilla/Firefox/Multiprocess_Firefox/Limitations_of_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.

+ +

兼容性垫片

+ +

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:

+ + + +

For each pattern we've noted:

+ + + +

gBrowser.contentWindow, window.content...

+ +

如果没有垫片

+ +

所有在 chrome 进程中的 API 提供的直接访问内容对象将不再工作。例如:

+ +
// chrome code
+
+gBrowser.contentWindow;                    // null
+
+gBrowser.contentDocument;                  // null
+
+gBrowser.selectedBrowser.contentWindow;    // null
+
+window.content;                            // null
+
+content;                                   // null
+
+ +

特别说明,docshells 存在于内容进程,因此它们也无法访问:

+ +
gBrowser.docShell;                         // null
+
+gBrowser.selectedBrowser.docShell;         // null
+ +

如果有垫片

+ +

在这些情况下,垫片为你通过一个 CPOW 提供内容对象。

+ +

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.

+ +

CPOW 的限制

+ +

跨进程对象包装器 (CPOWs) 是一个迁移辅助,给 chrome 代码带来同步访问内容对象的能力。但是,在使用它时也有各种限制

+ +

nsIContentPolicy

+ +

如果没有垫片

+ +

在多进程的 Firefox 上,你无法在 chrome  进程中使用 nsIContentPolicy,因为它需要接触网络内容。

+ +

如果有垫片

+ +

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.

+ +

为了使垫片不再必要,在内容进程中定义和注册 nsIContentPolicy。如果你需要确保该政策只注册一次,使用一个 process 脚本 来注册该政策。

+ +

nsIWebProgressListener

+ +

这个 API 在 chrome 进程中工作。有一个垫片让你可以访问传递到 onStateChange nsIWebProgress  对象的 DOMWindow 属性。但是,该 DOMWindow 是异步传递,因此在 chrome 进程收到时,DOM 可能已经改变了(例如,因为代码运行的内容进程已经修改它,或者我们已经导航到另一个页面)。

+ +

还要注意,不同于其他垫片,这个垫片始终有效。

+ +

我们正在努力修复此问题,见 bug 1118880

+ +

另外,你可以在内容进程中使用 nsIWebProgressListener

+ +

chrome 进程中的 Observers

+ +

根据不同的主题,你需要在 chrome 进程或者一个框架脚本中注册 observers。

+ +

对于大多数主题,你需要在 chrome 进程中注册 observers。

+ +

但是,你必须在一个框架脚本中监听 content-document-global-created and document-element-inserted。这些主题的 Observers 获取内容对象并作为 aSubject 参数到 observe(),因此通知不会发送到 chrome 进程。

+ +

有一个垫片会将两个主题转发到 chrome 进程,将 CPOWs 发送为 aSubject 参数。

+ +

HTTP 请求

+ +

你不能观测(observe)内容进程中的 HTTP 请求。如果这样做,你将得到一个错误。
+
+ 如果你在 chrome 进程中这样做,它一般会工作。observer 通知的主题将是一个 nsIHttpChannel,正如你所期望的。

+ +

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

或者这样:

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

+ +

DOM 事件

+ +

如果没有垫片

+ +

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.

+ +

如果有垫片

+ +

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
+ +
如果你需要在这时联系 chrome 进程,发送一个消息。
+ +
 
+ +

沙盒

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

+ +

你可以在你注册 about: URI 的代码中改变这个默认值。见 about: 和 chrome: URI

+
+ +

JavaScript 代码模块 (JSM)

+ +
在单进程的 Firefox 中,你可以使用 JavaScript 代码模块 (JSM) 来维持全局状态。在多进程的 Firefox 中,一个加载到某个进程的 JSM 不与加载到另一个进程的同样 JSM 共享状态:因此你不能使用一个 JSM 在 chrome 和内容进程之间共享状态。
+ +
 
+ +
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.
diff --git a/files/zh-cn/mozilla/firefox/multiprocess_firefox/limitations_of_frame_scripts/index.html b/files/zh-cn/mozilla/firefox/multiprocess_firefox/limitations_of_frame_scripts/index.html new file mode 100644 index 0000000000..d942067bd3 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/multiprocess_firefox/limitations_of_frame_scripts/index.html @@ -0,0 +1,101 @@ +--- +title: 框架脚本的限制 +slug: Mozilla/Firefox/Multiprocess_Firefox/Limitations_of_frame_scripts +translation_of: Mozilla/Firefox/Multiprocess_Firefox/Limitations_of_frame_scripts +--- +
{{FirefoxSidebar}}

框架脚本使用系统特权运行,并且能够访问 Components 对象,使它们能够使用 XPCOM 对象和 JSM。许多特权的 API 在内容进程中仍然工作。数据结构的处理仍将工作。XHR 和 Workers 仍将工作。但是,某些 API 在 chrome 进程中工作,但在框架脚本中将不工作。本文列出最重要的那些 API。

+ +

这是一对文章之一,另一篇是:chrome 脚本的限制

+ +

文件 I/O

+ +

你不应该从内容脚本写入或者读取磁盘,特别是配置文件目录。即使这是可能的,你也不应该这样做,应该预期它可能在任何时间停止工作。文件 I/O 应该全部放在 chrome 进程完成。例如:

+ + + +

XUL 和浏览器界面

+ +

任何试图接触界面或者与 XUL 相关的东西都很可能在内容进程中不工作。例如:

+ + + +

Services

+ +

某些服务不能在框架脚本中工作。

+ + + +

Chrome 窗口

+ +

任何需要使用 chrome 窗口的东西都不能在内容进程中工作。例如:

+ + + +

Places API

+ +

Places API 不能在框架脚本中使用。例如:

+ + + +

内容进程中的 Observers

+ +

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:

+ + + +

这些必须在内容进程中注册。

+ +

内容窗口到 chrome 窗口的 QI

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

+ +

默认情况下,使用 nsIAboutModule  注册的自定义的 about: 页面在 chrome 进程中加载。这意味着你不能从内容进程访问它们的内容(比如通过 XHR)。

+ +

你可以在注册 about: URI 的代码中更改这个默认值。见 about: 和 chrome: URI

+ +

JavaScript 代码模块 (JSM)

+ +
在多进程的 Firefox 中,一个加载到内容进程的 JSM 不予加载到 chrome 进程的同一个 JSM 共享任何状态。参考 chrome 脚本的限制 页面中的内容。
diff --git a/files/zh-cn/mozilla/firefox/multiprocess_firefox/message_manager/communicating_with_frame_scripts/index.html b/files/zh-cn/mozilla/firefox/multiprocess_firefox/message_manager/communicating_with_frame_scripts/index.html new file mode 100644 index 0000000000..9c8abfa1c9 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/multiprocess_firefox/message_manager/communicating_with_frame_scripts/index.html @@ -0,0 +1,205 @@ +--- +title: 与框架脚本通信 +slug: >- + Mozilla/Firefox/Multiprocess_Firefox/Message_Manager/Communicating_with_frame_scripts +translation_of: >- + Mozilla/Firefox/Multiprocess_Firefox/Message_Manager/Communicating_with_frame_scripts +--- +
{{FirefoxSidebar}}

Chrome 的代码与框架脚本的往来通信采用消息 API,它可以包含可 JSON 序列化的对象作为参数。

+ +

这个 API 大多是对称的,但有一个主要的例外:框架脚本可以发送同步或者异步消息到 chrome,但 chrome 只能发送异步消息到内容。这是一种有意的设计,是为了防止内容不响应而导致的 chrome 失去响应。
+
+ 在绝对必要时,框架脚本可以通过被称为 跨进程对象包装器(也称 CPOWs)的东西到达 chrome,并且 chrome 可以使用这些包装器来获得到内容对象的同步访问。

+ +

内容到 chrome

+ +

框架脚本可以选择发送同步消息或者异步消息到 chrome 代码。

+ +

异步消息

+ +

要发送异步消息,内容脚本应使用 sendAsyncMessage() 函数:

+ +
// frame script
+sendAsyncMessage("my-addon@me.org:my-e10s-extension-message");
+ +

sendAsyncMessage() takes one mandatory parameter, which is the name of the message. All messages share the same namespace, so to avoid conflicts with other code, you'll need to ensure that the names you use are unique. If you're using the message manager in an add-on, a good way to do that is to prefix messages with your add-on's ID.

+ +

After the name, you can pass detailed data as a string or a JSON-serializable object, and after that you can pass any objects it wants to pass to content as CPOWs.

+ +

The example below sends a message named "my-e10s-extension-message", with a data payload containing details and tag properties, and exposes the event.target object as a CPOW:

+ +
// frame script
+addEventListener("click", function (event) {
+  sendAsyncMessage("my-addon@me.org:my-e10s-extension-message", {
+    details : "they clicked",
+    tag : event.target.tagName
+  },
+  {
+     target : event.target
+  });
+}, false);
+ +

要接收来自内容的消息,一个 chrome 脚本需要使用消息管理器的 addMessageListener() API 添加消息监听器:
+
+ 传递给监听器的消息是一个对象,包含下列属性:

+ + + + + + + + + + + + + + + + + + + + + + + + +
name字符串,包含消息的名称。
sync布尔值,表示消息是否为同步发送,或者是异步发送。
dataJSON 对象,作为传递给 sendAsyncMessage() 的第二个参数。
target这是 XUL 的 <browser> 元素,来自消息发送的位置。
objectsAn object whose properties are any CPOWs exposed by the sender as the third argument to sendAsyncMessage()
+ +

在下面的例子中,监听器只是记录所有的消息细节;

+ +
// chrome script
+messageManager.addMessageListener("my-addon@me.org:my-e10s-extension-message", listener);
+
+function listener(message) {
+  console.log(message.name);
+  console.log(message.sync);
+  console.log(message.data);
+  console.log(message.target);
+  console.log(message.objects);
+}
+
+ +

So combining this message listener with the message above will give console output somewhat like this, when the user clicks a <div>:

+ +
"my-addon@me.org:my-e10s-extension-message"
+false
+Object { details: "they clicked", tag: "div" }
+<xul:browser anonid="initialBrowser" ... >
+{ target: <div#searchContainer> }
+
+ +

If your code requires access to a window (for example to run window.openDialog), and your message listener is run from somewhere without access to a window (e.g. an XPCOM component), you can access the window of the browser that sent the message with message.target.ownerDocument.defaultView.

+ +

同步消息

+ +

要发送一个同步消息,框架脚本应使用全局的 sendSyncMessage()  函数:

+ +
// frame script
+sendSyncMessage("my-addon@me.org:my-e10s-extension-message");
+ +

在一个 chrome 脚本收到一个同步消息时,它应该从它的消息监听器返回一个值:

+ +
// chrome script
+messageManager.addMessageListener("my-addon@me.org:my-e10s-extension-message", listener);
+
+function listener(message) {
+  return "value from chrome";
+}
+ +

This value is then presented to the frame script in the return value of sendSyncMessage(). Because a single message can be received by more than one listener, the return value of sendSyncMessage() is an array of all the values returned from every listener, even if it only contains a single value:

+ +
// frame script
+addEventListener("click", function (event) {
+  var results = sendSyncMessage("my-addon@me.org:my-e10s-extension-message", {
+    details : "they clicked",
+    tag : event.target.tagName
+  });
+  content.console.log(results[0]);    // "value from chrome"
+}, false);
+ +

Like arguments, return values from sendSyncMessage() must be JSON-serializable, so chrome can't return functions.

+ +

removeMessageListener()

+ +

要停止监听来自内容的消息,使用消息管理器的 removeMessageListener() 方法:

+ +
// chrome script
+messageManager.removeMessageListener("my-addon@me.org:my-e10s-extension-message", listener);
+ +

Chrome 到内容

+ +

要从 chrome 发送一个消息到内容,你需要知道你正在使用什么类型的消息管理器。如果它是一个浏览器消息管理器,你可以使用消息管理器的 sendAsyncMessage  方法:

+ +
// chrome script
+browser.messageManager.sendAsyncMessage("my-addon@me.org:message-from-chrome");
+ +

如果你有一个窗口或者全局消息管理器,你需要使用 broadcastAsyncMessage 方法:

+ +
// chrome script
+window.messageManager.broadcastAsyncMessage("my-addon@me.org:message-from-chrome");
+ +

These methods takes one mandatory parameter, which is the message name. All messages share the same namespace, so to avoid conflicts with other code, you'll need to ensure that the names you use are unique. If you're using the message manager in an add-on, a good way to do that is to prefix messages with your add-on's ID.

+ +

在消息名称后,你可以将详细的数据传递为一个字符串或者一个可 JSON 序列化的对象:

+ +
// chrome script
+messageManager.sendAsyncMessage("my-addon@me.org:message-from-chrome", {
+  details : "some more details"
+});
+ +

To receive a message from chrome, a frame script uses the global addMessageListener() function. This takes two parameters: the name of the message and a listener function. The listener will be passed a message object whose data property is the message payload:

+ +
// frame script
+function handleMessageFromChrome(message) {
+  var payload = message.data.details;      // "some more details"
+}
+
+addMessageListener("my-addon@me.org:message-from-chrome", handleMessageFromChrome);
+ +

message-manager-disconnect

+ +

If you're using a message manager to communicate with a script that may be running in a different process, you can listen for the message-manager-disconnect observer notification to know when the message manager has disconnected from the other end of the conversation, so you can stop sending it messages or expecting to receive messages.

+ +

For example, suppose we load a script into the current <browser> on some event, and keep the browser message manager in an array, so we can send it messages:

+ +
var messageManagers = [];
+
+...
+
+// on some event
+var browserMM = gBrowser.selectedBrowser.messageManager;
+browserMM.loadFrameScript("chrome://my-addon@me.org/content/frame-script.js", false);
+messageManagers.push(browserMM);
+console.log(messageManagers.length);
+ +

We can listen for message-manager-disconnect to update the array when the message managers disconnect (for example because the user closed the tab):

+ +
function myObserver() {
+}
+
+myObserver.prototype = {
+  observe: function(subject, topic, data) {
+    var index = messageManagers.indexOf(subject);
+    if (index != -1) {
+      console.log("one of our message managers disconnected");
+      mms.splice(index, 1);
+    }
+  },
+  register: function() {
+    var observerService = Cc["@mozilla.org/observer-service;1"]
+                          .getService(Ci.nsIObserverService);
+    observerService.addObserver(this, "message-manager-disconnect", false);
+    console.log("listening");
+  },
+  unregister: function() {
+    var observerService = Cc["@mozilla.org/observer-service;1"]
+                            .getService(Ci.nsIObserverService);
+    observerService.removeObserver(this, "message-manager-disconnect");
+  }
+}
+
+var observer = new myObserver();
+observer.register();
diff --git a/files/zh-cn/mozilla/firefox/multiprocess_firefox/message_manager/frame_script_environment/index.html b/files/zh-cn/mozilla/firefox/multiprocess_firefox/message_manager/frame_script_environment/index.html new file mode 100644 index 0000000000..8d5e9d287b --- /dev/null +++ b/files/zh-cn/mozilla/firefox/multiprocess_firefox/message_manager/frame_script_environment/index.html @@ -0,0 +1,104 @@ +--- +title: 框架脚本环境 +slug: Mozilla/Firefox/Multiprocess_Firefox/Message_Manager/Frame_script_environment +translation_of: Mozilla/Firefox/Multiprocess_Firefox/Message_Manager/Frame_script_environment +--- +
{{FirefoxSidebar}}

框架脚本的全局是 ContentFrameMessageManager,提供下列环境:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
contentThe DOM window of the content loaded in the browser. may be null (see below)
docShellThe nsIDocShell associated with the browser.
addEventListener()Listen to events from content.
removeEventListener()Stop listening to events from content.
addMessageListener()Listen to messages from chrome.
removeMessageListener()Stop listening to messages from chrome.
sendAsyncMessage()Send an asynchronous message to chrome.
sendSyncMessage()Send a synchronous message to chrome.
dump()Print a message to the console.
atob()Base64 decode.
btoa()Base64 encode.
ComponentsThe usual Components object.
+ +

特别注意,框架脚本使用 content 访问 DOM 窗口,而不是 window

+ +
// frame script
+var links = content.document.getElementsByTagName("a");
+ +

All the frame scripts running in a tab share this global. However, any top-level variables defined by a script are not stored on the global: instead, top-level variables are stored in a special per-script object that delegates to the per-tab global. This means you don't have to worry about global variables you define conflicting with global variables defined by another frame script. You can still access the global directly via this.

+ +

框架脚本使用系统主体运行。如果你想使用其他主题,可以使用 Sandbox

+ +

Frame scripts run with system privileges and have access to the Components object, enabling them to use XPCOM objects and JSMs. However, some APIs  that work in the chrome process will not work in a frame script. See Limitations of frame scripts for more details.

+ +

事件

+ +

Besides the regular DOM events being captured/bubbling up from content the current content object the following additional events get fired in a frame script environment:

+ + + + + + + + + + + + +
unload +
+
Bubbles
+
No
+
+ +

Fires when the frame script environment is shut down, i.e. when a tab gets closed.

+ +

If you use a capturing event listener on the ContentFrameMessageManager, you should verify that its event.target is set to the ContentFrameMessageManager global object in order to avoid handling unload events from content.

+
DOMWindowCreated +

Fires when a new content object is created.
+
+ This can be used if a framescript needs to interact with individual DOM windows instead of simply listening for events bubbling up from content.
+ Another use is to interact with the content very early in the page load process, long before DOMContentLoaded event is fired.
+  

+
+ +

 

diff --git a/files/zh-cn/mozilla/firefox/multiprocess_firefox/message_manager/frame_script_loading_and_lifetime/index.html b/files/zh-cn/mozilla/firefox/multiprocess_firefox/message_manager/frame_script_loading_and_lifetime/index.html new file mode 100644 index 0000000000..ee53fe52e2 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/multiprocess_firefox/message_manager/frame_script_loading_and_lifetime/index.html @@ -0,0 +1,124 @@ +--- +title: 框架脚本的加载与寿命 +slug: >- + Mozilla/Firefox/Multiprocess_Firefox/Message_Manager/Frame_script_loading_and_lifetime +translation_of: >- + Mozilla/Firefox/Multiprocess_Firefox/Message_Manager/Frame_script_loading_and_lifetime +--- +
{{FirefoxSidebar}}

加载框架脚本

+ +

要加载一个框架脚本,使用 loadFrameScript() 函数。

+ +

这行代码加载一个框架脚本到当前选中的标签页。该框架脚本只是将 "foo" 写入到命令行:

+ +
// chrome script
+var mm = gBrowser.selectedBrowser.messageManager;
+mm.loadFrameScript('data:,dump("foo\\n")', true);
+ +

loadFrameScript() 有两个强制性参数:

+ + + +

Note that if the message manager is a global frame message manager or a window message manager then loadFrameScript() may load the script multiple times, once into each applicable frame.

+ +

chrome: URL

+ +

扩展开发者通常会使用 chrome:// URL 来指向一个框架脚本。

+ +

要定义 chrome:// URL 的映射和将一个框架脚本打包到扩展中,使用 "chrome.manifest" 文件来 注册一个chrome URL

+ +
// chrome.manifest
+content my-e10s-extension content.js
+ +
// chrome script
+mm.loadFrameScript("chrome://my-e10s-extension/content/content.js", true);
+ +

allowDelayedLoad

+ +

如果消息管理器是一个 全局框架消息管理器 或者一个 窗口消息管理器,那么:

+ + + +

如果消息管理器是一个 浏览器消息管理器,你应该始终在这里传递 true。因为一个浏览器消息管理器永远只对应一个浏览器标签页,它的 loadFrameScript() 函数只加载框架脚本到一个标签页。因此传递 allowDelayedLoad 仅仅是一个方法来确保脚本被正确加载,在你的标签页在执行后还没有准备好时。

+ +

如果你使用 allowDelayedLoad,你可以使用 removeDelayedFrameScript 取消它:

+ +
var mm = window.messageManager;
+mm.removeDelayedFrameScript("chrome://my-e10s-extension/content/frame-script.js");
+ +

这意味着我们将停止加载脚本到新的标签页。请注意,此函数不会移除已经加载的任何脚本。

+ +

框架脚本的寿命

+ +

框架脚本将在 loadFrameScript() 被调用后尽快加载。如果你设置了 allowDelayedLoad,脚本将加载到一个新的标签页,一旦其已被创建。

+ +

框架脚本与浏览器的标签页相关联,而不是与页面。因此一旦你加载它们,它们就会持续存在,直至标签页被关闭,因此即便你重新加载或者文档重新导航也不会丢失。

+ +

如果你想一个框架脚本在每次新文档被加载后执行操作,你需要监听一个适当的 DOM 事件,通常是 DOMWindowCreated, DOMContentLoaded,  或者 load

+ +

卸载框架脚本

+ +

框架脚本会在托管它们的标签页被关闭时自动卸载。目前还没有办法在已加载它们的标签页之中卸载它们,除了关闭标签页。

+ +

若要监听你的框架脚本被卸载的事件(例如由于标签页被关闭),你必须将 addMessageListener 的第三个参数设置为 true,例如下面的 bootstrap.js 的代码:

+ +
Services.mm.addMessageListener(
+    'my-addon-id',
+    {
+        receiveMessage: function() {
+            console.log('incoming message from frame script:', aMsg.data);
+        }
+    },
+    true // must set this argument to true, otherwise sending message from framescript will not work during and after the unload event on the ContentMessageManager triggers
+);
+ +

and then in your frame script listen for the unload event of the message manager (which is the global this), and then send a message. If you did not set third argument to true in bootstrap.js on Services.mm.addMessageListener, then this send message during and after unload event, will do nothing.

+ +
var gContentFrameMessageManager = this;
+
+addEventListener('unload', function(aEvent) {
+    if (aEvent.target == gContentFrameMessageManager) {
+        sendAsyncMessage('my-addon-id', 'framescript-died'); // if you did not set third argument of `Services.mm.addMessageListener` to `true`, then this will fail to send a message
+    }
+}, false);
+ +

有关卸载/升级操作时的卸载

+ +

在你的附加组件被卸载或禁用时,你应该:

+ + + +
+
+

There is a bug in non-e10s where this oder is not true. In e10s framescripts work fine on updating. For non-e10s waiting for Bug 1202125 - framescripts are not backwards loaded in message order in non-e10s.

+
+ +

Note: you might think that there is a race condition here due to the asynchronous nature of the message passing:

+ + + +

In fact, the message manager guarantees that loadFrameScript and broadcastAsyncMessage are guaranteed to affect frame scripts in the order that they are called, so in this case "disable" will be received and consumed before the new frame scripts are loaded.

+
+ +

At the moment frame scripts are cached until the browser restarts: this problem is tracked as bug 1051238. This is especially a problem for restartless add-ons, because when a new version of the add-on is installed, the old frame scripts will not be unloaded. The workaround here is to randomize the frame script's URL, for example by appending "?" + Math.random() to it.

diff --git a/files/zh-cn/mozilla/firefox/multiprocess_firefox/message_manager/index.html b/files/zh-cn/mozilla/firefox/multiprocess_firefox/message_manager/index.html new file mode 100644 index 0000000000..be6ba855c9 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/multiprocess_firefox/message_manager/index.html @@ -0,0 +1,68 @@ +--- +title: 消息管理器 +slug: Mozilla/Firefox/Multiprocess_Firefox/Message_Manager +translation_of: Mozilla/Firefox/Multiprocess_Firefox/Message_Manager +--- +
{{FirefoxSidebar}}

消息管理器为 chrome 特权的 JavaScript 代码提供了跨进程边界的通信方式。它非常有用,可以允许 chrome 代码(包括浏览器自身的代码和外部代码)访问在单独的进程中运行的网页内容。

+ +

这些指南介绍了如何在多进程 Firefox 中使用消息管理器。

+ +

请注意,多进程 Firefox 的环境并非是必须的:这里描述的一切对单进程 Firefox 也同样有效,所以相同的代码在两个环境下都可以正常工作。

+ +
+

指南

+ +
+ + + +
+ +
+

API 参考资料

+ +
+ + + +
diff --git a/files/zh-cn/mozilla/firefox/multiprocess_firefox/message_manager/message_manager_overview/index.html b/files/zh-cn/mozilla/firefox/multiprocess_firefox/message_manager/message_manager_overview/index.html new file mode 100644 index 0000000000..fb85fa5e79 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/multiprocess_firefox/message_manager/message_manager_overview/index.html @@ -0,0 +1,442 @@ +--- +title: 消息管理器概述 +slug: Mozilla/Firefox/Multiprocess_Firefox/Message_Manager/Message_manager_overview +translation_of: Mozilla/Firefox/Multiprocess_Firefox/Message_Manager/Message_manager_overview +--- +
+

在多进程 Firefox 中有两个进程:

+ + + +

消息管理器的设计目的是使运行在一个进程中的 chrome 特权的 JavaScript 代码能够与不同进程中的 chrome 特权的 JavaScript 代码通信。

+ +

本文介绍了几种类型的消息管理器,如何访问它们,以及在一个较高层面你可以使用什么。

+
+ +

在顶层,有两种不同类型的消息管理器:

+ + + +

框架消息管理器

+ +

在多进程 Firefox 中,当 chrome 代码需要与网页内容交互时,它需要:

+ + + +
+

Some older articles on multiprocess Firefox and the message manager might refer to "content scripts" instead of "frame scripts", but this usage is deprecated because the Add-on SDK uses "content script" to refer to a similar but different kind of script.

+
+ +

因此从根本上,框架消息管理器使 chrome 代码能够:

+ + + +

有多种类型的框架消息管理器,如图所示:

+ +

+ +

This diagram shows the setup when there are 2 browser windows open, one with 2 tabs open and one with 1 tab open.

+ +

Chrome 进程

+ +

In the chrome process, there's a hierarchy of frame message managers: the global frame message manager, window message managers, and browser message managers.

+ +

全局框架消息管理器

+ + + + + + + + + + + + + + + + +
Description +

There's a single global frame message manager in the chrome process.

+ +

This operates on all frames, in all content tabs. If you load a frame script using the global frame message manager, the script gets loaded separately into every open tab: three times, in the diagram above. Similarly, if you send a message using the global frame message manager, it's received by all content tabs, and is then delivered to any frame scripts that are listening for it.

+ +

Its most important functions and attributes are:

+ +

childCount : contains the number of children (typically, browser windows)

+ +

getChildAt() : get the child at the given index

+ +

loadFrameScript() : load a frame script into every tab in the browser

+ +

broadcastAsyncMessage() : send a message to frame scripts

+ +

addMessageListener() : start listening to a specific message from all frame scripts

+ +

removeMessageListener() : stop listening to a specific message

+
Interfaces +

nsIFrameScriptLoader

+ +

nsIMessageListenerManager

+ +

nsIMessageBroadcaster

+
How to access +

Access it using Components.classes:

+ +
+// chrome script
+let globalMM = Cc["@mozilla.org/globalmessagemanager;1"]
+  .getService(Ci.nsIMessageListenerManager);
+
+ +

窗口消息管理器

+ + + + + + + + + + + + + + + + +
Description +

There's a window message manager for every browser window: two, in the diagram above.

+ +

It operates on all content tabs in a given window. If you load a frame script using the window message manager it gets loaded separately into each tab open in that particular window. If you send a message using the window message manager, it gets sent to all content tabs in that window.

+ +

Its most important functions and attributes are:

+ +

childCount : contains the number of children (typically, browser tabs)

+ +

getChildAt() : get the child at the given index

+ +

loadFrameScript() : load a frame script into every tab in this window

+ +

broadcastAsyncMessage() : send a message to all frame scripts in this window

+ +

addMessageListener() : start listening to a specific message from frame scripts

+ +

removeMessageListener() : stop listening to a specific message

+
Interfaces +

nsIFrameScriptLoader

+ +

nsIMessageListenerManager

+ +

nsIMessageBroadcaster

+
How to access +

You can access it as a property of the browser window:

+ +
+// chrome script
+let windowMM = window.messageManager;
+
+ +

浏览器消息管理器

+ +
+

Note that in this context, "browser" refers to the XUL <browser> object, which is a frame that hosts a single Web document. It does not refer to the more general sense of a Web browser.

+
+ + + + + + + + + + + + + + + + +
Description +

Finally, there's a browser message manager for every open content tab: three, in the diagram above.

+ +

This corresponds one-to-one with a content tab. Scripts you load using a browser message manager are loaded only into that content tab, and messages you send are delivered only to that content tab.

+ +

You can mix and match: so for example, you could load a script into every tab using the global message manager, but then send a message to the script instance loaded into a specific tab by using the browser message manager.

+ +

Its most important functions are:

+ +

loadFrameScript() : load a frame script into this browser frame (tab)

+ +

sendAsyncMessage() : send a message to all frame scripts in this browser frame

+ +

addMessageListener() : start listening to a specific message from frame scripts

+ +

removeMessageListener() : stop listening to a specific message

+
Interfaces +

nsIProcessChecker

+ +

nsIFrameScriptLoader

+ +

nsIMessageListenerManager

+ +

nsIMessageSender

+
How to access +

The browser message manager can be accessed as a property of the XUL <browser> element:

+ +
+// chrome script
+let browserMM = gBrowser.selectedBrowser.messageManager;
+
+ +

内容进程

+ +

内容框架消息管理器

+ + + + + + + + + + + + + + + + +
Description +

There's a content frame message manager for every open tab. It's the content-side end of frame message manager conversations.

+ +

Frame scripts are loaded into the content frame message manager scope, and messages from chrome message managers end up here.

+ +

The content frame message manager provides the global object for frame scripts (but note that there is trickery to ensure that top-level variables defined by frame scripts are not shared).

+ +

Frame scripts can use this object to send messages to the chrome process, and to receive messages from the chrome process.

+ +

Its most important attributes and functions are:

+ +

content : access the DOM window hosted by the tab

+ +

docShell : access the top-level docshell

+ +

Components : access privileged objects and APIs

+ +

addEventListener() : listen to DOM events

+ +

addMessageListener() : receive messages from the chrome process

+ +

sendAsyncMessage() : send asynchronous messages to the chrome process

+ +

sendSyncMessage() : send synchronous messages to the chrome process

+
Interfaces +

nsIDOMEventTarget

+ +

nsIMessageListenerManager

+ +

nsIMessageSender

+ +

nsISyncMessageSender

+ +

nsIContentFrameMessageManager

+
How to accessThe content frame message manager is the global object in frame scripts.
+ +

进程消息管理器

+ +

Process message managers correspond to process boundaries, and enable code running in different processes to communicate. Multiprocess Firefox has the concept of:

+ + + +

For practical purposes, in multiprocess Firefox the parent process is the chrome process, and child processes are content processes. 

+ +

In each child process, there's a single child process message manager (CPMM). There's also an additional child-in-process message manager (CIPMM) in the parent process.

+ +

For each child process message manager, there's a parent process message manager (PPMM) in the parent process.

+ +

There's also a single global parent process message manager (GPPMM) in the parent process, that provides access to all the parent process message managers. The diagram below shows the setup that would result from having two child processes:

+ +

+ +

With the GPPMM, you can broadcast messages to the CIPMM and all CPMMs. With a PPMM, you can send a message to its corresponding CPMM. With a CPMM, you can send messages to the parent process: these messages are received first by the corresponding PPMM, then by the GPPMM.

+ +

From Firefox 38 onwards, you can also use a parent process message manager to load a script into a child process. This is the recommended way to load a script that executes just once per child process, which is something you might want to do if you are interacting with some global service (for example, adding listeners to observer notifications or registering a content policy).

+ +

父消息管理器

+ +

全局父进程消息管理器

+ + + + + + + + + + + + + + + + +
Description +

The global parent process message manager (GPPMM) is global to the parent process.

+ +
    +
  • Messages sent using the GPPMM get sent to all CPMMs in all child processes.
  • +
  • Process scripts loaded using the GPPMM get loaded in all child processes.
  • +
+ +

Its most important functions and attributes are:

+ +

childCount : contains the number of children (child processes, plus the in-content child)

+ +

getChildAt() : get the child at the given index

+ +

loadProcessScript() : load a process script into every content process

+ +

broadcastAsyncMessage() : send a message to all process scripts

+ +

addMessageListener() : start listening to a specific message from process scripts

+ +

removeMessageListener() : stop listening to a specific message

+
Interfaces +

nsIProcessScriptLoader

+ +

nsIMessageListenerManager

+ +

nsIMessageBroadcaster

+
How to access +

You can access the GPPMM with code like this:

+ +
+// parent process
+let ppmm = Cc["@mozilla.org/parentprocessmessagemanager;1"]
+           .getService(Ci.nsIMessageBroadcaster);
+ +

You can also access it as the ppmm property of Services.jsm, if you are in the parent process.

+
+ +

父进程消息管理器

+ + + + + + + + + + + + + + + + +
Description +

There's one parent process message manager (PPMM) in the parent process for every child process, and its API is oriented to that one child process.

+ +
    +
  • Messages sent using the PPMM are received only by the corresponding CPMM
  • +
  • Scripts loaded using the PPMM are loaded only into the corresponding child process.
  • +
+ +

Its most important functions are:

+ +

loadProcessScript() : load a process script into the content process

+ +

broadcastAsyncMessage() : send a message to process scripts

+ +

addMessageListener() : start listening to a specific message from process scripts

+ +

removeMessageListener() : stop listening to a specific message

+
Interfaces +

nsIProcessChecker

+ +

nsIProcessScriptLoader

+ +

nsIMessageListenerManager

+ +

nsIMessageSender

+
How to access +

You can access a PPMM using the getChildAt() function in the GPPMM:

+ +
+// parent process
+let ppmm = Services.ppmm.getChildAt(1);
+
+ +

子进程

+ +

子进程消息管理器

+ + + + + + + + + + + + + + + + +
Description +

There's one child process message manager (CPMM) in each child process. Messages sent using the CPMM are sent to the corresponding PPMM and are also relayed to the GPPMM.

+ +

Its most important attributes and functions are:

+ +

Components : access privileged objects and APIs

+ +

addMessageListener() : receive messages from the parent process

+ +

sendAsyncMessage() : send asynchronous messages to the parent process

+ +

sendSyncMessage() : send synchronous messages to the parent process

+
Interfaces +

nsIMessageListenerManager

+ +

nsIMessageSender

+ +

nsISyncMessageSender

+ +

nsIContentProcessMessageManager

+
How to access +

Code running in a child process can access the CPMM with code like this:

+ +
+// child process script
+let cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"]
+           .getService(Ci.nsISyncMessageSender);
+ +

You can also access it as the cpmm property of Services.jsm, if you are in the child process.

+
diff --git a/files/zh-cn/mozilla/firefox/multiprocess_firefox/message_manager/performance/index.html b/files/zh-cn/mozilla/firefox/multiprocess_firefox/message_manager/performance/index.html new file mode 100644 index 0000000000..3bcb04d88e --- /dev/null +++ b/files/zh-cn/mozilla/firefox/multiprocess_firefox/message_manager/performance/index.html @@ -0,0 +1,292 @@ +--- +title: 性能 +slug: Mozilla/Firefox/Multiprocess_Firefox/Message_Manager/Performance +translation_of: Mozilla/Firefox/Multiprocess_Firefox/Message_Manager/Performance +--- +
{{FirefoxSidebar}}

着重讲几点框架脚本/消息管理器的使用方式和替代方法,以避免相关的性能缺陷。

+ +

要牢记几点:

+ + + +
+

下面的例子为了简洁,省略了一些样板代码

+ +

“更好”的例子还省略了一些最佳实践。只是为了演示如何解决各子主题中描述的问题。

+
+ +

性能的最佳实践

+ +

每个进程中声明无状态函数

+ +

不良:

+ +
// addon.js
+Services.mm.loadFrameScript("framescript.js", true)
+
+ +
// framescript.js
+
+const precomputedConstants = // ...
+
+function helper(window, action) {
+  // ...  do some work on the window
+}
+
+function doSomething(message) {
+  result = helper(content, message.data)
+  sendAsyncMessage("my-addon:response-from-child", {something: result})
+}
+
+addMessageListener("my-addon:request-from-parent", doSomething)
+
+ +

 

+ +

Why is this bad? Because declared functions are also objects. And since frame scripts get evaluated for each tab this means new function objects get instantiated, new constants get computed, block scopes must be set up etc.

+ +

While it may seem fairly innocencous in this toy example, real scripts often have a lot more functions and initialize some fairly heavyweight objects.

+ +

更好:

+ +

addon.js 如上

+ +
// framescript.js
+Components.utils.import("resource://my-addon/processModule.jsm", {}).addFrame(this)
+
+ +
// processModule.jsm
+
+const EXPORTED_SYMBOLS = ['addFrame'];
+
+const precomputedConstants = // ...
+
+function helper(window, action) {
+  // ... do some work on the window
+}
+
+function doSomething(message) {
+  frameGlobal = message.target
+  result = helper(frameGlobal.content, message.data)
+  frameGlobal.sendAsyncMessage("my-addon:response-from-child", {something: result})
+}
+
+function addFrame(frameGlobal) {
+  frameGlobal.addMessageListener("my-addon:request-from-parent", doSomething)
+}
+
+ +

Javascript modules are per-process singletons and thus all their objects are only initialized once, which makes them suitable for stateless callbacks.
+
+ But care must be taken to not leak references to the frame script global when it is passed into a JSM. Alternatively the frame's unload event or weak maps can be used to ensure that frames can be cleaned up when their respective tab is closed.

+ +

每个进程中存放重量级的状态

+ +

不良:

+ +
// addon.js
+var main = new MyAddonService();
+
+main.onChange(stateChange);
+
+function stateChange() {
+  Services.mm.broadcastAsyncMessage("my-addon:update-configuration", {newConfig: main.serialize()})
+}
+
+ +
// framescript.js
+var mainCopy;
+
+function onUpdate(message) {
+   mainCopy = MyAddonService.deserialize(message.data.newConfig);
+}
+
+addMessageListener("my-addon:update-configuration", onUpdate)
+
+
+// mainCopy used by other functions
+
+ +

The main issue here is that a separate object is kept for each tab. Not only does that increase memory footprint but the deserialization also has to be executed seperately for each tab, thus requiring more CPU time.

+ +

不良:

+ +
// addon.js
+var main = new MyAddonService();
+
+main.onChange(stateChange);
+
+function stateChange() {
+  Services.ppmm.broadcastAsyncMessage("my-addon:update-configuration", {newConfig: main.serialize()})
+}
+ +
// processModule.jsm
+const EXPORTED_SYMBOLS = ['getMainCopy'];
+
+var mainCopy;
+
+Services.cpmm.addMessageListener("my-addon:update-configuration", function(message) {
+  mainCopy = message.data.newConfig;
+})
+
+funtion getMainCopy() {
+  return mainCopy;
+}
+
+
+ +
// framescript.js
+Components.utils.import("resource://my-addon/processModule.jsm")
+
+// getMainCopy() used by other functions
+
+ +

 

+ +

不要在框架脚本中注册观察者(及其他到全局服务的回调)

+ +

不良:

+ +
//framescript.js
+Services.obs.addObserver("document-element-inserted", {
+  observe: function(doc, topic, data) {
+     if(doc.ownerGlobal.top != content)
+        return; // bail out if  this is for another tab
+     decorateDocument(doc);
+  }
+})
+ +

Observer notifications get fired for events that happen anywhere in the browser, they are not scoped to the current tab. If each framescript registers a seperate listener then the observed action will trigger the callbacks in all tabs.

+ +

Additionally the example above does not clean unregister itself, thus leaking objects each time a tab is closed. Frame message manager  message and event listeners are limited in their lifetime to that of the frame itself, this does not apply  to observer registrations.

+ +

更好:

+ +

     

+ +
+
content-document-global-created 通知
+
可以用 DOMWindowCreated 事件取代
+
其他观察者和服务
+
应该在 进程脚本 中注册,或者用 JSM 代替
+
+ +

 

+ +

根据需要加载框架脚本

+ +

不良:

+ +
// addon.js
+Services.mm.loadFrameScript("framescript.js", /*delayed:*/ true)
+
+// stuff communicating with the framescript
+
+ +
// framescript.js
+function onlyOnceInABlueMoon() {
+   // we only need this during a total solar eclipse while goat blood rains from the sky
+   sendAsyncMessage('my-addon:paragraph-count', {num: content.document.querySelectorAll('p').length})
+}
+addMessageListener("my-addon:request-from-parent", onlyOnceInABlueMoon)
+
+ +

更好:

+ +
// addon.js
+function onToolbarButton(event) {
+  let tabMM = gBrowser.mCurrentBrowser.frameLoader.messageManager;
+  let button = event.target;
+  let callback = (message) => {
+    tabMM.removeMessageListener("my-addon:paragraph-count", callback)
+    decorateButton(button, message.data.num)
+  }
+  tabMM.addMessageListener("my-addon:paragraph-count", callback);
+  tabMM.loadFrameScript("data:,sendAsyncMessage('my-addon:paragraph-count', {num: content.document.querySelectorAll('p').length})", false)
+}
+
+function decorateButton(button, count) {
+  // do stuff with result
+}
+
+ +

This executes the script only when it is needed and only in one tab and allows it to be garbage-collected immediately after execution.  As long as it the action does not happen frequently the memory and startup savings should outstrip the added cost of script evaluation.

+ +

Delaying the script registration until the session is restored my provide some middle ground for some addons. It does not provide the same memory footprint reductions but it improves application startup.

+ +

 

+ +

向下推进信息,避免到父进程的调用

+ +

不良:

+ +
// processscript.js
+
+function ContentPolicy() {
+  // ...
+}
+
+Object.assign(ContentyPolicy.prototype, {
+    classDescription: ..., classID: ..., contractID: ...,
+    QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPolicy]),
+
+    shouldLoad: function(type, location, origin, context) {
+
+       let resultList = Services.cpmm.sendSyncMessage("my-addon:check-load", {destination: location, source: origin}) // <=== SYNC MESSAGE!
+
+       if(resultList.every((r) => r == true))
+           return Ci.nsIContentPolicy.ACCEPT;
+
+       return Ci.nsIContentPolicy.REJECT_REQUEST;
+    }
+});
+
+// more boilerplate code here
+
+ +

This example is a (somewhat condensed) content policy which gets triggered for every network request in a child process to either allow or deny the request. Since the code calls to the parent process to check whether a specific request can be allowed it would slow down all page loads, as web pages generally issue dozens of requests.

+ +

更好:

+ +

Instead of only keeping the state in the parent an addon can employ a master-slave architecture where the parent has the authoritative state and replicates it to the child processes in advance so they can act based on their local copy.

+ +

See the previous chapter on how to efficiently replicate addon state to each process.

+ +

 

+ +

 

+ +

附加组件卸载时的清理

+ +

 

+ +

不良:

+ +

包括上述所有例子,*包括上述的“更好”*

+ +

If your addon is restartless or uses the SDK then updates or the user turning it off and on will load to unload/reload events. Not handling those properly can lead to duplicate or conflicting code execution, especially when messages are sent. It can also lead to conflicts between the old and new code. Under some circumstances it may even cause exceptions when attempting to register something twice under the same ID.

+ +

更好:

+ +
// addon.js
+function onUnload() {
+  Services.mm.removeDelayedFrameScript("resources://my-addon/framescript.js");
+  Services.ppmm.removeDelayedProcessScript("resources://my-addon/processcript.js");
+  Services.mm.broadcastAsyncMessage("my-addon:unload");
+  Services.ppmm.broadcastAsyncMessage("my-addon:unload");
+}
+
+ +

在框架/进程脚本中:

+ + diff --git a/files/zh-cn/mozilla/firefox/multiprocess_firefox/motivation/index.html b/files/zh-cn/mozilla/firefox/multiprocess_firefox/motivation/index.html new file mode 100644 index 0000000000..7ae3c2aaef --- /dev/null +++ b/files/zh-cn/mozilla/firefox/multiprocess_firefox/motivation/index.html @@ -0,0 +1,44 @@ +--- +title: 动机 +slug: Mozilla/Firefox/Multiprocess_Firefox/Motivation +translation_of: Mozilla/Firefox/Multiprocess_Firefox/Motivation +--- +
{{FirefoxSidebar}}

使 Firefox 在单独的进程中运行内容的主要原因:性能、安全和稳定性。

+ +

性能

+ +

Mozilla 在过去两年对性能的工作重点是浏览器的响应速度。目标是减少 “jank”—在加载大的页面时、表单中输入、或者滚动时,浏览器暂时性失去响应。响应问题在当今较高吞吐量的网络上日益显著。这些工作大部分已被 Snappy 项目完成。主要的重点在:

+ + + +

大部分能轻易做到的事情在这些领域已经完成。剩下的问题比较难以解决。举例来说,JavaScript 执行和布局都发生在主线程,并且阻挡着事件循环。在单独的线程中运行这些组件是困难的,因为它们访问数据,像是 DOM,它们不是线程安全的。作为替代方案,我们已经考虑让事件循环运行在 JavaScript 执行的中间,但这样做会毁掉大量 Firefox 其他地方做出的假设(更不用提附加组件)。

+ +

在一个单独的进程中运行网络内容,是这些方法的一个不错的替代品。类似线程的方式,Firefox 可以在 JavaScript 和布局在内容进程中运行时运行事件循环。但是不同于线程,用户界面(UI)的代码不能访问内容 DOM 或者其他内容的数据结构,因此没有必要进行锁定或者线程安全。而不足之处是,理所当然的,任何在 Firefox UI 进程中运行的需要访问内容数据的代码,都必须明确的通过消息传递的方式来访问内容数据。

+ +

我们觉得这种权衡有道理,有几个原因:

+ + + +

安全

+ +

目前来说,如果某人发现了一个 Firefox 中的可利用漏洞,他们能够接管用户的计算机。有很多种技术来缓解这种问题,但其中最强大的是沙盒。从技术上讲,沙盒不需要多个进程。但是,涵盖沙盒的单进程 Firefox 并不会很有用。沙盒能阻止进程执行,一个乖巧进程绝不会做的操作。遗憾的是,乖巧的 Firefox 进程(尤其是已安装附加组件的 Firefox)会访问很多网络和文件系统。因此,对单进程的 Firefox 沙盒不能限制太多。

+ +

在多进程 Firefox 中,内容进程将被沙盒化。一个乖巧的内容进程不会直接访问文件系统;它必须询问主线程来执行请求。在那时,主进程可以验证请求是否安全和合理。因此,对内容进程的沙盒化可以是相当严格的。我们希望这样的布局可以使 Firefox 更难被安全漏洞所利用。

+ +

稳定性

+ +

目前来说,在网页中运行的代码出现崩溃将导致整个浏览器崩溃。而多进程 Firefox 中,只有崩溃的内容进程会被终止。

+ +
+

此页面整合了很多 Bill McCloskey 的有关多进程 Firefox 的文章: http://billmccloskey.wordpress.com/2013/12/05/multiprocess-firefox/

+
+ +

 

diff --git a/files/zh-cn/mozilla/firefox/multiprocess_firefox/tab_selection_in_multiprocess_firefox/index.html b/files/zh-cn/mozilla/firefox/multiprocess_firefox/tab_selection_in_multiprocess_firefox/index.html new file mode 100644 index 0000000000..f396b7dcb5 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/multiprocess_firefox/tab_selection_in_multiprocess_firefox/index.html @@ -0,0 +1,21 @@ +--- +title: 多进程 Firefox 中的标签选择 +slug: Mozilla/Firefox/Multiprocess_Firefox/Tab_selection_in_multiprocess_Firefox +translation_of: Mozilla/Firefox/Multiprocess_Firefox/Tab_selection_in_multiprocess_Firefox +--- +
{{FirefoxSidebar}}

在单进程的 Firefox 中,当用户切换标签页时,这是同步操作。当浏览器加载新选择的标签页时,浏览器会阻塞,然后切换到该标签页。这表示标签页选定是通过设置 XUL 的 tab 对象的 selected 属性。代码(包括浏览器代码、扩展或主题)想要更改选定标签页的外观时,可以使用 selected  属性来应用 CSS 到该标签页。

+ +

在多进程的 Firefox 中,标签页切换是异步的。在用户切换标签页时,chrome 进程发送一个请求到内容进程来加载该页面到新选择的标签页。chrome 进程中的函数会立即返回,以便其他代码可以运行。一旦内容进程准备就绪,它发回一个消息到 chrome 进程,然后在用户界面中切换标签页。

+ +

还有 chrome 进程中的计时器:如果内容进程在计时器到期前没有响应,那么浏览器虽然继续切换标签页,但也显示一个包含标识的空标签页,直到目前的内容进程完成页面的加载。目前的计时器被设定为300毫秒。

+ +

还有,相应的,两个属性用于指示标签页选择:

+ + + +

这意味着想要对当前选中标签页应用的样式需要使用 visuallyselected 属性。如果使用 selected 属性,那么在新选择的标签页的样式被更新时会有一个短暂的断层,浏览器仍然在显示旧的标签页的内容。

+ + diff --git a/files/zh-cn/mozilla/firefox/multiprocess_firefox/technical_overview/index.html b/files/zh-cn/mozilla/firefox/multiprocess_firefox/technical_overview/index.html new file mode 100644 index 0000000000..18917fabc4 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/multiprocess_firefox/technical_overview/index.html @@ -0,0 +1,164 @@ +--- +title: 技术概述 +slug: Mozilla/Firefox/Multiprocess_Firefox/Technical_overview +translation_of: Mozilla/Firefox/Multiprocess_Firefox/Technical_overview +--- +
{{FirefoxSidebar}}
+

这个页面主要是 Bill McCloskey 的关于多进程 Firefox 的摘要: http://billmccloskey.wordpress.com/2013/12/05/multiprocess-firefox/

+
+ +

从总体上来看,多进程 Firefox 的运行方式如下。当 Firefox 启动时的进程被称为父进程。起初和单程 Firefox 一样:打开一个窗口用于显示browser.xul,它包含主要的 UI 元素。XUL是Firefox的GUI工具箱, 由它提供了类似Web HTML的方式来声明定义UI元素。Firefox 的 UI也有一个window 对象。它有一个document 属性,并含了在 browser.xul 中所有的XML元素。所有的菜单,工具栏,侧边栏和标签页都是 document 下的 XML 元素。每一个标签页(tab)都包含一个 <browser> 元素用来显示网页内容.

+ +

多进程与单进程的最主要区别是每个 <browser> 都有一个remote="true" 的属性。当这个 browser 元素被添加到 document 时,将会启动一个新的内容进程,也称为子进程。同时创建一个跨进程通信的IPC通道。开始时子进程显示 about:blank,父进程通过给子进程发送命令来导航显示的内容。

+ +

绘制

+ +

有时,显示的网页内容需要从子进程传递到父进程然后再显示到屏幕。多进程模式依赖于一个新的特性(off main thread compositing ,OMTC)。简单来说,每个窗口被分成若干层,概念上类似于photoshop中的层。每一次Firefox进行渲染时,这些层被提交到合成线程来构建为一个图片。

+ +

层是树状结构。树的根节点对应一个Firefox窗口。根节点层包其他子层,如绘制菜单和标签页。一个子树对应所有网页内容。网页内容可被分成更多的层,这些层都以同一个内容层为根节点。

+ +

在多进程Firefox中,内容层的子树是一个垫片(shim)。在大多数时间,它包含一个能够简单地保持到子进程的通信链接的引用的占位符节点。内容进程包括网页内容的层树。它构建并且描绘这个层树。当描绘完成时,它通过IPC将层数的结构发送给父进程。当父进程受到这个层树时,它删除这个占位符内容节点并且将其替换为源于内容的实际树。然后它正常地合成并且绘制。当它完成后,它将占位符放回。

+ +

因为Firefox OS的需要,OMTC怎样于多进程一起工作的基本构架已经存在了一段时间。然而,Matt Woodrow和 David Anderson已经完成了大量工作来使得其在Windows,Mac和Linux正常工作。一个巨大的挑战是使多进程Firefox能够在所有平台下都能使OMTC启动。现在,只有Macs默认使用OMTC。

+ +

用户输入

+ +

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.

+ +

进程间通信

+ +

所有 IPC 使用 Chromium IPC 程序库。每个子进程都有单独的与父进程的 IPC 链接。子进程之间不能直接通信。为了避免死锁和确保响应能力,父进程不允许坐等子进程的消息。但是,子进程可以阻塞等待父进程的消息。

+ +

相比于人们预期的直接通过 IPC 发送数据包,我们使用代码生成使这个过程更漂亮。IPC 协议在 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.

+ +

框架脚本

+ +

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.

+ +

跨进程 API

+ +

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.

+ +

跨进程对象包装器

+ +

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/zh-cn/mozilla/firefox/multiprocess_firefox/which_uris_load_where/index.html b/files/zh-cn/mozilla/firefox/multiprocess_firefox/which_uris_load_where/index.html new file mode 100644 index 0000000000..df24c59988 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/multiprocess_firefox/which_uris_load_where/index.html @@ -0,0 +1,53 @@ +--- +title: 各类 URI 在哪里加载 +slug: Mozilla/Firefox/Multiprocess_Firefox/Which_URIs_load_where +translation_of: Mozilla/Firefox/Multiprocess_Firefox/Which_URIs_load_where +--- +
{{FirefoxSidebar}}

浏览器加载一个页面到 chrome 或者内容进程,基于它的 URI 方案(URI scheme)。对于某些方案,你可以改变默认行为。

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
SchemeBehavior
about: +

默认情况下,about: 页面始终在 chrome 进程加载。但是,在你注册新的 about: 页面时,你可以改变此默认值。

+ +

两个新标志定义在 nsIAboutModule:

+ +
    +
  • URI_CAN_LOAD_IN_CHILD: 页面将加载在加载它的 browser 所在的进程。
  • +
  • URI_MUST_LOAD_IN_CHILD: 页面将始终加载在一个子进程
  • +
+ +

要使用上述任一标志,在你的 注册 about: URI 的代码getURIFlags 实现中返回它。

+
chrome: +

默认情况下,chrome: 页面始终加载在 chrome 进程。但是,在你注册新的 chrome: 页面时,你可以改变此默认值。

+ +

两个新标志定义在 chrome.manifest 文件

+ +
    +
  • remoteenabled: 页面将加载在加载它的 browser 所在的进程。
  • +
  • remoterequired: 页面将始终加载在一个子进程
  • +
+
file:始终在内容进程中加载。
resource:始终在内容进程中加载。
diff --git a/files/zh-cn/mozilla/firefox/privacy/index.html b/files/zh-cn/mozilla/firefox/privacy/index.html new file mode 100644 index 0000000000..e9a4126aa6 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/privacy/index.html @@ -0,0 +1,22 @@ +--- +title: 隐私 +slug: Mozilla/Firefox/Privacy +tags: + - 安全 + - 隐私 +translation_of: Mozilla/Firefox/Privacy +--- +
{{FirefoxSidebar}}
+ +

本文档是所有隐私相关的文档的列表。

+ +

{{ ListSubpages () }}

+ +

参见

+ + diff --git a/files/zh-cn/mozilla/firefox/privacy/storage_access_policy/errors/index.html b/files/zh-cn/mozilla/firefox/privacy/storage_access_policy/errors/index.html new file mode 100644 index 0000000000..a1e1f54a75 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/privacy/storage_access_policy/errors/index.html @@ -0,0 +1,24 @@ +--- +title: Errors +slug: Mozilla/Firefox/Privacy/Storage_access_policy/Errors +tags: + - Cookies + - Errors + - NeedsTranslation + - Storage + - TopicStub + - storage access policy +translation_of: Mozilla/Firefox/Privacy/Storage_access_policy/Errors +--- +
{{FirefoxSidebar}}
+ +

This page lists the errors that can be raised due to Firefox's anti-tracking functionality, governed by the Storage access policy. You can find further information about them by clicking on the links below:

+ +

A request to access cookies or storage was blocked because

+ + diff --git "a/files/zh-cn/mozilla/firefox/privacy/storage_access_policy/errors/\347\246\201\347\224\250\345\244\226\351\203\250cookie/index.html" "b/files/zh-cn/mozilla/firefox/privacy/storage_access_policy/errors/\347\246\201\347\224\250\345\244\226\351\203\250cookie/index.html" new file mode 100644 index 0000000000..d2c05cd375 --- /dev/null +++ "b/files/zh-cn/mozilla/firefox/privacy/storage_access_policy/errors/\347\246\201\347\224\250\345\244\226\351\203\250cookie/index.html" @@ -0,0 +1,39 @@ +--- +title: 禁用:所有第三方存储访问请求 +slug: Mozilla/Firefox/Privacy/Storage_access_policy/Errors/禁用外部Cookie +tags: + - cookie + - 存储 + - 存储访问策略 + - 跟踪 + - 错误 +translation_of: Mozilla/Firefox/Privacy/Storage_access_policy/Errors/CookieBlockedForeign +--- +
{{FirefoxSidebar}}
+ +

消息

+ +

Firefox:

+ +
禁用外部Cookie:由于浏览器禁用第三方内容展示及存储访问请求,Cookie和存储访问被拦截无法使用。
+ +

出现此类情形的原因?

+ +

由于浏览器禁用第三方内容的选项被开启,因此第三方Cookie使用请求和存储请求被拦截了。

+ +

通过以下操作可以修改权限或移除站点:

+ + + +

如果被拦截的资源不需要进行身份验证,你也可以给相关元素添加 crossorigin="anonymous" 属性来达到消除警告的目的。

+ +

相关资料

+ + diff --git a/files/zh-cn/mozilla/firefox/privacy/storage_access_policy/index.html b/files/zh-cn/mozilla/firefox/privacy/storage_access_policy/index.html new file mode 100644 index 0000000000..801d5bfad1 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/privacy/storage_access_policy/index.html @@ -0,0 +1,261 @@ +--- +title: 'Storage access policy: Block cookies from trackers' +slug: Mozilla/Firefox/Privacy/Storage_access_policy +tags: + - NeedsTranslation + - Privacy + - TopicStub + - storage access policy + - tracking protection +translation_of: Mozilla/Firefox/Privacy/Storage_access_policy +--- +
{{FirefoxSidebar}}
+ +

Firefox includes a new storage access policy that blocks cookies and other site data from third-party tracking resources. This policy is designed as an alternative to the older cookie policies, which have been available in Firefox for many years. This policy protects against cross-site tracking while minimizing the site breakage associated with traditional cookie blocking. This article explains how the policy works and how you can test it.

+ +

Testing in Firefox

+ +

This cookie policy has been available in Firefox since version 63. This documentation describes the policy that we intend to ship to Firefox Release users, but may not match what is implemented in the current Release version of Firefox. That's because we document new aspects of the policy as soon as they land in Firefox Nightly, our pre-release channel. Firefox Nightly may also contain experimental features that we don't yet plan to ship to Release users; experimental features will not be included in this documentation, but may nevertheless impact the functionality of domains classified as trackers.

+ +

We recommend sites test with Firefox Nightly, as this includes the newest version of our protections. As described above, note that Nightly may include additional protections that end up getting removed or changed before they reach our Release users. We’ll keep this page updated with the newest information as we strengthen our protections.

+ +

These protections are on by default in Nightly. The cookie policy can be enabled in other versions of Firefox through the Content Blocking settings (these steps will vary by version; the linked documentation includes a dropdown to select the appropriate Firefox version).

+ +

Report Broken Sites

+ +

If you find a website broken as a result of this change, file a bug under the Tracking Protection component within the Firefox product on Bugzilla. Alternatively you can report broken sites directly in Firefox by clicking "Report a Problem" in the Content Blocking section of the Control Center (this shortcut may not be available in all versions of Firefox).

+ +

Tracking protection explained

+ +

How does Firefox determine which resources are tracking resources?

+ +

Firefox uses the Tracking Protection list to determine which resources are tracking resources. The Tracking Protection list is maintained by Disconnect. When the list is applied in Firefox, we make two important changes:

+ + + +

Firefox uses the built-in Tracking Protection URL classifier to determine which resources match the tracking protection list. Domains are matched against the list in accordance with the SafeBrowsing v4 specification. Specifically, we check the exact hostname of the resource against the list, as well as the last four hostnames formed by starting with the last five components and successively removing the leading component. Consider the following examples:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Hostname on the listHostname of resourceMatched
example.comexample.comYes
example.coma.b.example.comYes
blah.example.comexample.comNo
a.b.example.comc.d.example.comNo
blah.example.comfoo.blah.example.comYes
+ +

What does the storage access policy block?

+ +

The storage access policy blocks resources identified as trackers from accessing their cookies and other site storage when they are loaded in a third-party context. This prevents those resources from retrieving tracking identifiers stored in cookies or site storage and using them to identify users across visits to multiple first parties. Specifically, Firefox does this by imposing the following restrictions:

+ +

Cookies:

+ + + +

DOM Storage:

+ + + +

Messaging and Workers:

+ + + +

DOM Cache:

+ + + +

Browser caches:

+ + + +

Network connections:

+ + + +

What is not blocked by the policy?

+ +
    +
  1. This policy does not currently restrict third-party storage access for resources that are not classified as tracking resources. We may choose to apply additional restrictions to third-party storage access in the future.
  2. +
  3. The restrictions applied by the policy will not prevent third-party scripts classified as tracking resources from accessing storage in the main context of the page. These scripts can continue to use storage scoped to the top-level origin.
  4. +
  5. Origins classified as trackers will have access to their own storage when they are loaded in a first-party context.
  6. +
  7. Cross-origin resources loaded from the same eTLD+1 as the top-level context will still have access to their storage.
  8. +
  9. Origins normally classified as trackers will not be blocked if the top-level page origin is determined to be from the same organization as them.
  10. +
+ +

Storage access grants

+ +

In order to improve web compatibility and permit third-party integrations that require storage access, Firefox will grant storage access scoped to the first party for a particular third-party origin as described in this section. Currently, Firefox includes some web compatibility heuristics that grant storage access to third-party resources classified as trackers when a user interacts with those third parties. We do this when we expect that not granting access would cause the web page to break. We also support an initial implementation of the Storage Access API, through which embedded {{htmlelement("iframe")}}s can request storage access by calling {{domxref("Document.requestStorageAccess()")}}. Although both of these approaches provide the same level of storage access, we recommend third parties switch to using the Storage Access API in order to guarantee their access to storage.

+ +

Automatic storage access upon interaction

+ +

In order to improve web compatibility, Firefox currently includes some heuristics to grant storage access automatically to third parties that receive user interaction. These heuristics are intended to allow some third-party integrations that are common on the web to continue to function. They are intended to be temporary and will be removed in a future version of Firefox. They should not be relied upon for current and future web development.

+ +

Third-party storage access may be granted to resources that have been classified as tracking resources when a user gesture triggers a pop-up window that has opener access to the originating document. When that occurs, there are two possible ways a third-party origin can be granted access:

+ + + +

Scope of storage access

+ +

When storage access is granted, it is scoped to the origin of the opener document or subdomains of that origin. Access that is granted on the subdomain of an origin does not extend to the top-level origin. As an example, if a resource from tracker.example is granted storage access on foo.example.com, then tracker.example will be able to access its cookies on bar.foo.example.com but not example.com. Instead, if tracker.example were granted access on example.com it would be able to access its storage on bar.foo.example.com, foo.example.com, and example.com.

+ +

When storage access is granted to tracker.example on example.com, all resources loaded from tracker.example on any top-level document loaded from example.com are immediately given storage access. This includes all resources loaded in the main context of the page, embedded <iframe>s, and resources loaded within embedded <iframe>s. Storage access is not extended to other resources loaded on example.com (e.g. other-tracker.example), nor to other first parties on which tracker.example is embedded (e.g. example.org).

+ +

Storage access grants extend into the first level of nested contexts, but no further. This means that <iframe>s embedded in the main context of the page and loaded from a domain classified as a tracker will have full access to all storage locations accessible through JavaScript. Similarly, requests for resources loaded in <iframe>s embedded in the main context of the page will have access to HTTP cookies. However, further nested contexts, including but not limited to those from the origin classified as a tracker, will not be granted storage access.

+ +

Consider the following embedding scenarios on a top-level page loaded from example.com on which tracker.example has been granted storage access.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Embeddingtracker.example resource storage access
An image is loaded from tracker.example and embedded in the main context of example.com.HTTP: Yes
+ JS: N/A
example.com embeds an <iframe> from example.org. That <iframe> goes on to load an image from tracker.example.HTTP: Yes
+ JS: N/A
example.com embeds an <iframe> from example.org. That <iframe> goes on to embed an <iframe> from tracker.example.HTTP: Yes
+ JS: No
example.com embeds an <iframe> from tracker.example.HTTP: Yes
+ JS: Yes
example.com embeds an <iframe> from example.com (same origin). The nested <iframe> embeds an <iframe> from tracker.example.HTTP: Yes
+ JS: No
+ +

Storage access expiration

+ +

The storage access grant expires after 30 days. Domains classified as tracking resources may be granted third-party storage access on multiple first parties, and the storage permission for each party expires independently. The above heuristics will also serve to extend the lifetime of a third-party storage permission on origins that have already been granted access.  Each time the heuristic is activated, or a success call to the Storage Access API is made, the pre-existing storage access expiration will be extended by 30 days, counting from the time the previous access was granted.

+ +

Please note that in the future we expect to make changes to how long storage access will remain valid for.  As mentioned before, the way to know that you will be able to use storage as a third-party going forward will be using the Storage Access API.

+ +

Debugging

+ +

We encourage site owners to test their sites, particularly those that rely on third-party content integrations. We’ve added several new features to Firefox to make testing easier.

+ +

Developer Tools notifications

+ +

The Network Monitor in Firefox Developer Tools now includes an indicator for all resource requests that have been classified as tracking resources. This indicator is shown as a shield icon in the domain column. In the sample image below, trackertest.org is classified as a tracking resource, while the request to example.com is not.

+ +

network requests in Firefox devtools indicating which ones are tracking resources with a small shield icon

+ +

Adding custom domains to the Tracking Protection list

+ +

Curious how things will work if a third-party domain on your site were classified as a tracker? We’ve added a preference that allows you to add custom domains to the Tracking Protection URL classifier. To do so:

+ +
    +
  1. Type about:config in your address bar. If you are presented with a page that warns you "This may void your warranty!", click "I accept the risk!"
  2. +
  3. Right click on the next page and click "New" > "String".
  4. +
  5. For the preference name enter "urlclassifier.trackingAnnotationTable.testEntries".
  6. +
  7. For the preference value enter comma separated origins that you’d like to have classified as trackers. E.g. "example.net,example.org".
  8. +
+ +
+

Warning: Be sure to remove these entries after you have finished testing.

+
+ +

FAQ

+ +

This cookie policy has the potential to lead to site breakage, but has been designed to allow common third-party integrations to continue to work while preventing cross-site tracking. In this section we describe the functionality you can expect in different integration scenarios.

+ +

Will this storage access policy block ads from displaying on my website?

+ +

No — this feature only restricts access to cookies and site data that can be used to track users across websites. Blocking tracking identifiers does not prevent the display of advertisements.

+ +

I use a third-party analytics service that is classified as a tracker. Will I still receive analytics data?

+ +

This depends on how the third-party analytics service is implemented. Third-party analytics providers will no longer be able to user their third-party storage to collect data. This means that providers using cookies which are scoped to their third-party domain, or local storage and other site data stored under their origin, will no longer have access to those identifiers across other websites.

+ +

If these services are embedded into the main context of the page, they can continue to use first-party cookies and site storage to track users across page visits on that specific first-party domain.

+ +

I use third-party services for social login, like, and share button integration. Will my users still be able to make use of these services?

+ +

This depends on how the social integration is implemented. We expect that many of the popular social integrations will continue to function as they do under Firefox’s current cookie policy with some minor differences in the user experience.

+ +

A social content provider that is classified as a tracker will not have access to their third-party cookies when the user first visits a new first party. Thus, the user may appear logged out to the service despite being logged in when they visit the provider’s website directly. Depending on the type of integration, the user may have to take some action to interact with the social content provider before the provider is given access to their cookies. For example:

+ + + +

After these interactions, the provider will receive third-party storage access if they prompt the user in a way that is captured by the storage access activation heuristics described above. These providers should consider switching to explicitly request storage access through the Storage Access API as soon as possible. An initial implementation of this API is currently available in Nightly.

+ +

I use third-party pixels and other tools to measure the effectiveness of my ad campaigns. Will I still be able to measure the conversion rate of my ads?

+ +

This depends on how the third party has implemented the measurement tool, but generally ad conversion measurement will be more difficult. Consider the following examples:

+ +
    +
  1. You run an ad on a social media website that is seen several times by a user, but never clicked. That user later visits your website, which includes a conversion tracking tag from the same social media website. This type of conversion is often referred to as a “view-through conversion.” Since the social media website does not have access to their third-party storage, they will not recognize the user as the same user that saw the advertisements on their website and the conversion will not be tracked. We expect that most view-through conversion tracking techniques will no longer work, including those offered by display networks.
  2. +
  3. You run an ad on a display network or social media website that is clicked by a user. That user lands on your website, which includes a conversion tracking tag from the same website that displayed your ad. This type of conversion is often referred to as a “click-through conversion.” Since the social media site or display network will not have access to their third-party storage, they will not recognize the user as the same user that saw the advertisements on their website and the conversion will not be tracked. We expect that this version of click-through conversion will no longer work.
  4. +
  5. You run an ad that appears on a social media website. A user clicks on your advertisement and is taken to a landing page that contains a conversion tracking tag from the third-party network. On the social media website, the network annotates the advertisement landing page URL with a query parameter that signals that the visit was the result of a click on an advertisement. On your website, the display network’s tag checks the URL query parameters and saves any ad tracking parameters to first-party storage. If a user later completes a conversion event, the network’s tag checks first-party storage to determine which click (or clicks) was responsible for the visit. We expect that click-through conversion implemented in this way will continue to work.
  6. +
diff --git a/files/zh-cn/mozilla/firefox/privacy/tracking_protection/index.html b/files/zh-cn/mozilla/firefox/privacy/tracking_protection/index.html new file mode 100644 index 0000000000..66620f47d9 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/privacy/tracking_protection/index.html @@ -0,0 +1,87 @@ +--- +title: Tracking Protection +slug: Mozilla/Firefox/Privacy/Tracking_Protection +tags: + - 隐私 +translation_of: Mozilla/Firefox/Privacy/Tracking_Protection +--- +
{{FirefoxSidebar}}
+ +

什么是跟踪保护?

+ +

Firefox 浏览器桌面版和 Android 移动版内置跟踪保护。在隐私窗口或标签页(Android移动版)内,Firefox会阻止跨网站的内容加载。

+ +

如果拦截的内容是网页的一部分,用户可能会注意到网页排版出现问题。如果页面上的其它元素把拦截内容的空位给填补上时,用户完全不会注意到 Firefox 浏览器阻止了一些内容加载。

+ +

当 Firefox 浏览器拦截到内容时,在控制台会有类似这样一条日志消息:

+ +
位于“http://some/url”的资源已被内容拦截功能拦截。
+ +

Firefox 浏览器 Android 移动版需要使用远程调试来看到控制台的输出内容。

+ +

Page information showing possible blocked content.

+ +

点下地址栏左侧这个标志ⓘ 可以查看当前页面的信息。按下第一行的按钮可以关闭对当前网站的跟踪保护。

+ +

如果存在跟踪Cookie,您可以通过单击上图中的“阻止跟踪Cookie”查看以下弹出窗口来查看列表:

+ +

+ +

您可以单击“管理内容阻止”来更改阻止设置:

+ +

+ +

Firefox如何选择要阻止的内容?
+ 基于要从中加载内容的域阻止内容。
+ Firefox将提供一个站点列表,这些站点已经被确定为参与用户的跨站点跟踪。启用跟踪保护后,Firefox将阻止来自列表中站点的内容。
+ 跟踪用户的网站通常是第三方广告和分析网站。

+ +

这对你的网站意味着什么?
+ 最明显的是,这意味着当启用跟踪保护时:
+ 从第三方跟踪服务的内容将对用户不可见
+ 您的网站将无法使用第三方广告或参与跟踪的分析服务
+ 更微妙的是,如果站点的其他部分依赖于正在加载的跟踪器,那么当启用跟踪保护时,这些部分也将被破坏。例如,如果站点包含在加载跟踪站点的内容时运行的回调,则不会执行该回调。
+ 例如,您不应以以下方式使用Google Analytics:

+ +
<a href="http://www.example.com" onclick="trackLink('http://www.example.com', event);">
+  Visit example.com
+</a>
+
+<script>
+function trackLink(url,event) {
+    event.preventDefault();
+    ga('send', 'event', 'outbound', 'click', url, {
+     'transport': 'beacon',
+     'hitCallback': function() {
+       document.location = url;
+     }
+   });
+}
+</script>
+ +

相反,您应该通过检查ga对象是否已初始化来解释Google Analytics丢失的情况:

+ +
<a href="http://www.example.com" onclick="trackLink('http://www.example.com', event);">
+  Visit example.com
+</a>
+
+<script>
+function trackLink(url,event) {
+    event.preventDefault();
+    if (window.ga && ga.loaded) {
+         ga('send', 'event', 'outbound', 'click', url, {
+         'transport': 'beacon',
+         'hitCallback': function() { document.location = url; }
+       });
+    } else {
+        document.location = url;
+    }
+}
+</script>
+
+ +

关于这项技术的更多信息可以在Google分析、隐私和事件跟踪上找到。

+ +
+

注意:以这种方式依赖第三方并不是一个好的做法,因为如果第三方速度慢或不可用,或者跟踪器已被加载项阻止,则站点可能会被破坏。

+
diff --git a/files/zh-cn/mozilla/firefox/releases/1.5/index.html b/files/zh-cn/mozilla/firefox/releases/1.5/index.html new file mode 100644 index 0000000000..a028828a01 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/1.5/index.html @@ -0,0 +1,123 @@ +--- +title: Firefox 1.5 for developers +slug: Mozilla/Firefox/Releases/1.5 +tags: + - Add-ons + - CSS + - DOM + - Extensions + - HTML + - JavaScript + - NeedsTranslation + - RDF + - SVG + - TopicStub + - Web Development + - Web Standards + - XML + - XML Web Services + - XSLT + - XUL +translation_of: Mozilla/Firefox/Releases/1.5 +--- +
{{FirefoxSidebar}}

Based on the Gecko 1.8 engine, Firefox 1.5 improved its already best in class standards support, and provided new capabilities to enable the next generation of web applications. Firefox 1.5 features improved support for CSS2 and CSS3, APIs for scriptable and programmable 2D graphics through SVG 1.1 and <canvas>, XForms and XML events, as well as many DHTML, JavaScript, and DOM enhancements.

+ +

Developer Tools

+ +

Several tools and browser extensions are available to help developers support Firefox 1.5.

+ + + +

Note: Some extensions do not currently support Firefox 1.5, and will be automatically disabled.

+ +

Overview

+ +

Some of the new features in Firefox 1.5:

+ +

Web site and application developers

+ +
+
SVG In XHTML Introduction
+
Learn how to use SVG in XHTML pages and how to use JavaScript and CSS to manipulate the picture in the same way you would script regular XHTML. See also SVG in Firefox to learn about the status and known problems of SVG implementation in Firefox.
+
Drawing Graphics with Canvas
+
Learn about the new <canvas> tag and how to draw graphs and other objects in Firefox.
+
CSS3 Columns
+
Learn about the new support for automatic multi-column text layout as proposed for CSS3.
+
Using Firefox 1.5 caching
+
Learn about bfcache and how it speeds up back and forward navigation.
+
+ +

XUL and Extension Developers

+ +
+
Building an Extension
+
This tutorial will take you through the steps required to build a very basic extension for Firefox. Also see another tutorial on MozillaZine knowledge base, which demonstrates the new features of the Extension Manager in 1.5 that make creating a new extension even easier.
+
XPCNativeWrapper
+
XPCNativeWrapper is a way to wrap up an object so that it's safe to access from privileged code. It can be used in all Firefox versions, though the behavior changed somewhat starting with Firefox 1.5 (Gecko 1.8).
+
Preferences System
+
Learn about the new widgets that allow you to create Options windows easier using less JavaScript code.
+
International characters in XUL JavaScript
+
XUL JavaScript files can now contain non-ASCII characters.
+
Tree API changes
+
The interfaces for accessing XUL <tree> elements have changed.
+
XUL Changes for Firefox 1.5
+
Summary of XUL changes. See also Adapting XUL Applications for Firefox 1.5.
+
+ + + + + +

New End user Features

+ +

User Experience

+ + + +

Security and Privacy

+ + + +

Support for open Web standards

+ +

Firefox support for Web standards continues to lead the industry with consistent cross-platform implementations for:

+ + + +

Firefox 1.5 supports the following data transport protocols (HTTP, FTP, SSL, TLS, and others), multilingual character data (Unicode), graphics (GIF, JPEG, PNG, SVG, and others) and the latest version of the world's most popular scripting language, JavaScript 1.6.

+ +

Changes since Firefox 1.0

+ +

Many changes have been introduced into Firefox since it was first released on November 9, 2004. Firefox has progressed with many new features and bug fixes. A detailed list of changes is available from squarefree.com.

diff --git a/files/zh-cn/mozilla/firefox/releases/1.5/using_firefox_1.5_caching/index.html b/files/zh-cn/mozilla/firefox/releases/1.5/using_firefox_1.5_caching/index.html new file mode 100644 index 0000000000..b062c43ddd --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/1.5/using_firefox_1.5_caching/index.html @@ -0,0 +1,184 @@ +--- +title: Using Firefox 1.5 caching +slug: Mozilla/Firefox/Releases/1.5/Using_Firefox_1.5_caching +translation_of: Mozilla/Firefox/Releases/1.5/Using_Firefox_1.5_caching +--- +
{{FirefoxSidebar}}

介绍

+ +

Firefox 1.5 对整个web页面的一个浏览器会话进行了内存缓存,包括他们对JavaScript状态。在访问过的页面间后退和前进不需要页面加载同时保存JavaScript状态。这个特性,被称为bfcache(“后退前进缓存”),使得页面导航(切换)非常快。这个状态缓存被保存直到用户关闭浏览器。 

+ +

有时候,Firefox不缓存页面。下面是一些页面不被缓存的常见的编程的原因:

+ + + +

这个新的缓存特性改变了页面的加载行为,web作者也许希望: 

+ + + +

两个新的浏览器事件使得用户可以做到这2个要求。

+ +

新的浏览器事件

+ +

如果你使用新的事件,你的页面在其他浏览器依然会正确显示  (我们已经测试了早期版本的Firefox, Internet Explorer, Opera, 和 Safari),而且在 Firefox 1.5加载时将会使用新的缓存功能。

+ +

注意: 直至10-2009 开发版本的Safari 添加了这些新的事件的支持 (见 the webkit bug).

+ +

标准的页面行为是:

+ +
    +
  1. 用户导航至一个页面
  2. +
  3. 当页面加载,行内scripts执行。
  4. +
  5. 一旦页面加载完毕, onload 事件执行。
  6. +
+ +

有些页面包含第四步。如果一个页面使用 unload 或者 beforeunload 处理程序,当从页面导航离开时事件被执行。如果提供了一个unload 处理程序,页面将不会被缓存。

+ +

当一个用户导航至一个被缓存的页面,行内scripts和onload 处理程序将不会执行 (步骤 2 和 3), 因为在大多数情况下,这些scripts的影响(执行效果)已经被保存。

+ +

如果你想在每次用户导航到页面时都执行页面包含的scripts或者其他在页面加载期间执行的行为,或者你想知道什么时候用户导航至一个被缓存的页面,使用新的pageshow 事件.

+ +

如果你拥有当用户导航离页面是执行的行为,但是你想利用这个新的缓存功能,因此不想使用unload处理程序,使用新的 pagehide 事件

+ +

pageshow 事件

+ +

这个事件和 load 事件一样的工作(效果), 除了它每次页面加载是都执行 that it fires every time the page is loaded (然而  load 事件在 Firefox 1.5中当页面从缓存中加载时不执行). 页面第一次加载时, pageshow 事件在 load 事件执行后执行。 pageshow 事件使用一个命名为persisted 的boolean属性,在初始加载时默认设置为 false。如果它不是初始加载,被设置为true(换句话说,但页面被缓存时它被设置为true).

+ +

pageshow 事件执行时,设置每次页面加载时你想要运行的任何的JavaScript。

+ +

如果你将JavaScript函数作为pageshow事件的一部分调用,你可以通过调用pageshow 事件作为load事件的一部分确保在不同于Firefox 1.5的浏览器在页面加载时调用这些函数,如在本文后面所示的示例。

+ +

pagehide 事件

+ +

如果你想定义当用户导航离页面时的行为,但是你不想使用 unload  (这将导致页面不被缓存),你可以使用新的  pagehide 事件。像 pageshow , pagehide 事件使用一个命名为persisted 的属性。 这个属性在页面未被浏览器缓存时设置为 false  ,如果页面被浏览器缓存则设置为 true 。如果这个属性被设置为 false, 如果有设置unload 处理程序的话,unload 事件在pagehide 事件执行后马上执行。

+ +

当页面初次加载,Firefox 1.5 试图按事件会发生相同的顺序模拟load事件。Frames 被作为顶级文档一样对待。如果页面包含frames, 则当缓存当页面被加载:

+ + + +

示例代码

+ +

以下的示例演示了一个页面同时使用 load 和 pageshow 事件。这个示例页面行为如下:

+ + + +

在这个例子中:

+ + + +
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+   "http://www.w3.org/TR/html4/loose.dtd">
+<HTML>
+<head>
+<title>Order query Firefox 1.5 Example</title>
+<style type="text/css">
+body, p {
+	font-family: Verdana, sans-serif;
+	font-size: 12px;
+   	}
+</style>
+<script type="text/javascript">
+function onLoad() {
+	loadOnlyFirst();
+	onPageShow();
+}
+
+function onPageShow() {
+//calculate current time
+	var currentTime= new Date();
+	var year=currentTime.getFullYear();
+	var month=currentTime.getMonth()+1;
+	var day=currentTime.getDate();
+	var hour=currentTime.getHours();
+	var min=currentTime.getMinutes();
+	var sec=currentTime.getSeconds();
+	var mil=currentTime.getMilliseconds();
+	var displayTime = (month + "/" + day + "/" + year + " " +
+		hour + ":" + min + ":" + sec + ":" + mil);
+	document.getElementById("timefield").value=displayTime;
+}
+
+function loadOnlyFirst() {
+	document.zipForm.name.focus();
+}
+</script>
+</head>
+<body onload="onLoad();" onpageshow="if (event.persisted) onPageShow();">
+<h2>Order query</h2>
+
+<form name="zipForm" action="http://www.example.com/formresult.html" method="get">
+<label for="timefield">Date and time:</label>
+<input type="text" id="timefield"><br>
+<label for="name">Name:</label>
+<input type="text" id="name"><br>
+<label for="address">Email address:</label>
+<input type="text" id="address"><br>
+<label for="order">Order number:</label>
+<input type="text" id="order"><br>
+<input type="submit" name="submit" value="Submit Query">
+</form>
+</body>
+</html>
+
+ +

与此相反, 如果以上页面不监听 pageshow 事件,所有的计算作为 load 事件的一部分(取而代之的是如下面的示例代码片段所示的编码),Firefox 1.5 中,当用户导航离页面时,光标位置及date/time会被缓存。当用户返回回该页面,缓存的date/time将会显示。

+ +
<script>
+function onLoad() {
+	loadOnlyFirst();
+
+//calculate current time
+	var currentTime= new Date();
+	var year = currentTime.getFullYear();
+	var month = currentTime.getMonth()+1;
+	var day = currentTime.getDate();
+	var hour=currentTime.getHours();
+	var min=currentTime.getMinutes();
+	var sec=currentTime.getSeconds();
+	var mil=currentTime.getMilliseconds();
+	var displayTime = (month + "/" + day + "/" + year + " " +
+		hour + ":" + min + ":" + sec + ":" + mil);
+	document.getElementById("timefield").value=displayTime;
+}
+
+function loadOnlyFirst() {
+	document.zipForm.name.focus();
+}
+</script>
+</head>
+
+<body onload="onLoad();">
+
+ +

开发Firefox扩展

+ +

Firefox 1.5 extensions 需要允许缓存功能。如果你在开发一个兼容1.5 及以前版本的Firefox扩展,确保它监听事件触发 load 可被缓存,监听的 pageshow 事件触发不应该被缓存。

+ +

例如,Firefox的Google工具栏为了兼容1.5和更早的版本,应该为autolink监听 load 事件函数,为PageRank监听 pageshow 事件函数。

diff --git a/files/zh-cn/mozilla/firefox/releases/12/index.html b/files/zh-cn/mozilla/firefox/releases/12/index.html new file mode 100644 index 0000000000..ee154efbfe --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/12/index.html @@ -0,0 +1,165 @@ +--- +title: Firefox 12 for developers +slug: Mozilla/Firefox/Releases/12 +tags: + - Firefox + - Firefox 12 + - Gecko 12 + - Web Developement +translation_of: Mozilla/Firefox/Releases/12 +--- +
{{FirefoxSidebar}}
+ +

Firefox 12 was shipped on April 24, 2012. This page summarizes the changes in Firefox 12 that affect developers. This article provides information about the new features and key bugs fixed in this release, as well as links to more detailed documentation for both web developers and add-on developers.

+ +

Changes for Web developers

+ +

HTML

+ + + +

CSS

+ + + +

JavaScript

+ + + +

DOM

+ + + +

New WebAPIs

+ + + +

SVG

+ + + +

MathML

+ + + +

Networking

+ + + +

Developer tools

+ + + +

Mozilla has been working on integrating its own Web developer tools that complement the popular Firebug add-on. You can get more information about these tools as well as see a list of resources external to Firefox that will help you with your Web development. The entire list is located at Web developer tools.

+ +

Miscellaneous changes

+ + + +

Changes for Mozilla and add-on developers

+ +

JavaScript code modules

+ +

source-editor.jsm

+ + + +

XUL

+ + + +

XPCOM

+ + + +

XPConnect

+ + + +

Interface changes

+ + + +

SpiderMonkey

+ + + +

Building

+ + + +

Other changes

+ + + +

See also

+ +
{{Firefox_for_developers('11')}}
diff --git a/files/zh-cn/mozilla/firefox/releases/14/index.html b/files/zh-cn/mozilla/firefox/releases/14/index.html new file mode 100644 index 0000000000..8ef207f56e --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/14/index.html @@ -0,0 +1,98 @@ +--- +title: Firefox 14 for developers +slug: Mozilla/Firefox/Releases/14 +tags: + - Firefox + - Firefox 14 + - Gecko + - Gecko 14 +translation_of: Mozilla/Firefox/Releases/14 +--- +
{{FirefoxSidebar}}

Firefox 14 shipped on July 17, 2012. This article lists key changes that are useful for not only Web developers to know about, but also Firefox and Gecko developers as well as add-on developers.

+ +

Changes for Web developers

+ +

HTML

+ + + +

DOM

+ + + +

CSS

+ + + +

JavaScript

+ +

No change.

+ +

MathML

+ + + +

HTTP

+ + + +

Changes for Mozilla and add-on developers

+ +

JavaScript 代码模块

+ +

source-editor.jsm

+ + + +

XUL

+ + + +

接口

+ + + +

拼写检查

+ + + +

相关链接

+ +
{{Firefox_for_developers('13')}}
diff --git a/files/zh-cn/mozilla/firefox/releases/15/index.html b/files/zh-cn/mozilla/firefox/releases/15/index.html new file mode 100644 index 0000000000..1c941836d7 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/15/index.html @@ -0,0 +1,122 @@ +--- +title: Firefox 15 for developers +slug: Mozilla/Firefox/Releases/15 +tags: + - Firefox + - Firefox 15 + - Gecko 15 +translation_of: Mozilla/Firefox/Releases/15 +--- +
{{FirefoxSidebar}}

Firefox 15 shipped on August 28, 2012. This article lists key changes that are useful for not only Web developers to know about, but also Firefox and Gecko developers as well as add-on developers.

+ +

Changes for Web developers

+ +

HTML

+ + + +

CSS

+ + + +

DOM

+ + + +

JavaScript

+ + + +

WebGL

+ + + +

MathML

+ + + +

SVG

+ + + +

Network

+ + + +

附加组件开发变更

+ +

接口变更

+ +
+
{{ interface("nsIDOMWindowUtils") }}
+
aModifiers of sendMouseEvent(), sendTouchEvent(), sendMouseEventToWindow(), sendMouseScrollEvent() and sendKeyEvent() supports all modifier keys which are supported by KeyboardEvent.getModifierState(). Use MODIFIER_* values. And now the 5th parameter of sendKeyEvent() is changed from boolean to unsigned long. For backward compatibility, if caller passes true or false to it, the behavior isn't changed. This change allows callers to specify the key's location.
+
{{ interface("nsIBrowserHistory") }}
+
The hidePage() method was never implemented, and has been removed entirely in this release. The addPageWithDetails() method has also been removed as part of the ongoing work to make all Places APIs asynchronous; use {{ ifmethod("mozIAsyncHistory", "updatePlaces") }} instead. Also, the count attribute was removed; it had not returned an actual count in some time (instead, it was simply indicating whether or not any entries existed). You can use {{ ifattribute("nsINavHistoryService", "hasHistoryEntries") }} instead.
+
{{interface("inIDOMUtils")}}
+
The {{ifmethod("inlDOMUtils", "parseStyleSheet")}} method has been added and allows the (re-)parsing of Cascading Style Sheets.
+
{{interface("nsIINIParserWriter")}}
+
The {{ifmethod("nsIINIParserWriter", "writeFile")}} method now accepts a flagsproperty. This currently offers only one option: you can now tell it to write the file in UTF-16 format instead of UTF-8, for better compatibility with Windows and certain installers.
+
+ +

新增接口

+ +
+
{{ interface("nsISpeculativeConnect") }}
+
Provides a way to hint to the networking layer that you are likely to ask to open a connection to a given URI sometime in the near future. This lets the network layer begin the sometimes high-latency process of opening a new network connection ahead of time.
+
+ +

移除接口

+ +

The following interfaces have been removed.

+ + + +

相关链接

+ +

{{Firefox_for_developers('14')}}

diff --git a/files/zh-cn/mozilla/firefox/releases/16/index.html b/files/zh-cn/mozilla/firefox/releases/16/index.html new file mode 100644 index 0000000000..7d63499c62 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/16/index.html @@ -0,0 +1,114 @@ +--- +title: Firefox 16 for developers +slug: Mozilla/Firefox/Releases/16 +tags: + - Firefox + - Firefox 16 +translation_of: Mozilla/Firefox/Releases/16 +--- +
{{FirefoxSidebar}}

Firefox 16 shipped on October 9, 2012. This article lists key changes that are useful for not only Web developers to know about, but also Firefox and Gecko developers as well as add-on developers.

+ +

Web开发

+ +

HTML

+ + + +

CSS

+ + + +

API/DOM

+ + + +

JavaScript

+ + + +

WebGL

+ +

No change

+ +

SVG

+ +

No change

+ +

MathML

+ +

 

+ + + +

 

+ +

网络

+ +

 

+ +

Developer tools

+ +

 

+ + + +

 

+ +

 

+ +

Changes for Open Web App developers

+ + + +

附加组件开发变更

+ +

修改接口

+ +

{{interface("nsIPrivateDOMEvent")}} has been merged into {{interface("nsIDOMEvent")}}. ({{bug("761613")}})

+ +

新增接口

+ +

废弃接口

diff --git a/files/zh-cn/mozilla/firefox/releases/17/index.html b/files/zh-cn/mozilla/firefox/releases/17/index.html new file mode 100644 index 0000000000..176604bdc7 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/17/index.html @@ -0,0 +1,146 @@ +--- +title: Firefox 17 for developers +slug: Mozilla/Firefox/Releases/17 +tags: + - Firefox + - Firefox 17 +translation_of: Mozilla/Firefox/Releases/17 +--- +
{{FirefoxSidebar}}
+ +

Firefox 17 shipped on November 20, 2012. This article lists key changes that are useful for not only web developers, but also Firefox and Gecko developers as well as add-on developers.

+ +

WEB开发者需要注意的变化

+ +

HTML

+ + + +

CSS

+ + + +

DOM

+ + + +

 

+ +

JavaScript

+ + + +

WebGL

+ +

 

+ + + +

 

+ +

SVG

+ +

No change.

+ +

MathML

+ +

 

+ + + +

 

+ +

XUL

+ + + +

网络

+ +

 

+ + + +

 

+ +

开发者工具

+ +

 

+ + + +

User Agent

+ +

The Gecko part of the user agent string changed. The build date (which hadn't been updated since 2010) was removed, and the Gecko version number was put in its place instead. So Gecko/20100101 -> Gecko/17.0. This may affect you if you are doing user agent sniffing.

+ +

附加组件和Mozilla开发者需要注意的变化

+ +

接口变化

+ +
+
{{ interface("nsIInputStream") }}
+
available() 方法返回一个64位的长度而不是32位的. ({{bug("215450")}})
+
{{ interface("nsIDOMWindowUtils") }}
+
sendMouseScrollEvent()方法被sendWheelEvent()替换. ({{bug("719320")}})
+
{{interface("nsIFilePicker")}}
+
The open() method, to open the file dialog asynchronously, has been added and the show() method has been deprecated ({{bug("731307")}}).
+
{{interface("nsIScriptSecurityManager")}}
+
The checkLoadURIStr() and checkLoadURI() methods have been removed ({{bug("327244")}}).
+
{{interface("nsIRefreshURI")}}
+
The setupRefreshURIFromHeader() method has a added principal parameter ({{bug("327244")}}).
+
+ +

新增接口

+ +

None.

+ +

移除接口

+ +

None removed.

+ +

See also

+ + + +

Older versions

+ +

{{Firefox_for_developers('16')}}

diff --git a/files/zh-cn/mozilla/firefox/releases/18/index.html b/files/zh-cn/mozilla/firefox/releases/18/index.html new file mode 100644 index 0000000000..9854df7bf7 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/18/index.html @@ -0,0 +1,82 @@ +--- +title: Firefox 18 for developers +slug: Mozilla/Firefox/Releases/18 +translation_of: Mozilla/Firefox/Releases/18 +--- +
{{FirefoxSidebar}}

Firefox 18已于2013年1月8日发布.

+

WEB开发者需要注意的变化

+

HTML

+ +

CSS

+ +

DOM

+ +

JavaScript

+ +

WebGL

+

SVG

+

MathML

+

XUL

+

网络

+ +

开发者工具

+

附加组件和Mozilla开发者需要注意的变化

+

接口变更

+
+
+ {{ interface("nsIStreamListener") }}
+
+ onDataAvailable()方法的第四个参数(aOffset)类型改为无符号长整型. ({{bug("784912")}})
+
+ {{ interface("nsIUploadChannel") }}
+
+ setUploadStream()支持了超过2GB大小的content-length ({{bug("790617")}})
+
+ {{ interface("nsIEditor") }}
+
+ 删除了addEditorObserver(),使用setEditorObserver()来替代, removeEditorObserver()不再需要一个{{ interface("nsIEditorObserver") }}参数({{bug("785091")}})
+
+
+
+ {{ interface("nsIHttpProtocolHandler") }}
+
+ http-on-modify-request observers are no longer guaranteed to be called synchronously during
+ nsIChannel.asyncOpen(). For observers that need to be called during asyncOpen(), the new http-on-opening-request observer topic has been added. ({{bug("800799")}})
+
+

新增接口

+

移除接口

+

下面的接口已经被移除.

+ +

相关链接

+ +

更早版本

+

{{Firefox_for_developers('17')}}

diff --git a/files/zh-cn/mozilla/firefox/releases/19/index.html b/files/zh-cn/mozilla/firefox/releases/19/index.html new file mode 100644 index 0000000000..670c6f9f18 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/19/index.html @@ -0,0 +1,76 @@ +--- +title: Firefox 19 for developers +slug: Mozilla/Firefox/Releases/19 +translation_of: Mozilla/Firefox/Releases/19 +--- +
{{FirefoxSidebar}}

Firefox 19已于2013年2月19日正式发布.

+ +

Web开发者需要注意的变化

+ +

JavaScript

+ + + +

CSS

+ + + +

DOM

+ + + +

XForms

+ +

删除了对XForms的支持.

+ +

附加组件和Mozilla开发者需要注意的变化

+ +
+

注: A key change in Firefox 19 is that nsresult is now strongly typed. This will help make it easier to detect bugs that are caused by mishandling of return values, but may cause existing code to break if it's making incorrect assumptions in this regard.

+
+ + + +

接口变化

+ +
+
{{interface("nsIImgLoadingContent")}}
+
The parameter (aObserver) of addObserver() method changes from {{interface("imgIDecoderObserver")}} to {{interface("imgINotificationObserver")}}. The notify() method of {{interface("imgINotificationObserver")}} is not scriptable, so you need to use createScriptedObserver() from {{interface("imgITools")}}.
+
{{interface("nsIChannel")}}
+
 contentLength 属性的类型由 long 改成 int64_t.
+
+ +

相关链接

+ + + +

更早版本

+ +
{{Firefox_for_developers('18')}}
diff --git a/files/zh-cn/mozilla/firefox/releases/20/index.html b/files/zh-cn/mozilla/firefox/releases/20/index.html new file mode 100644 index 0000000000..117426208d --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/20/index.html @@ -0,0 +1,47 @@ +--- +title: Firefox 20 for developers +slug: Mozilla/Firefox/Releases/20 +translation_of: Mozilla/Firefox/Releases/20 +--- +
{{FirefoxSidebar}}

Firefox 20正式版发布于

+

Web开发者需要注意的变化

+

HTML

+ +

JavaScript

+ +

CSS

+ +

DOM

+ +

附加组件和Mozilla开发者需要注意的变化

+ +

相关链接

+ +

更早版本

+

{{Firefox_for_developers('19')}}

diff --git a/files/zh-cn/mozilla/firefox/releases/21/index.html b/files/zh-cn/mozilla/firefox/releases/21/index.html new file mode 100644 index 0000000000..9d0788dfa6 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/21/index.html @@ -0,0 +1,107 @@ +--- +title: Firefox 21 for developers +slug: Mozilla/Firefox/Releases/21 +translation_of: Mozilla/Firefox/Releases/21 +--- +
{{FirefoxSidebar}}

Web开发者需要注意的变化

+

HTML

+ +

JavaScript

+ +

CSS

+ +

DOM

+ +

SVG

+ +

网络

+ +

附加组件和Mozilla开发者需要注意的变化

+ +

相关链接

+ +

更早版本

+

{{Firefox_for_developers('20')}}

diff --git a/files/zh-cn/mozilla/firefox/releases/22/index.html b/files/zh-cn/mozilla/firefox/releases/22/index.html new file mode 100644 index 0000000000..32177c38da --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/22/index.html @@ -0,0 +1,89 @@ +--- +title: Firefox 22 for developers +slug: Mozilla/Firefox/Releases/22 +tags: + - Firefox + - Firefox 22 +translation_of: Mozilla/Firefox/Releases/22 +--- +
{{FirefoxSidebar}}

Web开发者需要注意的变化

+ +

HTML

+ + + +

JavaScript

+ + + +

DOM

+ + + +

CSS

+ + + +

附加组件和Mozilla开发者需要注意的变化

+ + + +

Firefox Developer Tools

+ + + +

相关链接

+ + + +

Older versions

+ +

{{Firefox_for_developers('21')}}

diff --git a/files/zh-cn/mozilla/firefox/releases/23/index.html b/files/zh-cn/mozilla/firefox/releases/23/index.html new file mode 100644 index 0000000000..adaf75356f --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/23/index.html @@ -0,0 +1,94 @@ +--- +title: Firefox 23 for developers +slug: Mozilla/Firefox/Releases/23 +tags: + - Firefox + - Firefox 23 +translation_of: Mozilla/Firefox/Releases/23 +--- +
{{FirefoxSidebar}}

Web开发者需要注意的变化

+ +

HTML

+ + + +

JavaScript

+ +

 

+ + + +

HTML

+ + + +

 

+ +

DOM

+ + + +

CSS

+ + + +

WebRTC

+ + + +

MathML

+ + + +

Changes for addon and Mozilla developers

+ +

Firefox developer tools

+ +

Addons that overlay chrome://browser/content/debugger.xul must now overlay chrome://browser/content/devtools/debugger.xul. You may add references to both these files in chrome.manifest for compatibility.

+ +

 

+ +

See also

+ + + +

 

+ +

 

+ +

之前版本

+ +

{{Firefox_for_developers('22')}}

diff --git a/files/zh-cn/mozilla/firefox/releases/24/index.html b/files/zh-cn/mozilla/firefox/releases/24/index.html new file mode 100644 index 0000000000..cd3dd112e2 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/24/index.html @@ -0,0 +1,22 @@ +--- +title: Firefox 24 for developers +slug: Mozilla/Firefox/Releases/24 +translation_of: Mozilla/Firefox/Releases/24 +--- +
{{FirefoxSidebar}}

{{ draft() }}

+

Web开发者需要注意的变化

+

Developer Tools

+

HTML

+

JavaScript

+ +

DOM

+

MathML

+

相关链接

+ +

更早版本

+

{{Firefox_for_developers('23')}}

diff --git a/files/zh-cn/mozilla/firefox/releases/25/index.html b/files/zh-cn/mozilla/firefox/releases/25/index.html new file mode 100644 index 0000000000..a23b1fd7c7 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/25/index.html @@ -0,0 +1,50 @@ +--- +title: Firefox 25 for developers +slug: Mozilla/Firefox/Releases/25 +translation_of: Mozilla/Firefox/Releases/25 +--- +
{{FirefoxSidebar}}

{{ draft() }}

+

Web开发者需要注意的变化

+

CSS

+ +

HTML

+ +

JavaScript

+

下面都是 ECMAScript 6 (Harmony) 中的新特性!

+ +

DOM

+ +

MathML

+

SVG

+

相关链接

+ +

更早版本

+

{{Firefox_for_developers('24')}}

diff --git a/files/zh-cn/mozilla/firefox/releases/25/site_compatibility/index.html b/files/zh-cn/mozilla/firefox/releases/25/site_compatibility/index.html new file mode 100644 index 0000000000..d808bf4007 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/25/site_compatibility/index.html @@ -0,0 +1,40 @@ +--- +title: Firefox 25网站兼容性 +slug: Mozilla/Firefox/Releases/25/Site_Compatibility +translation_of: Mozilla/Firefox/Releases/25/Site_Compatibility +--- +
{{FirefoxSidebar}}

{{ draft() }}

+
+

DOM

+
+

ImageDocument 属性被删除

+ +

非标准的 {{ domxref("ImageDocument") }} 接口在普通页面中不能访问了.

+
+
+

worker 中的所有事件名都加上 Worker 前缀

+ +

为了能让 普通的 DOM 事件 能在 worker 中正常使用, 目前 worker 中的事件 {{domxref("Event") }}, {{ domxref("MessageEvent") }}, {{ domxref("ErrorEvent") }} and {{ domxref("ProgressEvent") }}  被重命名为了 {{ domxref("WorkerEvent") }}, {{ domxref("WorkerMessageEvent") }}, {{ domxref("WorkerErrorEvent") }} and {{ domxref("WorkerProgressEvent") }}.

+
+
+
+

JavaScript

+
+

Proxy 全局变量从对象类型修正到函数类型

+ +

以前, Proxy 是一个对象类型的值. 现在 typeof Proxy 会返回 function ,且不需要在前面加 new 运算符也可以正常调用了.

+
+
+

yield without a value has been deprecated

+ +

yield 运算符不再需要一个操作数, 该变化遵循了 ECMAScript 6 规范草案.

+
+
diff --git a/files/zh-cn/mozilla/firefox/releases/26/index.html b/files/zh-cn/mozilla/firefox/releases/26/index.html new file mode 100644 index 0000000000..621e9f87c9 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/26/index.html @@ -0,0 +1,41 @@ +--- +title: Firefox 26 for developers +slug: Mozilla/Firefox/Releases/26 +translation_of: Mozilla/Firefox/Releases/26 +--- +
{{FirefoxSidebar}}

Web开发者需要注意的变化

+

CSS

+ +

HTML

+

No change.

+

JavaScript

+ +

Interfaces/APIs/DOM

+ +

MathML

+ +

SVG

+

No change.

+

相关链接

+ +

更早版本

+

{{Firefox_for_developers('25')}}

diff --git a/files/zh-cn/mozilla/firefox/releases/26/site_compatibility/index.html b/files/zh-cn/mozilla/firefox/releases/26/site_compatibility/index.html new file mode 100644 index 0000000000..009959b5c0 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/26/site_compatibility/index.html @@ -0,0 +1,104 @@ +--- +title: Site Compatibility for Firefox 26 +slug: Mozilla/Firefox/Releases/26/Site_Compatibility +translation_of: Mozilla/Firefox/Releases/26/Site_Compatibility +--- +
{{FirefoxSidebar}}

{{ draft() }}

+

Firefox 26 Aurora (pre-Beta) will be released on . While it has been developed to maintain compatibility as much as possible, the new version includes some changes affecting backward compatibility aimed at improving interoperability with the other browsers or following the latest Web standards. Here's the list of such changes — hope this helps whenever you test your sites or applications.

+

This article only explains the changes that may affect backward compatibility for Websites. For the other new features and changes, please read the following documents:

+ +

This list may be updated until the release of the final version on , so please check back later. Follow @MozWebCompat on Twitter for further updates.

+
+

CSS

+
+ + +

The non-standard {{ cssxref("-moz-text-blink") }} property has been removed. Instead, the standard, still prefixed {{ cssxref("text-decoration-line") }} property now takes blink as a valid value. Actually it doesn't blink any content on Firefox though, from the perspective of accessibility. Note that the blink effect with text-decoration:blink has been dropped with Firefox 23.

+
+
+
+

DOM

+
+

type 属性不是 image 的 HTMLInputElement 元素的 width 和 height 属性会返回 0

+ +

Previously, the width and height properties of an {{ HTMLElement("input") }} returned the dimension of the element. To comply with the spec, those properties now return 0 if the type property is not image.

+
+
+

Setting document.domain in a sandboxed iframe is no longer allowed

+ +

Setting the {{ domxref("document.domain") }} property on a page embedded in an {{ HTMLElement("iframe") }} with the sandbox attribute will throw a security error from now on.

+
+
+

元素的 id 改变后,旧 id 不再是 window 对象的属性

+ +

An element with id is accessible through window.<id>. Previously, the DOM object remained on {{ domxref("window") }} even after the id of the element is programmatically changed. This odd behavior has been fixed with Firefox 26. The {{ domxref("document.getElementById") }} method, which is recommended to use in general, is not affected by this change.

+
+
+

MessageEvent has been updated

+ +

The {{ domxref("MessageEvent") }} interface has been updated to comply with the latest spec. The initMessageEvent method has been removed while the interface is now a constructor.

+
+
+

HTMLCanvasElement.mozGetAsFile has been deprecated

+ +

The non-standard mozGetAsFile method on the {{ domxref("HTMLCanvasElement") }} interface is now deprecated and will be removed soon. The standard toBlob method can be used instead.

+
+
+

UserDataHandler has been removed

+ +

The deprecated {{ domxref("UserDataHandler") }} interface has been removed. The {{ domxref("Node.setUserData") }} and {{ domxref("Node.getUserData") }} methods have already been removed with Firefox 22.

+
+
+ + +

The following methods on the XBL DOM Interface have been removed from the {{ domxref("Document") }} interface: getAnonymousNodes, getAnonymousElementByAttribute, getBindingParent and loadBindingDocument.

+
+
+

Various non-standard interfaces have been removed

+ +

As part of the ongoing effort to standardize global objects, the following non-standard interfaces have been removed: ChromeWindow, StorageIndexedDB, XULButtonElement, XULCheckboxElement, XULCommandDispatcher, XULCommandEvent, XULControlElement, XULDocument, XULElement, XULLabeledControlElement and XULPopupElement.

+
+
+
+

JavaScript

+
+

The reserved words are no longer allowed as function names

+ +

The reserved words cannot be used for function names. Starting with Firefox 26, such a usage will throw a SyntaxError. For example, function delete() { ... } is illegal.

+
+
+
+

Plug-ins

+
+

All plug-ins except Flash are now defaulted to Click-to-Play

+ +

Starting with Firefox 26, plug-ins require user interaction to be activated. With the exception of the popular Adobe Flash Player, all plug-in content embedded in a Web page is now disabled by default and enabled by user's click. This change has been made in order to improve security and performance of the browser. See the Mozilla Security Blog for details. Web developers are encouraged to leverage modern Web technologies, including HTML5, to provide richer user experience.

+
+
diff --git a/files/zh-cn/mozilla/firefox/releases/27/index.html b/files/zh-cn/mozilla/firefox/releases/27/index.html new file mode 100644 index 0000000000..7f9f6a9028 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/27/index.html @@ -0,0 +1,45 @@ +--- +title: Firefox 27 for developers +slug: Mozilla/Firefox/Releases/27 +translation_of: Mozilla/Firefox/Releases/27 +--- +
{{FirefoxSidebar}}

Web 开发者需要注意的变化

+

开发者工具

+ +

更多详情, 请看这篇文章.

+

CSS

+ +

HTML

+ +

JavaScript

+

EcmaScript 6 (Harmony) 实现了:

+ +

Interfaces/APIs/DOM

+

No change.

+

MathML

+

No change.

+

SVG

+

No change.

+

附加组件和 Mozilla 开发者需要注意的变化

+ +

相关链接

+ +

更早版本

+

{{Firefox_for_developers('26')}}

diff --git a/files/zh-cn/mozilla/firefox/releases/28/index.html b/files/zh-cn/mozilla/firefox/releases/28/index.html new file mode 100644 index 0000000000..1e41a0b20d --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/28/index.html @@ -0,0 +1,117 @@ +--- +title: Firefox 28 for developers +slug: Mozilla/Firefox/Releases/28 +tags: + - Firefox + - Firefox 28 +translation_of: Mozilla/Firefox/Releases/28 +--- +
{{FirefoxSidebar}}

Firefox 28 was released on March 18, 2014. This article lists key changes that are useful not only for web developers, but also Firefox and Gecko developers as well as add-on developers.

+ +

Changes for Web developers

+ +

Developer Tools

+ + + +

More details in this post.

+ +

CSS

+ + + +

HTML

+ + + +

JavaScript

+ + + +

Interfaces/APIs/DOM

+ + + +

MathML

+ + + +

SVG

+ +

No change.

+ +

Audio/Video

+ + + +

Network

+ + + +

Changes for addon and Mozilla developers

+ + + +

Security

+ + + +

See also

+ + + +

Older versions

+ +

{{Firefox_for_developers('27')}}

diff --git a/files/zh-cn/mozilla/firefox/releases/28/site_compatibility/index.html b/files/zh-cn/mozilla/firefox/releases/28/site_compatibility/index.html new file mode 100644 index 0000000000..c2a74bad9f --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/28/site_compatibility/index.html @@ -0,0 +1,56 @@ +--- +title: Site Compatibility for Firefox 28 +slug: Mozilla/Firefox/Releases/28/Site_Compatibility +translation_of: Mozilla/Firefox/Releases/28/Site_Compatibility +--- +
{{FirefoxSidebar}}

DOM

+
+
+ + +

{{ domxref("PluginArray") }} 接口, 通常就是指 {{ domxref("window.navigator.plugins") }} 属性, 现在不再是可以枚举的了. 这么做主要是为了防止网站通过某些技术手段窃取用户隐私. 不过开发人员仍然可以使用 {{ domxref("window.navigator.mimeTypes") }} 接口来判断浏览器支持哪些 MIME 类型. 这一变更可能会给一些已有的代码带来兼容性问题.

+
+
+

showModalDialog has been deprecated

+ +

The {{ domxref("window.showModalDialog") }} method, originally from Internet Explorer, is now considered deprecated. The {{ domxref("window.open") }} method should be used instead.

+
+
+

Make sure the deep argument is specified for cloneNode and importNode

+ +

The {{ domxref("Node.cloneNode") }} and {{ domxref("document.importNode") }} methods take the boolean deep argument. It's optional in the DOM4 specification, and if omitted, these methods acted as if the value of deep was true. But this behavior has been changed in the latest spec, and if omitted, the methods will act as if the value was false. Though It's still optional, Firefox now warns developers in console not to omit the argument for the forward compatibility.

+
+
+

History objects now throw if the document is inactive

+ +

The spec of the {{ domxref("History") }} interface has been updated, and the properties and methods now throw a SecurityError exception when those are called on an inactive {{ domxref("document") }}. It would be a problem if you are manipulating {{ domxref("window.history") }} in an {{ HTMLElement("iframe") }}.

+
+
+
+

Networking

+
+

SPDY/2 support has been dropped

+ +

The support of SPDY Protocol Draft 2 has been removed. Web sites should upgrade to SPDY/3 or 3.1.

+
+
+
+

Video/Audio

+
+

canPlayType('video/webm') now returns 'maybe'

+ +

The canPlayType method of the {{ domxref("HTMLMediaElement") }} interface has been updated to comply with the spec. canPlayType('video/webm') and canPlayType('audio/webm') now return 'maybe' instead of 'probably', because media can be encoded with a codec that Firefox doesn't support. If a codec is specified in the type argument, the method returns 'probably' or '' (empty string) depending on the codec. For example, canPlayType('video/webm; codecs=vp8') returns 'probably'.

+
+
diff --git a/files/zh-cn/mozilla/firefox/releases/3.6/index.html b/files/zh-cn/mozilla/firefox/releases/3.6/index.html new file mode 100644 index 0000000000..8bc9182b45 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/3.6/index.html @@ -0,0 +1,305 @@ +--- +title: Firefox 3.6 for developers +slug: Mozilla/Firefox/Releases/3.6 +translation_of: Mozilla/Firefox/Releases/3.6 +--- +

Firefox 3.6 offers support for new and developing web standards, increased performance, and an overall better experience for web users and developers. This page provides links to articles covering the new capabilities of Firefox 3.6.

+ +

For web site and application developers

+ +

CSS

+ +
+
Using gradients
+
Firefox 3.6 adds support for the proposed -moz-linear-gradient and -moz-radial-gradient properties  for background.
+
Multiple backgrounds
+
The background property (as well as background-color, background-image, background-position, background-repeat, and background-attachment) now supports multiple backgrounds. This lets you specify multiple backgrounds that are rendered atop one another in layers.
+
Mozilla-specific media features
+
Media features have been added for Mozilla-specific system metrics, so that media queries can be used to more safely check on the availability of features such as touch support.
+
Scaling background images
+
The background-size property from the CSS 3 Backgrounds and Borders draft is now supported under the name -moz-background-size.
+
WOFF font support
+
@font-face now supports the WOFF downloadable font file format.
+
Pointer events
+
The pointer-events property lets content specify whether or not an element may be the target of mouse pointer events.
+
+ +

Miscellaneous CSS changes

+ + + +

HTML

+ +
+
Using files from web applications
+
Support for the new HTML5 File API has been added to Gecko, making it possible for web applications to access local files selected by the user. This includes support for selecting multiple files using the input type="file" HTML element's new multiple attribute.
+
HTML5 video supports poster frames
+
The poster attribute is now supported for the video element, allowing content to specify a poster frame to be displayed until the video begins to play.
+
Checkboxes and radio buttons support the indeterminate property
+
HTML input elements of types checkbox and radio now support the indeterminate property, which allows a third, "indeterminate" state.
+
Canvas image smoothing can be controlled
+
The new mozImageSmoothingEnabled property can be used to turn on and off image smoothing when scaling in canvas elements.
+
Asynchronous script execution
+
By setting the async attribute on a script element, the script will not block loading or display of the rest of the page. Instead the script executes as soon as it is downloaded.
+
+ +

JavaScript

+ +

Gecko 1.9.2引入了JavaScript 1.8.2, 该版本的JavaScript添加了许多来自ECMAScript 5的新的语言特性:

+ + + +
+
+ +

DOM

+ +
+
Web workers可以自行终止
+
Workers 开始支持nsIWorkerScope.close()方法, 该方法允许它们终止自身的运行.
+
支持文件的拖放
+
DataTransfer对象提供的拖拽监听器现在可以包含一个被拖拽的文件列表.
+
Checking to see if an element matches a specified CSS selector
+
The new element.mozMatchesSelector method lets you determine whether or not an element matches a specified CSS selector. See bug 518003.
+
Detecting device orientation
+
Content can now detect the orientation of the device if it has a supported accelerometer, using the MozOrientation event. Firefox 3.6 supports the accelerometer in Mac laptops.
+
Detecting document width and height changes
+
The new MozScrollAreaChanged event is dispatched whenever the document's scrollWidth and/or scrollHeight properties change.
+
+ +

Miscellaneous DOM changes

+ + + +

XPath

+ +
+
支持choose()方法
+
XPath开始支持choose()方法.
+
+ +

For XUL and add-on developers

+ +

If you're an extension developer, you should start by reading Updating extensions for Firefox 3.6, which offers a helpful overview of what changes may affect your extension. Plug-in developers should read Updating plug-ins for Firefox 3.6.

+ +

New features

+ +
+
Detecting device orientation
+
Content can now detect the orientation of the device if it has a supported accelerometer, using the MozOrientation event. Firefox 3.6 supports the accelerometer in Mac laptops.
+
Monitoring HTTP activity
+
You can now monitor HTTP transactions to observe requests and responses in real time.
+
Working with the Windows taskbar
+
It's now possible to customize the appearance of windows in the taskbar in Windows 7 or later. This has been disabled by default in Firefox 3.6.
+
+ +

Places

+ + + +

Storage

+ +
+
Locale-aware collation of data is now supported by the Storage API
+
Gecko 1.9.2 added several new collation methods to provide optimized collation (sorting) of results using locale-aware techniques.
+
Properties on a statement can now be enumerated
+
You can now use a for..in enumeration to enumerate all the properties on a statement.
+
mozIStorageStatement's getParameterIndex changed behavior between 3.5 and 3.6.
+
See bug 528166 for details.
+
Asynchronously bind multiple sets of parameters and execute a statement.
+
See bug 490085 for details. Documentation coming soon.
+
+ +

Preferences

+ + + +

Themes

+ +

See Updating themes for Firefox 3.6 for a list of changes related to themes.

+ +
+
Lightweight themes
+
Firefox 3.6 supports lightweight themes; these are easy-to-create themes that simply apply a background to the top (URL bar and button bar) and bottom (status bar) of browser windows. This is an integration of the existing Personas theme architecture into Firefox.
+
+ +

Miscellaneous

+ + + +

Firefox/Gecko开发

+ +

Certain changes are only really interesting if you work on the internals of Firefox itself.

+ +

Interfaces merged

+ +

The following interfaces have been combined together:

+ + + +

Interfaces removed

+ +

The following interfaces have been removed entirely because they were unused, unimplemented, or obsolete:

+ + + +

Interfaces moved

+ +

The following interfaces have been relocated from their previous IDL files into new ones:

+ + + +

A large number of interfaces have been moved. See Interfaces moved in Firefox 3.6 for a complete list.

+ +

Other interface changes

+ +

The following assorted changes have been made:

+ + + +

Changes in accessibility code

+ + + +

相关链接

+ + diff --git a/files/zh-cn/mozilla/firefox/releases/3/index.html b/files/zh-cn/mozilla/firefox/releases/3/index.html new file mode 100644 index 0000000000..561c473cd3 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/3/index.html @@ -0,0 +1,310 @@ +--- +title: 致Firefox 3开发者 +slug: Mozilla/Firefox/Releases/3 +tags: + - Firefox 3 +translation_of: Mozilla/Firefox/Releases/3 +--- +
{{FirefoxSidebar}}

如果你是一个Web开发人员,并且希望了解Firefox 3中所有的新特性,这里是一个很好的起点。这篇文章提供了一个覆盖所有Firefox 3新特性的列表。虽然他并不是能够包括所有微小的改动,但他能够帮助你学习到最主要的更新。

+

 

+

Firefox 3 中新的开发人员特性

+

对网站和程序开发者

+
+
+ 更新WEB应用以适应Firefox 3
+
+ 提供了您用于更新WEB应用以受益于Firefox 3新特性所需的信息。
+
+
+
+ 上线与离线事件
+
+ Firefox 3支持WHATWG的上线与离线事件,基于这一特性,程序可以检测当前是否有可用的互联网联接以及何时上线或下线。
+
+
+
+ 跨域的XMLHttpRequest请求
+
+ Firefox 3支持W3C Access Control工作草案,使你有能够使用XMLHttpRequests检索和操作其他站点的数据;使你能够创造令人印象深刻的以浏览器为基础的交互式应用(mashups)。
+
+
+
+ 交错格式样表
+
+ Firefox 3 支持CSS 层叠式样式表 API.
+
+
+ 基于web的协议处理
+
+ 你现在可以使用navigator.registerProtocolHandler()方法注册web应用
+
+
+
+ 在画布(canvas)中“绘”出文字
+
+ 您可以使用Firefox 3支持的非标准API在canvas上绘制文字。
+
+
+
+ 支持画布变换
+
+ Firefox现在的canvas支持transform()setTransform()方法。
+
+
+
+ 使用微格式
+
+ Firefox现在有一组微格式的API。
+
+
+
+ 拖放事件
+
+ Firefox 3 支持新的拖放事件,当拖放开始和结束时,该事件将会被发送至源节点。
+
+ HTML的焦点管理
+
+
+
+ 新的HTML 5 支持activeElement和hasFocus属性
+
+
+
+ 离线浏览
+
+ 在Firefox中,WEB程序现在可以在离线时使用之前被缓存的资源。
+
+ 在Firefox 3中CSS的改进
+
+ Firefox 3 在支持CSS的功能上进行了一些完善。
+
+
+
+ 在Firefox 3中DOM的改进
+
+ Firefox 3 在Firefox3 DOM执行方面提供了一些新的功能,包括支持一些扩展的浏览器的DOM。
+
+
+
+ JavaScript 1.8 的支持
+
+ Firefox 3 提供了 JavaScript 1.8 标准的支持。
+
+
+
+ EXSLT支持
+
+ Firefox 3 提供了对 EXSLTXSLT的扩展)一个基本子集个支持。
+
+
+
+ Firefox 3中SVG的改进
+
+ Firefox 3 对SVG 的支持有了长足的改进:支持二十余个新透镜、一些新元素、一些新属性以及一些其他改进。
+
+
+
+ 对PNG动画的支持
+
+ Firefox 3 提供了对色彩艳丽的 PNG (APNG) 图像格式的支持.
+
+
+
+ <a ping>
+
+  现在可以使用 <a ping> 功能 ping 一个 URL ,并且此功能默认启用.
+
+

对XUL和扩展插件的开发者

+

 

+
+
+

   提供了你需要做的事情的向导,更新您的Firefox 3 扩展。

+
+
+ 更新扩展以兼容Firefox 3
+
+

FUEL 知识库

+
+
+ FUEL 使扩展开发者完成更有成效,更精悍的 XPCOM 规范代码并获得一些 "模式" JavaScript 思想。
+
+

   Firefox 3的提供了一些新的XUL元素,包括新的缩放法,日期和时间获取,以及旋转按钮。

+
+
+ Firefox  3在 XUL 上的改进   
+
+
+
+ Firefox 3的模板
+
+ Firefox 3的模板已显着改善 。关键的改进是,允许使用自定义查询处理器,除数据源之外还可以使用RDF。 
+
+

嵌入的XBL绑定

+
+
+ 现在,您可以使用 data: 网络协议直接嵌入XBL绑定,而不是在单独的XML文件中使用他们。 +

 

+
+
+ 本地化扩展描述
+
+ 这可让本地化的详细信息在附加组件被下载时或被禁用即时生效。 
+
+
+
+ 可靠更新
+
+

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

+
+
+ 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.
+
+
+
+ 全屏缩放
+
+
+
+ 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模块
+
+
+
+ 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.
+
+
+
+ Places
+
+
+
+ The history and bookmarks APIs have been completely replaced by the new Places API.
+
+
+
+ Making the transition to Places
+
+
+
+ An article about how to update an existing extension to use the Places API.
+
+
+
+ Firefox 3中下载管理器的改进
+
+
+
+ The Firefox 3 Download Manager features new and improved APIs, including support for multiple progress listeners.
+
+
+
+ Using nsILoginManager
+
+
+
+ 密码管理已经被新的登录管理所代替。
+
+
+
+ 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.
+
+
+
+ Notable bugs fixed in Firefox 3
+
+
+
+ 文章中所提供的相关Bug信息,已经在Firefox 3中进行了修改。
+
+
+
+ Firefox 3 的界面改动
+
+
+
+ Notes and information of use to people who want to create themes for Firefox 3.
+
+

最终用户将能体验到的新特性

+

用户体验

+ +

安全和隐私

+ + +

性能

+ +

参见

+ +

{{ languages( { "es": "es/Firefox_3_para_desarrolladores", "fr": "fr/Firefox_3_pour_les_d\u00e9veloppeurs", "ja": "ja/Firefox_3_for_developers", "zh-tw": "zh_tw/Firefox_3_for_developers", "zh-cn": "cn/Firefox_3_for_developers", "ko": "ko/Firefox_3_for_developers", "pl": "pl/Firefox_3_dla_programist\u00f3w", "pt": "pt/Firefox_3_para_desenvolvedores" } ) }}

diff --git a/files/zh-cn/mozilla/firefox/releases/3/site_compatibility/index.html b/files/zh-cn/mozilla/firefox/releases/3/site_compatibility/index.html new file mode 100644 index 0000000000..b8b2678b12 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/3/site_compatibility/index.html @@ -0,0 +1,26 @@ +--- +title: Gecko 1.9 Changes affecting websites +slug: Mozilla/Firefox/Releases/3/Site_compatibility +translation_of: Mozilla/Firefox/Releases/3/Site_compatibility +--- +
{{FirefoxSidebar}}

此页设法提供在 Gecko 1.8 和 Gecko 1.9 之间的变动概要,这些变动可能会影响某些网站的行为或网页渲染。

+

参见 Firefox 3 开发者参考

+

事件

+

捕获 load 事件监听

+

在 Gecko 1.8 中,不能在图片上设置 load 事件监听。 在 Gecko 1.9 中,已在 {{ Bug(234455) }} 中修复。 但是在某些网站中,由于捕获 load 事件的事件监听器不正确而导致问题。参见 {{ Bug(335251) }} 中的讨论。 要修复这个问题,出错的页面不再需要设置事件监听器。

+

例如,如下:

+
window.addEventListener('load', yourFunction, true);
+
+

应该更改为:

+
window.addEventListener('load', yourFunction, false);
+
+

事件捕获如何工作的解释,参见 DOM Level 2 事件捕获

+

preventBubble 已被移出

+

少许旧的事件 API 不再被支持

+

DOM

+

WRONG_DOCUMENT_ERR

+

范围

+

intersectsNode 已被移出

+

compareNode 已被移出

+

HTML

+

<object> 中的许多 bug 已经修复

diff --git a/files/zh-cn/mozilla/firefox/releases/31/index.html b/files/zh-cn/mozilla/firefox/releases/31/index.html new file mode 100644 index 0000000000..a22131fe8c --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/31/index.html @@ -0,0 +1,46 @@ +--- +title: Firefox 31 for developers +slug: Mozilla/Firefox/Releases/31 +translation_of: Mozilla/Firefox/Releases/31 +--- +
{{FirefoxSidebar}}

Web 开发者需要关注的变化

+

Developer Tools

+

No change.

+

CSS

+ +

HTML

+

No change.

+

JavaScript

+

实现了如下 ECMAScript 6 新特性:

+ +

Interfaces/APIs/DOM

+ +

MathML

+

No change.

+

SVG

+

No change.

+

Audio/Video

+

No change.

+

Security

+

No change.

+

Changes for add-on and Mozilla developers

+

No change.

+

See also

+ +

Older versions

+

{{Firefox_for_developers('30')}}

diff --git a/files/zh-cn/mozilla/firefox/releases/32/index.html b/files/zh-cn/mozilla/firefox/releases/32/index.html new file mode 100644 index 0000000000..b2bfbc3fd9 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/32/index.html @@ -0,0 +1,154 @@ +--- +title: Firefox 32 for developers +slug: Mozilla/Firefox/Releases/32 +tags: + - Firefox + - Firefox 31 +translation_of: Mozilla/Firefox/Releases/32 +--- +
{{FirefoxSidebar}}

普通 Web 开发者应该注意的变化

+ +

开发者工具

+ +

Highlights:

+ + + +

All devtools bugs fixed between Firefox 31 and Firefox 32.

+ +

CSS

+ + + +

HTML

+ + + +

JavaScript

+ + + +

Interfaces/APIs/DOM

+ + + +

MathML

+ + + +

SVG

+ +

No change.

+ +

WebRTC

+ + + +

Audio/Video

+ +

No change.

+ +

Security

+ + + +

附加组件 和 Mozilla 开发者应该注意的变化

+ +

Xray vision is now applied to JavaScript objects that are not themselves DOM objects: Xrays for JavaScript objects.

+ +

getDataDirectory() method has been added to Addon instances. This method returns the preferred location, within the current profile, for add-ons to store data.

+ +

 

+ +

Add-on SDK

+ +

Highlights

+ + + +

Details

+ +

GitHub commits made between Firefox 31 and Firefox 32. This will not include any uplifts made after this release entered Aurora.

+ +

Bugs fixed between Firefox 31 and Firefox 32. This will not include any uplifts made after this release entered Aurora.

+ +

XPCOM

+ + + +

 

+ +

相关链接

+ + + +

Older versions

+ +

{{Firefox_for_developers('31')}}

diff --git a/files/zh-cn/mozilla/firefox/releases/33/index.html b/files/zh-cn/mozilla/firefox/releases/33/index.html new file mode 100644 index 0000000000..accca764bf --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/33/index.html @@ -0,0 +1,38 @@ +--- +title: Firefox 33 for developers +slug: Mozilla/Firefox/Releases/33 +translation_of: Mozilla/Firefox/Releases/33 +--- +
{{FirefoxSidebar}}

普通 Web 开发者应该注意的变化

+

Developer Tools

+

No change.

+

CSS

+ +

HTML

+

No change.

+

JavaScript

+ +

Interfaces/APIs/DOM

+

No change.

+

MathML

+

No change.

+

SVG

+

No change.

+

Audio/Video

+

No change.

+

Security

+

No change.

+

附加组件 和 Mozilla 开发者应该注意的变化

+

No change.

+

相关链接

+ +

更早版本

+

{{Firefox_for_developers('32')}}

diff --git a/files/zh-cn/mozilla/firefox/releases/35/index.html b/files/zh-cn/mozilla/firefox/releases/35/index.html new file mode 100644 index 0000000000..c7d75e5f94 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/35/index.html @@ -0,0 +1,213 @@ +--- +title: Firefox 35 开发者相关变更清单 +slug: Mozilla/Firefox/Releases/35 +tags: + - Firefox + - Firefox 35 +translation_of: Mozilla/Firefox/Releases/35 +--- +
Firefox 35 was released on January 13th, 2015. This article lists key changes that are useful not only for web developers, but also Firefox and Gecko developers as well as add-on developers.
+ +

Web 开发者相关变更

+ +

开发者工具

+ +

Highlights:

+ + + +

All devtools bugs fixed between Firefox 34 and Firefox 35.

+ +

CSS

+ + + +

HTML

+ + + +

JavaScript

+ + + +

接口/APIs/DOM

+ + + +

 MathML

+ + + +

SVG

+ +

无变化。

+ +

音频/视频

+ +

无变化。

+ +

网络 & 安全

+ + + +

附加组件和 Mozilla 开发者相关的变更

+ +

XUL & 附加组件

+ + + +

Add-on SDK

+ +

Highlights

+ + + +

明细

+ +

Firefox 34 到 Firefox 35 的 GitHub 提交. This will not include any uplifts made after this release entered Aurora.

+ +

Bugs fixed between Firefox 34 and Firefox 35. This will not include any uplifts made after this release entered Aurora.

+ +

 

+ +

See also

+ + + +

 

+ +

以往版本

+ +
+ +
diff --git a/files/zh-cn/mozilla/firefox/releases/41/index.html b/files/zh-cn/mozilla/firefox/releases/41/index.html new file mode 100644 index 0000000000..9e373c6bf7 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/41/index.html @@ -0,0 +1,209 @@ +--- +title: Firefox 41 for developers +slug: Mozilla/Firefox/Releases/41 +tags: + - Firefox + - Firefox 41 +translation_of: Mozilla/Firefox/Releases/41 +--- +
{{FirefoxSidebar}}
To test the latest developer features of Firefox,
+install Firefox Developer Edition
Firefox 41 was released on September 22, 2015. This article lists key changes that are useful not only for web developers, but also Firefox and Gecko developers as well as add-on developers.
+ +

Changes for Web developers

+ +

开发工具

+ +

Highlights:

+ + + +

All devtools bugs fixed between Firefox 40 and Firefox 41: note that many of these bugs, especially those relating to the performance tools, were uplifted to Firefox 40.

+ +

CSS

+ + + +

HTML

+ + + +

JavaScript

+ + + +

Interfaces/APIs/DOM

+ + + +

Events

+ + + +

Web Crypto

+ + + +

Canvas API

+ + + +

Service Workers

+ + + +

WebGL

+ + + +

WebRTC

+ + + +

Miscellaneous

+ + + +

MathML

+ +

新的默认、支持字体处理

+ +

数学公式需要特殊的字体. 到目前为止, 这些字体被硬编码在用户默认样式 mathml.css (使用{{MathMLElement("math")}} 标志设置字体组) 和偏好选项font.mathfont-family (为拉伸和大操作数设置支持字体). Firefox 41 引入一个能够自动设置<math>标志和相应偏好选项的内置x-math 语言 (例如font.name.serif.x-math). 用户默认样式现在将<math>标志字体设置为serif 并且font.mathfont-family 被替换为 font.name.serif.x-math.  所有平台现在基本使用相同列表的支持字体, "Latin Modern Math" 是首选.在标准的 per-language字体偏好菜单中,默认支持字体能够被设置. 更多细节,请参照{{bug(947654)}} 和 {{bug(1160456)}}.

+ +

SVG

+ + + +

音频/视频

+ + + +

Networking

+ + + +

Security

+ + + +

Changes for add-on and Mozilla developers

+ +

XUL

+ +

没有变化。

+ +

JavaScript code modules

+ +

没有变化。

+ +

XPCOM

+ +

没有变化。

+ +

其他

+ + + +

See also

+ + + +

之前版本

+ +

{{Firefox_for_developers('40')}}

diff --git a/files/zh-cn/mozilla/firefox/releases/43/index.html b/files/zh-cn/mozilla/firefox/releases/43/index.html new file mode 100644 index 0000000000..81566a6373 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/43/index.html @@ -0,0 +1,173 @@ +--- +title: Firefox 43 for developers +slug: Mozilla/Firefox/Releases/43 +tags: + - Firefox +translation_of: Mozilla/Firefox/Releases/43 +--- +
{{FirefoxSidebar}}

To test the latest developer features of Firefox,
+ install Firefox Developer Edition
Firefox 43 was released on December 15, 2015. This article lists key changes that are useful not only for web developers, but also Firefox and Gecko developers as well as add-on developers.

+ +

Changes for Web developers

+ +

Developer Tools

+ +

Highlights:

+ + + +

All devtools bugs fixed between Firefox 42 and Firefox 43.

+ +

CSS

+ + + +

HTML

+ + + +

JavaScript

+ +

New APIs

+ + + +

Changes regarding the arguments object

+ + + +

Other changes

+ + + +

Interfaces/APIs/DOM

+ +

DOM & HTML DOM

+ +

No change.

+ +

IndexedDB

+ + + +

Service Workers

+ + + +

WebRTC

+ + + +

Miscellaneous

+ + + +

MathML

+ +

No change.

+ +

SVG

+ +

No change.

+ +

Audio/Video

+ +

No change.

+ +

HTTP

+ +

No change.

+ +

Networking

+ +

No change.

+ +

Security

+ + + +

Changes for add-on and Mozilla developers

+ +

Interfaces

+ +

No change

+ +

XUL

+ +

No change.

+ +

JavaScript code modules

+ +

No change.

+ +

XPCOM

+ +

No change.

+ +

Plugins

+ + + +

Other

+ +

No change.

+ +

See also

+ + + +

Older versions

+ +

{{Firefox_for_developers('42')}}

diff --git a/files/zh-cn/mozilla/firefox/releases/44/index.html b/files/zh-cn/mozilla/firefox/releases/44/index.html new file mode 100644 index 0000000000..d18ac693ac --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/44/index.html @@ -0,0 +1,222 @@ +--- +title: Firefox 44 for developers +slug: Mozilla/Firefox/Releases/44 +translation_of: Mozilla/Firefox/Releases/44 +--- +
{{FirefoxSidebar}}

为了测试火狐最新的开发人员特性,请安装火狐开发人员版(Firefox Developer Edition )Firefox 44 于2016年1月26号发布。这个页面列出了对开发人员有用的关键变化。

+ +

对于Web开发人员的变化

+ +

开发者工具

+ +

{{page('/en-US/docs/Tools/Release_notes', 'Firefox_44')}}

+ +

HTML

+ + + +

CSS

+ + + +

JavaScript

+ +

New APIs

+ + + +

Changes

+ + + +

Removals

+ + + +

Interfaces/APIs/DOM

+ +

DOM & HTML DOM

+ + + +

Canvas

+ + + +

WebGL

+ + + +

IndexedDB

+ + + +

Service Workers

+ + + +

WebRTC

+ + + +

New APIs

+ + + +

Miscellaneous

+ + + +

MathML

+ +

No change.

+ +

SVG

+ +

No change.

+ +

Audio/Video

+ +

No change.

+ +

HTTP

+ + + +

Networking

+ +

No change.

+ +

Security

+ + + +

Changes for add-on and Mozilla developers

+ +

Interfaces

+ +

No change

+ +

XUL

+ +

No change.

+ +

JavaScript code modules

+ + + +

XPCOM

+ + + +

Other

+ + + +

See also

+ + + +

Older versions

+ +

{{Firefox_for_developers(43)}}

diff --git a/files/zh-cn/mozilla/firefox/releases/45/index.html b/files/zh-cn/mozilla/firefox/releases/45/index.html new file mode 100644 index 0000000000..e288cbacc6 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/45/index.html @@ -0,0 +1,187 @@ +--- +title: Firefox 45 for developers +slug: Mozilla/Firefox/Releases/45 +tags: + - Firefox + - Firefox 45 +translation_of: Mozilla/Firefox/Releases/45 +--- +
{{FirefoxSidebar}}

安装Firefox开发者版本,
+ 以便测试Firefox最新的功能
Firefox 45 was released on March 8, 2016. This article lists key changes that are useful not only for web developers, but also Firefox and Gecko developers as well as add-on developers.

+ +

针对网络开发者的功能更新

+ +

开发工具

+ +

{{page('/en-US/docs/Tools/Release_notes', 'Firefox_45')}}

+ +

HTML

+ + + +

CSS

+ + + +

JavaScript

+ + + +

Interfaces/APIs/DOM

+ +

DOM & HTML DOM

+ + + +

WebGL

+ +

Our implementation of WebGL2 have been extended:

+ + + +

IndexedDB

+ +

No change.

+ +

Service Workers

+ + + +

WebRTC

+ +

No change.

+ +

New APIs

+ +

No change.

+ +

Miscellaneous

+ + + +

MathML

+ +

 

+ +

No change.

+ +

SVG

+ + + +

Audio/Video

+ + + +

HTTP

+ + + +

Security

+ + + +

Changes for add-on and Mozilla developers

+ +

Interfaces

+ +

No change.

+ +

XUL

+ + + +

JavaScript code modules

+ +

No change.

+ +

XPCOM

+ +

No change.

+ +

Search plugins

+ +

Starting in Firefox 45, search plugins located in the user's profile's searchpluginsdirectory are no longer automatically loaded on startup. Instead, a list of user-installed plugins is maintained and only those plugins are loaded. In effect, this means that the only ways to install new search plugins are for the user to do so in the Firefox UX (via OpenSearch discovery, for instance) or for an add-on to install it. Also, when a new search plugin is installed, more information is recorded about where it came from, for future use by profile debugging and cleaning tools.

+ +

 

+ +

Other

+ + + +

 

+ +

See also

+ + + +

Older versions

+ +

{{Firefox_for_developers(44)}}

diff --git a/files/zh-cn/mozilla/firefox/releases/49/index.html b/files/zh-cn/mozilla/firefox/releases/49/index.html new file mode 100644 index 0000000000..d1afa7f9a6 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/49/index.html @@ -0,0 +1,348 @@ +--- +title: Firefox 49 for developers +slug: Mozilla/Firefox/Releases/49 +tags: + - Firefox + - Firefox 49 +translation_of: Mozilla/Firefox/Releases/49 +--- +
{{FirefoxSidebar}}

To test the latest developer features of Firefox,
+ install Firefox Developer Edition
Firefox 49 was released on September 20, 2016. This article lists key changes that are useful not only for web developers, but also Firefox and Gecko developers as well as add-on developers.

+ +

对于Web开发者的改变

+ +

开发者工具

+ + + +

HTML

+ + + +

CSS

+ + + +

JavaScript

+ + + +

Interfaces/APIs/DOM

+ +

DOM & HTML DOM

+ + + +

Canvas

+ + + +

WebGL

+ + + +

IndexedDB

+ + + + + + + +

Media Streams

+ + + +

WebRTC

+ + + +

New APIs

+ + + +

Others

+ + + +

MathML

+ +

No change.

+ +

SVG

+ + + +

Audio/Video

+ +

没有改变.

+ +

Plugins and Flash

+ +

Beginning in Firefox 49, Firefox, by default, blocks certain kinds of Flash content that aren't necessary for sites to function well. This behavior, controlled by the preference browser.safebrowsing.blockedURIs.enabled, helps to improve the performance of sites and Firefox in general without having significant impact on site usability. It also helps improve stability of the browsing experience by elminating a major cause of crashes. The blocked Flash modules include several used just for fingerprinting purposes, as well as a number of "supercookie" modules, and in the future may be expanded to include more types of blocked modules. See {{bug(1275591)}} for details.

+ +

This marks the next step in the journey toward a plugin-free future. HTML is very close to the point where plugins will no longer be needed to get the job done.

+ +

HTTP

+ + + +

Networking

+ + + +

Security

+ + + +

Compatibility

+ +

为了增强兼容性对于现在已经存在的内容, Firefox 现在接受一些 webkit 前缀 properties and attributes.

+ + + +

改变对于 add-on and Mozilla developers

+ +

WebExtensions

+ + + +

Interfaces

+ + + +

Other

+ +

没有改变.

+ +

See also

+ + + +

Older versions

+ +

{{Firefox_for_developers(48)}}

diff --git a/files/zh-cn/mozilla/firefox/releases/56/index.html b/files/zh-cn/mozilla/firefox/releases/56/index.html new file mode 100644 index 0000000000..e7e2870e37 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/56/index.html @@ -0,0 +1,129 @@ +--- +title: Firefox 56 for developers +slug: Mozilla/Firefox/Releases/56 +translation_of: Mozilla/Firefox/Releases/56 +--- +
{{FirefoxSidebar}}
+

本文介绍了一些在Firefox 56中的一些改进,这些改进会对开发者们产生影响。Firefox 56是当前Firefox的Beta版,预计在2017年9月26日正式发布。

+ +
+

针对网页开发者们的若干改变

+ +

开发者工具

+ +
    +
  • 在CSS格检查器中显示以负号开始的行号({{bug(1369942)}}).
  • +
+ +

HTML

+ +
    +
  • 在打标签的窗体控件中采用labels 属性,比如 {{domxref("HTMLInputElement.labels")}} ({{bug(556743)}}).
  • +
  • 实现了 <link rel="preload">; 更详细的内容,可以参见 Preloading content with rel="preload"  ({{bug(1222633)}}). 需要注意的是,当前的Firefox只支持对可缓存的资源进行预加载。
  • +
+ +

CSS

+ +
    +
  • 实现了Mozilla自有的属性 {{cssxref("<color>")}} 值为 -moz-win-accentcolor 以及 -moz-win-accentcolortext (可以参见 {{bug(1344910)}}), 以及专用的媒体查询语句 -moz-windows-accent-color-in-titlebar (参见{{bug(1379938)}}).
  • +
+ +

SVG

+ +

无修改.

+ +

JavaScript

+ +
    +
  • The Intl API has been enabled on Firefox for Android ({{bug(1344625)}}).
  • +
+ +

APIs

+ +

New APIs

+ +

No changes.

+ +

DOM

+ +
    +
  • On Mac, {{domxref("Document.hidden")}} is now true when the window is behind another non-translucent application {{bug(1236512)}}.
  • +
  • The {{domxref("Gamepad.displayId")}} property has been implemented ({{bug(1375816)}}).
  • +
  • The {{domxref("PerformanceTiming.secureConnectionStart")}} property has been implemented ({{bug(772589)}}).
  • +
  • Firefox used to accept iso-2022-jp-2 sequences silently when an iso-2022-jp {{domxref("TextDecoder.TextDecoder","TextDecoder()")}} was instantiated, however this has now been removed to simplify the API, as no other browsers support it and no pages seem to use it. ({{bug(715833)}}).
  • +
  • The 4ms clamping behaviour of {{domxref("WindowOrWorkerGlobalScope.setTimeout","setTimeout()")}} and {{domxref("WindowOrWorkerGlobalScope.setInterval","setInterval()")}} has been updated to be more in line with other browsers, as described in Timeouts throttled to >=4ms ({{bug(1378586)}}).
  • +
  • The Page Visibility API's {{domxref("Document.onvisibilitychange")}} handler has been added ({{bug("1333912")}}).
  • +
  • The {{domxref("Window.showModalDialog()")}} method has been removed ({{bug(981796)}}).
  • +
+ +

DOM events

+ +
    +
  • {{domxref("GlobalEventHandlers.onwheel")}} is now available on {{domxref("HTMLElement")}} — it wasn't before ({{bug(1370550)}}).
  • +
+ +

WebRTC

+ +
    +
  • Firefox now supports the {{domxref("RTCPeerConnection")}} properties which let you examine the current and pending configurations of the local and remote ends of the connection, to help manage changes in configuration: {{domxref("RTCPeerConnection.currentLocalDescription", "currentLocalDescription")}}, {{domxref("RTCPeerConnection.pendingLocalDescription", "pendingLocalDescription")}}, {{domxref("RTCPeerConnection.currentRemoteDescription", "currentRemoteDescription")}}, and {{domxref("RTCPeerConnection.pendingRemoteDescription", "pendingRemoteDescription")}}.
  • +
+ +

Canvas and WebGL

+ +
    +
  • The {{domxref("CanvasRenderingContext2D.drawImage()")}} method has been updated so that smoothing occurs when downscaling even if imageSmoothingEnabled is false. This is not mandatory as per spec, but follows Chrome's behaviour. See {{bug(1360415)}}.
  • +
  • An {{domxref("SVGImageElement")}} can now be used as a {{domxref("CanvasImageSource")}}, e.g. as the image source in a {{domxref("CanvasRenderingContext2D.drawImage","drawImage()")}} call ({{bug(1382027)}}).
  • +
+ +

Security

+ +

No changes.

+ +

Plugins

+ +

No changes.

+ +

Other

+ +
    +
  • Gecko now encodes URLs internally as punycode, to avoid URL encoding problems (see {{bug("945240")}}, also see discussion in {{bug("942074")}}).
  • +
  • Firefox on Windows and Mac OS X can now be made to run in headless mode using the -headless flag (see {{bug(1355150)}} and {{bug(1355147)}}).
  • +
+ +

Removals from the web platform

+ +

HTML

+ +
    +
  • The {{htmlelement("isindex")}} element has been removed from the HTML parser, and from form submission ({{bug(1266495)}}).
  • +
  • The {{htmlelement("applet")}} element has been removed ({{bug(1279218)}}).
  • +
+ +

APIs

+ +

No changes.

+ +

SVG

+ +

No changes.

+ +

Changes for add-on and Mozilla developers

+ +

WebExtensions

+ +

No changes.

+ +

See also

+ + +
+ + + +

Older versions

+ +

{{Firefox_for_developers(55)}}

+
diff --git a/files/zh-cn/mozilla/firefox/releases/59/index.html b/files/zh-cn/mozilla/firefox/releases/59/index.html new file mode 100644 index 0000000000..aca2ace7c6 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/59/index.html @@ -0,0 +1,130 @@ +--- +title: Firefox 59 for developers +slug: Mozilla/Firefox/Releases/59 +tags: + - '29' + - 发布说明 + - 火狐 +translation_of: Mozilla/Firefox/Releases/59 +--- +
{{FirefoxSidebar}}
{{draft}}
+ +

本文提供了有关Firefox 59中会影响开发人员的更改的信息。 Firefox 59已于2018年3月13日发布。

+ +
+

Web开发者应该注意的变化

+ +

开发工具

+ + + +

HTML

+ + + +

CSS

+ +

无变化。

+ +

SVG

+ +

无变化。

+ +

JavaScript

+ +

无变化。

+ +

APIs

+ +

新增API

+ + + +

DOM

+ +

无变化。

+ +

DOM 事件

+ + + +

多媒体 和 WebRTC

+ +

无变化。

+ +

Canvas 和 WebGL

+ +

无变化。

+ +

HTTP

+ +

无变化。

+ +

安全

+ + + +

插件

+ +

无变化。

+ +

其他

+ +

无变化。

+ +

Web平台的删减

+ +

HTML

+ +

无变化。

+ +

CSS

+ +

无变化。

+ +

APIs

+ + + +

SVG

+ +

无变化

+ +

Mozilla和附加组件开发者应该注意的变化

+ +

WebExtensions

+ +

无变化

+ +

参见

+ + +
+ + + +

历史版本

+ +

{{Firefox_for_developers(58)}}

diff --git a/files/zh-cn/mozilla/firefox/releases/62/index.html b/files/zh-cn/mozilla/firefox/releases/62/index.html new file mode 100644 index 0000000000..10a5c5423a --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/62/index.html @@ -0,0 +1,187 @@ +--- +title: Firefox 62 for developers +slug: Mozilla/Firefox/Releases/62 +translation_of: Mozilla/Firefox/Releases/62 +--- +
{{FirefoxSidebar}}
{{FirefoxSidebar}}
+ +
{{draft}}
+ +

This article provides information about the changes in Firefox 62 that will affect developers. Firefox 62 is the current Beta version of Firefox, and will ship on September 5, 2018.

+ +

Changes for web developers

+ +

Developer tools

+ + + +

HTML

+ +

没有变化。

+ +

CSS

+ + + +

SVG

+ +

No changes.

+ +

JavaScript

+ + + +

APIs

+ +

New APIs

+ + + +

DOM

+ + + +

DOM events

+ +

No changes.

+ +

Service workers

+ +

No changes.

+ +

Media, Web Audio, and WebRTC

+ + + +

Canvas and WebGL

+ +

No changes.

+ + + +

CSSOM

+ + + +

HTTP

+ + + +

Security

+ +

No changes.

+ +

Plugins

+ +

No changes.

+ +

Other

+ +

No changes.

+ +

Removals from the web platform

+ +

HTML

+ +

No changes.

+ +

CSS

+ +

No changes.

+ +

APIs

+ +

No changes.

+ +

SVG

+ +

No changes.

+ +

Other

+ +

No changes.

+ +

Changes for add-on and Mozilla developers

+ +

WebExtensions

+ +

API changes

+ + + +

Manifest changes

+ + + +

Theme changes

+ + + +

Other changes

+ + + +

See also

+ + + +

Older versions

+ +

{{Firefox_for_developers(61)}}

diff --git a/files/zh-cn/mozilla/firefox/releases/65/index.html b/files/zh-cn/mozilla/firefox/releases/65/index.html new file mode 100644 index 0000000000..548193494e --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/65/index.html @@ -0,0 +1,128 @@ +--- +title: Firefox 65 for developers +slug: Mozilla/Firefox/Releases/65 +tags: + - '65' +translation_of: Mozilla/Firefox/Releases/65 +--- +
{{FirefoxSidebar}}{{Draft}}
+ +

本文提供了有关 Firefox 65 中将影响开发者的更改信息。 Firefox 65 是当前的 Nightly 版本, 将于2019年1月29日发布。

+ +

为网页开发者带来的改变

+ +

开发者工具

+ +

移除

+ +

HTML

+ +

事件现在可以在禁用状态下的 HTML 元素上进行分发,如设置了 disabled 属性的 {{htmlelement("button")}}, {{htmlelement("fieldset")}}, {{htmlelement("input")}}, {{htmlelement("select")}},和 {{htmlelement("textarea")}} ({{bug(329509)}})。

+ +

移除

+ +

CSS

+ + + +

移除

+ + + +

SVG

+ +

无变化。

+ +

移除

+ +

JavaScript

+ +

移除

+ +

APIs

+ +

无变化。

+ +

新的 APIs

+ +

DOM

+ + + +

DOM events

+ + + +

Service workers

+ + + +

Media, Web Audio, 和 WebRTC

+ + + +

Canvas 和 WebGL

+ +

移除

+ + + +

安全

+ +

无变化。

+ +

移除

+ +

插件

+ +

无变化。

+ +

移除

+ +

其他

+ +

无变化。

+ +

移除

+ +

为附加组件开发者带来的改变

+ +

API 变化

+ +

移除

+ +

Manifest 变化

+ +

移除

+ +

参阅

+ + + +

更早期的版本

+ +

{{Firefox_for_developers(65)}}

diff --git a/files/zh-cn/mozilla/firefox/releases/68/index.html b/files/zh-cn/mozilla/firefox/releases/68/index.html new file mode 100644 index 0000000000..621bd205fb --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/68/index.html @@ -0,0 +1,240 @@ +--- +title: 为开发者的 Firefox 68 文档 +slug: Mozilla/Firefox/Releases/68 +translation_of: Mozilla/Firefox/Releases/68 +--- +

{{FirefoxSidebar}}

+ +

本篇文章将提供关于在Firefox 68版本中,会影响到开发人员的更新的信息。Firefox 68版本发布于2019年7月9日。

+ +

面向开发者的变更

+ +

开发者工具

+ +

浏览器/网页控制台

+ + + +

JavaScript 调试器

+ + + +

网络监视器

+ + + +

页面查看器

+ + + +

存储查看器

+ + + +

其它

+ + + +

移除

+ + + +

HTML

+ + + +

 移除

+ + + +

CSS

+ + + +

Removals

+ + + +

SVG

+ +

No changes.

+ +

JavaScript

+ + + +

APIs

+ +

CSS Object Model (CSSOM)

+ + + +

DOM

+ + + +

DOM events

+ + + +

Media, Web Audio, and WebRTC

+ + + +

Removals

+ + + +

HTTP

+ + + +

Removals

+ + + +

Security

+ + + +

WebDriver conformance (Marionette)

+ +

Bug fixes

+ + + +

Other

+ + + +

Plugins

+ +

No changes.

+ +

Changes for add-on developers

+ +

API changes

+ + + +

显著变更

+ +

无变更。

+ +

还可以看看

+ + + +

更早的版本

+ +

{{Firefox_for_developers(67)}}

diff --git a/files/zh-cn/mozilla/firefox/releases/69/index.html b/files/zh-cn/mozilla/firefox/releases/69/index.html new file mode 100644 index 0000000000..88f1c741aa --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/69/index.html @@ -0,0 +1,185 @@ +--- +title: 面向开发者的Firefox 69 +slug: Mozilla/Firefox/Releases/69 +translation_of: Mozilla/Firefox/Releases/69 +--- +

{{FirefoxSidebar}}

+ +

这篇文章将会围绕Firefox 69对于开发者产生的影响展开。

+ +

Firefox 69 发布于2019年9月3日。

+ +

对于web开发者的变化

+ +

开发者工具

+ +

Debugger(调试器)

+ + + +

Console(控制台)

+ + + +

Network(网络)

+ + + +

Inspector(查看器)

+ + + +

Remote debugging(远程调试)

+ + + +

General(日常)

+ + + +

HTML

+ + + +

 Removals

+ + + +

CSS

+ + + +

SVG

+ + + +

JavaScript

+ + + +

HTTP

+ + + +

APIs

+ +

New APIs

+ + + +

DOM

+ + + +

Media, Web Audio, and WebRTC

+ + + +

Removals

+ + + +

WebDriver conformance (Marionette)

+ +

Other

+ + + +

Changes for add-on developers

+ +

API changes

+ + + +

Other changes

+ + + +

See also

+ + + +

Older versions

+ +

{{Firefox_for_developers(68)}}

diff --git a/files/zh-cn/mozilla/firefox/releases/78/index.html b/files/zh-cn/mozilla/firefox/releases/78/index.html new file mode 100644 index 0000000000..1c28b03a7a --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/78/index.html @@ -0,0 +1,116 @@ +--- +title: 对于开发人员的Firefox 78 +slug: Mozilla/Firefox/Releases/78 +translation_of: Mozilla/Firefox/Releases/78 +--- +

{{FirefoxSidebar}}

+ +

本文提供了有关Firefox 78中将影响开发人员的更改的信息。 Firefox 78发布于2020年6月30日.

+ +

另请参阅Firefox 78中的新增功能:DevTools的改进,新的正则表达式引擎以及Mozilla hacks上大量的Web平台更新。

+ +

对于Web开发人员的更改

+ +

开发者工具

+ +

调试器

+ + + +

网络监控器

+ + + +

其他工具

+ + + +

CSS

+ + + +

JavaScript

+ + + +

一些API

+ +

DOM

+ + + +

服务工作者

+ + + +

Web组装

+ + + +

TLS 1.0和1.1已被移除

+ + + +

对于附加组件开发人员的更改

+ + + +

参见

+ + + +

旧版本

+ +

{{Firefox_for_developers(77)}}

diff --git a/files/zh-cn/mozilla/firefox/releases/index.html b/files/zh-cn/mozilla/firefox/releases/index.html new file mode 100644 index 0000000000..9f16917cdc --- /dev/null +++ b/files/zh-cn/mozilla/firefox/releases/index.html @@ -0,0 +1,12 @@ +--- +title: 与Firefox开发者相关的发行说明 +slug: Mozilla/Firefox/Releases +tags: + - Firefox + - NeedsTranslation + - TopicStub +translation_of: Mozilla/Firefox/Releases +--- +
{{FirefoxSidebar}}

本页提供每个Firefox的版本的“与Firefox开发者相关的发行说明”文章的链接。这些日志文章可以让你查看每个Firefox版本增加了哪些功能和修复的错误。

+ +
{{ListSubpages("",1,1,1)}}
diff --git a/files/zh-cn/mozilla/firefox/the_about_protocol/index.html b/files/zh-cn/mozilla/firefox/the_about_protocol/index.html new file mode 100644 index 0000000000..9b889c3338 --- /dev/null +++ b/files/zh-cn/mozilla/firefox/the_about_protocol/index.html @@ -0,0 +1,163 @@ +--- +title: Firefox 与 "about" 协议 +slug: Mozilla/Firefox/The_about_protocol +translation_of: Mozilla/Firefox/The_about_protocol +--- +
{{FirefoxSidebar}}

Firefox 在 about: URL 协议中藏有很多隐藏的功能和有用的信息。最常用的 URL 就是 about:config,它提供首选项的显示和修改功能。以下是 about: 伪协议的完整列表:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
about: 页面描述
about:显示版本和构建信息,以及查阅贡献者、许可信息和构建配置的链接。
about:about提供 about: 页面的完整列表
about:accounts同步 功能使用的页面
about:addons附加组件管理器
about:app-manager应用管理器
about:buildconfig显示构建此 Firefox 所用的配置和平台
about:cache显示有关内存、磁盘和应用缓存的信息
about:compartments显示有关 compartments 的信息。从 Firefox 26 开始,此信息可在 about:memory 的 "Other Measurements"  部分找到
about:config允许查看和更改 Firefox 内部的首选项(偏好和设置)
about:crashes列出所有崩溃报告
about:credits列出所有参与 Firefox 产品的贡献者姓名
about:customizing切换到“定制”模式,允许用户定制 Firefox 的用户界面
about:downloads显示用 Firefox 进行的下载
about:healthreport显示 Firefox 的性能信息(如果用户已启用“健康报告”功能)
about:homeFirefox 原生的开始页(新窗口的第一个页面)
about:license显示许可信息
about:logoFirefox 标志
about:memory提供一种方法探查内存使用情况,以及保存为报告,还有运行 GC 和 CC
about:mozilla一个特殊页面,显示“Mozilla 之书”摘录
about:networking显示网络相关的信息
about:newtab新建一个标签页时显示的页面
about:permissions提供一种方法来显示和管理网站权限。在 Firefox 45 中已去除({{bug(933917)}})
about:plugins显示已安装插件的信息
about:preferencesFirefox 设置(也可通过 Firefox > 选项 来打开)
about:privatebrowsing打开新的隐私浏览窗口时显示的页面
about:reader指示在一个页面上开启了阅读视图。 参见Firefox 排除干扰的阅读视图
about:rights显示权利信息
about:robots显示有关机器人的信息,一个特殊的页面
about:sessionrestore会话恢复(Firefox 从崩溃恢复时显示)
about:support故障排除信息(也称“疑难解答”信息)。也可通过 Firefox 菜单 > ? (问号) > 故障排除信息 打开
about:sync-log显示 同步 功能所用的同步协议的日志
about:sync-progress这是 同步 功能设置完成后显示的页面
about:sync-tabs列出 同步 功能同步的标签页
about:telemetry显示在 Firefox 运行时已收集和将发送到 Mozilla 的遥测数据(如果用户已启用“遥测”功能)
about:webrtc有关 WebRTC 的使用情况
about:welcomeback在 Firefox 被重置后显示的信息页面
+ +

这些 URL 在 {{source("docshell/base/nsAboutRedirector.cpp")}} 中的 kRedirMap 数组定义。该数组映射大部分 URL,比如 config 指向 chrome: 伪协议,例如 chrome://global/content/config.xul。about 的位置信息在 {{source("docshell/build/nsDocShellModule.cpp")}} 也存有副本。

-- cgit v1.2.3-54-g00ecf