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