browser_source_map-no-race.js (1142B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 // Test that the source map service doesn't race against source 5 // reporting. 6 7 "use strict"; 8 9 const JS_URL = URL_ROOT + "code_bundle_no_race.js"; 10 11 const PAGE_URL = `data:text/html, 12 <!doctype html> 13 14 <html> 15 <head> 16 <meta charset="utf-8"/> 17 <title>Empty test page to test race case</title> 18 </head> 19 20 <body> 21 <script src="${JS_URL}"></script> 22 </body> 23 24 </html>`; 25 26 const ORIGINAL_URL = "webpack:///code_no_race.js"; 27 28 const GENERATED_LINE = 84; 29 const ORIGINAL_LINE = 11; 30 31 add_task(async function () { 32 // Start with the empty page, then navigate, so that we can properly 33 // listen for new sources arriving. 34 const toolbox = await openNewTabAndToolbox(PAGE_URL, "webconsole"); 35 const service = toolbox.sourceMapURLService; 36 37 info(`checking original location for ${JS_URL}:${GENERATED_LINE}`); 38 const newLoc = await new Promise(r => 39 service.subscribeByURL(JS_URL, GENERATED_LINE, undefined, r) 40 ); 41 is(newLoc.url, ORIGINAL_URL, "check mapped URL"); 42 is(newLoc.line, ORIGINAL_LINE, "check mapped line number"); 43 });