JS exception "aTabs[0].linkedBrowser is null" in nsSessionStore.js

RESOLVED FIXED in Firefox 11

Status

()

Firefox
Session Restore
RESOLVED FIXED
6 years ago
4 years ago

People

(Reporter: heycam, Assigned: zpao)

Tracking

Trunk
Firefox 11
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
During a few browser chrome mochitests, we get messages like the following in the log:

TEST-INFO | chrome://mochitests/content/browser/browser/components/sessionstore/test/browser/browser_588426.js | Console message: [JavaScript Error: "aTabs[0].linkedBrowser is null" {file: "resource:///components/nsSessionStore.js" line: 2982}]

(This is currently not reported as a test failure, although some local patches I have cause it to be.)
I see what the problem is there... Fallout from changing the way we store some data. In this case __SS_tabStillLoading is now on the tab's browser instead of put into tabData so we're checking a less safe place (which in this case doesn't exist).
Blocks: 698565
Created attachment 574745 [details] [diff] [review]
Patch v0.1

I think I got that logic right...
Assignee: nobody → paul
Attachment #574745 - Flags: review?(dietrich)
(Reporter)

Updated

6 years ago
Blocks: 703176
(Reporter)

Comment 3

6 years ago
Confirmed in https://tbpl.mozilla.org/?tree=Try&rev=f031662ebeb9 that this avoids the JS error.
Comment on attachment 574745 [details] [diff] [review]
Patch v0.1

Review of attachment 574745 [details] [diff] [review]:
-----------------------------------------------------------------

::: browser/components/sessionstore/src/nsSessionStore.js
@@ +2982,5 @@
>      function sss_restoreHistory(aWindow, aTabs, aTabData, aIdMap, aDocIdentMap) {
>      var _this = this;
> +    // if the tab got removed before being completely restored, then skip it
> +    while (aTabs.length > 0 && (!aTabs[0].parentNode || !aTabs[0].linkedBrowser ||
> +                                !aTabs[0].linkedBrowser.__SS_tabStillLoading)) {

can you bust this out into a isFullyRestored (or whatever it makes sense to call it) helper? that would be far more explicit and readable. r=me with that change.
Attachment #574745 - Flags: review?(dietrich) → review+
https://hg.mozilla.org/integration/fx-team/rev/b71dae458e87
Whiteboard: [fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/b71dae458e87
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 11
Version: unspecified → Trunk

Updated

4 years ago
Blocks: 886116
You need to log in before you can comment on or make changes to this bug.