tor-browser

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

browser_source_map-absolute.js (1209B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 // Test that an absolute sourceRoot works.
      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 
     15 // Empty page
     16 const PAGE_URL = `${URL_ROOT_SSL}doc_empty-tab-01.html`;
     17 const JS_URL = `${URL_ROOT_SSL}code_binary_search_absolute.js`;
     18 const ORIGINAL_URL = `${URL_ROOT_SSL}code_binary_search.coffee`;
     19 
     20 add_task(async function () {
     21  const toolbox = await openNewTabAndToolbox(PAGE_URL, "jsdebugger");
     22  const service = toolbox.sourceMapURLService;
     23 
     24  // Inject JS script
     25  const sourceSeen = waitForSourceLoad(toolbox, JS_URL);
     26  await createScript(JS_URL);
     27  await sourceSeen;
     28 
     29  info(`checking original location for ${JS_URL}:6`);
     30  const newLoc = await new Promise(r =>
     31    service.subscribeByURL(JS_URL, 6, 4, r)
     32  );
     33 
     34  is(newLoc.url, ORIGINAL_URL, "check mapped URL");
     35  is(newLoc.line, 4, "check mapped line number");
     36 });