зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1706445 - Fix test helpers that use "SessionStore:update", r=nika,perftest-reviewers,sparky
Also skips a frame script OOM test for Fission. Differential Revision: https://phabricator.services.mozilla.com/D115930
This commit is contained in:
Родитель
1209d70a99
Коммит
8b26cd73bb
|
@ -289,6 +289,7 @@ skip-if = verify && debug
|
|||
run-if = e10s
|
||||
tags = openUILinkIn
|
||||
[browser_send_async_message_oom.js]
|
||||
skip-if = fission # Tests that the frame script OOMs, which is unused in Fission.
|
||||
[browser_sessionStoreContainer.js]
|
||||
[browser_windowStateContainer.js]
|
||||
[browser_1234021.js]
|
||||
|
|
|
@ -1119,6 +1119,7 @@ var BrowserTestUtils = {
|
|||
let domWinClosedPromise = BrowserTestUtils.domWindowClosed(win);
|
||||
let promises = [domWinClosedPromise];
|
||||
let winType = win.document.documentElement.getAttribute("windowtype");
|
||||
let flushTopic = "sessionstore-browser-shutdown-flush";
|
||||
|
||||
if (winType == "navigator:browser") {
|
||||
let finalMsgsPromise = new Promise(resolve => {
|
||||
|
@ -1128,24 +1129,21 @@ var BrowserTestUtils = {
|
|||
browserSet.forEach(browser => {
|
||||
win.gBrowser._insertBrowser(win.gBrowser.getTabForBrowser(browser));
|
||||
});
|
||||
let mm = win.getGroupMessageManager("browsers");
|
||||
|
||||
mm.addMessageListener(
|
||||
"SessionStore:update",
|
||||
function onMessage(msg) {
|
||||
if (browserSet.has(msg.target) && msg.data.isFinal) {
|
||||
browserSet.delete(msg.target);
|
||||
let observer = (subject, topic, data) => {
|
||||
if (browserSet.has(subject)) {
|
||||
browserSet.delete(subject);
|
||||
}
|
||||
if (!browserSet.size) {
|
||||
mm.removeMessageListener("SessionStore:update", onMessage);
|
||||
Services.obs.removeObserver(observer, flushTopic);
|
||||
// Give the TabStateFlusher a chance to react to this final
|
||||
// update and for the TabStateFlusher.flushWindow promise
|
||||
// to resolve before we resolve.
|
||||
TestUtils.executeSoon(resolve);
|
||||
}
|
||||
}
|
||||
},
|
||||
true
|
||||
);
|
||||
};
|
||||
|
||||
Services.obs.addObserver(observer, flushTopic);
|
||||
});
|
||||
|
||||
promises.push(finalMsgsPromise);
|
||||
|
@ -1165,19 +1163,17 @@ var BrowserTestUtils = {
|
|||
*/
|
||||
waitForSessionStoreUpdate(tab) {
|
||||
return new Promise(resolve => {
|
||||
let { messageManager: mm, frameLoader } = tab.linkedBrowser;
|
||||
mm.addMessageListener(
|
||||
"SessionStore:update",
|
||||
function onMessage(msg) {
|
||||
if (msg.targetFrameLoader == frameLoader && msg.data.isFinal) {
|
||||
mm.removeMessageListener("SessionStore:update", onMessage);
|
||||
let browser = tab.linkedBrowser;
|
||||
let flushTopic = "sessionstore-browser-shutdown-flush";
|
||||
let observer = (subject, topic, data) => {
|
||||
if (subject === browser) {
|
||||
Services.obs.removeObserver(observer, flushTopic);
|
||||
// Wait for the next event tick to make sure other listeners are
|
||||
// called.
|
||||
TestUtils.executeSoon(() => resolve());
|
||||
}
|
||||
},
|
||||
true
|
||||
);
|
||||
};
|
||||
Services.obs.addObserver(observer, flushTopic);
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ ChromeUtils.defineModuleGetter(
|
|||
|
||||
const PREALLOCATED_PREF = "dom.ipc.processPrelaunch.enabled";
|
||||
const MESSAGES = ["CPStartup:Go", "CPStartup:BrowserChildReady"];
|
||||
const BROWSER_FLUSH_TOPIC = "sessionstore-browser-shutdown-flush";
|
||||
let domainID = 1;
|
||||
|
||||
/* global ExtensionAPI */
|
||||
|
@ -117,18 +118,14 @@ this.cpstartup = class extends ExtensionAPI {
|
|||
|
||||
removeTab(tab) {
|
||||
return new Promise(resolve => {
|
||||
let { messageManager: mm, frameLoader } = tab.linkedBrowser;
|
||||
mm.addMessageListener(
|
||||
"SessionStore:update",
|
||||
function onMessage(msg) {
|
||||
if (msg.targetFrameLoader == frameLoader && msg.data.isFinal) {
|
||||
mm.removeMessageListener("SessionStore:update", onMessage);
|
||||
let browser = tab.linkedBrowser;
|
||||
let observer = (subject, topic, data) => {
|
||||
if (subject === browser) {
|
||||
Services.obs.removeObserver(observer, BROWSER_FLUSH_TOPIC);
|
||||
resolve();
|
||||
}
|
||||
},
|
||||
true
|
||||
);
|
||||
|
||||
};
|
||||
Services.obs.addObserver(observer, BROWSER_FLUSH_TOPIC);
|
||||
tab.ownerGlobal.gBrowser.removeTab(tab);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -36,6 +36,8 @@ const MULTI_OPT_OUT_PREF = "dom.ipc.multiOptOut";
|
|||
|
||||
const MESSAGES = ["TabPaint:Go", "TabPaint:Painted"];
|
||||
|
||||
const BROWSER_FLUSH_TOPIC = "sessionstore-browser-shutdown-flush";
|
||||
|
||||
/* globals ExtensionAPI */
|
||||
this.tabpaint = class extends ExtensionAPI {
|
||||
onStartup() {
|
||||
|
@ -201,18 +203,14 @@ this.tabpaint = class extends ExtensionAPI {
|
|||
removeTab(tab) {
|
||||
TalosParentProfiler.mark("Tabpaint: Remove Tab");
|
||||
return new Promise(resolve => {
|
||||
let { messageManager: mm, frameLoader } = tab.linkedBrowser;
|
||||
mm.addMessageListener(
|
||||
"SessionStore:update",
|
||||
function onMessage(msg) {
|
||||
if (msg.targetFrameLoader == frameLoader && msg.data.isFinal) {
|
||||
mm.removeMessageListener("SessionStore:update", onMessage);
|
||||
let browser = tab.linkedBrowser;
|
||||
let observer = (subject, topic, data) => {
|
||||
if (subject === browser) {
|
||||
Services.obs.removeObserver(observer, BROWSER_FLUSH_TOPIC);
|
||||
resolve();
|
||||
}
|
||||
},
|
||||
true
|
||||
);
|
||||
|
||||
};
|
||||
Services.obs.addObserver(observer, BROWSER_FLUSH_TOPIC);
|
||||
tab.ownerGlobal.gBrowser.removeTab(tab);
|
||||
});
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче