Closed Bug 1563500 Opened 2 years ago Closed 2 years ago

JavaScript error: resource:///modules/sessionstore/SessionStore.jsm, line 2440: TypeError: tabbrowser.getTabForBrowser is not a function

Categories

(Core :: DOM: Content Processes, defect, P3)

69 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox-esr60 --- unaffected
firefox-esr68 --- wontfix
firefox68 --- wontfix
firefox69 --- wontfix
firefox70 --- fixed

People

(Reporter: whimboo, Assigned: mconley)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

No longer depends on: 1563498

The priority flag is not set for this bug.
:mikedeboer, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(mdeboer)
Component: Session Restore → DOM: Content Processes
Flags: needinfo?(mdeboer) → needinfo?(nika)
Product: Firefox → Core
Regressed by: 1539163

This seems relatively easy to fix, the check on the line before for tabbrowser could be extended to also check the getTabForbrowser method also exists.

Looking at the linked log, I see that there are a lot of assertions around gBrowser not looking like expected as well coming from BrowserTabParent.jsm. ni? :mconley in case they know why gBrowser would be in a "broken" state during this test.

06:27:59     INFO - PID 6480 | JavaScript error: resource:///actors/BrowserTabParent.jsm, line 27: TypeError: gBrowser.announceWindowCreated is not a function
06:27:59     INFO - PID 6480 | JavaScript error: , line 0: NS_ERROR_UNEXPECTED:
06:27:59     INFO - PID 6480 | 1562221679654	Marionette	INFO	Testing http://web-platform.test:8000/2dcontext/compositing/canvas_compositing_globalcompositeoperation_001.htm == http://web-platform.test:8000/2dcontext/compositing/canvas_compositing_globalcompositeoperation_001-ref.htm
06:27:59     INFO - PID 6480 | JavaScript error: resource:///actors/BrowserTabParent.jsm, line 27: TypeError: gBrowser.announceWindowCreated is not a function
06:27:59     INFO - PID 6480 | JavaScript error: , line 0: NS_ERROR_UNEXPECTED:
06:27:59     INFO - PID 6480 | JavaScript error: resource:///actors/BrowserTabParent.jsm, line 32: TypeError: browser.ownerGlobal.gBrowserInit is undefined
06:27:59     INFO - PID 6480 | JavaScript error: , line 0: NS_ERROR_UNEXPECTED:
06:27:59     INFO - PID 6480 | JavaScript error: resource:///modules/sessionstore/SessionStore.jsm, line 2440: TypeError: tabbrowser.getTabForBrowser is not a function
06:27:59     INFO - PID 6480 | JavaScript error: resource:///actors/BrowserTabParent.jsm, line 27: TypeError: gBrowser.announceWindowCreated is not a function
06:27:59     INFO - PID 6480 | JavaScript error: , line 0: NS_ERROR_UNEXPECTED:
06:27:59     INFO - PID 6480 | JavaScript error: resource:///actors/BrowserTabParent.jsm, line 32: TypeError: browser.ownerGlobal.gBrowserInit is undefined
06:27:59     INFO - PID 6480 | JavaScript error: , line 0: NS_ERROR_UNEXPECTED:
06:28:00     INFO - PID 6480 | JavaScript error: resource:///modules/sessionstore/SessionStore.jsm, line 2440: TypeError: tabbrowser.getTabForBrowser is not a function
06:28:00     INFO - PID 6480 | JavaScript error: resource:///actors/BrowserTabParent.jsm, line 27: TypeError: gBrowser.announceWindowCreated is not a function
06:28:00     INFO - PID 6480 | JavaScript error: , line 0: NS_ERROR_UNEXPECTED:
06:28:00     INFO - PID 6480 | JavaScript error: resource:///actors/BrowserTabParent.jsm, line 32: TypeError: browser.ownerGlobal.gBrowserInit is undefined
06:28:00     INFO - PID 6480 | JavaScript error: , line 0: NS_ERROR_UNEXPECTED:
Flags: needinfo?(nika) → needinfo?(mconley)

I think a lot of those errors were fixed by the patch in bug 1561970 (see bug 1563495 and bug 1563498).

Flags: needinfo?(mconley)

Note that this failure is still present in recent mozilla-central builds like:
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=258720683&repo=mozilla-central&lineNumber=1017

Hi Mike, any thoughts on newer failures? Also, do we know if there's any real-world impact from these errors? Lost of session or anything?

Flags: needinfo?(mconley)

(In reply to Ryan VanderMeulen [:RyanVM] from comment #5)

Hi Mike, any thoughts on newer failures? Also, do we know if there's any real-world impact from these errors? Lost of session or anything?

No, I think we're only hitting this because the refTest harness spoofs the gBrowser on a browser element to point to another browser:

https://searchfox.org/mozilla-central/rev/b38e3beb658b80e1ed03e0fdf64d225bd4a40327/testing/marionette/reftest.js#187

It's doing this for reasons that are beyond me. I've attached a patch that causes the SessionStore code to use the <browser>.getTabBrowser() method to avoid the spoof. I really wonder why refTest needs to spoof it though. shrug

Flags: needinfo?(mconley)

(In reply to Mike Conley (:mconley) (:⚙️) from comment #7)

No, I think we're only hitting this because the refTest harness spoofs the gBrowser on a browser element to point to another browser:

https://searchfox.org/mozilla-central/rev/b38e3beb658b80e1ed03e0fdf64d225bd4a40327/testing/marionette/reftest.js#187

It's doing this for reasons that are beyond me. I've attached a patch that causes the SessionStore code to use the <browser>.getTabBrowser() method to avoid the spoof. I really wonder why refTest needs to spoof it though. shrug

James, do you have an idea why this code is used?

Flags: needinfo?(james)

Essentially because the reftests run in a pretty strange window without the normal chrome (no tabs etc.) We need a reference to the browser element to call getBoundingClientRect on it (although we could probably call getElementsByTagNameNs or something). The specific approach of setting gBrowser on the window to point at the Browser element was stolen from the reftest harness, but it looks like that code subsequently changed to just stash the browser in a global.

So, we can probably change the details here if necessary.

Flags: needinfo?(james)

The priority flag is not set for this bug.
:jimm, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(jmathies)
Flags: needinfo?(jmathies)
Priority: -- → P3
Pushed by mconley@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a6395e0de040
Avoid accessing bogus reftest gBrowser in SessionStore.onMayChangeProcess. r=nika
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
Assignee: nobody → mconley
You need to log in before you can comment on or make changes to this bug.