browser_caching_domnodeid.js (1002B)
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 /** 8 * Test DOM ID caching on remotes. 9 */ 10 addAccessibleTask( 11 '<div id="div"></div>', 12 async function (browser, accDoc) { 13 const div = findAccessibleChildByID(accDoc, "div"); 14 ok(div, "Got accessible with 'div' ID."); 15 16 let contentPromise = invokeContentTask(browser, [], () => { 17 content.document.getElementById("div").id = "foo"; 18 }); 19 // We don't await for content task to return because we want to exercise the 20 // untilCacheIs function and demonstrate that it can await for a passing 21 // `is` test. 22 await untilCacheIs( 23 () => div.id, 24 "foo", 25 "ID is correct and updated in cache" 26 ); 27 28 // Don't leave test without the content task promise resolved. 29 await contentPromise; 30 }, 31 { iframe: true, remoteIframe: true } 32 );