Bug 1448933 - Get docShell from frameLoader and don't QI for frameLoader in convbrowser.xml. r=florian
authorMartin Giger <martin@humanoids.be>
Mon, 26 Mar 2018 20:41:14 +0200
changeset 29380 82c2f54ceefd9e53fc84d6f02eccd7db3d0f5692
parent 29379 167c026f6fbab3b6d00e365eed36fde589815741
child 29381 ecb5839542ce02325c8422e4d2560ff1f23a6485
push idunknown
push userunknown
push dateunknown
reviewersflorian
bugs1448933
Bug 1448933 - Get docShell from frameLoader and don't QI for frameLoader in convbrowser.xml. r=florian
chat/content/convbrowser.xml
--- a/chat/content/convbrowser.xml
+++ b/chat/content/convbrowser.xml
@@ -76,28 +76,39 @@
 
       <property name="currentURI"
                 onget="return this.webNavigation.currentURI;"
                 readonly="true"/>
 
       <field name="_docShell">null</field>
 
       <property name="docShell"
-                onget="return this._docShell || (this._docShell = this.boxObject.docShell);"
-                readonly="true"/>
+                readonly="true">
+        <getter>
+          <![CDATA[
+            if (this._docShell) {
+              return this._docShell;
+            }
+            if (!this.frameLoader) {
+              return null;
+            }
+            this._docShell = this.frameLoader.docShell;
+            return this._docShell;
+          ]]>
+        </getter>
+      </property>
 
       <property name="messageManager"
                 readonly="true">
         <getter>
           <![CDATA[
-            var owner = this.QueryInterface(Ci.nsIFrameLoaderOwner);
-            if (!owner.frameLoader) {
+            if (!this.frameLoader) {
               return null;
             }
-            return owner.frameLoader.messageManager;
+            return this.frameLoader.messageManager;
           ]]>
         </getter>
       </property>
 
       <field name="_webNavigation">null</field>
 
       <property name="webNavigation"
                 onget="return this._webNavigation || (this._webNavigation = this.docShell.QueryInterface(Ci.nsIWebNavigation));"
@@ -1240,18 +1251,17 @@
                               "_firstNonContextElt"];
 
           var ourFieldValues = {};
           var otherFieldValues = {};
           for (var field of fieldsToSwap) {
             ourFieldValues[field] = this[field];
             otherFieldValues[field] = aOtherBrowser[field];
           }
-          this.QueryInterface(Ci.nsIFrameLoaderOwner)
-              .swapFrameLoaders(aOtherBrowser);
+          this.swapFrameLoaders(aOtherBrowser);
           for (var field of fieldsToSwap) {
             this[field] = otherFieldValues[field];
             aOtherBrowser[field] = ourFieldValues[field];
           }
 
           this._exposeMethodsToContent();
 
           this.initMagicCopy();