Closed Bug 1519461 Opened 6 years ago Closed 6 years ago

Can't switch tabs in a given profile with `browser.tabs.remote.logSwitchTiming=true`: AsyncTabSwitcher.logState is throwing in the call to linkedBrowser.docShellIsActive

Categories

(Firefox :: Tabbed Browser, defect, P1)

defect

Tracking

()

RESOLVED FIXED
Firefox 66
Tracking Status
firefox-esr60 --- unaffected
firefox64 --- unaffected
firefox65 --- unaffected
firefox66 --- fixed

People

(Reporter: caspy77, Assigned: bgrins)

References

(Blocks 1 open bug)

Details

(Keywords: regression)

Attachments

(3 files)

I'm on windows 10 with a 64 bit build.

I wasn't sure when this started because I may have missed an update so I downloaded a few builds to test.

Starting with the build in archive directory https://ftp.mozilla.org/pub/firefox/nightly/2019/01/2019-01-10-09-38-54-mozilla-central/ I am no longer able to switch tabs.
Clicking on other tabs or using the keyboard to switch (ctrl + pgdn) does not work. I still see the same tab and interact with the same URL.

Using the prior build 66.0a1 (2019-01-09) (64-bit) works fine.

I tested in safe mode as well as removing userChrome.css customizations (I use Shadowfox dark CSS so I removed the chrome folder and restarted) but the issue remained.

Also on attempting to shut down got crashes. Here are a few reports:

https://crash-stats.mozilla.org/report/index/d05b5a05-9e54-4104-8012-ae6af0190111
https://crash-stats.mozilla.org/report/index/8ed87438-9c9a-41cb-95cb-d198c0190111

Testing in a fresh profile the issue is not present.

However, I have my profile set up how I like it and don't think I have any unusual settings, so others may also experience this (and I'd prefer not to lose all my settings including extension setup).

Does anything suspicious show up in the Browser Console (Ctrl+Shift+J) when attempting to switch tabs?

When I click on another tab I got:


TypeError: this.frameLoader is null[Learn More] browser-custom-element.js:390:7

get docShellIsActive chrome://global/content/elements/browser-custom-element.js:390 logState resource:///modules/AsyncTabSwitcher.jsm:1191 requestTab resource:///modules/AsyncTabSwitcher.jsm:996 updateCurrentBrowser chrome://browser/content/tabbrowser.js:913 _setupEventListeners chrome://browser/content/tabbrowser.js:4540 set selectedIndex chrome://global/content/elements/tabbox.js:201 set selectedPanel chrome://global/content/elements/tabbox.js:215 set_selectedIndex chrome://global/content/bindings/tabbox.xml:176 set_selectedItem chrome://global/content/bindings/tabbox.xml:201 _selectNewTab chrome://global/content/bindings/tabbox.xml:295 advanceSelectedTab chrome://global/content/bindings/tabbox.xml:341 handleEvent chrome://global/content/elements/tabbox.js:131 

moz-extension://384e4268-a110-4f6e-9a8a-3b186720820a/background.html: chrome tabs query did not return a result while changing window focus

Async*@moz-extension://384e4268-a110-4f6e-9a8a-3b186720820a/third_party/port.js:3:4229

@moz-extension://384e4268-a110-4f6e-9a8a-3b186720820a/third_party/port.js:3:4183

Log.js:3:3828


When I use ctrl+pgdn I get:


TypeError: this.frameLoader is null[Learn More] browser-custom-element.js:390:7

get docShellIsActive chrome://global/content/elements/browser-custom-element.js:390 logState resource:///modules/AsyncTabSwitcher.jsm:1191 warmupTab resource:///modules/AsyncTabSwitcher.jsm:926 warmupTab chrome://browser/content/tabbrowser.js:4179 _mouseenter chrome://browser/content/tabbrowser.xml:2187 onxblmouseover chrome://browser/content/tabbrowser.xml:2335 

Error: TelemetryStopwatch: key "FX_TAB_SWITCH_UPDATE_MS" was already initialized tabbrowser.js:910:7

updateCurrentBrowser chrome://browser/content/tabbrowser.js:910 _setupEventListeners chrome://browser/content/tabbrowser.js:4540 set selectedIndex chrome://global/content/elements/tabbox.js:201 set selectedPanel chrome://global/content/elements/tabbox.js:215 set_selectedIndex chrome://global/content/bindings/tabbox.xml:176 set_selectedItem chrome://global/content/bindings/tabbox.xml:201 _selectNewTab chrome://global/content/bindings/tabbox.xml:295 onxblmousedown chrome://global/content/bindings/tabbox.xml:445 

TypeError: this.frameLoader is null[Learn More] browser-custom-element.js:390:7

