Bug 1599662 - Add process switching to the reftest harness so that we can get better coverage for fission. r=kmag

Differential Revision: https://phabricator.services.mozilla.com/D55568

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Matt Woodrow 2019-12-03 22:18:45 +00:00
Родитель c4d5bb1a19
Коммит 8ca80cd1af
3 изменённых файлов: 64 добавлений и 7 удалений

Просмотреть файл

@ -11,7 +11,7 @@ load 500328-1.html
load 514779-1.xhtml
load 614499-1.html
load 678872-1.html
skip pref(dom.disable_open_during_load,false) load 914521.html # Android bug 1584562, process selection bug 1599662.
skip-if(Android) pref(dom.disable_open_during_load,false) load 914521.html # Android bug 1584562
pref(browser.send_pings,true) asserts(0-2) load 1257730-1.html # bug 566159
load 1331295.html
load 1341657.html

Просмотреть файл

@ -110,6 +110,9 @@ function OnInitialLoad()
removeEventListener("load", OnInitialLoad, true);
gDebug = Cc[DEBUG_CONTRACTID].getService(Ci.nsIDebug2);
if (gDebug.isDebugBuild) {
gAssertionCount = gDebug.assertionCount;
}
var env = Cc[ENVIRONMENT_CONTRACTID].getService(Ci.nsIEnvironment);
gVerbose = !!env.get("MOZ_REFTEST_VERBOSE");

Просмотреть файл

@ -18,9 +18,12 @@ Cu.import("resource://reftest/manifest.jsm", this);
Cu.import("resource://reftest/StructuredLog.jsm", this);
Cu.import("resource://reftest/PerTestCoverageUtils.jsm", this);
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
const { E10SUtils } = ChromeUtils.import(
"resource://gre/modules/E10SUtils.jsm"
);
XPCOMUtils.defineLazyGetter(this, "OS", function() {
const { OS } = Cu.import("resource://gre/modules/osfile.jsm");
return OS;
@ -224,7 +227,7 @@ function OnRefTestLoad(win)
g.browserMessageManager = g.browser.frameLoader.messageManager;
// The content script waits for the initial onload, then notifies
// us.
RegisterMessageListenersAndLoadContentScript();
RegisterMessageListenersAndLoadContentScript(false);
}
function InitAndStartRefTests()
@ -669,7 +672,41 @@ function StartCurrentTest()
}
}
function StartCurrentURI(aURLTargetType)
// A simplified version of the function with the same name in tabbrowser.js.
function updateBrowserRemotenessByURL(aBrowser, aURL) {
let remoteType = E10SUtils.getRemoteTypeForURI(
aURL,
aBrowser.ownerGlobal.docShell.nsILoadContext.useRemoteTabs,
aBrowser.ownerGlobal.docShell.nsILoadContext.useRemoteSubframes,
aBrowser.remoteType,
aBrowser.currentURI
);
// Things get confused if we switch to not-remote
// for chrome:// URIs, so lets not for now.
if (remoteType == E10SUtils.NOT_REMOTE &&
g.browserIsRemote) {
remoteType = aBrowser.remoteType;
}
if (aBrowser.remoteType != remoteType) {
if (remoteType == E10SUtils.NOT_REMOTE) {
aBrowser.removeAttribute("remote");
aBrowser.removeAttribute("remoteType");
} else {
aBrowser.setAttribute("remote", "true");
aBrowser.setAttribute("remoteType", remoteType);
}
aBrowser.changeRemoteness({ remoteType });
aBrowser.construct();
g.browserMessageManager = aBrowser.frameLoader.messageManager;
RegisterMessageListenersAndLoadContentScript(true);
return new Promise(resolve => { g.resolveContentReady = resolve; });
}
return Promise.resolve();
}
async function StartCurrentURI(aURLTargetType)
{
const isStartingRef = (aURLTargetType == URL_TARGET_TYPE_REFERENCE);
@ -767,6 +804,8 @@ function StartCurrentURI(aURLTargetType)
gDumpFn("REFTEST TEST-LOAD | " + g.currentURL + " | " + currentTest + " / " + g.totalTests +
" (" + Math.floor(100 * (currentTest / g.totalTests)) + "%)\n");
TestBuffer("START " + g.currentURL);
await updateBrowserRemotenessByURL(g.browser, g.currentURL);
var type = g.urls[0].type
if (TYPE_SCRIPT == type) {
SendLoadScriptTest(g.currentURL, g.loadTimeout);
@ -1439,7 +1478,7 @@ function RestoreChangedPreferences()
}
}
function RegisterMessageListenersAndLoadContentScript()
function RegisterMessageListenersAndLoadContentScript(aReload)
{
g.browserMessageManager.addMessageListener(
"reftest:AssertionCount",
@ -1512,6 +1551,10 @@ function RegisterMessageListenersAndLoadContentScript()
g.browserMessageManager.loadFrameScript("resource://reftest/reftest-content.js", true, true);
if (aReload) {
return;
}
ChromeUtils.registerWindowActor("ReftestFission", {
parent: {
moduleURI: "resource://reftest/ReftestFissionParent.jsm",
@ -1531,8 +1574,19 @@ function RecvAssertionCount(count)
function RecvContentReady(info)
{
g.contentGfxInfo = info.gfx;
InitAndStartRefTests();
if (g.resolveContentReady) {
// Focus the content browser.
if (g.focusFilterMode != FOCUS_FILTER_NON_NEEDS_FOCUS_TESTS) {
if (Services.focus.activeWindow != g.containingWindow) {
Focus();
}
}
g.resolveContentReady();
g.resolveContentReady = null;
} else {
g.contentGfxInfo = info.gfx;
InitAndStartRefTests();
}
return { remote: g.browserIsRemote };
}