Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: os == 'mac' && os_version == '10.15' && processor == 'x86_64' && debug OR os == 'mac' && os_version == '11.20' && arch == 'aarch64' && debug
- Manifest: toolkit/components/passwordmgr/test/browser/browser.toml
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
add_task(async function test_auth_switchtab() {
let tab = BrowserTestUtils.addTab(gBrowser);
isnot(tab, gBrowser.selectedTab, "New tab shouldn't be selected");
let authPromptShown = PromptTestUtils.waitForPrompt(tab.linkedBrowser, {
modalType: Ci.nsIPrompt.MODAL_TYPE_TAB,
promptType: "promptUserAndPass",
});
let loadPromise = BrowserTestUtils.browserLoaded(tab.linkedBrowser);
BrowserTestUtils.startLoadingURIString(
tab.linkedBrowser,
);
// Wait for the basic auth prompt
let dialog = await authPromptShown;
Assert.equal(gBrowser.selectedTab, tab, "Should have selected the new tab");
// Cancel the auth prompt
PromptTestUtils.handlePrompt(dialog, { buttonNumClick: 1 });
// After closing the prompt the load should finish
await loadPromise;
gBrowser.removeTab(tab);
});