Merge from mozilla-central.
authorDavid Anderson <danderson@mozilla.com>
Tue, 14 Feb 2012 15:04:32 -0800
changeset 105829 132462b85b08292526d3c3d87ecffe552ac81727
parent 105828 1a9f6de629e0d9dbf11992ee77b5737fc24fd2e5 (current diff)
parent 86781 ad0038e0af1f4a6beae965b7dab2e048578b2130 (diff)
child 105830 ef7d9616a99b5f4400da76873b8c4c775c9c8929
child 105833 98a0b13b8a0cec8430394da7d323021ff8ee7800
push id23447
push userdanderson@mozilla.com
push dateTue, 11 Sep 2012 17:34:27 +0000
treeherderautoland@fdfaef738a00 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone13.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge from mozilla-central.
accessible/src/base/AccEvent.cpp
accessible/src/base/AccEvent.h
accessible/src/xpcom/nsAccEvent.cpp
browser/base/content/browser.js
browser/components/sessionstore/src/nsSessionStore.js
chrome/src/nsChromeRegistryChrome.cpp
configure.in
content/base/public/nsContentUtils.h
content/base/src/nsContentUtils.cpp
content/base/src/nsCopySupport.cpp
content/base/src/nsDocument.cpp
content/base/src/nsGenericDOMDataNode.cpp
content/base/src/nsGenericElement.cpp
content/base/src/nsGenericElement.h
content/base/src/nsObjectLoadingContent.cpp
content/base/test/Makefile.in
content/html/content/src/nsHTMLLegendElement.cpp
content/smil/nsSMILAnimationFunction.cpp
content/smil/nsSMILCSSProperty.cpp
content/smil/nsSMILParserUtils.cpp
content/svg/content/src/nsSVGFilters.cpp
content/xbl/src/nsXBLPrototypeHandler.cpp
docshell/base/nsDSURIContentListener.cpp
dom/base/nsFocusManager.cpp
dom/base/nsFocusManager.h
dom/ipc/ContentParent.cpp
dom/plugins/base/nsPluginHost.cpp
dom/plugins/base/nsPluginTags.cpp
dom/plugins/base/nsPluginTags.h
dom/src/geolocation/nsGeolocation.cpp
dom/src/storage/nsDOMStoragePersistentDB.cpp
dom/workers/XMLHttpRequestPrivate.cpp
extensions/cookie/nsCookiePermission.cpp
extensions/cookie/nsPopupWindowManager.cpp
extensions/gio/nsGIOProtocolHandler.cpp
extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp
extensions/permissions/nsContentBlocker.h
extensions/spellcheck/src/mozPersonalDictionary.cpp
image/src/imgLoader.cpp
js/src/Makefile.in
js/src/jsapi-tests/Makefile.in
js/src/jsapi.cpp
js/src/jsapi.h
js/src/jsinfer.cpp
js/src/jsiter.cpp
js/src/jsiter.h
js/src/jsutil.h
js/src/vm/Stack.cpp
js/src/vm/Stack.h
js/xpconnect/src/XPCJSRuntime.cpp
layout/base/crashtests/crashtests.list
layout/base/nsCSSFrameConstructor.cpp
layout/generic/nsColumnSetFrame.cpp
layout/generic/nsHTMLReflowState.cpp
layout/generic/nsHTMLReflowState.h
layout/reftests/flexbox/flexbox-attributes-no-box-horizontal-ref.xhtml
layout/reftests/flexbox/flexbox-attributes-no-box-horizontal.xhtml
layout/reftests/flexbox/flexbox-attributes-no-box-vertical-ref.xhtml
layout/reftests/flexbox/flexbox-attributes-no-box-vertical.xhtml
layout/reftests/flexbox/flexbox-attributes-no-input-horizontal-ref.xhtml
layout/reftests/flexbox/flexbox-attributes-no-input-horizontal.xhtml
layout/reftests/flexbox/flexbox-attributes-no-input-vertical-ref.xhtml
layout/reftests/flexbox/flexbox-attributes-no-input-vertical.xhtml
layout/reftests/flexbox/reftest.list
layout/reftests/reftest.list
layout/tools/reftest/reftest.js
layout/xul/base/src/nsMenuBarListener.cpp
layout/xul/base/src/nsXULPopupManager.cpp
media/libvorbis/lib/vorbis_codebook.c
media/libvorbis/update.sh
mobile/android/base/AndroidManifest.xml.in
mobile/android/base/GeckoApp.java
mobile/android/base/GeckoAppShell.java
mobile/xul/chrome/content/aboutHome.xhtml
modules/libpref/public/Preferences.h
modules/libpref/src/Preferences.cpp
modules/libpref/src/init/all.js
modules/libpref/src/nsPrefBranch.cpp
mozglue/android/APKOpen.cpp
netwerk/base/src/nsIOService.cpp
netwerk/base/src/nsIOService.h
netwerk/base/src/nsProtocolProxyService.cpp
netwerk/base/src/nsSocketTransportService2.cpp
netwerk/base/src/nsStandardURL.cpp
netwerk/cache/nsCacheMetaData.cpp
netwerk/cache/nsCacheService.cpp
netwerk/cookie/CookieServiceChild.cpp
netwerk/cookie/nsCookieService.cpp
netwerk/dns/nsDNSService2.cpp
netwerk/dns/nsIDNService.cpp
netwerk/protocol/ftp/nsFtpProtocolHandler.cpp
netwerk/protocol/http/nsHttpHandler.cpp
security/manager/ssl/src/nsNSSComponent.cpp
security/manager/ssl/src/nsNSSIOLayer.cpp
security/patches/bug-542832-ssl-restart-4.patch
security/patches/bug-542832-ssl-restart-tstclnt-4.patch
security/patches/bug-710176-ssl-restart-7-poll-v5.patch
toolkit/components/downloads/nsDownloadScanner.cpp
toolkit/components/intl/nsCharsetMenu.cpp
toolkit/components/passwordmgr/nsLoginManager.js
toolkit/components/telemetry/Telemetry.cpp
toolkit/components/telemetry/TelemetryHistograms.h
toolkit/components/telemetry/TelemetryPing.js
toolkit/components/telemetry/tests/unit/test_TelemetryPing.js
toolkit/components/typeaheadfind/nsTypeAheadFind.cpp
toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
toolkit/mozapps/extensions/LightweightThemeManager.jsm
toolkit/mozapps/extensions/content/extensions.js
toolkit/mozapps/extensions/nsBlocklistService.js
toolkit/xre/nsXREDirProvider.cpp
uriloader/exthandler/mac/nsOSHelperAppService.mm
widget/gonk/nsScreenManagerGonk.cpp
widget/gtk2/nsDragService.cpp
widget/gtk2/nsWindow.cpp
widget/gtk2/nsWindow.h
xpcom/base/nsCycleCollector.cpp
xpcom/build/nsXULAppAPI.h
xpcom/glue/nsCycleCollectionParticipant.h
--- a/.gitignore
+++ b/.gitignore
@@ -36,12 +36,12 @@ js/src/autom4te.cache
 js/src/tests/results-*.html
 js/src/tests/results-*.txt
 
 # Java HTML5 parser classes
 parser/html/java/htmlparser/
 parser/html/java/javaparser/
 
 # Ignore the files and directory that Eclipse IDE creates
-/.project
-/.cproject
-/.settings/
+.project
+.cproject
+.settings/
 
--- a/.hgignore
+++ b/.hgignore
@@ -36,12 +36,12 @@
 
 # Java HTML5 parser classes
 ^parser/html/java/(html|java)parser/
 
 # SVN directories
 \.svn/
 
 # Ignore the files and directory that Eclipse IDE creates
-^\.project$
-^\.cproject$
-^\.settings$
+\.project$
+\.cproject$
+\.settings/
 
--- a/accessible/public/nsIAccessibleEvent.idl
+++ b/accessible/public/nsIAccessibleEvent.idl
@@ -524,16 +524,35 @@ interface nsIAccessibleTextChangeEvent :
   boolean isInserted();
 
   /**
    * The inserted or removed text
    */
   readonly attribute DOMString modifiedText;
 };
 
+[scriptable, uuid(a2bd2eca-3afa-489b-afb2-f93ef32ad99c)]
+interface nsIAccessibleHideEvent: nsISupports
+{
+  /**
+   * Return an accessible that was a parent of the target.
+   */
+  readonly attribute nsIAccessible targetParent;
+
+  /**
+   * Return an accessible that was a next sibling of the target
+   */
+  readonly attribute nsIAccessible targetNextSibling;
+
+  /**
+   * Return an accessible that was a parent of the target
+   */
+  readonly attribute nsIAccessible targetPrevSibling;
+};
+
 [scriptable, uuid(5675c486-a230-4d85-a4bd-33670826d5ff)]
 interface nsIAccessibleCaretMoveEvent: nsISupports
 {
   /**
    * Return caret offset.
    */
   readonly attribute long caretOffset;
 };
--- a/accessible/src/base/AccEvent.cpp
+++ b/accessible/src/base/AccEvent.cpp
@@ -286,16 +286,24 @@ AccHideEvent::
   AccHideEvent(nsAccessible* aTarget, nsINode* aTargetNode) :
   AccMutationEvent(::nsIAccessibleEvent::EVENT_HIDE, aTarget, aTargetNode)
 {
   mParent = mAccessible->Parent();
   mNextSibling = mAccessible->NextSibling();
   mPrevSibling = mAccessible->PrevSibling();
 }
 
+already_AddRefed<nsAccEvent>
+AccHideEvent::CreateXPCOMObject()
+{
+  nsAccEvent* event = new nsAccHideEvent(this);
+  NS_ADDREF(event);
+  return event;
+}
+
 
 ////////////////////////////////////////////////////////////////////////////////
 // AccShowEvent
 ////////////////////////////////////////////////////////////////////////////////
 
 AccShowEvent::
   AccShowEvent(nsAccessible* aTarget, nsINode* aTargetNode) :
   AccMutationEvent(::nsIAccessibleEvent::EVENT_SHOW, aTarget, aTargetNode)
--- a/accessible/src/base/AccEvent.h
+++ b/accessible/src/base/AccEvent.h
@@ -265,22 +265,29 @@ protected:
  * Accessible hide event.
  */
 class AccHideEvent: public AccMutationEvent
 {
 public:
   AccHideEvent(nsAccessible* aTarget, nsINode* aTargetNode);
 
   // Event
+  virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
+
   static const EventGroup kEventGroup = eHideEvent;
   virtual unsigned int GetEventGroups() const
   {
     return AccMutationEvent::GetEventGroups() | (1U << eHideEvent);
   }
 
+  // AccHideEvent
+  nsAccessible* TargetParent() const { return mParent; }
+  nsAccessible* TargetNextSibling() const { return mNextSibling; }
+  nsAccessible* TargetPrevSibling() const { return mPrevSibling; }
+
 protected:
   nsRefPtr<nsAccessible> mParent;
   nsRefPtr<nsAccessible> mNextSibling;
   nsRefPtr<nsAccessible> mPrevSibling;
 
   friend class NotificationController;
 };
 
--- a/accessible/src/xpcom/nsAccEvent.cpp
+++ b/accessible/src/xpcom/nsAccEvent.cpp
@@ -169,16 +169,54 @@ NS_IMETHODIMP
 nsAccTextChangeEvent::GetModifiedText(nsAString& aModifiedText)
 {
   static_cast<AccTextChangeEvent*>(mEvent.get())->GetModifiedText(aModifiedText);
   return NS_OK;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
+// nsAccHideEvent
+////////////////////////////////////////////////////////////////////////////////
+
+NS_IMPL_ISUPPORTS_INHERITED1(nsAccHideEvent, nsAccEvent,
+                             nsIAccessibleHideEvent)
+
+NS_IMETHODIMP
+nsAccHideEvent::GetTargetParent(nsIAccessible** aAccessible)
+{
+  NS_ENSURE_ARG_POINTER(aAccessible);
+
+  NS_IF_ADDREF(*aAccessible =
+    static_cast<AccHideEvent*>(mEvent.get())->TargetParent());
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsAccHideEvent::GetTargetNextSibling(nsIAccessible** aAccessible)
+{
+  NS_ENSURE_ARG_POINTER(aAccessible);
+
+  NS_IF_ADDREF(*aAccessible =
+    static_cast<AccHideEvent*>(mEvent.get())->TargetNextSibling());
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsAccHideEvent::GetTargetPrevSibling(nsIAccessible** aAccessible)
+{
+  NS_ENSURE_ARG_POINTER(aAccessible);
+
+  NS_IF_ADDREF(*aAccessible =
+    static_cast<AccHideEvent*>(mEvent.get())->TargetPrevSibling());
+  return NS_OK;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
 // nsAccCaretMoveEvent
 ////////////////////////////////////////////////////////////////////////////////
 
 NS_IMPL_ISUPPORTS_INHERITED1(nsAccCaretMoveEvent, nsAccEvent,
                              nsIAccessibleCaretMoveEvent)
 
 NS_IMETHODIMP
 nsAccCaretMoveEvent::GetCaretOffset(PRInt32 *aCaretOffset)
--- a/accessible/src/xpcom/nsAccEvent.h
+++ b/accessible/src/xpcom/nsAccEvent.h
@@ -101,16 +101,36 @@ public:
 private:
   nsAccTextChangeEvent();
   nsAccTextChangeEvent(const nsAccTextChangeEvent&);
   nsAccTextChangeEvent& operator =(const nsAccTextChangeEvent&);
 };
 
 
 /**
+ * Accessible hide event.
+ */
+class nsAccHideEvent : public nsAccEvent,
+                       public nsIAccessibleHideEvent
+{
+public:
+  nsAccHideEvent(AccHideEvent* aEvent) : nsAccEvent(aEvent) { }
+  virtual ~nsAccHideEvent() { }
+
+  NS_DECL_ISUPPORTS_INHERITED
+  NS_DECL_NSIACCESSIBLEHIDEEVENT
+
+private:
+  nsAccHideEvent() MOZ_DELETE;
+  nsAccHideEvent(const nsAccHideEvent&) MOZ_DELETE;
+  nsAccHideEvent& operator =(const nsAccHideEvent&) MOZ_DELETE;
+};
+
+
+/**
  * Accessible caret move event.
  */
 class nsAccCaretMoveEvent: public nsAccEvent,
                            public nsIAccessibleCaretMoveEvent
 {
 public:
   nsAccCaretMoveEvent(AccCaretMoveEvent* aEvent) : nsAccEvent(aEvent) { }
   virtual ~nsAccCaretMoveEvent() { }
--- a/browser/app/profile/extensions/testpilot@labs.mozilla.com/tests/test_data_store.js
+++ b/browser/app/profile/extensions/testpilot@labs.mozilla.com/tests/test_data_store.js
@@ -402,17 +402,17 @@ StubHandlers.prototype = {
   uninstallAll: function() {
   }
 };
 
 function clearAllPrefsForStudy(studyId) {
   dump("Looking for prefs to delete...\n");
   let prefService = Cc["@mozilla.org/preferences-service;1"]
                      .getService(Ci.nsIPrefService)
-                     .QueryInterface(Ci.nsIPrefBranch2);
+                     .QueryInterface(Ci.nsIPrefBranch);
   let prefStem = "extensions.testpilot";
   let prefNames = prefService.getChildList(prefStem);
   for each (let prefName in prefNames) {
     if (prefName.indexOf(studyId) != -1) {
       dump("Clearing pref " + prefName + "\n");
       prefService.clearUserPref(prefName);
     }
   }
@@ -778,9 +778,9 @@ function testSameGUIDs() {
           cheapAssertEqual((exp2Guid != ""), true, "guid should be non-empty");
         });
       });
     });
   });
 }
 
 // TODO test for continuity of GUID with recurring study (longitudinal) - i don't think this
-// has actually been working so far because a new GUID is generted every time the study starts up...
\ No newline at end of file
+// has actually been working so far because a new GUID is generted every time the study starts up...
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -3540,39 +3540,21 @@ const BrowserSearch = {
 
     // getSubmission can return null if the engine doesn't have a URL
     // with a text/html response type.  This is unlikely (since
     // SearchService._addEngineToStore() should fail for such an engine),
     // but let's be on the safe side.
     if (!submission)
       return;
 
-    let newTab;
-    function newTabHandler(event) {
-      newTab = event.target;
-    }
-    gBrowser.tabContainer.addEventListener("TabOpen", newTabHandler);
-
     openLinkIn(submission.uri.spec,
                useNewTab ? "tab" : "current",
                { postData: submission.postData,
+                 inBackground: false,
                  relatedToCurrent: true });
-
-    gBrowser.tabContainer.removeEventListener("TabOpen", newTabHandler);
-    if (newTab && !newTab.selected) {
-      let tabSelected = false;
-      function tabSelectHandler() {
-        tabSelected = true;
-      }
-      newTab.addEventListener("TabSelect", tabSelectHandler);
-      setTimeout(function () {
-        newTab.removeEventListener("TabSelect", tabSelectHandler);
-        Services.telemetry.getHistogramById("FX_CONTEXT_SEARCH_AND_TAB_SELECT").add(tabSelected);
-      }, 5000);
-    }
   },
 
   /**
    * Returns the search bar element if it is present in the toolbar, null otherwise.
    */
   get searchBar() {
     return document.getElementById("searchbar");
   },
--- a/browser/base/content/pageinfo/pageInfo.js
+++ b/browser/base/content/pageinfo/pageInfo.js
@@ -789,17 +789,17 @@ function selectSaveFolder()
   const nsIFilePicker = Components.interfaces.nsIFilePicker;
   var fp = Components.classes["@mozilla.org/filepicker;1"]
                      .createInstance(nsIFilePicker);
 
   var titleText = gBundle.getString("mediaSelectFolder");
   fp.init(window, titleText, nsIFilePicker.modeGetFolder);
   try {
     var prefs = Components.classes[PREFERENCES_CONTRACTID]
-                          .getService(Components.interfaces.nsIPrefBranch2);
+                          .getService(Components.interfaces.nsIPrefBranch);
 
     var initialDir = prefs.getComplexValue("browser.download.dir", nsILocalFile);
     if (initialDir)
       fp.displayDirectory = initialDir;
   }
   catch (ex) { }
 
   fp.appendFilters(nsIFilePicker.filterAll);
@@ -1099,17 +1099,17 @@ function makePreview(row)
   imageContainer.appendChild(newImage);
 }
 
 function makeBlockImage(url)
 {
   var permissionManager = Components.classes[PERMISSION_CONTRACTID]
                                     .getService(nsIPermissionManager);
   var prefs = Components.classes[PREFERENCES_CONTRACTID]
-                        .getService(Components.interfaces.nsIPrefBranch2);
+                        .getService(Components.interfaces.nsIPrefBranch);
 
   var checkbox = document.getElementById("blockImage");
   var imagePref = prefs.getIntPref("permissions.default.image");
   if (!(/^https?:/.test(url)) || imagePref == 2)
     // We can't block the images from this host because either is is not
     // for http(s) or we don't load images at all
     checkbox.hidden = true;
   else {
--- a/browser/base/content/pageinfo/permissions.js
+++ b/browser/base/content/pageinfo/permissions.js
@@ -94,17 +94,17 @@ var permissionObserver = {
         initRow(permission.type);
     }
   }
 };
 
 function onLoadPermission()
 {
   gPrefs = Components.classes[PREFERENCES_CONTRACTID]
-                     .getService(Components.interfaces.nsIPrefBranch2);
+                     .getService(Components.interfaces.nsIPrefBranch);
 
   var uri = gDocument.documentURIObject;
   var permTab = document.getElementById("permTab");
   if(/^https?/.test(uri.scheme)) {
     gPermURI = uri;
     var hostText = document.getElementById("hostText");
     hostText.value = gPermURI.host;
 
--- a/browser/base/content/sanitize.js
+++ b/browser/base/content/sanitize.js
@@ -228,17 +228,17 @@ Sanitizer.prototype = {
           var os = Components.classes["@mozilla.org/observer-service;1"]
                              .getService(Components.interfaces.nsIObserverService);
           os.notifyObservers(null, "browser:purge-session-history", "");
         }
         catch (e) { }
         
         // Clear last URL of the Open Web Location dialog
         var prefs = Components.classes["@mozilla.org/preferences-service;1"]
-                              .getService(Components.interfaces.nsIPrefBranch2);
+                              .getService(Components.interfaces.nsIPrefBranch);
         try {
           prefs.clearUserPref("general.open_location.last_url");
         }
         catch (e) { }
       },
       
       get canClear()
       {
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -77,18 +77,17 @@
                     class="autocomplete-result-popupset"/>
       <children includes="toolbarbutton"/>
     </content>
 
     <implementation implements="nsIObserver, nsIDOMEventListener">
       <constructor><![CDATA[
         this._prefs = Components.classes["@mozilla.org/preferences-service;1"]
                                 .getService(Components.interfaces.nsIPrefService)
-                                .getBranch("browser.urlbar.")
-                                .QueryInterface(Components.interfaces.nsIPrefBranch2);
+                                .getBranch("browser.urlbar.");
 
         this._prefs.addObserver("", this, false);
         this.clickSelectsAll = this._prefs.getBoolPref("clickSelectsAll");
         this.doubleClickSelectsAll = this._prefs.getBoolPref("doubleClickSelectsAll");
         this.completeDefaultIndex = this._prefs.getBoolPref("autoFill");
         this.timeout = this._prefs.getIntPref("delay");
         this._formattingEnabled = this._prefs.getBoolPref("formatting.enabled");
         this._mayTrimURLs = this._prefs.getBoolPref("trimURLs");
--- a/browser/components/feeds/src/FeedWriter.js
+++ b/browser/components/feeds/src/FeedWriter.js
@@ -1159,17 +1159,17 @@ FeedWriter.prototype = {
                  getService(Ci.nsIScriptSecurityManager);
     this._feedPrincipal = secman.getCodebasePrincipal(this._feedURI);
 
     LOG("Subscribe Preview: feed uri = " + this._window.location.href);
 
     // Set up the subscription UI
     this._initSubscriptionUI();
     var prefs = Cc["@mozilla.org/preferences-service;1"].
-                getService(Ci.nsIPrefBranch2);
+                getService(Ci.nsIPrefBranch);
     prefs.addObserver(PREF_SELECTED_ACTION, this, false);
     prefs.addObserver(PREF_SELECTED_READER, this, false);
     prefs.addObserver(PREF_SELECTED_WEB, this, false);
     prefs.addObserver(PREF_SELECTED_APP, this, false);
     prefs.addObserver(PREF_VIDEO_SELECTED_ACTION, this, false);
     prefs.addObserver(PREF_VIDEO_SELECTED_READER, this, false);
     prefs.addObserver(PREF_VIDEO_SELECTED_WEB, this, false);
     prefs.addObserver(PREF_VIDEO_SELECTED_APP, this, false);
@@ -1202,17 +1202,17 @@ FeedWriter.prototype = {
   close: function FW_close() {
     this._getUIElement("handlersMenuPopup")
         .removeEventListener("command", this, false);
     this._getUIElement("subscribeButton")
         .removeEventListener("command", this, false);
     this._document = null;
     this._window = null;
     var prefs = Cc["@mozilla.org/preferences-service;1"].
-                getService(Ci.nsIPrefBranch2);
+                getService(Ci.nsIPrefBranch);
     prefs.removeObserver(PREF_SELECTED_ACTION, this);
     prefs.removeObserver(PREF_SELECTED_READER, this);
     prefs.removeObserver(PREF_SELECTED_WEB, this);
     prefs.removeObserver(PREF_SELECTED_APP, this);
     prefs.removeObserver(PREF_VIDEO_SELECTED_ACTION, this);
     prefs.removeObserver(PREF_VIDEO_SELECTED_READER, this);
     prefs.removeObserver(PREF_VIDEO_SELECTED_WEB, this);
     prefs.removeObserver(PREF_VIDEO_SELECTED_APP, this);
--- a/browser/components/preferences/applications.js
+++ b/browser/components/preferences/applications.js
@@ -216,21 +216,18 @@ HandlerInfoWrapper.prototype = {
 
 
   //**************************************************************************//
   // Convenience Utils
 
   _handlerSvc: Cc["@mozilla.org/uriloader/handler-service;1"].
                getService(Ci.nsIHandlerService),
 
-  // Retrieve this as nsIPrefBranch and then immediately QI to nsIPrefBranch2
-  // so both interfaces are available to callers.
   _prefSvc: Cc["@mozilla.org/preferences-service;1"].
-            getService(Ci.nsIPrefBranch).
-            QueryInterface(Ci.nsIPrefBranch2),
+            getService(Ci.nsIPrefBranch),
 
   _categoryMgr: Cc["@mozilla.org/categorymanager;1"].
                 getService(Ci.nsICategoryManager),
 
   element: function(aID) {
     return document.getElementById(aID);
   },
 
@@ -880,21 +877,18 @@ var gApplicationsPane = {
   // Convenience & Performance Shortcuts
 
   // These get defined by init().
   _brandShortName : null,
   _prefsBundle    : null,
   _list           : null,
   _filter         : null,
 
-  // Retrieve this as nsIPrefBranch and then immediately QI to nsIPrefBranch2
-  // so both interfaces are available to callers.
   _prefSvc      : Cc["@mozilla.org/preferences-service;1"].
-                  getService(Ci.nsIPrefBranch).
-                  QueryInterface(Ci.nsIPrefBranch2),
+                  getService(Ci.nsIPrefBranch),
 
   _mimeSvc      : Cc["@mozilla.org/mime;1"].
                   getService(Ci.nsIMIMEService),
 
   _helperAppSvc : Cc["@mozilla.org/uriloader/external-helper-app-service;1"].
                   getService(Ci.nsIExternalHelperAppService),
 
   _handlerSvc   : Cc["@mozilla.org/uriloader/handler-service;1"].
--- a/browser/components/preferences/privacy.js
+++ b/browser/components/preferences/privacy.js
@@ -75,33 +75,31 @@ var gPrivacyPane = {
    * private browsing mode is not active, the initial history mode would be
    * set to "Remember everything".
    * Otherwise, the initial history mode would be set to "Custom".
    *
    * Extensions adding their own preferences can append their IDs to this array if needed.
    */
   prefsForDefault: [
     "places.history.enabled",
-    "browser.download.manager.retention",
     "browser.formfill.enable",
     "network.cookie.cookieBehavior",
     "network.cookie.lifetimePolicy",
     "privacy.sanitize.sanitizeOnShutdown"
   ],
 
   /**
    * The list of control IDs which are dependent on the auto-start private
    * browsing setting, such that in "Custom" mode they would be disabled if
    * the auto-start private browsing checkbox is checked, and enabled otherwise.
    *
    * Extensions adding their own controls can append their IDs to this array if needed.
    */
   dependentControls: [
     "rememberHistory",
-    "rememberDownloads",
     "rememberForms",
     "keepUntil",
     "keepCookiesUntil",
     "alwaysClear",
     "clearDataSettings"
   ],
 
   /**
@@ -172,20 +170,16 @@ var gPrivacyPane = {
     case "remember":
       pref.value = false;
 
       // select the remember history option if needed
       let rememberHistoryCheckbox = document.getElementById("rememberHistory");
       if (!rememberHistoryCheckbox.checked)
         rememberHistoryCheckbox.checked = true;
 
-      // select the remember downloads option if needed
-      if (!document.getElementById("rememberDownloads").checked)
-        document.getElementById("browser.download.manager.retention").value = 2;
-
       // select the remember forms history option
       document.getElementById("browser.formfill.enable").value = true;
 
       // select the accept cookies option
       document.getElementById("network.cookie.cookieBehavior").value = 0;
       // select the cookie lifetime policy option
       document.getElementById("network.cookie.lifetimePolicy").value = 0;
 
@@ -218,18 +212,16 @@ var gPrivacyPane = {
 
       // adjust the checked state of the sanitizeOnShutdown checkbox
       document.getElementById("alwaysClear").checked = disabled ? false :
         document.getElementById("privacy.sanitize.sanitizeOnShutdown").value;
 
       // adjust the checked state of the remember history checkboxes
       document.getElementById("rememberHistory").checked = disabled ? false :
         document.getElementById("places.history.enabled").value;
-      document.getElementById("rememberDownloads").checked = disabled ? false :
-        this.readDownloadRetention();
       document.getElementById("rememberForms").checked = disabled ? false :
         document.getElementById("browser.formfill.enable").value;
 
       if (!disabled) {
         // adjust the Settings button for sanitizeOnShutdown
         this._updateSanitizeSettingsButton();
       }
     }
@@ -239,30 +231,30 @@ var gPrivacyPane = {
 
   /**
    * Install the observer for the auto-start private browsing mode pref.
    */
   initAutoStartPrivateBrowsingObserver: function PPP_initAutoStartPrivateBrowsingObserver()
   {
     let prefService = document.getElementById("privacyPreferences")
                               .service
-                              .QueryInterface(Components.interfaces.nsIPrefBranch2);
+                              .QueryInterface(Components.interfaces.nsIPrefBranch);
     prefService.addObserver("browser.privatebrowsing.autostart",
                             this.autoStartPrivateBrowsingObserver,
                             false);
   },
 
   /**
    * Install the observer for the auto-start private browsing mode pref.
    */
   removeASPBObserver: function PPP_removeASPBObserver()
   {
     let prefService = document.getElementById("privacyPreferences")
                               .service
-                              .QueryInterface(Components.interfaces.nsIPrefBranch2);
+                              .QueryInterface(Components.interfaces.nsIPrefBranch);
     prefService.removeObserver("browser.privatebrowsing.autostart",
                                this.autoStartPrivateBrowsingObserver);
   },
 
   autoStartPrivateBrowsingObserver:
   {
     QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIObserver]),
 
@@ -326,46 +318,18 @@ var gPrivacyPane = {
   /*
    * Preferences:
    *
    * places.history.enabled
    * - whether history is enabled or not
    * browser.formfill.enable
    * - true if entries in forms and the search bar should be saved, false
    *   otherwise
-   * browser.download.manager.retention
-   * - determines when downloads are automatically removed from the download
-   *   manager:
-   *
-   *     0 means remove downloads when they finish downloading
-   *     1 means downloads will be removed when the browser quits
-   *     2 means never remove downloads
    */
 
-  /**
-   * Converts the value of the browser.download.manager.retention preference
-   * into a Boolean value.  "remove on close" and "don't remember" both map
-   * to an unchecked checkbox, while "remember" maps to a checked checkbox.
-   */
-  readDownloadRetention: function ()
-  {
-    var pref = document.getElementById("browser.download.manager.retention");
-    return (pref.value == 2);
-  },
-
-  /**
-   * Returns the appropriate value of the browser.download.manager.retention
-   * preference for the current UI.
-   */
-  writeDownloadRetention: function ()
-  {
-    var checkbox = document.getElementById("rememberDownloads");
-    return checkbox.checked ? 2 : 0;
-  },
-
   // COOKIES
 
   /*
    * Preferences:
    *
    * network.cookie.cookieBehavior
    * - determines how the browser should handle cookies:
    *     0   means enable all cookies
--- a/browser/components/preferences/privacy.xul
+++ b/browser/components/preferences/privacy.xul
@@ -82,19 +82,16 @@
 
       <!-- History -->
       <preference id="places.history.enabled"
                   name="places.history.enabled"
                   type="bool"/>
       <preference id="browser.formfill.enable"
                   name="browser.formfill.enable"
                   type="bool"/>
-      <preference id="browser.download.manager.retention"
-                  name="browser.download.manager.retention"
-                  type="int"/>
 
       <!-- Cookies -->
       <preference id="network.cookie.cookieBehavior"      name="network.cookie.cookieBehavior"      type="int"/>
       <preference id="network.cookie.lifetimePolicy"      name="network.cookie.lifetimePolicy"      type="int"/>
       <preference id="network.cookie.blockFutureCookies"  name="network.cookie.blockFutureCookies"  type="bool"/>
 
       <!-- Clear Private Data -->
       <preference id="privacy.sanitize.sanitizeOnShutdown"
@@ -189,25 +186,19 @@
           <checkbox id="privateBrowsingAutoStart" class="indent"
                     label="&privateBrowsingPermanent2.label;"
                     accesskey="&privateBrowsingPermanent2.accesskey;"
                     preference="browser.privatebrowsing.autostart"/>
 
           <vbox class="indent">
             <vbox class="indent">
               <checkbox id="rememberHistory"
-                        label="&rememberHistory.label;"
-                        accesskey="&rememberHistory.accesskey;"
+                        label="&rememberHistory2.label;"
+                        accesskey="&rememberHistory2.accesskey;"
                         preference="places.history.enabled"/>
-              <checkbox id="rememberDownloads"
-                        label="&rememberDownload.label;"
-                        accesskey="&rememberDownload.accesskey;"
-                        preference="browser.download.manager.retention"
-                        onsyncfrompreference="return gPrivacyPane.readDownloadRetention();"
-                        onsynctopreference="return gPrivacyPane.writeDownloadRetention();"/>
               <checkbox id="rememberForms"
                         label="&rememberSearchForm.label;"
                         accesskey="&rememberSearchForm.accesskey;"
                         preference="browser.formfill.enable"/>
 
               <hbox id="cookiesBox">
                 <checkbox id="acceptCookies" label="&acceptCookies.label;" flex="1"
                           preference="network.cookie.cookieBehavior"
--- a/browser/components/preferences/tests/browser_privacypane_3.js
+++ b/browser/components/preferences/tests/browser_privacypane_3.js
@@ -44,18 +44,16 @@ function test() {
     let tmpdir = extractJarToTmp(jar);
     rootDir = "file://" + tmpdir.path + '/';
   }
   loader.loadSubScript(rootDir + "privacypane_tests.js", this);
 
   run_test_subset([
     test_custom_retention("rememberHistory", "remember"),
     test_custom_retention("rememberHistory", "custom"),
-    test_custom_retention("rememberDownloads", "remember"),
-    test_custom_retention("rememberDownloads", "custom"),
     test_custom_retention("rememberForms", "remember"),
     test_custom_retention("rememberForms", "custom"),
     test_historymode_retention("remember", "remember"),
 
     // reset all preferences to their default values once we're done
     reset_preferences
   ]);
 }
--- a/browser/components/preferences/tests/privacypane_tests.js
+++ b/browser/components/preferences/tests/privacypane_tests.js
@@ -87,17 +87,16 @@ function test_pane_visibility(win) {
 
 function test_dependent_elements(win) {
   let historymode = win.document.getElementById("historyMode");
   ok(historymode, "history mode menulist should exist");
   let pbautostart = win.document.getElementById("privateBrowsingAutoStart");
   ok(pbautostart, "the private browsing auto-start checkbox should exist");
   let controls = [
     win.document.getElementById("rememberHistory"),
-    win.document.getElementById("rememberDownloads"),
     win.document.getElementById("rememberForms"),
     win.document.getElementById("keepUntil"),
     win.document.getElementById("keepCookiesUntil"),
     win.document.getElementById("alwaysClear"),
   ];
   controls.forEach(function(control) {
     ok(control, "the dependent controls should exist");
   });
@@ -111,18 +110,16 @@ function test_dependent_elements(win) {
   let cookieexceptions = win.document.getElementById("cookieExceptions");
   ok(cookieexceptions, "the cookie exceptions button should exist");
   let keepuntil = win.document.getElementById("keepCookiesUntil");
   ok(keepuntil, "the keep cookies until menulist should exist");
   let alwaysclear = win.document.getElementById("alwaysClear");
   ok(alwaysclear, "the clear data on close checkbox should exist");
   let rememberhistory = win.document.getElementById("rememberHistory");
   ok(rememberhistory, "the remember history checkbox should exist");
-  let rememberdownloads = win.document.getElementById("rememberDownloads");
-  ok(rememberdownloads, "the remember downloads checkbox should exist");
   let rememberforms = win.document.getElementById("rememberForms");
   ok(rememberforms, "the remember forms checkbox should exist");
   let alwaysclearsettings = win.document.getElementById("clearDataSettings");
   ok(alwaysclearsettings, "the clear data settings button should exist");
 
   function expect_disabled(disabled) {
     controls.forEach(function(control) {
       is(control.disabled, disabled,
@@ -130,18 +127,16 @@ function test_dependent_elements(win) {
     });
     is(keepuntil.value, disabled ? 2 : 0,
       "the keep cookies until menulist value should be as expected");
     if (disabled) {
      ok(!alwaysclear.checked,
         "the clear data on close checkbox value should be as expected");
      ok(!rememberhistory.checked,
         "the remember history checkbox value should be as expected");
-     ok(!rememberdownloads.checked,
-        "the remember downloads checkbox value should be as expected");
      ok(!rememberforms.checked,
         "the remember forms checkbox value should be as expected");
     }
   }
   function check_independents(expected) {
     independents.forEach(function(control) {
       is(control.disabled, expected,
         control.getAttribute("id") + " should " + (expected ? "" : "not ") + "be disabled");
@@ -297,17 +292,16 @@ function test_dependent_clearonclose_ele
   expect_disabled(true);
 }
 
 function test_dependent_prefs(win) {
   let historymode = win.document.getElementById("historyMode");
   ok(historymode, "history mode menulist should exist");
   let controls = [
     win.document.getElementById("rememberHistory"),
-    win.document.getElementById("rememberDownloads"),
     win.document.getElementById("rememberForms"),
     win.document.getElementById("acceptCookies"),
     win.document.getElementById("acceptThirdParty"),
   ];
   controls.forEach(function(control) {
     ok(control, "the micro-management controls should exist");
   });
 
--- a/browser/components/privatebrowsing/test/unit/test_geoClearCookie.js
+++ b/browser/components/privatebrowsing/test/unit/test_geoClearCookie.js
@@ -36,17 +36,17 @@
  * ***** END LICENSE BLOCK ***** */
 
 // Test to ensure the geolocation token is cleared when changing the private
 // browsing mode
 
 const accessToken = '{"location":{"latitude":51.5090332,"longitude":-0.1212726,"accuracy":150.0},"access_token":"2:jVhRZJ-j6PiRchH_:RGMrR0W1BiwdZs12"}'
 function run_test_on_service() {
   var prefBranch = Cc["@mozilla.org/preferences-service;1"].
-                   getService(Ci.nsIPrefBranch2);
+                   getService(Ci.nsIPrefBranch);
   var pb = Cc[PRIVATEBROWSING_CONTRACT_ID].
            getService(Ci.nsIPrivateBrowsingService);
   prefBranch.setCharPref("geo.wifi.access_token.test", accessToken);
   var token = prefBranch.getCharPref("geo.wifi.access_token.test");
   do_check_eq(token, accessToken);
   pb.privateBrowsingEnabled = true;
   token = "";
   try {
--- a/browser/components/search/content/search.xml
+++ b/browser/components/search/content/search.xml
@@ -534,19 +534,19 @@
       <constructor><![CDATA[
         if (document.getBindingParent(this).parentNode.parentNode.localName ==
             "toolbarpaletteitem")
           return;
         setTimeout(function(a) { a.initialize(); }, 0, this);
       ]]></constructor>
 
       <destructor><![CDATA[
-          var ps2 = Components.classes["@mozilla.org/preferences-service;1"]
-                              .getService(Components.interfaces.nsIPrefBranch2);
-          ps2.removeObserver("browser.search.suggest.enabled", this);
+          var prefs = Components.classes["@mozilla.org/preferences-service;1"]
+                              .getService(Components.interfaces.nsIPrefBranch);
+          prefs.removeObserver("browser.search.suggest.enabled", this);
 
         // Because XBL and the customize toolbar code interacts poorly,
         // there may not be anything to remove here
         try {
           this.controllers.removeController(this.searchbarController);
         } catch (ex) { }
       ]]></destructor>
 
@@ -630,19 +630,19 @@
           element.setAttribute("checked", this._suggestEnabled);
           element.setAttribute("autocheck", "false");
           this._suggestMenuItem = element;
           cxmenu.appendChild(element);
 
           this.controllers.appendController(this.searchbarController);
 
           // Add observer for suggest preference
-          var ps2 = Components.classes["@mozilla.org/preferences-service;1"]
-                              .getService(Components.interfaces.nsIPrefBranch2);
-          ps2.addObserver("browser.search.suggest.enabled", this, false);
+          var prefs = Components.classes["@mozilla.org/preferences-service;1"]
+                              .getService(Components.interfaces.nsIPrefBranch);
+          prefs.addObserver("browser.search.suggest.enabled", this, false);
         ]]></body>
       </method>
 
       <!--
         This method overrides the autocomplete binding's openPopup (essentially
         duplicating the logic from the autocomplete popup binding's
         openAutocompletePopup method), modifying it so that the popup is aligned with
         the inner textbox, but sized to not extend beyond the search bar border.
--- a/browser/components/sessionstore/src/nsSessionStore.js
+++ b/browser/components/sessionstore/src/nsSessionStore.js
@@ -158,18 +158,17 @@ function debug(aMsg) {
   Services.console.logStringMessage(aMsg);
 }
 
 /* :::::::: The Service ::::::::::::::: */
 
 function SessionStoreService() {
   XPCOMUtils.defineLazyGetter(this, "_prefBranch", function () {
     return Cc["@mozilla.org/preferences-service;1"].
-           getService(Ci.nsIPrefService).getBranch("browser.").
-           QueryInterface(Ci.nsIPrefBranch2);
+           getService(Ci.nsIPrefService).getBranch("browser.");
   });
 
   // minimal interval between two save operations (in milliseconds)
   XPCOMUtils.defineLazyGetter(this, "_interval", function () {
     // used often, so caching/observing instead of fetching on-demand
     this._prefBranch.addObserver("sessionstore.interval", this, true);
     return this._prefBranch.getIntPref("sessionstore.interval");
   });
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -430,24 +430,21 @@
 @BINPATH@/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf
 @BINPATH@/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/icon.png
 @BINPATH@/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/preview.png
 #ifdef SHIP_FEEDBACK
 @BINPATH@/distribution/extensions/testpilot@labs.mozilla.com.xpi
 #endif
 @BINPATH@/chrome/toolkit@JAREXT@
 @BINPATH@/chrome/toolkit.manifest
-#ifdef XP_UNIX
-#ifndef XP_MACOSX
+#ifdef MOZ_GTK2
 @BINPATH@/chrome/icons/default/default16.png
 @BINPATH@/chrome/icons/default/default32.png
 @BINPATH@/chrome/icons/default/default48.png
 #endif
-#endif
-
 
 ; shell icons
 #ifdef XP_UNIX
 #ifndef XP_MACOSX
 @BINPATH@/icons/*.xpm
 @BINPATH@/icons/*.png
 #endif
 #endif
--- a/browser/locales/en-US/chrome/browser/preferences/privacy.dtd
+++ b/browser/locales/en-US/chrome/browser/preferences/privacy.dtd
@@ -10,17 +10,16 @@
 <!ENTITY  locbar.pre.label              "When using the location bar, suggest:">
 <!ENTITY  locbar.pre.accessKey          "u">
 <!ENTITY  locbar.post.label             "">
 <!ENTITY  locbar.both.label             "History and Bookmarks">
 <!ENTITY  locbar.history.label          "History">
 <!ENTITY  locbar.bookmarks.label        "Bookmarks">
 <!ENTITY  locbar.nothing.label          "Nothing">
 
-
 <!ENTITY  acceptCookies.label           "Accept cookies from sites">
 <!ENTITY  acceptCookies.accesskey       "A">
 
 <!ENTITY  acceptThirdParty.label        "Accept third-party cookies">
 <!ENTITY  acceptThirdParty.accesskey    "c">
 
 <!ENTITY  keepUntil.label               "Keep until:">
 <!ENTITY  keepUntil.accesskey           "K">
@@ -59,21 +58,18 @@
 <!-- LOCALIZATION NOTE (dontrememberActions.post.label): include a starting space as needed -->
 <!ENTITY  dontrememberActions.pre.label          "You may also want to ">
 <!ENTITY  dontrememberActions.clearHistory.label "clear all current history">
 <!ENTITY  dontrememberActions.post.label         ".">
 
 <!ENTITY  privateBrowsingPermanent2.label "Always use private browsing mode">
 <!ENTITY  privateBrowsingPermanent2.accesskey "p">
 
-<!ENTITY  rememberHistory.label      "Remember my browsing history">
-<!ENTITY  rememberHistory.accesskey  "b">
-
-<!ENTITY  rememberDownload.label         "Remember download history">
-<!ENTITY  rememberDownload.accesskey     "d">
+<!ENTITY  rememberHistory2.label      "Remember my browsing and download history">
+<!ENTITY  rememberHistory2.accesskey  "b">
 
 <!ENTITY  rememberSearchForm.label       "Remember search and form history">
 <!ENTITY  rememberSearchForm.accesskey   "f">
 
 <!ENTITY  clearOnClose.label             "Clear history when &brandShortName; closes">
 <!ENTITY  clearOnClose.accesskey         "r">
 
 <!ENTITY  clearOnCloseSettings.label     "Settingsā€¦">
--- a/browser/modules/WindowsJumpLists.jsm
+++ b/browser/modules/WindowsJumpLists.jsm
@@ -74,18 +74,17 @@ let EXPORTED_SYMBOLS = [
   "WinTaskbarJumpList",
 ];
 
 /**
  * Smart getters
  */
 
 XPCOMUtils.defineLazyGetter(this, "_prefs", function() {
-  return Services.prefs.getBranch(PREF_TASKBAR_BRANCH)
-                       .QueryInterface(Ci.nsIPrefBranch2);
+  return Services.prefs.getBranch(PREF_TASKBAR_BRANCH);
 });
 
 XPCOMUtils.defineLazyGetter(this, "_stringBundle", function() {
   return Services.strings
                  .createBundle("chrome://browser/locale/taskbar.properties");
 });
 
 XPCOMUtils.defineLazyGetter(this, "PlacesUtils", function() {
--- a/browser/modules/WindowsPreviewPerTab.jsm
+++ b/browser/modules/WindowsPreviewPerTab.jsm
@@ -719,11 +719,11 @@ var AeroPeek = {
 };
 
 XPCOMUtils.defineLazyGetter(AeroPeek, "cacheTimer", function ()
   Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer)
 );
 
 XPCOMUtils.defineLazyServiceGetter(AeroPeek, "prefs",
                                    "@mozilla.org/preferences-service;1",
-                                   "nsIPrefBranch2");
+                                   "nsIPrefBranch");
 
 AeroPeek.initialize();
--- a/chrome/src/nsChromeRegistryChrome.cpp
+++ b/chrome/src/nsChromeRegistryChrome.cpp
@@ -62,17 +62,17 @@
 #include "nsZipArchive.h"
 
 #include "mozilla/LookAndFeel.h"
 
 #include "nsICommandLine.h"
 #include "nsILocaleService.h"
 #include "nsILocalFile.h"
 #include "nsIObserverService.h"
-#include "nsIPrefBranch2.h"
+#include "nsIPrefBranch.h"
 #include "nsIPrefService.h"
 #include "nsIResProtocolHandler.h"
 #include "nsIScriptError.h"
 #include "nsIVersionComparator.h"
 #include "nsIXPConnect.h"
 #include "nsIXULAppInfo.h"
 #include "nsIXULRuntime.h"
 
@@ -185,22 +185,19 @@ nsChromeRegistryChrome::Init()
   else {
     nsXPIDLCString provider;
     rv = prefs->GetCharPref(SELECTED_SKIN_PREF, getter_Copies(provider));
     if (NS_SUCCEEDED(rv))
       mSelectedSkin = provider;
 
     SelectLocaleFromPref(prefs);
 
-    nsCOMPtr<nsIPrefBranch2> prefs2 (do_QueryInterface(prefs));
-    if (prefs2) {
-      rv = prefs2->AddObserver(MATCH_OS_LOCALE_PREF, this, true);
-      rv = prefs2->AddObserver(SELECTED_LOCALE_PREF, this, true);
-      rv = prefs2->AddObserver(SELECTED_SKIN_PREF, this, true);
-    }
+    rv = prefs->AddObserver(MATCH_OS_LOCALE_PREF, this, true);
+    rv = prefs->AddObserver(SELECTED_LOCALE_PREF, this, true);
+    rv = prefs->AddObserver(SELECTED_SKIN_PREF, this, true);
   }
 
   nsCOMPtr<nsIObserverService> obsService = mozilla::services::GetObserverService();
   if (obsService) {
     obsService->AddObserver(this, "command-line-startup", true);
     obsService->AddObserver(this, "profile-initial-state", true);
   }
 
@@ -215,17 +212,17 @@ nsChromeRegistryChrome::CheckForOSAccess
 
   if (useAccessibilityTheme) {
     /* Set the skin to classic and remove pref observers */
     if (!mSelectedSkin.EqualsLiteral("classic/1.0")) {
       mSelectedSkin.AssignLiteral("classic/1.0");
       RefreshSkins();
     }
 
-    nsCOMPtr<nsIPrefBranch2> prefs (do_GetService(NS_PREFSERVICE_CONTRACTID));
+    nsCOMPtr<nsIPrefBranch> prefs (do_GetService(NS_PREFSERVICE_CONTRACTID));
     if (prefs) {
       prefs->RemoveObserver(SELECTED_SKIN_PREF, this);
     }
   }
 
   return NS_OK;
 }
 
@@ -382,17 +379,17 @@ nsChromeRegistryChrome::Observe(nsISuppo
   else if (!strcmp("command-line-startup", aTopic)) {
     nsCOMPtr<nsICommandLine> cmdLine (do_QueryInterface(aSubject));
     if (cmdLine) {
       nsAutoString uiLocale;
       rv = cmdLine->HandleFlagWithParam(NS_LITERAL_STRING(UILOCALE_CMD_LINE_ARG),
                                         false, uiLocale);
       if (NS_SUCCEEDED(rv) && !uiLocale.IsEmpty()) {
         CopyUTF16toUTF8(uiLocale, mSelectedLocale);
-        nsCOMPtr<nsIPrefBranch2> prefs (do_GetService(NS_PREFSERVICE_CONTRACTID));
+        nsCOMPtr<nsIPrefBranch> prefs (do_GetService(NS_PREFSERVICE_CONTRACTID));
         if (prefs) {
           prefs->RemoveObserver(SELECTED_LOCALE_PREF, this);
         }
       }
     }
   }
   else if (!strcmp("profile-initial-state", aTopic)) {
     mProfileLoaded = true;
--- a/content/base/public/nsContentUtils.h
+++ b/content/base/public/nsContentUtils.h
@@ -945,16 +945,36 @@ public:
    *                       see nsIDOMEventTarget::DispatchEvent.
    */
   static nsresult DispatchTrustedEvent(nsIDocument* aDoc,
                                        nsISupports* aTarget,
                                        const nsAString& aEventName,
                                        bool aCanBubble,
                                        bool aCancelable,
                                        bool *aDefaultAction = nsnull);
+                                       
+  /**
+   * This method creates and dispatches a untrusted event.
+   * Works only with events which can be created by calling
+   * nsIDOMDocument::CreateEvent() with parameter "Events".
+   * @param aDoc           The document which will be used to create the event.
+   * @param aTarget        The target of the event, should be QIable to
+   *                       nsIDOMEventTarget.
+   * @param aEventName     The name of the event.
+   * @param aCanBubble     Whether the event can bubble.
+   * @param aCancelable    Is the event cancelable.
+   * @param aDefaultAction Set to true if default action should be taken,
+   *                       see nsIDOMEventTarget::DispatchEvent.
+   */
+  static nsresult DispatchUntrustedEvent(nsIDocument* aDoc,
+                                         nsISupports* aTarget,
+                                         const nsAString& aEventName,
+                                         bool aCanBubble,
+                                         bool aCancelable,
+                                         bool *aDefaultAction = nsnull);
 
   /**
    * This method creates and dispatches a trusted event to the chrome
    * event handler.
    * Works only with events which can be created by calling
    * nsIDOMDocument::CreateEvent() with parameter "Events".
    * @param aDocument      The document which will be used to create the event,
    *                       and whose window's chrome handler will be used to
@@ -1940,16 +1960,24 @@ private:
   static bool CanCallerAccess(nsIPrincipal* aSubjectPrincipal,
                                 nsIPrincipal* aPrincipal);
 
   static nsresult WrapNative(JSContext *cx, JSObject *scope,
                              nsISupports *native, nsWrapperCache *cache,
                              const nsIID* aIID, jsval *vp,
                              nsIXPConnectJSObjectHolder** aHolder,
                              bool aAllowWrapping);
+                            
+  static nsresult DispatchEvent(nsIDocument* aDoc,
+                                nsISupports* aTarget,
+                                const nsAString& aEventName,
+                                bool aCanBubble,
+                                bool aCancelable,
+                                bool aTrusted,
+                                bool *aDefaultAction = nsnull);
 
   static void InitializeModifierStrings();
 
   static void DropFragmentParsers();
 
   static nsIDOMScriptObjectFactory *sDOMScriptObjectFactory;
 
   static nsIXPConnect *sXPConnect;
--- a/content/base/src/CSPUtils.jsm
+++ b/content/base/src/CSPUtils.jsm
@@ -59,17 +59,16 @@ var gPrefObserver = {
       this._initialize();
     return this._debugEnabled;
   },
 
   _initialize: function() {
     var prefSvc = Components.classes["@mozilla.org/preferences-service;1"]
                     .getService(Components.interfaces.nsIPrefService);
     this._branch = prefSvc.getBranch("security.csp.");
-    this._branch.QueryInterface(Components.interfaces.nsIPrefBranch2);
     this._branch.addObserver("", this, false);
     this._debugEnabled = this._branch.getBoolPref("debug");
   },
 
   unregister: function() {
     if(!this._branch) return;
     this._branch.removeObserver("", this);
   },
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -3067,17 +3067,17 @@ nsContentUtils::GetEventIdAndAtom(const 
   sStringEventTable->Put(aName, mapping);
   return mapping.mAtom;
 }
 
 static
 nsresult GetEventAndTarget(nsIDocument* aDoc, nsISupports* aTarget,
                            const nsAString& aEventName,
                            bool aCanBubble, bool aCancelable,
-                           nsIDOMEvent** aEvent,
+                           bool aTrusted, nsIDOMEvent** aEvent,
                            nsIDOMEventTarget** aTargetOut)
 {
   nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(aDoc);
   nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(aTarget));
   NS_ENSURE_TRUE(domDoc && target, NS_ERROR_INVALID_ARG);
 
   nsCOMPtr<nsIDOMEvent> event;
   nsresult rv =
@@ -3085,17 +3085,17 @@ nsresult GetEventAndTarget(nsIDocument* 
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(event));
   NS_ENSURE_TRUE(privateEvent, NS_ERROR_FAILURE);
 
   rv = event->InitEvent(aEventName, aCanBubble, aCancelable);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = privateEvent->SetTrusted(true);
+  rv = privateEvent->SetTrusted(aTrusted);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = privateEvent->SetTarget(target);
   NS_ENSURE_SUCCESS(rv, rv);
 
   event.forget(aEvent);
   target.forget(aTargetOut);
   return NS_OK;
@@ -3103,20 +3103,42 @@ nsresult GetEventAndTarget(nsIDocument* 
 
 // static
 nsresult
 nsContentUtils::DispatchTrustedEvent(nsIDocument* aDoc, nsISupports* aTarget,
                                      const nsAString& aEventName,
                                      bool aCanBubble, bool aCancelable,
                                      bool *aDefaultAction)
 {
+  return DispatchEvent(aDoc, aTarget, aEventName, aCanBubble, aCancelable,
+                       true, aDefaultAction);
+}
+
+// static
+nsresult
+nsContentUtils::DispatchUntrustedEvent(nsIDocument* aDoc, nsISupports* aTarget,
+                                       const nsAString& aEventName,
+                                       bool aCanBubble, bool aCancelable,
+                                       bool *aDefaultAction)
+{
+  return DispatchEvent(aDoc, aTarget, aEventName, aCanBubble, aCancelable,
+                       false, aDefaultAction);
+}
+
+// static
+nsresult
+nsContentUtils::DispatchEvent(nsIDocument* aDoc, nsISupports* aTarget,
+                              const nsAString& aEventName,
+                              bool aCanBubble, bool aCancelable,
+                              bool aTrusted, bool *aDefaultAction)
+{
   nsCOMPtr<nsIDOMEvent> event;
   nsCOMPtr<nsIDOMEventTarget> target;
   nsresult rv = GetEventAndTarget(aDoc, aTarget, aEventName, aCanBubble,
-                                  aCancelable, getter_AddRefs(event),
+                                  aCancelable, aTrusted, getter_AddRefs(event),
                                   getter_AddRefs(target));
   NS_ENSURE_SUCCESS(rv, rv);
 
   bool dummy;
   return target->DispatchEvent(event, aDefaultAction ? aDefaultAction : &dummy);
 }
 
 nsresult
@@ -3125,17 +3147,17 @@ nsContentUtils::DispatchChromeEvent(nsID
                                     const nsAString& aEventName,
                                     bool aCanBubble, bool aCancelable,
                                     bool *aDefaultAction)
 {
 
   nsCOMPtr<nsIDOMEvent> event;
   nsCOMPtr<nsIDOMEventTarget> target;
   nsresult rv = GetEventAndTarget(aDoc, aTarget, aEventName, aCanBubble,
-                                  aCancelable, getter_AddRefs(event),
+                                  aCancelable, true, getter_AddRefs(event),
                                   getter_AddRefs(target));
   NS_ENSURE_SUCCESS(rv, rv);
 
   NS_ASSERTION(aDoc, "GetEventAndTarget lied?");
   if (!aDoc->GetWindow())
     return NS_ERROR_INVALID_ARG;
 
   nsIDOMEventTarget* piTarget = aDoc->GetWindow()->GetChromeEventHandler();
--- a/content/base/src/nsCopySupport.cpp
+++ b/content/base/src/nsCopySupport.cpp
@@ -76,16 +76,20 @@
 // image copy stuff
 #include "nsIImageLoadingContent.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsContentUtils.h"
 #include "nsContentCID.h"
 
 #include "mozilla/dom/Element.h"
 
+#include "mozilla/Preferences.h"
+
+using namespace mozilla;
+
 nsresult NS_NewDomSelection(nsISelection **aDomSelection);
 
 static NS_DEFINE_CID(kCClipboardCID,           NS_CLIPBOARD_CID);
 static NS_DEFINE_CID(kCTransferableCID,        NS_TRANSFERABLE_CID);
 static NS_DEFINE_CID(kHTMLConverterCID,        NS_HTMLFORMATCONVERTER_CID);
 
 // private clipboard data flavors for html copy, used by editor when pasting
 #define kHTMLContext   "text/_moz_htmlcontext"
@@ -722,24 +726,26 @@ nsCopySupport::FireClipboardEvent(PRInt3
       return false;
   }
 
   // It seems to be unsafe to fire an event handler during reflow (bug 393696)
   if (!nsContentUtils::IsSafeToRunScript())
     return false;
 
   // next, fire the cut or copy event
-  nsEventStatus status = nsEventStatus_eIgnore;
-  nsEvent evt(true, aType);
-  nsEventDispatcher::Dispatch(content, presShell->GetPresContext(), &evt, nsnull,
-                              &status);
-  // if the event was cancelled, don't do the clipboard operation
-  if (status == nsEventStatus_eConsumeNoDefault)
-    return false;
-
+  if (Preferences::GetBool("dom.event.clipboardevents.enabled", true)) {
+    nsEventStatus status = nsEventStatus_eIgnore;
+    nsEvent evt(true, aType);
+    nsEventDispatcher::Dispatch(content, presShell->GetPresContext(), &evt, nsnull,
+                                &status);
+    // if the event was cancelled, don't do the clipboard operation
+    if (status == nsEventStatus_eConsumeNoDefault)
+      return false;
+  }
+  
   if (presShell->IsDestroying())
     return false;
 
   // No need to do anything special during a paste. Either an event listener
   // took care of it and cancelled the event, or the caller will handle it.
   // Return true to indicate the event wasn't cancelled.
   if (aType == NS_PASTE)
     return true;
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -1719,17 +1719,17 @@ NS_INTERFACE_TABLE_HEAD(nsDocument)
 NS_INTERFACE_MAP_END
 
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDocument)
 NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_DESTROY(nsDocument, 
                                               nsNodeUtils::LastRelease(this))
 
 NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsDocument)
-  return nsGenericElement::CanSkip(tmp);
+  return nsGenericElement::CanSkip(tmp, aRemovingAllowed);
 NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
 
 NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsDocument)
   return nsGenericElement::CanSkipInCC(tmp);
 NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END
 
 NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(nsDocument)
   return nsGenericElement::CanSkipThis(tmp);
--- a/content/base/src/nsGenericDOMDataNode.cpp
+++ b/content/base/src/nsGenericDOMDataNode.cpp
@@ -93,17 +93,17 @@ nsGenericDOMDataNode::~nsGenericDOMDataN
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsGenericDOMDataNode)
 
 NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsGenericDOMDataNode)
   nsINode::Trace(tmp, aCallback, aClosure);
 NS_IMPL_CYCLE_COLLECTION_TRACE_END
 
 NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsGenericDOMDataNode)
-  return nsGenericElement::CanSkip(tmp);
+  return nsGenericElement::CanSkip(tmp, aRemovingAllowed);
 NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
 
 NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsGenericDOMDataNode)
   return nsGenericElement::CanSkipInCC(tmp);
 NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END
 
 NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(nsGenericDOMDataNode)
   return nsGenericElement::CanSkipThis(tmp);
@@ -747,16 +747,19 @@ nsGenericDOMDataNode::SplitData(PRUint32
 
   PRUint32 cutStartOffset = aCloneAfterOriginal ? aOffset : 0;
   PRUint32 cutLength = aCloneAfterOriginal ? length - aOffset : aOffset;
   rv = SubstringData(cutStartOffset, cutLength, cutText);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
+  nsIDocument* document = GetCurrentDoc();
+  mozAutoDocUpdate updateBatch(document, UPDATE_CONTENT_MODEL, true);
+
   // Use Clone for creating the new node so that the new node is of same class
   // as this node!
   nsCOMPtr<nsIContent> newContent = CloneDataNode(mNodeInfo, false);
   if (!newContent) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
   newContent->SetText(cutText, true); // XXX should be false?
 
--- a/content/base/src/nsGenericElement.cpp
+++ b/content/base/src/nsGenericElement.cpp
@@ -4629,17 +4629,17 @@ NodeHasActiveFrame(nsIDocument* aCurrent
 
 // CanSkip checks if aNode is black, and if it is, returns
 // true. If aNode is in a black DOM tree, CanSkip may also remove other objects
 // from purple buffer and unmark event listeners and user data.
 // If the root of the DOM tree is a document, less optimizations are done
 // since checking the blackness of the current document is usually fast and we
 // don't want slow down such common cases.
 bool
-nsGenericElement::CanSkip(nsINode* aNode)
+nsGenericElement::CanSkip(nsINode* aNode, bool aRemovingAllowed)
 {
   // Don't try to optimize anything during shutdown.
   if (nsCCUncollectableMarker::sGeneration == 0) {
     return false;
   }
 
   bool unoptimizable = UnoptimizableCCNode(aNode);
   nsIDocument* currentDoc = aNode->GetCurrentDoc();
@@ -4688,17 +4688,17 @@ nsGenericElement::CanSkip(nsINode* aNode
       if (currentDoc) {
         // If we can mark the whole document black, no need to optimize
         // so much, since when the next purple node in the document will be
         // handled, it is fast to check that the currentDoc is in CCGeneration.
         break;
       }
       // No need to put stuff to the nodesToClear array, if we can clear it
       // already here.
-      if (node->IsPurple() && node != aNode) {
+      if (node->IsPurple() && (node != aNode || aRemovingAllowed)) {
         node->RemovePurple();
       }
       MarkNodeChildren(node);
     } else if (ShouldClearPurple(node)) {
       // Collect interesting nodes which we can clear if we find that
       // they are kept alive in a black tree.
       nodesToClear.AppendElement(node);
     }
@@ -4724,18 +4724,19 @@ nsGenericElement::CanSkip(nsINode* aNode
     MarkNodeChildren(currentDoc);
   }
 
   // Subtree is black, so we can remove purple nodes from
   // purple buffer and mark stuff that to be certainly alive.
   for (PRUint32 i = 0; i < nodesToClear.Length(); ++i) {
     nsIContent* n = nodesToClear[i];
     MarkNodeChildren(n);
-    // Can't remove currently handled purple node.
-    if (n != aNode && n->IsPurple()) {
+    // Can't remove currently handled purple node,
+    // unless aRemovingAllowed is true. 
+    if ((n != aNode || aRemovingAllowed) && n->IsPurple()) {
       n->RemovePurple();
     }
   }
   return true;
 }
 
 bool
 nsGenericElement::CanSkipThis(nsINode* aNode)
@@ -4755,17 +4756,17 @@ nsGenericElement::CanSkipThis(nsINode* a
 void
 nsGenericElement::InitCCCallbacks()
 {
   nsCycleCollector_setForgetSkippableCallback(ClearPurpleRoots);
   nsCycleCollector_setBeforeUnlinkCallback(ClearBlackMarkedNodes);
 }
 
 NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsGenericElement)
-  return nsGenericElement::CanSkip(tmp);
+  return nsGenericElement::CanSkip(tmp, aRemovingAllowed);
 NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
 
 NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsGenericElement)
   return nsGenericElement::CanSkipInCC(tmp);
 NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END
 
 NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(nsGenericElement)
   return nsGenericElement::CanSkipThis(tmp);
--- a/content/base/src/nsGenericElement.h
+++ b/content/base/src/nsGenericElement.h
@@ -618,17 +618,17 @@ public:
     return mRefCnt.IsPurple();
   }
 
   virtual void RemovePurple()
   {
     mRefCnt.RemovePurple();
   }
 
-  static bool CanSkip(nsINode* aNode);
+  static bool CanSkip(nsINode* aNode, bool aRemovingAllowed);
   static bool CanSkipInCC(nsINode* aNode);
   static bool CanSkipThis(nsINode* aNode);
   static void MarkNodeChildren(nsINode* aNode);
   static void InitCCCallbacks();
   static void MarkUserData(void* aObject, nsIAtom* aKey, void* aChild,
                            void *aData);
   static void MarkUserDataHandler(void* aObject, nsIAtom* aKey, void* aChild,
                                   void* aData);
--- a/content/base/src/nsObjectLoadingContent.cpp
+++ b/content/base/src/nsObjectLoadingContent.cpp
@@ -1939,24 +1939,27 @@ nsObjectLoadingContent::PluginCrashed(ns
 }
 
 NS_IMETHODIMP
 nsObjectLoadingContent::SyncStartPluginInstance()
 {
   NS_ASSERTION(nsContentUtils::IsSafeToRunScript(),
                "Must be able to run script in order to instantiate a plugin instance!");
 
-  // Don't even attempt to start an instance unless the content is in the document.
-  nsCOMPtr<nsIContent> thisContent = do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
+  // Don't even attempt to start an instance unless the content is in
+  // the document.
+  nsCOMPtr<nsIContent> thisContent =
+    do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
   if (!thisContent->IsInDoc()) {
     return NS_ERROR_FAILURE;
   }
 
   nsCOMPtr<nsIURI> kungFuURIGrip(mURI);
-  return InstantiatePluginInstance(mContentType.get(), mURI.get());
+  nsCString contentType(mContentType);
+  return InstantiatePluginInstance(contentType.get(), mURI.get());
 }
 
 NS_IMETHODIMP
 nsObjectLoadingContent::AsyncStartPluginInstance()
 {
   // OK to have an instance already.
   if (mInstanceOwner) {
     return NS_OK;
--- a/content/base/test/Makefile.in
+++ b/content/base/test/Makefile.in
@@ -549,16 +549,17 @@ include $(topsrcdir)/config/rules.mk
 		test_XHR_timeout.html \
 		test_XHR_timeout.js \
 		file_XHR_timeout.sjs \
 		test_bug717511.html \
 		file_bug717511.html \
 		file_bug717511.html^headers^ \
 		file_bug717511_2.html \
 		file_bug717511_2.html^headers^ \
+		test_bug726364.html \
 		$(NULL)
 
 _CHROME_FILES =	\
 		test_bug357450.js \
 		$(NULL)
 
 # This test fails on the Mac for some reason
 ifneq (,$(filter gtk2 windows,$(MOZ_WIDGET_TOOLKIT)))
new file mode 100644
--- /dev/null
+++ b/content/base/test/test_bug726364.html
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=726364
+-->
+<head>
+  <meta charset="utf-8">
+  <title>Test for Bug 726364</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=726364">Mozilla Bug 726364</a>
+<p id="display"><div id="v">ABC</div></p>
+<div id="content" style="display: none">
+  
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 726364 **/
+function boom()
+{
+  var v = document.getElementById("v");
+  var t = v.firstChild;
+  is(v.childNodes.length,1, "child count");
+
+  var f = function(event) {
+    window.removeEventListener("DOMCharacterDataModified", f, true);
+    is(v.childNodes[0],t, "first child is the same");
+    is(v.childNodes.length,2, "child count");
+    r.setEnd(v, 0);
+    SimpleTest.finish();
+  };
+  window.addEventListener("DOMCharacterDataModified", f, true);
+
+  var r = document.createRange();
+  r.setStart(t, 2);
+  t.splitText(1);
+}
+
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(boom);
+
+</script>
+</pre>
+</body>
+</html>
--- a/content/base/test/test_websocket.html
+++ b/content/base/test/test_websocket.html
@@ -69,18 +69,31 @@
  * 44. Test sending/receving binary ArrayBuffer 
  * 45. Test sending/receving binary Blob 
  * 46. Test that we don't dispatch incoming msgs once in CLOSING state
  */
 
 var first_test = 1;
 var last_test = 46;
 
+
+// Set this to >1 if you want to run the suite multiple times to probe for
+// random orange failures. 
+// - Do NOT check into mozilla-central with a value != 1.
+// - Too large a count will wind up causing tryserver to timeout the test (which
+//   is ok, but means all testruns will be orange).  If I set first_test to >22
+//   (i.e don't run any of the tests that require waiting) I can get ~250-300
+//   iterations of the remaining tests w/o a timeout.
+var testsuite_iterations = 1;   
+
+
 var current_test = first_test;
+var testsuite_iteration = 1;
 
+var test_started = new Array(last_test);
 var all_ws = [];
 
 function shouldNotOpen(e)
 {
   var ws = e.target;
   ok(false, "onopen shouldn't be called on test " + ws._testNumber + "!");
 }
 
@@ -171,26 +184,31 @@ function forcegc()
 function doTest(number)
 {
   if (number > last_test) {
     ranAllTests = true;
     maybeFinished();
     return;
   }
 
-  $("feedback").innerHTML = "executing test: " + number + " of " + last_test + " tests.";
+  if (testsuite_iteration > 1) {
+    $("feedback").innerHTML = "test suite iteration #" + testsuite_iteration + " of " + testsuite_iterations + 
+      ": executing test: " + number + " of " + last_test + " tests.";
+  } else {
+    $("feedback").innerHTML = "executing test: " + number + " of " + last_test + " tests.";
+  }
 
   var fnTest = eval("test" + number + "");
 
-  if (fnTest._started === true) {
+  if (test_started[number] === true) {
     doTest(number + 1);
     return;
   }
 
-  fnTest._started = true;
+  test_started[number] = true;
   fnTest();
 }
 doTest.timeoutId = null;
 
 function test1()
 {
   try {
     var ws = CreateTestWS("http://mochi.test:8888/tests/content/base/test/file_websocket");
@@ -556,17 +574,17 @@ function test16()
     doTest(17);
   }
 }
 
 var status_test17 = "not started";
 
 var waitTest17 = false;
 
-window._test17 = function()
+var test17func = function()
 {
   waitTest17 = true;
 
   var local_ws = new WebSocket("ws://sub1.test2.example.org/tests/content/base/test/file_websocket", "test-17");
   local_ws._testNumber = "local17";
   local_ws._testNumber = current_test++;
 
   status_test17 = "started";
@@ -606,16 +624,17 @@ window._test17 = function()
 
 // do this in the background
   doTest(18);
   forcegc();
 }
 
 function test17()
 {
+  window._test17 = test17func;
   window._test17();
 }
 
 // The tests that expects that their websockets neither open nor close MUST
 // be in the end of the tests, i.e. HERE, in order to prevent blocking the other
 // tests.
 
 function test18()
@@ -639,17 +658,17 @@ function test19()
   {
     shouldCloseNotCleanly(e);
     doTest(20);
   };
 }
 
 var waitTest20 = false;
 
-window._test20 = function()
+var test20func = function()
 {
   waitTest20 = true;
 
   var local_ws = new WebSocket("ws://sub1.test1.example.org/tests/content/base/test/file_websocket", "test-20");
   local_ws._testNumber = "local20";
   local_ws._testNumber = current_test++;
 
   local_ws.onerror = function()
@@ -669,22 +688,23 @@ window._test20 = function()
   forcegc();
 
   // let test run in the background
   doTest(21);
 }
 
 function test20()
 {
+  window._test20 = test20func;
   window._test20();
 }
 
 var waitTest21 = false;
 
-window._test21 = function()
+test21func = function()
 {
   waitTest21 = true;
 
   var local_ws = new WebSocket("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test-21");
   local_ws._testNumber = current_test++;
   var received_message = false;
 
   local_ws.onopen = function(e)
@@ -722,16 +742,17 @@ window._test21 = function()
   forcegc();
 
   doTest(22);
 
 }
 
 function test21()
 {
+  window._test21 = test21func;
   window._test21();
 }
 
 var waitTest22 = false;
 
 function test22()
 {
   waitTest22 = true;
@@ -1417,17 +1438,25 @@ function maybeFinished()
 
   for (i = 0; i < all_ws.length; ++i) {
     if (all_ws[i] != shouldNotReceiveCloseEvent &&
         !all_ws[i]._receivedCloseEvent) {
       ok(false, "didn't called close on test " + all_ws[i]._testNumber + "!");
     }
   }
 
-  SimpleTest.finish();
+  if (testsuite_iteration++ < testsuite_iterations) {
+    // play it again, Sam...
+    ok(1, "starting testsuite iteration " + testsuite_iteration);
+    test_started = new Array(last_test);
+    doTest(current_test = first_test);
+  } else {
+    // all done
+    SimpleTest.finish();
+  }
 }
 
 function testWebSocket ()
 {
   doTest(first_test);
 }
 
 SimpleTest.waitForExplicitFinish();
--- a/content/events/test/test_bug350471.xul
+++ b/content/events/test/test_bug350471.xul
@@ -217,28 +217,28 @@ function testDefaultHandling(aWin, andTh
   
   exec();
 }
 
 function initPrefs()
 {
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
   var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
-                  getService(Components.interfaces.nsIPrefBranch2);
+                  getService(Components.interfaces.nsIPrefBranch);
   // Disables the app level scroll acceleration
   prefSvc.setIntPref("mousewheel.acceleration.start", -1);
   prefSvc.setBoolPref("mousewheel.system_scroll_override_on_root_content.enabled", false);
   prefSvc.setBoolPref("general.smoothScroll", false);
 }
 
 function clearPrefs()
 {
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
   var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
-                  getService(Components.interfaces.nsIPrefBranch2);
+                  getService(Components.interfaces.nsIPrefBranch);
 
   prefSvc.clearUserPref("mousewheel.acceleration.start");
   prefSvc.clearUserPref("mousewheel.system_scroll_override_on_root_content.enabled");
   prefSvc.clearUserPref("general.smoothScroll");
 }
 
 window.onload = function () {
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
--- a/content/events/test/test_bug607464.html
+++ b/content/events/test/test_bug607464.html
@@ -65,30 +65,30 @@ function runTest() {
     }, 0);
   }, win);
 }
 
 function initPrefs()
 {
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
   var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
-                  getService(Components.interfaces.nsIPrefBranch2);
+                  getService(Components.interfaces.nsIPrefBranch);
   // Disables the app level scroll acceleration
   prefSvc.setIntPref("mousewheel.acceleration.start", -1);
   prefSvc.setBoolPref("mousewheel.system_scroll_override_on_root_content.enabled", false);
 
   // Enables smooth scrolling
   prefSvc.setBoolPref("general.smoothScroll", true);
 }
 
 function clearPrefs()
 {
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
   var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
-                  getService(Components.interfaces.nsIPrefBranch2);
+                  getService(Components.interfaces.nsIPrefBranch);
 
   if (prefSvc.prefHasUserValue("mousewheel.acceleration.start"))
     prefSvc.clearUserPref("mousewheel.acceleration.start");
   if (prefSvc.prefHasUserValue("mousewheel.system_scroll_override_on_root_content.enabled"))
     prefSvc.clearUserPref("mousewheel.system_scroll_override_on_root_content.enabled");
   if (prefSvc.prefHasUserValue("general.smoothScroll"))
     prefSvc.clearUserPref("general.smoothScroll");
 }
--- a/content/events/test/test_clickevent_on_input.html
+++ b/content/events/test/test_clickevent_on_input.html
@@ -40,17 +40,17 @@ function runTests()
   SimpleTest.finish();
 }
 
 function isEnabledMiddleClickPaste()
 {
   netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
 
   var prefs = Components.classes["@mozilla.org/preferences-service;1"].
-                         getService(Components.interfaces.nsIPrefBranch2);
+                         getService(Components.interfaces.nsIPrefBranch);
   try {
     return prefs.getBoolPref("middlemouse.paste");
   } catch (e) {
     return false;
   }
 }
 
 function doTest(aButton)
--- a/content/html/content/src/nsHTMLLegendElement.cpp
+++ b/content/html/content/src/nsHTMLLegendElement.cpp
@@ -183,17 +183,18 @@ nsHTMLLegendElement::Focus()
 
   // If the legend isn't focusable, focus whatever is focusable following
   // the legend instead, bug 81481.
   nsIFocusManager* fm = nsFocusManager::GetFocusManager();
   if (!fm)
     return NS_OK;
 
   nsCOMPtr<nsIDOMElement> result;
-  return fm->MoveFocus(nsnull, this, nsIFocusManager::MOVEFOCUS_FORWARD, 0,
+  return fm->MoveFocus(nsnull, this, nsIFocusManager::MOVEFOCUS_FORWARD,
+                       nsIFocusManager::FLAG_NOPARENTFRAME,
                        getter_AddRefs(result));
 }
 
 void
 nsHTMLLegendElement::PerformAccesskey(bool aKeyCausesActivation,
                                       bool aIsTrustedEvent)
 {
   // just use the same behaviour as the focus method
--- a/content/smil/nsSMILAnimationFunction.cpp
+++ b/content/smil/nsSMILAnimationFunction.cpp
@@ -750,17 +750,17 @@ nsSMILAnimationFunction::GetAttr(nsIAtom
 bool
 nsSMILAnimationFunction::ParseAttr(nsIAtom* aAttName,
                                    const nsISMILAttr& aSMILAttr,
                                    nsSMILValue& aResult,
                                    bool& aPreventCachingOfSandwich) const
 {
   nsAutoString attValue;
   if (GetAttr(aAttName, attValue)) {
-    bool preventCachingOfSandwich;
+    bool preventCachingOfSandwich = false;
     nsresult rv = aSMILAttr.ValueFromString(attValue, mAnimationElement,
                                             aResult, preventCachingOfSandwich);
     if (NS_FAILED(rv))
       return false;
 
     if (preventCachingOfSandwich) {
       aPreventCachingOfSandwich = true;
     }
@@ -791,17 +791,17 @@ nsSMILAnimationFunction::GetValues(const
 
   mValueNeedsReparsingEverySample = false;
   nsSMILValueArray result;
 
   // If "values" is set, use it
   if (HasAttr(nsGkAtoms::values)) {
     nsAutoString attValue;
     GetAttr(nsGkAtoms::values, attValue);
-    bool preventCachingOfSandwich;
+    bool preventCachingOfSandwich = false;
     nsresult rv = nsSMILParserUtils::ParseValues(attValue, mAnimationElement,
                                                  aSMILAttr, result,
                                                  preventCachingOfSandwich);
     if (NS_FAILED(rv))
       return rv;
 
     if (preventCachingOfSandwich) {
       mValueNeedsReparsingEverySample = true;
--- a/content/smil/nsSMILCSSProperty.cpp
+++ b/content/smil/nsSMILCSSProperty.cpp
@@ -164,24 +164,27 @@ nsSMILCSSProperty::ValueFromString(const
                                    nsSMILValue& aValue,
                                    bool& aPreventCachingOfSandwich) const
 {
   NS_ENSURE_TRUE(IsPropertyAnimatable(mPropID), NS_ERROR_FAILURE);
 
   nsSMILCSSValueType::ValueFromString(mPropID, mElement, aStr, aValue,
       &aPreventCachingOfSandwich);
 
+  if (aValue.IsNull()) {
+    return NS_ERROR_FAILURE;
+  }
+
   // XXX Due to bug 536660 (or at least that seems to be the most likely
   // culprit), when we have animation setting display:none on a <use> element,
   // if we DON'T set the property every sample, chaos ensues.
   if (!aPreventCachingOfSandwich && mPropID == eCSSProperty_display) {
     aPreventCachingOfSandwich = true;
   }
-
-  return aValue.IsNull() ? NS_ERROR_FAILURE : NS_OK;
+  return NS_OK;
 }
 
 nsresult
 nsSMILCSSProperty::SetAnimValue(const nsSMILValue& aValue)
 {
   NS_ENSURE_TRUE(IsPropertyAnimatable(mPropID), NS_ERROR_FAILURE);
 
   // Convert nsSMILValue to string
--- a/content/smil/nsSMILParserUtils.cpp
+++ b/content/smil/nsSMILParserUtils.cpp
@@ -559,17 +559,17 @@ public:
     mSrcElement(aSrcElement),
     mSMILAttr(aSMILAttr),
     mValuesArray(aValuesArray),
     mPreventCachingOfSandwich(aPreventCachingOfSandwich)
   {}
 
   virtual nsresult Parse(const nsAString& aValueStr) {
     nsSMILValue newValue;
-    bool tmpPreventCachingOfSandwich;
+    bool tmpPreventCachingOfSandwich = false;
     nsresult rv = mSMILAttr->ValueFromString(aValueStr, mSrcElement, newValue,
                                              tmpPreventCachingOfSandwich);
     if (NS_FAILED(rv))
       return rv;
 
     if (!mValuesArray->AppendElement(newValue)) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
--- a/content/svg/content/src/nsSVGFilters.cpp
+++ b/content/svg/content/src/nsSVGFilters.cpp
@@ -4952,16 +4952,25 @@ GenerateNormal(float *N, const PRUint8 *
     { { 2.0 / 3.0, 1.0 / 3.0, 2.0 / 3.0 },
       { 1.0 / 2.0, 1.0 / 4.0, 1.0 / 2.0 },
       { 2.0 / 3.0, 1.0 / 3.0, 2.0 / 3.0 } };
   static const float FACTORy[3][3] =
     { { 2.0 / 3.0, 1.0 / 2.0, 2.0 / 3.0 },
       { 1.0 / 3.0, 1.0 / 4.0, 1.0 / 3.0 },
       { 2.0 / 3.0, 1.0 / 2.0, 2.0 / 3.0 } };
 
+  // degenerate cases
+  if (surfaceWidth == 1 || surfaceHeight == 1) {
+    // just return a unit vector pointing towards the viewer
+    N[0] = 0;
+    N[1] = 0;
+    N[2] = 255;
+    return;
+  }
+
   PRInt8 xflag, yflag;
   if (x == 0) {
     xflag = 0;
   } else if (x == surfaceWidth - 1) {
     xflag = 2;
   } else {
     xflag = 1;
   }
--- a/content/xbl/src/nsXBLProtoImplMethod.cpp
+++ b/content/xbl/src/nsXBLProtoImplMethod.cpp
@@ -284,23 +284,27 @@ nsXBLProtoImplMethod::Read(nsIScriptCont
 
   return NS_OK;
 }
 
 nsresult
 nsXBLProtoImplMethod::Write(nsIScriptContext* aContext,
                             nsIObjectOutputStream* aStream)
 {
-  nsresult rv = aStream->Write8(XBLBinding_Serialize_Method);
-  NS_ENSURE_SUCCESS(rv, rv);
+  if (mJSMethodObject) {
+    nsresult rv = aStream->Write8(XBLBinding_Serialize_Method);
+    NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = aStream->WriteWStringZ(mName);
-  NS_ENSURE_SUCCESS(rv, rv);
+    rv = aStream->WriteWStringZ(mName);
+    NS_ENSURE_SUCCESS(rv, rv);
 
-  return XBL_SerializeFunction(aContext, aStream, mJSMethodObject);
+    return XBL_SerializeFunction(aContext, aStream, mJSMethodObject);
+  }
+
+  return NS_OK;
 }
 
 nsresult
 nsXBLProtoImplAnonymousMethod::Execute(nsIContent* aBoundElement)
 {
   NS_PRECONDITION(IsCompiled(), "Can't execute uncompiled method");
   
   if (!mJSMethodObject) {
--- a/content/xbl/src/nsXBLPrototypeHandler.cpp
+++ b/content/xbl/src/nsXBLPrototypeHandler.cpp
@@ -1069,17 +1069,17 @@ nsXBLPrototypeHandler::Read(nsIScriptCon
   return NS_OK;
 }
 
 nsresult
 nsXBLPrototypeHandler::Write(nsIScriptContext* aContext, nsIObjectOutputStream* aStream)
 {
   // Make sure we don't write out NS_HANDLER_TYPE_XUL types, as they are used
   // for <keyset> elements.
-  if (mType & NS_HANDLER_TYPE_XUL)
+  if ((mType & NS_HANDLER_TYPE_XUL) || !mEventName)
     return NS_OK;
 
   XBLBindingSerializeDetails type = XBLBinding_Serialize_Handler;
 
   nsresult rv = aStream->Write8(type);
   rv = aStream->Write8(mPhase);
   NS_ENSURE_SUCCESS(rv, rv);
   rv = aStream->Write8(mKeyMask);
--- a/content/xbl/test/Makefile.in
+++ b/content/xbl/test/Makefile.in
@@ -74,16 +74,18 @@ include $(topsrcdir)/config/rules.mk
 		test_bug639338.xhtml \
 		$(NULL)
 
 _CHROME_FILES = \
 		test_bug296375.xul \
 		test_bug378518.xul \
 		test_bug398135.xul \
 		test_bug398492.xul \
+		test_bug721452.xul \
+		test_bug723676.xul \
 		$(NULL)
 
 libs:: $(_TEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
 
 libs:: $(_CHROME_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
 
new file mode 100644
--- /dev/null
+++ b/content/xbl/test/test_bug721452.xul
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>      
+
+<script>
+ok(true, "Handler with empty action didn't crash")
+</script>
+
+<body xmlns="http://www.w3.org/1999/xhtml"/>
+
+<box style="-moz-binding: url(#binding)"/>
+
+<xbl:bindings xmlns:xbl="http://www.mozilla.org/xbl">
+  <xbl:binding id="binding">
+    <xbl:content/>
+    <xbl:handlers>
+      <xbl:handler nt="action" action=""/>
+    </xbl:handlers>
+  </xbl:binding>
+</xbl:bindings>
+
+</window>
new file mode 100644
--- /dev/null
+++ b/content/xbl/test/test_bug723676.xul
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>      
+
+<script>
+ok(true, "Method with empty body didn't crash");
+</script>
+
+<body xmlns="http://www.w3.org/1999/xhtml"/>
+
+<box style="-moz-binding: url(#binding)"/>
+
+<xbl:bindings xmlns:xbl="http://www.mozilla.org/xbl">
+  <xbl:binding id="binding">
+    <xbl:implementation>
+      <xbl:method name="init"/>
+    </xbl:implementation>
+  </xbl:binding>
+</xbl:bindings>
+
+
+</window>
--- a/docshell/base/nsDSURIContentListener.cpp
+++ b/docshell/base/nsDSURIContentListener.cpp
@@ -62,17 +62,17 @@ nsDSURIContentListener::nsDSURIContentLi
     : mDocShell(aDocShell), 
       mParentContentListener(nsnull)
 {
   static bool initializedPrefCache = false;
 
   // Set up a pref cache for sIgnoreXFrameOptions, if we haven't already.
   if (NS_UNLIKELY(!initializedPrefCache)) {
     // Lock the pref so that the user's changes to it, if any, are ignored.
-    nsIPrefBranch2 *root = Preferences::GetRootBranch();
+    nsIPrefBranch *root = Preferences::GetRootBranch();
     root->LockPref("b2g.ignoreXFrameOptions");
 
     Preferences::AddBoolVarCache(&sIgnoreXFrameOptions, "b2g.ignoreXFrameOptions");
     initializedPrefCache = true;
   }
 }
 
 nsDSURIContentListener::~nsDSURIContentListener()
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -522,18 +522,19 @@ nsFocusManager::MoveFocus(nsIDOMWindow* 
   else {
     window = aWindow ? do_QueryInterface(aWindow) : mFocusedWindow;
     NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
     window = window->GetOuterWindow();
   }
 
   NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
 
+  bool noParentTraversal = aFlags & FLAG_NOPARENTFRAME;
   nsCOMPtr<nsIContent> newFocus;
-  nsresult rv = DetermineElementToMoveFocus(window, startContent, aType,
+  nsresult rv = DetermineElementToMoveFocus(window, startContent, aType, noParentTraversal,
                                             getter_AddRefs(newFocus));
   NS_ENSURE_SUCCESS(rv, rv);
 
 #ifdef DEBUG_FOCUS_NAVIGATION
   PRINTTAGF("-> Element to be focused: %s\n", newFocus);
 #endif
 
   if (newFocus) {
@@ -2327,17 +2328,17 @@ nsFocusManager::GetSelectionLocation(nsI
   NS_IF_ADDREF(*aEndContent);
 
   return rv;
 }
 
 nsresult
 nsFocusManager::DetermineElementToMoveFocus(nsPIDOMWindow* aWindow,
                                             nsIContent* aStartContent,
-                                            PRInt32 aType,
+                                            PRInt32 aType, bool aNoParentTraversal,
                                             nsIContent** aNextContent)
 {
   *aNextContent = nsnull;
 
   nsCOMPtr<nsIDocShell> docShell = aWindow->GetDocShell();
   if (!docShell)
     return NS_OK;
 
@@ -2557,16 +2558,22 @@ nsFocusManager::DetermineElementToMoveFo
         return NS_OK;
       }
     }
 
     doNavigation = true;
     skipOriginalContentCheck = false;
     ignoreTabIndex = false;
 
+    if (aNoParentTraversal) {
+      startContent = rootContent;
+      tabIndex = forward ? 1 : 0;
+      continue;
+    }
+
     // reached the beginning or end of the document. Traverse up to the parent
     // document and try again.
     nsCOMPtr<nsIDocShellTreeItem> dsti = do_QueryInterface(docShell);
 
     nsCOMPtr<nsIDocShellTreeItem> docShellParent;
     dsti->GetParent(getter_AddRefs(docShellParent));
     if (docShellParent) {
       // move up to the parent shell and try again from there.
--- a/dom/base/nsFocusManager.h
+++ b/dom/base/nsFocusManager.h
@@ -342,21 +342,23 @@ protected:
   /**
    * Helper function for MoveFocus which determines the next element
    * to move the focus to and returns it in aNextContent.
    *
    * aWindow is the window to adjust the focus within, and aStart is
    * the element to start navigation from. For tab key navigation,
    * this should be the currently focused element.
    *
-   * aType is the type passed to MoveFocus.
+   * aType is the type passed to MoveFocus. If aNoParentTraversal is set,
+   * navigation is not done to parent documents and iteration returns to the
+   * beginning (or end) of the starting document.
    */
   nsresult DetermineElementToMoveFocus(nsPIDOMWindow* aWindow,
                                        nsIContent* aStart,
-                                       PRInt32 aType,
+                                       PRInt32 aType, bool aNoParentTraversal,
                                        nsIContent** aNextContent);
 
   /**
    * Retrieve the next tabbable element within a document, using focusability
    * and tabindex to determine the tab order. The element is returned in
    * aResultContent.
    *
    * aRootContent is the root node -- nodes above this will not be examined.
--- a/dom/interfaces/base/nsIFocusManager.idl
+++ b/dom/interfaces/base/nsIFocusManager.idl
@@ -186,16 +186,24 @@ interface nsIFocusManager : nsISupports
    * switch focus to that window. Instead, just update the focus within that
    * window and leave the application focus as is. This flag will have no
    * effect if a child window is focused and an attempt is made to adjust the
    * focus in an ancestor, as the frame must be switched in this case.
    */
   const unsigned long FLAG_NOSWITCHFRAME = 4;
 
   /**
+   * This flag is only used when passed to moveFocus. If set, focus is never
+   * moved to the parent frame of the starting element's document, instead
+   * iterating around to the beginning of that document again. Child frames
+   * are navigated as normal.
+   */
+  const unsigned long FLAG_NOPARENTFRAME = 8;
+
+  /**
    * Focus is changing due to a mouse operation, for instance the mouse was
    * clicked on an element.
    */
   const unsigned long FLAG_BYMOUSE = 0x1000;
 
   /**
    * Focus is changing due to a key operation, for instance pressing the tab
    * key. This flag would normally be passed when MOVEFOCUS_FORWARD or
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -45,17 +45,16 @@
 #include "mozilla/ipc/TestShellParent.h"
 #include "mozilla/net/NeckoParent.h"
 #include "mozilla/Preferences.h"
 #include "nsHashPropertyBag.h"
 #include "nsIFilePicker.h"
 #include "nsIWindowWatcher.h"
 #include "nsIDOMWindow.h"
 #include "nsIPrefBranch.h"
-#include "nsIPrefBranch2.h"
 #include "nsIPrefLocalizedString.h"
 #include "nsIObserverService.h"
 #include "nsContentUtils.h"
 #include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
 #include "nsServiceManagerUtils.h"
 #include "nsThreadUtils.h"
 #include "nsChromeRegistryChrome.h"
@@ -213,17 +212,17 @@ ContentParent::Init()
         obs->AddObserver(this, "child-memory-reporter-request", false);
         obs->AddObserver(this, "memory-pressure", false);
         obs->AddObserver(this, "child-gc-request", false);
         obs->AddObserver(this, "child-cc-request", false);
 #ifdef ACCESSIBILITY
         obs->AddObserver(this, "a11y-init-or-shutdown", false);
 #endif
     }
-    nsCOMPtr<nsIPrefBranch2> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
+    nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
     if (prefs) {
         prefs->AddObserver("", this, false);
     }
     nsCOMPtr<nsIThreadInternal>
             threadInt(do_QueryInterface(NS_GetCurrentThread()));
     if (threadInt) {
         threadInt->AddObserver(this);
     }
@@ -326,17 +325,17 @@ ContentParent::ActorDestroy(ActorDestroy
 
     mMessageManager->Disconnect();
 
     // clear the child memory reporters
     InfallibleTArray<MemoryReport> empty;
     SetChildMemoryReporters(empty);
 
     // remove the global remote preferences observers
-    nsCOMPtr<nsIPrefBranch2> prefs 
+    nsCOMPtr<nsIPrefBranch> prefs 
             (do_GetService(NS_PREFSERVICE_CONTRACTID));
     if (prefs) { 
         prefs->RemoveObserver("", this);
     }
 
     RecvRemoveGeolocationListener();
     RecvRemoveDeviceMotionListener();
 
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -75,17 +75,17 @@
 #include "nsISeekableStream.h"
 #include "nsNetUtil.h"
 #include "nsIProgressEventSink.h"
 #include "nsIDocument.h"
 #include "nsICachingChannel.h"
 #include "nsHashtable.h"
 #include "nsIProxyInfo.h"
 #include "nsPluginLogging.h"
-#include "nsIPrefBranch2.h"
+#include "nsIPrefBranch.h"
 #include "nsIScriptChannel.h"
 #include "nsIBlocklistService.h"
 #include "nsVersionComparator.h"
 #include "nsIPrivateBrowsingService.h"
 #include "nsIObjectLoadingContent.h"
 #include "nsIWritablePropertyBag2.h"
 #include "nsPluginStreamListenerPeer.h"
 
--- a/dom/plugins/base/nsPluginTags.cpp
+++ b/dom/plugins/base/nsPluginTags.cpp
@@ -225,16 +225,17 @@ mFlags(0) // Caller will read in our fla
 
 nsPluginTag::~nsPluginTag()
 {
   NS_ASSERTION(!mNext, "Risk of exhausting the stack space, bug 486349");
 }
 
 NS_IMPL_ISUPPORTS1(nsPluginTag, nsIPluginTag)
 
+#if !defined(XP_WIN) && !defined(XP_MACOSX)
 static nsresult ConvertToUTF8(nsIUnicodeDecoder *aUnicodeDecoder,
                               nsAFlatCString& aString)
 {
   PRInt32 numberOfBytes = aString.Length();
   PRInt32 outUnicodeLen;
   nsAutoString buffer;
   nsresult rv = aUnicodeDecoder->GetMaxLength(aString.get(), numberOfBytes,
                                               &outUnicodeLen);
@@ -244,16 +245,17 @@ static nsresult ConvertToUTF8(nsIUnicode
   rv = aUnicodeDecoder->Convert(aString.get(), &numberOfBytes,
                                 buffer.BeginWriting(), &outUnicodeLen);
   NS_ENSURE_SUCCESS(rv, rv);
   buffer.SetLength(outUnicodeLen);
   CopyUTF16toUTF8(buffer, aString);
   
   return NS_OK;
 }
+#endif
 
 nsresult nsPluginTag::EnsureMembersAreUTF8()
 {
 #if defined(XP_WIN) || defined(XP_MACOSX)
   return NS_OK;
 #else
   nsresult rv;
   
@@ -524,15 +526,9 @@ void nsPluginTag::TryUnloadPlugin()
     nsPluginHost::PostPluginUnloadEvent(mLibrary);
   }
   
   // we should zero it anyway, it is going to be unloaded by
   // CleanUnsedLibraries before we need to call the library
   // again so the calling code should not be fooled and reload
   // the library fresh
   mLibrary = nsnull;
-  
-  // Remove mime types added to the category manager
-  // only if we were made 'active' by setting the host
-  if (mPluginHost) {
-    RegisterWithCategoryManager(false, nsPluginTag::ePluginUnregister);
-  }
 }
--- a/dom/plugins/base/nsPluginTags.h
+++ b/dom/plugins/base/nsPluginTags.h
@@ -82,17 +82,17 @@ public:
               const char* aVersion,
               const char* const* aMimeTypes,
               const char* const* aMimeDescriptions,
               const char* const* aExtensions,
               PRInt32 aVariants,
               PRInt64 aLastModifiedTime = 0,
               bool aCanUnload = true,
               bool aArgsAreUTF8 = false);
-  ~nsPluginTag();
+  virtual ~nsPluginTag();
   
   void SetHost(nsPluginHost * aHost);
   void TryUnloadPlugin();
   void Mark(PRUint32 mask);
   void UnMark(PRUint32 mask);
   bool HasFlag(PRUint32 flag);
   PRUint32 Flags();
   bool Equals(nsPluginTag* aPluginTag);
--- a/dom/src/geolocation/nsGeolocation.cpp
+++ b/dom/src/geolocation/nsGeolocation.cpp
@@ -62,17 +62,17 @@
 #include "nsICategoryManager.h"
 #include "nsISupportsPrimitives.h"
 #include "nsServiceManagerUtils.h"
 #include "nsContentUtils.h"
 #include "nsIURI.h"
 #include "nsIPermissionManager.h"
 #include "nsIObserverService.h"
 #include "nsIPrefService.h"
-#include "nsIPrefBranch2.h"
+#include "nsIPrefBranch.h"
 #include "nsIJSContextStack.h"
 #include "nsThreadUtils.h"
 #include "mozilla/Services.h"
 #include "mozilla/unused.h"
 #include "mozilla/Preferences.h"
 
 #include <math.h>
 
--- a/dom/src/storage/nsDOMStoragePersistentDB.cpp
+++ b/dom/src/storage/nsDOMStoragePersistentDB.cpp
@@ -183,30 +183,31 @@ nsDOMStoragePersistentDB::Init(const nsS
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = mConnection->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
          "CREATE TEMPORARY TABLE webappsstore2_temp ("
          "scope TEXT, "
          "key TEXT, "
          "value TEXT, "
          "secure INTEGER, "
-         "owner TEXT)"));
+         "owner TEXT, "
+         "modified INTEGER DEFAULT 0)"));
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = mConnection->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
         "CREATE UNIQUE INDEX scope_key_index_temp"
         " ON webappsstore2_temp(scope, key)"));
   NS_ENSURE_SUCCESS(rv, rv);
 
 
   rv = mConnection->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
         "CREATE TEMPORARY VIEW webappsstore2_view AS "
-        "SELECT * FROM webappsstore2_temp "
+        "SELECT scope, key, value, secure, owner FROM webappsstore2_temp "
         "UNION ALL "
-        "SELECT * FROM webappsstore2 "
+        "SELECT scope, key, value, secure, owner FROM webappsstore2 "
           "WHERE NOT EXISTS ("
             "SELECT scope, key FROM webappsstore2_temp "
             "WHERE scope = webappsstore2.scope AND key = webappsstore2.key)"));
   NS_ENSURE_SUCCESS(rv, rv);
 
   // carry deletion to both the temporary table and the disk table
   rv = mConnection->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
         "CREATE TEMPORARY TRIGGER webappsstore2_view_delete_trigger "
@@ -297,18 +298,18 @@ nsDOMStoragePersistentDB::EnsureLoadTemp
 
   if (!mTempTableLoads.Get(aStorage->GetScopeDBKey(), &timeStamp)) {
     nsresult rv;
 
     rv = MaybeCommitInsertTransaction();
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCOMPtr<mozIStorageStatement> stmt = mStatements.GetCachedStatement(
-      "INSERT INTO webappsstore2_temp "
-        "SELECT * FROM webappsstore2 "
+      "INSERT INTO webappsstore2_temp (scope, key, value, secure, owner) "
+        "SELECT scope, key, value, secure, owner FROM webappsstore2 "
         "WHERE scope = :scope "
           "AND NOT EXISTS ( "
             "SELECT scope, key FROM webappsstore2_temp "
             "WHERE scope = webappsstore2.scope AND key = webappsstore2.key "
           ") "
     );
     NS_ENSURE_STATE(stmt);
     mozStorageStatementScoper scope(stmt);
@@ -339,18 +340,18 @@ nsDOMStoragePersistentDB::FlushTemporary
   if (!data->mForce && 
       ((TimeStamp::Now() - aData).ToSeconds() < TEMP_TABLE_MAX_AGE))
     return PL_DHASH_NEXT;
 
   {
     nsCOMPtr<mozIStorageStatement> stmt =
       data->mDB->mStatements.GetCachedStatement(
         "INSERT OR REPLACE INTO webappsstore2 "
-         "SELECT * FROM webappsstore2_temp "
-         "WHERE scope = :scope "
+         "SELECT scope, key, value, secure, owner FROM webappsstore2_temp "
+         "WHERE scope = :scope AND modified = 1"
       );
     NS_ENSURE_TRUE(stmt, PL_DHASH_STOP);
     mozStorageStatementScoper scope(stmt);
 
     data->mRV = stmt->BindUTF8StringByName(NS_LITERAL_CSTRING("scope"), aKey);
     NS_ENSURE_SUCCESS(data->mRV, PL_DHASH_STOP);
 
     data->mRV = stmt->Execute();
@@ -534,18 +535,18 @@ nsDOMStoragePersistentDB::SetKey(DOMStor
   if (usage > aQuota) {
     return NS_ERROR_DOM_QUOTA_REACHED;
   }
 
   rv = EnsureInsertTransaction();
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<mozIStorageStatement> stmt = mStatements.GetCachedStatement(
-    "INSERT OR REPLACE INTO webappsstore2_temp (scope, key, value, secure) "
-    "VALUES (:scope, :key, :value, :secure) "
+    "INSERT OR REPLACE INTO webappsstore2_temp (scope, key, value, secure, modified) "
+    "VALUES (:scope, :key, :value, :secure, 1) "
   );
   NS_ENSURE_STATE(stmt);
   mozStorageStatementScoper scopeinsert(stmt);
 
   rv = stmt->BindUTF8StringByName(NS_LITERAL_CSTRING("scope"),
                                   aStorage->GetScopeDBKey());
   NS_ENSURE_SUCCESS(rv, rv);
   rv = stmt->BindStringByName(NS_LITERAL_CSTRING("key"),
@@ -583,17 +584,17 @@ nsDOMStoragePersistentDB::SetSecure(DOMS
   rv = EnsureLoadTemporaryTableForStorage(aStorage);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = EnsureInsertTransaction();
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<mozIStorageStatement> stmt = mStatements.GetCachedStatement(
     "UPDATE webappsstore2_temp "
-    "SET secure = :secure "
+    "SET secure = :secure, modified = 1 "
     "WHERE scope = :scope "
       "AND key = :key "
   );
   NS_ENSURE_STATE(stmt);
   mozStorageStatementScoper scope(stmt);
 
   rv = stmt->BindUTF8StringByName(NS_LITERAL_CSTRING("scope"),
                                   aStorage->GetScopeDBKey());
--- a/dom/tests/mochitest/general/Makefile.in
+++ b/dom/tests/mochitest/general/Makefile.in
@@ -75,16 +75,17 @@ include $(topsrcdir)/config/rules.mk
 		browserFrameHelpers.js \
 		test_browserFrame1.html \
 		test_browserFrame2.html \
 		test_browserFrame3.html \
 		test_browserFrame4.html \
 		test_browserFrame5.html \
 		test_browserFrame6.html \
 		test_for_of.html \
+		test_focus_legend_noparent.html \
 		$(NULL)
 
 _CHROME_FILES = \
 		test_innerScreen.xul \
 		test_offsets.xul \
 		test_offsets.js \
 		$(NULL)
 
new file mode 100644
--- /dev/null
+++ b/dom/tests/mochitest/general/test_focus_legend_noparent.html
@@ -0,0 +1,34 @@
+<html>
+<head>
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+function runTest()
+{
+    window.focus();
+    var g = document.createElementNS("http://www.w3.org/1999/xhtml", "legend");
+    document.body.appendChild(g);
+    setTimeout(g.focus.bind(g), 0);
+    setTimeout(done, 10);
+}
+
+function done()
+{
+  ok(document.hasFocus(), "document is still focused");
+  is(document.activeElement, document.body, "document has no focused element")
+  SimpleTest.finish();
+}
+
+SimpleTest.waitForFocus(runTest);
+</script>
+</head>
+
+<p id="display"></p>
+<div id="content" style="display: none">
+</div>
+
+<body onblur="dump('blurred window!\n')"></body>
+</html>
--- a/dom/workers/XMLHttpRequestPrivate.cpp
+++ b/dom/workers/XMLHttpRequestPrivate.cpp
@@ -344,18 +344,17 @@ class LoadStartDetectionRunnable : publi
 
     bool
     WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
     {
       if (mSyncQueueKey != PR_UINT32_MAX) {
         aWorkerPrivate->StopSyncLoop(mSyncQueueKey, true);
       }
 
-      mXMLHttpRequestPrivate->UnrootJSObject(aCx);
-      aWorkerPrivate->RemoveFeature(aCx, mXMLHttpRequestPrivate);
+      mXMLHttpRequestPrivate->Unpin(aCx);
 
       return true;
     }
   };
 
 public:
   NS_DECL_ISUPPORTS
 
@@ -1178,16 +1177,39 @@ public:
   intN
   MainThreadRun()
   {
     nsresult rv = mProxy->mXHR->OverrideMimeType(mMimeType);
     return GetDOMExceptionCodeFromResult(rv);
   }
 };
 
+class AutoUnpinXHR {
+public:
+  AutoUnpinXHR(XMLHttpRequestPrivate* aXMLHttpRequestPrivate,
+               JSContext* aCx)
+  :  mXMLHttpRequestPrivate(aXMLHttpRequestPrivate), mCx(aCx)
+  { }
+
+  ~AutoUnpinXHR()
+  {
+    if (mXMLHttpRequestPrivate) {
+      mXMLHttpRequestPrivate->Unpin(mCx);
+    }
+  }
+
+  void Clear()
+  {
+    mXMLHttpRequestPrivate = nsnull;
+  }
+private:
+  XMLHttpRequestPrivate* mXMLHttpRequestPrivate;
+  JSContext* mCx;
+};
+
 } // anonymous namespace
 
 void
 Proxy::Teardown()
 {
   AssertIsOnMainThread();
 
   if (mXHR) {
@@ -1341,42 +1363,54 @@ XMLHttpRequestPrivate::ReleaseProxy()
 
     if (NS_FAILED(NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL))) {
       NS_ERROR("Failed to dispatch teardown runnable!");
     }
   }
 }
 
 bool
-XMLHttpRequestPrivate::RootJSObject(JSContext* aCx)
+XMLHttpRequestPrivate::Pin(JSContext* aCx)
 {
   mWorkerPrivate->AssertIsOnWorkerThread();
 
   if (!mJSObjectRootCount) {
     if (!JS_AddNamedObjectRoot(aCx, &mJSObject,
                                "XMLHttpRequestPrivate mJSObject")) {
       return false;
     }
+    if (!mWorkerPrivate->AddFeature(aCx, this)) {
+      if (!JS_RemoveObjectRoot(aCx, &mJSObject)) {
+        NS_ERROR("JS_RemoveObjectRoot failed!");
+      }
+      return false;
+    }
   }
 
   mJSObjectRootCount++;
   return true;
 }
 
 void
-XMLHttpRequestPrivate::UnrootJSObject(JSContext* aCx)
+XMLHttpRequestPrivate::Unpin(JSContext* aCx)
 {
   mWorkerPrivate->AssertIsOnWorkerThread();
 
-  NS_ASSERTION(mJSObjectRootCount, "Mismatched calls to UnrootJSObject!");
+  NS_ASSERTION(mJSObjectRootCount, "Mismatched calls to Unpin!");
   mJSObjectRootCount--;
 
-  if (!mJSObjectRootCount && !JS_RemoveObjectRoot(aCx, &mJSObject)) {
+  if (mJSObjectRootCount) {
+    return;
+  }
+
+  if (!JS_RemoveObjectRoot(aCx, &mJSObject)) {
     NS_ERROR("JS_RemoveObjectRoot failed!");
   }
+
+  mWorkerPrivate->RemoveFeature(aCx, this);
 }
 
 bool
 XMLHttpRequestPrivate::Notify(JSContext* aCx, Status aStatus)
 {
   mWorkerPrivate->AssertIsOnWorkerThread();
 
   if (aStatus >= Canceling && !mCanceled) {
@@ -1699,39 +1733,36 @@ XMLHttpRequestPrivate::Send(JSContext* a
   bool hasUploadListeners = false;
   if (mUploadJSObject) {
     events::EventTarget* target =
       events::EventTarget::FromJSObject(mUploadJSObject);
     NS_ASSERTION(target, "This should never be null!");
     hasUploadListeners = target->HasListeners();
   }
 
-  if (!RootJSObject(aCx)) {
+  if (!Pin(aCx)) {
     return false;
   }
 
-  if (!mWorkerPrivate->AddFeature(aCx, this)) {
-    UnrootJSObject(aCx);
-    return false;
-  }
+  AutoUnpinXHR autoUnpin(this, aCx);
 
   PRUint32 syncQueueKey = PR_UINT32_MAX;
   if (mProxy->mIsSyncXHR) {
     syncQueueKey = mWorkerPrivate->CreateNewSyncLoop();
   }
 
   nsRefPtr<SendRunnable> runnable =
     new SendRunnable(mWorkerPrivate, mProxy, buffer, syncQueueKey,
                      hasUploadListeners);
   if (!runnable->Dispatch(aCx)) {
-    UnrootJSObject(aCx);
-    mWorkerPrivate->RemoveFeature(aCx, this);
     return false;
   }
 
+  autoUnpin.Clear();
+
   // The event loop was spun above, make sure we aren't canceled already.
   if (mCanceled) {
     return false;
   }
 
   return mProxy->mIsSyncXHR ?
          mWorkerPrivate->RunSyncLoop(aCx, syncQueueKey) :
          true;
@@ -1759,33 +1790,36 @@ XMLHttpRequestPrivate::SendAsBinary(JSCo
   bool hasUploadListeners = false;
   if (mUploadJSObject) {
     events::EventTarget* target =
       events::EventTarget::FromJSObject(mUploadJSObject);
     NS_ASSERTION(target, "This should never be null!");
     hasUploadListeners = target->HasListeners();
   }
 
-  if (!RootJSObject(aCx)) {
+  if (!Pin(aCx)) {
     return false;
   }
 
+  AutoUnpinXHR autoUnpin(this, aCx);
+
   PRUint32 syncQueueKey = PR_UINT32_MAX;
   if (mProxy->mIsSyncXHR) {
     syncQueueKey = mWorkerPrivate->CreateNewSyncLoop();
   }
 
   nsRefPtr<SendAsBinaryRunnable> runnable =
     new SendAsBinaryRunnable(mWorkerPrivate, mProxy, body, syncQueueKey,
                              hasUploadListeners);
   if (!runnable->Dispatch(aCx)) {
-    UnrootJSObject(aCx);
     return false;
   }
 
+  autoUnpin.Clear();
+
   // The event loop was spun above, make sure we aren't canceled already.
   if (mCanceled) {
     return false;
   }
 
   return mProxy->mIsSyncXHR ?
          mWorkerPrivate->RunSyncLoop(aCx, syncQueueKey) :
          true;
--- a/dom/workers/XMLHttpRequestPrivate.h
+++ b/dom/workers/XMLHttpRequestPrivate.h
@@ -75,17 +75,17 @@ public:
   void
   FinalizeInstance(JSContext* aCx)
   {
     ReleaseProxy();
     events::EventTarget::FinalizeInstance(aCx);
   }
 
   void
-  UnrootJSObject(JSContext* aCx);
+  Unpin(JSContext* aCx);
 
   JSObject*
   GetJSObject()
   {
     mWorkerPrivate->AssertIsOnWorkerThread();
     return mJSObject;
   }
 
@@ -147,17 +147,17 @@ public:
   bool
   OverrideMimeType(JSContext* aCx, JSString* aMimeType);
 
 private:
   void
   ReleaseProxy();
 
   bool
-  RootJSObject(JSContext* aCx);
+  Pin(JSContext* aCx);
 
   bool
   MaybeDispatchPrematureAbortEvents(JSContext* aCx);
 
   bool
   DispatchPrematureAbortEvent(JSContext* aCx, JSObject* aTarget,
                               PRUint64 aEventType, bool aUploadTarget);
 
--- a/dom/workers/test/Makefile.in
+++ b/dom/workers/test/Makefile.in
@@ -115,16 +115,18 @@ include $(topsrcdir)/config/rules.mk
   test_fibonacci.html \
   fibonacci_worker.js \
   test_newError.html \
   newError_worker.js \
   test_chromeWorker.html \
   WorkerTest_badworker.js \
   test_workersDisabled.html \
   workersDisabled_worker.js \
+  test_xhr_implicit_cancel.html \
+  xhr_implicit_cancel_worker.js \
   $(NULL)
 
 _SUBDIR_TEST_FILES = \
   relativeLoad_sub_worker.js \
   relativeLoad_sub_worker2.js \
   relativeLoad_sub_import.js \
   $(NULL)
 
new file mode 100644
--- /dev/null
+++ b/dom/workers/test/test_xhr_implicit_cancel.html
@@ -0,0 +1,44 @@
+<!--
+  Any copyright is dedicated to the Public Domain.
+  http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE HTML>
+<html>
+<!--
+Tests of DOM Worker Threads XHR(Bug 450452 )
+-->
+<head>
+  <title>Test for DOM Worker Threads XHR (Bug 450452 )</title>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=450452">DOM Worker Threads XHR (Bug 450452)</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+  var worker = new Worker("xhr_implicit_cancel_worker.js");
+
+  worker.onmessage = function(event) {
+    is(event.target, worker);
+    ok(true, "Worker didn't have an error");
+    SimpleTest.finish();
+  };
+
+  worker.onerror = function(event) {
+    is(event.target, worker);
+    ok(false, "Worker had an error:" + event.data);
+    SimpleTest.finish();
+  }
+
+  SimpleTest.waitForExplicitFinish();
+
+</script>
+</pre>
+</body>
+</html>
+
new file mode 100644
--- /dev/null
+++ b/dom/workers/test/xhr_implicit_cancel_worker.js
@@ -0,0 +1,10 @@
+/**
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+var xhr = new XMLHttpRequest();
+xhr.open("GET", "testXHR.txt");
+xhr.send(null);
+xhr.open("GET", "testXHR.txt");
+xhr.send(null);
+postMessage("done");
--- a/extensions/cookie/nsCookiePermission.cpp
+++ b/extensions/cookie/nsCookiePermission.cpp
@@ -46,17 +46,16 @@
 #include "nsICookie2.h"
 #include "nsIServiceManager.h"
 #include "nsICookiePromptService.h"
 #include "nsICookieManager2.h"
 #include "nsNetUtil.h"
 #include "nsIURI.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
-#include "nsIPrefBranch2.h"
 #include "nsIChannel.h"
 #include "nsIHttpChannelInternal.h"
 #include "nsIDOMWindow.h"
 #include "nsIDOMDocument.h"
 #include "nsIPrincipal.h"
 #include "nsString.h"
 #include "nsCRT.h"
 #include "nsILoadContext.h"
@@ -100,17 +99,17 @@ nsCookiePermission::Init()
   // Initialize nsIPermissionManager and fetch relevant prefs. This is only
   // required for some methods on nsICookiePermission, so it should be done
   // lazily.
   nsresult rv;
   mPermMgr = do_GetService(NS_PERMISSIONMANAGER_CONTRACTID, &rv);
   if (NS_FAILED(rv)) return false;
 
   // failure to access the pref service is non-fatal...
-  nsCOMPtr<nsIPrefBranch2> prefBranch =
+  nsCOMPtr<nsIPrefBranch> prefBranch =
       do_GetService(NS_PREFSERVICE_CONTRACTID);
   if (prefBranch) {
     prefBranch->AddObserver(kCookiesLifetimePolicy, this, false);
     prefBranch->AddObserver(kCookiesLifetimeDays, this, false);
     prefBranch->AddObserver(kCookiesAlwaysAcceptSession, this, false);
     PrefChanged(prefBranch, nsnull);
 
     // migration code for original cookie prefs
--- a/extensions/cookie/nsPopupWindowManager.cpp
+++ b/extensions/cookie/nsPopupWindowManager.cpp
@@ -36,17 +36,16 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsPopupWindowManager.h"
 
 #include "nsCRT.h"
 #include "nsIServiceManager.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
-#include "nsIPrefBranch2.h"
 
 /**
  * The Popup Window Manager maintains popup window permissions by website.
  */
 
 static const char kPopupDisablePref[] = "dom.disable_open_during_load";
 
 //*****************************************************************************
@@ -68,17 +67,17 @@ NS_IMPL_ISUPPORTS3(nsPopupWindowManager,
                    nsSupportsWeakReference)
 
 nsresult
 nsPopupWindowManager::Init()
 {
   nsresult rv;
   mPermissionManager = do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
 
-  nsCOMPtr<nsIPrefBranch2> prefBranch =
+  nsCOMPtr<nsIPrefBranch> prefBranch =
     do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
   if (NS_SUCCEEDED(rv)) {
     bool permission;
     rv = prefBranch->GetBoolPref(kPopupDisablePref, &permission);
     if (NS_FAILED(rv)) {
       permission = true;
     }
     mPolicy = permission ? (PRUint32) DENY_POPUP : (PRUint32) ALLOW_POPUP;
--- a/extensions/gio/nsGIOProtocolHandler.cpp
+++ b/extensions/gio/nsGIOProtocolHandler.cpp
@@ -38,17 +38,17 @@
  * ***** END LICENSE BLOCK ***** */
 
 /*
  * This code is based on original Mozilla gnome-vfs extension. It implements
  * input stream provided by GVFS/GIO.
 */
 #include "mozilla/ModuleUtils.h"
 #include "nsIPrefService.h"
-#include "nsIPrefBranch2.h"
+#include "nsIPrefBranch.h"
 #include "nsIObserver.h"
 #include "nsThreadUtils.h"
 #include "nsProxyRelease.h"
 #include "nsIStringBundle.h"
 #include "nsIStandardURL.h"
 #include "nsMimeTypes.h"
 #include "nsNetUtil.h"
 #include "mozilla/Monitor.h"
@@ -939,17 +939,17 @@ NS_IMPL_ISUPPORTS2(nsGIOProtocolHandler,
 
 nsresult
 nsGIOProtocolHandler::Init()
 {
 #ifdef PR_LOGGING
   sGIOLog = PR_NewLogModule("gio");
 #endif
 
-  nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
+  nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
   if (prefs)
   {
     InitSupportedProtocolsPref(prefs);
     prefs->AddObserver(MOZ_GIO_SUPPORTED_PROTOCOLS, this, false);
   }
 
   return NS_OK;
 }
--- a/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp
+++ b/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp
@@ -42,17 +42,17 @@ extern "C" {
 #include <libgnomevfs/gnome-vfs-mime-utils.h>
 }
 
 #include "nsServiceManagerUtils.h"
 #include "nsComponentManagerUtils.h"
 #include "mozilla/ModuleUtils.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIPrefService.h"
-#include "nsIPrefBranch2.h"
+#include "nsIPrefBranch.h"
 #include "nsIObserver.h"
 #include "nsThreadUtils.h"
 #include "nsProxyRelease.h"
 #include "nsIAuthPrompt.h"
 #include "nsIStringBundle.h"
 #include "nsIStandardURL.h"
 #include "nsIURL.h"
 #include "nsMimeTypes.h"
@@ -794,17 +794,17 @@ nsGnomeVFSProtocolHandler::Init()
   {
     if (!gnome_vfs_init())
     {
       NS_WARNING("gnome_vfs_init failed");
       return NS_ERROR_UNEXPECTED;
     }
   }
 
-  nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
+  nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
   if (prefs)
   {
     InitSupportedProtocolsPref(prefs);
     prefs->AddObserver(MOZ_GNOMEVFS_SUPPORTED_PROTOCOLS, this, false);
   }
 
   return NS_OK;
 }
--- a/extensions/permissions/nsContentBlocker.h
+++ b/extensions/permissions/nsContentBlocker.h
@@ -35,17 +35,17 @@
  * ***** END LICENSE BLOCK ***** */
 #ifndef nsContentBlocker_h__
 #define nsContentBlocker_h__
 
 #include "nsIContentPolicy.h"
 #include "nsIObserver.h"
 #include "nsWeakReference.h"
 #include "nsIPermissionManager.h"
-#include "nsIPrefBranch2.h"
+#include "nsIPrefBranch.h"
 
 class nsIPrefBranch;
 
 ////////////////////////////////////////////////////////////////////////////////
 
 class nsContentBlocker : public nsIContentPolicy,
                          public nsIObserver,
                          public nsSupportsWeakReference
@@ -66,17 +66,17 @@ private:
   void PrefChanged(nsIPrefBranch *, const char *);
   nsresult TestPermission(nsIURI *aCurrentURI,
                           nsIURI *aFirstURI,
                           PRInt32 aContentType,
                           bool *aPermission,
                           bool *aFromPrefs);
 
   nsCOMPtr<nsIPermissionManager> mPermissionManager;
-  nsCOMPtr<nsIPrefBranch2> mPrefBranchInternal;
+  nsCOMPtr<nsIPrefBranch> mPrefBranchInternal;
   static PRUint8 mBehaviorPref[];
 };
 
 #define NS_CONTENTBLOCKER_CID \
 { 0x4ca6b67b, 0x5cc7, 0x4e71, \
   { 0xa9, 0x8a, 0x97, 0xaf, 0x1c, 0x13, 0x48, 0x62 } }
 
 #define NS_CONTENTBLOCKER_CONTRACTID "@mozilla.org/permissions/contentblocker;1"
--- a/extensions/spellcheck/src/mozPersonalDictionary.cpp
+++ b/extensions/spellcheck/src/mozPersonalDictionary.cpp
@@ -40,17 +40,16 @@
 #include "nsReadableUtils.h"
 #include "nsIFile.h"
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsICharsetConverterManager.h"
 #include "nsICharsetAlias.h"
 #include "nsIObserverService.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
-#include "nsIPrefBranch2.h"
 #include "nsIWeakReference.h"
 #include "nsCRT.h"
 #include "nsNetUtil.h"
 #include "nsStringEnumerator.h"
 #include "nsUnicharInputStream.h"
 
 #define MOZ_PERSONAL_DICT_NAME "persdict.dat"
 
--- a/gfx/2d/Factory.cpp
+++ b/gfx/2d/Factory.cpp
@@ -40,16 +40,17 @@
 #ifdef USE_CAIRO
 #include "DrawTargetCairo.h"
 #include "ScaledFontBase.h"
 #endif
 
 #ifdef USE_SKIA
 #include "DrawTargetSkia.h"
 #include "ScaledFontBase.h"
+#include "ScaledFontFreetype.h"
 #endif
 
 #ifdef WIN32
 #include "ScaledFontWin.h"
 #endif
 
 #ifdef XP_MACOSX
 #include "ScaledFontMac.h"
@@ -151,17 +152,17 @@ Factory::CreateScaledFontForNativeFont(c
 #ifdef WIN32
   case NATIVE_FONT_GDI_FONT_FACE:
     {
       return new ScaledFontWin(static_cast<gfxGDIFont*>(aNativeFont.mFont), aSize);
     }
 #endif
   case NATIVE_FONT_SKIA_FONT_FACE:
     {
-      return new ScaledFontBase(static_cast<gfxFont*>(aNativeFont.mFont), aSize);
+      return new ScaledFontFreetype(static_cast<gfxFont*>(aNativeFont.mFont), aSize);
     }
 #endif
 #ifdef USE_CAIRO
   case NATIVE_FONT_CAIRO_FONT_FACE:
     {
       return new ScaledFontBase(aSize);
     }
 #endif
--- a/gfx/2d/Makefile.in
+++ b/gfx/2d/Makefile.in
@@ -85,16 +85,17 @@ endif
 
 DEFINES += -DMOZ_GFX -DUSE_CAIRO
 
 ifdef MOZ_ENABLE_SKIA
 CPPSRCS	+= \
         SourceSurfaceSkia.cpp \
         DrawTargetSkia.cpp \
         PathSkia.cpp \
+        ScaledFontFreetype.cpp
         $(NULL)
 
 DEFINES += -DUSE_SKIA
 
 endif
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 ifdef MOZ_ENABLE_SKIA
--- a/gfx/2d/ScaledFontBase.cpp
+++ b/gfx/2d/ScaledFontBase.cpp
@@ -52,42 +52,16 @@
 #include <vector>
 #include <cmath>
 
 using namespace std;
 
 namespace mozilla {
 namespace gfx {
 
-#ifdef USE_SKIA
-static SkTypeface::Style
-gfxFontStyleToSkia(const gfxFontStyle* aStyle)
-{
-  if (aStyle->style == NS_FONT_STYLE_ITALIC) {
-    if (aStyle->weight == NS_FONT_WEIGHT_BOLD) {
-      return SkTypeface::kBoldItalic;
-    }
-    return SkTypeface::kItalic;
-  }
-  if (aStyle->weight == NS_FONT_WEIGHT_BOLD) {
-    return SkTypeface::kBold;
-  }
-  return SkTypeface::kNormal;
-}
-#endif
-
-#ifdef USE_SKIA
-ScaledFontBase::ScaledFontBase(gfxFont* aFont, Float aSize)
-  : mSize(aSize)
-{
-  NS_LossyConvertUTF16toASCII name(aFont->GetName());
-  mTypeface = SkTypeface::CreateFromName(name.get(), gfxFontStyleToSkia(aFont->GetStyle()));
-}
-#endif
-
 ScaledFontBase::~ScaledFontBase()
 {
 #ifdef USE_SKIA
   SkSafeUnref(mTypeface);
 #endif
 #ifdef USE_CAIRO
   cairo_scaled_font_destroy(mScaledFont);
 #endif
--- a/gfx/2d/ScaledFontBase.h
+++ b/gfx/2d/ScaledFontBase.h
@@ -55,17 +55,16 @@ namespace gfx {
 class ScaledFontBase : public ScaledFont
 {
 public:
   ScaledFontBase(Float aSize);
   virtual ~ScaledFontBase();
 
   virtual TemporaryRef<Path> GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget);
 #ifdef USE_SKIA
-  ScaledFontBase(gfxFont* aFont, Float aSize);
   virtual SkTypeface* GetSkTypeface() { return mTypeface; }
 #endif
 
   // Not true, but required to instantiate a ScaledFontBase.
   virtual FontType GetType() const { return FONT_SKIA; }
 
 #ifdef USE_CAIRO
   cairo_scaled_font_t* GetCairoScaledFont() { return mScaledFont; }
new file mode 100644
--- /dev/null
+++ b/gfx/2d/ScaledFontFreetype.cpp
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Corporation code.
+ *
+ * The Initial Developer of the Original Code is Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2011
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   George Wright <george@mozilla.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "ScaledFontFreetype.h"
+
+#include "gfxFont.h"
+
+#ifdef USE_SKIA
+#include "skia/SkTypeface.h"
+#endif
+
+using namespace std;
+
+namespace mozilla {
+namespace gfx {
+
+#ifdef USE_SKIA
+static SkTypeface::Style
+gfxFontStyleToSkia(const gfxFontStyle* aStyle)
+{
+  if (aStyle->style == NS_FONT_STYLE_ITALIC) {
+    if (aStyle->weight == NS_FONT_WEIGHT_BOLD) {
+      return SkTypeface::kBoldItalic;
+    }
+    return SkTypeface::kItalic;
+  }
+  if (aStyle->weight == NS_FONT_WEIGHT_BOLD) {
+    return SkTypeface::kBold;
+  }
+  return SkTypeface::kNormal;
+}
+#endif
+
+// Ideally we want to use FT_Face here but as there is currently no way to get
+// an SkTypeface from an FT_Face we do this.
+ScaledFontFreetype::ScaledFontFreetype(gfxFont* aFont, Float aSize)
+  : ScaledFontBase(aSize)
+{
+#ifdef USE_SKIA
+  NS_LossyConvertUTF16toASCII name(aFont->GetName());
+  mTypeface = SkTypeface::CreateFromName(name.get(), gfxFontStyleToSkia(aFont->GetStyle()));
+#endif
+}
+
+}
+}
new file mode 100644
--- /dev/null
+++ b/gfx/2d/ScaledFontFreetype.h
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Corporation code.
+ *
+ * The Initial Developer of the Original Code is Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2011
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Matt Woodrow <mwoodrow@mozilla.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef MOZILLA_GFX_SCALEDFONTFREETYPE_H_
+#define MOZILLA_GFX_SCALEDFONTFREETYPE_H_
+
+#include "ScaledFontBase.h"
+
+namespace mozilla {
+namespace gfx {
+
+class ScaledFontFreetype : public ScaledFontBase
+{
+public:
+
+  ScaledFontFreetype(gfxFont* aFont, Float aSize);
+};
+
+}
+}
+
+#endif /* MOZILLA_GFX_SCALEDFONTFREETYPE_H_ */
--- a/image/src/imgLoader.cpp
+++ b/image/src/imgLoader.cpp
@@ -2199,17 +2199,17 @@ NS_IMETHODIMP imgCacheValidator::OnStart
   mRequest->RemoveFromCache();
 
   mRequest->mValidator = nsnull;
   mRequest = nsnull;
 
   // We use originalURI here to fulfil the imgIRequest contract on GetURI.
   nsCOMPtr<nsIURI> originalURI;
   channel->GetOriginalURI(getter_AddRefs(originalURI));
-  mNewRequest->Init(originalURI, uri, channel, channel, mNewEntry,
+  mNewRequest->Init(originalURI, uri, aRequest, channel, mNewEntry,
                     mContext, loadingPrincipal,
                     corsmode);
 
   mDestListener = new ProxyListener(mNewRequest);
 
   // Try to add the new request into the cache. Note that the entry must be in
   // the cache before the proxies' ownership changes, because adding a proxy
   // changes the caching behaviour for imgRequests.
--- a/js/src/jsiter.cpp
+++ b/js/src/jsiter.cpp
@@ -1388,19 +1388,21 @@ MarkGenerator(JSTracer *trc, JSGenerator
 
     /*
      * Currently, generators are not mjitted. Still, (overflow) args can be
      * pushed by the mjit and need to be conservatively marked. Technically, the
      * formal args and generator slots are safe for exact marking, but since the
      * plan is to eventually mjit generators, it makes sense to future-proof
      * this code and save someone an hour later.
      */
-    MarkStackRangeConservatively(trc, gen->floatingStack, fp->formalArgsEnd());
+    MarkValueRange(trc, (HeapValue *)fp->formalArgsEnd() - gen->floatingStack,
+                   gen->floatingStack, "Generator Floating Args");
     fp->mark(trc);
-    MarkStackRangeConservatively(trc, fp->slots(), gen->regs.sp);
+    MarkValueRange(trc, gen->regs.sp - fp->slots(),
+                   (HeapValue *)fp->slots(), "Generator Floating Stack");
 }
 
 static void
 GeneratorWriteBarrierPre(JSContext *cx, JSGenerator *gen)
 {
     JSCompartment *comp = cx->compartment;
     if (comp->needsBarrier())
         MarkGenerator(comp->barrierTracer(), gen);
@@ -1479,35 +1481,40 @@ js_NewGenerator(JSContext *cx)
     Value *stackvp = stackfp->actualArgs() - 2;
     uintN vplen = stackfp->formalArgsEnd() - stackvp;
 
     /* Compute JSGenerator size. */
     uintN nbytes = sizeof(JSGenerator) +
                    (-1 + /* one Value included in JSGenerator */
                     vplen +
                     VALUES_PER_STACK_FRAME +
-                    stackfp->numSlots()) * sizeof(Value);
+                    stackfp->numSlots()) * sizeof(HeapValue);
+
+    JS_ASSERT(nbytes % sizeof(Value) == 0);
+    JS_STATIC_ASSERT(sizeof(StackFrame) % sizeof(HeapValue) == 0);
 
     JSGenerator *gen = (JSGenerator *) cx->malloc_(nbytes);
     if (!gen)
         return NULL;
+    SetValueRangeToUndefined((Value *)gen, nbytes / sizeof(Value));
 
     /* Cut up floatingStack space. */
-    Value *genvp = gen->floatingStack;
+    HeapValue *genvp = gen->floatingStack;
     StackFrame *genfp = reinterpret_cast<StackFrame *>(genvp + vplen);
 
     /* Initialize JSGenerator. */
     gen->obj.init(obj);
     gen->state = JSGEN_NEWBORN;
     gen->enumerators = NULL;
     gen->floating = genfp;
 
     /* Copy from the stack to the generator's floating frame. */
     gen->regs.rebaseFromTo(stackRegs, *genfp);
-    genfp->stealFrameAndSlots(genvp, stackfp, stackvp, stackRegs.sp);
+    genfp->stealFrameAndSlots<HeapValue, Value, StackFrame::DoPostBarrier>(
+                              genfp, genvp, stackfp, stackvp, stackRegs.sp);
     genfp->initFloatingGenerator();
 
     obj->setPrivate(gen);
     return obj;
 }
 
 JSGenerator *
 js_FloatingFrameToGenerator(StackFrame *fp)
--- a/js/src/jsiter.h
+++ b/js/src/jsiter.h
@@ -235,17 +235,17 @@ typedef enum JSGeneratorState {
 } JSGeneratorState;
 
 struct JSGenerator {
     js::HeapPtrObject   obj;
     JSGeneratorState    state;
     js::FrameRegs       regs;
     JSObject            *enumerators;
     js::StackFrame      *floating;
-    js::Value           floatingStack[1];
+    js::HeapValue       floatingStack[1];
 
     js::StackFrame *floatingFrame() {
         return floating;
     }
 
     js::StackFrame *liveFrame() {
         JS_ASSERT((state == JSGEN_RUNNING || state == JSGEN_CLOSING) ==
                   (regs.fp() != floatingFrame()));
--- a/js/src/methodjit/MethodJIT.cpp
+++ b/js/src/methodjit/MethodJIT.cpp
@@ -248,17 +248,17 @@ JS_STATIC_ASSERT(offsetof(FrameRegs, sp)
  * We make sure our CFI covers the code address GDB will actually use, by
  * placing a 'nop' *before* the entry point --- it is never executed --- and
  * having our CFI apply starting at that nop.
  */
 
 #if defined(__GNUC__) && !defined(_WIN64)
 
 /* If this assert fails, you need to realign VMFrame to 16 bytes. */
-#if defined(JS_CPU_ARM) || defined(JS_CPU_MIPS)
+#if defined(JS_CPU_ARM) || defined(JS_CPU_MIPS) || defined(JS_CPU_SPARC)
 JS_STATIC_ASSERT(sizeof(VMFrame) % 8 == 0);
 #else
 JS_STATIC_ASSERT(sizeof(VMFrame) % 16 == 0);
 #endif
 
 # if defined(JS_CPU_X64)
 
 /*
--- a/js/src/vm/Stack.cpp
+++ b/js/src/vm/Stack.cpp
@@ -33,16 +33,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
+#include "jscntxt.h"
 #include "jsgcmark.h"
 #include "methodjit/MethodJIT.h"
 #include "ion/IonFrames.h"
 #include "Stack.h"
 
 #include "jsgcinlines.h"
 #include "jsobjinlines.h"
 
@@ -121,31 +122,41 @@ StackFrame::initDummyFrame(JSContext *cx
 {
     PodZero(this);
     flags_ = DUMMY | HAS_PREVPC | HAS_SCOPECHAIN;
     initPrev(cx);
     JS_ASSERT(chain.isGlobal());
     setScopeChainNoCallObj(chain);
 }
 
+template <class T, class U, StackFrame::TriggerPostBarriers doPostBarrier>
 void
-StackFrame::stealFrameAndSlots(Value *vp, StackFrame *otherfp,
-                               Value *othervp, Value *othersp)
+StackFrame::stealFrameAndSlots(StackFrame *fp, T *vp, StackFrame *otherfp, U *othervp,
+                               Value *othersp)
 {
-    JS_ASSERT(vp == (Value *)this - ((Value *)otherfp - othervp));
-    JS_ASSERT(othervp == otherfp->actualArgs() - 2);
+    JS_ASSERT((U *)vp == (U *)this - ((U *)otherfp - othervp));
+    JS_ASSERT((Value *)othervp == otherfp->actualArgs() - 2);
     JS_ASSERT(othersp >= otherfp->slots());
     JS_ASSERT(othersp <= otherfp->base() + otherfp->numSlots());
+    JS_ASSERT((T *)fp - vp == (U *)otherfp - othervp);
 
-    PodCopy(vp, othervp, othersp - othervp);
-    JS_ASSERT(vp == this->actualArgs() - 2);
+    /* Copy args, StackFrame, and slots. */
+    U *srcend = (U *)otherfp->formalArgsEnd();
+    T *dst = vp;
+    for (U *src = othervp; src < srcend; src++, dst++)
+        *dst = *src;
 
-    /* Catch bad-touching of non-canonical args (e.g., generator_trace). */
-    if (otherfp->hasOverflowArgs())
-        Debug_SetValueRangeToCrashOnTouch(othervp, othervp + 2 + otherfp->numFormalArgs());
+    *fp = *otherfp;
+    if (doPostBarrier)
+        fp->writeBarrierPost();
+
+    srcend = (U *)othersp;
+    dst = (T *)fp->slots();
+    for (U *src = (U *)otherfp->slots(); src < srcend; src++, dst++)
+        *dst = *src;
 
     /*
      * Repoint Call, Arguments, Block and With objects to the new live frame.
      * Call and Arguments are done directly because we have pointers to them.
      * Block and With objects are done indirectly through 'liveFrame'. See
      * js_LiveFrameToFloating comment in jsiter.h.
      */
     if (hasCallObj()) {
@@ -162,16 +173,47 @@ StackFrame::stealFrameAndSlots(Value *vp
         if (argsobj.isNormalArguments())
             argsobj.setStackFrame(this);
         else
             JS_ASSERT(!argsobj.maybeStackFrame());
         otherfp->flags_ &= ~HAS_ARGS_OBJ;
     }
 }
 
+/* Note: explicit instantiation for js_NewGenerator located in jsiter.cpp. */
+template void StackFrame::stealFrameAndSlots<Value, HeapValue, StackFrame::NoPostBarrier>(
+                                             StackFrame *, Value *,
+                                             StackFrame *, HeapValue *, Value *);
+template void StackFrame::stealFrameAndSlots<HeapValue, Value, StackFrame::DoPostBarrier>(
+                                             StackFrame *, HeapValue *,
+                                             StackFrame *, Value *, Value *);
+
+void
+StackFrame::writeBarrierPost()
+{
+    /* This needs to follow the same rules as in js_TraceStackFrame. */
+    if (scopeChain_)
+        JSObject::writeBarrierPost(scopeChain_, (void *)&scopeChain_);
+    if (isDummyFrame())
+        return;
+    if (hasArgsObj())
+        JSObject::writeBarrierPost(argsObj_, (void *)&argsObj_);
+    if (isScriptFrame()) {
+        if (isFunctionFrame()) {
+            JSFunction::writeBarrierPost((JSObject *)exec.fun, (void *)&exec.fun);
+            if (isEvalFrame())
+                JSScript::writeBarrierPost(u.evalScript, (void *)&u.evalScript);
+        } else {
+            JSScript::writeBarrierPost(exec.script, (void *)&exec.script);
+        }
+    }
+    if (hasReturnValue())
+        HeapValue::writeBarrierPost(rval_, &rval_);
+}
+
 #ifdef DEBUG
 JSObject *const StackFrame::sInvalidScopeChain = (JSObject *)0xbeef;
 #endif
 
 jsbytecode *
 StackFrame::prevpcSlow(JSInlinedSite **pinlined)
 {
     JS_ASSERT(!(flags_ & HAS_PREVPC));
@@ -870,18 +912,18 @@ ContextStack::popFrame(const FrameGuard 
     if (!hasfp())
         cx_->resetCompartment();
 }
 
 bool
 ContextStack::pushGeneratorFrame(JSContext *cx, JSGenerator *gen, GeneratorFrameGuard *gfg)
 {
     StackFrame *genfp = gen->floatingFrame();
-    Value *genvp = gen->floatingStack;
-    uintN vplen = (Value *)genfp - genvp;
+    HeapValue *genvp = gen->floatingStack;
+    uintN vplen = (HeapValue *)genfp - genvp;
 
     uintN nvars = vplen + VALUES_PER_STACK_FRAME + genfp->numSlots();
     Value *firstUnused = ensureOnTop(cx, REPORT_ERROR, nvars, CAN_EXTEND, &gfg->pushedSeg_);
     if (!firstUnused)
         return false;
 
     StackFrame *stackfp = reinterpret_cast<StackFrame *>(firstUnused + vplen);
     Value *stackvp = (Value *)stackfp - vplen;
@@ -897,41 +939,43 @@ ContextStack::pushGeneratorFrame(JSConte
      * We don't need to worry about generational barriers as the generator
      * object has a trace hook and cannot be nursery allocated.
      */
     JSObject *genobj = js_FloatingFrameToGenerator(genfp)->obj;
     JS_ASSERT(genobj->getClass()->trace);
     JSObject::writeBarrierPre(genobj);
 
     /* Copy from the generator's floating frame to the stack. */
-    stackfp->stealFrameAndSlots(stackvp, genfp, genvp, gen->regs.sp);
+    stackfp->stealFrameAndSlots<Value, HeapValue, StackFrame::NoPostBarrier>(
+                                stackfp, stackvp, genfp, genvp, gen->regs.sp);
     stackfp->resetGeneratorPrev(cx);
     stackfp->unsetFloatingGenerator();
     gfg->regs_.rebaseFromTo(gen->regs, *stackfp);
 
     gfg->prevRegs_ = seg_->pushRegs(gfg->regs_);
     JS_ASSERT(space().firstUnused() == gfg->regs_.sp);
     gfg->setPushed(*this);
     return true;
 }
 
 void
 ContextStack::popGeneratorFrame(const GeneratorFrameGuard &gfg)
 {
     JSGenerator *gen = gfg.gen_;
     StackFrame *genfp = gen->floatingFrame();
-    Value *genvp = gen->floatingStack;
+    HeapValue *genvp = gen->floatingStack;
 
     const FrameRegs &stackRegs = gfg.regs_;
     StackFrame *stackfp = stackRegs.fp();
     Value *stackvp = gfg.stackvp_;
 
     /* Copy from the stack to the generator's floating frame. */
     gen->regs.rebaseFromTo(stackRegs, *genfp);
-    genfp->stealFrameAndSlots(genvp, stackfp, stackvp, stackRegs.sp);
+    genfp->stealFrameAndSlots<HeapValue, Value, StackFrame::DoPostBarrier>(
+                              genfp, genvp, stackfp, stackvp, stackRegs.sp);
     genfp->setFloatingGenerator();
 
     /* ~FrameGuard/popFrame will finish the popping. */
     JS_ASSERT(ImplicitCast<const FrameGuard>(gfg).pushed());
 }
 
 bool
 ContextStack::saveFrameChain()
--- a/js/src/vm/Stack.h
+++ b/js/src/vm/Stack.h
@@ -430,17 +430,24 @@ class StackFrame
     /* Used for getFixupFrame (for FixupArity). */
     void initFixupFrame(StackFrame *prev, StackFrame::Flags flags, void *ncode, uintN nactual);
 
     /* Used for eval. */
     void initExecuteFrame(JSScript *script, StackFrame *prev, FrameRegs *regs,
                           const Value &thisv, JSObject &scopeChain, ExecuteType type);
 
     /* Used when activating generators. */
-    void stealFrameAndSlots(Value *vp, StackFrame *otherfp, Value *othervp, Value *othersp);
+    enum TriggerPostBarriers {
+        DoPostBarrier = true,
+        NoPostBarrier = false
+    };
+    template <class T, class U, TriggerPostBarriers doPostBarrier>
+    void stealFrameAndSlots(StackFrame *fp, T *vp, StackFrame *otherfp, U *othervp,
+                            Value *othersp);
+    void writeBarrierPost();
 
     /* Perhaps one fine day we will remove dummy frames. */
     void initDummyFrame(JSContext *cx, JSObject &chain);
 
     /*
      * Stack frame type
      *
      * A stack frame may have one of three types, which determines which
@@ -988,16 +995,20 @@ class StackFrame
 
     void setHookData(void *v) {
         hookData_ = v;
         flags_ |= HAS_HOOK_DATA;
     }
 
     /* Return value */
 
+    bool hasReturnValue() const {
+        return !!(flags_ & HAS_RVAL);
+    }
+
     const Value &returnValue() {
         if (!(flags_ & HAS_RVAL))
             rval_.setUndefined();
         return rval_;
     }
 
     void markReturnValue() {
         flags_ |= HAS_RVAL;
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -579,17 +579,17 @@ XPCJSRuntime::AddXPConnectRoots(JSContex
     GetCompartmentMap().EnumerateRead(SuspectCompartment, &closure);
 }
 
 static JSDHashOperator
 UnmarkJSHolder(JSDHashTable *table, JSDHashEntryHdr *hdr, uint32_t number,
                void *arg)
 {
     ObjectHolder* entry = reinterpret_cast<ObjectHolder*>(hdr);
-    entry->tracer->CanSkip(entry->holder);
+    entry->tracer->CanSkip(entry->holder, true);
     return JS_DHASH_NEXT;
 }
 
 void
 XPCJSRuntime::UnmarkSkippableJSHolders()
 {
     XPCAutoLock lock(mMapLock);
     if (mJSHolders.ops) {             
new file mode 100644
--- /dev/null
+++ b/layout/base/crashtests/725535.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html style="-moz-transform-style: preserve-3d">
+<body>
+<script>
+document.addEventListener("MozReftestInvalidate", function() {document.documentElement.style.MozTransform = 'rotate(0)';}, false);
+</script>
+</body>
+</html>
--- a/layout/base/crashtests/crashtests.list
+++ b/layout/base/crashtests/crashtests.list
@@ -344,8 +344,9 @@ load 668941.xhtml
 load 670226.html
 asserts(2) load 675246-1.xhtml # Bug 675713
 load 691118-1.html
 load 695861.html
 load 698335.html
 needs-focus pref(accessibility.browsewithcaret,true) load 699353-1.html
 load 707098.html
 load 722137.html
+load 725535.html
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -7669,19 +7669,16 @@ static void
 DoApplyRenderingChangeToTree(nsIFrame* aFrame,
                              nsFrameManager* aFrameManager,
                              nsChangeHint aChange)
 {
   NS_PRECONDITION(gInApplyRenderingChangeToTree,
                   "should only be called within ApplyRenderingChangeToTree");
 
   for ( ; aFrame; aFrame = nsLayoutUtils::GetNextContinuationOrSpecialSibling(aFrame)) {
-    NS_ASSERTION(!(aChange & nsChangeHint_UpdateTransformLayer) || aFrame->IsTransformed(),
-                 "Only transformed frames should have UpdateTransformLayer hint");
-
     // Get view if this frame has one and trigger an update. If the
     // frame doesn't have a view, find the nearest containing view
     // (adjusting r's coordinate system to reflect the nesting) and
     // update there.
     // We don't need to update transforms in UpdateViewsForTree, because
     // there can't be any out-of-flows or popups that need to be transformed;
     // all out-of-flow descendants of the transformed element must also be
     // descendants of the transformed frame.
@@ -7713,16 +7710,19 @@ DoApplyRenderingChangeToTree(nsIFrame* a
   }
 }
 
 static void
 ApplyRenderingChangeToTree(nsPresContext* aPresContext,
                            nsIFrame* aFrame,
                            nsChangeHint aChange)
 {
+  NS_ASSERTION(!(aChange & nsChangeHint_UpdateTransformLayer) || aFrame->IsTransformed(),
+               "Only transformed frames should have UpdateTransformLayer hint");
+
   nsIPresShell *shell = aPresContext->PresShell();
   if (shell->IsPaintingSuppressed()) {
     // Don't allow synchronous rendering changes when painting is turned off.
     aChange = NS_SubtractHint(aChange, nsChangeHint_RepaintFrame);
     if (!aChange) {
       return;
     }
   }
--- a/layout/generic/nsColumnSetFrame.cpp
+++ b/layout/generic/nsColumnSetFrame.cpp
@@ -359,16 +359,32 @@ nsColumnSetFrame::ChooseColumnStrategy(c
   nscoord colHeight = GetAvailableContentHeight(aReflowState);
   if (aReflowState.ComputedHeight() != NS_INTRINSICSIZE) {
     colHeight = aReflowState.ComputedHeight();
   }
 
   nscoord colGap = GetColumnGap(this, colStyle);
   PRInt32 numColumns = colStyle->mColumnCount;
 
+  bool isBalancing = colStyle->mColumnFill == NS_STYLE_COLUMN_FILL_BALANCE;
+  if (isBalancing) {
+    const PRUint32 MAX_NESTED_COLUMN_BALANCING = 5;
+    PRUint32 cnt = 1;
+    for (const nsHTMLReflowState* rs = aReflowState.parentReflowState;
+         rs && cnt < MAX_NESTED_COLUMN_BALANCING;
+         rs = rs->parentReflowState) {
+      if (rs->mFlags.mIsColumnBalancing) {
+        ++cnt;
+      }
+    }
+    if (cnt == MAX_NESTED_COLUMN_BALANCING) {
+      numColumns = 1;
+    }
+  }
+
   nscoord colWidth;
   if (colStyle->mColumnWidth.GetUnit() == eStyleUnit_Coord) {
     colWidth = colStyle->mColumnWidth.GetCoordValue();
     NS_ASSERTION(colWidth >= 0, "negative column width");
     // Reduce column count if necessary to make columns fit in the
     // available width. Compute max number of columns that fit in
     // availContentWidth, satisfying colGap*(maxColumns - 1) +
     // colWidth*maxColumns <= availContentWidth
@@ -412,17 +428,17 @@ nsColumnSetFrame::ChooseColumnStrategy(c
     nscoord extraSpace =
       NS_MAX(0, availContentWidth - (colWidth*numColumns + colGap*(numColumns - 1)));
     nscoord extraToColumns = extraSpace/numColumns;
     colWidth += extraToColumns;
     expectedWidthLeftOver = extraSpace - (extraToColumns*numColumns);
   }
 
   // If column-fill is set to 'balance', then we want to balance the columns.
-  if (colStyle->mColumnFill == NS_STYLE_COLUMN_FILL_BALANCE) {
+  if (isBalancing) {
     // Balancing!
 
     if (numColumns <= 0) {
       // Hmm, auto column count, column width or available width is unknown,
       // and balancing is required. Let's just use one column then.
       numColumns = 1;
     }
 
@@ -652,16 +668,17 @@ nsColumnSetFrame::ReflowChildren(nsHTMLR
       if (reflowNext)
         child->AddStateBits(NS_FRAME_IS_DIRTY);
 
       nsHTMLReflowState kidReflowState(PresContext(), aReflowState, child,
                                        availSize, availSize.width,
                                        aReflowState.ComputedHeight());
       kidReflowState.mFlags.mIsTopOfPage = true;
       kidReflowState.mFlags.mTableIsSplittable = false;
+      kidReflowState.mFlags.mIsColumnBalancing = aConfig.mBalanceColCount < PR_INT32_MAX;
           
 #ifdef DEBUG_roc
       printf("*** Reflowing child #%d %p: availHeight=%d\n",
              columnCount, (void*)child,availSize.height);
 #endif
 
       // Note if the column's next in flow is not being changed by this incremental reflow.
       // This may allow the current column to avoid trying to pull lines from the next column.
--- a/layout/generic/nsHTMLReflowState.cpp
+++ b/layout/generic/nsHTMLReflowState.cpp
@@ -98,23 +98,17 @@ nsHTMLReflowState::nsHTMLReflowState(nsP
   NS_PRECONDITION(aPresContext, "no pres context");
   NS_PRECONDITION(aRenderingContext, "no rendering context");
   NS_PRECONDITION(aFrame, "no frame");
   parentReflowState = nsnull;
   availableWidth = aAvailableSpace.width;
   availableHeight = aAvailableSpace.height;
   mFloatManager = nsnull;
   mLineLayout = nsnull;
-  mFlags.mSpecialHeightReflow = false;
-  mFlags.mIsTopOfPage = false;
-  mFlags.mTableIsSplittable = false;
-  mFlags.mNextInFlowUntouched = false;
-  mFlags.mAssumingHScrollbar = mFlags.mAssumingVScrollbar = false;
-  mFlags.mHasClearance = false;
-  mFlags.mHeightDependsOnAncestorCell = false;
+  memset(&mFlags, 0, sizeof(mFlags));
   mDiscoveredClearance = nsnull;
   mPercentHeightObserver = nsnull;
   Init(aPresContext);
 }
 
 static bool CheckNextInFlowParenthood(nsIFrame* aFrame, nsIFrame* aParent)
 {
   nsIFrame* frameNext = aFrame->GetNextInFlow();
@@ -169,16 +163,17 @@ nsHTMLReflowState::nsHTMLReflowState(nsP
 
   // Note: mFlags was initialized as a copy of aParentReflowState.mFlags up in
   // this constructor's init list, so the only flags that we need to explicitly
   // initialize here are those that may need a value other than our parent's.
   mFlags.mNextInFlowUntouched = aParentReflowState.mFlags.mNextInFlowUntouched &&
     CheckNextInFlowParenthood(aFrame, aParentReflowState.frame);
   mFlags.mAssumingHScrollbar = mFlags.mAssumingVScrollbar = false;
   mFlags.mHasClearance = false;
+  mFlags.mIsColumnBalancing = false;
 
   mDiscoveredClearance = nsnull;
   mPercentHeightObserver = (aParentReflowState.mPercentHeightObserver && 
                             aParentReflowState.mPercentHeightObserver->NeedsToObserve(*this)) 
                            ? aParentReflowState.mPercentHeightObserver : nsnull;
 
   if (aInit) {
     Init(aPresContext, aContainingBlockWidth, aContainingBlockHeight);
--- a/layout/generic/nsHTMLReflowState.h
+++ b/layout/generic/nsHTMLReflowState.h
@@ -362,17 +362,17 @@ public:
                                      // different height than before or
                                      // (potentially) in a context where
                                      // percent heights have a different
                                      // basis?
     PRUint16 mTableIsSplittable:1;   // tables are splittable, this should happen only inside a page
                                      // and never insider a column frame
     PRUint16 mHeightDependsOnAncestorCell:1;   // Does frame height depend on
                                                // an ancestor table-cell?
-    
+    PRUint16 mIsColumnBalancing:1;   // nsColumnSetFrame is balancing columns
   } mFlags;
 
 private:
 
   mozilla::AutoRestore<nsIFrame*> mRestoreCurrentInflationContainer;
   mozilla::AutoRestore<nscoord> mRestoreCurrentInflationContainerWidth;
 
 public:
rename from layout/reftests/flexbox/flexbox-attributes-no-box-horizontal-ref.xhtml
rename to layout/reftests/box/flexbox-attributes-no-box-horizontal-ref.xhtml
rename from layout/reftests/flexbox/flexbox-attributes-no-box-horizontal.xhtml
rename to layout/reftests/box/flexbox-attributes-no-box-horizontal.xhtml
rename from layout/reftests/flexbox/flexbox-attributes-no-box-vertical-ref.xhtml
rename to layout/reftests/box/flexbox-attributes-no-box-vertical-ref.xhtml
rename from layout/reftests/flexbox/flexbox-attributes-no-box-vertical.xhtml
rename to layout/reftests/box/flexbox-attributes-no-box-vertical.xhtml
rename from layout/reftests/flexbox/flexbox-attributes-no-input-horizontal-ref.xhtml
rename to layout/reftests/box/flexbox-attributes-no-input-horizontal-ref.xhtml
rename from layout/reftests/flexbox/flexbox-attributes-no-input-horizontal.xhtml
rename to layout/reftests/box/flexbox-attributes-no-input-horizontal.xhtml
rename from layout/reftests/flexbox/flexbox-attributes-no-input-vertical-ref.xhtml
rename to layout/reftests/box/flexbox-attributes-no-input-vertical-ref.xhtml
rename from layout/reftests/flexbox/flexbox-attributes-no-input-vertical.xhtml
rename to layout/reftests/box/flexbox-attributes-no-input-vertical.xhtml
rename from layout/reftests/flexbox/reftest.list
rename to layout/reftests/box/reftest.list
--- a/layout/reftests/reftest.list
+++ b/layout/reftests/reftest.list
@@ -21,16 +21,19 @@ include backgrounds/reftest.list
 include bidi/reftest.list
 
 # border-image
 skip-if(Android) include border-image/reftest.list
 
 # border-radius/
 include border-radius/reftest.list
 
+# -moz-box tests
+include box/reftest.list
+
 # box-ordinal/
 include box-ordinal/reftest.list
 
 # box-properties/
 include box-properties/reftest.list
 
 # box-shadow/
 skip-if(Android) include box-shadow/reftest.list
@@ -135,19 +138,16 @@ include editor/reftest.list
 include generated-content/reftest.list
 
 # first-letter/
 skip-if(Android) include first-letter/reftest.list
 
 # first-line/
 include first-line/reftest.list
 
-# flexbox/
-include flexbox/reftest.list
-
 # floats/
 include floats/reftest.list
 
 # font-face
 include font-face/reftest.list
 
 # font features (opentype)
 include font-features/reftest.list
--- a/layout/tools/reftest/reftest.js
+++ b/layout/tools/reftest/reftest.js
@@ -239,17 +239,17 @@ function OnRefTestLoad(win)
                     .get("ProfD", CI.nsIFile);
     gCrashDumpDir.append("minidumps");
     
     var env = CC["@mozilla.org/process/environment;1"].
               getService(CI.nsIEnvironment);
     gVerbose = !!env.get("MOZ_REFTEST_VERBOSE");
 
     var prefs = Components.classes["@mozilla.org/preferences-service;1"].
-                getService(Components.interfaces.nsIPrefBranch2);
+                getService(Components.interfaces.nsIPrefBranch);
     try {
         gBrowserIsRemote = prefs.getBoolPref("browser.tabs.remote");
     } catch (e) {
         gBrowserIsRemote = false;
     }
     
     if (win === undefined || win == null) {
       win = window;
@@ -283,17 +283,17 @@ function OnRefTestLoad(win)
     RegisterMessageListenersAndLoadContentScript();
 }
 
 function InitAndStartRefTests()
 {
     /* These prefs are optional, so we don't need to spit an error to the log */
     try {
         var prefs = Components.classes["@mozilla.org/preferences-service;1"].
-                    getService(Components.interfaces.nsIPrefBranch2);
+                    getService(Components.interfaces.nsIPrefBranch);
     } catch(e) {
         gDumpLog("REFTEST TEST-UNEXPECTED-FAIL | | EXCEPTION: " + e + "\n");
     }
     
     /* set the gLoadTimeout */
     try {
         gLoadTimeout = prefs.getIntPref("reftest.timeout");
     } catch(e) { 
@@ -396,17 +396,17 @@ function StartHTTPServer()
 }
 
 function StartTests()
 {
 #if BOOTSTRAP
     /* These prefs are optional, so we don't need to spit an error to the log */
     try {
         var prefs = Components.classes["@mozilla.org/preferences-service;1"].
-                    getService(Components.interfaces.nsIPrefBranch2);
+                    getService(Components.interfaces.nsIPrefBranch);
     } catch(e) {
         gDumpLog("REFTEST TEST-UNEXPECTED-FAIL | | EXCEPTION: " + e + "\n");
     }
     
     try {
         gNoCanvasCache = prefs.getIntPref("reftest.nocache");
     } catch(e) { 
         gNoCanvasCache = false;
@@ -558,17 +558,17 @@ function BuildConditionSandbox(aURL) {
     // Set a flag on sandbox if the windows default theme is active
     var box = gContainingWindow.document.createElement("box");
     box.setAttribute("id", "_box_windowsDefaultTheme");
     gContainingWindow.document.documentElement.appendChild(box);
     sandbox.windowsDefaultTheme = (gContainingWindow.getComputedStyle(box, null).display == "none");
     gContainingWindow.document.documentElement.removeChild(box);
 
     var prefs = CC["@mozilla.org/preferences-service;1"].
-                getService(CI.nsIPrefBranch2);
+                getService(CI.nsIPrefBranch);
     try {
         sandbox.nativeThemePref = !prefs.getBoolPref("mozilla.widget.disable-native-theme");
     } catch (e) {
         sandbox.nativeThemePref = true;
     }
 
     sandbox.prefs = {
         __exposedProps__: {
@@ -1031,17 +1031,17 @@ function StartCurrentTest()
             gDumpLog("REFTEST TEST-KNOWN-FAIL | " + test.url1.spec + " | (SKIPPED; COULDN'T GET FOCUS)\n");
             gURLs.shift();
         } else if (test.slow && !gRunSlowTests) {
             ++gTestResults.Slow;
             gDumpLog("REFTEST TEST-KNOWN-SLOW | " + test.url1.spec + " | (SLOW)\n");
             gURLs.shift();
         } else if (gURLs[0].prefSettings.length > 0) {
             var prefs = Components.classes["@mozilla.org/preferences-service;1"].
-                        getService(Components.interfaces.nsIPrefBranch2);
+                        getService(Components.interfaces.nsIPrefBranch);
             var badPref = undefined;
             try {
                 gURLs[0].prefSettings.forEach(function(ps) {
                     var oldVal;
                     if (ps.type == PREF_BOOLEAN) {
                         try {
                             oldVal = prefs.getBoolPref(ps.name);
                         } catch (e) {
@@ -1607,17 +1607,17 @@ function ResetRenderingState()
     SendResetRenderingState();
     // We would want to clear any viewconfig here, if we add support for it
 }
 
 function RestoreChangedPreferences()
 {
     if (gPrefsToRestore.length > 0) {
         var prefs = Components.classes["@mozilla.org/preferences-service;1"].
-                    getService(Components.interfaces.nsIPrefBranch2);
+                    getService(Components.interfaces.nsIPrefBranch);
         gPrefsToRestore.forEach(function(ps) {
             var value = ps.value;
             if (ps.type == PREF_BOOLEAN) {
                 prefs.setBoolPref(ps.name, value);
             } else if (ps.type == PREF_STRING) {
                 prefs.setCharPref(ps.name, value);
                 value = '"' + value + '"';
             } else if (ps.type == PREF_INTEGER) {
--- a/layout/xul/base/src/nsMenuBarListener.cpp
+++ b/layout/xul/base/src/nsMenuBarListener.cpp
@@ -339,46 +339,61 @@ nsMenuBarListener::KeyDown(nsIDOMEvent* 
     return NS_OK;
 
   if (mAccessKey && mAccessKeyFocuses)
   {
     nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aKeyEvent);
     PRUint32 theChar;
     keyEvent->GetKeyCode(&theChar);
 
-    if (!mAccessKeyDownCanceled && theChar == (PRUint32)mAccessKey &&
-        (GetModifiers(keyEvent) & ~mAccessKeyMask) == 0) {
-      // No other modifiers can be down.
-      // Especially CTRL.  CTRL+ALT == AltGR, and
-      // we'll fuck up on non-US enhanced 102-key
-      // keyboards if we don't check this.
+    // No other modifiers can be down.
+    // Especially CTRL.  CTRL+ALT == AltGR, and we'll fuck up on non-US
+    // enhanced 102-key keyboards if we don't check this.
+    bool isAccessKeyDownEvent =
+      ((theChar == (PRUint32)mAccessKey) &&
+       (GetModifiers(keyEvent) & ~mAccessKeyMask) == 0);
+
+    if (!mAccessKeyDown) {
+      // If accesskey isn't being pressed and the key isn't the accesskey,
+      // ignore the event.
+      if (!isAccessKeyDownEvent) {
+        return NS_OK;
+      }
+
+      // Otherwise, accept the accesskey state.
       mAccessKeyDown = true;
+      mAccessKeyDownCanceled = false;
+      return NS_OK;
     }
-    else {
-      // Some key other than the access key just went down,
-      // so we won't activate the menu bar when the access
-      // key is released.
 
-      mAccessKeyDownCanceled = true;
+    // If the pressed accesskey was canceled already, ignore the event.
+    if (mAccessKeyDownCanceled) {
+      return NS_OK;
     }
+
+    // Some key other than the access key just went down,
+    // so we won't activate the menu bar when the access key is released.
+    mAccessKeyDownCanceled = !isAccessKeyDownEvent;
   }
 
   return NS_OK; // means I am NOT consuming event
 }
 
 ////////////////////////////////////////////////////////////////////////
 
 nsresult
 nsMenuBarListener::Blur(nsIDOMEvent* aEvent)
 {
   if (!mMenuBarFrame->IsMenuOpen() && mMenuBarFrame->IsActive()) {
     ToggleMenuActiveState();
-    mAccessKeyDown = false;
-    mAccessKeyDownCanceled = false;
   }
+  // Reset the accesskey state because we cannot receive the keyup event for
+  // the pressing accesskey.
+  mAccessKeyDown = false;
+  mAccessKeyDownCanceled = false;
   return NS_OK; // means I am NOT consuming event
 }
   
 ////////////////////////////////////////////////////////////////////////
 nsresult 
 nsMenuBarListener::MouseDown(nsIDOMEvent* aMouseEvent)
 {
   // NOTE: MouseDown method listens all phases
--- a/layout/xul/base/src/nsXULPopupManager.cpp
+++ b/layout/xul/base/src/nsXULPopupManager.cpp
@@ -1613,20 +1613,19 @@ nsXULPopupManager::SetCaptureState(nsICo
 
   if (mWidget) {
     mWidget->CaptureRollupEvents(this, false, false);
     mWidget = nsnull;
   }
 
   if (item) {
     nsMenuPopupFrame* popup = item->Frame();
-    nsCOMPtr<nsIWidget> widget = popup->GetWidget();
-    if (widget) {
-      widget->CaptureRollupEvents(this, true, popup->ConsumeOutsideClicks());
-      mWidget = widget;
+    mWidget = popup->GetWidget();
+    if (mWidget) {
+      mWidget->CaptureRollupEvents(this, true, popup->ConsumeOutsideClicks());
       popup->AttachedDismissalListener();
     }
   }
 
   UpdateKeyboardListeners();
 }
 
 void
new file mode 100644
--- /dev/null
+++ b/media/libvorbis/bug722924.patch
@@ -0,0 +1,22 @@
+diff --git a/media/libvorbis/lib/vorbis_codebook.c b/media/libvorbis/lib/vorbis_codebook.c
+--- a/media/libvorbis/lib/vorbis_codebook.c
++++ b/media/libvorbis/lib/vorbis_codebook.c
+@@ -442,17 +442,17 @@ long vorbis_book_decodev_set(codebook *b
+       t     = book->valuelist+entry*book->dim;
+       for (j=0;j<book->dim;)
+         a[i++]=t[j++];
+     }
+   }else{
+     int i,j;
+ 
+     for(i=0;i<n;){
+-      for (j=0;j<book->dim;)
++      for (j=0;j<book->dim;j++)
+         a[i++]=0.f;
+     }
+   }
+   return(0);
+ }
+ 
+ long vorbis_book_decodevv_add(codebook *book,float **a,long offset,int ch,
+                               oggpack_buffer *b,int n){
--- a/media/libvorbis/lib/vorbis_codebook.c
+++ b/media/libvorbis/lib/vorbis_codebook.c
@@ -442,17 +442,17 @@ long vorbis_book_decodev_set(codebook *b
       t     = book->valuelist+entry*book->dim;
       for (j=0;j<book->dim;)
         a[i++]=t[j++];
     }
   }else{
     int i,j;
 
     for(i=0;i<n;){
-      for (j=0;j<book->dim;)
+      for (j=0;j<book->dim;j++)
         a[i++]=0.f;
     }
   }
   return(0);
 }
 
 long vorbis_book_decodevv_add(codebook *book,float **a,long offset,int ch,
                               oggpack_buffer *b,int n){
--- a/media/libvorbis/update.sh
+++ b/media/libvorbis/update.sh
@@ -43,8 +43,9 @@ cp $1/lib/bitrate.c ./lib/vorbis_bitrate
 cp $1/lib/block.c ./lib/vorbis_block.c
 cp $1/include/vorbis/codec.h ./include/vorbis/codec.h
 cp $1/todo.txt ./todo.txt
 cp $1/COPYING ./COPYING
 cp $1/README ./README
 cp $1/AUTHORS ./AUTHORS
 patch -p3 < ./alloca.diff
 patch -p3 < ./bug719612.patch
+patch -p3 < ./bug722924.patch
--- a/mobile/android/base/AndroidManifest.xml.in
+++ b/mobile/android/base/AndroidManifest.xml.in
@@ -51,17 +51,17 @@
 		 android:debuggable="true">
 #endif
 
         <activity android:name="App"
                   android:label="@MOZ_APP_DISPLAYNAME@"
                   android:configChanges="keyboard|keyboardHidden|mcc|mnc|orientation"
                   android:windowSoftInputMode="stateUnspecified|adjustResize"
                   android:launchMode="singleTask"
-                  android:theme="@style/Gecko">
+                  android:theme="@style/Gecko.App">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
             <intent-filter>
                 <action android:name="org.mozilla.gecko.UPDATE"/>
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
@@ -141,26 +141,26 @@
             <intent-filter>
                 <action android:name="android.intent.action.CREATE_SHORTCUT" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
         </activity>
         -->
 
         <activity android:name="org.mozilla.gecko.AwesomeBar"
-                  android:theme="@style/Gecko.Light"
+                  android:theme="@style/Gecko.Light.AwesomeBar"
                   android:configChanges="orientation"
                   android:windowSoftInputMode="stateAlwaysVisible|adjustResize"/>
 
         <activity android:name="org.mozilla.gecko.TabsTray"
-                  android:theme="@style/Gecko.Translucent"
+                  android:theme="@style/Gecko.Translucent.TabsTray"
                   android:launchMode="singleTask"/>
 
         <activity android:name="org.mozilla.gecko.GeckoPreferences"
-                  android:theme="@style/Gecko.TitleBar"
+                  android:theme="@style/Gecko.TitleBar.Preferences"
                   android:label="@string/settings_title"
                   android:excludeFromRecents="true"/>
 
         <provider android:name="@ANDROID_PACKAGE_NAME@.db.BrowserProvider"
                   android:authorities="@ANDROID_PACKAGE_NAME@.db.browser"
                   android:permission="@ANDROID_PACKAGE_NAME@.permissions.BROWSER_PROVIDER"/>
 
         <provider android:name="@ANDROID_PACKAGE_NAME@.db.PasswordsProvider"
--- a/mobile/android/base/AutoCompletePopup.java
+++ b/mobile/android/base/AutoCompletePopup.java
@@ -79,17 +79,17 @@ public class AutoCompletePopup extends L
         mAnimation = AnimationUtils.loadAnimation(context, R.anim.grow_fade_in);
         mAnimation.setDuration(75);
 
         setFocusable(false);
 
         setOnItemClickListener(new OnItemClickListener() {
             public void onItemClick(AdapterView<?> parentView, View view, int position, long id) {
                 String value = ((TextView) view).getText().toString();
-                GeckoAppShell.sendEventToGecko(new GeckoEvent("FormAssist:AutoComplete", value));
+                GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("FormAssist:AutoComplete", value));
                 hide();
             }
         });
     }
 
     public void show(JSONArray suggestions, JSONArray rect, double zoom) {
         ArrayAdapter<String> adapter = new ArrayAdapter<String>(mContext, R.layout.autocomplete_list_item);
         for (int i = 0; i < suggestions.length(); i++) {
@@ -177,12 +177,12 @@ public class AutoCompletePopup extends L
         mLayout.setMargins(listLeft, listTop, 0, 0);
         setLayoutParams(mLayout);
         requestLayout();
     }
 
     public void hide() {
         if (isShown()) {
             setVisibility(View.GONE);
-            GeckoAppShell.sendEventToGecko(new GeckoEvent("FormAssist:Closed", null));
+            GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("FormAssist:Closed", null));
         }
     }
 }
--- a/mobile/android/base/AwesomeBar.java
+++ b/mobile/android/base/AwesomeBar.java
@@ -103,24 +103,17 @@ public class AwesomeBar extends Activity
 
         Log.d(LOGTAG, "creating awesomebar");
 
         mResolver = Tabs.getInstance().getContentResolver();
 
         setContentView(R.layout.awesomebar);
 
         if (Build.VERSION.SDK_INT >= 11) {
-            RelativeLayout actionBarLayout = (RelativeLayout) getLayoutInflater().inflate(R.layout.awesomebar_search, null);
-
-            GeckoActionBar.setDisplayOptions(this, ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_CUSTOM |
-                                                                                  ActionBar.DISPLAY_SHOW_HOME |
-                                                                                  ActionBar.DISPLAY_SHOW_TITLE |
-                                                                                  ActionBar.DISPLAY_USE_LOGO);
-            GeckoActionBar.setCustomView(this, actionBarLayout);
-
+            RelativeLayout actionBarLayout = (RelativeLayout) GeckoActionBar.getCustomView(this);
             mGoButton = (ImageButton) actionBarLayout.findViewById(R.id.awesomebar_button);
             mText = (AwesomeBarEditText) actionBarLayout.findViewById(R.id.awesomebar_text);
         } else {
             mGoButton = (ImageButton) findViewById(R.id.awesomebar_button);
             mText = (AwesomeBarEditText) findViewById(R.id.awesomebar_text);
         }
 
         TabWidget tabWidget = (TabWidget) findViewById(android.R.id.tabs);
@@ -230,17 +223,17 @@ public class AwesomeBar extends Activity
             }
         });
 
         registerForContextMenu(mAwesomeTabs.findViewById(R.id.all_pages_list));
         registerForContextMenu(mAwesomeTabs.findViewById(R.id.bookmarks_list));
         registerForContextMenu(mAwesomeTabs.findViewById(R.id.history_list));
 
         GeckoAppShell.registerGeckoEventListener("SearchEngines:Data", this);
-        GeckoAppShell.sendEventToGecko(new GeckoEvent("SearchEngines:Get", null));
+        GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("SearchEngines:Get", null));
     }
 
     public void handleMessage(String event, JSONObject message) {
         try {
             if (event.equals("SearchEngines:Data")) {
                 mAwesomeTabs.setSearchEngines(message.getJSONArray("searchEngines"));
             }
         } catch (Exception e) {
--- a/mobile/android/base/ConfirmPreference.java
+++ b/mobile/android/base/ConfirmPreference.java
@@ -67,15 +67,15 @@ class ConfirmPreference extends DialogPr
                 public void run() {
                     BrowserDB.clearHistory(mContext.getContentResolver());
                     GeckoApp.mAppContext.mFavicons.clearFavicons();
                 }
             });
         } else if ("clear_private_data".equalsIgnoreCase(mAction)) {
             GeckoAppShell.getHandler().post(new Runnable(){
                 public void run() {
-                    GeckoAppShell.sendEventToGecko(new GeckoEvent("Sanitize:ClearAll", null));
+                    GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Sanitize:ClearAll", null));
                 }
             });
         }
         Log.i(LOGTAG, "action: " + mAction);
     }
 }
--- a/mobile/android/base/DoorHanger.java
+++ b/mobile/android/base/DoorHanger.java
@@ -90,17 +90,17 @@ public class DoorHanger extends LinearLa
         Button mButton = new Button(mContext);
         mButton.setText(aText);
         mButton.setTag(Integer.toString(aCallback));
         mButton.setOnClickListener(this);
         mChoicesLayout.addView(mButton, mLayoutParams);
     }
 
     public void onClick(View v) {
-        GeckoEvent e = new GeckoEvent("Doorhanger:Reply", v.getTag().toString());
+        GeckoEvent e = GeckoEvent.createBroadcastEvent("Doorhanger:Reply", v.getTag().toString());
         GeckoAppShell.sendEventToGecko(e);
         mTab.removeDoorHanger(mValue);
 
         // This will hide the doorhanger (and hide the popup if there are no
         // more doorhangers to show)
         GeckoApp.mDoorHangerPopup.updatePopup();
     }
 
--- a/mobile/android/base/DoorHangerPopup.java
+++ b/mobile/android/base/DoorHangerPopup.java
@@ -54,35 +54,44 @@ import org.json.JSONObject;
 import org.json.JSONException;
 
 public class DoorHangerPopup extends PopupWindow {
     private static final String LOGTAG = "GeckoDoorHangerPopup";
 
     private Context mContext;
     private LinearLayout mContent;
 
+    private boolean mInflated; 
+
     public DoorHangerPopup(Context aContext) {
         super(aContext);
         mContext = aContext;
+        mInflated = false;
+   }
 
+    private void init() {
         setBackgroundDrawable(new BitmapDrawable());
         setOutsideTouchable(true);
         setWindowLayoutMode(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
 
         LayoutInflater inflater = LayoutInflater.from(mContext);
         RelativeLayout layout = (RelativeLayout) inflater.inflate(R.layout.doorhangerpopup, null);
         mContent = (LinearLayout) layout.findViewById(R.id.doorhanger_container);
         
         setContentView(layout);
+        mInflated = true;
     }
 
     public void addDoorHanger(String message, String value, JSONArray buttons,
                               Tab tab, JSONObject options) {
         Log.i(LOGTAG, "Adding a DoorHanger to Tab: " + tab.getId());
 
+        if (!mInflated)
+            init();
+
         // Replace the doorhanger if it already exists
         DoorHanger dh = tab.getDoorHanger(value);
         if (dh != null) {
             tab.removeDoorHanger(value);
         }
         dh = new DoorHanger(mContent.getContext(), value);
  
         // Set the doorhanger text and buttons
--- a/mobile/android/base/GeckoActionBar.java
+++ b/mobile/android/base/GeckoActionBar.java
@@ -37,16 +37,20 @@
 
 package org.mozilla.gecko;
 
 import android.app.Activity;
 import android.graphics.drawable.Drawable;
 import android.view.View;
 
 public class GeckoActionBar {
+
+    public static View getCustomView(Activity activity) {
+        return activity.getActionBar().getCustomView();
+    }
  
     public static void hide(Activity activity) {
         activity.getActionBar().hide();
     }
 
     public static void setBackgroundDrawable(Activity activity, Drawable drawable) {
          activity.getActionBar().setBackgroundDrawable(drawable);
     }
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -160,17 +160,17 @@ abstract public class GeckoApp
     private static ArrayList<OnTabsChangedListener> mTabsChangedListeners;
 
     static class ExtraMenuItem implements MenuItem.OnMenuItemClickListener {
         String label;
         String icon;
         int id;
         public boolean onMenuItemClick(MenuItem item) {
             Log.i(LOGTAG, "menu item clicked");
-            GeckoAppShell.sendEventToGecko(new GeckoEvent("Menu:Clicked", Integer.toString(id)));
+            GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Menu:Clicked", Integer.toString(id)));
             return true;
         }
     }
 
     static Vector<ExtraMenuItem> sExtraMenuItems = new Vector<ExtraMenuItem>();
 
     public enum LaunchState {Launching, WaitForDebugger,
                              Launched, GeckoRunning, GeckoExiting};
@@ -478,17 +478,17 @@ abstract public class GeckoApp
     public boolean onOptionsItemSelected(MenuItem item) {
         Tab tab = null;
         Intent intent = null;
         switch (item.getItemId()) {
             case R.id.quit:
                 synchronized(sLaunchState) {
                     if (sLaunchState == LaunchState.GeckoRunning)
                         GeckoAppShell.notifyGeckoOfEvent(
-                            new GeckoEvent("Browser:Quit", null));
+                            GeckoEvent.createBroadcastEvent("Browser:Quit", null));
                     else
                         System.exit(0);
                     sLaunchState = LaunchState.GeckoExiting;
                 }
                 return true;
             case R.id.bookmark:
                 tab = Tabs.getInstance().getSelectedTab();
                 if (tab != null) {
@@ -512,34 +512,34 @@ abstract public class GeckoApp
                 return true;
             case R.id.reload:
                 doReload();
                 return true;
             case R.id.forward:
                 doForward();
                 return true;
             case R.id.save_as_pdf:
-                GeckoAppShell.sendEventToGecko(new GeckoEvent("SaveAs:PDF", null));
+                GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("SaveAs:PDF", null));
                 return true;
             case R.id.settings:
                 intent = new Intent(this, GeckoPreferences.class);
                 startActivity(intent);
                 return true;
             case R.id.site_settings:
-                GeckoAppShell.sendEventToGecko(new GeckoEvent("Permissions:Get", null));
+                GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Permissions:Get", null));
                 return true;
             case R.id.addons:
                 loadUrlInTab("about:addons");
                 return true;
             case R.id.downloads:
                 intent = new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS);
                 startActivity(intent);
                 return true;
             case R.id.char_encoding:
-                GeckoAppShell.sendEventToGecko(new GeckoEvent("CharEncoding:Get", null));
+                GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("CharEncoding:Get", null));
                 return true;
             default:
                 return super.onOptionsItemSelected(item);
         }
     }
 
     public String getLastViewport() {
         return mLastViewport;
@@ -622,17 +622,17 @@ abstract public class GeckoApp
                 message.put("source", source);
 
                 JSONObject destination = new JSONObject();
                 destination.put("width", dw);
                 destination.put("height", dh);
                 message.put("destination", destination);
 
                 String json = message.toString();
-                GeckoAppShell.sendEventToGecko(new GeckoEvent("Tab:Screenshot", json));
+                GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Tab:Screenshot", json));
             } catch(JSONException jsonEx) {
                 Log.w(LOGTAG, "Constructing the JSON data for Tab:Screenshot event failed", jsonEx);
             }
         }
     }
     
     void processThumbnail(Tab thumbnailTab, Bitmap bitmap, byte[] compressed) {
         if (Tabs.getInstance().isSelectedTab(thumbnailTab)) {
@@ -1055,17 +1055,17 @@ abstract public class GeckoApp
                 }
 
                 final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
                 dialogBuilder.setSingleChoiceItems(titleArray, selected, new AlertDialog.OnClickListener() {
                     @Override
                     public void onClick(DialogInterface dialog, int which) {
                         try {
                             JSONObject charset = charsets.getJSONObject(which);
-                            GeckoAppShell.sendEventToGecko(new GeckoEvent("CharEncoding:Set", charset.getString("code")));
+                            GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("CharEncoding:Set", charset.getString("code")));
                             dialog.dismiss();
                         } catch (JSONException e) {
                             Log.e(LOGTAG, "error parsing json", e);
                         }
                     }
                 });
                 dialogBuilder.setNegativeButton(R.string.button_cancel, new AlertDialog.OnClickListener() {
                     @Override
@@ -1192,17 +1192,17 @@ abstract public class GeckoApp
 
                     // An array of the indices of the permissions we want to clear
                     JSONArray permissionsToClear = new JSONArray();
                     for (int i = 0; i < checkedItemPositions.size(); i++) {
                         boolean checked = checkedItemPositions.get(i);
                         if (checked)
                             permissionsToClear.put(i);
                     }
-                    GeckoAppShell.sendEventToGecko(new GeckoEvent("Permissions:Clear", permissionsToClear.toString()));
+                    GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Permissions:Clear", permissionsToClear.toString()));
                 }
             });
         }
 
         builder.setNegativeButton(R.string.site_settings_cancel, new DialogInterface.OnClickListener(){
             public void onClick(DialogInterface dialog, int id) {
                 dialog.cancel();
             }            
@@ -1663,22 +1663,22 @@ abstract public class GeckoApp
 
         if (ACTION_UPDATE.equals(intent.getAction()) || args != null && args.contains("-alert update-app")) {
             Log.i(LOGTAG,"onCreate: Update request");
             checkAndLaunchUpdate();
         }
 
         super.onCreate(savedInstanceState);
 
+        mOrientation = getResources().getConfiguration().orientation;
+
         setContentView(R.layout.gecko_app);
 
-        mOrientation = getResources().getConfiguration().orientation;
-
         if (Build.VERSION.SDK_INT >= 11) {
-            refreshActionBar();
+            mBrowserToolbar = (BrowserToolbar) GeckoActionBar.getCustomView(this);
         } else {
             mBrowserToolbar = (BrowserToolbar) findViewById(R.id.browser_toolbar);
         }
 
         mBrowserToolbar.setTitle(mLastTitle);
 
         String passedUri = null;
         String uri = getURIFromIntent(intent);
@@ -1997,36 +1997,36 @@ abstract public class GeckoApp
             Log.i(LOGTAG, "Intent : ACTION_DEBUG - waiting 5s before launching");
             return;
         }
         if (checkLaunchState(LaunchState.WaitForDebugger) || intent == getIntent())
             return;
 
         if (Intent.ACTION_MAIN.equals(action)) {
             Log.i(LOGTAG, "Intent : ACTION_MAIN");
-            GeckoAppShell.sendEventToGecko(new GeckoEvent(""));
+            GeckoAppShell.sendEventToGecko(GeckoEvent.createLoadEvent(""));
         }
         else if (ACTION_LOAD.equals(action)) {
             String uri = intent.getDataString();
             loadUrl(uri, AwesomeBar.Type.EDIT);
             Log.i(LOGTAG,"onNewIntent: " + uri);
         }
         else if (Intent.ACTION_VIEW.equals(action)) {
             String uri = intent.getDataString();
-            GeckoAppShell.sendEventToGecko(new GeckoEvent(uri));
+            GeckoAppShell.sendEventToGecko(GeckoEvent.createLoadEvent(uri));
             Log.i(LOGTAG,"onNewIntent: " + uri);
         }
         else if (ACTION_WEBAPP.equals(action)) {
             String uri = getURIFromIntent(intent);
-            GeckoAppShell.sendEventToGecko(new GeckoEvent(uri));
+            GeckoAppShell.sendEventToGecko(GeckoEvent.createLoadEvent(uri));
             Log.i(LOGTAG,"Intent : WEBAPP - " + uri);
         }
         else if (ACTION_BOOKMARK.equals(action)) {
             String uri = getURIFromIntent(intent);
-            GeckoAppShell.sendEventToGecko(new GeckoEvent(uri));
+            GeckoAppShell.sendEventToGecko(GeckoEvent.createLoadEvent(uri));
             Log.i(LOGTAG,"Intent : BOOKMARK - " + uri);
         }
     }
 
     /*
      * Handles getting a uri from and intent in a way that is backwards
      * compatable with our previous implementations
      */
@@ -2048,17 +2048,17 @@ abstract public class GeckoApp
     @Override
     public void onPause()
     {
         Log.i(LOGTAG, "pause");
 
         Runnable r = new SessionSnapshotRunnable(null);
         GeckoAppShell.getHandler().post(r);
 
-        GeckoAppShell.sendEventToGecko(new GeckoEvent(GeckoEvent.ACTIVITY_PAUSING));
+        GeckoAppShell.sendEventToGecko(GeckoEvent.createPauseEvent());
         // The user is navigating away from this activity, but nothing
         // has come to the foreground yet; for Gecko, we may want to
         // stop repainting, for example.
 
         // Whatever we do here should be fast, because we're blocking
         // the next activity from showing up until we finish.
 
         // onPause will be followed by either onResume or onStop.
@@ -2106,46 +2106,46 @@ abstract public class GeckoApp
         // without going through onDestroy.
         //
         // We might also get an onRestart after this; not sure what
         // that would mean for Gecko if we were to kill it here.
         // Instead, what we should do here is save prefs, session,
         // etc., and generally mark the profile as 'clean', and then
         // dirty it again if we get an onResume.
 
-        GeckoAppShell.sendEventToGecko(new GeckoEvent(GeckoEvent.ACTIVITY_STOPPING));
+        GeckoAppShell.sendEventToGecko(GeckoEvent.createStoppingEvent());
         super.onStop();
     }
 
     @Override
     public void onRestart()
     {
         Log.i(LOGTAG, "restart");
         super.onRestart();
     }
 
     @Override
     public void onStart()
     {
         Log.w(LOGTAG, "zerdatime " + SystemClock.uptimeMillis() + " - onStart");
 
         Log.i(LOGTAG, "start");
-        GeckoAppShell.sendEventToGecko(new GeckoEvent(GeckoEvent.ACTIVITY_START));
+        GeckoAppShell.sendEventToGecko(GeckoEvent.createStartEvent());
         super.onStart();
     }
 
     @Override
     public void onDestroy()
     {
         Log.i(LOGTAG, "destroy");
 
         // Tell Gecko to shutting down; we'll end up calling System.exit()
         // in onXreExit.
         if (isFinishing())
-            GeckoAppShell.sendEventToGecko(new GeckoEvent(GeckoEvent.ACTIVITY_SHUTDOWN));
+            GeckoAppShell.sendEventToGecko(GeckoEvent.createShutdownEvent());
         
         GeckoAppShell.unregisterGeckoEventListener("DOMContentLoaded", GeckoApp.mAppContext);
         GeckoAppShell.unregisterGeckoEventListener("DOMTitleChanged", GeckoApp.mAppContext);
         GeckoAppShell.unregisterGeckoEventListener("DOMLinkAdded", GeckoApp.mAppContext);
         GeckoAppShell.unregisterGeckoEventListener("DOMWindowClose", GeckoApp.mAppContext);
         GeckoAppShell.unregisterGeckoEventListener("log", GeckoApp.mAppContext);
         GeckoAppShell.unregisterGeckoEventListener("Content:LocationChange", GeckoApp.mAppContext);
         GeckoAppShell.unregisterGeckoEventListener("Content:SecurityChange", GeckoApp.mAppContext);
@@ -2427,17 +2427,17 @@ abstract public class GeckoApp
     @Override
     public void onBackPressed() {
         if (mDoorHangerPopup.isShowing()) {
             mDoorHangerPopup.dismiss();
             return;
         }
 
         if (mDOMFullScreen) {
-            GeckoAppShell.sendEventToGecko(new GeckoEvent("FullScreen:Exit", null));
+            GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("FullScreen:Exit", null));
             return;
         }
 
         Tabs tabs = Tabs.getInstance();
         Tab tab = tabs.getSelectedTab();
         if (tab == null) {
             moveTaskToBack(true);
             return;
@@ -2532,17 +2532,17 @@ abstract public class GeckoApp
                 if (url != null && url.length() > 0)
                     loadRequest(url, type, searchEngine);
             }
             break;
         case CAMERA_CAPTURE_REQUEST:
             Log.i(LOGTAG, "Returning from CAMERA_CAPTURE_REQUEST: " + resultCode);
             File file = new File(Environment.getExternalStorageDirectory(), "cameraCapture-" + Integer.toString(kCaptureIndex) + ".jpg");
             kCaptureIndex++;
-            GeckoEvent e = new GeckoEvent("cameraCaptureDone", resultCode == Activity.RESULT_OK ?
+            GeckoEvent e = GeckoEvent.createBroadcastEvent("cameraCaptureDone", resultCode == Activity.RESULT_OK ?
                                           "{\"ok\": true,  \"path\": \"" + file.getPath() + "\" }" :
                                           "{\"ok\": false, \"path\": \"" + file.getPath() + "\" }");
             GeckoAppShell.sendEventToGecko(e);
             break;
        }
     }
 
     public void doCameraCapture() {
@@ -2563,19 +2563,19 @@ abstract public class GeckoApp
         try {
             args.put("url", url);
             args.put("engine", searchEngine);
         } catch (Exception e) {
             Log.e(LOGTAG, "error building JSON arguments");
         }
         if (type == AwesomeBar.Type.ADD) {
             Log.i(LOGTAG, "Sending message to Gecko: " + SystemClock.uptimeMillis() + " - Tab:Add");
-            GeckoAppShell.sendEventToGecko(new GeckoEvent("Tab:Add", args.toString()));
+            GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Tab:Add", args.toString()));
         } else {
-            GeckoAppShell.sendEventToGecko(new GeckoEvent("Tab:Load", args.toString()));
+            GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Tab:Load", args.toString()));
         }
     }
 
     public void loadUrl(String url, AwesomeBar.Type type) {
         loadRequest(url, type, null);
     }
 
     /**
@@ -2600,47 +2600,47 @@ abstract public class GeckoApp
         JSONObject args = new JSONObject();
         try {
             args.put("url", url);
             args.put("parentId", Tabs.getInstance().getSelectedTab().getId());
         } catch (Exception e) {
             Log.e(LOGTAG, "error building JSON arguments");
         }
         Log.i(LOGTAG, "Sending message to Gecko: " + SystemClock.uptimeMillis() + " - Tab:Add");
-        GeckoAppShell.sendEventToGecko(new GeckoEvent("Tab:Add", args.toString()));
+        GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Tab:Add", args.toString()));
     }
 
     public GeckoSoftwareLayerClient getSoftwareLayerClient() { return mSoftwareLayerClient; }
     public LayerController getLayerController() { return mLayerController; }
 
     // accelerometer
     public void onAccuracyChanged(Sensor sensor, int accuracy)
     {
     }
 
     public void onSensorChanged(SensorEvent event)
     {
         Log.w(LOGTAG, "onSensorChanged "+event);
-        GeckoAppShell.sendEventToGecko(new GeckoEvent(event));
+        GeckoAppShell.sendEventToGecko(GeckoEvent.createSensorEvent(event));
     }
 
     private class GeocoderRunnable implements Runnable {
         Location mLocation;
         GeocoderRunnable (Location location) {
             mLocation = location;
         }
         public void run() {
             try {
                 List<Address> addresses = mGeocoder.getFromLocation(mLocation.getLatitude(),
                                                                     mLocation.getLongitude(), 1);
                 // grab the first address.  in the future,
                 // may want to expose multiple, or filter
                 // for best.
                 mLastGeoAddress = addresses.get(0);
-                GeckoAppShell.sendEventToGecko(new GeckoEvent(mLocation, mLastGeoAddress));
+                GeckoAppShell.sendEventToGecko(GeckoEvent.createLocationEvent(mLocation, mLastGeoAddress));
             } catch (Exception e) {
                 Log.w(LOGTAG, "GeocoderTask "+e);
             }
         }
     }
 
     // geolocation
     public void onLocationChanged(Location location)
@@ -2661,17 +2661,17 @@ abstract public class GeckoApp
                                      results);
             // pfm value.  don't want to slam the
             // geocoder with very similar values, so
             // only call after about 100m
             if (results[0] > 100)
                 GeckoAppShell.getHandler().post(new GeocoderRunnable(location));
         }
 
-        GeckoAppShell.sendEventToGecko(new GeckoEvent(location, mLastGeoAddress));
+        GeckoAppShell.sendEventToGecko(GeckoEvent.createLocationEvent(location, mLastGeoAddress));
     }
 
     public void onProviderDisabled(String provider)
     {
     }
 
     public void onProviderEnabled(String provider)
     {
--- a/mobile/android/base/GeckoAppShell.java
+++ b/mobile/android/base/GeckoAppShell.java
@@ -141,17 +141,17 @@ public class GeckoAppShell
         e.printStackTrace(pw);
         pw.flush();
         reportJavaCrash(sw.toString());
     }
 
     private static native void reportJavaCrash(String stackTrace);
 
     public static void notifyUriVisited(String uri) {
-        sendEventToGecko(new GeckoEvent(GeckoEvent.VISITED, uri));
+        sendEventToGecko(GeckoEvent.createVisitedEvent(uri));
     }
 
     public static native void processNextNativeEvent();
 
     public static native void notifyBatteryChange(double aLevel, boolean aCharging, double aRemainingTime);
 
     public static native void notifySmsReceived(String aSender, String aBody, long aTimestamp);
     public static native int  saveMessageInSentbox(String aReceiver, String aBody, long aTimestamp);
@@ -501,17 +501,17 @@ public class GeckoAppShell
         LayerView v = layerController.getView();
         mInputConnection = GeckoInputConnection.create(v);
         v.setInputConnectionHandler(mInputConnection);
 
         layerController.setOnTouchListener(new View.OnTouchListener() {
             public boolean onTouch(View view, MotionEvent event) {
                 if (event == null)
                     return true;
-                GeckoAppShell.sendEventToGecko(new GeckoEvent(event));
+                GeckoAppShell.sendEventToGecko(GeckoEvent.createMotionEvent(event));
                 return true;
             }
         });
 
         layerController.notifyLayerClientOfGeometryChange();
     }
 
     static void sendPendingEventsToGecko() {
@@ -569,18 +569,17 @@ public class GeckoAppShell
         });
     }
 
     private static CountDownLatch sGeckoPendingAcks = null;
 
     // Block the current thread until the Gecko event loop is caught up
     synchronized public static void geckoEventSync() {
         sGeckoPendingAcks = new CountDownLatch(1);
-        GeckoAppShell.sendEventToGecko(
-            new GeckoEvent(GeckoEvent.GECKO_EVENT_SYNC));
+        GeckoAppShell.sendEventToGecko(GeckoEvent.createSyncEvent());
         while (sGeckoPendingAcks.getCount() != 0) {
             try {
                 sGeckoPendingAcks.await();
             } catch(InterruptedException e) {}
         }
         sGeckoPendingAcks = null;
     }
 
@@ -1858,17 +1857,17 @@ public class GeckoAppShell
         event.setContentDescription(description);
         event.getText().add(text);
 
         accessibilityManager.sendAccessibilityEvent(event);
     }
 
     public static void viewSizeChanged() {
         if (mInputConnection != null && mInputConnection.isIMEEnabled()) {
-            sendEventToGecko(new GeckoEvent("ScrollTo:FocusedInput", ""));
+            sendEventToGecko(GeckoEvent.createBroadcastEvent("ScrollTo:FocusedInput", ""));
         }
     }
 
     public static double[] getCurrentNetworkInformation() {
         return GeckoNetworkManager.getInstance().getCurrentInformation();
     }
 
     public static void enableNetworkNotifications() {
--- a/mobile/android/base/GeckoEvent.java
+++ b/mobile/android/base/GeckoEvent.java
@@ -59,39 +59,39 @@ import android.util.Log;
 /* We're not allowed to hold on to most events given to us
  * so we save the parts of the events we want to use in GeckoEvent.
  * Fields have different meanings depending on the event type.
  */
 
 public class GeckoEvent {
     private static final String LOGTAG = "GeckoEvent";
 
-    public static final int INVALID = -1;
-    public static final int NATIVE_POKE = 0;
-    public static final int KEY_EVENT = 1;
-    public static final int MOTION_EVENT = 2;
-    public static final int ORIENTATION_EVENT = 3;
-    public static final int ACCELERATION_EVENT = 4;
-    public static final int LOCATION_EVENT = 5;
-    public static final int IME_EVENT = 6;
-    public static final int DRAW = 7;
-    public static final int SIZE_CHANGED = 8;
-    public static final int ACTIVITY_STOPPING = 9;
-    public static final int ACTIVITY_PAUSING = 10;
-    public static final int ACTIVITY_SHUTDOWN = 11;
-    public static final int LOAD_URI = 12;
-    public static final int SURFACE_CREATED = 13;
-    public static final int SURFACE_DESTROYED = 14;
-    public static final int GECKO_EVENT_SYNC = 15;
-    public static final int ACTIVITY_START = 17;
-    public static final int BROADCAST = 19;
-    public static final int VIEWPORT = 20;
-    public static final int VISITED = 21;
-    public static final int NETWORK_CHANGED = 22;
-    public static final int PROXIMITY_EVENT = 23;
+    private static final int INVALID = -1;
+    private static final int NATIVE_POKE = 0;
+    private static final int KEY_EVENT = 1;
+    private static final int MOTION_EVENT = 2;
+    private static final int ORIENTATION_EVENT = 3;
+    private static final int ACCELERATION_EVENT = 4;
+    private static final int LOCATION_EVENT = 5;
+    private static final int IME_EVENT = 6;
+    private static final int DRAW = 7;
+    private static final int SIZE_CHANGED = 8;
+    private static final int ACTIVITY_STOPPING = 9;
+    private static final int ACTIVITY_PAUSING = 10;
+    private static final int ACTIVITY_SHUTDOWN = 11;
+    private static final int LOAD_URI = 12;
+    private static final int SURFACE_CREATED = 13;
+    private static final int SURFACE_DESTROYED = 14;
+    private static final int GECKO_EVENT_SYNC = 15;
+    private static final int ACTIVITY_START = 17;
+    private static final int BROADCAST = 19;
+    private static final int VIEWPORT = 20;
+    private static final int VISITED = 21;
+    private static final int NETWORK_CHANGED = 22;
+    private static final int PROXIMITY_EVENT = 23;
 
     public static final int IME_COMPOSITION_END = 0;
     public static final int IME_COMPOSITION_BEGIN = 1;
     public static final int IME_SET_TEXT = 2;
     public static final int IME_GET_TEXT = 3;
     public static final int IME_DELETE_TEXT = 4;
     public static final int IME_SET_SELECTION = 5;
     public static final int IME_GET_SELECTION = 6;
@@ -102,17 +102,17 @@ public class GeckoEvent {
     public static final int IME_RANGE_SELECTEDRAWTEXT = 3;
     public static final int IME_RANGE_CONVERTEDTEXT = 4;
     public static final int IME_RANGE_SELECTEDCONVERTEDTEXT = 5;
 
     public static final int IME_RANGE_UNDERLINE = 1;
     public static final int IME_RANGE_FORECOLOR = 2;
     public static final int IME_RANGE_BACKCOLOR = 4;
 
-    public int mType;
+    final public int mType;
     public int mAction;
     public long mTime;
     public Point[] mPoints;
     public int[] mPointIndicies;
     public int mPointerIndex; // index of the point that has changed
     public float[] mOrientations;
     public float[] mPressures;
     public Point[] mPointRadii;
@@ -130,37 +130,63 @@ public class GeckoEvent {
     public Location mLocation;
     public Address  mAddress;
 
     public double mBandwidth;
     public boolean mCanBeMetered;
 
     public int mNativeWindow;
 
-    public GeckoEvent() {
-        mType = NATIVE_POKE;
-    }
-
-    public GeckoEvent(int evType) {
+    private GeckoEvent(int evType) {
         mType = evType;
     }
 
-    public GeckoEvent(KeyEvent k) {
-        mType = KEY_EVENT;
+    public static GeckoEvent createPauseEvent() {
+        return new GeckoEvent(ACTIVITY_PAUSING);
+    }
+
+    public static GeckoEvent createStoppingEvent() {
+        return new GeckoEvent(ACTIVITY_STOPPING);
+    }
+
+    public static GeckoEvent createStartEvent() {
+        return new GeckoEvent(ACTIVITY_START);
+    }
+
+    public static GeckoEvent createShutdownEvent() {
+        return new GeckoEvent(ACTIVITY_SHUTDOWN);
+    }
+
+    public static GeckoEvent createSyncEvent() {
+        return new GeckoEvent(GECKO_EVENT_SYNC);
+    }
+
+    public static GeckoEvent createKeyEvent(KeyEvent k) {
+        GeckoEvent event = new GeckoEvent(KEY_EVENT);
+        event.initKeyEvent(k);
+        return event;
+    }
+
+    private void initKeyEvent(KeyEvent k) {
         mAction = k.getAction();
         mTime = k.getEventTime();
         mMetaState = k.getMetaState();
         mFlags = k.getFlags();
         mKeyCode = k.getKeyCode();
         mUnicodeChar = k.getUnicodeChar();
         mCharacters = k.getCharacters();
     }
 
-    public GeckoEvent(MotionEvent m) {
-        mType = MOTION_EVENT;
+    public static GeckoEvent createMotionEvent(MotionEvent m) {
+        GeckoEvent event = new GeckoEvent(MOTION_EVENT);
+        event.initMotionEvent(m);
+        return event;
+    }
+
+    private void initMotionEvent(MotionEvent m) {
         mAction = m.getAction();
         mTime = (System.currentTimeMillis() - SystemClock.elapsedRealtime()) + m.getEventTime();
         mMetaState = m.getMetaState();
 
         switch (mAction & MotionEvent.ACTION_MASK) {
             case MotionEvent.ACTION_CANCEL:
             case MotionEvent.ACTION_UP:
             case MotionEvent.ACTION_POINTER_UP:
@@ -233,130 +259,131 @@ public class GeckoEvent {
             mPressures[index] = event.getPressure(eventIndex);
         } catch(Exception ex) {
             Log.e(LOGTAG, "Error creating motion point " + index, ex);
             mPointRadii[index] = new Point(0, 0);
             mPoints[index] = new Point(0, 0);
         }
     }
 
-    public GeckoEvent(SensorEvent s) {
+    public static GeckoEvent createSensorEvent(SensorEvent s) {
+        GeckoEvent event = null;
         int sensor_type = s.sensor.getType();
  
         switch(sensor_type) {
         case Sensor.TYPE_ACCELEROMETER:
-            mType = ACCELERATION_EVENT;
-            mX = s.values[0];
-            mY = s.values[1];
-            mZ = s.values[2];
+            event = new GeckoEvent(ACCELERATION_EVENT);
+            event.mX = s.values[0];
+            event.mY = s.values[1];
+            event.mZ = s.values[2];
             break;
             
         case Sensor.TYPE_ORIENTATION:
-            mType = ORIENTATION_EVENT;
-            mAlpha = -s.values[0];
-            mBeta = -s.values[1];
-            mGamma = -s.values[2];
-            Log.i(LOGTAG, "SensorEvent type = " + s.sensor.getType() + " " + s.sensor.getName() + " " + mAlpha + " " + mBeta + " " + mGamma );
+            event = new GeckoEvent(ORIENTATION_EVENT);
+            event.mAlpha = -s.values[0];
+            event.mBeta = -s.values[1];
+            event.mGamma = -s.values[2];
             break;
 
         case Sensor.TYPE_PROXIMITY:
-            mType = PROXIMITY_EVENT;
-            mDistance = s.values[0];
-            Log.i("GeckoEvent", "SensorEvent type = " + s.sensor.getType() + 
-                  " " + s.sensor.getName() + " " + mDistance);
+            event = new GeckoEvent(PROXIMITY_EVENT);
+            event.mDistance = s.values[0];
             break;
         }
+        return event;
     }
 
-    public GeckoEvent(Location l, Address a) {
-        mType = LOCATION_EVENT;
-        mLocation = l;
-        mAddress  = a;
+    public static GeckoEvent createLocationEvent(Location l, Address a) {
+        GeckoEvent event = new GeckoEvent(LOCATION_EVENT);
+        event.mLocation = l;
+        event.mAddress  = a;
+        return event;
     }
 
-    public GeckoEvent(int imeAction, int offset, int count) {
-        mType = IME_EVENT;
-        mAction = imeAction;
-        mOffset = offset;
-        mCount = count;
+    public static GeckoEvent createIMEEvent(int imeAction, int offset, int count) {
+        GeckoEvent event = new GeckoEvent(IME_EVENT);
+        event.mAction = imeAction;
+        event.mOffset = offset;
+        event.mCount = count;
+        return event;
     }
 
     private void InitIMERange(int action, int offset, int count,
                               int rangeType, int rangeStyles,
                               int rangeForeColor, int rangeBackColor) {
-        mType = IME_EVENT;
         mAction = action;
         mOffset = offset;
         mCount = count;
         mRangeType = rangeType;
         mRangeStyles = rangeStyles;
         mRangeForeColor = rangeForeColor;
         mRangeBackColor = rangeBackColor;
         return;
     }
     
-    public GeckoEvent(int offset, int count,
-                      int rangeType, int rangeStyles,
-                      int rangeForeColor, int rangeBackColor, String text) {
-        InitIMERange(IME_SET_TEXT, offset, count, rangeType, rangeStyles,
-                     rangeForeColor, rangeBackColor);
-        mCharacters = text;
+    public static GeckoEvent createIMERangeEvent(int offset, int count,
+                                                 int rangeType, int rangeStyles,
+                                                 int rangeForeColor, int rangeBackColor,
+                                                 String text) {
+        GeckoEvent event = new GeckoEvent(IME_EVENT);
+        event.InitIMERange(IME_SET_TEXT, offset, count, rangeType, rangeStyles,
+                           rangeForeColor, rangeBackColor);
+        event.mCharacters = text;
+        return event;
     }
 
-    public GeckoEvent(int offset, int count,
-                      int rangeType, int rangeStyles,
-                      int rangeForeColor, int rangeBackColor) {
-        InitIMERange(IME_ADD_RANGE, offset, count, rangeType, rangeStyles,
-                     rangeForeColor, rangeBackColor);
+    public static GeckoEvent createIMERangeEvent(int offset, int count,
+                                                 int rangeType, int rangeStyles,
+                                                 int rangeForeColor, int rangeBackColor) {
+        GeckoEvent event = new GeckoEvent(IME_EVENT);
+        event.InitIMERange(IME_SET_TEXT, offset, count, rangeType, rangeStyles,
+                           rangeForeColor, rangeBackColor);
+        return event;
     }
 
-    public GeckoEvent(int etype, Rect rect) {
-        if (etype != DRAW) {
-            mType = INVALID;
-            return;
-        }
-
-        mType = etype;
-        mRect = rect;
+    public static GeckoEvent createDrawEvent(Rect rect) {
+        GeckoEvent event = new GeckoEvent(DRAW);
+        event.mRect = rect;
+        return event;
     }
 
-    public GeckoEvent(int etype, int w, int h, int screenw, int screenh, int tilew, int tileh) {
-        if (etype != SIZE_CHANGED) {
-            mType = INVALID;
-            return;
-        }
-
-        mType = etype;
-
-        mPoints = new Point[3];
-        mPoints[0] = new Point(w, h);
-        mPoints[1] = new Point(screenw, screenh);
-        mPoints[2] = new Point(tilew, tileh);
+    public static GeckoEvent createSizeChangedEvent(int w, int h, int screenw, int screenh, int tilew, int tileh) {
+        GeckoEvent event = new GeckoEvent(SIZE_CHANGED);
+        event.mPoints = new Point[3];
+        event.mPoints[0] = new Point(w, h);
+        event.mPoints[1] = new Point(screenw, screenh);
+        event.mPoints[2] = new Point(tilew, tileh);
+        return event;
     }
 
-    public GeckoEvent(String subject, String data) {
-        mType = BROADCAST;
-        mCharacters = subject;
-        mCharactersExtra = data;
+    public static GeckoEvent createBroadcastEvent(String subject, String data) {
+        GeckoEvent event = new GeckoEvent(BROADCAST);
+        event.mCharacters = subject;
+        event.mCharactersExtra = data;
+        return event;
     }
 
-    public GeckoEvent(ViewportMetrics viewport) {
-        mType = VIEWPORT;
-        mCharacters = "Viewport:Change";
-        mCharactersExtra = viewport.toJSON();
+    public static GeckoEvent createViewportEvent(ViewportMetrics viewport) {
+        GeckoEvent event = new GeckoEvent(VIEWPORT);
+        event.mCharacters = "Viewport:Change";
+        event.mCharactersExtra = viewport.toJSON();
+        return event;
     }
 
-    public GeckoEvent(String uri) {
-        mType = LOAD_URI;
-        mCharacters = uri;
+    public static GeckoEvent createLoadEvent(String uri) {
+        GeckoEvent event = new GeckoEvent(LOAD_URI);
+        event.mCharacters = uri;
+        return event;
     }
 
-    public GeckoEvent(int type, String data) {
-        mType = type;
-        mCharacters = data;
+    public static GeckoEvent createVisitedEvent(String data) {
+        GeckoEvent event = new GeckoEvent(VISITED);
+        event.mCharacters = data;
+        return event;
     }
 
-    public GeckoEvent(double bandwidth, boolean canBeMetered) {
-        mType = NETWORK_CHANGED;
-        mBandwidth = bandwidth;
-        mCanBeMetered = canBeMetered;
+    public static GeckoEvent createNetworkEvent(double bandwidth, boolean canBeMetered) {
+        GeckoEvent event = new GeckoEvent(NETWORK_CHANGED);
+        event.mBandwidth = bandwidth;
+        event.mCanBeMetered = canBeMetered;
+        return event;
     }
 }
--- a/mobile/android/base/GeckoInputConnection.java
+++ b/mobile/android/base/GeckoInputConnection.java
@@ -154,19 +154,19 @@ public class GeckoInputConnection
                 setSelection(0, text.length());
                 break;
             case R.id.cut:
                 // Fill the clipboard
                 GeckoAppShell.setClipboardText(text);
                 // If selection is empty, we'll select everything
                 if (a >= b)
                     GeckoAppShell.sendEventToGecko(
-                        new GeckoEvent(GeckoEvent.IME_SET_SELECTION, 0, text.length()));
+                        GeckoEvent.createIMEEvent(GeckoEvent.IME_SET_SELECTION, 0, text.length()));
                 GeckoAppShell.sendEventToGecko(
-                    new GeckoEvent(GeckoEvent.IME_DELETE_TEXT, 0, 0));
+                    GeckoEvent.createIMEEvent(GeckoEvent.IME_DELETE_TEXT, 0, 0));
                 break;
             case R.id.paste:
                 commitText(GeckoAppShell.getClipboardText(), 1);
                 break;
             case R.id.copy:
                 // If there is no selection set, we must be doing "Copy All",
                 // otherwise get the selection
                 if (a < b)
@@ -217,17 +217,17 @@ public class GeckoInputConnection
             return null;
         }
         return extract;
     }
 
     @Override
     public boolean setSelection(int start, int end) {
         GeckoAppShell.sendEventToGecko(
-            new GeckoEvent(GeckoEvent.IME_SET_SELECTION, start, end - start));
+            GeckoEvent.createIMEEvent(GeckoEvent.IME_SET_SELECTION, start, end - start));
 
         return super.setSelection(start, end);
     }
 
     @Override
     public boolean setComposingText(CharSequence text, int newCursorPosition) {
         replaceText(text, newCursorPosition, true);
         return true;
@@ -454,45 +454,45 @@ public class GeckoInputConnection
         if (mComposing && mCompositionStart != start) {
             // Changed range is different from the composition, need to reset the composition
             endComposition();
         }
 
         if (!mComposing) {
             if (DEBUG) Log.d(LOGTAG, ". . . onTextChanged: IME_COMPOSITION_BEGIN");
             GeckoAppShell.sendEventToGecko(
-                new GeckoEvent(GeckoEvent.IME_COMPOSITION_BEGIN, 0, 0));
+                GeckoEvent.createIMEEvent(GeckoEvent.IME_COMPOSITION_BEGIN, 0, 0));
             mComposing = true;
             mCompositionStart = start;
 
             if (DEBUG) Log.d(LOGTAG, ". . . onTextChanged: IME_SET_SELECTION, start=" + start + ", len=" + before);
             GeckoAppShell.sendEventToGecko(
-                new GeckoEvent(GeckoEvent.IME_SET_SELECTION, start, before));
+                GeckoEvent.createIMEEvent(GeckoEvent.IME_SET_SELECTION, start, before));
         }
 
         if (count == 0) {
             if (DEBUG) Log.d(LOGTAG, ". . . onTextChanged: IME_DELETE_TEXT");
             GeckoAppShell.sendEventToGecko(
-                new GeckoEvent(GeckoEvent.IME_DELETE_TEXT, 0, 0));
+                GeckoEvent.createIMEEvent(GeckoEvent.IME_DELETE_TEXT, 0, 0));
         } else {
             sendTextToGecko(s.subSequence(start, start + count), start + count);
         }
 
         if (DEBUG) Log.d(LOGTAG, ". . . onTextChanged: IME_SET_SELECTION, start=" + (start + count) + ", 0");
         GeckoAppShell.sendEventToGecko(
-            new GeckoEvent(GeckoEvent.IME_SET_SELECTION, start + count, 0));
+            GeckoEvent.createIMEEvent(GeckoEvent.IME_SET_SELECTION, start + count, 0));
 
         // Block this thread until all pending events are processed
         GeckoAppShell.geckoEventSync();
     }
 
     private void endComposition() {
         if (DEBUG) Log.d(LOGTAG, "IME: endComposition: IME_COMPOSITION_END");
         GeckoAppShell.sendEventToGecko(
-            new GeckoEvent(GeckoEvent.IME_COMPOSITION_END, 0, 0));
+            GeckoEvent.createIMEEvent(GeckoEvent.IME_COMPOSITION_END, 0, 0));
         mComposing = false;
         mCompositionStart = -1;
     }
 
     private void sendTextToGecko(CharSequence text, int caretPos) {
         if (DEBUG) Log.d(LOGTAG, "IME: sendTextToGecko(\"" + text + "\")");
 
         // Handle composition text styles
@@ -536,37 +536,37 @@ public class GeckoInputConnection
                     }
                 }
 
                 // Add range to array, the actual styles are
                 //  applied when IME_SET_TEXT is sent
                 if (DEBUG) Log.d(LOGTAG, String.format(". . . sendTextToGecko: IME_ADD_RANGE, %d, %d, %d, %d, %d, %d",
                                                        spanStart, spanEnd - spanStart, rangeType, rangeStyles, rangeForeColor, rangeBackColor));
                 GeckoAppShell.sendEventToGecko(
-                    new GeckoEvent(spanStart, spanEnd - spanStart,
-                                   rangeType, rangeStyles,
-                                   rangeForeColor, rangeBackColor));
+                    GeckoEvent.createIMERangeEvent(spanStart, spanEnd - spanStart,
+                                                  rangeType, rangeStyles,
+                                                  rangeForeColor, rangeBackColor));
 
                 spanStart = spanEnd;
             } while (spanStart < text.length());
         } else {
             if (DEBUG) Log.d(LOGTAG, ". . . sendTextToGecko: IME_ADD_RANGE, 0, " + text.length() +
                                      ", IME_RANGE_RAWINPUT, IME_RANGE_UNDERLINE)");
             GeckoAppShell.sendEventToGecko(
-                new GeckoEvent(0, text == null ? 0 : text.length(),
-                               GeckoEvent.IME_RANGE_RAWINPUT,
-                               GeckoEvent.IME_RANGE_UNDERLINE, 0, 0));
+                GeckoEvent.createIMERangeEvent(0, text == null ? 0 : text.length(),
+                                               GeckoEvent.IME_RANGE_RAWINPUT,
+                                               GeckoEvent.IME_RANGE_UNDERLINE, 0, 0));
         }
 
         // Change composition (treating selection end as where the caret is)
         if (DEBUG) Log.d(LOGTAG, ". . . sendTextToGecko: IME_SET_TEXT, IME_RANGE_CARETPOSITION, \"" + text + "\")");
         GeckoAppShell.sendEventToGecko(
-            new GeckoEvent(caretPos, 0,
-                           GeckoEvent.IME_RANGE_CARETPOSITION, 0, 0, 0,
-                           text.toString()));
+            GeckoEvent.createIMERangeEvent(caretPos, 0,
+                                           GeckoEvent.IME_RANGE_CARETPOSITION, 0, 0, 0,
+                                           text.toString()));
     }
 
     public void afterTextChanged(Editable s)
     {
     }
 
     public void beforeTextChanged(CharSequence s, int start, int count, int after)
     {
@@ -678,19 +678,19 @@ public class GeckoInputConnection
                 keyCode == KeyEvent.KEYCODE_TAB ||
                 (event.getFlags() & KeyEvent.FLAG_SOFT_KEYBOARD) != 0 ||
                 !mKeyListener.onKeyDown(v, mEditable, keyCode, event)) {
             // Make sure selection in Gecko is up-to-date
             final Editable content = getEditable();
             int a = Selection.getSelectionStart(content);
             int b = Selection.getSelectionEnd(content);
             GeckoAppShell.sendEventToGecko(
-                new GeckoEvent(GeckoEvent.IME_SET_SELECTION, a, b - a));
+                GeckoEvent.createIMEEvent(GeckoEvent.IME_SET_SELECTION, a, b - a));
 
-            GeckoAppShell.sendEventToGecko(new GeckoEvent(event));
+            GeckoAppShell.sendEventToGecko(GeckoEvent.createKeyEvent(event));
         }
         return true;
     }
 
     public boolean onKeyUp(int keyCode, KeyEvent event) {
         return processKeyUp(keyCode, event, false);
     }
 
@@ -713,22 +713,22 @@ public class GeckoInputConnection
 
         View v = GeckoApp.mAppContext.getLayerController().getView();
 
         if (mIMEState == IME_STATE_DISABLED ||
             keyCode == KeyEvent.KEYCODE_ENTER ||
             keyCode == KeyEvent.KEYCODE_DEL ||
             (event.getFlags() & KeyEvent.FLAG_SOFT_KEYBOARD) != 0 ||
             !mKeyListener.onKeyUp(v, mEditable, keyCode, event))
-            GeckoAppShell.sendEventToGecko(new GeckoEvent(event));
+            GeckoAppShell.sendEventToGecko(GeckoEvent.createKeyEvent(event));
         return true;
     }
 
     public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) {
-        GeckoAppShell.sendEventToGecko(new GeckoEvent(event));
+        GeckoAppShell.sendEventToGecko(GeckoEvent.createKeyEvent(event));
         return true;
     }
 
     public boolean onKeyLongPress(int keyCode, KeyEvent event) {
         View v = GeckoApp.mAppContext.getLayerController().getView();
         switch (keyCode) {
             case KeyEvent.KEYCODE_MENU:
                 InputMethodManager imm = (InputMethodManager)
--- a/mobile/android/base/GeckoNetworkManager.java
+++ b/mobile/android/base/GeckoNetworkManager.java
@@ -181,18 +181,19 @@ public class GeckoNetworkManager
   private void updateNetworkType() {
     NetworkType previousNetworkType = mNetworkType;
     mNetworkType = getNetworkType();
 
     if (mNetworkType == previousNetworkType || !mShouldNotify) {
       return;
     }
 
-    GeckoAppShell.sendEventToGecko(new GeckoEvent(getNetworkSpeed(mNetworkType),
-                                                  isNetworkUsuallyMetered(mNetworkType)));
+    GeckoAppShell.sendEventToGecko(GeckoEvent.createNetworkEvent(
+                                       getNetworkSpeed(mNetworkType),
+                                       isNetworkUsuallyMetered(mNetworkType)));
   }
 
   public double[] getCurrentInformation() {
     return new double[] { getNetworkSpeed(mNetworkType),
                           isNetworkUsuallyMetered(mNetworkType) ? 1.0 : 0.0 };
   }
 
   public void enableNotifications() {
--- a/mobile/android/base/GeckoPreferences.java
+++ b/mobile/android/base/GeckoPreferences.java
@@ -74,19 +74,16 @@ public class GeckoPreferences
     private ArrayList<String> mPreferencesList = new ArrayList<String>();
     private PreferenceScreen mPreferenceScreen;
     private static boolean sIsCharEncodingEnabled = false;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
-        if (Build.VERSION.SDK_INT >= 11)
-            GeckoActionBar.setDisplayHomeAsUpEnabled(this, true);
-
         addPreferencesFromResource(R.xml.preferences);
         mPreferenceScreen = getPreferenceScreen();
         GeckoAppShell.registerGeckoEventListener("Preferences:Data", this);
         initGroups(mPreferenceScreen);
         initValues();
     }
 
     @Override
@@ -105,17 +102,17 @@ public class GeckoPreferences
             Log.e(LOGTAG, "Exception handling message \"" + event + "\":", e);
         }
     }
 
     // Initialize preferences by sending the "Preferences:Get" command to Gecko
     private void initValues() {
         JSONArray jsonPrefs = new JSONArray(mPreferencesList);
 
-        GeckoEvent event = new GeckoEvent("Preferences:Get", jsonPrefs.toString());
+        GeckoEvent event = GeckoEvent.createBroadcastEvent("Preferences:Get", jsonPrefs.toString());
         GeckoAppShell.sendEventToGecko(event);
     }
 
     private void initGroups(PreferenceGroup preferences) {
         final int count = preferences.getPreferenceCount();
         for (int i = 0; i < count; i++) {
             Preference pref = preferences.getPreference(i);
             if (pref instanceof PreferenceGroup)
@@ -224,17 +221,17 @@ public class GeckoPreferences
                        .setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() {  
                             public void onClick(DialogInterface dialog, int which) {
                                 JSONObject jsonPref = new JSONObject();
                                 try {
                                     jsonPref.put("name", "privacy.masterpassword.enabled");
                                     jsonPref.put("type", "string");
                                     jsonPref.put("value", input1.getText().toString());
                     
-                                    GeckoEvent event = new GeckoEvent("Preferences:Set", jsonPref.toString());
+                                    GeckoEvent event = GeckoEvent.createBroadcastEvent("Preferences:Set", jsonPref.toString());
                                     GeckoAppShell.sendEventToGecko(event);
                                 } catch(Exception ex) {
                                     Log.e(LOGTAG, "Error setting masterpassword", ex);
                                 }
                                 return;
                             }
                         })
                         .setNegativeButton(R.string.button_cancel, new DialogInterface.OnClickListener() {  
@@ -265,17 +262,17 @@ public class GeckoPreferences
                        .setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() {  
                             public void onClick(DialogInterface dialog, int which) {
                                 try {
                                     JSONObject jsonPref = new JSONObject();
                                     jsonPref.put("name", "privacy.masterpassword.enabled");
                                     jsonPref.put("type", "string");
                                     jsonPref.put("value", input.getText().toString());
                         
-                                    GeckoEvent event = new GeckoEvent("Preferences:Set", jsonPref.toString());
+                                    GeckoEvent event = GeckoEvent.createBroadcastEvent("Preferences:Set", jsonPref.toString());
                                     GeckoAppShell.sendEventToGecko(event);
                                 } catch(Exception ex) {
                                     Log.e(LOGTAG, "Error setting masterpassword", ex);
                                 }
                                 return;
                             }
                         })
                         .setNegativeButton(R.string.button_cancel, new DialogInterface.OnClickListener() {  
@@ -364,15 +361,15 @@ public class GeckoPreferences
                 jsonPref.put("type", "int");
                 jsonPref.put("value", ((Integer)value).intValue());
             }
             else {
                 jsonPref.put("type", "string");
                 jsonPref.put("value", String.valueOf(value));
             }
 
-            GeckoEvent event = new GeckoEvent("Preferences:Set", jsonPref.toString());
+            GeckoEvent event = GeckoEvent.createBroadcastEvent("Preferences:Set", jsonPref.toString());
             GeckoAppShell.sendEventToGecko(event);
         } catch (JSONException e) {
             Log.e(LOGTAG, "JSON exception: ", e);
         }
     }
 }
--- a/mobile/android/base/Tab.java
+++ b/mobile/android/base/Tab.java
@@ -371,45 +371,45 @@ public final class Tab {
 
     public void removeBookmark() {
         new RemoveBookmarkTask().execute();
     }
 
     public boolean doReload() {
         if (mHistory.isEmpty())
             return false;
-        GeckoEvent e = new GeckoEvent("Session:Reload", "");
+        GeckoEvent e = GeckoEvent.createBroadcastEvent("Session:Reload", "");
         GeckoAppShell.sendEventToGecko(e);
         return true;
     }
 
     public boolean doBack() {
         if (mHistoryIndex < 1) {
             return false;
         }
-        GeckoEvent e = new GeckoEvent("Session:Back", "");
+        GeckoEvent e = GeckoEvent.createBroadcastEvent("Session:Back", "");
         GeckoAppShell.sendEventToGecko(e);
         return true;
     }
 
     public boolean doStop() {
-        GeckoEvent e = new GeckoEvent("Session:Stop", "");
+        GeckoEvent e = GeckoEvent.createBroadcastEvent("Session:Stop", "");
         GeckoAppShell.sendEventToGecko(e);
         return true;
     }
 
     public boolean canDoForward() {
         return (mHistoryIndex + 1 < mHistory.size());
     }
 
     public boolean doForward() {
         if (mHistoryIndex + 1 >= mHistory.size()) {
             return false;
         }
-        GeckoEvent e = new GeckoEvent("Session:Forward", "");
+        GeckoEvent e = GeckoEvent.createBroadcastEvent("Session:Forward", "");
         GeckoAppShell.sendEventToGecko(e);
         return true;
     }
 
     public void addDoorHanger(String value, DoorHanger dh) {
         mDoorHangers.put(value, dh);
     }
 
--- a/mobile/android/base/Tabs.java
+++ b/mobile/android/base/Tabs.java
@@ -140,17 +140,17 @@ public class Tabs implements GeckoEventL
 
                     if (oldTab != null)
                         GeckoApp.mAppContext.hidePlugins(oldTab, true);
                 }
             }
         });
 
         // Pass a message to Gecko to update tab state in BrowserApp
-        GeckoAppShell.sendEventToGecko(new GeckoEvent("Tab:Selected", String.valueOf(tab.getId())));
+        GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Tab:Selected", String.valueOf(tab.getId())));
         return selectedTab = tab;
     }
 
     public int getIndexOf(Tab tab) {
         return order.lastIndexOf(tab);
     }
 
     public Tab getTabAt(int index) {
@@ -203,17 +203,17 @@ public class Tabs implements GeckoEventL
                 GeckoApp.mAppContext.onTabsChanged(closedTab);
                 GeckoApp.mBrowserToolbar.updateTabCountAndAnimate(Tabs.getInstance().getCount());
                 GeckoApp.mDoorHangerPopup.updatePopup();
                 GeckoApp.mAppContext.hidePlugins(closedTab, true);
             }
         });
 
         // Pass a message to Gecko to update tab state in BrowserApp
-        GeckoAppShell.sendEventToGecko(new GeckoEvent("Tab:Closed", String.valueOf(tabId)));
+        GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Tab:Closed", String.valueOf(tabId)));
     }
 
     /** Return the tab that will be selected by default after this one is closed */
     public Tab getNextTab(Tab tab) {
         Tab selectedTab = getSelectedTab();
         if (selectedTab != tab)
             return selectedTab;
 
--- a/mobile/android/base/TabsTray.java
+++ b/mobile/android/base/TabsTray.java
@@ -74,20 +74,16 @@ public class TabsTray extends Activity i
     private static final int TABS_ADD_TAB_HEIGHT = 50;
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
         setContentView(R.layout.tabs_tray);
 
-        if (Build.VERSION.SDK_INT >= 11) {
-            GeckoActionBar.hide(this);
-        }
-
         mWaitingForClose = false;
 
         mList = (ListView) findViewById(R.id.list);
         mListContainer = (TabsListContainer) findViewById(R.id.list_container);
 
         LinearLayout addTab = (LinearLayout) findViewById(R.id.add_tab);
         addTab.setOnClickListener(new Button.OnClickListener() {
             public void onClick(View v) {
@@ -150,29 +146,29 @@ public class TabsTray extends Activity i
         }
         
         int position = mTabsAdapter.getPositionForTab(tab);
         if (position == -1)
             return;
 
         if (Tabs.getInstance().getIndexOf(tab) == -1) {
             mWaitingForClose = false;
-            mTabsAdapter = new TabsAdapter(this, Tabs.getInstance().getTabsInOrder());
-            mList.setAdapter(mTabsAdapter);
+            mTabsAdapter.removeTab(tab);
+            mList.invalidateViews();
             mListContainer.requestLayout();
         } else {
             View view = mList.getChildAt(position - mList.getFirstVisiblePosition());
             mTabsAdapter.assignValues(view, tab);
         }
     }
 
     void finishActivity() {
         finish();
         overridePendingTransition(0, R.anim.shrink_fade_out);
-        GeckoAppShell.sendEventToGecko(new GeckoEvent("Tab:Screenshot:Cancel",""));
+        GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Tab:Screenshot:Cancel",""));
     }
 
     // Tabs List Container holds the ListView and the New Tab button
     public static class TabsListContainer extends LinearLayout {
         public TabsListContainer(Context context, AttributeSet attrs) {
             super(context, attrs);
         }
 
@@ -249,16 +245,20 @@ public class TabsTray extends Activity i
 
         public int getPositionForTab(Tab tab) {
             if (mTabs == null || tab == null)
                 return -1;
 
             return mTabs.indexOf(tab);
         }
 
+        public void removeTab(Tab tab) {
+            mTabs.remove(tab);
+        }
+
         public void assignValues(View view, Tab tab) {
             if (view == null || tab == null)
                 return;
 
             ImageView thumbnail = (ImageView) view.findViewById(R.id.thumbnail);
 
             Drawable thumbnailImage = tab.getThumbnail();
             if (thumbnailImage != null)
--- a/mobile/android/base/db/PasswordsProvider.java.in
+++ b/mobile/android/base/db/PasswordsProvider.java.in
@@ -119,17 +119,17 @@ public class PasswordsProvider extends C
                 if (!GeckoApp.checkLaunchState(GeckoApp.LaunchState.GeckoRunning)) {
                     mBridge = null;
                     throw new UnsupportedOperationException("Need to launch Gecko to set password database up");
                 }
             }
             if (dbNeedsSetup) {
                 Log.i(LOGTAG, "Sending init to gecko");
                 mBridge = null;
-                GeckoAppShell.sendEventToGecko(new GeckoEvent("Passwords:Init", databasePath));
+                GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Passwords:Init", databasePath));
             }
         } catch(SQLiteBridgeException ex) {
             Log.e(LOGTAG, "Error getting database", ex);
         }
         return mBridge;
     }
 
     private SQLiteBridge getDatabaseForProfile(String profile) {
--- a/mobile/android/base/gfx/GeckoSoftwareLayerClient.java
+++ b/mobile/android/base/gfx/GeckoSoftwareLayerClient.java
@@ -462,20 +462,19 @@ public class GeckoSoftwareLayerClient ex
 
             // Round to next power of two until we have NPOT texture support, respecting maximum texture size
             bufferSize = new IntSize(Math.min(maxSize, IntSize.nextPowerOfTwo(mScreenSize.width + LayerController.MIN_BUFFER.width)),
                                      Math.min(maxSize, IntSize.nextPowerOfTwo(mScreenSize.height + LayerController.MIN_BUFFER.height)));
             tileSize = new IntSize(0, 0);
         }
 
         Log.i(LOGTAG, "Screen-size changed to " + mScreenSize);
-        GeckoEvent event = new GeckoEvent(GeckoEvent.SIZE_CHANGED,
-                                          bufferSize.width, bufferSize.height,
-                                          metrics.widthPixels, metrics.heightPixels,
-                                          tileSize.width, tileSize.height);
+        GeckoEvent event = GeckoEvent.createSizeChangedEvent(
+            bufferSize.width, bufferSize.height, metrics.widthPixels, 
+            metrics.heightPixels, tileSize.width, tileSize.height);
         GeckoAppShell.sendEventToGecko(event);
     }
 
     @Override
     public void viewportSizeChanged() {
         mViewportSizeChanged = true;
     }
 
@@ -510,32 +509,32 @@ public class GeckoSoftwareLayerClient ex
     private void adjustViewport() {
         ViewportMetrics viewportMetrics =
             new ViewportMetrics(getLayerController().getViewportMetrics());
 
         PointF viewportOffset = viewportMetrics.getOptimumViewportOffset(mBufferSize);
         viewportMetrics.setViewportOffset(viewportOffset);
         viewportMetrics.setViewport(viewportMetrics.getClampedViewport());
 
-        GeckoAppShell.sendEventToGecko(new GeckoEvent(viewportMetrics));
+        GeckoAppShell.sendEventToGecko(GeckoEvent.createViewportEvent(viewportMetrics));
         if (mViewportSizeChanged) {
             mViewportSizeChanged = false;
             GeckoAppShell.viewSizeChanged();
         }
 
         mLastViewportChangeTime = System.currentTimeMillis();
     }
 
     public void handleMessage(String event, JSONObject message) {
         if ("Viewport:UpdateAndDraw".equals(event)) {
             mUpdateViewportOnEndDraw = true;
 
             // Redraw everything.
             Rect rect = new Rect(0, 0, mBufferSize.width, mBufferSize.height);
-            GeckoAppShell.sendEventToGecko(new GeckoEvent(GeckoEvent.DRAW, rect));
+            GeckoAppShell.sendEventToGecko(GeckoEvent.createDrawEvent(rect));
         } else if ("Viewport:UpdateLater".equals(event)) {
             mUpdateViewportOnEndDraw = true;
         } else if ("Checkerboard:Toggle".equals(event)) {
             try {
                 boolean showChecks = message.getBoolean("value");
                 LayerController controller = getLayerController();
                 controller.setCheckerboardShowChecks(showChecks);
                 Log.i(LOGTAG, "Showing checks: " + showChecks);
--- a/mobile/android/base/resources/values-v11/styles.xml
+++ b/mobile/android/base/resources/values-v11/styles.xml
@@ -21,10 +21,37 @@
     </style>
 
     <!-- Lists in AwesomeBar -->
     <style name="AwesomeBarList" parent="android:style/Widget.Holo.ListView">
         <item name="android:layout_width">fill_parent</item>
         <item name="android:layout_height">fill_parent</item>
         <item name="android:layout_weight">1</item>
     </style>
+ 
+    <!-- ActionBar -->
+    <style name="ActionBar" parent="android:style/Widget.Holo.ActionBar" />
+
+    <!-- GeckoApp ActionBar -->
+    <style name="ActionBar.GeckoApp">
+         <item name="android:background">@drawable/gecko_actionbar_bg</item>
+         <item name="android:displayOptions">showCustom</item>
+         <item name="android:customNavigationLayout">@layout/browser_toolbar</item>
+    </style>
+ 
+    <!-- AwesomeBar ActionBar -->
+    <style name="ActionBar.AwesomeBar">
+         <item name="android:background">@android:color/transparent</item>
+         <item name="android:displayOptions">showCustom</item>
+         <item name="android:customNavigationLayout">@layout/awesomebar_search</item>
+    </style>
+ 
+    <!-- GeckoPreferences ActionBar -->
+    <style name="ActionBar.GeckoPreferences">
+         <item name="android:displayOptions">showHome|homeAsUp|showTitle</item>
+    </style>
+ 
+    <!-- TabsTray ActionBar -->
+    <style name="ActionBar.TabsTray">
+         <item name="android:visibility">gone</item>
+    </style>
 
 </resources>
--- a/mobile/android/base/resources/values-v11/themes.xml
+++ b/mobile/android/base/resources/values-v11/themes.xml
@@ -1,35 +1,48 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
 
     <style name="Gecko" parent="@android:style/Theme.Holo">
-        <item name="android:windowBackground">@color/splash_background</item>
         <item name="android:windowContentOverlay">@null</item>
     </style>
     
     <style name="Gecko.TitleBar" parent="Gecko"/>
 
     <style name="Gecko.NoActionBar" parent="@android:style/Theme.Holo">
         <item name="android:windowActionBar">false</item>
         <item name="android:windowNoTitle">true</item>
         <item name="android:windowBackground">@color/splash_background</item>
     </style>
     
     <style name="Gecko.Light" parent="@android:style/Theme.Holo.Light">
-        <item name="android:windowBackground">@color/splash_background</item>
         <item name="android:windowContentOverlay">@null</item>
     </style>
     
     <style name="Gecko.Light.TitleBar" parent="Gecko.Light"/>
 
     <style name="Gecko.Light.NoActionBar" parent="@android:style/Theme.Holo.Light">
         <item name="android:windowActionBar">false</item>
         <item name="android:windowNoTitle">true</item>
-        <item name="android:windowBackground">@color/splash_background</item>
     </style>
     
     <style name="Gecko.Translucent" parent="@android:style/Theme.Translucent">
         <item name="android:windowActionBar">true</item>
         <item name="android:windowNoTitle">false</item>
     </style>
+
+    <style name="Gecko.App">
+        <item name="android:actionBarStyle">@style/ActionBar.GeckoApp</item>
+    </style>
+
+    <style name="Gecko.Light.AwesomeBar">
+        <item name="android:actionBarStyle">@style/ActionBar.AwesomeBar</item>
+    </style>
+
+    <style name="Gecko.TitleBar.Preferences">
+        <item name="android:actionBarStyle">@style/ActionBar.GeckoPreferences</item>
+    </style>
+
+    <style name="Gecko.Translucent.TabsTray">
+        <item name="android:actionBarStyle">@style/ActionBar.TabsTray</item>
+    </style>
     
 </resources>
--- a/mobile/android/base/resources/values/themes.xml
+++ b/mobile/android/base/resources/values/themes.xml
@@ -1,32 +1,38 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
 
     <style name="Gecko" parent="@android:style/Theme">
         <item name="android:windowNoTitle">true</item>
-        <item name="android:windowBackground">@color/splash_background</item>
         <item name="android:windowContentOverlay">@null</item>
     </style>
     
     <style name="Gecko.TitleBar" parent="Gecko">
         <item name="android:windowNoTitle">false</item>
     </style>
 
     <style name="Gecko.NoActionBar" parent="Gecko"/>
     
     <style name="Gecko.Light" parent="@android:style/Theme.Light">
         <item name="android:windowNoTitle">true</item>
-        <item name="android:windowBackground">@color/splash_background</item>
         <item name="android:windowContentOverlay">@null</item>
     </style>
     
     <style name="Gecko.Light.TitleBar" parent="Gecko.Light">
         <item name="android:windowNoTitle">false</item>
     </style>
 
     <style name="Gecko.Light.NoActionBar" parent="Gecko.Light"/>
     
     <style name="Gecko.Translucent" parent="@android:style/Theme.Translucent">
         <item name="android:windowNoTitle">true</item>
     </style>
 
+    <style name="Gecko.App"/>
+    
+    <style name="Gecko.Light.AwesomeBar"/>
+    
+    <style name="Gecko.TitleBar.Preferences"/>
+    
+    <style name="Gecko.Translucent.TabsTray"/>
+
 </resources>
--- a/mobile/android/base/ui/PanZoomController.java
+++ b/mobile/android/base/ui/PanZoomController.java
@@ -831,17 +831,17 @@ public class PanZoomController
                 return;
             }
             json = PointUtils.toJSON(point).toString();
         } catch (Exception e) {
             Log.e(LOGTAG, "Unable to convert point to JSON for " + event, e);
             return;
         }
 
-        GeckoAppShell.sendEventToGecko(new GeckoEvent(event, json));
+        GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent(event, json));
     }
 
     @Override
     public void onLongPress(MotionEvent motionEvent) {
         sendPointToGecko("Gesture:LongPress", motionEvent);
     }
 
     @Override
@@ -859,17 +859,17 @@ public class PanZoomController
 
     @Override
     public boolean onDoubleTap(MotionEvent motionEvent) {
         sendPointToGecko("Gesture:DoubleTap", motionEvent);
         return true;
     }
 
     public void cancelTouch() {
-        GeckoEvent e = new GeckoEvent("Gesture:CancelTouch", "");
+        GeckoEvent e = GeckoEvent.createBroadcastEvent("Gesture:CancelTouch", "");
         GeckoAppShell.sendEventToGecko(e);
     }
 
     private boolean animatedZoomTo(RectF zoomToRect) {
         GeckoApp.mAppContext.mAutoCompletePopup.hide();
 
         mState = PanZoomState.ANIMATED_ZOOM;
         final float startZoom = mController.getZoomFactor();
--- a/mobile/android/base/ui/SubdocumentScrollHelper.java
+++ b/mobile/android/base/ui/SubdocumentScrollHelper.java
@@ -87,17 +87,17 @@ class SubdocumentScrollHelper implements
 
         JSONObject json = new JSONObject();
         try {
             json.put("x", displacement.x);
             json.put("y", displacement.y);
         } catch (JSONException e) {
             Log.e(LOGTAG, "Error forming subwindow scroll message: ", e);
         }
-        GeckoAppShell.sendEventToGecko(new GeckoEvent(MESSAGE_SCROLL, json.toString()));
+        GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent(MESSAGE_SCROLL, json.toString()));
 
         return true;
     }
 
     void cancel() {
         mOverridePanning = false;
     }
 
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -139,17 +139,18 @@ function resolveGeckoURI(aURI) {
 
 /**
  * Cache of commonly used string bundles.
  */
 var Strings = {};
 [
   ["brand",      "chrome://branding/locale/brand.properties"],
   ["browser",    "chrome://browser/locale/browser.properties"],
-  ["charset",    "chrome://global/locale/charsetTitles.properties"]
+  ["charset",    "chrome://global/locale/charsetTitles.properties"],
+  ["ext",        "chrome://mozapps/locale/extensions/extensions.properties"]
 ].forEach(function (aStringBundle) {
   let [name, bundle] = aStringBundle;
   XPCOMUtils.defineLazyGetter(Strings, name, function() {
     return Services.strings.createBundle(bundle);
   });
 });
 
 var MetadataProvider = {
@@ -3066,17 +3067,35 @@ var XPInstallObserver = {
   },
 
   onDownloadProgress: function xpidm_onDownloadProgress(aInstall) {},
 
   onDownloadFailed: function(aInstall) {
     this.onInstallFailed(aInstall);
   },
 
-  onDownloadCancelled: function(aInstall) {}
+  onDownloadCancelled: function(aInstall) {
+    let addon = aInstall.addon;
+    if (!addon)
+      return;
+
+    let msg;
+
+    if (addon.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED) {
+      msg = gStrings.ext.formatStringFromName("details.notification.blocked", [aInstall.name], 1);
+    } else if (!addon.isCompatible || !addon.isPlatformCompatible) {
+      let brandShortName = Strings.brand.GetStringFromName("brandShortName");
+      msg = Strings.ext.formatStringFromName("details.notification.incompatible",
+        [aInstall.name, brandShortName, Services.appinfo.version], 3);
+    } else {
+      msg = Strings.ext.formatStringFromName("notification.downloadError", [aInstall.name], 1);
+    }
+
+    NativeWindow.toast.show(msg, "short");
+  }
 };
 
 // Blindly copied from Safari documentation for now.
 const kViewportMinScale  = 0;
 const kViewportMaxScale  = 10;
 const kViewportMinWidth  = 200;
 const kViewportMaxWidth  = 10000;
 const kViewportMinHeight = 223;
--- a/mobile/xul/chrome/content/aboutHome.xhtml
+++ b/mobile/xul/chrome/content/aboutHome.xhtml
@@ -163,17 +163,17 @@
       win.document.getElementById("prefs-uilanguage-button").click();
     }
 
     function init() {
       initTabs();
       initAddons();
       initSetupSync();
 
-      let prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService).QueryInterface(Ci.nsIPrefBranch2);
+      let prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
       if (prefs.getBoolPref("browser.firstrun.show.uidiscovery")) {
         startDiscovery();
         prefs.setBoolPref("browser.firstrun.show.uidiscovery", false);
         document.getElementById("locale").style.display = "block";
       } else {
         endDiscovery();
       }
 
--- a/mobile/xul/chrome/content/bindings/browser.xml
+++ b/mobile/xul/chrome/content/bindings/browser.xml
@@ -560,18 +560,17 @@
       </method>
 
       <constructor>
         <![CDATA[
           this._frameLoader = this.QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader;
           this._contentViewManager = this._frameLoader.QueryInterface(Components.interfaces.nsIContentViewManager);
 
           let prefService = Components.classes["@mozilla.org/preferences-service;1"]
-                                              .getService(Components.interfaces.nsIPrefService)
-                                              .QueryInterface(Components.interfaces.nsIPrefBranch2);
+                                              .getService(Components.interfaces.nsIPrefBranch);
 
           this._cacheRatioWidth = Math.max(1, prefService.getIntPref("toolkit.browser.cacheRatioWidth") / 1000);
           this._cacheRatioHeight = Math.max(1, prefService.getIntPref("toolkit.browser.cacheRatioHeight") / 1000);
 
           if (this._contentViewPrototype)
             this._contentViewPrototype.kDieTime = prefService.getIntPref("toolkit.browser.contentViewExpire");
 
           this.messageManager.loadFrameScript("chrome://browser/content/bindings/browser.js", true);
--- a/mobile/xul/chrome/content/config.js
+++ b/mobile/xul/chrome/content/config.js
@@ -286,17 +286,17 @@ var Utils = {
   QueryInterface: function(aIID) {
     if (!aIID.equals(Ci.nsIObserver) && !aIID.equals(Ci.nsISupportsWeakReference))
       throw Components.results.NS_ERROR_NO_INTERFACE;
     return this;
   },
 
   get _branch() {
     delete this._branch;
-    this._branch = Services.prefs.getBranch(null).QueryInterface(Ci.nsIPrefBranch2);
+    this._branch = Services.prefs.getBranch(null);
     this._branch.addObserver("", this, true);
     return this._branch;
   },
 
   get _preferences() {
     delete this._preferences;
     let list = this._branch.getChildList("", {}).filter(function(element) {
       return !(/^capability\./.test(element));
--- a/modules/libpref/public/Preferences.h
+++ b/modules/libpref/public/Preferences.h
@@ -68,17 +68,16 @@ class Preferences : public nsIPrefServic
                     public nsIObserver,
                     public nsIPrefBranchInternal,
                     public nsSupportsWeakReference
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPREFSERVICE
   NS_FORWARD_NSIPREFBRANCH(sRootBranch->)
-  NS_FORWARD_NSIPREFBRANCH2(sRootBranch->)
   NS_DECL_NSIOBSERVER
 
   Preferences();
   virtual ~Preferences();
 
   nsresult Init();
 
   /**
@@ -105,17 +104,17 @@ public:
     NS_ENSURE_TRUE(InitStaticMembers(), nsnull);
     return sPreferences;
   }
 
   /**
    * Returns shared pref branch instance.
    * NOTE: not addreffed.
    */
-  static nsIPrefBranch2* GetRootBranch()
+  static nsIPrefBranch* GetRootBranch()
   {
     NS_ENSURE_TRUE(InitStaticMembers(), nsnull);
     return sRootBranch;
   }
 
   /**
    * Returns shared default pref branch instance.
    * NOTE: not addreffed.
@@ -340,17 +339,16 @@ public:
                                              nsACString* aResult);
   static nsresult GetDefaultLocalizedString(const char* aPref,
                                             nsAString* aResult);
 
   static nsresult GetDefaultComplex(const char* aPref, const nsIID &aType,
                                     void** aResult);
 
   // Used to synchronise preferences between chrome and content processes.
-  static nsresult ReadExtensionPrefs(nsIFile *aFile);
   static void MirrorPreferences(nsTArray<PrefTuple,
                                 nsTArrayInfallibleAllocator> *aArray);
   static bool MirrorPreference(const char *aPref, PrefTuple *aTuple);
   static void ClearContentPref(const char *aPref);
   static void SetPreference(const PrefTuple *aTuple);
 
 protected:
   nsresult NotifyServiceObservers(const char *aSubject);
@@ -361,18 +359,17 @@ protected:
   nsresult SavePrefFileInternal(nsIFile* aFile);
   nsresult WritePrefFile(nsIFile* aFile);
   nsresult MakeBackupPrefFile(nsIFile *aFile);
 
 private:
   nsCOMPtr<nsIFile>        mCurrentFile;
 
   static Preferences*      sPreferences;
-  static nsIPrefBranch2*   sRootBranch;
-  // NOTE: default branch doesn't return nsIPrefBranch2 interface at query.
+  static nsIPrefBranch*    sRootBranch;
   static nsIPrefBranch*    sDefaultRootBranch;
   static bool              sShutdown;
 
   /**
    * Init static members.  TRUE if it succeeded.  Otherwise, FALSE.
    */
   static bool InitStaticMembers();
 };
--- a/modules/libpref/public/nsIPrefBranch.idl
+++ b/modules/libpref/public/nsIPrefBranch.idl
@@ -34,33 +34,35 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsISupports.idl"
 
+interface nsIObserver;
+
 /**
  * The nsIPrefBranch interface is used to manipulate the preferences data. This
  * object may be obtained from the preferences service (nsIPrefService) and
  * used to get and set default and/or user preferences across the application.
  *
  * This object is created with a "root" value which describes the base point in
  * the preferences "tree" from which this "branch" stems. Preferences are
  * accessed off of this root by using just the final portion of the preference.
  * For example, if this object is created with the root "browser.startup.",
  * the preferences "browser.startup.page", "browser.startup.homepage",
  * and "browser.startup.homepage_override" can be accessed by simply passing
  * "page", "homepage", or "homepage_override" to the various Get/Set methods.
  *
  * @see nsIPrefService
  */
 
-[scriptable, uuid(e162bfa0-01bd-4e9f-9843-8fb2efcd6d1f)]
+[scriptable, uuid(7df46a54-d8b0-448e-903c-4341a1b2499c)]
 interface nsIPrefBranch : nsISupports
 {
 
   /**
    * Values describing the basic preference types.
    *
    * @see getPrefType
    */
@@ -340,17 +342,99 @@ interface nsIPrefBranch : nsISupports
    * This method can be called on either a default or user branch but, in
    * effect, always operates on the user branch.
    *
    * @return NS_OK The preference(s) were successfully reset.
    * @return Other The preference(s) do not exist or an error occurred.
    */
   void resetBranch(in string aStartingAt);
 
+  /**
+   * Add a preference change observer. On preference changes, the following
+   * arguments will be passed to the nsIObserver.observe() method:
+   *   aSubject - The nsIPrefBranch object (this)
+   *   aTopic   - The string defined by NS_PREFBRANCH_PREFCHANGE_TOPIC_ID
+   *   aData    - The name of the preference which has changed, relative to
+   *              the |root| of the aSubject branch.
+   *
+   * aSubject.get*Pref(aData) will get the new value of the modified
+   * preference. For example, if your observer is registered with
+   * addObserver("bar.", ...) on a branch with root "foo.", modifying
+   * the preference "foo.bar.baz" will trigger the observer, and aData
+   * parameter will be "bar.baz".
+   *
+   * @param aDomain   The preference on which to listen for changes. This can
+   *                  be the name of an entire branch to observe.
+   *                  e.g. Holding the "root" prefbranch and calling
+   *                  addObserver("foo.bar.", ...) will observe changes to
+   *                  foo.bar.baz and foo.bar.bzip
+   * @param aObserver The object to be notified if the preference changes.
+   * @param aHoldWeak true  Hold a weak reference to |aObserver|. The object
+   *                        must implement the nsISupportsWeakReference
+   *                        interface or this will fail.
+   *                  false Hold a strong reference to |aObserver|.
+   *
+   * @note
+   * Registering as a preference observer can open an object to potential
+   * cyclical references which will cause memory leaks. These cycles generally
+   * occur because an object both registers itself as an observer (causing the
+   * branch to hold a reference to the observer) and holds a reference to the
+   * branch object for the purpose of getting/setting preference values. There
+   * are 3 approaches which have been implemented in an attempt to avoid these
+   * situations.
+   * 1) The nsPrefBranch object supports nsISupportsWeakReference. Any consumer
+   *    may hold a weak reference to it instead of a strong one.
+   * 2) The nsPrefBranch object listens for xpcom-shutdown and frees all of the
+   *    objects currently in its observer list. This ensures that long lived
+   *    objects (services for example) will be freed correctly.
+   * 3) The observer can request to be held as a weak reference when it is
+   *    registered. This insures that shorter lived objects (say one tied to an
+   *    open window) will not fall into the cyclical reference trap.
+   *
+   * @note
+   * The list of registered observers may be changed during the dispatch of
+   * nsPref:changed notification. However, the observers are not guaranteed
+   * to be notified in any particular order, so you can't be sure whether the
+   * added/removed observer will be called during the notification when it
+   * is added/removed.
+   *
+   * @note
+   * It is possible to change preferences during the notification.
+   *
+   * @note
+   * It is not safe to change observers during this callback in Gecko 
+   * releases before 1.9. If you want a safe way to remove a pref observer,
+   * please use an nsITimer.
+   *
+   * @see nsIObserver
+   * @see removeObserver
+   */
+  void addObserver(in string aDomain, in nsIObserver aObserver,
+                   in boolean aHoldWeak);
+
+  /**
+   * Remove a preference change observer.
+   *
+   * @param aDomain   The preference which is being observed for changes.
+   * @param aObserver An observer previously registered with addObserver().
+   *
+   * @note
+   * Note that you must call removeObserver() on the same nsIPrefBranch
+   * instance on which you called addObserver() in order to remove aObserver;
+   * otherwise, the observer will not be removed.
+   *
+   * @see nsIObserver
+   * @see addObserver
+   */
+  void removeObserver(in string aDomain, in nsIObserver aObserver);
 };
 
 
 %{C++
 
 #define NS_PREFBRANCH_CONTRACTID "@mozilla.org/preferencesbranch;1"
 #define NS_PREFBRANCH_CLASSNAME "Preferences Branch"
+/**
+ * Notification sent when a preference changes.
+ */
+#define NS_PREFBRANCH_PREFCHANGE_TOPIC_ID "nsPref:changed"
 
 %}
--- a/modules/libpref/public/nsIPrefBranch2.idl
+++ b/modules/libpref/public/nsIPrefBranch2.idl
@@ -35,106 +35,17 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsIPrefBranch.idl"
 
-interface nsIObserver;
-
 /**
- * nsIPrefBranch2 allows clients to observe changes to pref values.
+ * An empty interface to provide backwards compatibility for existing code.
  *
  * @see nsIPrefBranch
  */
-[scriptable, uuid(d9bb54df-daac-4ce6-a70c-95d87b770cd8)]
+[scriptable, uuid(8892016d-07f7-4530-b5c1-d73dfcde4a1c)]
 interface nsIPrefBranch2 : nsIPrefBranch
 {
-  /**
-   * Add a preference change observer. On preference changes, the following
-   * arguments will be passed to the nsIObserver.observe() method:
-   *   aSubject - The nsIPrefBranch object (this)
-   *   aTopic   - The string defined by NS_PREFBRANCH_PREFCHANGE_TOPIC_ID
-   *   aData    - The name of the preference which has changed, relative to
-   *              the |root| of the aSubject branch.
-   *
-   * aSubject.get*Pref(aData) will get the new value of the modified
-   * preference. For example, if your observer is registered with
-   * addObserver("bar.", ...) on a branch with root "foo.", modifying
-   * the preference "foo.bar.baz" will trigger the observer, and aData
-   * parameter will be "bar.baz".
-   *
-   * @param aDomain   The preference on which to listen for changes. This can
-   *                  be the name of an entire branch to observe.
-   *                  e.g. Holding the "root" prefbranch and calling
-   *                  addObserver("foo.bar.", ...) will observe changes to
-   *                  foo.bar.baz and foo.bar.bzip
-   * @param aObserver The object to be notified if the preference changes.
-   * @param aHoldWeak true  Hold a weak reference to |aObserver|. The object
-   *                        must implement the nsISupportsWeakReference
-   *                        interface or this will fail.
-   *                  false Hold a strong reference to |aObserver|.
-   *
-   * @note
-   * Registering as a preference observer can open an object to potential
-   * cyclical references which will cause memory leaks. These cycles generally
-   * occur because an object both registers itself as an observer (causing the
-   * branch to hold a reference to the observer) and holds a reference to the
-   * branch object for the purpose of getting/setting preference values. There
-   * are 3 approaches which have been implemented in an attempt to avoid these
-   * situations.
-   * 1) The nsPrefBranch object supports nsISupportsWeakReference. Any consumer
-   *    may hold a weak reference to it instead of a strong one.
-   * 2) The nsPrefBranch object listens for xpcom-shutdown and frees all of the
-   *    objects currently in its observer list. This ensures that long lived
-   *    objects (services for example) will be freed correctly.
-   * 3) The observer can request to be held as a weak reference when it is
-   *    registered. This insures that shorter lived objects (say one tied to an
-   *    open window) will not fall into the cyclical reference trap.
-   *
-   * @note
-   * The list of registered observers may be changed during the dispatch of
-   * nsPref:changed notification. However, the observers are not guaranteed
-   * to be notified in any particular order, so you can't be sure whether the
-   * added/removed observer will be called during the notification when it
-   * is added/removed.
-   *
-   * @note
-   * It is possible to change preferences during the notification.
-   *
-   * @note
-   * It is not safe to change observers during this callback in Gecko 
-   * releases before 1.9. If you want a safe way to remove a pref observer,
-   * please use an nsITimer.
-   *
-   * @see nsIObserver
-   * @see removeObserver
-   */
-  void addObserver(in string aDomain, in nsIObserver aObserver,
-                   in boolean aHoldWeak);
-
-  /**
-   * Remove a preference change observer.
-   *
-   * @param aDomain   The preference which is being observed for changes.
-   * @param aObserver An observer previously registered with addObserver().
-   *
-   * @note
-   * Note that you must call removeObserver() on the same nsIPrefBranch2
-   * instance on which you called addObserver() in order to remove aObserver;
-   * otherwise, the observer will not be removed.
-   *
-   * @see nsIObserver
-   * @see addObserver
-   */
-  void removeObserver(in string aDomain, in nsIObserver aObserver);
 };
-
-%{C++
-
-/**
- * Notification sent when a preference changes.
- */
-#define NS_PREFBRANCH_PREFCHANGE_TOPIC_ID "nsPref:changed"
-
-%}
--- a/modules/libpref/src/Preferences.cpp
+++ b/modules/libpref/src/Preferences.cpp
@@ -82,19 +82,20 @@ namespace mozilla {
 // Definitions
 #define INITIAL_PREF_FILES 10
 static NS_DEFINE_CID(kZipReaderCID, NS_ZIPREADER_CID);
 
 // Prototypes
 static nsresult openPrefFile(nsIFile* aFile);
 static nsresult pref_InitInitialObjects(void);
 static nsresult pref_LoadPrefsInDirList(const char *listId);
+static nsresult ReadExtensionPrefs(nsIFile *aFile);
 
 Preferences* Preferences::sPreferences = nsnull;
-nsIPrefBranch2* Preferences::sRootBranch = nsnull;
+nsIPrefBranch* Preferences::sRootBranch = nsnull;
 nsIPrefBranch* Preferences::sDefaultRootBranch = nsnull;
 bool Preferences::sShutdown = false;
 
 class ValueObserverHashKey : public PLDHashEntryHdr {
 public:
   typedef ValueObserverHashKey* KeyType;
   typedef const ValueObserverHashKey* KeyTypePointer;
 
@@ -449,18 +450,18 @@ Preferences::SavePrefFile(nsIFile *aFile
   if (XRE_GetProcessType() == GeckoProcessType_Content) {
     NS_ERROR("cannot save prefs from content process");
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   return SavePrefFileInternal(aFile);
 }
 
-nsresult
-Preferences::ReadExtensionPrefs(nsIFile *aFile)
+static nsresult
+ReadExtensionPrefs(nsIFile *aFile)
 {
   nsresult rv;
   nsCOMPtr<nsIZipReader> reader = do_CreateInstance(kZipReaderCID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = reader->Open(aFile);
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -935,35 +936,45 @@ pref_LoadPrefsInDir(nsIFile* aDir, char 
 
   return rv;
 }
 
 static nsresult pref_LoadPrefsInDirList(const char *listId)
 {
   nsresult rv;
   nsCOMPtr<nsIProperties> dirSvc(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv));
-  if (NS_FAILED(rv)) return rv;
+  if (NS_FAILED(rv))
+    return rv;
 
-  nsCOMPtr<nsISimpleEnumerator> dirList;
+  nsCOMPtr<nsISimpleEnumerator> list;
   dirSvc->Get(listId,
               NS_GET_IID(nsISimpleEnumerator),
-              getter_AddRefs(dirList));
-  if (dirList) {
-    bool hasMore;
-    while (NS_SUCCEEDED(dirList->HasMoreElements(&hasMore)) && hasMore) {
-      nsCOMPtr<nsISupports> elem;
-      dirList->GetNext(getter_AddRefs(elem));
-      if (elem) {
-        nsCOMPtr<nsIFile> dir = do_QueryInterface(elem);
-        if (dir) {
-          // Do we care if a file provided by this process fails to load?
-          pref_LoadPrefsInDir(dir, nsnull, 0); 
-        }
-      }
-    }
+              getter_AddRefs(list));
+  if (!list)
+    return NS_OK;
+
+  bool hasMore;
+  while (NS_SUCCEEDED(list->HasMoreElements(&hasMore)) && hasMore) {
+    nsCOMPtr<nsISupports> elem;
+    list->GetNext(getter_AddRefs(elem));
+    if (!elem)
+      continue;
+
+    nsCOMPtr<nsIFile> path = do_QueryInterface(elem);
+    if (!path)
+      continue;
+
+    nsCAutoString leaf;
+    path->GetNativeLeafName(leaf);
+
+    // Do we care if a file provided by this process fails to load?
+    if (Substring(leaf, leaf.Length() - 4).Equals(NS_LITERAL_CSTRING(".xpi")))
+      ReadExtensionPrefs(path);
+    else
+      pref_LoadPrefsInDir(path, nsnull, 0);
   }
   return NS_OK;
 }
 
 static nsresult pref_ReadPrefFromJar(nsZipArchive* jarReader, const char *name)
 {
   nsZipItemPtr<char> manifest(jarReader, name, true);
   NS_ENSURE_TRUE(manifest.Buffer(), NS_ERROR_NOT_AVAILABLE);
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -629,16 +629,17 @@ pref("content.sink.pending_event_mode", 
 //   1 = openControlled
 //   2 = openAbused
 pref("privacy.popups.disable_from_plugins", 2);
 
 // "do not track" HTTP header, disabled by default
 pref("privacy.donottrackheader.enabled",    false);
 
 pref("dom.event.contextmenu.enabled",       true);
+pref("dom.event.clipboardevents.enabled",   true);
 
 pref("javascript.enabled",                  true);
 pref("javascript.options.strict",           false);
 #ifdef DEBUG
 pref("javascript.options.strict.debug",     true);
 #endif
 pref("javascript.options.relimit",          true);
 pref("javascript.options.methodjit.content", true);
--- a/modules/libpref/src/nsPrefBranch.cpp
+++ b/modules/libpref/src/nsPrefBranch.cpp
@@ -556,21 +556,16 @@ NS_IMETHODIMP nsPrefBranch::GetChildList
     }
     *aChildArray = outArray;
   }
   *aCount = numPrefs;
 
   return NS_OK;
 }
 
-
-/*
- *  nsIPrefBranch2 methods
- */
-
 NS_IMETHODIMP nsPrefBranch::AddObserver(const char *aDomain, nsIObserver *aObserver, bool aHoldWeak)
 {
   PrefCallback *pCallback;
   const char *pref;
 
   NS_ENSURE_ARG(aDomain);
   NS_ENSURE_ARG(aObserver);
 
--- a/modules/libpref/test/unit/test_bug345529.js
+++ b/modules/libpref/test/unit/test_bug345529.js
@@ -4,17 +4,17 @@
 // Regression test for bug 345529 - crash removing an observer during an
 // nsPref:changed notification.
 function run_test() {
   const Cc = Components.classes;
   const Ci = Components.interfaces;
   const PREF_NAME = "testPref";
 
   var prefs = Cc["@mozilla.org/preferences-service;1"]
-              .getService(Ci.nsIPrefBranch2);
+              .getService(Ci.nsIPrefBranch);
   var observer = {
     QueryInterface: function QueryInterface(aIID) {
       if (aIID.equals(Ci.nsIObserver) ||
           aIID.equals(Ci.nsISupports))
          return this;
       throw Components.results.NS_NOINTERFACE;
     },
 
--- a/modules/libpref/test/unit/test_bug577950.js
+++ b/modules/libpref/test/unit/test_bug577950.js
@@ -33,19 +33,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 function run_test() {
   var ps = Cc["@mozilla.org/preferences-service;1"].
             getService(Ci.nsIPrefService);
 
-  var pb2= Cc["@mozilla.org/preferences-service;1"].
-            getService(Ci.nsIPrefBranch2);
-
   var pb = Cc["@mozilla.org/preferences-service;1"].
             getService(Ci.nsIPrefBranch);
 
   var observer = {
     QueryInterface: function QueryInterface(aIID) {
       if (aIID.equals(Ci.nsIObserver) ||
           aIID.equals(Ci.nsISupports))
          return this;
--- a/modules/libpref/test/unit/test_libPrefs.js
+++ b/modules/libpref/test/unit/test_libPrefs.js
@@ -50,17 +50,17 @@ function makeList(a)
 }
 
 function run_test() {
 
   var ps = Cc["@mozilla.org/preferences-service;1"].
             getService(Ci.nsIPrefService);
 
   var pb2= Cc["@mozilla.org/preferences-service;1"].
-            getService(Ci.nsIPrefBranch2);
+            getService(Ci.nsIPrefBranch);
 
   var pb = Cc["@mozilla.org/preferences-service;1"].
             getService(Ci.nsIPrefBranch);
 
   //**************************************************************************//
   // Nullsafety
 
   do_check_throws(function() {
--- a/netwerk/base/src/nsIOService.cpp
+++ b/netwerk/base/src/nsIOService.cpp
@@ -49,17 +49,16 @@
 #include "nsLoadGroup.h"
 #include "nsInputStreamChannel.h"
 #include "nsXPIDLString.h" 
 #include "nsReadableUtils.h"
 #include "nsIErrorService.h" 
 #include "netCore.h"
 #include "nsIObserverService.h"
 #include "nsIPrefService.h"
-#include "nsIPrefBranch2.h"
 #include "nsIPrefLocalizedString.h"
 #include "nsICategoryManager.h"
 #include "nsXPCOM.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIProxiedProtocolHandler.h"
 #include "nsIProxyInfo.h"
 #include "nsEscape.h"
 #include "nsNetCID.h"
@@ -217,17 +216,17 @@ nsIOService::Init()
     
     NS_TIME_FUNCTION_MARK("got Error Service");
 
     // setup our bad port list stuff
     for(int i=0; gBadPortList[i]; i++)
         mRestrictedPortList.AppendElement(gBadPortList[i]);
 
     // Further modifications to the port list come from prefs
-    nsCOMPtr<nsIPrefBranch2> prefBranch;
+    nsCOMPtr<nsIPrefBranch> prefBranch;
     GetPrefBranch(getter_AddRefs(prefBranch));
     if (prefBranch) {
         prefBranch->AddObserver(PORT_PREF_PREFIX, this, true);
         prefBranch->AddObserver(AUTODIAL_PREF, this, true);
         prefBranch->AddObserver(MANAGE_OFFLINE_STATUS_PREF, this, true);
         PrefsChanged(prefBranch);
     }
     
@@ -436,17 +435,17 @@ nsIOService::GetProtocolHandler(const ch
     // scheme -> protocol handler mapping, avoiding the string manipulation
     // and service manager stuff
 
     rv = GetCachedProtocolHandler(scheme, result);
     if (NS_SUCCEEDED(rv))
         return rv;
 
     bool externalProtocol = false;
-    nsCOMPtr<nsIPrefBranch2> prefBranch;
+    nsCOMPtr<nsIPrefBranch> prefBranch;
     GetPrefBranch(getter_AddRefs(prefBranch));
     if (prefBranch) {
         nsCAutoString externalProtocolPref("network.protocol-handler.external.");
         externalProtocolPref += scheme;
         rv = prefBranch->GetBoolPref(externalProtocolPref.get(), &externalProtocol);
         if (NS_FAILED(rv)) {
             externalProtocol = false;
         }
@@ -957,17 +956,17 @@ nsIOService::ParsePortList(nsIPrefBranch
                }
             }
 
         }
     }
 }
 
 void
-nsIOService::GetPrefBranch(nsIPrefBranch2 **result)
+nsIOService::GetPrefBranch(nsIPrefBranch **result)
 {
     *result = nsnull;
     CallGetService(NS_PREFSERVICE_CONTRACTID, result);
 }
 
 // nsIObserver interface
 NS_IMETHODIMP
 nsIOService::Observe(nsISupports *subject,
--- a/netwerk/base/src/nsIOService.h
+++ b/netwerk/base/src/nsIOService.h
@@ -65,17 +65,16 @@
 // Intended internal use only for remoting offline/inline events.
 // See Bug 552829
 #define NS_IPC_IOSERVICE_SET_OFFLINE_TOPIC "ipc:network:set-offline"
 
 static const char gScheme[][sizeof("resource")] =
     {"chrome", "file", "http", "jar", "resource"};
 
 class nsIPrefBranch;
-class nsIPrefBranch2;
 
 class nsIOService : public nsIIOService2
                   , public nsIObserver
                   , public nsINetUtil
                   , public nsSupportsWeakReference
 {
 public:
     NS_DECL_ISUPPORTS
@@ -125,17 +124,17 @@ private:
                                                   nsIProtocolHandler* *hdlrResult,
                                                   PRUint32 start=0,
                                                   PRUint32 end=0);
     NS_HIDDEN_(nsresult) CacheProtocolHandler(const char *scheme,
                                               nsIProtocolHandler* hdlr);
 
     // Prefs wrangling
     NS_HIDDEN_(void) PrefsChanged(nsIPrefBranch *prefs, const char *pref = nsnull);
-    NS_HIDDEN_(void) GetPrefBranch(nsIPrefBranch2 **);
+    NS_HIDDEN_(void) GetPrefBranch(nsIPrefBranch **);
     NS_HIDDEN_(void) ParsePortList(nsIPrefBranch *prefBranch, const char *pref, bool remove);
 
     nsresult InitializeSocketTransportService();
     nsresult InitializeNetworkLinkService();
 
 private:
     bool                                 mOffline;
     bool                                 mOfflineForProfileChange;
--- a/netwerk/base/src/nsProtocolProxyService.cpp
+++ b/netwerk/base/src/nsProtocolProxyService.cpp
@@ -47,17 +47,17 @@
 #include "nsIProxyAutoConfig.h"
 #include "nsIIOService.h"
 #include "nsIObserverService.h"
 #include "nsIProtocolHandler.h"
 #include "nsIProtocolProxyCallback.h"
 #include "nsICancelable.h"
 #include "nsIDNSService.h"
 #include "nsIPrefService.h"
-#include "nsIPrefBranch2.h"
+#include "nsIPrefBranch.h"
 #include "nsReadableUtils.h"
 #include "nsThreadUtils.h"
 #include "nsString.h"
 #include "nsNetUtil.h"
 #include "nsNetCID.h"
 #include "nsCRT.h"
 #include "prnetdb.h"
 #include "nsPACMan.h"
@@ -335,17 +335,17 @@ nsProtocolProxyService::~nsProtocolProxy
 // nsProtocolProxyService methods
 nsresult
 nsProtocolProxyService::Init()
 {
     if (!mFailedProxies.Init())
         return NS_ERROR_OUT_OF_MEMORY;
 
     // failure to access prefs is non-fatal
-    nsCOMPtr<nsIPrefBranch2> prefBranch =
+    nsCOMPtr<nsIPrefBranch> prefBranch =
             do_GetService(NS_PREFSERVICE_CONTRACTID);
     if (prefBranch) {
         // monitor proxy prefs
         prefBranch->AddObserver(PROXY_PREF_BRANCH, this, false);
 
         // read all prefs
         PrefsChanged(prefBranch, nsnull);
     }
--- a/netwerk/base/src/nsSocketTransportService2.cpp
+++ b/netwerk/base/src/nsSocketTransportService2.cpp
@@ -43,17 +43,17 @@
 #include "nsSocketTransportService2.h"
 #include "nsSocketTransport2.h"
 #include "nsReadableUtils.h"
 #include "nsNetError.h"
 #include "prnetdb.h"
 #include "prerror.h"
 #include "plstr.h"
 #include "nsIPrefService.h"
-#include "nsIPrefBranch2.h"
+#include "nsIPrefBranch.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIOService.h"
 
 #include "mozilla/FunctionTimer.h"
 
 // XXX: There is no good header file to put these in. :(
 namespace mozilla { namespace psm {
 
@@ -489,17 +489,17 @@ nsSocketTransportService::Init()
     if (NS_FAILED(rv)) return rv;
     
     {
         MutexAutoLock lock(mLock);
         // Install our mThread, protecting against concurrent readers
         thread.swap(mThread);
     }
 
-    nsCOMPtr<nsIPrefBranch2> tmpPrefService = do_GetService(NS_PREFSERVICE_CONTRACTID);
+    nsCOMPtr<nsIPrefBranch> tmpPrefService = do_GetService(NS_PREFSERVICE_CONTRACTID);
     if (tmpPrefService) 
         tmpPrefService->AddObserver(SEND_BUFFER_PREF, this, false);
     UpdatePrefs();
 
     NS_TIME_FUNCTION_MARK("UpdatePrefs");
 
     mInitialized = true;
     return NS_OK;
@@ -534,17 +534,17 @@ nsSocketTransportService::Shutdown()
     mThread->Shutdown();
     {
         MutexAutoLock lock(mLock);
         // Drop our reference to mThread and make sure that any concurrent
         // readers are excluded
         mThread = nsnull;
     }
 
-    nsCOMPtr<nsIPrefBranch2> tmpPrefService = do_GetService(NS_PREFSERVICE_CONTRACTID);
+    nsCOMPtr<nsIPrefBranch> tmpPrefService = do_GetService(NS_PREFSERVICE_CONTRACTID);
     if (tmpPrefService) 
         tmpPrefService->RemoveObserver(SEND_BUFFER_PREF, this);
 
     mInitialized = false;
     mShuttingDown = false;
 
     return NS_OK;
 }
@@ -813,17 +813,17 @@ nsSocketTransportService::DoPollIteratio
     return NS_OK;
 }
 
 nsresult
 nsSocketTransportService::UpdatePrefs()
 {
     mSendBufferSize = 0;
     
-    nsCOMPtr<nsIPrefBranch2> tmpPrefService = do_GetService(NS_PREFSERVICE_CONTRACTID);
+    nsCOMPtr<nsIPrefBranch> tmpPrefService = do_GetService(NS_PREFSERVICE_CONTRACTID);
     if (tmpPrefService) {
         PRInt32 bufferSize;
         nsresult rv = tmpPrefService->GetIntPref(SEND_BUFFER_PREF, &bufferSize);
         if (NS_SUCCEEDED(rv) && bufferSize > 0)
             mSendBufferSize = bufferSize;
     }
     
     return NS_OK;
--- a/netwerk/base/src/nsStandardURL.cpp
+++ b/netwerk/base/src/nsStandardURL.cpp
@@ -46,17 +46,16 @@
 #include "nsCRT.h"
 #include "nsEscape.h"
 #include "nsILocalFile.h"
 #include "nsIObjectInputStream.h"
 #include "nsIObjectOutputStream.h"
 #include "nsICharsetConverterManager.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
-#include "nsIPrefBranch2.h"
 #include "nsIIDNService.h"
 #include "nsNetUtil.h"
 #include "prlog.h"
 #include "nsAutoPtr.h"
 #include "nsIProgrammingLanguage.h"
 #include "nsVoidArray.h"
 
 static NS_DEFINE_CID(kThisImplCID, NS_THIS_STANDARDURL_IMPL_CID);
@@ -337,17 +336,17 @@ DumpLeakedURLs::~DumpLeakedURLs()
         }
     }
 }
 #endif
 
 void
 nsStandardURL::InitGlobalObjects()
 {
-    nsCOMPtr<nsIPrefBranch2> prefBranch( do_GetService(NS_PREFSERVICE_CONTRACTID) );
+    nsCOMPtr<nsIPrefBranch> prefBranch( do_GetService(NS_PREFSERVICE_CONTRACTID) );
     if (prefBranch) {
         nsCOMPtr<nsIObserver> obs( new nsPrefObserver() );
         prefBranch->AddObserver(NS_NET_PREF_ESCAPEUTF8, obs.get(), false);
         prefBranch->AddObserver(NS_NET_PREF_ALWAYSENCODEINUTF8, obs.get(), false);
         prefBranch->AddObserver(NS_NET_PREF_ENABLEIDN, obs.get(), false);
 
         PrefsChanged(prefBranch, nsnull);
     }
--- a/netwerk/cache/nsCacheMetaData.cpp
+++ b/netwerk/cache/nsCacheMetaData.cpp
@@ -136,17 +136,17 @@ nsCacheMetaData::UnflattenMetaData(const
         // Check if the metadata ends with a zero byte.
         if (data[size-1] != '\0') {
             NS_ERROR("Cache MetaData is not null terminated");
             return NS_ERROR_ILLEGAL_VALUE;
         }
         // Check that there are an even number of zero bytes
         // to match the pattern { key \0 value \0 }
         bool odd = false;
-        for (int i = 0; i < size; i++) {
+        for (PRUint32 i = 0; i < size; i++) {
             if (data[i] == '\0') 
                 odd = !odd;
         }
         if (odd) {
             NS_ERROR("Cache MetaData is malformed");
             return NS_ERROR_ILLEGAL_VALUE;
         }
 
--- a/netwerk/cache/nsCacheService.cpp
+++ b/netwerk/cache/nsCacheService.cpp
@@ -55,17 +55,16 @@
 #include "nsICacheVisitor.h"
 #include "nsDiskCacheDevice.h"
 #include "nsDiskCacheDeviceSQL.h"
 
 #include "nsIMemoryReporter.h"
 #include "nsIObserverService.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
-#include "nsIPrefBranch2.h"
 #include "nsILocalFile.h"
 #include "nsIOService.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsThreadUtils.h"
 #include "nsProxyRelease.h"
 #include "nsVoidArray.h"
 #include "nsDeleteDir.h"
@@ -259,17 +258,17 @@ public:
         // Ensure smart sizing wasn't switched off while event was pending.
         // It is safe to access the observer without the lock since we are
         // on the main thread and the value changes only on the main thread.
         if (!nsCacheService::gService->mObserver->SmartSizeEnabled())
             return NS_OK;
 
         nsCacheService::SetDiskCacheCapacity(mSmartSize);
 
-        nsCOMPtr<nsIPrefBranch2> ps = do_GetService(NS_PREFSERVICE_CONTRACTID);
+        nsCOMPtr<nsIPrefBranch> ps = do_GetService(NS_PREFSERVICE_CONTRACTID);
         if (!ps ||
             NS_FAILED(ps->SetIntPref(DISK_CACHE_SMART_SIZE_PREF, mSmartSize)))
             NS_WARNING("Failed to set smart size pref");
 
         return NS_OK;
     }
 
 private:
@@ -331,17 +330,17 @@ nsCacheProfilePrefObserver::Install()
     nsresult rv, rv2 = NS_OK;
     for (unsigned int i=0; i<ArrayLength(observerList); i++) {
         rv = observerService->AddObserver(this, observerList[i], false);
         if (NS_FAILED(rv)) 
             rv2 = rv;
     }
     
     // install preferences observer
-    nsCOMPtr<nsIPrefBranch2> branch = do_GetService(NS_PREFSERVICE_CONTRACTID);
+    nsCOMPtr<nsIPrefBranch> branch = do_GetService(NS_PREFSERVICE_CONTRACTID);
     if (!branch) return NS_ERROR_FAILURE;
 
     for (unsigned int i=0; i<ArrayLength(prefList); i++) {
         rv = branch->AddObserver(prefList[i], this, false);
         if (NS_FAILED(rv))
             rv2 = rv;
     }
 
@@ -379,17 +378,17 @@ nsCacheProfilePrefObserver::Remove()
         mozilla::services::GetObserverService();
     if (obs) {
         for (unsigned int i=0; i<ArrayLength(observerList); i++) {
             obs->RemoveObserver(this, observerList[i]);
         }
     }
 
     // remove Pref Service observers
-    nsCOMPtr<nsIPrefBranch2> prefs =
+    nsCOMPtr<nsIPrefBranch> prefs =
         do_GetService(NS_PREFSERVICE_CONTRACTID);
     if (!prefs)
         return;
     for (unsigned int i=0; i<ArrayLength(prefList); i++)
         prefs->RemoveObserver(prefList[i], this); // remove cache pref observers
 }
 
 void
--- a/netwerk/cookie/CookieServiceChild.cpp
+++ b/netwerk/cookie/CookieServiceChild.cpp
@@ -35,17 +35,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "mozilla/net/CookieServiceChild.h"
 #include "mozilla/net/NeckoChild.h"
 #include "nsIURI.h"
 #include "nsIPrefService.h"
-#include "nsIPrefBranch2.h"
+#include "nsIPrefBranch.h"
 
 namespace mozilla {
 namespace net {
 
 // Behavior pref constants
 static const PRInt32 BEHAVIOR_ACCEPT = 0;
 static const PRInt32 BEHAVIOR_REJECTFOREIGN = 1;
 static const PRInt32 BEHAVIOR_REJECT = 2;
@@ -81,17 +81,17 @@ CookieServiceChild::CookieServiceChild()
   // This corresponds to Release() in DeallocPCookieService.
   NS_ADDREF_THIS();
 
   // Create a child PCookieService actor.
   NeckoChild::InitNeckoChild();
   gNeckoChild->SendPCookieServiceConstructor(this);
 
   // Init our prefs and observer.
-  nsCOMPtr<nsIPrefBranch2> prefBranch =
+  nsCOMPtr<nsIPrefBranch> prefBranch =
     do_GetService(NS_PREFSERVICE_CONTRACTID);
   NS_WARN_IF_FALSE(prefBranch, "no prefservice");
   if (prefBranch) {
     prefBranch->AddObserver(kPrefCookieBehavior, this, true);
     prefBranch->AddObserver(kPrefThirdPartySession, this, true);
     PrefChanged(prefBranch);
   }
 }
--- a/netwerk/cookie/nsCookieService.cpp
+++ b/netwerk/cookie/nsCookieService.cpp
@@ -48,17 +48,16 @@
 #include "mozilla/net/CookieServiceChild.h"
 #include "mozilla/net/NeckoCommon.h"
 
 #include "nsCookieService.h"
 #include "nsIServiceManager.h"
 
 #include "nsIIOService.h"
 #include "nsIPrefBranch.h"
-#include "nsIPrefBranch2.h"
 #include "nsIPrefService.h"
 #include "nsICookiePermission.h"
 #include "nsIURI.h"
 #include "nsIURL.h"
 #include "nsIChannel.h"
 #include "nsIFile.h"
 #include "nsIObserverService.h"
 #include "nsILineInputStream.h"
@@ -626,17 +625,17 @@ nsCookieService::Init()
   nsresult rv;
   mTLDService = do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   mIDNService = do_GetService(NS_IDNSERVICE_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // init our pref and observer
-  nsCOMPtr<nsIPrefBranch2> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID);
+  nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID);
   if (prefBranch) {
     prefBranch->AddObserver(kPrefCookieBehavior,     this, true);
     prefBranch->AddObserver(kPrefMaxNumberOfCookies, this, true);
     prefBranch->AddObserver(kPrefMaxCookiesPerHost,  this, true);
     prefBranch->AddObserver(kPrefCookiePurgeAge,     this, true);
     prefBranch->AddObserver(kPrefThirdPartySession,  this, true);
     PrefChanged(prefBranch);
   }
--- a/netwerk/dns/nsDNSService2.cpp
+++ b/netwerk/dns/nsDNSService2.cpp
@@ -36,17 +36,16 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsDNSService2.h"
 #include "nsIDNSRecord.h"
 #include "nsIDNSListener.h"
 #include "nsICancelable.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
-#include "nsIPrefBranch2.h"
 #include "nsIServiceManager.h"
 #include "nsProxyRelease.h"
 #include "nsReadableUtils.h"
 #include "nsString.h"
 #include "nsAutoPtr.h"
 #include "nsNetCID.h"
 #include "nsNetError.h"
 #include "nsDNSPrefetch.h"
@@ -404,17 +403,17 @@ nsDNSService::Init()
     bool     enableIDN        = true;
     bool     disableIPv6      = false;
     bool     disablePrefetch  = false;
     int      proxyType        = nsIProtocolProxyService::PROXYCONFIG_DIRECT;
     
     nsAdoptingCString ipv4OnlyDomains;
 
     // read prefs
-    nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
+    nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
     if (prefs) {
         PRInt32 val;
         if (NS_SUCCEEDED(prefs->GetIntPref(kPrefDnsCacheEntries, &val)))
             maxCacheEntries = (PRUint32) val;
         if (NS_SUCCEEDED(prefs->GetIntPref(kPrefDnsCacheExpiration, &val)))
             maxCacheLifetime = val / 60; // convert from seconds to minutes
         if (NS_SUCCEEDED(prefs->GetIntPref(kPrefDnsCacheGrace, &val)))
             lifetimeGracePeriod = val / 60; // convert from seconds to minutes
--- a/netwerk/dns/nsIDNService.cpp
+++ b/netwerk/dns/nsIDNService.cpp
@@ -38,17 +38,16 @@
 
 #include "nsIDNService.h"
 #include "nsReadableUtils.h"
 #include "nsCRT.h"
 #include "nsUnicharUtils.h"
 #include "nsIServiceManager.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
-#include "nsIPrefBranch2.h"
 #include "nsIObserverService.h"
 #include "nsISupportsPrimitives.h"
 #include "punycode.h"
 
 #include "mozilla/FunctionTimer.h"
 
 //-----------------------------------------------------------------------------
 // RFC 1034 - 3.1. Name space specifications and terminology
@@ -82,17 +81,17 @@ NS_IMPL_THREADSAFE_ISUPPORTS3(nsIDNServi
 nsresult nsIDNService::Init()
 {
   NS_TIME_FUNCTION;
 
   nsCOMPtr<nsIPrefService> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
   if (prefs)
     prefs->GetBranch(NS_NET_PREF_IDNWHITELIST, getter_AddRefs(mIDNWhitelistPrefBranch));
 
-  nsCOMPtr<nsIPrefBranch2> prefInternal(do_QueryInterface(prefs));
+  nsCOMPtr<nsIPrefBranch> prefInternal(do_QueryInterface(prefs));
   if (prefInternal) {
     prefInternal->AddObserver(NS_NET_PREF_IDNTESTBED, this, true); 
     prefInternal->AddObserver(NS_NET_PREF_IDNPREFIX, this, true); 
     prefInternal->AddObserver(NS_NET_PREF_IDNBLACKLIST, this, true);
     prefInternal->AddObserver(NS_NET_PREF_SHOWPUNYCODE, this, true);
     prefsChanged(prefInternal, nsnull);
   }
 
--- a/netwerk/protocol/ftp/nsFtpProtocolHandler.cpp
+++ b/netwerk/protocol/ftp/nsFtpProtocolHandler.cpp
@@ -61,17 +61,17 @@ using namespace mozilla::net;
 #include "nsCRT.h"
 #include "nsIComponentManager.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIProgressEventSink.h"
 #include "prlog.h"
 #include "nsNetUtil.h"
 #include "nsIPrefService.h"
-#include "nsIPrefBranch2.h"
+#include "nsIPrefBranch.h"
 #include "nsIObserverService.h"
 #include "nsEscape.h"
 #include "nsAlgorithm.h"
 
 //-----------------------------------------------------------------------------
 
 #if defined(PR_LOGGING)
 //
@@ -135,17 +135,17 @@ NS_IMPL_THREADSAFE_ISUPPORTS4(nsFtpProto
 nsresult
 nsFtpProtocolHandler::Init()
 {
     if (IsNeckoChild())
         NeckoChild::InitNeckoChild();
 
     if (mIdleTimeout == -1) {
         nsresult rv;
-        nsCOMPtr<nsIPrefBranch2> branch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
+        nsCOMPtr<nsIPrefBranch> branch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
         if (NS_FAILED(rv)) return rv;
 
         rv = branch->GetIntPref(IDLE_TIMEOUT_PREF, &mIdleTimeout);
         if (NS_FAILED(rv))
             mIdleTimeout = 5*60; // 5 minute default
 
         rv = branch->AddObserver(IDLE_TIMEOUT_PREF, this, true);
         if (NS_FAILED(rv)) return rv;
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -57,17 +57,17 @@
 #include "nsIHttpChannel.h"
 #include "nsIURL.h"
 #include "nsIStandardURL.h"
 #include "nsICacheService.h"
 #include "nsICategoryManager.h"
 #include "nsCategoryManagerUtils.h"
 #include "nsICacheService.h"
 #include "nsIPrefService.h"
-#include "nsIPrefBranch2.h"
+#include "nsIPrefBranch.h"
 #include "nsIPrefLocalizedString.h"
 #include "nsISocketProviderService.h"
 #include "nsISocketProvider.h"
 #include "nsPrintfCString.h"
 #include "nsCOMPtr.h"
 #include "nsNetCID.h"
 #include "prprf.h"
 #include "nsReadableUtils.h"
@@ -253,17 +253,17 @@ nsHttpHandler::Init()
     }
 
     if (IsNeckoChild())
         NeckoChild::InitNeckoChild();
 
     InitUserAgentComponents();
 
     // monitor some preference changes
-    nsCOMPtr<nsIPrefBranch2> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID);
+    nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID);
     if (prefBranch) {
         prefBranch->AddObserver(HTTP_PREF_PREFIX, this, true);
         prefBranch->AddObserver(UA_PREF_PREFIX, this, true);
         prefBranch->AddObserver(INTL_ACCEPT_LANGUAGES, this, true); 
         prefBranch->AddObserver(NETWORK_ENABLEIDN, this, true);
         prefBranch->AddObserver(BROWSER_PREF("disk_cache_ssl"), this, true);
         prefBranch->AddObserver(DONOTTRACK_HEADER_ENABLED, this, true);
 
--- a/netwerk/test/unit/test_bug427957.js
+++ b/netwerk/test/unit/test_bug427957.js
@@ -24,17 +24,17 @@ function expected_fail(inputIDN)
   catch(e) {}
 
   do_check_neq(displayIDN, inputIDN);
 }
 
 function run_test() {
    // add an IDN whitelist pref
   var pbi = Cc["@mozilla.org/preferences-service;1"]
-    .getService(Ci.nsIPrefBranch2);
+    .getService(Ci.nsIPrefBranch);
   pbi.setBoolPref("network.IDN.whitelist.com", true);
  
   idnService = Cc["@mozilla.org/network/idn-service;1"]
     .getService(Ci.nsIIDNService);
   /*
    * In any profile that specifies bidirectional character handling, all
    * three of the following requirements MUST be met:
    *
--- a/netwerk/test/unit/test_bug479413.js
+++ b/netwerk/test/unit/test_bug479413.js
@@ -24,17 +24,17 @@ function expected_fail(inputIDN)
   catch(e) {}
 
   do_check_neq(displayIDN, inputIDN);
 }
 
 function run_test() {
    // add an IDN whitelist pref
   var pbi = Cc["@mozilla.org/preferences-service;1"]
-    .getService(Ci.nsIPrefBranch2);
+    .getService(Ci.nsIPrefBranch);
   var whitelistPref = "network.IDN.whitelist.com";
 
   pbi.setBoolPref(whitelistPref, true);
  
   idnService = Cc["@mozilla.org/network/idn-service;1"]
     .getService(Ci.nsIIDNService);
 
   // assigned code point
--- a/netwerk/test/unit/test_idnservice.js
+++ b/netwerk/test/unit/test_idnservice.js
@@ -20,17 +20,17 @@ function run_test() {
      do_check_eq(idnService.convertUTF8toACE(reference[i][0]), reference[i][1]);
      do_check_eq(idnService.convertUTF8toACE(reference[i][1]), reference[i][1]);
      do_check_eq(idnService.convertACEtoUTF8(reference[i][1]), reference[i][0]);
      do_check_eq(idnService.isACE(reference[i][1]), reference[i][2]);
   }
 
   // add an IDN whitelist pref
   var pbi = Components.classes["@mozilla.org/preferences-service;1"]
-                      .getService(Components.interfaces.nsIPrefBranch2);
+                      .getService(Components.interfaces.nsIPrefBranch);
   pbi.setBoolPref("network.IDN.whitelist.es", true);
 
   // check convertToDisplayIDN against the whitelist
   var isASCII = {};
   do_check_eq(idnService.convertToDisplayIDN("b\u00FCcher.es", isASCII), "b\u00FCcher.es");
   do_check_eq(isASCII.value, false);
   do_check_eq(idnService.convertToDisplayIDN("xn--bcher-kva.es", isASCII), "b\u00FCcher.es");
   do_check_eq(isASCII.value, false);
--- a/security/coreconf/coreconf.dep
+++ b/security/coreconf/coreconf.dep
@@ -37,9 +37,8 @@
 
 /*
  * A dummy header file that is a dependency for all the object files.
  * Used to force a full recompilation of NSS in Mozilla's Tinderbox
  * depend builds.  See comments in rules.mk.
  */
 
 #error "Do not include this header file."
-
--- a/security/manager/ssl/src/nsNSSComponent.cpp
+++ b/security/manager/ssl/src/nsNSSComponent.cpp
@@ -62,17 +62,16 @@
 #include "nsIX509CertDB.h"
 #include "nsIProfileChangeStatus.h"
 #include "nsNSSCertificate.h"
 #include "nsNSSHelper.h"
 #include "nsSmartCardMonitor.h"
 #include "prlog.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
-#include "nsIPrefBranch2.h"
 #include "nsIDateTimeFormat.h"
 #include "nsDateTimeFormatCID.h"
 #include "nsIDOMEvent.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMWindow.h"
 #include "nsIDOMWindowCollection.h"
 #include "nsIDOMSmartCardEvent.h"
 #include "nsIDOMCrypto.h"
@@ -1777,18 +1776,17 @@ nsNSSComponent::InitializeNSS(bool showW
 
       ::NSS_SetDomesticPolicy();
       //  SSL_EnableCipher(SSL_RSA_WITH_NULL_MD5, SSL_ALLOWED);
       //  SSL_EnableCipher(SSL_RSA_WITH_NULL_SHA, SSL_ALLOWED);
 
       PK11_SetPasswordFunc(PK11PasswordPrompt);
 
       // Register an observer so we can inform NSS when these prefs change
-      nsCOMPtr<nsIPrefBranch2> pbi = do_QueryInterface(mPrefBranch);
-      pbi->AddObserver("security.", this, false);
+      mPrefBranch->AddObserver("security.", this, false);
 
       SSL_OptionSetDefault(SSL_ENABLE_SSL2, false);
       SSL_OptionSetDefault(SSL_V2_COMPATIBLE_HELLO, false);
       bool enabled;
       mPrefBranch->GetBoolPref("security.enable_ssl3", &enabled);
       SSL_OptionSetDefault(SSL_ENABLE_SSL3, enabled);
       mPrefBranch->GetBoolPref("security.enable_tls", &enabled);
       SSL_OptionSetDefault(SSL_ENABLE_TLS, enabled);
@@ -1902,18 +1900,17 @@ nsNSSComponent::ShutdownNSS()
   if (mNSSInitialized) {
     mNSSInitialized = false;
 
     PK11_SetPasswordFunc((PK11PasswordFunc)nsnull);
     mHttpForNSS.unregisterHttpClient();
     UnregisterMyOCSPAIAInfoCallback();
 
     if (mPrefBranch) {
-      nsCOMPtr<nsIPrefBranch2> pbi = do_QueryInterface(mPrefBranch);
-      pbi->RemoveObserver("security.", this);
+      mPrefBranch->RemoveObserver("security.", this);
     }
 
     ShutdownSmartCardThreads();
     SSL_ClearSessionCache();
     if (mClientAuthRememberService) {
       mClientAuthRememberService->ClearRememberedDecisions();
     }
     UnloadLoadableRoots();
--- a/security/manager/ssl/src/nsNSSIOLayer.cpp
+++ b/security/manager/ssl/src/nsNSSIOLayer.cpp
@@ -964,31 +964,31 @@ void
 nsNSSSocketInfo::SetCertVerificationResult(PRErrorCode errorCode,
                                            SSLErrorMessageType errorMessageType)
 {
   NS_ASSERTION(mCertVerificationState == waiting_for_cert_verification,
                "Invalid state transition to cert_verification_finished");
 
   mCertVerificationEnded = PR_IntervalNow();
 
-  if (errorCode != 0) {
-    SetCanceled(errorCode, errorMessageType);
-  } else if (mFd) {
-    // We haven't closed the connection already, so restart it
-    SECStatus rv = SSL_RestartHandshakeAfterAuthCertificate(mFd);
-    if (rv != SECSuccess) {
+  if (mFd) {
+    SECStatus rv = SSL_AuthCertificateComplete(mFd, errorCode);
+    // Only replace errorCode if there was originally no error
+    if (rv != SECSuccess && errorCode == 0) {
       errorCode = PR_GetError();
+      errorMessageType = PlainErrorMessage;
       if (errorCode == 0) {
-        NS_ERROR("SSL_RestartHandshakeAfterAuthCertificate didn't set error code");
+        NS_ERROR("SSL_AuthCertificateComplete didn't set error code");
         errorCode = PR_INVALID_STATE_ERROR;
       }
-      SetCanceled(errorCode, PlainErrorMessage);
     }
-  } else {
-    // If we closed the connection alreay, we don't have anything to do
+  }
+
+  if (errorCode) {
+    SetCanceled(errorCode, errorMessageType);
   }
 
   mCertVerificationState = after_cert_verification;
 }
 
 nsresult nsNSSSocketInfo::GetSSLStatus(nsISSLStatus** _result)
 {
   NS_ENSURE_ARG_POINTER(_result);
@@ -1594,18 +1594,24 @@ nsHandleSSLError(nsNSSSocketInfo *socket
     }
   }
 
   socketInfo->SetCanceled(err, PlainErrorMessage);
 }
 
 namespace {
 
+enum Operation { reading, writing, not_reading_or_writing };
+
+PRInt32 checkHandshake(PRInt32 bytesTransfered, bool wasReading,
+                       PRFileDesc* ssl_layer_fd,
+                       nsNSSSocketInfo *socketInfo);
+
 nsNSSSocketInfo *
-getSocketInfoIfRunning(PRFileDesc * fd,
+getSocketInfoIfRunning(PRFileDesc * fd, Operation op,
                        const nsNSSShutDownPreventionLock & /*proofOfLock*/)
 {
   if (!fd || !fd->lower || !fd->secret ||
       fd->identity != nsSSLIOLayerHelpers::nsSSLIOLayerIdentity) {
     NS_ERROR("bad file descriptor passed to getSocketInfoIfRunning");
     PR_SetError(PR_BAD_DESCRIPTOR_ERROR, 0);
     return nsnull;
   }
@@ -1614,34 +1620,40 @@ getSocketInfoIfRunning(PRFileDesc * fd,
 
   if (socketInfo->isAlreadyShutDown() || socketInfo->isPK11LoggedOut()) {
     PR_SetError(PR_SOCKET_SHUTDOWN_ERROR, 0);
     return nsnull;
   }
 
   if (socketInfo->GetErrorCode()) {
     PRErrorCode err = socketInfo->GetErrorCode();
+    PR_SetError(err, 0);
+    if (op == reading || op == writing) {
+      // We must do TLS intolerance checks for reads and writes, for timeouts
+      // in particular.
+      (void) checkHandshake(-1, op == reading, fd, socketInfo);
+    }
+
     // If we get here, it is probably because cert verification failed and this
     // is the first I/O attempt since that failure.
-    PR_SetError(err, 0);
     return nsnull;
   }
 
   return socketInfo;
 }
 
 } // unnnamed namespace
 
 static PRStatus PR_CALLBACK
 nsSSLIOLayerConnect(PRFileDesc* fd, const PRNetAddr* addr,
                     PRIntervalTime timeout)
 {
   PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("[%p] connecting SSL socket\n", (void*)fd));
   nsNSSShutDownPreventionLock locker;
-  if (!getSocketInfoIfRunning(fd, locker))
+  if (!getSocketInfoIfRunning(fd, not_reading_or_writing, locker))
     return PR_FAILURE;
   
   PRStatus status = fd->lower->methods->connect(fd->lower, addr, timeout);
   if (status != PR_SUCCESS) {
     PR_LOG(gPIPNSSLog, PR_LOG_ERROR, ("[%p] Lower layer connect error: %d\n",
                                       (void*)fd, PR_GetError()));
     return status;
   }
@@ -1951,16 +1963,18 @@ class SSLErrorRunnable : public SyncRunn
   {
     nsHandleSSLError(mInfoObject, mErrorCode);
   }
   
   nsRefPtr<nsNSSSocketInfo> mInfoObject;
   const PRErrorCode mErrorCode;
 };
 
+namespace {
+
 PRInt32 checkHandshake(PRInt32 bytesTransfered, bool wasReading,
                        PRFileDesc* ssl_layer_fd,
                        nsNSSSocketInfo *socketInfo)
 {
   // This is where we work around all of those SSL servers that don't 
   // conform to the SSL spec and shutdown a connection when we request
   // SSL v3.1 (aka TLS).  The spec says the client says what version
   // of the protocol we're willing to perform, in our case SSL v3.1
@@ -2054,30 +2068,34 @@ PRInt32 checkHandshake(PRInt32 bytesTran
   if (handleHandshakeResultNow) {
     socketInfo->SetHandshakePending(false);
     socketInfo->SetHandshakeInProgress(false);
   }
   
   return bytesTransfered;
 }
 
+}
+
 static PRInt16 PR_CALLBACK
 nsSSLIOLayerPoll(PRFileDesc * fd, PRInt16 in_flags, PRInt16 *out_flags)
 {
   nsNSSShutDownPreventionLock locker;
 
   if (!out_flags)
   {
     NS_WARNING("nsSSLIOLayerPoll called with null out_flags");
     return 0;
   }
 
   *out_flags = 0;
 
-  nsNSSSocketInfo * socketInfo = getSocketInfoIfRunning(fd, locker);
+  nsNSSSocketInfo * socketInfo =
+    getSocketInfoIfRunning(fd, not_reading_or_writing, locker);
+
   if (!socketInfo) {
     // If we get here, it is probably because certificate validation failed
     // and this is the first I/O operation after the failure. 
     PR_LOG(gPIPNSSLog, PR_LOG_DEBUG,
             ("[%p] polling SSL socket right after certificate verification failed "
                   "or NSS shutdown or SDR logout %d\n",
              fd, (int) in_flags));
 
@@ -2093,19 +2111,22 @@ nsSSLIOLayerPoll(PRFileDesc * fd, PRInt1
   PR_LOG(gPIPNSSLog, PR_LOG_DEBUG,
          (socketInfo->IsWaitingForCertVerification()
             ?  "[%p] polling SSL socket during certificate verification using lower %d\n"
             :  "[%p] poll SSL socket using lower %d\n",
          fd, (int) in_flags));
 
   // See comments in HandshakeTimeout before moving and/or changing this block
   if (socketInfo->HandshakeTimeout()) {
+    NS_WARNING("SSL handshake timed out");
+    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("[%p] handshake timed out\n", fd));
     NS_ASSERTION(in_flags & PR_POLL_EXCEPT,
                  "caller did not poll for EXCEPT (handshake timeout)");
     *out_flags = in_flags | PR_POLL_EXCEPT;
+    socketInfo->SetCanceled(PR_CONNECT_RESET_ERROR, PlainErrorMessage);
     return in_flags;
   }
 
   // We want the handshake to continue during certificate validation, so we
   // don't need to do anything special here. libssl automatically blocks when
   // it reaches any point that would be unsafe to send/receive something before
   // cert validation is complete.
   PRInt16 result = fd->lower->methods->poll(fd->lower, in_flags, out_flags);
@@ -2151,56 +2172,56 @@ static PRFileDesc *_PSM_InvalidDesc(void
     PR_ASSERT(!"I/O method is invalid");
     PR_SetError(PR_INVALID_METHOD_ERROR, 0);
     return NULL;
 }
 
 static PRStatus PR_CALLBACK PSMGetsockname(PRFileDesc *fd, PRNetAddr *addr)
 {
   nsNSSShutDownPreventionLock locker;
-  if (!getSocketInfoIfRunning(fd, locker))
+  if (!getSocketInfoIfRunning(fd, not_reading_or_writing, locker))
     return PR_FAILURE;
 
   return fd->lower->methods->getsockname(fd->lower, addr);
 }
 
 static PRStatus PR_CALLBACK PSMGetpeername(PRFileDesc *fd, PRNetAddr *addr)
 {
   nsNSSShutDownPreventionLock locker;
-  if (!getSocketInfoIfRunning(fd, locker))
+  if (!getSocketInfoIfRunning(fd, not_reading_or_writing, locker))
     return PR_FAILURE;
 
   return fd->lower->methods->getpeername(fd->lower, addr);
 }
 
 static PRStatus PR_CALLBACK PSMGetsocketoption(PRFileDesc *fd, 
                                         PRSocketOptionData *data)
 {
   nsNSSShutDownPreventionLock locker;
-  if (!getSocketInfoIfRunning(fd, locker))
+  if (!getSocketInfoIfRunning(fd, not_reading_or_writing, locker))
     return PR_FAILURE;
 
   return fd->lower->methods->getsocketoption(fd, data);
 }
 
 static PRStatus PR_CALLBACK PSMSetsocketoption(PRFileDesc *fd, 
                                         const PRSocketOptionData *data)
 {
   nsNSSShutDownPreventionLock locker;
-  if (!getSocketInfoIfRunning(fd, locker))
+  if (!getSocketInfoIfRunning(fd, not_reading_or_writing, locker))
     return PR_FAILURE;
 
   return fd->lower->methods->setsocketoption(fd, data);
 }
 
 static PRInt32 PR_CALLBACK PSMRecv(PRFileDesc *fd, void *buf, PRInt32 amount,
     PRIntn flags, PRIntervalTime timeout)
 {
   nsNSSShutDownPreventionLock locker;
-  nsNSSSocketInfo *socketInfo = getSocketInfoIfRunning(fd, locker);
+  nsNSSSocketInfo *socketInfo = getSocketInfoIfRunning(fd, reading, locker);
   if (!socketInfo)
     return -1;
 
   if (flags != PR_MSG_PEEK && flags != 0) {
     PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
     return -1;
   }
 
@@ -2215,17 +2236,17 @@ static PRInt32 PR_CALLBACK PSMRecv(PRFil
 
   return checkHandshake(bytesRead, true, fd, socketInfo);
 }
 
 static PRInt32 PR_CALLBACK PSMSend(PRFileDesc *fd, const void *buf, PRInt32 amount,
     PRIntn flags, PRIntervalTime timeout)
 {
   nsNSSShutDownPreventionLock locker;
-  nsNSSSocketInfo *socketInfo = getSocketInfoIfRunning(fd, locker);
+  nsNSSSocketInfo *socketInfo = getSocketInfoIfRunning(fd, writing, locker);
   if (!socketInfo)
     return -1;
 
   if (flags != 0) {
     PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
     return -1;
   }
 
@@ -2252,17 +2273,17 @@ static PRInt32 PR_CALLBACK
 nsSSLIOLayerWrite(PRFileDesc* fd, const void* buf, PRInt32 amount)
 {
   return PSMSend(fd, buf, amount, 0, PR_INTERVAL_NO_TIMEOUT);
 }
 
 static PRStatus PR_CALLBACK PSMConnectcontinue(PRFileDesc *fd, PRInt16 out_flags)
 {
   nsNSSShutDownPreventionLock locker;
-  if (!getSocketInfoIfRunning(fd, locker)) {
+  if (!getSocketInfoIfRunning(fd, not_reading_or_writing, locker)) {
     return PR_FAILURE;
   }
 
   return fd->lower->methods->connectcontinue(fd, out_flags);
 }
 
 static PRIntn PSMAvailable(void)
 {
--- a/security/manager/ssl/tests/mochitest/stricttransportsecurity/test_sts_privatebrowsing.html
+++ b/security/manager/ssl/tests/mochitest/stricttransportsecurity/test_sts_privatebrowsing.html
@@ -96,17 +96,17 @@
     if (_PrefSvc)
       return _PrefSvc;
 
     // not all apps will have the private browsing service.
     try {
       netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
       _PrefSvc = Components.classes["@mozilla.org/preferences-service;1"]
         .getService(Components.interfaces.nsIPrefService)
-        .QueryInterface(Components.interfaces.nsIPrefBranch2);
+        .QueryInterface(Components.interfaces.nsIPrefBranch);
       return _PrefSvc;
     } catch (e) {}
     return null;
   }
 
   function startRound(round) {
     currentround = round;
     testsleftinround = NUM_TEST_FRAMES;
--- a/security/nss/TAG-INFO
+++ b/security/nss/TAG-INFO
@@ -1,1 +1,1 @@
-NSS_3_13_2_BETA1
+NSS_3_13_2_RC0
--- a/security/nss/cmd/tstclnt/tstclnt.c
+++ b/security/nss/cmd/tstclnt/tstclnt.c
@@ -320,17 +320,17 @@ ownBadCertHandler(void * arg, PRFileDesc
 }
 
 static SECStatus 
 ownAuthCertificate(void *arg, PRFileDesc *fd, PRBool checkSig,
                        PRBool isServer)
 {
     ServerCertAuth * serverCertAuth = (ServerCertAuth *) arg;
 
-    FPRINTF(stderr, "using asynchronous certificate validation\n", progName);
+    FPRINTF(stderr, "using asynchronous certificate validation\n");
 
     PORT_Assert(serverCertAuth->shouldPause);
     PORT_Assert(!serverCertAuth->isPaused);
     serverCertAuth->isPaused = PR_TRUE;
     return SECWouldBlock;
 }
 
 SECStatus
@@ -525,33 +525,43 @@ separateReqHeader(const PRFileDesc* outF
     }
 
 static SECStatus
 restartHandshakeAfterServerCertIfNeeded(PRFileDesc * fd,
                                         ServerCertAuth * serverCertAuth,
                                         PRBool override)
 {
     SECStatus rv;
+    PRErrorCode status;
     
     if (!serverCertAuth->isPaused)
 	return SECSuccess;
     
     FPRINTF(stderr, "%s: handshake was paused by auth certificate hook\n",
             progName);
 
     serverCertAuth->isPaused = PR_FALSE;
     rv = SSL_AuthCertificate(serverCertAuth->dbHandle, fd, PR_TRUE, PR_FALSE);
-    if (rv != SECSuccess && override) {
-        rv = ownBadCertHandler(NULL, fd);
+    if (rv != SECSuccess) {
+        status = PR_GetError();
+        if (status == 0) {
+            PR_NOT_REACHED("SSL_AuthCertificate return SECFailure without "
+                           "setting error code.");
+            status = PR_INVALID_STATE_ERROR;
+        } else if (override) {
+            rv = ownBadCertHandler(NULL, fd);
+        }
     }
-    if (rv != SECSuccess) {
-	return rv;
+    if (rv == SECSuccess) {
+        status = 0;
     }
-    
-    rv = SSL_RestartHandshakeAfterAuthCertificate(fd);
+
+    if (SSL_AuthCertificateComplete(fd, status) != SECSuccess) {
+        rv = SECFailure;
+    }
 
     return rv;
 }
     
 int main(int argc, char **argv)
 {
     PRFileDesc *       s;
     PRFileDesc *       std_out;
--- a/security/nss/lib/certdb/stanpcertdb.c
+++ b/security/nss/lib/certdb/stanpcertdb.c
@@ -632,17 +632,17 @@ CERT_FindCertByDERCert(CERTCertDBHandle 
 static CERTCertificate *
 common_FindCertByNicknameOrEmailAddrForUsage(CERTCertDBHandle *handle, 
                                              char *name,
                                              PRBool anyUsage,
                                              SECCertUsage lookingForUsage)
 {
     NSSCryptoContext *cc;
     NSSCertificate *c, *ct;
-    CERTCertificate *cert;
+    CERTCertificate *cert = NULL;
     NSSUsage usage;
     CERTCertList *certlist;
 
     if (NULL == name) {
         PORT_SetError(SEC_ERROR_INVALID_ARGS);
 	return NULL;
     }
 
--- a/security/nss/lib/ckfw/builtins/certdata.c
+++ b/security/nss/lib/ckfw/builtins/certdata.c
@@ -30,17 +30,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #ifdef DEBUG
-static const char CVS_ID[] = "@(#) $RCSfile: certdata.c,v $ $Revision: 1.83 $ $Date: 2011/11/03 15:11:57 $""; @(#) $RCSfile: certdata.c,v $ $Revision: 1.83 $ $Date: 2011/11/03 15:11:57 $";
+static const char CVS_ID[] = "@(#) $RCSfile: certdata.c,v $ $Revision: 1.84 $ $Date: 2012/01/17 22:02:37 $""; @(#) $RCSfile: certdata.c,v $ $Revision: 1.84 $ $Date: 2012/01/17 22:02:37 $";
 #endif /* DEBUG */
 
 #ifndef BUILTINS_H
 #include "builtins.h"
 #endif /* BUILTINS_H */
 
 static const CK_BBOOL ck_false = CK_FALSE;
 static const CK_BBOOL ck_true = CK_TRUE;
@@ -1070,37 +1070,25 @@ static const CK_ATTRIBUTE_TYPE nss_built
  CKA_CLASS,  CKA_TOKEN,  CKA_PRIVATE,  CKA_MODIFIABLE,  CKA_LABEL,  CKA_CERT_SHA1_HASH,  CKA_CERT_MD5_HASH,  CKA_ISSUER,  CKA_SERIAL_NUMBER,  CKA_TRUST_SERVER_AUTH,  CKA_TRUST_EMAIL_PROTECTION,  CKA_TRUST_CODE_SIGNING,  CKA_TRUST_STEP_UP_APPROVED
 };
 static const CK_ATTRIBUTE_TYPE nss_builtins_types_338 [] = {
  CKA_CLASS,  CKA_TOKEN,  CKA_PRIVATE,  CKA_MODIFIABLE,  CKA_LABEL,  CKA_CERTIFICATE_TYPE,  CKA_SUBJECT,  CKA_ID,  CKA_ISSUER,  CKA_SERIAL_NUMBER,  CKA_VALUE
 };
 static const CK_ATTRIBUTE_TYPE nss_builtins_types_339 [] = {
  CKA_CLASS,  CKA_TOKEN,  CKA_PRIVATE,  CKA_MODIFIABLE,  CKA_LABEL,  CKA_CERT_SHA1_HASH,  CKA_CERT_MD5_HASH,  CKA_ISSUER,  CKA_SERIAL_NUMBER,  CKA_TRUST_SERVER_AUTH,  CKA_TRUST_EMAIL_PROTECTION,  CKA_TRUST_CODE_SIGNING,  CKA_TRUST_STEP_UP_APPROVED
 };
-static const CK_ATTRIBUTE_TYPE nss_builtins_types_340 [] = {
- CKA_CLASS,  CKA_TOKEN,  CKA_PRIVATE,  CKA_MODIFIABLE,  CKA_LABEL,  CKA_CERTIFICATE_TYPE,  CKA_SUBJECT,  CKA_ID,  CKA_ISSUER,  CKA_SERIAL_NUMBER,  CKA_VALUE
-};
-static const CK_ATTRIBUTE_TYPE nss_builtins_types_341 [] = {
- CKA_CLASS,  CKA_TOKEN,  CKA_PRIVATE,  CKA_MODIFIABLE,  CKA_LABEL,  CKA_CERT_SHA1_HASH,  CKA_CERT_MD5_HASH,  CKA_ISSUER,  CKA_SERIAL_NUMBER,  CKA_TRUST_SERVER_AUTH,  CKA_TRUST_EMAIL_PROTECTION,  CKA_TRUST_CODE_SIGNING,  CKA_TRUST_STEP_UP_APPROVED
-};
-static const CK_ATTRIBUTE_TYPE nss_builtins_types_342 [] = {
- CKA_CLASS,  CKA_TOKEN,  CKA_PRIVATE,  CKA_MODIFIABLE,  CKA_LABEL,  CKA_CERTIFICATE_TYPE,  CKA_SUBJECT,  CKA_ID,  CKA_ISSUER,  CKA_SERIAL_NUMBER,  CKA_VALUE
-};
-static const CK_ATTRIBUTE_TYPE nss_builtins_types_343 [] = {
- CKA_CLASS,  CKA_TOKEN,  CKA_PRIVATE,  CKA_MODIFIABLE,  CKA_LABEL,  CKA_CERT_SHA1_HASH,  CKA_CERT_MD5_HASH,  CKA_ISSUER,  CKA_SERIAL_NUMBER,  CKA_TRUST_SERVER_AUTH,  CKA_TRUST_EMAIL_PROTECTION,  CKA_TRUST_CODE_SIGNING,  CKA_TRUST_STEP_UP_APPROVED
-};
 #ifdef DEBUG
 static const NSSItem nss_builtins_items_0 [] = {
   { (void *)&cko_data, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"CVS ID", (PRUint32)7 },
   { (void *)"NSS", (PRUint32)4 },
-  { (void *)"@(#) $RCSfile: certdata.c,v $ $Revision: 1.83 $ $Date: 2011/11/03 15:11:57 $""; @(#) $RCSfile: certdata.c,v $ $Revision: 1.83 $ $Date: 2011/11/03 15:11:57 $", (PRUint32)160 }
+  { (void *)"@(#) $RCSfile: certdata.c,v $ $Revision: 1.84 $ $Date: 2012/01/17 22:02:37 $""; @(#) $RCSfile: certdata.c,v $ $Revision: 1.84 $ $Date: 2012/01/17 22:02:37 $", (PRUint32)160 }
 };
 #endif /* DEBUG */
 static const NSSItem nss_builtins_items_1 [] = {
   { (void *)&cko_nss_builtin_root_list, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Mozilla Builtin Roots", (PRUint32)22 }
@@ -1745,201 +1733,16 @@ static const NSSItem nss_builtins_items_
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
 static const NSSItem nss_builtins_items_14 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
-  { (void *)"Verisign Class 1 Public Primary Certification Authority", (PRUint32)56 },
-  { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
-  { (void *)"\060\137\061\013\060\011\006\003\125\004\006\023\002\125\123\061"
-"\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123\151"
-"\147\156\054\040\111\156\143\056\061\067\060\065\006\003\125\004"
-"\013\023\056\103\154\141\163\163\040\061\040\120\165\142\154\151"
-"\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151\146"
-"\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151\164"
-"\171"
-, (PRUint32)97 },
-  { (void *)"0", (PRUint32)2 },
-  { (void *)"\060\137\061\013\060\011\006\003\125\004\006\023\002\125\123\061"
-"\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123\151"
-"\147\156\054\040\111\156\143\056\061\067\060\065\006\003\125\004"
-"\013\023\056\103\154\141\163\163\040\061\040\120\165\142\154\151"
-"\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151\146"
-"\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151\164"
-"\171"
-, (PRUint32)97 },
-  { (void *)"\002\021\000\315\272\177\126\360\337\344\274\124\376\042\254\263"
-"\162\252\125"
-, (PRUint32)19 },
-  { (void *)"\060\202\002\075\060\202\001\246\002\021\000\315\272\177\126\360"
-"\337\344\274\124\376\042\254\263\162\252\125\060\015\006\011\052"
-"\206\110\206\367\015\001\001\002\005\000\060\137\061\013\060\011"
-"\006\003\125\004\006\023\002\125\123\061\027\060\025\006\003\125"
-"\004\012\023\016\126\145\162\151\123\151\147\156\054\040\111\156"
-"\143\056\061\067\060\065\006\003\125\004\013\023\056\103\154\141"
-"\163\163\040\061\040\120\165\142\154\151\143\040\120\162\151\155"
-"\141\162\171\040\103\145\162\164\151\146\151\143\141\164\151\157"
-"\156\040\101\165\164\150\157\162\151\164\171\060\036\027\015\071"
-"\066\060\061\062\071\060\060\060\060\060\060\132\027\015\062\070"
-"\060\070\060\061\062\063\065\071\065\071\132\060\137\061\013\060"
-"\011\006\003\125\004\006\023\002\125\123\061\027\060\025\006\003"
-"\125\004\012\023\016\126\145\162\151\123\151\147\156\054\040\111"
-"\156\143\056\061\067\060\065\006\003\125\004\013\023\056\103\154"
-"\141\163\163\040\061\040\120\165\142\154\151\143\040\120\162\151"
-"\155\141\162\171\040\103\145\162\164\151\146\151\143\141\164\151"
-"\157\156\040\101\165\164\150\157\162\151\164\171\060\201\237\060"
-"\015\006\011\052\206\110\206\367\015\001\001\001\005\000\003\201"
-"\215\000\060\201\211\002\201\201\000\345\031\277\155\243\126\141"
-"\055\231\110\161\366\147\336\271\215\353\267\236\206\200\012\221"
-"\016\372\070\045\257\106\210\202\345\163\250\240\233\044\135\015"
-"\037\314\145\156\014\260\320\126\204\030\207\232\006\233\020\241"
-"\163\337\264\130\071\153\156\301\366\025\325\250\250\077\252\022"
-"\006\215\061\254\177\260\064\327\217\064\147\210\011\315\024\021"
-"\342\116\105\126\151\037\170\002\200\332\334\107\221\051\273\066"
-"\311\143\134\305\340\327\055\207\173\241\267\062\260\173\060\272"
-"\052\057\061\252\356\243\147\332\333\002\003\001\000\001\060\015"
-"\006\011\052\206\110\206\367\015\001\001\002\005\000\003\201\201"
-"\000\114\077\270\213\306\150\337\356\103\063\016\135\351\246\313"
-"\007\204\115\172\063\377\222\033\364\066\255\330\225\042\066\150"
-"\021\154\174\102\314\363\234\056\304\007\077\024\260\017\117\377"
-"\220\222\166\371\342\274\112\351\217\315\240\200\012\367\305\051"
-"\361\202\042\135\270\261\335\201\043\243\173\045\025\106\060\171"
-"\026\370\352\005\113\224\177\035\302\034\310\343\267\364\020\100"
-"\074\023\303\137\037\123\350\110\344\206\264\173\241\065\260\173"
-"\045\272\270\323\216\253\077\070\235\000\064\000\230\363\321\161"
-"\224"
-, (PRUint32)577 }
-};
-static const NSSItem nss_builtins_items_15 [] = {
-  { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
-  { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
-  { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
-  { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
-  { (void *)"Verisign Class 1 Public Primary Certification Authority", (PRUint32)56 },
-  { (void *)"\220\256\242\151\205\377\024\200\114\103\111\122\354\351\140\204"
-"\167\257\125\157"
-, (PRUint32)20 },
-  { (void *)"\227\140\350\127\137\323\120\107\345\103\014\224\066\212\260\142"
-, (PRUint32)16 },
-  { (void *)"\060\137\061\013\060\011\006\003\125\004\006\023\002\125\123\061"
-"\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123\151"
-"\147\156\054\040\111\156\143\056\061\067\060\065\006\003\125\004"
-"\013\023\056\103\154\141\163\163\040\061\040\120\165\142\154\151"
-"\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151\146"
-"\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151\164"
-"\171"
-, (PRUint32)97 },
-  { (void *)"\002\021\000\315\272\177\126\360\337\344\274\124\376\042\254\263"
-"\162\252\125"
-, (PRUint32)19 },
-  { (void *)&ckt_nss_trust_unknown, (PRUint32)sizeof(CK_TRUST) },
-  { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
-  { (void *)&ckt_nss_trust_unknown, (PRUint32)sizeof(CK_TRUST) },
-  { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
-};
-static const NSSItem nss_builtins_items_16 [] = {
-  { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
-  { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
-  { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
-  { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
-  { (void *)"Verisign Class 2 Public Primary Certification Authority", (PRUint32)56 },
-  { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
-  { (void *)"\060\137\061\013\060\011\006\003\125\004\006\023\002\125\123\061"
-"\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123\151"
-"\147\156\054\040\111\156\143\056\061\067\060\065\006\003\125\004"
-"\013\023\056\103\154\141\163\163\040\062\040\120\165\142\154\151"
-"\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151\146"
-"\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151\164"
-"\171"
-, (PRUint32)97 },
-  { (void *)"0", (PRUint32)2 },
-  { (void *)"\060\137\061\013\060\011\006\003\125\004\006\023\002\125\123\061"
-"\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123\151"
-"\147\156\054\040\111\156\143\056\061\067\060\065\006\003\125\004"
-"\013\023\056\103\154\141\163\163\040\062\040\120\165\142\154\151"
-"\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151\146"
-"\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151\164"
-"\171"
-, (PRUint32)97 },
-  { (void *)"\002\020\055\033\374\112\027\215\243\221\353\347\377\365\213\105"
-"\276\013"
-, (PRUint32)18 },
-  { (void *)"\060\202\002\074\060\202\001\245\002\020\055\033\374\112\027\215"
-"\243\221\353\347\377\365\213\105\276\013\060\015\006\011\052\206"
-"\110\206\367\015\001\001\002\005\000\060\137\061\013\060\011\006"
-"\003\125\004\006\023\002\125\123\061\027\060\025\006\003\125\004"
-"\012\023\016\126\145\162\151\123\151\147\156\054\040\111\156\143"
-"\056\061\067\060\065\006\003\125\004\013\023\056\103\154\141\163"
-"\163\040\062\040\120\165\142\154\151\143\040\120\162\151\155\141"
-"\162\171\040\103\145\162\164\151\146\151\143\141\164\151\157\156"
-"\040\101\165\164\150\157\162\151\164\171\060\036\027\015\071\066"
-"\060\061\062\071\060\060\060\060\060\060\132\027\015\062\070\060"
-"\070\060\061\062\063\065\071\065\071\132\060\137\061\013\060\011"
-"\006\003\125\004\006\023\002\125\123\061\027\060\025\006\003\125"
-"\004\012\023\016\126\145\162\151\123\151\147\156\054\040\111\156"
-"\143\056\061\067\060\065\006\003\125\004\013\023\056\103\154\141"
-"\163\163\040\062\040\120\165\142\154\151\143\040\120\162\151\155"
-"\141\162\171\040\103\145\162\164\151\146\151\143\141\164\151\157"
-"\156\040\101\165\164\150\157\162\151\164\171\060\201\237\060\015"
-"\006\011\052\206\110\206\367\015\001\001\001\005\000\003\201\215"
-"\000\060\201\211\002\201\201\000\266\132\213\243\015\152\043\203"
-"\200\153\317\071\207\364\041\023\063\006\114\045\242\355\125\022"
-"\227\305\247\200\271\372\203\301\040\240\372\057\025\015\174\241"
-"\140\153\176\171\054\372\006\017\072\256\366\033\157\261\322\377"
-"\057\050\122\137\203\175\113\304\172\267\370\146\037\200\124\374"
-"\267\302\216\131\112\024\127\106\321\232\223\276\101\221\003\273"
-"\025\200\223\134\353\347\314\010\154\077\076\263\112\374\377\113"
-"\154\043\325\120\202\046\104\031\216\043\303\161\352\031\044\107"
-"\004\236\165\277\310\246\000\037\002\003\001\000\001\060\015\006"
-"\011\052\206\110\206\367\015\001\001\002\005\000\003\201\201\000"
-"\212\033\053\372\071\301\164\327\136\330\031\144\242\130\112\055"
-"\067\340\063\107\017\254\355\367\252\333\036\344\213\006\134\140"
-"\047\312\105\122\316\026\357\077\006\144\347\224\150\174\140\063"
-"\025\021\151\257\235\142\215\243\003\124\153\246\276\345\356\005"
-"\030\140\004\277\102\200\375\320\250\250\036\001\073\367\243\134"
-"\257\243\334\346\046\200\043\074\270\104\164\367\012\256\111\213"
-"\141\170\314\044\277\210\212\247\016\352\163\031\101\375\115\003"
-"\360\210\321\345\170\215\245\052\117\366\227\015\027\167\312\330"
-, (PRUint32)576 }
-};
-static const NSSItem nss_builtins_items_17 [] = {
-  { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
-  { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
-  { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
-  { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
-  { (void *)"Verisign Class 2 Public Primary Certification Authority", (PRUint32)56 },
-  { (void *)"\147\202\252\340\355\356\342\032\130\071\323\300\315\024\150\012"
-"\117\140\024\052"
-, (PRUint32)20 },
-  { (void *)"\263\234\045\261\303\056\062\123\200\025\060\235\115\002\167\076"
-, (PRUint32)16 },
-  { (void *)"\060\137\061\013\060\011\006\003\125\004\006\023\002\125\123\061"
-"\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123\151"
-"\147\156\054\040\111\156\143\056\061\067\060\065\006\003\125\004"
-"\013\023\056\103\154\141\163\163\040\062\040\120\165\142\154\151"
-"\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151\146"
-"\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151\164"
-"\171"
-, (PRUint32)97 },
-  { (void *)"\002\020\055\033\374\112\027\215\243\221\353\347\377\365\213\105"
-"\276\013"
-, (PRUint32)18 },
-  { (void *)&ckt_nss_trust_unknown, (PRUint32)sizeof(CK_TRUST) },
-  { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
-  { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
-  { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
-};
-static const NSSItem nss_builtins_items_18 [] = {
-  { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
-  { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
-  { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
-  { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Verisign Class 3 Public Primary Certification Authority", (PRUint32)56 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\137\061\013\060\011\006\003\125\004\006\023\002\125\123\061"
 "\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123\151"
 "\147\156\054\040\111\156\143\056\061\067\060\065\006\003\125\004"
 "\013\023\056\103\154\141\163\163\040\063\040\120\165\142\154\151"
 "\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151\146"
 "\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151\164"
@@ -1990,17 +1793,17 @@ static const NSSItem nss_builtins_items_
 "\225\274\035\217\154\054\250\121\314\163\330\244\300\123\360\116"
 "\326\046\300\166\001\127\201\222\136\041\361\321\261\377\347\320"
 "\041\130\315\151\027\343\104\034\234\031\104\071\211\134\334\234"
 "\000\017\126\215\002\231\355\242\220\105\114\344\273\020\244\075"
 "\360\062\003\016\361\316\370\350\311\121\214\346\142\237\346\237"
 "\300\175\267\162\234\311\066\072\153\237\116\250\377\144\015\144"
 , (PRUint32)576 }
 };
-static const NSSItem nss_builtins_items_19 [] = {
+static const NSSItem nss_builtins_items_15 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Verisign Class 3 Public Primary Certification Authority", (PRUint32)56 },
   { (void *)"\164\054\061\222\346\007\344\044\353\105\111\124\053\341\273\305"
 "\076\141\164\342"
 , (PRUint32)20 },
@@ -2017,17 +1820,17 @@ static const NSSItem nss_builtins_items_
   { (void *)"\002\020\160\272\344\035\020\331\051\064\266\070\312\173\003\314"
 "\272\277"
 , (PRUint32)18 },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_20 [] = {
+static const NSSItem nss_builtins_items_16 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Verisign Class 1 Public Primary Certification Authority - G2", (PRUint32)61 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\201\301\061\013\060\011\006\003\125\004\006\023\002\125\123"
 "\061\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123"
@@ -2107,17 +1910,17 @@ static const NSSItem nss_builtins_items_
 "\261\135\363\307\266\012\333\340\025\223\015\335\003\274\307\166"
 "\212\265\335\117\303\233\023\165\270\001\300\346\311\133\153\245"
 "\270\211\334\254\244\335\162\355\116\241\367\117\274\006\323\352"
 "\310\144\164\173\302\225\101\234\145\163\130\361\220\232\074\152"
 "\261\230\311\304\207\274\317\105\155\105\342\156\042\077\376\274"
 "\017\061\134\350\362\331"
 , (PRUint32)774 }
 };
-static const NSSItem nss_builtins_items_21 [] = {
+static const NSSItem nss_builtins_items_17 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Verisign Class 1 Public Primary Certification Authority - G2", (PRUint32)61 },
   { (void *)"\047\076\341\044\127\375\304\371\014\125\350\053\126\026\177\142"
 "\365\062\345\107"
 , (PRUint32)20 },
@@ -2140,17 +1943,17 @@ static const NSSItem nss_builtins_items_
   { (void *)"\002\020\114\307\352\252\230\076\161\323\223\020\370\075\072\211"
 "\221\222"
 , (PRUint32)18 },
   { (void *)&ckt_nss_trust_unknown, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trust_unknown, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_22 [] = {
+static const NSSItem nss_builtins_items_18 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Verisign Class 2 Public Primary Certification Authority - G2", (PRUint32)61 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\201\301\061\013\060\011\006\003\125\004\006\023\002\125\123"
 "\061\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123"
@@ -2230,17 +2033,17 @@ static const NSSItem nss_builtins_items_
 "\225\366\044\140\206\115\104\056\203\245\304\055\240\323\256\170"
 "\151\157\162\332\154\256\010\360\143\222\067\346\273\304\060\027"
 "\255\167\314\111\065\252\317\330\217\321\276\267\030\226\107\163"
 "\152\124\042\064\144\055\266\026\233\131\133\264\121\131\072\263"
 "\013\024\364\022\337\147\240\364\255\062\144\136\261\106\162\047"
 "\214\022\173\305\104\264\256"
 , (PRUint32)775 }
 };
-static const NSSItem nss_builtins_items_23 [] = {
+static const NSSItem nss_builtins_items_19 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Verisign Class 2 Public Primary Certification Authority - G2", (PRUint32)61 },
   { (void *)"\263\352\304\107\166\311\310\034\352\362\235\225\266\314\240\010"
 "\033\147\354\235"
 , (PRUint32)20 },
@@ -2263,17 +2066,17 @@ static const NSSItem nss_builtins_items_
   { (void *)"\002\021\000\271\057\140\314\210\237\241\172\106\011\270\133\160"
 "\154\212\257"
 , (PRUint32)19 },
   { (void *)&ckt_nss_trust_unknown, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_24 [] = {
+static const NSSItem nss_builtins_items_20 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Verisign Class 3 Public Primary Certification Authority - G2", (PRUint32)61 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\201\301\061\013\060\011\006\003\125\004\006\023\002\125\123"
 "\061\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123"
@@ -2353,17 +2156,17 @@ static const NSSItem nss_builtins_items_
 "\141\222\137\246\304\035\020\141\066\323\054\047\074\350\051\011"
 "\271\021\144\164\314\265\163\237\034\110\251\274\141\001\356\342"
 "\027\246\014\343\100\010\073\016\347\353\104\163\052\232\361\151"
 "\222\357\161\024\303\071\254\161\247\221\011\157\344\161\006\263"
 "\272\131\127\046\171\000\366\370\015\242\063\060\050\324\252\130"
 "\240\235\235\151\221\375"
 , (PRUint32)774 }
 };
-static const NSSItem nss_builtins_items_25 [] = {
+static const NSSItem nss_builtins_items_21 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Verisign Class 3 Public Primary Certification Authority - G2", (PRUint32)61 },
   { (void *)"\205\067\034\246\345\120\024\075\316\050\003\107\033\336\072\011"
 "\350\370\167\017"
 , (PRUint32)20 },
@@ -2386,140 +2189,17 @@ static const NSSItem nss_builtins_items_
   { (void *)"\002\020\175\331\376\007\317\250\036\267\020\171\147\373\247\211"
 "\064\306"
 , (PRUint32)18 },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_26 [] = {
-  { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
-  { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
-  { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
-  { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
-  { (void *)"Verisign Class 4 Public Primary Certification Authority - G2", (PRUint32)61 },
-  { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
-  { (void *)"\060\201\301\061\013\060\011\006\003\125\004\006\023\002\125\123"
-"\061\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123"
-"\151\147\156\054\040\111\156\143\056\061\074\060\072\006\003\125"
-"\004\013\023\063\103\154\141\163\163\040\064\040\120\165\142\154"
-"\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151"
-"\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151"
-"\164\171\040\055\040\107\062\061\072\060\070\006\003\125\004\013"
-"\023\061\050\143\051\040\061\071\071\070\040\126\145\162\151\123"
-"\151\147\156\054\040\111\156\143\056\040\055\040\106\157\162\040"
-"\141\165\164\150\157\162\151\172\145\144\040\165\163\145\040\157"
-"\156\154\171\061\037\060\035\006\003\125\004\013\023\026\126\145"
-"\162\151\123\151\147\156\040\124\162\165\163\164\040\116\145\164"
-"\167\157\162\153"
-, (PRUint32)196 },
-  { (void *)"0", (PRUint32)2 },
-  { (void *)"\060\201\301\061\013\060\011\006\003\125\004\006\023\002\125\123"
-"\061\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123"
-"\151\147\156\054\040\111\156\143\056\061\074\060\072\006\003\125"
-"\004\013\023\063\103\154\141\163\163\040\064\040\120\165\142\154"
-"\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151"
-"\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151"
-"\164\171\040\055\040\107\062\061\072\060\070\006\003\125\004\013"
-"\023\061\050\143\051\040\061\071\071\070\040\126\145\162\151\123"
-"\151\147\156\054\040\111\156\143\056\040\055\040\106\157\162\040"
-"\141\165\164\150\157\162\151\172\145\144\040\165\163\145\040\157"
-"\156\154\171\061\037\060\035\006\003\125\004\013\023\026\126\145"
-"\162\151\123\151\147\156\040\124\162\165\163\164\040\116\145\164"
-"\167\157\162\153"
-, (PRUint32)196 },
-  { (void *)"\002\020\062\210\216\232\322\365\353\023\107\370\177\304\040\067"
-"\045\370"
-, (PRUint32)18 },
-  { (void *)"\060\202\003\002\060\202\002\153\002\020\062\210\216\232\322\365"
-"\353\023\107\370\177\304\040\067\045\370\060\015\006\011\052\206"
-"\110\206\367\015\001\001\005\005\000\060\201\301\061\013\060\011"
-"\006\003\125\004\006\023\002\125\123\061\027\060\025\006\003\125"
-"\004\012\023\016\126\145\162\151\123\151\147\156\054\040\111\156"
-"\143\056\061\074\060\072\006\003\125\004\013\023\063\103\154\141"
-"\163\163\040\064\040\120\165\142\154\151\143\040\120\162\151\155"
-"\141\162\171\040\103\145\162\164\151\146\151\143\141\164\151\157"
-"\156\040\101\165\164\150\157\162\151\164\171\040\055\040\107\062"
-"\061\072\060\070\006\003\125\004\013\023\061\050\143\051\040\061"
-"\071\071\070\040\126\145\162\151\123\151\147\156\054\040\111\156"
-"\143\056\040\055\040\106\157\162\040\141\165\164\150\157\162\151"
-"\172\145\144\040\165\163\145\040\157\156\154\171\061\037\060\035"
-"\006\003\125\004\013\023\026\126\145\162\151\123\151\147\156\040"
-"\124\162\165\163\164\040\116\145\164\167\157\162\153\060\036\027"
-"\015\071\070\060\065\061\070\060\060\060\060\060\060\132\027\015"
-"\062\070\060\070\060\061\062\063\065\071\065\071\132\060\201\301"
-"\061\013\060\011\006\003\125\004\006\023\002\125\123\061\027\060"
-"\025\006\003\125\004\012\023\016\126\145\162\151\123\151\147\156"
-"\054\040\111\156\143\056\061\074\060\072\006\003\125\004\013\023"
-"\063\103\154\141\163\163\040\064\040\120\165\142\154\151\143\040"
-"\120\162\151\155\141\162\171\040\103\145\162\164\151\146\151\143"
-"\141\164\151\157\156\040\101\165\164\150\157\162\151\164\171\040"
-"\055\040\107\062\061\072\060\070\006\003\125\004\013\023\061\050"
-"\143\051\040\061\071\071\070\040\126\145\162\151\123\151\147\156"
-"\054\040\111\156\143\056\040\055\040\106\157\162\040\141\165\164"
-"\150\157\162\151\172\145\144\040\165\163\145\040\157\156\154\171"
-"\061\037\060\035\006\003\125\004\013\023\026\126\145\162\151\123"
-"\151\147\156\040\124\162\165\163\164\040\116\145\164\167\157\162"
-"\153\060\201\237\060\015\006\011\052\206\110\206\367\015\001\001"
-"\001\005\000\003\201\215\000\060\201\211\002\201\201\000\272\360"
-"\344\317\371\304\256\205\124\271\007\127\371\217\305\177\150\021"
-"\370\304\027\260\104\334\343\060\163\325\052\142\052\270\320\314"
-"\034\355\050\133\176\275\152\334\263\221\044\312\101\142\074\374"
-"\002\001\277\034\026\061\224\005\227\166\156\242\255\275\141\027"
-"\154\116\060\206\360\121\067\052\120\307\250\142\201\334\133\112"
-"\252\301\240\264\156\353\057\345\127\305\261\053\100\160\333\132"
-"\115\241\216\037\275\003\037\330\003\324\217\114\231\161\274\342"
-"\202\314\130\350\230\072\206\323\206\070\363\000\051\037\002\003"
-"\001\000\001\060\015\006\011\052\206\110\206\367\015\001\001\005"
-"\005\000\003\201\201\000\205\214\022\301\247\271\120\025\172\313"
-"\076\254\270\103\212\334\252\335\024\272\211\201\176\001\074\043"
-"\161\041\210\057\202\334\143\372\002\105\254\105\131\327\052\130"
-"\104\133\267\237\201\073\222\150\075\342\067\044\365\173\154\217"
-"\166\065\226\011\250\131\235\271\316\043\253\164\326\203\375\062"
-"\163\047\330\151\076\103\164\366\256\305\211\232\347\123\174\351"
-"\173\366\113\363\301\145\203\336\215\212\234\074\210\215\071\131"
-"\374\252\077\042\215\241\301\146\120\201\162\114\355\042\144\117"
-"\117\312\200\221\266\051"
-, (PRUint32)774 }
-};
-static const NSSItem nss_builtins_items_27 [] = {
-  { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
-  { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
-  { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
-  { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
-  { (void *)"Verisign Class 4 Public Primary Certification Authority - G2", (PRUint32)61 },
-  { (void *)"\013\167\276\273\313\172\242\107\005\336\314\017\275\152\002\374"
-"\172\275\233\122"
-, (PRUint32)20 },
-  { (void *)"\046\155\054\031\230\266\160\150\070\120\124\031\354\220\064\140"
-, (PRUint32)16 },
-  { (void *)"\060\201\301\061\013\060\011\006\003\125\004\006\023\002\125\123"
-"\061\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123"
-"\151\147\156\054\040\111\156\143\056\061\074\060\072\006\003\125"
-"\004\013\023\063\103\154\141\163\163\040\064\040\120\165\142\154"
-"\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151"
-"\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151"
-"\164\171\040\055\040\107\062\061\072\060\070\006\003\125\004\013"
-"\023\061\050\143\051\040\061\071\071\070\040\126\145\162\151\123"
-"\151\147\156\054\040\111\156\143\056\040\055\040\106\157\162\040"
-"\141\165\164\150\157\162\151\172\145\144\040\165\163\145\040\157"
-"\156\154\171\061\037\060\035\006\003\125\004\013\023\026\126\145"
-"\162\151\123\151\147\156\040\124\162\165\163\164\040\116\145\164"
-"\167\157\162\153"
-, (PRUint32)196 },
-  { (void *)"\002\020\062\210\216\232\322\365\353\023\107\370\177\304\040\067"
-"\045\370"
-, (PRUint32)18 },
-  { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
-  { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
-  { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
-  { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
-};
-static const NSSItem nss_builtins_items_28 [] = {
+static const NSSItem nss_builtins_items_22 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"GlobalSign Root CA", (PRUint32)19 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\127\061\013\060\011\006\003\125\004\006\023\002\102\105\061"
 "\031\060\027\006\003\125\004\012\023\020\107\154\157\142\141\154"
@@ -2591,17 +2271,17 @@ static const NSSItem nss_builtins_items_
 "\052\304\126\061\225\320\147\211\205\053\371\154\246\135\106\235"
 "\014\252\202\344\231\121\335\160\267\333\126\075\141\344\152\341"
 "\134\326\366\376\075\336\101\314\007\256\143\122\277\123\123\364"
 "\053\351\307\375\266\367\202\137\205\322\101\030\333\201\263\004"
 "\034\305\037\244\200\157\025\040\311\336\014\210\012\035\326\146"
 "\125\342\374\110\311\051\046\151\340"
 , (PRUint32)889 }
 };
-static const NSSItem nss_builtins_items_29 [] = {
+static const NSSItem nss_builtins_items_23 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"GlobalSign Root CA", (PRUint32)19 },
   { (void *)"\261\274\226\213\324\364\235\142\052\250\232\201\362\025\001\122"
 "\244\035\202\234"
 , (PRUint32)20 },
@@ -2616,17 +2296,17 @@ static const NSSItem nss_builtins_items_
 , (PRUint32)89 },
   { (void *)"\002\013\004\000\000\000\000\001\025\113\132\303\224"
 , (PRUint32)13 },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_30 [] = {
+static const NSSItem nss_builtins_items_24 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"GlobalSign Root CA - R2", (PRUint32)24 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\114\061\040\060\036\006\003\125\004\013\023\027\107\154\157"
 "\142\141\154\123\151\147\156\040\122\157\157\164\040\103\101\040"
@@ -2700,17 +2380,17 @@ static const NSSItem nss_builtins_items_
 "\001\373\303\155\271\357\104\155\171\106\061\176\012\376\251\202"
 "\301\377\357\253\156\040\304\120\311\137\235\115\233\027\214\014"
 "\345\001\311\240\101\152\163\123\372\245\120\264\156\045\017\373"
 "\114\030\364\375\122\331\216\151\261\350\021\017\336\210\330\373"
 "\035\111\367\252\336\225\317\040\170\302\140\022\333\045\100\214"
 "\152\374\176\102\070\100\144\022\367\236\201\341\223\056"
 , (PRUint32)958 }
 };
-static const NSSItem nss_builtins_items_31 [] = {
+static const NSSItem nss_builtins_items_25 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"GlobalSign Root CA - R2", (PRUint32)24 },
   { (void *)"\165\340\253\266\023\205\022\047\034\004\370\137\335\336\070\344"
 "\267\044\056\376"
 , (PRUint32)20 },
@@ -2724,17 +2404,17 @@ static const NSSItem nss_builtins_items_
 , (PRUint32)78 },
   { (void *)"\002\013\004\000\000\000\000\001\017\206\046\346\015"
 , (PRUint32)13 },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_32 [] = {
+static const NSSItem nss_builtins_items_26 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"ValiCert Class 1 VA", (PRUint32)20 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\201\273\061\044\060\042\006\003\125\004\007\023\033\126\141"
 "\154\151\103\145\162\164\040\126\141\154\151\144\141\164\151\157"
@@ -2809,17 +2489,17 @@ static const NSSItem nss_builtins_items_
 "\322\265\247\122\376\234\261\266\342\133\167\027\100\352\162\326"
 "\043\313\050\201\062\303\000\171\030\354\131\027\211\311\306\152"
 "\036\161\311\375\267\164\245\045\105\151\305\110\253\031\341\105"
 "\212\045\153\031\356\345\273\022\365\177\367\246\215\121\303\360"
 "\235\164\267\251\076\240\245\377\266\111\003\023\332\042\314\355"
 "\161\202\053\231\317\072\267\365\055\162\310"
 , (PRUint32)747 }
 };
-static const NSSItem nss_builtins_items_33 [] = {
+static const NSSItem nss_builtins_items_27 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"ValiCert Class 1 VA", (PRUint32)20 },
   { (void *)"\345\337\164\074\266\001\304\233\230\103\334\253\214\350\152\201"
 "\020\237\344\216"
 , (PRUint32)20 },
@@ -2840,17 +2520,17 @@ static const NSSItem nss_builtins_items_
 , (PRUint32)190 },
   { (void *)"\002\001\001"
 , (PRUint32)3 },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_34 [] = {
+static const NSSItem nss_builtins_items_28 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"ValiCert Class 2 VA", (PRUint32)20 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\201\273\061\044\060\042\006\003\125\004\007\023\033\126\141"
 "\154\151\103\145\162\164\040\126\141\154\151\144\141\164\151\157"
@@ -2925,17 +2605,17 @@ static const NSSItem nss_builtins_items_
 "\250\130\177\241\171\000\265\273\351\215\257\101\331\017\064\356"
 "\041\201\031\240\062\111\050\364\304\216\126\325\122\063\375\120"
 "\325\176\231\154\003\344\311\114\374\313\154\253\146\263\112\041"
 "\214\345\265\014\062\076\020\262\314\154\241\334\232\230\114\002"
 "\133\363\316\271\236\245\162\016\112\267\077\074\346\026\150\370"
 "\276\355\164\114\274\133\325\142\037\103\335"
 , (PRUint32)747 }
 };
-static const NSSItem nss_builtins_items_35 [] = {
+static const NSSItem nss_builtins_items_29 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"ValiCert Class 2 VA", (PRUint32)20 },
   { (void *)"\061\172\052\320\177\053\063\136\365\241\303\116\113\127\350\267"
 "\330\361\374\246"
 , (PRUint32)20 },
@@ -2956,17 +2636,17 @@ static const NSSItem nss_builtins_items_
 , (PRUint32)190 },
   { (void *)"\002\001\001"
 , (PRUint32)3 },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_36 [] = {
+static const NSSItem nss_builtins_items_30 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"RSA Root Certificate 1", (PRUint32)23 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\201\273\061\044\060\042\006\003\125\004\007\023\033\126\141"
 "\154\151\103\145\162\164\040\126\141\154\151\144\141\164\151\157"
@@ -3041,17 +2721,17 @@ static const NSSItem nss_builtins_items_
 "\076\317\251\124\364\361\330\222\026\214\321\004\313\113\253\311"
 "\237\105\256\074\212\251\260\161\063\135\310\305\127\337\257\250"
 "\065\263\177\211\207\351\350\045\222\270\177\205\172\256\326\274"
 "\036\067\130\052\147\311\221\317\052\201\076\355\306\071\337\300"
 "\076\031\234\031\314\023\115\202\101\265\214\336\340\075\140\010"
 "\040\017\105\176\153\242\177\243\214\025\356"
 , (PRUint32)747 }
 };
-static const NSSItem nss_builtins_items_37 [] = {
+static const NSSItem nss_builtins_items_31 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"RSA Root Certificate 1", (PRUint32)23 },
   { (void *)"\151\275\214\364\234\323\000\373\131\056\027\223\312\125\152\363"
 "\354\252\065\373"
 , (PRUint32)20 },
@@ -3072,17 +2752,17 @@ static const NSSItem nss_builtins_items_
 , (PRUint32)190 },
   { (void *)"\002\001\001"
 , (PRUint32)3 },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_38 [] = {
+static const NSSItem nss_builtins_items_32 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Verisign Class 1 Public Primary Certification Authority - G3", (PRUint32)61 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\201\312\061\013\060\011\006\003\125\004\006\023\002\125\123"
 "\061\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123"
@@ -3179,17 +2859,17 @@ static const NSSItem nss_builtins_items_
 "\245\040\200\151\150\241\117\176\341\153\317\007\101\372\203\216"
 "\274\070\335\260\056\021\261\153\262\102\314\232\274\371\110\042"
 "\171\112\031\017\262\034\076\040\164\331\152\303\276\362\050\170"
 "\023\126\171\117\155\120\352\033\260\265\127\261\067\146\130\043"
 "\363\334\017\337\012\207\304\357\206\005\325\070\024\140\231\243"
 "\113\336\006\226\161\054\362\333\266\037\244\357\077\356"
 , (PRUint32)1054 }
 };
-static const NSSItem nss_builtins_items_39 [] = {
+static const NSSItem nss_builtins_items_33 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Verisign Class 1 Public Primary Certification Authority - G3", (PRUint32)61 },
   { (void *)"\040\102\205\334\367\353\166\101\225\127\216\023\153\324\267\321"
 "\351\216\106\245"
 , (PRUint32)20 },
@@ -3212,17 +2892,17 @@ static const NSSItem nss_builtins_items_
   { (void *)"\002\021\000\213\133\165\126\204\124\205\013\000\317\257\070\110"
 "\316\261\244"
 , (PRUint32)19 },
   { (void *)&ckt_nss_trust_unknown, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trust_unknown, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_40 [] = {
+static const NSSItem nss_builtins_items_34 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Verisign Class 2 Public Primary Certification Authority - G3", (PRUint32)61 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\201\312\061\013\060\011\006\003\125\004\006\023\002\125\123"
 "\061\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123"
@@ -3319,17 +2999,17 @@ static const NSSItem nss_builtins_items_
 "\260\177\373\066\045\332\225\320\361\044\024\027\335\030\200\153"
 "\106\043\071\124\365\216\142\011\004\035\224\220\246\233\346\045"
 "\342\102\105\252\270\220\255\276\010\217\251\013\102\030\224\317"
 "\162\071\341\261\103\340\050\317\267\347\132\154\023\153\111\263"
 "\377\343\030\174\211\213\063\135\254\063\327\247\371\332\072\125"
 "\311\130\020\371\252\357\132\266\317\113\113\337\052"
 , (PRUint32)1053 }
 };
-static const NSSItem nss_builtins_items_41 [] = {
+static const NSSItem nss_builtins_items_35 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Verisign Class 2 Public Primary Certification Authority - G3", (PRUint32)61 },
   { (void *)"\141\357\103\327\177\312\324\141\121\274\230\340\303\131\022\257"
 "\237\353\143\021"
 , (PRUint32)20 },
@@ -3352,17 +3032,17 @@ static const NSSItem nss_builtins_items_
   { (void *)"\002\020\141\160\313\111\214\137\230\105\051\347\260\246\331\120"
 "\133\172"
 , (PRUint32)18 },
   { (void *)&ckt_nss_trust_unknown, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_42 [] = {
+static const NSSItem nss_builtins_items_36 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Verisign Class 3 Public Primary Certification Authority - G3", (PRUint32)61 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\201\312\061\013\060\011\006\003\125\004\006\023\002\125\123"
 "\061\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123"
@@ -3459,17 +3139,17 @@ static const NSSItem nss_builtins_items_
 "\027\201\053\132\067\311\136\052\364\306\342\241\134\124\233\246"
 "\124\000\317\360\361\301\307\230\060\032\073\066\026\333\243\156"
 "\352\375\255\262\302\332\357\002\107\023\212\300\361\263\061\255"
 "\117\034\341\117\234\257\017\014\235\367\170\015\330\364\065\126"
 "\200\332\267\155\027\217\235\036\201\144\341\376\305\105\272\255"
 "\153\271\012\172\116\117\113\204\356\113\361\175\335\021"
 , (PRUint32)1054 }
 };
-static const NSSItem nss_builtins_items_43 [] = {
+static const NSSItem nss_builtins_items_37 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Verisign Class 3 Public Primary Certification Authority - G3", (PRUint32)61 },
   { (void *)"\023\055\015\105\123\113\151\227\315\262\325\303\071\342\125\166"
 "\140\233\134\306"
 , (PRUint32)20 },
@@ -3492,17 +3172,17 @@ static const NSSItem nss_builtins_items_
   { (void *)"\002\021\000\233\176\006\111\243\076\142\271\325\356\220\110\161"
 "\051\357\127"
 , (PRUint32)19 },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_44 [] = {
+static const NSSItem nss_builtins_items_38 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Verisign Class 4 Public Primary Certification Authority - G3", (PRUint32)61 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\201\312\061\013\060\011\006\003\125\004\006\023\002\125\123"
 "\061\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123"
@@ -3599,17 +3279,17 @@ static const NSSItem nss_builtins_items_
 "\330\325\074\102\035\027\301\022\135\105\070\303\070\363\374\205"
 "\056\203\106\110\262\327\040\137\222\066\217\347\171\017\230\136"
 "\231\350\360\320\244\273\365\123\275\052\316\131\260\257\156\177"
 "\154\273\322\036\000\260\041\355\370\101\142\202\271\330\262\304"
 "\273\106\120\363\061\305\217\001\250\164\353\365\170\047\332\347"
 "\367\146\103\363\236\203\076\040\252\303\065\140\221\316"
 , (PRUint32)1054 }
 };
-static const NSSItem nss_builtins_items_45 [] = {
+static const NSSItem nss_builtins_items_39 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Verisign Class 4 Public Primary Certification Authority - G3", (PRUint32)61 },
   { (void *)"\310\354\214\207\222\151\313\113\253\071\351\215\176\127\147\363"
 "\024\225\163\235"
 , (PRUint32)20 },
@@ -3632,17 +3312,17 @@ static const NSSItem nss_builtins_items_
   { (void *)"\002\021\000\354\240\247\213\156\165\152\001\317\304\174\314\057"
 "\224\136\327"
 , (PRUint32)19 },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_46 [] = {
+static const NSSItem nss_builtins_items_40 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Entrust.net Secure Server CA", (PRUint32)29 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\201\303\061\013\060\011\006\003\125\004\006\023\002\125\123"
 "\061\024\060\022\006\003\125\004\012\023\013\105\156\164\162\165"
@@ -3750,17 +3430,17 @@ static const NSSItem nss_builtins_items_
 "\367\222\276\361\303\325\325\225\152\004\273\054\316\046\066\145"
 "\310\061\306\347\356\077\343\127\165\204\172\021\357\106\117\030"
 "\364\323\230\273\250\207\062\272\162\366\074\342\075\237\327\035"
 "\331\303\140\103\214\130\016\042\226\057\142\243\054\037\272\255"
 "\005\357\253\062\170\207\240\124\163\031\265\134\005\371\122\076"
 "\155\055\105\013\367\012\223\352\355\006\371\262"
 , (PRUint32)1244 }
 };
-static const NSSItem nss_builtins_items_47 [] = {
+static const NSSItem nss_builtins_items_41 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Entrust.net Secure Server CA", (PRUint32)29 },
   { (void *)"\231\246\233\346\032\376\210\153\115\053\202\000\174\270\124\374"
 "\061\176\025\071"
 , (PRUint32)20 },
@@ -3782,17 +3462,17 @@ static const NSSItem nss_builtins_items_
 , (PRUint32)198 },
   { (void *)"\002\004\067\112\322\103"
 , (PRUint32)6 },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_48 [] = {
+static const NSSItem nss_builtins_items_42 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Entrust.net Premium 2048 Secure Server CA", (PRUint32)42 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\201\264\061\024\060\022\006\003\125\004\012\023\013\105\156"
 "\164\162\165\163\164\056\156\145\164\061\100\060\076\006\003\125"
@@ -3890,17 +3570,17 @@ static const NSSItem nss_builtins_items_
 "\015\063\333\004\321\346\111\100\023\053\166\373\076\351\234\211"
 "\017\025\316\030\260\205\170\041\117\153\117\016\372\066\147\315"
 "\007\362\377\010\320\342\336\331\277\052\257\270\207\206\041\074"
 "\004\312\267\224\150\177\317\074\351\230\327\070\377\354\300\331"
 "\120\360\056\113\130\256\106\157\320\056\303\140\332\162\125\162"
 "\275\114\105\236\141\272\277\204\201\222\003\321\322\151\174\305"
 , (PRUint32)1120 }
 };
-static const NSSItem nss_builtins_items_49 [] = {
+static const NSSItem nss_builtins_items_43 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Entrust.net Premium 2048 Secure Server CA", (PRUint32)42 },
   { (void *)"\200\035\142\320\173\104\235\134\134\003\134\230\352\141\372\104"
 "\074\052\130\376"
 , (PRUint32)20 },
@@ -3921,17 +3601,17 @@ static const NSSItem nss_builtins_items_
 , (PRUint32)183 },
   { (void *)"\002\004\070\143\271\146"
 , (PRUint32)6 },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_50 [] = {
+static const NSSItem nss_builtins_items_44 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Baltimore CyberTrust Root", (PRUint32)26 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\132\061\013\060\011\006\003\125\004\006\023\002\111\105\061"
 "\022\060\020\006\003\125\004\012\023\011\102\141\154\164\151\155"
@@ -4003,17 +3683,17 @@ static const NSSItem nss_builtins_items_
 "\144\346\037\267\316\360\362\237\056\273\033\267\362\120\210\163"
 "\222\302\342\343\026\215\232\062\002\253\216\030\335\351\020\021"
 "\356\176\065\253\220\257\076\060\224\172\320\063\075\247\145\017"
 "\365\374\216\236\142\317\107\104\054\001\135\273\035\265\062\322"
 "\107\322\070\056\320\376\201\334\062\152\036\265\356\074\325\374"
 "\347\201\035\031\303\044\102\352\143\071\251"
 , (PRUint32)891 }
 };
-static const NSSItem nss_builtins_items_51 [] = {
+static const NSSItem nss_builtins_items_45 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Baltimore CyberTrust Root", (PRUint32)26 },
   { (void *)"\324\336\040\320\136\146\374\123\376\032\120\210\054\170\333\050"
 "\122\312\344\164"
 , (PRUint32)20 },
@@ -4028,17 +3708,17 @@ static const NSSItem nss_builtins_items_
 , (PRUint32)92 },
   { (void *)"\002\004\002\000\000\271"
 , (PRUint32)6 },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trust_unknown, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_52 [] = {
+static const NSSItem nss_builtins_items_46 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Equifax Secure Global eBusiness CA", (PRUint32)35 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\132\061\013\060\011\006\003\125\004\006\023\002\125\123\061"
 "\034\060\032\006\003\125\004\012\023\023\105\161\165\151\146\141"
@@ -4096,17 +3776,17 @@ static const NSSItem nss_builtins_items_
 "\147\275\001\257\315\340\161\374\132\317\144\304\340\226\230\320"
 "\243\100\342\001\212\357\047\007\361\145\001\212\104\055\006\145"
 "\165\122\300\206\020\040\041\137\154\153\017\154\256\011\034\257"
 "\362\242\030\064\304\165\244\163\034\361\215\334\357\255\371\263"
 "\166\264\222\277\334\225\020\036\276\313\310\073\132\204\140\031"
 "\126\224\251\125"
 , (PRUint32)660 }
 };
-static const NSSItem nss_builtins_items_53 [] = {
+static const NSSItem nss_builtins_items_47 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Equifax Secure Global eBusiness CA", (PRUint32)35 },
   { (void *)"\176\170\112\020\034\202\145\314\055\341\361\155\107\264\100\312"
 "\331\012\031\105"
 , (PRUint32)20 },
@@ -4121,17 +3801,17 @@ static const NSSItem nss_builtins_items_
 , (PRUint32)92 },
   { (void *)"\002\001\001"
 , (PRUint32)3 },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_54 [] = {
+static const NSSItem nss_builtins_items_48 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Equifax Secure eBusiness CA 1", (PRUint32)30 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\123\061\013\060\011\006\003\125\004\006\023\002\125\123\061"
 "\034\060\032\006\003\125\004\012\023\023\105\161\165\151\146\141"
@@ -4188,17 +3868,17 @@ static const NSSItem nss_builtins_items_
 "\142\040\247\204\113\130\145\361\342\371\225\041\077\365\324\176"
 "\130\036\107\207\124\076\130\241\265\265\370\052\357\161\347\274"
 "\303\366\261\111\106\342\327\240\153\345\126\172\232\047\230\174"
 "\106\142\024\347\311\374\156\003\022\171\200\070\035\110\202\215"
 "\374\027\376\052\226\053\265\142\246\246\075\275\177\222\131\315"
 "\132\052\202\262\067\171"
 , (PRUint32)646 }
 };
-static const NSSItem nss_builtins_items_55 [] = {
+static const NSSItem nss_builtins_items_49 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Equifax Secure eBusiness CA 1", (PRUint32)30 },
   { (void *)"\332\100\030\213\221\211\243\355\356\256\332\227\376\057\235\365"
 "\267\321\212\101"
 , (PRUint32)20 },
@@ -4213,17 +3893,17 @@ static const NSSItem nss_builtins_items_
 , (PRUint32)85 },
   { (void *)"\002\001\004"
 , (PRUint32)3 },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_56 [] = {
+static const NSSItem nss_builtins_items_50 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Equifax Secure eBusiness CA 2", (PRUint32)30 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\116\061\013\060\011\006\003\125\004\006\023\002\125\123\061"
 "\027\060\025\006\003\125\004\012\023\016\105\161\165\151\146\141"
@@ -4288,17 +3968,17 @@ static const NSSItem nss_builtins_items_
 "\321\301\076\123\237\003\104\260\176\113\364\157\344\174\037\347"
 "\342\261\344\270\232\357\303\275\316\336\013\062\064\331\336\050"
 "\355\063\153\304\324\327\075\022\130\253\175\011\055\313\160\365"
 "\023\212\224\241\047\244\326\160\305\155\224\265\311\175\235\240"
 "\322\306\010\111\331\146\233\246\323\364\013\334\305\046\127\341"
 "\221\060\352\315"
 , (PRUint32)804 }
 };
-static const NSSItem nss_builtins_items_57 [] = {
+static const NSSItem nss_builtins_items_51 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Equifax Secure eBusiness CA 2", (PRUint32)30 },
   { (void *)"\071\117\366\205\013\006\276\122\345\030\126\314\020\341\200\350"
 "\202\263\205\314"
 , (PRUint32)20 },
@@ -4312,17 +3992,17 @@ static const NSSItem nss_builtins_items_
 , (PRUint32)80 },
   { (void *)"\002\004\067\160\317\265"
 , (PRUint32)6 },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_58 [] = {
+static const NSSItem nss_builtins_items_52 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"AddTrust Low-Value Services Root", (PRUint32)33 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\145\061\013\060\011\006\003\125\004\006\023\002\123\105\061"
 "\024\060\022\006\003\125\004\012\023\013\101\144\144\124\162\165"
@@ -4406,17 +4086,17 @@ static const NSSItem nss_builtins_items_
 "\247\077\376\321\146\255\013\274\153\231\206\357\077\175\363\030"
 "\062\312\173\306\343\253\144\106\225\370\046\151\331\125\203\173"
 "\054\226\007\377\131\054\104\243\306\345\351\251\334\241\143\200"
 "\132\041\136\041\317\123\124\360\272\157\211\333\250\252\225\317"
 "\213\343\161\314\036\033\040\104\010\300\172\266\100\375\304\344"
 "\065\341\035\026\034\320\274\053\216\326\161\331"
 , (PRUint32)1052 }
 };
-static const NSSItem nss_builtins_items_59 [] = {
+static const NSSItem nss_builtins_items_53 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"AddTrust Low-Value Services Root", (PRUint32)33 },
   { (void *)"\314\253\016\240\114\043\001\326\151\173\335\067\237\315\022\353"
 "\044\343\224\235"
 , (PRUint32)20 },
@@ -4432,17 +4112,17 @@ static const NSSItem nss_builtins_items_
 , (PRUint32)103 },
   { (void *)"\002\001\001"
 , (PRUint32)3 },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trust_unknown, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_60 [] = {
+static const NSSItem nss_builtins_items_54 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"AddTrust External Root", (PRUint32)23 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\157\061\013\060\011\006\003\125\004\006\023\002\123\105\061"
 "\024\060\022\006\003\125\004\012\023\013\101\144\144\124\162\165"
@@ -4530,17 +4210,17 @@ static const NSSItem nss_builtins_items_
 "\142\041\150\025\040\103\074\231\347\174\275\044\330\251\221\027"
 "\163\210\077\126\033\061\070\030\264\161\017\232\315\310\016\236"
 "\216\056\033\341\214\230\203\313\037\061\361\104\114\306\004\163"
 "\111\166\140\017\307\370\275\027\200\153\056\351\314\114\016\132"
 "\232\171\017\040\012\056\325\236\143\046\036\125\222\224\330\202"
 "\027\132\173\320\274\307\217\116\206\004"
 , (PRUint32)1082 }
 };
-static const NSSItem nss_builtins_items_61 [] = {
+static const NSSItem nss_builtins_items_55 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"AddTrust External Root", (PRUint32)23 },
   { (void *)"\002\372\363\342\221\103\124\150\140\170\127\151\115\365\344\133"
 "\150\205\030\150"
 , (PRUint32)20 },
@@ -4557,17 +4237,17 @@ static const NSSItem nss_builtins_items_
 , (PRUint32)113 },
   { (void *)"\002\001\001"
 , (PRUint32)3 },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_62 [] = {
+static const NSSItem nss_builtins_items_56 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"AddTrust Public Services Root", (PRUint32)30 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\144\061\013\060\011\006\003\125\004\006\023\002\123\105\061"
 "\024\060\022\006\003\125\004\012\023\013\101\144\144\124\162\165"
@@ -4651,17 +4331,17 @@ static const NSSItem nss_builtins_items_
 "\341\042\015\207\000\144\376\214\175\142\071\145\246\357\102\266"
 "\200\045\022\141\001\250\044\023\160\000\021\046\137\372\065\120"
 "\305\110\314\006\107\350\047\330\160\215\137\144\346\241\104\046"
 "\136\042\354\222\315\377\102\232\104\041\155\134\305\343\042\035"
 "\137\107\022\347\316\137\135\372\330\252\261\063\055\331\166\362"
 "\116\072\063\014\053\263\055\220\006"
 , (PRUint32)1049 }
 };
-static const NSSItem nss_builtins_items_63 [] = {
+static const NSSItem nss_builtins_items_57 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"AddTrust Public Services Root", (PRUint32)30 },
   { (void *)"\052\266\050\110\136\170\373\363\255\236\171\020\335\153\337\231"
 "\162\054\226\345"
 , (PRUint32)20 },
@@ -4677,17 +4357,17 @@ static const NSSItem nss_builtins_items_
 , (PRUint32)102 },
   { (void *)"\002\001\001"
 , (PRUint32)3 },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_64 [] = {
+static const NSSItem nss_builtins_items_58 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"AddTrust Qualified Certificates Root", (PRUint32)37 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\147\061\013\060\011\006\003\125\004\006\023\002\123\105\061"
 "\024\060\022\006\003\125\004\012\023\013\101\144\144\124\162\165"
@@ -4772,17 +4452,17 @@ static const NSSItem nss_builtins_items_
 "\011\371\277\122\241\356\302\200\076\006\134\056\125\100\301\033"
 "\365\160\105\260\334\135\372\366\162\132\167\322\143\315\317\130"
 "\211\000\102\143\077\171\071\320\104\260\202\156\101\031\350\335"
 "\340\301\210\132\321\036\161\223\037\044\060\164\345\036\250\336"
 "\074\047\067\177\203\256\236\167\317\360\060\261\377\113\231\350"
 "\306\241"
 , (PRUint32)1058 }
 };
-static const NSSItem nss_builtins_items_65 [] = {
+static const NSSItem nss_builtins_items_59 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"AddTrust Qualified Certificates Root", (PRUint32)37 },
   { (void *)"\115\043\170\354\221\225\071\265\000\177\165\217\003\073\041\036"
 "\305\115\213\317"
 , (PRUint32)20 },
@@ -4798,17 +4478,17 @@ static const NSSItem nss_builtins_items_
 , (PRUint32)105 },
   { (void *)"\002\001\001"
 , (PRUint32)3 },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_66 [] = {
+static const NSSItem nss_builtins_items_60 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Entrust Root Certification Authority", (PRUint32)37 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\201\260\061\013\060\011\006\003\125\004\006\023\002\125\123"
 "\061\026\060\024\006\003\125\004\012\023\015\105\156\164\162\165"
@@ -4910,17 +4590,17 @@ static const NSSItem nss_builtins_items_
 "\234\066\303\046\342\021\366\147\111\035\222\253\214\373\353\377"
 "\172\356\205\112\247\120\200\360\247\134\112\224\056\137\005\231"
 "\074\122\101\340\315\264\143\317\001\103\272\234\203\334\217\140"
 "\073\363\132\264\264\173\256\332\013\220\070\165\357\201\035\146"
 "\322\367\127\160\066\263\277\374\050\257\161\045\205\133\023\376"
 "\036\177\132\264\074"
 , (PRUint32)1173 }
 };
-static const NSSItem nss_builtins_items_67 [] = {
+static const NSSItem nss_builtins_items_61 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"Entrust Root Certification Authority", (PRUint32)37 },
   { (void *)"\263\036\261\267\100\343\154\204\002\332\334\067\324\115\365\324"
 "\147\111\122\371"
 , (PRUint32)20 },
@@ -4941,17 +4621,17 @@ static const NSSItem nss_builtins_items_
 , (PRUint32)179 },
   { (void *)"\002\004\105\153\120\124"
 , (PRUint32)6 },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trust_unknown, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trust_unknown, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_68 [] = {
+static const NSSItem nss_builtins_items_62 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"RSA Security 2048 v3", (PRUint32)21 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\072\061\031\060\027\006\003\125\004\012\023\020\122\123\101"
 "\040\123\145\143\165\162\151\164\171\040\111\156\143\061\035\060"
@@ -5019,17 +4699,17 @@ static const NSSItem nss_builtins_items_
 "\022\000\360\137\254\015\341\254\160\143\163\367\177\171\237\062"
 "\045\102\164\005\200\050\277\275\301\044\226\130\025\261\027\041"
 "\351\211\113\333\007\210\147\364\025\255\160\076\057\115\205\073"
 "\302\267\333\376\230\150\043\211\341\164\017\336\364\305\204\143"
 "\051\033\314\313\007\311\000\244\251\327\302\042\117\147\327\167"
 "\354\040\005\141\336"
 , (PRUint32)869 }
 };
-static const NSSItem nss_builtins_items_69 [] = {
+static const NSSItem nss_builtins_items_63 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"RSA Security 2048 v3", (PRUint32)21 },
   { (void *)"\045\001\220\031\317\373\331\231\034\267\150\045\164\215\224\137"
 "\060\223\225\102"
 , (PRUint32)20 },
@@ -5043,17 +4723,17 @@ static const NSSItem nss_builtins_items_
   { (void *)"\002\020\012\001\001\001\000\000\002\174\000\000\000\012\000\000"
 "\000\002"
 , (PRUint32)18 },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_70 [] = {
+static const NSSItem nss_builtins_items_64 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"GeoTrust Global CA", (PRUint32)19 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\102\061\013\060\011\006\003\125\004\006\023\002\125\123\061"
 "\026\060\024\006\003\125\004\012\023\015\107\145\157\124\162\165"
@@ -5121,17 +4801,17 @@ static const NSSItem nss_builtins_items_
 "\207\016\004\154\325\377\335\240\135\355\207\122\267\053\025\002"
 "\256\071\246\152\164\351\332\304\347\274\115\064\036\251\134\115"
 "\063\137\222\011\057\210\146\135\167\227\307\035\166\023\251\325"
 "\345\361\026\011\021\065\325\254\333\044\161\160\054\230\126\013"
 "\331\027\264\321\343\121\053\136\165\350\325\320\334\117\064\355"
 "\302\005\146\200\241\313\346\063"
 , (PRUint32)856 }
 };
-static const NSSItem nss_builtins_items_71 [] = {
+static const NSSItem nss_builtins_items_65 [] = {
   { (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"GeoTrust Global CA", (PRUint32)19 },
   { (void *)"\336\050\364\244\377\345\271\057\243\305\003\321\243\111\247\371"
 "\226\052\202\022"
 , (PRUint32)20 },
@@ -5145,17 +4825,17 @@ static const NSSItem nss_builtins_items_
 , (PRUint32)68 },
   { (void *)"\002\003\002\064\126"
 , (PRUint32)5 },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ckt_nss_trusted_delegator, (PRUint32)sizeof(CK_TRUST) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) }
 };
-static const NSSItem nss_builtins_items_72 [] = {
+static const NSSItem nss_builtins_items_66 [] = {
   { (void *)&cko_certificate, (PRUint32)sizeof(CK_OBJECT_CLASS) },
   { (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL) },
   { (void *)"GeoTrust Global CA 2", (PRUint32)21 },
   { (void *)&ckc_x_509, (PRUint32)sizeof(CK_CERTIFICATE_TYPE) },
   { (void *)"\060\104\061\013\060\011\006\003\125\004\006\023\002\125\123\061"
 "\026\060\024\006\003\125\004\012\023\015\107\145\157\124\162\165"
@@ -5224,17 +4904,17 @@ static const NSSItem nss_builtins_items_
 "\136\054\157\025\231\046\347\266\051\377\042\354\311\002\307\126"
 "\000\315\111\271\263\154\173\123\004\032\342\250\311\252\022\005"