Bug 1240900 - Use outerWindowID directly from browser. r=ochameau draft
authorJ. Ryan Stinnett <jryans@gmail.com>
Tue, 31 May 2016 16:56:54 -0500
changeset 376533 dd5c1be1c8982c6f6dfef224b47306f8c88db615
parent 376532 e8a93699aab96a93d4f244a27f386a8cac176f5d
child 523176 d982a0adb69107308f2ea453b621de7b45ce049c
push id20602
push userbmo:jryans@gmail.com
push dateWed, 08 Jun 2016 07:10:41 +0000
reviewersochameau
bugs1240900
milestone49.0a1
Bug 1240900 - Use outerWindowID directly from browser. r=ochameau MozReview-Commit-ID: JuJNSScaJEs
devtools/client/framework/target.js
devtools/shared/client/main.js
--- a/devtools/client/framework/target.js
+++ b/devtools/client/framework/target.js
@@ -420,17 +420,17 @@ TabTarget.prototype = {
       this._client.connect()
         .then(() => this._client.getTab({ tab: this.tab }))
         .then(response => {
           this._form = response.tab;
           this._url = this._form.url;
           this._title = this._form.title;
 
           attachTab();
-        });
+        }, e => this._remote.reject(e));
     } else if (this.isTabActor) {
       // In the remote debugging case, the protocol connection will have been
       // already initialized in the connection screen code.
       attachTab();
     } else {
       // AddonActor and chrome debugging on RootActor doesn't inherits from
       // TabActor and doesn't need to be attached.
       attachConsole();
--- a/devtools/shared/client/main.js
+++ b/devtools/shared/client/main.js
@@ -1633,21 +1633,24 @@ RootClient.prototype = {
         packet.outerWindowID = aFilter.outerWindowID;
       } else if (typeof (aFilter.tabId) == "number") {
         packet.tabId = aFilter.tabId;
       } else if ("tab" in aFilter) {
         let browser = aFilter.tab.linkedBrowser;
         if (browser.frameLoader.tabParent) {
           // Tabs in child process
           packet.tabId = browser.frameLoader.tabParent.tabId;
+        } else if (browser.outerWindowID) {
+          // <xul:browser> tabs in parent process
+          packet.outerWindowID = browser.outerWindowID;
         } else {
-          // Tabs in parent process
+          // <iframe mozbrowser> tabs in parent process
           let windowUtils = browser.contentWindow
-            .QueryInterface(Ci.nsIInterfaceRequestor)
-            .getInterface(Ci.nsIDOMWindowUtils);
+                                   .QueryInterface(Ci.nsIInterfaceRequestor)
+                                   .getInterface(Ci.nsIDOMWindowUtils);
           packet.outerWindowID = windowUtils.outerWindowID;
         }
       } else {
         // Throw if a filter object have been passed but without
         // any clearly idenfified filter.
         throw new Error("Unsupported argument given to getTab request");
       }
     }