get docShellIsActive chrome://global/content/elements/browser-custom-element.js:390 logState resource:///modules/AsyncTabSwitcher.jsm:1191 requestTab resource:///modules/AsyncTabSwitcher.jsm:996 updateCurrentBrowser chrome://browser/content/tabbrowser.js:913 _setupEventListeners chrome://browser/content/tabbrowser.js:4540 set selectedIndex chrome://global/content/elements/tabbox.js:201 set selectedPanel chrome://global/content/elements/tabbox.js:215 set_selectedIndex chrome://global/content/bindings/tabbox.xml:176 set_selectedItem chrome://global/content/bindings/tabbox.xml:201 _selectNewTab chrome://global/content/bindings/tabbox.xml:295 onxblmousedown chrome://global/content/bindings/tabbox.xml:445 

moz-extension://384e4268-a110-4f6e-9a8a-3b186720820a/background.html: chrome tabs query did not return a result while changing window focus

Async*@moz-extension://384e4268-a110-4f6e-9a8a-3b186720820a/third_party/port.js:3:4229

@moz-extension://384e4268-a110-4f6e-9a8a-3b186720820a/third_party/port.js:3:4183

Log.js:3:3828
TypeError: this.frameLoader is null[Learn More] browser-custom-element.js:390:7

get docShellIsActive chrome://global/content/elements/browser-custom-element.js:390 logState resource:///modules/AsyncTabSwitcher.jsm:1191 warmupTab resource:///modules/AsyncTabSwitcher.jsm:926 warmupTab chrome://browser/content/tabbrowser.js:4179 _mouseenter chrome://browser/content/tabbrowser.xml:2187 onxblmouseover chrome://browser/content/tabbrowser.xml:2335

Seems related to the browser custom element, bug 1441935, which landed in the build you're having trouble with. Brian, thought this might interest you.

Flags: needinfo?(bgrinstead)

Which extension is showing up in the logs here in background.html and port.js?

Blocks: 1441935
Flags: needinfo?(bgrinstead) → needinfo?(caspy77)

If you can help narrow this down to one or more extensions I'll try to reproduce.

I mentioned in comment 0 that I tested in safe mode and still had the issue.

Should I look in the console in safe mode?

Flags: needinfo?(caspy77)

I tested in safe mode, used ctrl+pgdn to switch tabs and got:

START
Initial tab is loaded?: true
TypeError: this.frameLoader is null[Learn More] browser-custom-element.js:390:7
Tab should be blank: false
Requested tab is remote?: true
FINISH
TypeError: this.frameLoader is null[Learn More] browser-custom-element.js:390:7

This may or may not involve the new browser-custom-element.js or the AsyncTabSwitcher.jsm... these error messages look to me like the symptoms of a browser tab that's entered a pretty funky state (but they're not necessarily the cause of the state).

Caspy7, are you able to reproduce this reliably? If so, I'd love to know if it's reproducible in the build before bug 1441935 closed out, and if it's reproducible just after.

Ultimately, the problem is that the frameLoader return value is null. That's not really expected - the browser binding is supposed to be implementing nsIFrameLoaderOwner.

Either the frameLoader was never created (which can't be true if you'd seen the tab before), or the frameLoader was nulled out. I believe in this case, that can only happen in these two places:

https://searchfox.org/mozilla-central/rev/7adb490485eff0783071a3e132005bceeb337461/dom/xul/XULFrameElement.cpp#151-169

ni? to Caspy7 to see if they can reproduce in the January 9th Nightly.

Flags: needinfo?(caspy77)

In case it is relevant for figuring out the tab got into this state, the extension that outputs "chrome tabs query did not return a result while changing window focus" seems to be https://addons.mozilla.org/en-US/firefox/addon/evernote-web-clipper/

I wonder if this is similar to https://bugzilla.mozilla.org/show_bug.cgi?id=1441935#c41. That is, the browser is in some kind of weird state (removed from DOM or never added to DOM, for instance), such that the XBL binding wouldn't have been attached.

In the XBL world this means that browser.docShellIsActive would be undefined (it was a property that would have gotten removed upon destruction). In the CE world, the property is still there, but in a state that throws.

We could debug this by checking mInitialized, either inside the docShellIsActive getter or at the individual caller that's causing a problem here.

I'll make a build to test out the theory in Comment 11 to see if that fixes it (or changes the error).

Yes. I can reproduce this reliably. I literally cannot switch tabs at all. The only useable web pages are the currently focused one for each window.
Notable perhaps that if I restart the browser, the last tab I selected will be loaded.

Yes, as I mentioned the issue is not present on the build from the 9th and is present on all builds after that.

FYI, this is what I see when I just hover a tab:


