browser_tab_name_change.js (1025B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 /* import-globals-from ../../mochitest/role.js */ 8 loadScripts({ name: "role.js", dir: MOCHITESTS_DIR }); 9 10 addAccessibleTask(``, async function (browser, _accDoc) { 11 let tabChanged = waitForEvent( 12 EVENT_FOCUS, 13 e => e.accessible.name == "One" && e.accessible.role == ROLE_DOCUMENT 14 ); 15 16 // Put new tab in foreground 17 let tab = await BrowserTestUtils.openNewForegroundTab({ 18 gBrowser, 19 url: "data:text/html,<title>One</title>", 20 }); 21 22 await tabChanged; 23 24 let nameChanged = waitForEvent( 25 EVENT_NAME_CHANGE, 26 e => e.accessible.name == "Two" && e.accessible.role == ROLE_PAGETAB 27 ); 28 29 // Change name of background tab 30 BrowserTestUtils.startLoadingURIString( 31 browser, 32 "data:text/html,<title>Two</title>" 33 ); 34 35 await nameChanged; 36 37 BrowserTestUtils.removeTab(tab); 38 });