Backed out 8 changesets (bug 1458375) for Mochitest leaks on a CLOSED TREE

Backed out changeset 30a743401670 (bug 1458375)
Backed out changeset ae969e1cebfb (bug 1458375)
Backed out changeset 1fb76b9b6f82 (bug 1458375)
Backed out changeset 868da3a1b94a (bug 1458375)
Backed out changeset bd2cba9dfb3d (bug 1458375)
Backed out changeset 715850ae92a1 (bug 1458375)
Backed out changeset cfe8da250de7 (bug 1458375)
Backed out changeset 2968c0a21410 (bug 1458375)
This commit is contained in:
Noemi Erli 2018-05-31 22:38:48 +03:00
Родитель 9e81b12ebc
Коммит 8e2471b6cb
11 изменённых файлов: 120 добавлений и 64 удалений

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

@ -1162,7 +1162,6 @@ var delayedStartupPromise = new Promise(resolve => {
var gBrowserInit = {
delayedStartupFinished: false,
idleTasksFinished: false,
_tabToAdopt: undefined,
@ -1780,14 +1779,6 @@ var gBrowserInit = {
Cu.reportError(ex);
}
}, {timeout: 10000});
// This should always go last, since the idle tasks (except for the ones with
// timeouts) should execute in order. Note that this observer notification is
// not guaranteed to fire, since the window could close before we get here.
scheduleIdleTask(() => {
this.idleTasksFinished = true;
Services.obs.notifyObservers(window, "browser-idle-startup-tasks-finished");
});
},
// Returns the URI(s) to load at startup if it is immediately known, or a

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

