tor-browser

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

browser_source_map-inline.js (1425B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 // Test that inline source maps work.
      5 
      6 "use strict";
      7 
      8 // There are shutdown issues for which multiple rejections are left uncaught.
      9 // See bug 1018184 for resolving these issues.
     10 const { PromiseTestUtils } = ChromeUtils.importESModule(
     11  "resource://testing-common/PromiseTestUtils.sys.mjs"
     12 );
     13 PromiseTestUtils.allowMatchingRejectionsGlobally(/this\.worker is null/);
     14 PromiseTestUtils.allowMatchingRejectionsGlobally(/Component not initialized/);
     15 
     16 const TEST_ROOT = "https://example.com/browser/devtools/client/framework/test/";
     17 // Empty page
     18 const PAGE_URL = `${TEST_ROOT}doc_empty-tab-01.html`;
     19 const JS_URL = `${TEST_ROOT}code_inline_bundle.js`;
     20 const ORIGINAL_URL = "webpack:///code_inline_original.js";
     21 
     22 add_task(async function () {
     23  const toolbox = await openNewTabAndToolbox(PAGE_URL, "jsdebugger");
     24  const service = toolbox.sourceMapURLService;
     25 
     26  // Inject JS script
     27  const sourceSeen = waitForSourceLoad(toolbox, JS_URL);
     28  await createScript(JS_URL);
     29  await sourceSeen;
     30 
     31  info(`checking original location for ${JS_URL}:84`);
     32  const newLoc = await new Promise(r =>
     33    service.subscribeByURL(JS_URL, 84, undefined, r)
     34  );
     35 
     36  is(newLoc.url, ORIGINAL_URL, "check mapped URL");
     37  is(newLoc.line, 11, "check mapped line number");
     38 
     39  await toolbox.destroy();
     40  gBrowser.removeCurrentTab();
     41  finish();
     42 });