Bug 923333 - Replace docShell.setCurrentURI with something e10s-compatible (r=felipe)
authorBill McCloskey <wmccloskey@mozilla.com>
Tue, 12 Nov 2013 15:02:14 -0800
changeset 154789 5b0fdad425f8030c346ce9d066498f258a4bb3d5
parent 154788 e70c1287741eca8cef8a6daaa89c6ea2b133818f
child 154790 22a64c02375c3464d9747d1a1a227f8dc0125c88
push id25654
push userryanvm@gmail.com
push dateFri, 15 Nov 2013 03:19:28 +0000
treeherdermozilla-central@b2fab608772f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfelipe
bugs923333
milestone28.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 923333 - Replace docShell.setCurrentURI with something e10s-compatible (r=felipe)
toolkit/content/widgets/browser.xml
toolkit/content/widgets/remote-browser.xml
toolkit/modules/RemoteWebProgress.jsm
--- a/toolkit/content/widgets/browser.xml
+++ b/toolkit/content/widgets/browser.xml
@@ -201,16 +201,29 @@
           ]]>
         </body>
       </method>
 
       <property name="currentURI"
                 onget="return this.webNavigation.currentURI;"
                 readonly="true"/>
 
+      <!--
+        Used by session restore to ensure that currentURI is set so
+        that switch-to-tab works before the tab is fully
+        restored. This function also invokes onLocationChanged
+        listeners in tabbrowser.xml.
+      -->
+      <method name="_setCurrentURI">
+        <parameter name="aURI"/>
+        <body><![CDATA[
+          this.docShell.setCurrentURI(aURI);
+        ]]></body>
+      </method>
+
       <property name="documentURI"
                 onget="return this.contentDocument.documentURIObject;"
                 readonly="true"/>
 
       <property name="preferences"
                 onget="return this.mPrefs.QueryInterface(Components.interfaces.nsIPrefService);"
                 readonly="true"/>
 
--- a/toolkit/content/widgets/remote-browser.xml
+++ b/toolkit/content/widgets/remote-browser.xml
@@ -40,18 +40,18 @@
       <field name="_remoteWebProgress">null</field>
 
       <property name="webProgress" readonly="true">
       	<getter>
       	  <![CDATA[
             if (!this._remoteWebProgress) {
               let jsm = "resource://gre/modules/RemoteWebProgress.jsm";
               let RemoteWebProgressManager = Cu.import(jsm, {}).RemoteWebProgressManager;
-              this._remoteWebProgress = new RemoteWebProgressManager(this)
-                                         .topLevelWebProgress;
+              this._remoteWebProgressManager = new RemoteWebProgressManager(this);
+              this._remoteWebProgress = this._remoteWebProgressManager.topLevelWebProgress;
             }
             return this._remoteWebProgress;
       	  ]]>
       	</getter>
       </property>
 
       <field name="_remoteFinder">null</field>
 
@@ -63,16 +63,29 @@
             this._remoteFinder = new RemoteFinder(this);
           }
           return this._remoteFinder;
         ]]></getter>
       </property>
 
       <field name="_documentURI">null</field>
 
+      <!--
+        Used by session restore to ensure that currentURI is set so
+        that switch-to-tab works before the tab is fully
+        restored. This function also invokes onLocationChanged
+        listeners in tabbrowser.xml.
+      -->
+      <method name="_setCurrentURI">
+        <parameter name="aURI"/>
+        <body><![CDATA[
+          this._remoteWebProgressManager.setCurrentURI(aURI);
+        ]]></body>
+      </method>
+
       <property name="documentURI"
                 onget="return this._documentURI;"
                 readonly="true"/>
 
       <field name="_contentTitle">""</field>
 
       <property name="contentTitle"
                 onget="return this._contentTitle"
--- a/toolkit/modules/RemoteWebProgress.jsm
+++ b/toolkit/modules/RemoteWebProgress.jsm
@@ -104,16 +104,28 @@ RemoteWebProgressManager.prototype = {
     // We must check the Extended Validation (EV) state here, on the chrome
     // process, because NSS is needed for that determination.
     if (deserialized && deserialized.isExtendedValidation)
       aState |= Ci.nsIWebProgressListener.STATE_IDENTITY_EV_TOPLEVEL;
 
     return [deserialized, aState];
   },
 
+  setCurrentURI: function (aURI) {
+    // This function is simpler than nsDocShell::SetCurrentURI since
+    // it doesn't have to deal with child docshells.
+    let webNavigation = this._browser.webNavigation;
+    webNavigation._currentURI = aURI;
+
+    let webProgress = this.topLevelWebProgress;
+    for (let p of this._progressListeners) {
+      p.onLocationChange(webProgress, null, aURI);
+    }
+  },
+
   _callProgressListeners: function(methodName, ...args) {
     for (let p of this._progressListeners) {
       if (p[methodName]) {
         try {
           p[methodName].apply(p, args);
         } catch (ex) {
           Cu.reportError("RemoteWebProgress failed to call " + methodName + ": " + ex + "\n");
         }