Bug 897194 - Use outer window ID to match toolbox to tab rather than assuming the currently-selected tab. r=bgrins, a=lsblakk
authorDave Camp <dcamp@mozilla.com>
Tue, 29 Oct 2013 10:47:16 -0700
changeset 167331 2535acbe5c168d4140420668a13bf282408ca2b7
parent 167330 2d77f338c43b4b2fb30c7b0aa5f46e4b38506927
child 167332 d0c8aba6bfb047597329cd0051433d4f1a524072
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgrins, lsblakk
bugs897194
milestone27.0a2
Bug 897194 - Use outer window ID to match toolbox to tab rather than assuming the currently-selected tab. r=bgrins, a=lsblakk
browser/devtools/framework/target.js
toolkit/devtools/server/actors/webbrowser.js
--- a/browser/devtools/framework/target.js
+++ b/browser/devtools/framework/target.js
@@ -288,17 +288,30 @@ TabTarget.prototype = {
         this._remote.resolve(null);
       });
     };
 
     if (this.isLocalTab) {
       this._client.connect((aType, aTraits) => {
         this._client.listTabs(aResponse => {
           this._root = aResponse;
-          this._form = aResponse.tabs[aResponse.selected];
+
+          let windowUtils = this.window
+            .QueryInterface(Ci.nsIInterfaceRequestor)
+            .getInterface(Ci.nsIDOMWindowUtils);
+          let outerWindow = windowUtils.outerWindowID;
+          aResponse.tabs.some((tab) => {
+            if (tab.outerWindowID === outerWindow) {
+              this._form = tab;
+              return true;
+            }
+          });
+          if (!this._form) {
+            this._form = aResponse.tabs[aResponse.selected];
+          }
           attachTab();
         });
       });
     } else if (!this.chrome) {
       // In the remote debugging case, the protocol connection will have been
       // already initialized in the connection screen code.
       attachTab();
     } else {
--- a/toolkit/devtools/server/actors/webbrowser.js
+++ b/toolkit/devtools/server/actors/webbrowser.js
@@ -578,20 +578,25 @@ BrowserTabActor.prototype = {
   },
 
   form: function BTA_form() {
     dbg_assert(!this.exited,
                "grip() shouldn't be called on exited browser actor.");
     dbg_assert(this.actorID,
                "tab should have an actorID.");
 
+    let windowUtils = this.window
+      .QueryInterface(Ci.nsIInterfaceRequestor)
+      .getInterface(Ci.nsIDOMWindowUtils);
+
     let response = {
       actor: this.actorID,
       title: this.title,
-      url: this.url
+      url: this.url,
+      outerWindowID: windowUtils.outerWindowID
     };
 
     // Walk over tab actors added by extensions and add them to a new ActorPool.
     let actorPool = new ActorPool(this.conn);
     this._createExtraActors(DebuggerServer.tabActorFactories, actorPool);
     if (!actorPool.isEmpty()) {
       this._tabActorPool = actorPool;
       this.conn.addActorPool(this._tabActorPool);