Closed Bug 1587784 Opened 5 years ago Closed 5 years ago

Fix browser_alltabslistener.js to work in fission

Categories

(Firefox :: Tabbed Browser, task)

task
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 71
Fission Milestone M4
Tracking Status
firefox71 --- fixed

People

(Reporter: Gijs, Assigned: Gijs)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

This test is marked fail-if = fission, and lots (if not to say most) of the assertions fail when switching to fission.

A big reason this happens is that early on, the test gets confused and it never recovers. This is because of this code:

https://searchfox.org/mozilla-central/rev/05a22d864814cb1e4352faa4004e1f975c7d2eb9/browser/base/content/test/general/browser_alltabslistener.js#215-223,236-237

function test() {
  ...
  // We must wait until a page has completed loading before
  // starting tests or we get notifications from that
  let promises = [
    BrowserTestUtils.browserStopped(gBackgroundBrowser, kBasePage),
    BrowserTestUtils.browserStopped(gForegroundBrowser, kBasePage),
  ];
  BrowserTestUtils.loadURI(gBackgroundBrowser, kBasePage);
  BrowserTestUtils.loadURI(gForegroundBrowser, kBasePage);
  Promise.all(promises).then(startTest1);
}

function startTest1() {
  info("\nTest 1");
  gBrowser.addProgressListener(gFrontProgressListener);
  gBrowser.addTabsProgressListener(gAllProgressListener);
  ...
}

With fission, the load of kBasePage triggers a process swap. The process swap means webprogress listeners get detached from the old torn-down browser/docshell/webprogress instances, and attached to the new one. Unfortunately, this happens at different times for the listener from tabbrowser itself, and the listener in the test. This means that the test's listener (ie the one from browserStopped) gets notified before the tabbrowser listener. In non-fission, there's no process swap and so the test listener gets notified afterwards.

The upshot of this is that in fission, the test's listeners get told of the state_stop state change that finishes loadding kBasePage, which because it is the last one means that the test concludes this is the only notification it's going to get for the page it's loaded, and it correctly fails because of this.

However, even when fixing this by waiting for the event to be fully processed before adding the test handlers, further loads in the test also confuse the test. I'm still working on those bits...

Pushed by gijskruitbosch@gmail.com: https://hg.mozilla.org/integration/autoland/rev/d4837cfe8ba0 improve logging and test assertions in browser_alltabslistener.js so it's easier to work out what's going on, r=dao https://hg.mozilla.org/integration/autoland/rev/a90b5a945993 avoid the test listener in browser_alltabslistener.js being notified for the base/dummy page loading when fission is enabled, r=dao https://hg.mozilla.org/integration/autoland/rev/c51f3b5c78ad expect the additional onSecurityChange update that comes with a remoteness change in fission in browser_alltabslistener.js, r=dao

Retroactively moving fixed bugs whose summaries mention "Fission" (or other Fission-related keywords) but are not assigned to a Fission Milestone to an appropriate Fission Milestone.

This will generate a lot of bugmail, so you can filter your bugmail for the following UUID and delete them en masse:

0ee3c76a-bc79-4eb2-8d12-05dc0b68e732

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

Attachment

General

Creator:
Created:
Updated:
Size: