Bug 1348318 - Avoid toolbox.win.top with undocked toolboxes. r=ochameau draft
authorJ. Ryan Stinnett <jryans@gmail.com>
Fri, 17 Mar 2017 10:51:03 -0500
changeset 500744 6e4b5ca73c37c25a68cdcd4a58c7eccd905ab5d2
parent 498551 cf5f24e225fe5f1b66ed5ae505faee373dd1a045
child 549693 e1f3b38300f4b3af3586fd51a09827f8816fe099
push id49783
push userbmo:jryans@gmail.com
push dateFri, 17 Mar 2017 15:53:01 +0000
reviewersochameau
bugs1348318
milestone55.0a1
Bug 1348318 - Avoid toolbox.win.top with undocked toolboxes. r=ochameau `toolbox.win.top` is a bit suspect when we support undocked toolboxes, as this doesn't allow you to reach a browser window for the toolbox. Here we take a different approach that should work for all docking types. MozReview-Commit-ID: 5mlsp4OyZrc
devtools/client/framework/devtools-browser.js
--- a/devtools/client/framework/devtools-browser.js
+++ b/devtools/client/framework/devtools-browser.js
@@ -746,17 +746,17 @@ var gDevToolsBrowser = exports.gDevTools
     }
     gDevToolsBrowser._trackedBrowserWindows.delete(win);
     win.removeEventListener("unload", this);
 
     BrowserMenus.removeMenus(win.document);
 
     // Destroy toolboxes for closed window
     for (let [target, toolbox] of gDevTools._toolboxes) {
-      if (toolbox.win.top == win) {
+      if (target.tab.ownerDocument.defaultView == win) {
         toolbox.destroy();
       }
     }
 
     // Destroy the Developer toolbar if it has been accessed
     let desc = Object.getOwnPropertyDescriptor(win, "DeveloperToolbar");
     if (desc && !desc.get) {
       win.DeveloperToolbar.destroy();