tor-browser

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

browser_toolbox_view_source_02.js (1244B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 /**
      5 * Tests that Toolbox#viewSourceInDebugger works when debugger is already loaded.
      6 */
      7 
      8 var URL = `${URL_ROOT_SSL}doc_viewsource.html`;
      9 var JS_URL = `${URL_ROOT_SSL}code_math.js`;
     10 
     11 async function viewSource() {
     12  const toolbox = await openNewTabAndToolbox(URL);
     13  await toolbox.selectTool("jsdebugger");
     14 
     15  await toolbox.viewSourceInDebugger(JS_URL, 2);
     16 
     17  const debuggerPanel = toolbox.getPanel("jsdebugger");
     18  ok(debuggerPanel, "The debugger panel was opened.");
     19  is(toolbox.currentToolId, "jsdebugger", "The debugger panel was selected.");
     20 
     21  assertSelectedLocationInDebugger(debuggerPanel, 2, undefined);
     22 
     23  // See Bug 1637793 and Bug 1621337.
     24  // Ideally the debugger should only resolve when the worker targets have been
     25  // retrieved, which should be fixed by Bug 1621337 or a followup.
     26  info("Wait for all pending requests to settle on the DevToolsClient");
     27  await toolbox.commands.client.waitForRequestsToSettle();
     28 
     29  await closeToolboxAndTab(toolbox);
     30  finish();
     31 }
     32 
     33 function test() {
     34  viewSource().then(finish, error => {
     35    ok(false, "Got an error: " + error.message + "\n" + error.stack);
     36    finish();
     37  });
     38 }