Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Firefox 4 技術文件

2010 年六月起進入 Beta 測試期的 Firefox 4,增進了效能、加強針對 HTML 5 及其他創新網際科技的支援程度,也更加安全。本文為網頁、附加元件、Gecko 平台開發者們提供這一版的簡要技術相關資訊。

Gecko 2 備註
(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)

Gecko 1.9.3 即將更名為 Gecko 2,但許多文件還沒有針對此點更新,在接下來的幾個星期中才會有所更動。

以下大部分的功能都已經可以在 逐日建置版中試用。

註:本文、以及本文所連結的其他文件仍持續編修中,很多文件的名稱只是暫定、有些主題的文件也可能會拆成幾份子文件以方便閱讀。中文團隊的目標將僅翻譯這份概覽,其他子文件則有待大家的幫忙。

Features for web developers

Gecko now uses the HTML5 parser, which fixes bugs, improves interoperability, and improves performance. It also lets content embed SVG and MathML directly in the HTML markup.

HTML

Introduction to the HTML5 parser
A look at what the HTML5 parser means to you, and how to embed SVG and MathML into your content inline.
Forms in HTML5
A look at improvements to web forms in HTML5.
HTML5 Sections
Gecko now supports the new HTML5 elements related to sections in a document: <article>, <section>, <nav>, <aside>, <hgroup>, <header> and <footer>.
Other HTML5 elements
Gecko now also supports the following new HTML5 elements: <mark>, <figure> and  <figcaption>.
WebSockets
A guide to using the new WebSockets API for real-time communication between a web application and a server.

Miscellaneous HTML changes

  • <textarea> elements are now resizable by default; you can use the resize CSS property to disable this.
  • canvas.getContext and canvas.toDataURL no longer throw an exception when called with unrecognized arguments.
  • canvas2dcontext.globalCompositeOperation, canvas2dcontext.lineCap and canvas2dcontext.lineJoin no longer throw an exception when set to an unrecognized value.

CSS

CSS transitions
New CSS transitions support is available in Firefox 4.
Computed values in CSS
Support for calc() to compute values in CSS is in progress. See bug 363249.
Selector grouping
Support for :-moz-any to group selectors and factorize combinators.
Background image subrectangle support
The -moz-image-rect property makes it possible to use subrectangles of images as a background image.
CSS touch properties
Support for touch properties is added. Details, and real article names, to come later.
Privacy and the :visited selector
Changes have been made to what information can be obtained about the style of visited links using CSS selectors. This may affect some web applications.

Miscellaneous CSS changes

  • The text-shadow property now caps the blur radius to 300px for sanity and performance reasons.
  • The :-moz-window-inactive pseudoclass has been implemented.
  • The -moz-tab-size property lets you specify the width in space characters of a tab character (U+0009) when rendering text.
  • The CSS3 resize property has been implemented.
  • The -moz-background-size property has been renamed to its final background-size naming; -moz-background-size is no longer supported.
  • The oveflow property no longer applies to table-group elements (<thead>, <tbody>, and <tfoot>).

Graphics and video

WebGL
The developing WebGL standard is now supported by Firefox.
Optimizing graphics performance
Tips and tricks for getting the most out of graphics and video performance in Firefox 4.
Support for WebM video
The new open WebM video format is supported by Gecko 1.9.3; support is included in nightlies as of 9 June.
Full screen API
Details coming soon.
SMIL animation
Support for SMIL animation of SVG is now available. See bug 482402.
Using SVG as images and as CSS backgrounds
You can now use SVG with the <img> element, as well as the background image in CSS. See bug 272288, bug 276431 and bug 231179.

DOM

Obtaining boundary rectangles for ranges
The Range object now has getClientRects() and getBoundingClientRect() methods. See bug 396392.
Capturing mouse events on arbitrary elements
Support for the Internet Explorer-originated setCapture() and releaseCapture() APIs has been added. See bug 503943.
Manipulating the browser history
The existing document history object, available through the window.history object, now supports the new HTML5 pushState() and replaceState() methods.
Touch and multi-touch events
Support has been added for touch and multi-touch events.
IndexedDB
The proposed IndexedDB standard, which provides a local database store for web applications, will be supported by Firefox 4.

