Closed Bug 1348318 Opened 7 years ago Closed 7 years ago

`toolbox.win.top` doesn't work well for undocked windows

Categories

(DevTools :: Framework, enhancement, P1)

enhancement

Tracking

(firefox55 fixed)

RESOLVED FIXED
Firefox 55
Tracking Status
firefox55 --- fixed

People

(Reporter: jryans, Assigned: jryans)

Details

Attachments

(1 file)

In bug 1346647, we fixed one usage of `toolbox.win.top` that was breaking RDM button for undocked toolboxes.

In general, it may not make sense to check windows like this given that undocked toolboxes exist.

The only other case currently is:

http://searchfox.org/mozilla-central/rev/006005beff40d377cfd2f69d3400633c5ff09127/devtools/client/framework/devtools-browser.js#754
When closing an undocked toolbox currently, that if check on the window does miss the toolbox, but `toolbox.destroy` ends up being called through another path, probably because of unloading the toolbox's window.

So, it doesn't seem too critical, just a nice to have fix so that this works in all toolbox types.
Component: Developer Tools → Developer Tools: Framework
Comment on attachment 8848550 [details]
Bug 1348318 - Avoid toolbox.win.top with undocked toolboxes.

https://reviewboard.mozilla.org/r/121454/#review123496

Thanks for this cleanup!

::: devtools/client/framework/devtools-browser.js:754
(Diff revision 1)
>  
>      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) {

You may want to check that target.tab is defined as it may not necessarely be set. Only TabTarget have it defined.
It will be undefined for toolboxes from bug  	1348012... I don't know if there is any other such scenario that already exists.
Attachment #8848550 - Flags: review?(poirot.alex) → review+
Comment on attachment 8848550 [details]
Bug 1348318 - Avoid toolbox.win.top with undocked toolboxes.

https://reviewboard.mozilla.org/r/121454/#review123496

> You may want to check that target.tab is defined as it may not necessarely be set. Only TabTarget have it defined.
> It will be undefined for toolboxes from bug  	1348012... I don't know if there is any other such scenario that already exists.

Yep, seems safest to check, I'll add it!
Pushed by jryans@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/d06ce06386ad
Avoid toolbox.win.top with undocked toolboxes. r=ochameau
https://hg.mozilla.org/mozilla-central/rev/d06ce06386ad
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 55
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: