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
andy
properties have been removed. - The
HTMLSelectElement
add()
methodbefore
parameter is now optional. - The
<body>
element'sbackground
attribute is no longer resolved as a URI; this is in compliance with the current HTML specification. - The
<option>
element'slabel
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()
, orarcTo()
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 throwsINVALID_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
operationsclear
andover
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
andmozCurrentTransformInverse
attributes has been added. - Support for the non-standard methods
mozDrawText()
,mozMeasureText()
,mozPathText()
andmozTextAlongPath()
has been removed.
CSS
text-overflow
is now supported.- The
-moz-orient
property has been fixed so that<progress>
elements that are vertically oriented have appropriate default dimensions.
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 oflspace
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 methodsgetAsBinary()
,getAsDataURL()
, andgetAsText()
have been removed as well as the non-standard propertiesfileName
andfileSize
(bug 661876). - The
FormData
interface no longer reports the filename as an empty string when sending theContent-Disposition
HTTP header if the data was set using aBlob
. 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. UseNode.normalize
instead.DOMTokenList.item
now returnsundefined
if theindex
is out of bounds, previously it returnednull
.Node.getFeature
has been removed.- The
HTMLInsElement
andHTMLDelElement
interfaces have been removed, since the<ins>
and<del>
elements actually use theHTMLModElement
interface. - In a effort to conform to the upcoming DOM4 specification where
Attr
do not inherit fromNode
anymore (it did in DOM Core 1, 2 and 3), manyNode
properties and methods on theAttr
interface are now reporting warnings as we work toward removing them in a later version. - Added support for the
window.ondeviceorientation
andwindow.ondevicemotion
properties onwindow
objects. window.resizeTo
,window.resizeBy
,window.moveTo
, andwindow.moveBy
no longer apply to the main window.
JavaScript
- The
Function.arity
property has been removed; useFunction.length
instead.
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
- In addition to the previously supported
text/xsl
, XSLT stylesheets can now use the official internet media (MIME) typeapplication/xslt+xml
(in the stylesheet processing instruction or the HTTP Link header field).
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
- The Add-on Manager has new methods for managing lists of add-ons that changed during applications startup:
AddonManager.addStarupChange()
,AddonManager.removeStartupChange()
, andAddonManager.getStartupChanges()
.
XUL
<xul:tree>
elements can now persist the state of disclosure triangles if the nodes referenced bydatasources
all have unique IDs specified by "id" attributes.<xul:panel>
elements can now be configured to let the user drag them by clicking anywhere on their background by using the newbackdrag
attribute.
XPCOM
- The new
Components.utils.schedulePreciseGC()
method lets you schedule a thorough garbage collection cycle to occur at some point in the future when no JavaScript code is executing; a callback is executed once collection is complete. - The
Components.utils.unload()
method lets you unload JavaScript code modules previously loaded by callingComponents.utils.load()
.
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
- Extension options can now be displayed inside the Add-on Manager for both restartless and traditional extensions.
- The destination of downloads is now remembered on a site-by-site basis. This data can be accessed using DownloadLastDir.jsm.
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 andinIDOMUtils.getUsedFontFaces()
which returns a list of font faces used in a range.- The
nsIMarkupDocumentViewer_MOZILLA_2_0_BRANCH
interface has been merged into thensIMarkupDocumentViewer
interface. - The
nsIDOMWindow2
interface has been merged into thensIDOMWindow
interface. - The
nsIDOMWindow_2_0_BRANCH
interface has been merged into thensIDOMWindowInternal
interface. nsINavHistoryObserver
methods with URI parameters now require a GUID as well.- The
nsISHistory_2_0_BRANCH
interface has been merged into thensISHistory
interface. nsITelemetry
has a new method,nsITelemetry.getHistogramById()
which returns a histogram by its ID, and a new attribute,canRecord
which when set tofalse
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 withnsITelemetry.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 bynsIXMLHttpRequest.setRequestHeader()
are sent with the request when following a redirect. Previously these headers would not be sent.nsIDocShell
has a newallowWindowControl
attribute. Iftrue
, 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 thensIThreadInternal
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
- The structure of the library window (
places.xul
) has been cleaned up. This may break extensions and themes. - The look of the print preview window has been modernized and theme authors are encouraged to style it using the CSS pseudo-elements
::-moz-page
,::-moz-page-sequence
and::-moz-scrolled-page-sequence
.
See also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论