START
Initial tab is loaded?: true
Tab should be blank: false
Requested tab is remote?: true
FINISH
TypeError: this.frameLoader is null[Learn More] browser-custom-element.js:390:7
START
Initial tab is loaded?: true
Tab should be blank: false
Requested tab is remote?: true
FINISH
TypeError: this.frameLoader is null[Learn More] browser-custom-element.js:390:7
START
Initial tab is loaded?: true
Tab should be blank: false
Requested tab is remote?: true
FINISH
TypeError: this.frameLoader is null[Learn More] browser-custom-element.js:390:7

Flags: needinfo?(caspy77)

(In reply to Caspy7 from comment #13)

Yes, as I mentioned the issue is not present on the build from the 9th and is present on all builds after that.

Whoops - sorry, must have missed that part!

Apologies for the crazy big formatting on some of that text. That was not intentional.

Just to confirm: can you check if setting browser.tabs.remote.logSwitchTiming=false makes the error go away?

Yes. This fixed the issue.

I would also like to add that based on some comments about the browser "getting into a bad state" I tried opening a new window (before I toggled that pref) and opening new tabs and I was able to switch to them just like normal.
I restarted the browser and the other windows were still broken, but not the new one.

(In reply to Caspy7 from comment #17)

Yes. This fixed the issue.

OK, I've started a build at https://treeherder.mozilla.org/#/jobs?repo=try&revision=3f4ff873e33a46095078a23123ea88bb7b9685ad for win64 (which I assume is the platform based on the crash report). When the "B" for "Windows 2012 x64 opt" completes (should be ~20 minutes), could you please that build with that pref flipped back to 'true'? And then also confirm you still do see the error on the Nightly build after flipping back to 'true' as well? Thanks!

I restarted the browser and the other windows were still broken, but not the new one.

Restarted after the pref flip, or before?

Yes. I can test this.

Comment 18, about the new window working, was all performed before flipping the pref.

(In reply to Brian Grinstead [:bgrins] from comment #19)

When the "B" for "Windows 2012 x64 opt" completes (should be ~20 minutes), could you please that build with that pref flipped back to 'true'?

Tab switching worked.

And then also confirm you still do see the error on the Nightly build after flipping back to 'true' as well? Thanks!

Assuming "Nightly build" in this case means the most recent nightly, yes, the tab switching issue remains when the pref is set to true.

In the mean time is there any harm in me running nightly with that pref switch to false so I don't have to camp out on the build from the 9th?

(In reply to Caspy7 from comment #21)

(In reply to Brian Grinstead [:bgrins] from comment #19)

When the "B" for "Windows 2012 x64 opt" completes (should be ~20 minutes), could you please that build with that pref flipped back to 'true'?

Tab switching worked.

And then also confirm you still do see the error on the Nightly build after flipping back to 'true' as well? Thanks!

Assuming "Nightly build" in this case means the most recent nightly, yes, the tab switching issue remains when the pref is set to true.

Great, thanks.

In the mean time is there any harm in me running nightly with that pref switch to false so I don't have to camp out on the build from the 9th?

No harm in flipping the pref - it's actually hidden (unset) by default so it must have gotten manually turned on at some point.

I'd still like to know what is causing this (since this is the type of thing that could spring up in other getter calls in the browser), but I'll get a version of this patch up for review so this particular issue goes away.

Assignee: nobody → bgrinstead
Status: NEW → ASSIGNED
Summary: Nightly: I can't switch tabs → Can't switch tabs in a given profile with `browser.tabs.remote.logSwitchTiming=true`: AsyncTabSwitcher.logState is throwing in the call to linkedBrowser.docShellIsActive
Alternatively, we could check for mInitialized in `AsyncTabSwitcher.logState` before accessing the getter. But this matches an existing pattern for other browser getters that rely on the frameLoader existing, and will support other callers that hit this case.
This is more consistent with other setters, and lets us handle the null frameLoader case a bit more simply.

I went with a slightly different approach from the push that's confirmed working in Comment 21, but this should fix it just as well (moves the null check into the getter rather than the caller).

Here's a try push with the patches on phab: https://treeherder.mozilla.org/#/jobs?repo=try&revision=6e8c377c1da0689f5115ffbd0a8e2cf078eb4d06.

Attachment #9036073 - Attachment description: Bug 1519461 - Don't return values from docShellIsActive and renderLayers setters;r=mconley → Bug 1519461 - Don't return values from docShellIsActive, renderLayers, and userTypedValue setters;r=mconley
Pushed by bgrinstead@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c036c740fbbc Check for frameLoader existence before accessing it in docShellIsActive;r=mconley https://hg.mozilla.org/integration/autoland/rev/e00e03df2c6b Unify the hasLayers getter to use the same frameLoader check as renderLayers and docShellIsActive;r=mconley https://hg.mozilla.org/integration/autoland/rev/848d8e9a1f03 Don't return values from docShellIsActive, renderLayers, and userTypedValue setters;r=mconley
Keywords: regression
Priority: -- → P1
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: