forked from mirrors/gecko-dev
Using `visibility` preserves frames of the content inside the dialog, which we rely on to print the preview `<browser>` element. This was working before bug 1662336 mostly by chance, because we were doing an extra clone and that happened to mostly not rely on the cloned document being rendered. I'd rather fix it in the front-end (by not trying to print a `display: none` <browser>) than going back to do a separate clone, because that can get expensive (specially with fission). It's not super-clear to me how to best test the "print from system dialog" case, but ideas certainly welcome. Differential Revision: https://phabricator.services.mozilla.com/D95501
112 lines
3.3 KiB
JavaScript
112 lines
3.3 KiB
JavaScript
add_task(async function() {
|
|
await openPreferencesViaOpenPreferencesAPI("general", { leaveOpen: true });
|
|
const contentDocument = gBrowser.contentDocument;
|
|
let dialogOverlay = content.gSubDialog._preloadDialog._overlay;
|
|
|
|
async function languagesSubdialogOpened() {
|
|
const promiseSubDialogLoaded = promiseLoadSubDialog(
|
|
"chrome://browser/content/preferences/dialogs/languages.xhtml"
|
|
);
|
|
contentDocument.getElementById("chooseLanguage").click();
|
|
const win = await promiseSubDialogLoaded;
|
|
win.Preferences.forceEnableInstantApply();
|
|
dialogOverlay = content.gSubDialog._topDialog._overlay;
|
|
ok(!BrowserTestUtils.is_hidden(dialogOverlay), "The dialog is visible.");
|
|
return win;
|
|
}
|
|
|
|
function closeLanguagesSubdialog() {
|
|
const closeBtn = dialogOverlay.querySelector(".dialogClose");
|
|
closeBtn.doCommand();
|
|
}
|
|
|
|
ok(BrowserTestUtils.is_hidden(dialogOverlay), "The dialog is invisible.");
|
|
let win = await languagesSubdialogOpened();
|
|
ok(
|
|
win.document.getElementById("spoofEnglish").hidden,
|
|
"The 'Request English' checkbox is hidden."
|
|
);
|
|
closeLanguagesSubdialog();
|
|
ok(BrowserTestUtils.is_hidden(dialogOverlay), "The dialog is invisible.");
|
|
|
|
await SpecialPowers.pushPrefEnv({
|
|
set: [
|
|
["privacy.resistFingerprinting", true],
|
|
["privacy.spoof_english", 0],
|
|
],
|
|
});
|
|
|
|
win = await languagesSubdialogOpened();
|
|
ok(
|
|
!win.document.getElementById("spoofEnglish").hidden,
|
|
"The 'Request English' checkbox isn't hidden."
|
|
);
|
|
ok(
|
|
!win.document.getElementById("spoofEnglish").checked,
|
|
"The 'Request English' checkbox isn't checked."
|
|
);
|
|
is(
|
|
win.Preferences.get("privacy.spoof_english").value,
|
|
0,
|
|
"The privacy.spoof_english pref is set to 0."
|
|
);
|
|
|
|
win.document.getElementById("spoofEnglish").checked = true;
|
|
win.document.getElementById("spoofEnglish").doCommand();
|
|
ok(
|
|
win.document.getElementById("spoofEnglish").checked,
|
|
"The 'Request English' checkbox is checked."
|
|
);
|
|
is(
|
|
win.Preferences.get("privacy.spoof_english").value,
|
|
2,
|
|
"The privacy.spoof_english pref is set to 2."
|
|
);
|
|
closeLanguagesSubdialog();
|
|
|
|
win = await languagesSubdialogOpened();
|
|
ok(
|
|
!win.document.getElementById("spoofEnglish").hidden,
|
|
"The 'Request English' checkbox isn't hidden."
|
|
);
|
|
ok(
|
|
win.document.getElementById("spoofEnglish").checked,
|
|
"The 'Request English' checkbox is checked."
|
|
);
|
|
is(
|
|
win.Preferences.get("privacy.spoof_english").value,
|
|
2,
|
|
"The privacy.spoof_english pref is set to 2."
|
|
);
|
|
|
|
win.document.getElementById("spoofEnglish").checked = false;
|
|
win.document.getElementById("spoofEnglish").doCommand();
|
|
ok(
|
|
!win.document.getElementById("spoofEnglish").checked,
|
|
"The 'Request English' checkbox isn't checked."
|
|
);
|
|
is(
|
|
win.Preferences.get("privacy.spoof_english").value,
|
|
1,
|
|
"The privacy.spoof_english pref is set to 1."
|
|
);
|
|
closeLanguagesSubdialog();
|
|
|
|
win = await languagesSubdialogOpened();
|
|
ok(
|
|
!win.document.getElementById("spoofEnglish").hidden,
|
|
"The 'Request English' checkbox isn't hidden."
|
|
);
|
|
ok(
|
|
!win.document.getElementById("spoofEnglish").checked,
|
|
"The 'Request English' checkbox isn't checked."
|
|
);
|
|
is(
|
|
win.Preferences.get("privacy.spoof_english").value,
|
|
1,
|
|
"The privacy.spoof_english pref is set to 1."
|
|
);
|
|
closeLanguagesSubdialog();
|
|
|
|
gBrowser.removeCurrentTab();
|
|
});
|