此頁面發生指令碼錯誤。網站編輯修正完成前,您可繼續檢視下方的其他內容。
翻譯不完整。請協助 翻譯此英文文件。
Firefox 5,基於 Gecko 5.0,在 2011 年六月21日發行。本文將提供這次發行會對開發者所生影響之資訊。
網路開發者的改變
HTML
- 所有的 HTML 元素現在都有
accessKey屬性,blur()、click()、focus()方法也是。這些都在HTMLElement介面受到規範化。 - 為了遵從 HTML5 規範,移除了針對 UTF-7 與 UTF-32 字符集的支援。
- 處於怪異模式(quirks mode)的時候,空白的
<map>支持非空匹配時,再也不跳過。需要更多資訊,請參閱 Gecko notes 的<map>元素。 - 針對 Android 的 Firefox mobile,
@font-face現在支援 WOFF 字型。 - 出於安全考量,WebGL 再也不加載來自其他網域的紋理。HTTP access control support should be coming sometime in the future to make this possible more securely.
Canvas improvements
- The
<canvas>2D drawing context now supports specifying anImageDataobject as the input to thecreateImageData()method; this creates a newImageDataobject initialized with the same dimensions as the specified object, but still with all pixels preset to transparent black. This was documented as implemented already but was not. - Specifying non-finite values when adding color stops through a call to the
CanvasGradientmethodaddColorStop()now correctly throwsINDEX_SIZE_ERRinstead ofSYNTAX_ERR. - The
HTMLCanvasElementmethodtoDataURL()now correctly lower-cases the specified MIME type before matching. getImageData()now correctly accepts rectangles that extend beyond the bounds of the canvas; pixels outside the canvas are returned as transparent black.drawImage()andcreateImageData()now handle negative arguments in accordance with the specification, by flipping the rectangle around the appropriate axis. We need an article about CSS sizing and how this works.- Specifying non-finite values when calling
createImageData()now properly throws aNOT_SUPPORTED_ERRexception. createImageData()andgetImageData()now correctly return at least one pixel's worth of image data if a rectangle smaller than one pixel is specified.- Specifying a negative radius when calling
createRadialGradient()now correctly throwsINDEX_SIZE_ERR. - Specifying a
nullorundefinedimage when callingcreatePattern()ordrawImage()now correctly throws aTYPE_MISMATCH_ERRexception. - Specifying invalid values for
globalAlphano longer throws aSYNTAX_ERRexception; these are now correctly silently ignored. - Specifying invalid values when calling
translate(),transform(),rect(),clearRect(),fillRect(),strokeRect(),lineTo(),moveTo(),quadraticCurveTo(), orarc()no longer throws an exception; these calls are now correctly silently ignored. - Setting the value of
shadowOffsetX,shadowOffsetY, orshadowBlurto an invalid value is now silently ignored. - Setting the value of
rotateorscaleto an invalid value is now silently ignored.
CSS
- CSS animations
- Support for CSS animations has been added, using the
-moz-prefix for now.
DOM
- The
selectionobject'smodify()method has been changed so that the "word" selection granularity no longer includes trailing spaces; this makes it more consistent across platforms and matches the behavior of WebKit's implementation. - The
window.setTimeout()method now clamps to send no more than one timeout per second in inactive tabs. In addition, it now clamps nested timeouts to the smallest value allowed by the HTML5 specification: 4 ms (instead of the 10 ms it used to clamp to). - Similarly, the
window.setInterval()method now clamps to no more than one interval per second in inactive tabs. XMLHttpRequestnow supports theloadendevent for progress listeners. This is sent after any transfer is finished (that is, after theabort,error, orloadevent). You can use this to handle any tasks that need to be performed regardless of success or failure of a transfer.- The
Bloband, by extension, theFileobjects'slice()method has been removed and replaced with a new, proposed syntax that makes it more consistent withArray.slice()andString.slice()methods in JavaScript. This method is namedmozSlice()for now. - The value of
window.navigator.languageis now determined by looking at the value of theAccept-LanguageHTTP header. - The
Node.prefixproperty is now read only, as required by the DOM specification. - The
HTMLVideoElementnow supports experimental properties to get information about video paint statistics like frame rates.
JavaScript
- Regular expressions are no longer callable as if they were functions; this change has been made in concert with the WebKit team to ensure compatibility (see WebKit bug 28285. This feature had existed for a long time but was never documented (at least, not here on MDC).
- The
Function.prototype.isGenerator()method is now supported; this lets you determine if a function is a generator. - The following reserved words were previously only treated as reserved when in strict mode; now they're always treated as reserved:
class,enum,export,extends,import, andsuper. - DOM documents created in chrome code may no longer be exposed to sandboxed scripts.
- The JSON parser has been re-written for improved speed and compliance. This includes a fix for bug 572279.
SVG
- The
classSVG attribute can now be animated. - The following SVG-related DOM interfaces representing lists of objects are now indexable and can be accessed like arrays; in addition, they have a
lengthproperty indicating the number of items in the lists:SVGLengthList,SVGNumberList,SVGPathSegList, andSVGPointList.
HTTP
- Firefox no longer sends the
Keep-AliveHTTP header; we weren't formatting it correctly, and it was redundant since we were also sending theConnectionorProxy-Connectionheader with the value "keep-alive" anyway. - The HTTP transaction model has been updated to be more intelligent about reusing connections in the persistent connection pool; instead of treating the pool as a FIFO queue, Necko now attempts to sort the pool with connections with the largest congestion window (CWND) first. This can reduce the round-trip time (RTT) of HTTP transactions by avoiding the need to grow connections' windows in many cases.
- Firefox now handles the
Content-DispositionHTTP response header more effectively if both thefilenameandfilename*parameters are provided; it looks through all provided names, using thefilename*parameter if one is available, even if afilenameparameter is included first. Previously, the first matching parameter would be used, thereby preventing a more appropriate name from being used. See bug 588781.
MathML
- Support for embellished operators
Developer tools
- The Web Console's
Consoleobject now has adebug()method, which is an alias for itslog()method; this improves compatibility with certain existing sites.
Changes for Mozilla and add-on developers
For a guide to updating your add-on for Firefox 5, please see Updating add-ons for Firefox 5.
Note: Firefox 5 requires that binary components be recompiled, as do all major releases of Firefox. See Binary Interfaces for details.
Changes to JavaScript code modules
New JavaScript code modules
- The
Dict.jsmcode module was added; it provides an API for dictionaries of key/value pairs.
NetUtil.jsm
- The
asyncFetch()method now supports specifying the input source as annsIInputStream.
Interface changes
- The
nsIHttpChannelInternalinterface has new attributes providing access to information about the channels' endpoints' addresses and ports. This information is provided primarily for debugging purposes. - The
<canvas>element'swidthandheightattributes are now reflected in IDL as unsigned integers instead of signed (seeHTMLCanvasElement). - The
nsIAppStartup2andnsIAppStartup_MOZILLA_2_0interfaces have been merged into thensIAppStartupinterface. - The
nsIDocShell_MOZILLA_2_0_BRANCHinterface has been merged into thensIDocShellinterface. - The
nsIFocusManager_MOZILLA_2_0_BRANCHinterface has been merged into theinterface.nsIFocusManager - The
nsIHTMLEditor_MOZILLA_2_0_BRANCHinterface has been merged into thensIHTMLEditorinterface.
New interfaces
nsIDOMAnimationEventadded. {{ SeeDOMEvent }}
Removed interfaces
The following interfaces were implementation details that are no longer needed:
nsICiter(see bug 633066)nsIDOM3Document(see bug 639849)nsIFIXptrEvaluatornsISelectElement(see bug 619996)
Debugging aids
- The new
DebugOnly<T>helper makes it possible to declare variables only forDEBUGbuilds.
JavaScript API (SpiderMonkey)
JS_DoubleToInt32()andJS_DoubleToUint32()have been added, for convertingjsdoublevalues into C integers and unsigned integers.
Build system changes
- You can now build Firefox without a
mozconfigfile; the--enable-applicationsetting now defaults to "browser". After pulling or downloading the code, you can simplyconfigure && make(ormake -f client.mk) to build Firefox.
See also
- Firefox 50 for developers
- Firefox 49 for developers
- Firefox 48 for developers
- Firefox 47 for developers
- Firefox 46 for developers
- Firefox 45 for developers
- Firefox 44 for developers
- Firefox 43 for developers
- Firefox 42 for developers
- Firefox 41 for developers
- Firefox 40 for developers
- Firefox 39 for developers
- Firefox 38 for developers
- Firefox 37 for developers
- Firefox 36 for developers
- Firefox 35 for developers
- Firefox 34 for developers
- Firefox 33 for developers
- Firefox 32 for developers
- Firefox 31 for developers
- Firefox 30 for developers
- Firefox 29 for developers
- Firefox 28 for developers
- Firefox 27 for developers
- Firefox 26 for developers
- Firefox 25 for developers
- Firefox 24 for developers
- Firefox 23 for developers
- Firefox 22 for developers
- Firefox 21 for developers
- Firefox 20 for developers