英文原文取自于 http://developer.mozilla.org/en/docs/Extensions 这篇文章将对于那些想把他们的扩展在 Firefox 3 中正常运行的开发者提供一些有用的信息。
maxVersion信息，并且你的扩展所在的主机是addons.mozilla.org，事实上你不需要上传你的新的版本的扩展！只需要在 AMO 中使用开发者控制面板调整
install.rdf，声明扩展兼容 Firefox 3。
对于 Firefox 3，如下：
注意，在 Firefox3 的本版号中没有额外的“.0”，所以请使用“3.0.*”，而非“3.0.0.*”。
备注： Note that at this point more changes in Firefox 3 are expected. These changes may break some extensions, so you shouldn't release an extension with
maxVersion to the users until the Firefox 3 release candidate is out. During the Firefox 3 Beta period, you should use
3.0b5 as your
There have been (and will continue to be) a number of API changes that will likely break some extensions. We're still working on compiling a complete list of these changes.
备注： If your extension still uses an
Install.js script instead of an install manifest, you need to make the transition to an install manifest now. Firefox 3 no longer supports
install.js scripts in XPI files.
Add localizations to the install manifest
Firefox 3 supports new properties in the install manifest to specify localized descriptions. The old methods still work however the new allow Firefox to pick up the localizations even when the add-on is disabled and pending install. See Localizing extension descriptions for more details.
If you are hosting addons yourself and not on a secure add-on hosting provider like addons.mozilla.org then you must provide a secure method of updating your add-on. This will either involve hosting your updates on an SSL website, or using cryptographic keys to sign the update information. Read Securing Updates for more information.
Several APIs have been changed in significant ways. The most significant of these, which will likely affect a large number of extensions, are:
即使你不执行导入动作，就执行插入外部文档中的节点.Firefox 目前也不会报错 (如果严格按标准执行，很多已有的网站都无法正常运行). 我们鼓励开发者严格按标准修改自己已有的不符合上述标准的代码。
Bookmarks & History
If your extension accesses bookmark or history data in any way, it will need substantial work to be compatible with Firefox 3. The old APIs for accessing this information have been replaced by the new Places architecture. See the Places migration guide for details on updating your existing extension to use the Places API.
The Download Manager API has changed slightly due to the transition from an RDF data store to using the Storage API. This should be a pretty easy transition to make. In addition, the API for monitoring download progress has changed to support multiple download manager listeners. See
nsIDownloadProgressListener, and Monitoring downloads for more information.
If your extension accesses user login information using the Password Manager, it will need to be updated to use the new Login Manager API.
- The article Using nsILoginManager includes examples, including a demonstration of how to write your extension to work with both the Password Manager and the Login Manager, so it will work with both Firefox 3 and earlier versions.
You can also override the built-in password manager storage if you want to provide your own password storage implementation in your extensions. See Creating a Login Manager storage module for details.
Popups (Menus, Context Menus, Tooltips and Panels)
The XUL Popup system was heavily modified in Firefox 3. The Popup system includes main menus, context menus and popup panels. A guide to using Popups has been created, detailing how the system works. One thing to note is that
popup.showPopup has been deprecated in favor of new
handleEnter() method has been changed to accept an argument that indicates whether the text was selected from the autocomplete popup or by the user pressing enter after typing text.
- When a
DOMParseris instantiated, it inherits the calling code's principal and the
baseURIof the window the constructor came from.
- If the caller has UniversalXPConnect privileges, it can pass parameters to
new DOMParser(). If fewer than three parameters are passed, the remaining parameters will default to
- The first parameter is the principal to use; this overrides the default principal normally inherited.
- The second parameter is the
- The third parameter is the
- If you initialize a
DOMParserusing a contract, such as by calling
createInstance(), and you don't call the
init()method, attempting to initiate a parsing operation will automatically create and initialize the
DOMParserwith a null principal and
The following interfaces were removed from Gecko 1.9, which drives Firefox 3. If your extension makes use of any of these, you'll need to update your code:
nsICloseAllWindows(see bug 386200)
There has been a minor change to the chrome that may require changes in your code. A new
vbox has been added, called "browser-bottombox", which encloses the find bar and status bar at the bottom of the browser window. Although this doesn't affect the appearance of the display, it may affect your extension if it overlays chrome relative to these elements.
For example, if you previously overlaid some chrome before the status bar, like this:
<window id="main-window"> <something insertbefore="status-bar" /> </window>
You should now overlay it like this:
<vbox id="browser-bottombox"> <something insertbefore="status-bar" /> </vbox>
Or use the following technique to make your overlay work on both Firefox 2 and Firefox 3:
<window id="main-window"> <vbox id="browser-bottombox" insertbefore="status-bar"> <something insertbefore="status-bar" /> </vbox> </window>
备注： This change is effective for Firefox 3 beta 4 and the pre-beta 4 nightlies.
Add simple changes you had to make while updating your extension to work with Firefox 3 here.
chrome://browser/base/utilityOverlay.jsis no longer supported for security reasons. If you were previously using this, you should switch to
nsIAboutModuleimplementations are now required to support the
getURIFlagsmethod. See nsIAboutModule.idl for documentation. This affects extensions that provide new
about:URIs. (bug 337746)
tabbrowserelement is no longer part of "toolkit" (bug 339964). This means this element is no longer available to XUL applications and extensions. It continues to be used in the main Firefox window (browser.xul).
- Changes to nsISupports proxies and possibly to threading-related interfaces need to be documented.
- If you use XML processing instructions, such as
<?xml-stylesheet ?>in your XUL files, be aware of the changes made in bug 319654:
- XML PIs are now added to a XUL document's DOM. This means
document.firstChildis no longer guaranteed to be the root element. If you need to get the root document in your script, use
<?xul-overlay ?>processing instructions now have no effect outside the document prolog.
- XML PIs are now added to a XUL document's DOM. This means
window.addEventListener("load", myFunc, true)is not fired when loading web content (browser page loads). This is due to bug 296639 which changes the way inner and outer windows communicate. The simple fix here is to use
gBrowser.addEventListener("load", myFunc, true)as described here and works in Firefox 2 as well.
content.window.getSelection()gives an object (which can be converted to a string by
toString()), unlike the now deprecated
content.document.getSelection()which returns a string
event.preventBubble()was deprecated in Firefox 2 and has been removed in Firefox 3. Use
event.stopPropagation(), which works in Firefox 2 as well.
- Timers that are initiated using
setTimeout()are now blocked by modal windows due to the fix made for bug 52209. You may use
- If your extension needs to allow an untrusted source (e.g., a web site) to access the extension's chrome, then you must use the new