--- title: Firefox 8 技術文件 slug: Mozilla/Firefox/Releases/8 translation_of: Mozilla/Firefox/Releases/8 ---
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.
HTMLImageElement crossOrigin property has been added and the crossorigin attribute 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)HTMLIsIndexElement constructor has been removed. No elements have implemented this interface since before Firefox 4.contextmenu attribute), 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).accesskeylabel attribute has been added to all elements.<input> and <textarea> elements now support the selectionDirection attribute, and their setSelectionRange() methods have been updated to support optionally specifying a direction.tabindex attribute and the user then focuses the element.<label> elements click events do no longer trigger multiple insertAdjacentHTML method has been implemented.BlobBuilder now has a getFile() method that returns the content of the blob as a file.FileReaderSync interface (part of the FileAPI) has been implemented.<label>s has been fixed.window.postMessage() to pass File and FileList objects between windows.element.contenteditable areas, 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 <br> elements.element.contenteditable area.element.contenteditable area to affect the previous contenteditable block if one is present.document.getSelection() now returns the same Selection object as window.getSelection(), instead of stringifying it.selectionDirection property makes it possible to define the direction of the selection in an editable text.HTMLMediaElement now have a seekable property that return a TimeRanges object.HTMLMediaElement.preload attribute now correctly reflects as an enumerated value.crossOrigin property defaults to "Anonymous" when an invalid value is used.window.navigator.cookieEnabled now returns correct information when the default cookie setting is overridden on a per-site basis.RegExp.exec() and RegExp.test() called with no arguments now match against the string "undefined".String.search() and String.match() called with no arguments or undefined now match against the empty string and thus match every string.watch() and unwatch() methods.resolution now accepts <number>, not just <integer> values as per the specification.hyphens.background-size has been revised to more closely match the specification.text-decoration in 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.Content-Disposition) now requires "=" in parameters.WebSocket object's send() method no longer incorrectly returns a Boolean value.WebSocket object's close() method now matches the current draft of the standard, and close events now properly use the CloseEvent interface.WebSocket object's extensions attribute is now supported.onerror handler.displaystyle attribute on the top-level <math> element has been added.align attribute on <mtable> has been corrected.console object has a new dir() method, which displays an interactive list of the properties on a specified object.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.
Components.utilsComponents.utils.createObjectIn() and Components.utils.makeObjectPropsNormal() have been created to make it easier to create objects in specific compartments.File objects from component code by simply doing new File, instead of having to instantiate an nsIDOMFile directly.nsTPtrArray array 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.
document.execCommand() that occurred when calling it on the value of contentDocument has been fixed. Since Firefox 3, this resulted in errors instead of working correctly.chrome.manifest file. See the section Adding user interface with a chrome.manifest for details.--enable-timeline--disable-storage--necko-disk-cachejspubtd.h is automatically included when needed. Manual inclusions of jspubtd.h and/or jsapi.h in IDL files that use jsval or [implicit_jscontext] are no longer necessary.platformversion flag can be used in the chrome.manifest to specify Gecko version compatibility.mozIJSSubScriptLoader.loadSubScript() method now loads scripts from the startup cache when possible.ownerWindow attribute has been removed from the nsIAccessNode interface.nsIDOMStorageWindow interface has been merged into the nsIDOMWindow interface.nsIDOMWindowInternal interface have been moved into the nsIDOMWindow interface. The interface itself (with no members) remains available for compatibility until Firefox 9.mozIVisitInfoCallback.handleResult() and mozIVisitInfoCallback.handleError() methods, which replace the old single method for both error and success condition handling.nsIMemoryReporter KIND_MAPPED attribute has been deprecated in favor of KIND_NONHEAP, new unit types UNITS_COUNT_CUMULATIVE and UNITS_PERCENTAGE have been added.nsIMemoryReporterManager interface has a new explicit attribute, which reports the total size of explicit memory allocations.nsIMemoryReporterManager interface has a new resident attribute, which reports the amount of physical memory used.nsINetworkLinkService interface 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.nsISelection2 interface has been merged into the nsISelectionPrivate interface.nsISelection3 interface has been merged into the nsISelection interface.nsISessionStartup attribute state is now a jsval instead of a string, for performance reasons.nsIDocShell attribute isActive is now false for 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:
nsITimelineServicensIDOMHTMLIsIndexElementThe nsIWorkerFactory interface has been removed as well. Workers can still be created using the Worker and ChromeWorker constructors.
sizemodechange event.extensions.autoDisableScopes preference to disable automatic installation of add-ons from specific add-on install locations.document.mozSyntheticDocument property on Document objects 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).about:config; for example, "about:config?filter=sessionstore" will show only session storage related preferences.