зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1718435 - fix clear recent history dialog when there are no open windows, r=mconley
Differential Revision: https://phabricator.services.mozilla.com/D121842
This commit is contained in:
Родитель
1ba71d6e84
Коммит
0c1c818c13
|
@ -34,10 +34,17 @@ var gSanitizePromptDialog = {
|
||||||
// This is used by selectByTimespan() to determine if the window has loaded.
|
// This is used by selectByTimespan() to determine if the window has loaded.
|
||||||
this._inited = true;
|
this._inited = true;
|
||||||
this._dialog = document.querySelector("dialog");
|
this._dialog = document.querySelector("dialog");
|
||||||
let { inBrowserWindow = false } = window.arguments?.[0] || {};
|
let arg = window.arguments?.[0] || {};
|
||||||
if (inBrowserWindow) {
|
if (arg.inBrowserWindow) {
|
||||||
this._dialog.setAttribute("inbrowserwindow", "true");
|
this._dialog.setAttribute("inbrowserwindow", "true");
|
||||||
this._observeTitleForChanges();
|
this._observeTitleForChanges();
|
||||||
|
} else if (arg.wrappedJSObject?.needNativeUI) {
|
||||||
|
document
|
||||||
|
.getElementById("sanitizeDurationChoice")
|
||||||
|
.setAttribute("native", "true");
|
||||||
|
for (let cb of document.querySelectorAll("checkbox")) {
|
||||||
|
cb.setAttribute("native", "true");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let OKButton = this._dialog.getButton("accept");
|
let OKButton = this._dialog.getButton("accept");
|
||||||
|
|
|
@ -107,13 +107,31 @@ var Sanitizer = {
|
||||||
* @throws if parentWindow is undefined or doesn't have a gDialogBox.
|
* @throws if parentWindow is undefined or doesn't have a gDialogBox.
|
||||||
*/
|
*/
|
||||||
showUI(parentWindow) {
|
showUI(parentWindow) {
|
||||||
if (!parentWindow?.gDialogBox) {
|
// Treat the hidden window as not being a parent window:
|
||||||
throw new Error("Sanitizer.showUI expected a browser window argument.");
|
if (
|
||||||
|
parentWindow?.document.documentURI ==
|
||||||
|
"chrome://browser/content/hiddenWindowMac.xhtml"
|
||||||
|
) {
|
||||||
|
parentWindow = null;
|
||||||
}
|
}
|
||||||
|
if (parentWindow?.gDialogBox) {
|
||||||
parentWindow.gDialogBox.open("chrome://browser/content/sanitize.xhtml", {
|
parentWindow.gDialogBox.open("chrome://browser/content/sanitize.xhtml", {
|
||||||
inBrowserWindow: true,
|
inBrowserWindow: true,
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
let arg = {
|
||||||
|
needNativeUI: true,
|
||||||
|
QueryInterface: ChromeUtils.generateQI([]),
|
||||||
|
};
|
||||||
|
arg.wrappedJSObject = arg;
|
||||||
|
Services.ww.openWindow(
|
||||||
|
parentWindow,
|
||||||
|
"chrome://browser/content/sanitize.xhtml",
|
||||||
|
"Sanitize",
|
||||||
|
"chrome,titlebar,dialog,centerscreen,modal",
|
||||||
|
arg
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Загрузка…
Ссылка в новой задаче