Bug 1355126 - regression test for absolute sourceRoot; r=bgrins
authorTom Tromey <tom@tromey.com>
Tue, 30 May 2017 13:08:12 -0600
changeset 361415 657e72f1f725ef85bf9989bf5f5c82b3fec7573b
parent 361414 33f0d0599bb9c611a1f92e2e484b80a1578ea15e
child 361416 c11a042b597c24a2b24e1eab57676dd08aac2c5d
push id31930
push usercbook@mozilla.com
push dateWed, 31 May 2017 09:24:33 +0000
treeherdermozilla-central@23243677c7dd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgrins
bugs1355126
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1355126 - regression test for absolute sourceRoot; r=bgrins MozReview-Commit-ID: EOsAWOr5XWn
.eslintignore
devtools/client/framework/test/browser.ini
devtools/client/framework/test/browser_source_map-absolute.js
devtools/client/framework/test/code_binary_search_absolute.js
devtools/client/framework/test/code_binary_search_absolute.map
--- a/.eslintignore
+++ b/.eslintignore
@@ -160,16 +160,17 @@ devtools/client/sourceeditor/tern/*
 devtools/client/sourceeditor/test/cm_mode_ruby.js
 devtools/client/sourceeditor/test/codemirror/*
 devtools/client/inspector/markup/test/lib_*
 devtools/client/jsonview/lib/require.js
 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*
 devtools/client/debugger/test/mochitest/code_worker-source-map.js
 devtools/client/framework/test/code_ugly*
 devtools/client/inspector/markup/test/events_bundle.js
 devtools/client/netmonitor/test/xhr_bundle.js
 devtools/server/tests/unit/babel_and_browserify_script_with_source_map.js
--- a/devtools/client/framework/test/browser.ini
+++ b/devtools/client/framework/test/browser.ini
@@ -6,16 +6,18 @@ support-files =
   browser_toolbox_options_disable_js_iframe.html
   browser_toolbox_options_disable_cache.sjs
   browser_toolbox_sidebar_tool.xul
   browser_toolbox_window_title_changes_page.html
   browser_toolbox_window_title_frame_select_page.html
   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
   code_bundle_reload_2.js.map
   code_inline_bundle.js
   code_inline_original.js
   code_math.js
   code_reload_1.js
@@ -43,16 +45,17 @@ support-files =
 [browser_dynamic_tool_enabling.js]
 [browser_ignore_toolbox_network_requests.js]
 [browser_keybindings_01.js]
 [browser_keybindings_02.js]
 [browser_keybindings_03.js]
 [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]
 [browser_target_events.js]
 [browser_target_remote.js]
 [browser_target_support.js]
 [browser_toolbox_custom_host.js]
 [browser_toolbox_dynamic_registration.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/framework/test/browser_source_map-absolute.js
@@ -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");
+});
new file mode 100644
--- /dev/null
+++ b/devtools/client/framework/test/code_binary_search_absolute.js
@@ -0,0 +1,29 @@
+// Generated by CoffeeScript 1.6.1
+(function() {
+
+  window.binary_search = function(items, value) {
+    var pivot, start, stop;
+    start = 0;
+    stop = items.length - 1;
+    pivot = Math.floor((start + stop) / 2);
+    while (items[pivot] !== value && start < stop) {
+      if (value < items[pivot]) {
+        stop = pivot - 1;
+      }
+      if (value > items[pivot]) {
+        start = pivot + 1;
+      }
+      pivot = Math.floor((stop + start) / 2);
+    }
+    if (items[pivot] === value) {
+      return pivot;
+    } else {
+      return -1;
+    }
+  };
+
+}).call(this);
+
+/*
+//# sourceMappingURL=code_binary_search_absolute.map
+*/
new file mode 100644
--- /dev/null
+++ b/devtools/client/framework/test/code_binary_search_absolute.map
@@ -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"
+}