Skip to content

Commit

Permalink
Bug 1355126 - regression test for absolute sourceRoot; r=bgrins
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: EOsAWOr5XWn
  • Loading branch information
tromey committed May 30, 2017
1 parent bb179d5 commit 0f5deed
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 0 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ devtools/server/actors/utils/automation-timeline.js

# Ignore devtools files testing sourcemaps / code style
devtools/client/debugger/test/mochitest/code_binary_search.js
devtools/client/debugger/test/mochitest/code_binary_search_absolute.js
devtools/client/debugger/test/mochitest/code_math.min.js
devtools/client/debugger/test/mochitest/code_math_bogus_map.js
devtools/client/debugger/test/mochitest/code_ugly*
Expand Down
3 changes: 3 additions & 0 deletions devtools/client/framework/test/browser.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ support-files =
code_binary_search.coffee
code_binary_search.js
code_binary_search.map
code_binary_search_absolute.js
code_binary_search_absolute.map
code_bundle_reload_1.js
code_bundle_reload_1.js.map
code_bundle_reload_2.js
Expand Down Expand Up @@ -48,6 +50,7 @@ support-files =
[browser_menu_api.js]
[browser_new_activation_workflow.js]
[browser_source_map-01.js]
[browser_source_map-absolute.js]
[browser_source_map-inline.js]
[browser_source_map-reload.js]
[browser_target_from_url.js]
Expand Down
29 changes: 29 additions & 0 deletions devtools/client/framework/test/browser_source_map-absolute.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */

// Test that an absolute sourceRoot works.

"use strict";

// Empty page
const PAGE_URL = `${URL_ROOT}doc_empty-tab-01.html`;
const JS_URL = `${URL_ROOT}code_binary_search_absolute.js`;
const ORIGINAL_URL = `${URL_ROOT}code_binary_search.coffee`;

add_task(function* () {
yield pushPref("devtools.debugger.new-debugger-frontend", true);

const toolbox = yield openNewTabAndToolbox(PAGE_URL, "jsdebugger");
const service = toolbox.sourceMapURLService;

// Inject JS script
let sourceSeen = waitForSourceLoad(toolbox, JS_URL);
yield createScript(JS_URL);
yield sourceSeen;

info(`checking original location for ${JS_URL}:6`);
let newLoc = yield service.originalPositionFor(JS_URL, 6);

is(newLoc.sourceUrl, ORIGINAL_URL, "check mapped URL");
is(newLoc.line, 4, "check mapped line number");
});
29 changes: 29 additions & 0 deletions devtools/client/framework/test/code_binary_search_absolute.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions devtools/client/framework/test/code_binary_search_absolute.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"version": 3,
"file": "code_binary_search.js",
"sourceRoot": "http://example.com/browser/devtools/client/framework/test/",
"sources": [
"code_binary_search.coffee"
],
"names": [],
"mappings": ";AACA;CAAA;CAAA,CAAA,CAAuB,EAAA,CAAjB,GAAkB,IAAxB;CAEE,OAAA,UAAA;CAAA,EAAQ,CAAR,CAAA;CAAA,EACQ,CAAR,CAAa,CAAL;CADR,EAEQ,CAAR,CAAA;CAEA,EAA0C,CAAR,CAAtB,MAAN;CAGJ,EAA6B,CAAR,CAAA,CAArB;CAAA,EAAQ,CAAR,CAAQ,GAAR;QAAA;CACA,EAA6B,CAAR,CAAA,CAArB;CAAA,EAAQ,EAAR,GAAA;QADA;CAAA,EAIQ,CAAI,CAAZ,CAAA;CAXF,IAIA;CAUA,GAAA,CAAS;CAAT,YAA8B;MAA9B;AAA0C,CAAD,YAAA;MAhBpB;CAAvB,EAAuB;CAAvB"
}

0 comments on commit 0f5deed

Please sign in to comment.