Firefox 7 for developers

Firefox 7 shipped on September 27, 2011. This article provides information about the changes that affect developers -- both of web content and of Firefox add-ons.

Changes for web developers

HTML

  • The HTMLHeadElement profile property has been removed, this property has been deprecated since Gecko 2.0.
  • The HTMLImageElement x and y properties have been removed.
  • The HTMLSelectElement add() method before parameter is now optional.
  • The <body> element's background attribute is no longer resolved as a URI; this is in compliance with the current HTML specification.
  • The <option> element's label attribute now reflects the value of the element's text content if the attribute isn't specified.

Canvas

  • As part of the Azure project the Direct2D Azure Backend has been implemented and will significantly improve the performance of the 2D canvas.
  • Specifying invalid values when calling setTransform(), bezierCurveTo(), or arcTo() no longer throws an exception; these calls are now correctly silently ignored.
  • The isPointInPath() method now correctly considers the transformation matrix when comparing the specified point to the current path.
  • Calling strokeRect() with a zero width and height now correctly does nothing.
  • Calling drawImage() with a zero width or height <canvas> now throws INVALID_STATE_ERR.
  • Calling drawImage() with non-finite coordinates no longer throws an exception.
  • toDataURL() method now accepts a second argument to control JPEG quality.
  • Support for the non-standard globalCompositeOperation operations clear and over has been removed.
  • Shadows are now only drawn for source-over compositing operations.
  • You can now configure the fill rule used by canvas by setting the mozFillRule attribute on the context.
  • Support for the experimental mozDash, mozDashOffset, mozCurrentTransform and mozCurrentTransformInverse attributes has been added.
  • Support for the non-standard methods mozDrawText(), mozMeasureText(), mozPathText() and mozTextAlongPath() has been been removed.

CSS

MathML

  • XLink href has been restored and the MathML3 href attribute is now supported. Developers are encouraged to move to the latter syntax.
  • Support for the voffset attribute on <mpadded> elements has been added and behavior of lspace attribute has been fixed.
  • The top-level <math> element now accepts any attributes of the <mstyle> element.
  • Support for Asana Math fonts has been added.
  • The medium line thickness of fraction bars in <mfrac> elements has been corrected to match the default thickness.
  • Names for negative spaces are now supported.

DOM

  • The File interface's non-standard methods getAsBinary(), getAsDataURL(), and getAsText() have been removed as well as the non-standard properties fileName and fileSize (bug 661876).
  • The FormData interface no longer reports the filename as an empty string when sending the Content-Disposition HTTP header if the data was set using a Blob. This fixes errors that were happening with some servers.
  • The element.dir attribute now always returns its result as all lower-case, as required by the HTML specification.
  • The FileReader readAsArrayBuffer() method is now implemented.
  • document.createEntityReference has been removed. It was never properly implemented and is not implemented in most other browsers.
  • document.normalizeDocument has been removed. Use Node.normalize instead.
  • DOMTokenList.item now returns undefined if the index is out of bounds, previously it returned null.
  • Node.getFeature has been removed.
  • The HTMLInsElement and HTMLDelElement interfaces have been removed, since the <ins> and <del> elements actually use the HTMLModElement interface.
  • In a effort to conform to the upcoming DOM4 specification where Attr do not inherit from Node anymore (it did in DOM Core 1, 2 and 3), many Node properties and methods on the Attr interface are now reporting warnings as we work toward removing them in a later version.
  • Added support for the window.ondeviceorientation and window.ondevicemotion properties on window objects.
  • window.resizeTo, window.resizeBy, window.moveTo , and window.moveBy no longer apply to the main window.

JavaScript

WebSockets

  • The network.websocket.max-connections preference is used to determine the maximum number of WebSocket connections that can be open at a time. The default value is 200.
  • The underlying WebSocket protocol version 8 (as specified by IETF draft 10) is used now instead of the version 7 protocol used by Firefox 6.
  • The WebSocket API is now available on Firefox Mobile.

console API

  • Message logged with console.log while the web console isn't open are still logged, although they aren't displayed when the web console is opened.

Web timing

  • Initial implementation of the Navigation Timing specification which provides data that can be used to measure the performance of a website.

XML

Changes for Mozilla and add-on developers

These changes affect add-on developers as well as developers working on or with Mozilla code itself. Add-on developers should see Updating extensions for Firefox 7 for additional information.

