forked from mirrors/gecko-dev
Bug 1673962 - Test to cover the code path of canceling the Restart Required prompt when enabling a restart-required=true experimental feature. r=Gijs,preferences-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D95058
This commit is contained in:
parent
d92ef717a6
commit
d6d0de33e6
2 changed files with 48 additions and 0 deletions
|
|
@ -21,6 +21,7 @@ skip-if = !updater
|
||||||
[browser_experimental_features_filter.js]
|
[browser_experimental_features_filter.js]
|
||||||
[browser_experimental_features_hidden_when_not_public.js]
|
[browser_experimental_features_hidden_when_not_public.js]
|
||||||
[browser_experimental_features_resetall.js]
|
[browser_experimental_features_resetall.js]
|
||||||
|
[browser_experimental_features_restart_required_cancel.js]
|
||||||
[browser_filetype_dialog.js]
|
[browser_filetype_dialog.js]
|
||||||
[browser_search_no_results_change_category.js]
|
[browser_search_no_results_change_category.js]
|
||||||
[browser_search_within_preferences_1.js]
|
[browser_search_within_preferences_1.js]
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
add_task(async function testInfiniteCancelLoop() {
|
||||||
|
await SpecialPowers.pushPrefEnv({
|
||||||
|
set: [["browser.preferences.experimental", true]],
|
||||||
|
});
|
||||||
|
|
||||||
|
const server = new DefinitionServer();
|
||||||
|
server.addDefinition({
|
||||||
|
id: "test-featureA",
|
||||||
|
isPublic: true,
|
||||||
|
preference: "test.feature.a",
|
||||||
|
restartRequired: true,
|
||||||
|
});
|
||||||
|
await BrowserTestUtils.openNewForegroundTab(
|
||||||
|
gBrowser,
|
||||||
|
`about:preferences?definitionsUrl=${encodeURIComponent(
|
||||||
|
server.definitionsUrl
|
||||||
|
)}#paneExperimental`
|
||||||
|
);
|
||||||
|
let doc = gBrowser.contentDocument;
|
||||||
|
|
||||||
|
// Trigger and cancel a feature that has restart-required=true to make
|
||||||
|
// sure that we don't enter an infinite loop of prompts.
|
||||||
|
let featureCheckbox = doc.getElementById("test-featureA");
|
||||||
|
ok(featureCheckbox, "Checkbox should exist");
|
||||||
|
let newWindowPromise = BrowserTestUtils.domWindowOpened();
|
||||||
|
featureCheckbox.click();
|
||||||
|
|
||||||
|
let restartWin = await newWindowPromise;
|
||||||
|
let dialog = await TestUtils.waitForCondition(() =>
|
||||||
|
restartWin.document.querySelector(`dialog`)
|
||||||
|
);
|
||||||
|
let cancelButton = dialog.shadowRoot.querySelector(`[dlgtype="cancel"]`);
|
||||||
|
ok(cancelButton, "Cancel button should exist in dialog");
|
||||||
|
let windowClosedPromise = BrowserTestUtils.domWindowClosed(restartWin);
|
||||||
|
cancelButton.click();
|
||||||
|
await windowClosedPromise;
|
||||||
|
|
||||||
|
// If a new prompt is opened then the test should fail since
|
||||||
|
// the prompt window will have leaked.
|
||||||
|
|
||||||
|
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||||
|
});
|
||||||
Loading…
Reference in a new issue