Bug 1624550 - P5: Fix racy check for SessionHistory update. r=kmag

This code was relying on SessionHistory update having completed when
GlobalHistory is update. Moving GlobalHistory update to the parent process with
DocumentChannel means that it's possible for the GlobalHistory event to fire
before the SessionHistory is updated in nsDocShell.

Switch to using tab loading complete to signal when it's OK to check
SessionHistory.

Differential Revision: https://phabricator.services.mozilla.com/D72280
This commit is contained in:
Dan Glastonbury 2020-05-08 03:28:46 +00:00
parent 7699520bf5
commit d35dd7a81d

View File

@ -148,7 +148,7 @@ add_task(async function test_update_reload() {
let extension = ExtensionTestUtils.loadExtension({
manifest: {
permissions: ["tabs", "history"],
permissions: ["tabs"],
},
background() {
@ -157,9 +157,15 @@ add_task(async function test_update_reload() {
browser.test.sendMessage("result", result);
});
browser.history.onVisited.addListener(data => {
browser.test.sendMessage("historyAdded");
});
const filter = {
properties: ["status"],
};
browser.tabs.onUpdated.addListener((tabId, changeInfo) => {
if (changeInfo.status === "complete") {
browser.test.sendMessage("historyAdded");
}
}, filter);
},
});