browser_inspector_reload_nested_iframe.js (1462B)
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 "use strict"; 5 6 // Check that the markup view selection is preserved even if the selection is 7 // in a nested iframe. 8 9 const NESTED_IFRAME_URL = `https://example.com/document-builder.sjs?html=${encodeURIComponent( 10 "<h3>second level iframe</h3>" 11 )}&delay=100`; 12 13 const TEST_URI = `data:text/html;charset=utf-8, 14 <h1>Top-level</h1> 15 <iframe id=first-level 16 src='data:text/html;charset=utf-8,${encodeURIComponent( 17 `<h2>first level iframe</h2><iframe id=second-level src="${NESTED_IFRAME_URL}"></iframe>` 18 )}' 19 ></iframe>`; 20 21 add_task(async function () { 22 const { inspector } = await openInspectorForURL(TEST_URI); 23 24 await selectNodeInFrames( 25 ["iframe#first-level", "iframe#second-level", "h3"], 26 inspector 27 ); 28 29 const markupLoaded = inspector.once("markuploaded"); 30 31 info("Reloading page."); 32 await navigateTo(TEST_URI); 33 34 info("Waiting for markupview to load after reload."); 35 await markupLoaded; 36 37 // This was broken at some point, see Bug 1733539. 38 ok(true, "The markup did reload fine"); 39 40 const reloadedNodeFront = await getNodeFrontInFrames( 41 ["iframe#first-level", "iframe#second-level", "h3"], 42 inspector 43 ); 44 45 is( 46 inspector.selection.nodeFront, 47 reloadedNodeFront, 48 `h3 selected after reload` 49 ); 50 });