browser_dbg-paused-overlay-iframe.js (2276B)
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 // Tests the paused overlay in a remote frame 6 7 "use strict"; 8 9 const TEST_COM_URI = `${URL_ROOT_COM_SSL}examples/doc_dbg-fission-frame-sources.html`; 10 11 add_task(async function () { 12 info("Load a test page with a remote frame"); 13 // simple1.js is imported by the main page. simple2.js comes from the remote frame. 14 const dbg = await initDebuggerWithAbsoluteURL( 15 TEST_COM_URI, 16 "simple1.js", 17 "simple2.js" 18 ); 19 const { 20 selectors: { getSelectedSource }, 21 commands, 22 } = dbg; 23 24 info("Add breakpoint within the iframe, in `foo` function"); 25 await selectSource(dbg, "simple2.js"); 26 await addBreakpoint(dbg, "simple2.js", 5); 27 28 info("Call `foo` in the iframe"); 29 SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => { 30 const iframe = content.document.querySelector("iframe"); 31 SpecialPowers.spawn(iframe, [], () => { 32 return content.wrappedJSObject.foo(); 33 }); 34 }); 35 await waitForPaused(dbg); 36 ok(true, "debugger is paused"); 37 38 // We need to retrieve the highlighterTestFront for the frame target. 39 const iframeTarget = commands.targetCommand 40 .getAllTargets([commands.targetCommand.TYPES.FRAME]) 41 .find(target => target.url.includes("example.org")); 42 const highlighterTestFront = await iframeTarget.getFront("highlighterTest"); 43 44 info("Check that the paused overlay is displayed"); 45 await waitFor(() => highlighterTestFront.isPausedDebuggerOverlayVisible()); 46 ok(true, "Paused debugger overlay is visible"); 47 48 ok( 49 getSelectedSource().url.includes("simple2.js"), 50 "Selected source is simple2.js" 51 ); 52 await assertPausedAtSourceAndLine(dbg, findSource(dbg, "simple2.js").id, 5); 53 54 info("Test clicking the resume button"); 55 await highlighterTestFront.clickPausedDebuggerOverlayButton( 56 "paused-dbg-resume-button" 57 ); 58 59 await waitForResumed(dbg); 60 ok("The debugger isn't paused after clicking on the resume button"); 61 62 await waitFor(async () => { 63 const visible = await highlighterTestFront.isPausedDebuggerOverlayVisible(); 64 return !visible; 65 }); 66 67 ok(true, "The overlay is now hidden"); 68 });