diff --git a/browser/components/aboutlogins/tests/browser/browser_openPreferences.js b/browser/components/aboutlogins/tests/browser/browser_openPreferences.js index c9fe2a5423d7..6c1cb53cf452 100644 --- a/browser/components/aboutlogins/tests/browser/browser_openPreferences.js +++ b/browser/components/aboutlogins/tests/browser/browser_openPreferences.js @@ -12,9 +12,28 @@ add_task(async function setup() { }); add_task(async function test_open_preferences() { + // We want to make sure we visit about:preferences#privacy-logins , as that is + // what causes us to scroll to and highlight the "logins" section. However, + // about:preferences will redirect the URL, so the eventual load event will happen + // on about:preferences#privacy . The `wantLoad` parameter we pass to + // `waitForNewTab` needs to take this into account: + let seenFirstURL = false; let promiseNewTab = BrowserTestUtils.waitForNewTab( gBrowser, - "about:preferences#privacy-logins" + url => { + if (url == "about:preferences#privacy-logins") { + seenFirstURL = true; + return true; + } else if (url == "about:preferences#privacy") { + ok( + seenFirstURL, + "Must have seen an onLocationChange notification for the privacy-logins hash" + ); + return true; + } + return false; + }, + true ); let browser = gBrowser.selectedBrowser;