@ -32,7 +32,7 @@
#include "nsXULAppAPI.h"
#include "xpcpublic.h"
#define STARTUP_COMPLETE_TOPIC "browser-idle-startup-tasks-finished"
#define DELAYED_STARTUP_TOPIC "browser-delayed-startup-finished"
#define DOC_ELEM_INSERTED_TOPIC "document-element-inserted"
#define CLEANUP_TOPIC "xpcom-shutdown"
#define SHUTDOWN_TOPIC "quit-application-granted"
@ -231,8 +231,8 @@ ScriptPreloader::ScriptPreloader()
if (XRE_IsParentProcess()) {
// In the parent process, we want to freeze the script cache as soon
// as idle tasks for the first browser window have completed.
obs->AddObserver(this, STARTUP_COMPLETE_TOPIC, false);
// as delayed startup for the first browser window has completed.
obs->AddObserver(this, DELAYED_STARTUP_TOPIC, false);
} else {
// In the child process, we need to freeze the script cache before any
// untrusted code has been executed. The insertion of the first DOM
@ -338,8 +338,8 @@ nsresult
ScriptPreloader::Observe(nsISupports* subject, const char* topic, const char16_t* data)
{
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
if (!strcmp(topic, STARTUP_COMPLETE_TOPIC)) {
obs->RemoveObserver(this, STARTUP_COMPLETE_TOPIC);
if (!strcmp(topic, DELAYED_STARTUP_TOPIC)) {
obs->RemoveObserver(this, DELAYED_STARTUP_TOPIC);
MOZ_ASSERT(XRE_IsParentProcess());

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

@ -554,12 +554,6 @@ var BrowserApp = {
// Bug 778855 - Perf regression if we do this here. To be addressed in bug 779008.
InitLater(() => SafeBrowsing.init(), window, "SafeBrowsing");
// This should always go last, since the idle tasks (except for the ones with
// timeouts) should execute in order. Note that this observer notification is
// not guaranteed to fire, since the window could close before we get here.
InitLater(() => {
Services.obs.notifyObservers(window, "browser-idle-startup-tasks-finished");
});
}, {once: true});
},

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

@ -16,7 +16,7 @@ ChromeUtils.defineModuleGetter(this, "StartupPerformance",
"resource:///modules/sessionstore/StartupPerformance.jsm");
// Observer Service topics.
const WINDOW_READY_TOPIC = "browser-idle-startup-tasks-finished";
const WINDOW_READY_TOPIC = "browser-delayed-startup-finished";
// Process Message Manager topics.
const MSG_REQUEST = "session-restore-test?duration";
@ -73,7 +73,7 @@ const sessionRestoreTest = {
// onReady might fire before the browser window has finished initializing
// or sometimes soon after. We handle both cases here.
let win = Services.wm.getMostRecentWindow("navigator:browser");
if (!win || !win.gBrowserInit || !win.gBrowserInit.idleTasksFinished) {
if (!win || !win.gBrowserInit || !win.gBrowserInit.delayedStartupFinished) {
// We didn't have a window around yet, so we'll wait until one becomes
// available before opening the result tab.
Services.obs.addObserver(this, WINDOW_READY_TOPIC);

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

@ -25,6 +25,7 @@ function logResults(data) {
window.setTimeout(function() {
TalosPowersContent.goQuitApplication();
window.close();
}, 0);
} else {
alert(data[0].split("__start_report")[1].split("__end_report")[0]);

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

@ -59,6 +59,7 @@ function dumpConsoleAndQuit() {
dumpLog("__startTimestamp" + Date.now() + "__endTimestamp\n");
}
TalosPowersContent.goQuitApplication();
window.close();
}, 0);
}

32
testing/talos/talos/talos-powers/bootstrap.js поставляемый
Просмотреть файл

@ -7,8 +7,6 @@ ChromeUtils.defineModuleGetter(this, "Services",
"resource://gre/modules/Services.jsm");
ChromeUtils.defineModuleGetter(this, "OS",
"resource://gre/modules/osfile.jsm");
ChromeUtils.defineModuleGetter(this, "BrowserWindowTracker",
"resource:///modules/BrowserWindowTracker.jsm");
Cu.importGlobalProperties(["TextEncoder"]);
@ -214,35 +212,17 @@ TalosPowersService.prototype = {
}
},
async forceQuit(messageData) {
forceQuit(messageData) {
if (messageData && messageData.waitForSafeBrowsing) {
let SafeBrowsing = ChromeUtils.import("resource://gre/modules/SafeBrowsing.jsm", {}).SafeBrowsing;
let whenDone = () => {
this.forceQuit();
};
SafeBrowsing.addMozEntriesFinishedPromise.then(whenDone, whenDone);
// Speed things up in case nobody else called this:
SafeBrowsing.init();
try {
await SafeBrowsing.addMozEntriesFinishedPromise;
} catch (e) {
// We don't care if things go wrong here - let's just shut down.
}
}
// Check to see if the top-most browser window still needs to fire its
// idle tasks notification. If so, we'll wait for it before shutting
// down, since some caching that can influence future runs in this profile
// keys off of that notification.
let topWin = BrowserWindowTracker.getTopWindow();
if (topWin &&
topWin.gBrowserInit &&
!topWin.gBrowserInit.idleTasksFinished) {
await new Promise(resolve => {
let obs = (subject, topic, data) => {
Services.obs.removeObserver(obs, "browser-idle-startup-tasks-finished");
resolve();
};
Services.obs.addObserver(obs, "browser-idle-startup-tasks-finished");
});
return;
}
let enumerator = Services.wm.getEnumerator(null);

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

@ -8,6 +8,104 @@
ChromeUtils.import("resource://gre/modules/Services.jsm");
function canQuitApplication() {
try {
var cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
.createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(cancelQuit, "quit-application-requested");
// Something aborted the quit process.
if (cancelQuit.data) {
return false;
}
} catch (ex) {
}
Services.obs.notifyObservers(null, "quit-application-granted");
return true;
}
function goQuitApplication(waitForSafeBrowsing) {
if (Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT) {
// If we're running in a remote browser, emit an event for a
// frame script to pick up to quit the whole browser.
var event = new content.CustomEvent("TalosQuitApplication", {bubbles: true, detail: {waitForSafeBrowsing}});
content.document.dispatchEvent(event);
return false;
}
if (waitForSafeBrowsing) {
var SafeBrowsing = ChromeUtils.import("resource://gre/modules/SafeBrowsing.jsm", {}).SafeBrowsing;
var whenDone = () => {
goQuitApplication(false);
};
SafeBrowsing.addMozEntriesFinishedPromise.then(whenDone, whenDone);
// Speed things up in case nobody else called this:
SafeBrowsing.init();
return false;
}
if (!canQuitApplication()) {
return false;
}
const kAppStartup = "@mozilla.org/toolkit/app-startup;1";
const kAppShell = "@mozilla.org/appshell/appShellService;1";
var appService;
if (kAppStartup in Cc) {
appService = Services.startup;
} else if (kAppShell in Cc) {
appService = Services.appShell;
} else {
throw "goQuitApplication: no AppStartup/appShell";
}
var windowManager = Cc["@mozilla.org/appshell/window-mediator;1"].getService();
var windowManagerInterface = windowManager.
QueryInterface(Ci.nsIWindowMediator);
var enumerator = windowManagerInterface.getEnumerator(null);
while (enumerator.hasMoreElements()) {
var domWindow = enumerator.getNext();
if (("tryToClose" in domWindow) && !domWindow.tryToClose()) {
return false;
}
domWindow.close();
}
try {
appService.quit(appService.eForceQuit);
} catch (ex) {
throw ("goQuitApplication: " + ex);
}
return true;
}
/**
* Content that wants to quit the whole session should
* fire the TalosQuitApplication custom event. This will
* attempt to force-quit the browser.
*/
addEventListener("TalosQuitApplication", event => {
// If we're loaded in a low-priority background process, like
// the background page thumbnailer, then we shouldn't be allowed
// to quit the whole application. This is a workaround until
// bug 1164459 is fixed.
let priority = docShell.QueryInterface(Ci.nsIDocumentLoader)
.loadGroup
.QueryInterface(Ci.nsISupportsPriority)
.priority;
if (priority != Ci.nsISupportsPriority.PRIORITY_LOWEST) {
sendAsyncMessage("Talos:ForceQuit", event.detail);
}
});
addEventListener("TalosContentProfilerCommand", (e) => {
let name = e.detail.name;
let data = e.detail.data;
@ -66,23 +164,8 @@ addEventListener("TalosPowersContentGetStartupInfo", (e) => {
});
});
/**
* Content that wants to quit the whole session should
* fire the TalosPowersGoQuitApplication custom event. This will
* attempt to force-quit the browser.
*/
addEventListener("TalosPowersGoQuitApplication", (e) => {
// If we're loaded in a low-priority background process, like
// the background page thumbnailer, then we shouldn't be allowed
// to quit the whole application. This is a workaround until
// bug 1164459 is fixed.
let priority = docShell.QueryInterface(Ci.nsIDocumentLoader)
.loadGroup
.QueryInterface(Ci.nsISupportsPriority)
.priority;
if (priority != Ci.nsISupportsPriority.PRIORITY_LOWEST) {
sendAsyncMessage("Talos:ForceQuit", e.detail);
}
goQuitApplication(e.detail);
});
/* *

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

@ -9,6 +9,10 @@
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
<!-- This binding is needed on <scrollbar> to prevent content process
startup performance regression; to be removed in bug 1458375 -->
<binding id="empty"/>
<binding id="basecontrol">
<implementation implements="nsIDOMXULControlElement">
<!-- public implementation -->

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

@ -7,6 +7,7 @@
scrollbar {
-moz-appearance: scrollbar;
-moz-binding: url("chrome://global/content/bindings/general.xml#empty");
cursor: default;
background-color: white;
}

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

@ -13,6 +13,7 @@
scrollbar {
-moz-appearance: scrollbar-horizontal;
-moz-binding: url("chrome://global/content/bindings/general.xml#empty");
cursor: default;
}