Closed
Bug 1442398
Opened 7 years ago
Closed 7 years ago
'gBrowser is null' logs showing up during testing
Categories
(Firefox :: Tabbed Browser, defect, P1)
Firefox
Tabbed Browser
Tracking
()
RESOLVED
FIXED
Firefox 60
Tracking | Status | |
---|---|---|
firefox60 | --- | fixed |
People
(Reporter: bgrins, Assigned: dao)
References
Details
Attachments
(1 file)
STR: Run `./mach test accessible/tests/mochitest/states/test_expandable.xul` I see a log like: GECKO(12686) | JavaScript error: chrome://browser/content/tabbrowser.js, line 5652: TypeError: gBrowser is null I think what's happening here is that the TabProgressListener is initialized in the TabBrowser constructur, but gBrowser isn't yet assigned to the instance of the TabBrowser until after the constructor finishes. I can think of two relatively easy fixes: 1) Make the TabBrowser constructor do much less and then instantiate gBrowser in two steps as `gBrowser = new TabBrowser(); gBrowser.init()` 2) Pass `this` (i.e. the TabBrowser) into the TabProgressListener constructor and refer to that on the instance instead of the global gBrowser.
Assignee | ||
Updated•7 years ago
|
Assignee: nobody → dao+bmo
Priority: -- → P1
Assignee | ||
Comment 1•7 years ago
|
||
(In reply to Brian Grinstead [:bgrins] from comment #0) > 1) Make the TabBrowser constructor do much less and then instantiate > gBrowser in two steps as `gBrowser = new TabBrowser(); gBrowser.init()` I'll do this, and use the opportunity to convert TabBrowser to a plain object. > 2) Pass `this` (i.e. the TabBrowser) into the TabProgressListener > constructor and refer to that on the instance instead of the global gBrowser. We did this before but I think it's less preferable, as this problem might bite us again with other consumers. Or it already does, see bug 1442384 and bug 1443318. Not entirely sure if these are exactly the same issue, though. Will re-evaluate once this is fixed.
Assignee | ||
Comment 2•7 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=2af84abbdc8f8e9c9f4c53f7e965504e45f4092c
Comment hidden (mozreview-request) |
Reporter | ||
Comment 4•7 years ago
|
||
mozreview-review |
Comment on attachment 8956385 [details] Bug 1442398 - Convert the TabBrowser class to a plain object and make gBrowser available already before gBrowser.init returns. https://reviewboard.mozilla.org/r/225264/#review231468 ::: browser/base/content/browser.js:157 (Diff revision 1) > + } > + delete window.gBrowser; > + window.gBrowser = window._gBrowser; > + delete window._gBrowser; > + gBrowser.init(); > + return window.gBrowser; nit: we refer to this as `gBrowser` without window on the line above - we should be consistent and either `return gBrowser` here or do `window.gBrowser.init();` above.
Attachment #8956385 -
Flags: review?(bgrinstead) → review+
Comment hidden (mozreview-request) |
Pushed by dgottwald@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f27d7eca013d Convert the TabBrowser class to a plain object and make gBrowser available already before gBrowser.init returns. r=bgrins
![]() |
||
Comment 7•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/f27d7eca013d
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 60
You need to log in
before you can comment on or make changes to this bug.
Description
•