Note: Firefox 7 requires that binary components be recompiled, as do all major releases of Firefox. See Binary Interfaces for details.

JavaScript code modules

FileUtils.jsm

  • New method openFileOutputStream() opens a file output stream, the non-safe variant, for writing.

AddonManager.jsm

XUL

XPCOM

Memory reporters

Support has been added for multi-reporters; that is, memory reporters that gather data on request and call a callback for each generated result. See nsIMemoryMultiReporter and nsIMemoryMultiReporterCallback for the relevant interfaces, as well as the nsIMemoryReporterManager.registerMultiReporter() and nsIMemoryReporterManager.unregisterMultiReporter() methods.

User experience changes

Changes to the build system

  • The ActiveX embedding API is no longer built and support has been removed from the build system. Supporting interfaces have also been removed; see Removed interfaces.
  • You should no longer specify -Zc:wchar_t- when building on Windows. See the updated Build documentation for details.

Interface changes

  • nsISocketTransport now offers a new connection flag: DISABLE_IPV6; this causes a socket to only attempt to connect to IPv4 addresses, ignoring any available IPv6 addresses. In addition, nsIDNSService now offers a new resolve flag: RESOLVE_DISABLE_IPV6; this causes domain name resolution to only consider IPv4 hosts, ignoring any available IPv6 addresses. These changes are used to implement the "happy eyeballs" strategy for improving response time when attempting to connect on hosts that support both IPv4 and IPv6 (especially those that have broken IPv6 connectivity).
  • inIDOMUtils has two new methods, inIDOMUtils.getChildrenForNode() which returns a list of child nodes of a node and inIDOMUtils.getUsedFontFaces() which returns a list of font faces used in a range.
  • The nsIMarkupDocumentViewer_MOZILLA_2_0_BRANCH interface has been merged into the nsIMarkupDocumentViewer interface.
  • The nsIDOMWindow2 interface has been merged into the nsIDOMWindow interface.
  • The nsIDOMWindow_2_0_BRANCH interface has been merged into the nsIDOMWindowInternal interface.
  • nsINavHistoryObserver methods with URI parameters now require a GUID as well.
  • The nsISHistory_2_0_BRANCH interface has been merged into the nsISHistory interface.
  • nsITelemetry has a new method, nsITelemetry.getHistogramById() which returns a histogram by its ID, and a new attribute, canRecord which when set to false disables recording of telemetry statistics. Telemetry statistics are no longer recorded when in Private Browsing Mode. (see bug 661574 and bug 661573)
    Telemetry histograms defined with nsITelemetry.newHistogram() will not be reported in the telemetry ping.
  • The nsIMemoryReporter interface has been substantially changed; if you use it, you will need to make some adjustments to your code.
  • nsIXMLHttpRequest, headers set by nsIXMLHttpRequest.setRequestHeader() are sent with the request when following a redirect. Previously these headers would not be sent.
  • nsIDocShell has a new allowWindowControl attribute. If true, the docshell's content is allowed to control the window (that is, to move or resize the window).
  • The nsIThreadInternal2 interface has been merged into the nsIThreadInternal interface.

New interfaces

nsIDOMFontFace
Describes a single font face.
nsIDOMFontFaceList
Describes a list of font faces, each represented by nsIDOMFontFace.

Removed interfaces

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

  • nsIDOM3Attr
  • nsIDOM3Node
  • nsIDOM3TypeInfo
  • nsIDOM3Text
  • nsIDOMDocumentStyle
  • nsIDOMNSDocument
  • nsIDOMNSFeatureFactory
  • nsIDOMNSHTMLDocument
  • nsIDOMNSHTMLFormElement
  • nsIDOMNSHTMLHRElement
  • nsIDOMNSHTMLTextAreaElement

The following interfaces were removed as part of the removal of the ActiveX embedding API:

  • DITestScriptHelper
  • DWebBrowserEvents
  • DWebBrowserEvents2
  • IDispatch
  • IMozControlBridge
  • IMozPluginHostCtrl
  • IWebBrowser
  • IWebBrowser2
  • IWebBrowserApp
  • IXMLDocument
  • IXMLElement
  • IXMLElementCollection
  • IXMLError
  • nsIActiveXSecurityPolicy
  • nsIDispatchSupport
  • nsIMozAxPlugin
  • nsIScriptEventHandler
  • nsIScriptEventManager

Other Changes

See also

Document Tags and Contributors

 Last updated by: Sebastianz,