summaryrefslogtreecommitdiffstats
path: root/devtools/server/tests/unit/test_sourcemaps-17.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /devtools/server/tests/unit/test_sourcemaps-17.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/server/tests/unit/test_sourcemaps-17.js')
-rw-r--r--devtools/server/tests/unit/test_sourcemaps-17.js63
1 files changed, 63 insertions, 0 deletions
diff --git a/devtools/server/tests/unit/test_sourcemaps-17.js b/devtools/server/tests/unit/test_sourcemaps-17.js
new file mode 100644
index 000000000..85da95972
--- /dev/null
+++ b/devtools/server/tests/unit/test_sourcemaps-17.js
@@ -0,0 +1,63 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/**
+ * Check that we properly handle frames that cannot be sourcemapped
+ * when using sourcemaps.
+ */
+
+var gDebuggee;
+var gClient;
+var gThreadClient;
+
+const {SourceNode} = require("source-map");
+
+function run_test() {
+ initTestDebuggerServer();
+ gDebuggee = addTestGlobal("test-source-map");
+ gClient = new DebuggerClient(DebuggerServer.connectPipe());
+ gClient.connect().then(function () {
+ attachTestTabAndResume(gClient, "test-source-map", function (aResponse, aTabClient, aThreadClient) {
+ gThreadClient = aThreadClient;
+ test_source_map();
+ });
+ });
+ do_test_pending();
+}
+
+function test_source_map() {
+ // Set up debuggee code.
+ const a = new SourceNode(1, 1, "a.js", "function a() { b(); }");
+ const b = new SourceNode(null, null, null, "function b() { c(); }");
+ const c = new SourceNode(1, 1, "c.js", "function c() { d(); }");
+ const d = new SourceNode(null, null, null, "function d() { e(); }");
+ const e = new SourceNode(1, 1, "e.js", "function e() { debugger; }");
+ const { map, code } = (new SourceNode(null, null, null, [a, b, c, d, e])).toStringWithSourceMap({
+ file: "root.js",
+ sourceRoot: "root",
+ });
+ Components.utils.evalInSandbox(
+ code + "//# sourceMappingURL=data:text/json;base64," + btoa(map.toString()),
+ gDebuggee,
+ "1.8",
+ "http://example.com/www/js/abc.js",
+ 1
+ );
+
+ gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
+ gThreadClient.getFrames(0, 50, function ({ error, frames }) {
+ do_check_true(!error);
+ do_check_eq(frames.length, 4);
+ // b.js should be skipped
+ do_check_eq(frames[0].where.source.url, "http://example.com/www/root/e.js");
+ do_check_eq(frames[1].where.source.url, "http://example.com/www/root/c.js");
+ do_check_eq(frames[2].where.source.url, "http://example.com/www/root/a.js");
+ do_check_eq(frames[3].where.source.url, null);
+
+ finishClient(gClient);
+ });
+ });
+
+ // Trigger it.
+ gDebuggee.eval("a()");
+}