Miscellaneous DOM changes

  • The wrapping of a <textarea> element can now be controlled via the DOM, via the wrap DOM attribute. bug 41464
  • DOM file objects now offer a url property.
  • DOM file objects now have a new click() method. (Note: not done yet, see bug 36619.)
  • FormData support for XMLHttpRequest.
  • The element.isContentEditable property has been implemented.
  • Added the mozSourceNode property to the DragTransfer object.
  • Added the selection.modify() method to the Selection object; this lets you easily alter the current text selection or cursor position in a browser window.
  • Support for the window.directories object and the directories feature for window.open, which are not supported in any other browser, has been removed. Use personalbar instead. bug 474058
  • The event.mozInputSource property has been added to DOM user interface events; this non-standard property lets you determine the type of device that generated an event.
  • The document.onreadystatechange event has been implemented.
  • The document.createElement method no longer accepts < and > around the tag name in quirks mode.

Security

Introducing Content Security Policy
Content Security Policy (CSP) is a Mozilla proposal designed to help web designers and server administrators specify how content on their web sites interacts. The goal is to help detect and mitigate attacks including cross-site scripting and data injection attacks.
ForceTLS
Details soon.
The Account Manager
Details soon.

JavaScript

For an overview of the changes implemented in JavaScript 1.8.5, see New in JavaScript 1.8.5. JavaScript in Firefox 4 will have additional adherence to the ECMAScript 5 standard.

Changes for Mozilla and add-on developers

For helpful tips on updating existing extensions for Firefox 4, see Updating extensions for Firefox 4.

JavaScript code modules

Services.jsm
The Services.jsm code module provides getters that make it easy to obtain references to commonly-used services, such as the preferences service or the window mediator, among others.
JS-ctypes API
The JS-ctypes API makes it possible to call C-compatible foreign library functions without using XPCOM.
Add-ons Manager
The new Add-ons Manager provides information about installed add-ons, support for managing them, and provides ways to install and remove add-ons.
Loading code modules from chrome: URLs
You can now load JavaScript code modules using chrome: URLs, even inside JAR files.

DOM changes

ChromeWorker
A new type of worker for privileged code; this lets you use things like js-ctypes from workers in extensions and application code.

XUL

tabbrowser (gBrowser) changes

Several changes were made to the tabbrowser element that impact extensions that interact with tabs.

  • TabClose/TabSelect/TabOpen events no longer bubble up to the tabbrowser element (gBrowser). Event listeners for those events should be added to gBrowser.tabContainer rather than to gBrowser directly.
  • The tab context menu is no longer an anonymous child of the tabbrowser. It can therefore be overlaid directly with XUL overlays. It can also be accessed more directly in JS via gBrowser.tabContextMenu. See this blog post for more details.

Miscellaneous XUL changes

  • The readonly attribute now correctly works for fields.
  • The resizer element now lets you use the element attribute to specify an element to resize, instead of resizing the window.
  • The "active" attribute no longer gets set on active XUL windows. Instead, you can use the new :-moz-window-inactive pseudoclass in order to assign different styles to background windows.
  • The emptytext attribute is now deprecated; you should use placeholder instead.
  • The popup element is no longer supported; you should use menupopup instead.

Storage

Miscellaneous storage API changes

XPCOM

XPCOM changes in Gecko 1.9.3
Details about changes to XPCOM that impact compatibility in Firefox 4.
Components.utils.getGlobalForObject()
This new method returns the global object with which an object is associated; this replaces a common use case of the now-removed __parent__.

Memory management

Infallible memory allocation
Mozilla now provides infallible memory allocators that are guaranteed not to return null. You should read this article to learn how they work and how to explicitly request fallible versus infallible memory allocation.

Other changes

Gopher support removed
The Gopher protocol is no longer supported natively. Continued support is available via the OverbiteFF extension.
Default plugin removed
The default plugin has been removed. The application plugins folder has also been removed by default, however support for installing plugins via this folder still exists. See bug 533891.
Extension Manager replaced with AddonManager
nsIExtensionManager has been replaced by AddonManager. Since there is apparently no way at present to obtain the install location from a given extension ID, the closest workaround is to use the directory service to find the profile directory and append "extensions" to it (though this approach will not catch extensions outside of the profile directory or those which are aliased to another location).

參考

文件標籤與貢獻者

 此頁面的貢獻者: Kennyluck, BobChao
 最近更新: Kennyluck,