browser_source_map-cross-domain.js (1066B)
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 can fetch a source map from a 5 // different domain. 6 7 "use strict"; 8 9 const JS_URL = URL_ROOT + "code_bundle_cross_domain.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 cross domain source map</title> 18 </head> 19 20 <body> 21 <script src="${JS_URL}"></script> 22 </body> 23 24 </html>`; 25 26 const ORIGINAL_URL = "webpack:///code_cross_domain.js"; 27 28 const GENERATED_LINE = 82; 29 const ORIGINAL_LINE = 12; 30 31 add_task(async function () { 32 const toolbox = await openNewTabAndToolbox(PAGE_URL, "webconsole"); 33 const service = toolbox.sourceMapURLService; 34 35 info(`checking original location for ${JS_URL}:${GENERATED_LINE}`); 36 const newLoc = await new Promise(r => 37 service.subscribeByURL(JS_URL, GENERATED_LINE, undefined, r) 38 ); 39 is(newLoc.url, ORIGINAL_URL, "check mapped URL"); 40 is(newLoc.line, ORIGINAL_LINE, "check mapped line number"); 41 });