2010 年六月起進入 Beta 測試期的 Firefox 4，增進了效能、加強針對 HTML 5 及其他創新網際科技的支援程度，也更加安全。本文為網頁、附加元件、Gecko 平台開發者們提供這一版的簡要技術相關資訊。
Gecko 1.9.3 即將更名為 Gecko 2，但許多文件還沒有針對此點更新，在接下來的幾個星期中才會有所更動。
Features for web developers
- 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:
- Other HTML5 elements
- Gecko now also supports the following new HTML5 elements:
- 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
resizeCSS property to disable this.
canvas.toDataURLno longer throw an exception when called with unrecognized arguments.
canvas2dcontext.lineJoinno longer throw an exception when set to an unrecognized value.
- 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-anyto group selectors and factorize combinators.
- Background image subrectangle support
-moz-image-rectproperty 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
text-shadowproperty now caps the blur radius to 300px for sanity and performance reasons.
:-moz-window-inactivepseudoclass has been implemented.
-moz-tab-sizeproperty lets you specify the width in space characters of a tab character (U+0009) when rendering text.
- The CSS3
resizeproperty has been implemented.
-moz-background-sizeproperty has been renamed to its final
-moz-background-sizeis no longer supported.
oveflowproperty no longer applies to table-group elements (
Graphics and video
- 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.
- Obtaining boundary rectangles for ranges
- The Range object now has
getBoundingClientRect()methods. See bug 396392.
- Capturing mouse events on arbitrary elements
- Support for the Internet Explorer-originated
releaseCapture()APIs has been added. See bug 503943.
- Manipulating the browser history
- The existing document history object, available through the
window.historyobject, now supports the new HTML5
- Touch and multi-touch events
- Support has been added for touch and multi-touch events.
- 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
wrapDOM attribute. bug 41464
fileobjects now offer a
fileobjects now have a new
click()method. (Note: not done yet, see bug 36619.)
- FormData support for XMLHttpRequest.
element.isContentEditableproperty has been implemented.
- Added the
mozSourceNodeproperty to the
- Added the
selection.modify()method to the
Selectionobject; this lets you easily alter the current text selection or cursor position in a browser window.
- Support for the
window.directoriesobject and the
window.open, which are not supported in any other browser, has been removed. Use
personalbarinstead. bug 474058
event.mozInputSourceproperty has been added to DOM user interface events; this non-standard property lets you determine the type of device that generated an event.
document.onreadystatechangeevent has been implemented.
document.createElementmethod no longer accepts
>around the tag name in quirks mode.
- 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.
- Details soon.
- The Account Manager
- Details soon.
Changes for Mozilla and add-on developers
For helpful tips on updating existing extensions for Firefox 4, see Updating extensions for Firefox 4.
Services.jsmcode 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
- A new type of worker for privileged code; this lets you use things like js-ctypes from workers in extensions and application code.
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
tabbrowserelement (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
readonlyattribute now correctly works for fields.
resizerelement now lets you use the
elementattribute 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-inactivepseudoclass in order to assign different styles to background windows.
emptytextattribute is now deprecated; you should use
popupelement is no longer supported; you should use
Miscellaneous storage API changes
mozIStorageBindingParamsArrayinterface now has a length attribute that indicates the number of
mozIStorageBindingParamsobjects in the array.
mozIStorageStatement.bindParameters()now returns an error if the specified
- XPCOM changes in Gecko 1.9.3
- Details about changes to XPCOM that impact compatibility in Firefox 4.
- This new method returns the global object with which an object is associated; this replaces a common use case of the now-removed
- 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.
- 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).