tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_dbg-iframes.js (1838B)


      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 // Test is taking too much time to complete on some hardware since
      6 // release at https://bugzilla.mozilla.org/show_bug.cgi?id=1423158
      7 
      8 "use strict";
      9 
     10 requestLongerTimeout(3);
     11 
     12 /**
     13 * Test debugging a page with iframes
     14 *  1. pause in the main thread
     15 *  2. pause in the iframe
     16 */
     17 add_task(async function () {
     18  const dbg = await initDebugger("doc-iframes.html");
     19 
     20  // test pausing in the main thread
     21  const onReloaded = reload(dbg);
     22  await waitForPaused(dbg);
     23  await waitForLoadedSource(dbg, "doc-iframes.html");
     24  await assertPausedAtSourceAndLine(
     25    dbg,
     26    findSource(dbg, "doc-iframes.html").id,
     27    11
     28  );
     29 
     30  // test pausing in the iframe
     31  await resume(dbg);
     32  await waitForPaused(dbg);
     33  await waitForLoadedSource(dbg, "doc-debugger-statements.html");
     34  await assertPausedAtSourceAndLine(
     35    dbg,
     36    findSource(dbg, "doc-debugger-statements.html").id,
     37    11
     38  );
     39 
     40  // test pausing in the iframe
     41  await resume(dbg);
     42  await waitForPaused(dbg);
     43  await assertPausedAtSourceAndLine(
     44    dbg,
     45    findSource(dbg, "doc-debugger-statements.html").id,
     46    16
     47  );
     48  await waitFor(() => dbg.toolbox.isHighlighted("jsdebugger"));
     49  ok(true, "Debugger is highlighted when paused");
     50 
     51  info("Remove the iframe and wait for resume");
     52  await SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => {
     53    const iframe = content.document.querySelector("iframe");
     54    iframe.remove();
     55  });
     56  await waitForResumed(dbg);
     57  await waitFor(() => !dbg.toolbox.isHighlighted("jsdebugger"));
     58  ok(true, "Debugger is no longer highlighted when resumed");
     59 
     60  info("Wait for reload to complete after resume");
     61  await onReloaded;
     62 });