Open Bug 1709132 Opened 2 months ago Updated 2 days ago

Investigate removing the nsIDocShell::SetCurrentURI call in RestoreDocShellState

Categories

(Firefox :: Session Restore, task)

task

Tracking

()

Fission Milestone MVP

People

(Reporter: kashav, Assigned: annyG)

References

(Blocks 2 open bugs)

Details

At time of writing, this happens in ContentSessionStore.restoreDocShellState(). Bug 1702055 will move it to SessionStoreUtils::RestoreDocShellState. It was originally added to mirror behavior of ContentRestore.restoreHistory() (https://searchfox.org/mozilla-central/rev/083983b7f09b00cdfe4f70396e39ea4f8a1735e1/browser/components/sessionstore/ContentRestore.jsm#120-130).

It doesn't make a lot of sense for us to be setting the docshell's URI directly in the restore process, so we should investigate removing the call completely.

A sessionstore/ try push with the bug 1702055 patches and this call removed has 3 failures. Logs with some noise removed:

INFO - TEST-START | browser/components/sessionstore/test/browser_615394-SSWindowState_events_duplicateTab.js
INFO - running test_duplicateTab
INFO - TEST-PASS | browser/components/sessionstore/test/browser_615394-SSWindowState_events_duplicateTab.js | undefined assertion name - 
INFO - TEST-PASS | browser/components/sessionstore/test/browser_615394-SSWindowState_events_duplicateTab.js | undefined assertion name - 
INFO - TEST-PASS | browser/components/sessionstore/test/browser_615394-SSWindowState_events_duplicateTab.js | undefined assertion name - 
INFO - TEST-PASS | browser/components/sessionstore/test/browser_615394-SSWindowState_events_duplicateTab.js | undefined assertion name - 
INFO - Buffered messages finished
INFO - TEST-UNEXPECTED-FAIL | browser/components/sessionstore/test/browser_615394-SSWindowState_events_duplicateTab.js | undefined assertion name - Got "about:blank", expected "about:rights"
INFO - Stack trace:
INFO - chrome://mochikit/content/browser-test.js:test_is:1369
INFO - chrome://mochitests/content/browser/browser/components/sessionstore/test/browser_615394-SSWindowState_events_duplicateTab.js:onSSTabRestoring:48
INFO - resource:///modules/sessionstore/SessionStore.jsm:_restoreHistoryComplete:6028
INFO - resource:///modules/sessionstore/SessionStore.jsm:_restoreHistory/<:5871
INFO - TEST-OK | browser/components/sessionstore/test/browser_615394-SSWindowState_events_duplicateTab.js | took 886ms
INFO - TEST-START | browser/components/sessionstore/test/browser_615394-SSWindowState_events_setTabState.js
INFO - running test_setTabState
INFO - TEST-PASS | browser/components/sessionstore/test/browser_615394-SSWindowState_events_setTabState.js | undefined assertion name - 
INFO - TEST-PASS | browser/components/sessionstore/test/browser_615394-SSWindowState_events_setTabState.js | undefined assertion name - 
INFO - TEST-PASS | browser/components/sessionstore/test/browser_615394-SSWindowState_events_setTabState.js | undefined assertion name - 
INFO - TEST-PASS | browser/components/sessionstore/test/browser_615394-SSWindowState_events_setTabState.js | undefined assertion name - 
INFO - TEST-UNEXPECTED-FAIL | browser/components/sessionstore/test/browser_615394-SSWindowState_events_setTabState.js | undefined assertion name - Got "about:blank", expected "http://example.org/"
INFO - Stack trace:
INFO - chrome://mochikit/content/browser-test.js:test_is:1369
INFO - chrome://mochitests/content/browser/browser/components/sessionstore/test/browser_615394-SSWindowState_events_setTabState.js:onSSTabRestoring:46
INFO - resource:///modules/sessionstore/SessionStore.jsm:_restoreHistoryComplete:6028
INFO - resource:///modules/sessionstore/SessionStore.jsm:_restoreHistory/<:5871
INFO - TEST-OK | browser/components/sessionstore/test/browser_615394-SSWindowState_events_setTabState.js | took 932ms
INFO - TEST-START | browser/components/sessionstore/test/browser_tabs_in_urlbar.js
INFO - Entering test bound setup
INFO - Leaving test bound setup
INFO - Entering test bound test_unrestored_tabs_listed
INFO - Searching open pages.
INFO - Found 1 matches
INFO - Skip heuristic match
INFO - TEST-UNEXPECTED-FAIL | browser/components/sessionstore/test/browser_tabs_in_urlbar.js | Should have found all the tabs - 3 == 0 - JS frame :: chrome://mochitests/content/browser/browser/components/sessionstore/test/browser_tabs_in_urlbar.js :: test_unrestored_tabs_listed :: line 134
INFO - Stack trace:
INFO - chrome://mochitests/content/browser/browser/components/sessionstore/test/browser_tabs_in_urlbar.js:test_unrestored_tabs_listed:134
INFO - Leaving test bound test_unrestored_tabs_listed
INFO - TEST-OK | browser/components/sessionstore/test/browser_tabs_in_urlbar.js | took 1339ms
Assignee: nobody → kmadan

Looking at browser_615394-SSWindowState_events_setTabState.js, this fails because the URI at time of "SSTabRestoring" is expected to be example.com, but is still about:blank. We're retrieving the URI from the RemoteWebNavigation, which is set by nsDocShell::SetCurrentURI.

Will have to see if there's an actual reason that the URI needs to be set when we're firing SSTabRestoring, or if we can just wait until we've completed the full restore.

The event is used in 3 places: BrowserReloadWithFlags(), tabs.duplicate(), and BrowserUsageTelemetry. The latter two appear to rely on the event solely for the fact that at this point the browser's currentURI is updated.

Will look into an alternate solution for these (maybe they can use the load event instead?), but this is probably a WONTFIX.

Going to wait to see if we can do anything with this after bug 1709136 lands.

Depends on: 1709136

Anny will land changes for this with bug 1709136.

Assignee: kmadan → agakhokidze

Change of plans, this work will proceed in this patch, and we will try to remove SetCurrentURI for both ship and non-ship together. We will also have to check several things when removing the call:

  • If we make the extensions duplicate call wait for SSTabRestored and not SStabRestoring, check if there is UI jank when we try to duplicate a tab and the tab happens to take longer to load
  • If the currentURI of the browser wont be set until we select a tab, what kinds of things does it break in the front end code that does lazy tab loading?

as per convo with kashav

Fission Milestone: M8 → MVP
You need to log in before you can comment on or make changes to this bug.