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 375861 2dd20151319b1db8496edb17cdbc50d574d764eb
parent 375860 f14d25a1d13e034710815034c0f2cd5f5c9771cb
child 375862 b75cd6920ee5d7499bbb383a57070df32503dc82
push id20402
push userbmo:jryans@gmail.com
push dateMon, 06 Jun 2016 20:31:20 +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");
       }
     }