Commit c15c6e8d authored by Felipe Gomes's avatar Felipe Gomes
Browse files

Bug 827976 - Make Sanitizer.jsm not use the hidden window. r=Gijs

It doesn't need a high precision performance.now() to count minutes. In addition, if there are no windows to be closed, it's not doing anything, so it doesn't need to open a new one.

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

--HG--
extra : moz-landing-system : lando
parent 5d922af0
......@@ -470,8 +470,7 @@ var Sanitizer = {
// Keep track of the time in case we get stuck in la-la-land because of onbeforeunload
// dialogs
let existingWindow = Services.appShell.hiddenDOMWindow;
let startDate = existingWindow.performance.now();
let startDate = Date.now();
// First check if all these windows are OK with being closed:
let windowList = [];
......@@ -487,12 +486,16 @@ var Sanitizer = {
// hit until the prompt has been dismissed. If more than 1 minute has elapsed since we
// started prompting, stop, because the user might not even remember initiating the
// 'forget', and the timespans will be all wrong by now anyway:
if (existingWindow.performance.now() > (startDate + 60 * 1000)) {
if (Date.now() > (startDate + 60 * 1000)) {
this._resetAllWindowClosures(windowList);
throw new Error("Sanitize could not close windows: timeout");
}
}
if (windowList.length == 0) {
return;
}
// If/once we get here, we should actually be able to close all windows.
let refObj = {};
......@@ -503,8 +506,8 @@ var Sanitizer = {
let handler = Cc["@mozilla.org/browser/clh;1"].getService(Ci.nsIBrowserHandler);
let defaultArgs = handler.defaultArgs;
let features = "chrome,all,dialog=no," + privateStateForNewWindow;
let newWindow = existingWindow.openDialog(AppConstants.BROWSER_CHROME_URL, "_blank",
features, defaultArgs);
let newWindow = windowList[0].openDialog(AppConstants.BROWSER_CHROME_URL, "_blank",
features, defaultArgs);
let onFullScreen = null;
if (AppConstants.platform == "macosx") {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment