我们的志愿者还没有将这篇文章翻译为 中文 (简体)。加入我们帮助完成翻译！
Firefox 8 was released on November 8, 2011. This article provides information both for web developers and for add-on and Mozilla project developers to help take full advantage of the features of this release.
Changes for web developers
crossOriginproperty has been added and the
crossoriginattribute has been added to the
<img>element. (see bug 664299)
HTMLSelectElement.add()method now supports either an item or index of an item that the new item should be inserted before. Previously it only supported an item. (see bug 666200)
HTMLIsIndexElementconstructor has been removed. No elements have implemented this interface since before Firefox 4.
- The HTML5 "context menu" feature (
contextmenuattribute), which lets you add custom element specific items to native context menu, is now supported (the implementation is still experimental awaiting changes in the specification; see bug 617528).
- Support for the
accesskeylabelattribute has been added to all elements.
<textarea>elements now support the
selectionDirectionattribute, and their
setSelectionRange()methods have been updated to support optionally specifying a direction.
- Most elements now get a focus ring drawn around them if they've been made focusable by using the
tabindexattribute and the user then focuses the element.
- In a set of nested
<label>elements click events do no longer trigger multiple
insertAdjacentHTMLmethod has been implemented.
BlobBuildernow has a
getFile()method that returns the content of the blob as a file.
FileReaderSyncinterface (part of the FileAPI) has been implemented.
- Event handling in nested
<label>s has been fixed.
- You can now use
FileListobjects between windows.
- When editing
element.contenteditableareas, exiting a heading by pressing return, or exiting list editing mode by pressing return twice, now returns to paragraph entry mode (that is, paragraphs inside
<p>blocks) instead of separating lines by
- Fixed a bug that prevents justification from taking effect properly when applied to the first line in a
- Fixed a bug that caused pressing delete or backspace at the beginning of a
element.contenteditablearea to affect the previous
contenteditableblock if one is present.
document.getSelection()now returns the same
window.getSelection(), instead of stringifying it.
- The HTML5
selectionDirectionproperty makes it possible to define the direction of the selection in an editable text.
HTMLMediaElementnow have a
seekableproperty that return a
.preloadattribute now correctly reflects as an enumerated value.
crossOriginproperty defaults to "Anonymous" when an invalid value is used.
window.navigator.cookieEnablednow returns correct information when the default cookie setting is overridden on a per-site basis.
RegExp.test()called with no arguments now match against the string "undefined".
String.match()called with no arguments or
undefinednow match against the empty string and thus match every string.
- Support for watchlists has been implemented with the new (non-standard)
<number>, not just
<integer>values as per the specification.
- Hyphenation rules have been added for many new languages when using
- Handling of
background-sizehas been revised to more closely match the specification.
- In the past,
text-decorationin quirks mode had line thickness and position adjusted on descendant text to match the descendant. Now standards mode and quirks mode rendering are more similar.
- Horizontal positioning for elements has been brought more in line with the specification in many cases. Documentation for this is forthcoming, but for now, see bug 682780, comment 23 for details.
- SVG images are now scaled properly when used as background images.
- Double quotes are no longer accepted as a delimiter for RFC 2231 or RFC 5987 encoding, as per those RFCs.
- MIME header field parser (
Content-Disposition) now requires "=" in parameters.
- SSL 2.0 is no longer supported.
send()method no longer incorrectly returns a Boolean value.
close()method now matches the current draft of the standard, and close events now properly use the
extensionsattribute is now supported.
- The WebSocket constructor now supports an array of protocols as well as a single protocol string.
- Mixed content is not allowed with WebSockets; that is, you can no longer open a connection to a non-secure WebSocket server from secure content.
- Connection errors with WebSockets now trigger the
- WebSocket API has been updated to the latest draft of the specification (see bug 674890, bug 674527, and bug 674716).
- The deflate-stream extension to WebSockets has been disabled; it has been deprecated, and was breaking compatibility with some sites.
- Cross-domain textures can now be allowed with CORS approval.
- Cross-process rendering with Direct2D/Direct3D 10.
- Support for the
displaystyleattribute on the top-level
<math>element has been added.
- The interpretation of negative row numbers for the
<mtable>has been corrected.
consoleobject has a new
dir()method, which displays an interactive list of the properties on a specified object.
Changes for Mozilla and add-on developers
See Updating add-ons for Firefox 8 for a guide to changes you're likely to have to make to make your add-ons compatible with Firefox 8.
- The new methods
Components.utils.makeObjectPropsNormal()have been created to make it easier to create objects in specific compartments.
Other XPCOM related changes
- You can now instantiate DOM
Fileobjects from component code by simply doing new File, instead of having to instantiate an
nsTPtrArrayarray type has been removed. Its functionality is now all available on
nsTArray, which now offers the
SafeElementAt()method when instantiated using a pointer type. See the section on
SafeElementAt()in the XPCOM array guide for more information.
It is no longer possible to access XPCOM objects from ChromeWorkers. XPConnect has been disabled in worker contexts as of bug 649537.
- A bug in
document.execCommand()that occurred when calling it on the value of
contentDocumenthas been fixed. Since Firefox 3, this resulted in errors instead of working correctly.
- Bootstrapped add-ons can now load chrome using a
chrome.manifestfile. See the section Adding user interface with a chrome.manifest for details.
- XUL images now shrink down with the same ratio in both directions when specifying maximum sizes.
Changes to the build system
- The following build configuration options have been removed:
- When compiling IDL files to headers, the header file
jspubtd.his automatically included when needed. Manual inclusions of
jsapi.hin IDL files that use jsval or [implicit_jscontext] are no longer necessary.
platformversionflag can be used in the chrome.manifest to specify Gecko version compatibility.
mozIJSSubScriptLoader.loadSubScript()method now loads scripts from the startup cache when possible.
ownerWindowattribute has been removed from the
nsIDOMStorageWindowinterface has been merged into the
- All members of the
nsIDOMWindowInternalinterface have been moved into the
nsIDOMWindowinterface. The interface itself (with no members) remains available for compatibility until Firefox 9.
- In order to improve performance, callback handling for asynchronous Places database updates has been changed. See the new
mozIVisitInfoCallback.handleError()methods, which replace the old single method for both error and success condition handling.
KIND_MAPPEDattribute has been deprecated in favor of
KIND_NONHEAP, new unit types
UNITS_PERCENTAGEhave been added.
nsIMemoryReporterManagerinterface has a new
explicitattribute, which reports the total size of explicit memory allocations.
nsIMemoryReporterManagerinterface has a new
residentattribute, which reports the amount of physical memory used.
nsINetworkLinkServiceinterface has a new attribute,
linkType. This attribute provides the type of network connection in use. All Operating Systems currently return
LINK_TYPE_UNKNOWN. Android support was backed out due to perceived security concerns.
nsISelection2interface has been merged into the
nsISelection3interface has been merged into the
nsISessionStartupattribute state is now a
jsvalinstead of a string, for performance reasons.
falsefor minimized windows.
nsIDownloadHistory.addDownload()method now saves the the target where the download is saved on the local file system.
The following interfaces were implementation details that are no longer needed:
nsIWorkerFactory interface has been removed as well. Workers can still be created using the
- When a window is minimized, un-minimized, or switches between full screen and windowed mode, it receives a
- You can now use the
extensions.autoDisableScopespreference to disable automatic installation of add-ons from specific add-on install locations.
- The new
Documentobjects lets you determine whether a document is synthetic (that is, something like a standalone image, video, or audio file) rather than a full, standard DOM document. This can be useful, for example, if you want to present different user interface in this situation (such as adding contextual items differently depending on this case).
- You can now specify a filter when opening
about:config; for example, "about:config?filter=sessionstore" will show only session storage related preferences.