Bug 1381944 - Adjust browser_notification_open_settings.js to work with both old and new forms of about:preferences. r?jaws
MozReview-Commit-ID: 9JIcNFnz0hv
--- a/browser/base/content/test/alerts/browser_notification_open_settings.js
+++ b/browser/base/content/test/alerts/browser_notification_open_settings.js
@@ -1,19 +1,21 @@
"use strict";
var notificationURL = "http://example.org/browser/browser/base/content/test/alerts/file_dom_notifications.html";
+var expectedURL = Services.prefs.getBoolPref("browser.preferences.useOldOrganization") ? "about:preferences#content"
+ : "about:preferences#privacy";
add_task(async function test_settingsOpen_observer() {
info("Opening a dummy tab so openPreferences=>switchToTabHavingURI doesn't use the blank tab.");
await BrowserTestUtils.withNewTab({
gBrowser,
url: "about:robots"
}, async function dummyTabTask(aBrowser) {
- let tabPromise = BrowserTestUtils.waitForNewTab(gBrowser, "about:preferences#privacy");
+ let tabPromise = BrowserTestUtils.waitForNewTab(gBrowser, expectedURL);
info("simulate a notifications-open-settings notification");
let uri = NetUtil.newURI("https://example.com");
let principal = Services.scriptSecurityManager.createCodebasePrincipal(uri, {});
Services.obs.notifyObservers(principal, "notifications-open-settings");
let tab = await tabPromise;
ok(tab, "The notification settings tab opened");
await BrowserTestUtils.removeTab(tab);
});
@@ -35,17 +37,17 @@ add_task(async function test_settingsOpe
let alertWindow = Services.wm.getMostRecentWindow("alert:alert");
if (!alertWindow) {
ok(true, "Notifications don't use XUL windows on all platforms.");
await closeNotification(aBrowser);
return;
}
let closePromise = promiseWindowClosed(alertWindow);
- let tabPromise = BrowserTestUtils.waitForNewTab(gBrowser, "about:preferences#privacy");
+ let tabPromise = BrowserTestUtils.waitForNewTab(gBrowser, expectedURL);
let openSettingsMenuItem = alertWindow.document.getElementById("openSettingsMenuItem");
openSettingsMenuItem.click();
info("Waiting for notification settings tab");
let tab = await tabPromise;
ok(tab, "The notification settings tab opened");
await closePromise;