From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../debugger/test/mochitest/browser_dbg-iframes.js | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 devtools/client/debugger/test/mochitest/browser_dbg-iframes.js (limited to 'devtools/client/debugger/test/mochitest/browser_dbg-iframes.js') diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-iframes.js b/devtools/client/debugger/test/mochitest/browser_dbg-iframes.js new file mode 100644 index 0000000000..0bcc0e020f --- /dev/null +++ b/devtools/client/debugger/test/mochitest/browser_dbg-iframes.js @@ -0,0 +1,60 @@ +/* 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 + * file, You can obtain one at . */ + +// Test is taking too much time to complete on some hardware since +// release at https://bugzilla.mozilla.org/show_bug.cgi?id=1423158 + +"use strict"; + +requestLongerTimeout(3); + +/** + * Test debugging a page with iframes + * 1. pause in the main thread + * 2. pause in the iframe + */ +add_task(async function () { + const dbg = await initDebugger("doc-iframes.html"); + + // test pausing in the main thread + const onReloaded = reload(dbg); + await waitForPaused(dbg); + await waitForLoadedSource(dbg, "doc-iframes.html"); + assertPausedAtSourceAndLine(dbg, findSource(dbg, "doc-iframes.html").id, 11); + + // test pausing in the iframe + await resume(dbg); + await waitForPaused(dbg); + await waitForLoadedSource(dbg, "doc-debugger-statements.html"); + assertPausedAtSourceAndLine( + dbg, + findSource(dbg, "doc-debugger-statements.html").id, + 11 + ); + + // test pausing in the iframe + await resume(dbg); + await waitForPaused(dbg); + assertPausedAtSourceAndLine( + dbg, + findSource(dbg, "doc-debugger-statements.html").id, + 16 + ); + await waitFor(() => dbg.toolbox.isHighlighted("jsdebugger")); + ok(true, "Debugger is highlighted when paused"); + + if (isFissionEnabled() || isEveryFrameTargetEnabled()) { + info("Remove the iframe and wait for resume"); + await SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => { + const iframe = content.document.querySelector("iframe"); + iframe.remove(); + }); + await waitForResumed(dbg); + await waitFor(() => !dbg.toolbox.isHighlighted("jsdebugger")); + ok(true, "Debugger is no longer highlighted when resumed"); + + info("Wait for reload to complete after resume"); + await onReloaded; + } +}); -- cgit v1.2.3