Bug 862078 - Use an about:config preference to control multiprocess browsing, part 3 (r=felipe)
authorBill McCloskey <wmccloskey@mozilla.com>
Mon, 22 Apr 2013 19:47:58 -0700
changeset 140499 019a9c42ce2e7362ec61bc79e33fc828621a2acb
parent 140498 b8bfc9dbdef7e20d4396189a3cda0315aef7e131
child 140500 7b495fe61ee49e5580dbbd7aa7cdd1260ac46d84
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfelipe
bugs862078
milestone23.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
Bug 862078 - Use an about:config preference to control multiprocess browsing, part 3 (r=felipe)
browser/components/sessionstore/src/SessionStore.jsm
toolkit/content/widgets/browser.xml
--- a/browser/components/sessionstore/src/SessionStore.jsm
+++ b/browser/components/sessionstore/src/SessionStore.jsm
@@ -314,16 +314,20 @@ let SessionStoreInternal = {
   _deferredInitialState: null,
 
   // A promise resolved once initialization is complete
   _promiseInitialization: Promise.defer(),
 
   // Whether session has been initialized
   _sessionInitialized: false,
 
+  // True if session store is disabled by multi-process browsing.
+  // See bug 516755.
+  _disabledForMultiProcess: false,
+
   // The original "sessionstore.resume_session_once" preference value before it
   // was modified by saveState.  saveState will set the
   // "sessionstore.resume_session_once" to true when the
   // the "sessionstore.resume_from_crash" preference is false (crash recovery
   // is disabled) so that pinned tabs will be restored in the case of a
   // crash.  This variable is used to restore the original value so the
   // previous session is not always restored when
   // "sessionstore.resume_from_crash" is true.
@@ -362,16 +366,18 @@ let SessionStoreInternal = {
       Services.obs.addObserver(this, aTopic, true);
     }, this);
 
     this._initPrefs();
 
     // Do pref migration before we store any values and start observing changes
     this._migratePrefs();
 
+    this._disabledForMultiProcess = this._prefBranch.getBoolPref("tabs.remote");
+
     // this pref is only read at startup, so no need to observe it
     this._sessionhistory_max_entries =
       this._prefBranch.getIntPref("sessionhistory.max_entries");
 
     this._restoreOnDemand =
       this._prefBranch.getBoolPref("sessionstore.restore_on_demand");
     this._prefBranch.addObserver("sessionstore.restore_on_demand", this, true);
 
@@ -586,16 +592,19 @@ let SessionStoreInternal = {
       this._prefBranch.clearUserPref("sessionstore.max_concurrent_tabs");
     }
   },
 
   /**
    * Handle notifications
    */
   observe: function ssi_observe(aSubject, aTopic, aData) {
+    if (this._disabledForMultiProcess)
+      return;
+
     switch (aTopic) {
       case "domwindowopened": // catch new windows
         this.onOpen(aSubject);
         break;
       case "domwindowclosed": // catch closed windows
         this.onClose(aSubject);
         break;
       case "quit-application-requested":
@@ -649,16 +658,19 @@ let SessionStoreInternal = {
   },
 
   /* ........ Window Event Handlers .............. */
 
   /**
    * Implement nsIDOMEventListener for handling various window and tab events
    */
   handleEvent: function ssi_handleEvent(aEvent) {
+    if (this._disabledForMultiProcess)
+      return;
+
     var win = aEvent.currentTarget.ownerDocument.defaultView;
     switch (aEvent.type) {
       case "load":
         // If __SS_restore_data is set, then we need to restore the document
         // (form data, scrolling, etc.). This will only happen when a tab is
         // first restored.
         let browser = aEvent.currentTarget;
         if (browser.__SS_restore_data)
--- a/toolkit/content/widgets/browser.xml
+++ b/toolkit/content/widgets/browser.xml
@@ -608,16 +608,20 @@
         </body>
       </method>
 
       <field name="pageReport">null</field>
 
       <property name="securityUI">
         <getter>
           <![CDATA[
+            // Bug 666809 - SecurityUI support for e10s
+            if (!this.docShell)
+              return null;
+
             if (!this.docShell.securityUI) {
               const SECUREBROWSERUI_CONTRACTID = "@mozilla.org/secure_browser_ui;1";
               if (!this.hasAttribute("disablesecurity") &&
                   SECUREBROWSERUI_CONTRACTID in Components.classes) {
                 var securityUI = Components.classes[SECUREBROWSERUI_CONTRACTID]
                                            .createInstance(Components.interfaces.nsISecureBrowserUI);
                 securityUI.init(this.contentWindow);
               }