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 5, based on Gecko 5.0, was released on June 21, 2011. This article provides links to information about the changes that affect developers in this release.

Changes for web developers

HTML

Canvas improvements

  • The <canvas> 2D drawing context now supports specifying an ImageData object as the input to the createImageData() method; this creates a new ImageData object 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 CanvasGradient method addColorStop() now correctly throws INDEX_SIZE_ERR instead of SYNTAX_ERR.
  • The HTMLCanvasElement method toDataURL() 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() and createImageData() 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 a NOT_SUPPORTED_ERR exception.
  • createImageData() and getImageData() 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 throws INDEX_SIZE_ERR.
  • Specifying a null or undefined image when calling createPattern() or drawImage() now correctly throws a TYPE_MISMATCH_ERR exception.
  • Specifying invalid values for globalAlpha no longer throws a SYNTAX_ERR exception; these are now correctly silently ignored.
  • Specifying invalid values when calling translate(), transform(), rect(), clearRect(), fillRect(), strokeRect(), lineTo(), moveTo(), quadraticCurveTo(), or arc() no longer throws an exception; these calls are now correctly silently ignored.
  • Setting the value of shadowOffsetX, shadowOffsetY, or shadowBlur to an invalid value is now silently ignored.
  • Setting the value of rotate or scale to 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 selection object's modify() 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.
  • XMLHttpRequest now supports the loadend event for progress listeners. This is sent after any transfer is finished (that is, after the abort, error, or load event). You can use this to handle any tasks that need to be performed regardless of success or failure of a transfer.
  • The Blob and, by extension, the File objects' slice() method has been removed and replaced with a new, proposed syntax that makes it more consistent with Array.slice() and String.slice() methods in JavaScript. This method is named mozSlice() for now.
  • The value of window.navigator.language is now determined by looking at the value of the Accept-Language HTTP header.
  • The Node.prefix property is now read only, as required by the DOM specification.
  • The HTMLVideoElement now 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, and super.
  • 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 class SVG 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 length property indicating the number of items in the lists: SVGLengthList, SVGNumberList, SVGPathSegList, and SVGPointList.

HTTP

  • Firefox no longer sends the Keep-Alive HTTP header; we weren't formatting it correctly, and it was redundant since we were also sending the Connection: or Proxy-Connection: header 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-Disposition HTTP response header more effectively if both the filename and filename* parameters are provided; it looks through all provided names, using the filename* parameter if one is available, even if a filename parameter is included first. Previously, the first matching parameter would be used, thereby preventing a more appropriate name from being used. See bug 588781.

MathML

Developer tools

  • The Web Console's Console object now has a debug() method, which is an alias for its log() 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.jsm code module was added; it provides an API for dictionaries of key/value pairs.

NetUtil.jsm

Interface changes

  • The nsIHttpChannelInternal interface 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's width and height attributes are now reflected in IDL as unsigned integers instead of signed (see HTMLCanvasElement).
  • The nsIAppStartup2 and nsIAppStartup_MOZILLA_2_0 interfaces have been merged into the nsIAppStartup interface.
  • The nsIDocShell_MOZILLA_2_0_BRANCH interface has been merged into the nsIDocShell interface.
  • The nsIFocusManager_MOZILLA_2_0_BRANCH interface has been merged into the nsIFocusManager interface.
  • The nsIHTMLEditor_MOZILLA_2_0_BRANCH interface has been merged into the nsIHTMLEditor interface.

New interfaces

Removed interfaces

The following interfaces were implementation details that are no longer needed:

Debugging aids

  • The new DebugOnly<T> helper makes it possible to declare variables only for DEBUG builds.

JavaScript API (SpiderMonkey)

Build system changes

  • You can now build Firefox without a mozconfig file; the --enable-application setting now defaults to "browser". After pulling or downloading the code, you can simply configure && make (or make -f client.mk) to build Firefox.

See also

Метки документа и участники

Метки: 
 Внесли вклад в эту страницу: Timmi, ethertank, Sheppy, fscholz, shizumae, trevorh, simonster, myakura, kmaglione, fred.wang, Bzbarsky, custom.firefox.lady, Ehsan, Nickolay, Potappo, Crash
 Обновлялась последний раз: Timmi,