michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /** michael@0: * Regression test for bug 882986 regarding sourcesContent and absolute source michael@0: * URLs. michael@0: */ michael@0: michael@0: var gDebuggee; michael@0: var gClient; michael@0: var gThreadClient; michael@0: michael@0: Components.utils.import("resource:///modules/devtools/SourceMap.jsm"); michael@0: michael@0: function run_test() michael@0: { michael@0: initTestDebuggerServer(); michael@0: gDebuggee = addTestGlobal("test-source-map"); michael@0: gClient = new DebuggerClient(DebuggerServer.connectPipe()); michael@0: gClient.connect(function() { michael@0: attachTestTabAndResume(gClient, "test-source-map", function(aResponse, aTabClient, aThreadClient) { michael@0: gThreadClient = aThreadClient; michael@0: test_source_maps(); michael@0: }); michael@0: }); michael@0: do_test_pending(); michael@0: } michael@0: michael@0: function test_source_maps() michael@0: { michael@0: gClient.addOneTimeListener("newSource", function (aEvent, aPacket) { michael@0: let sourceClient = gThreadClient.source(aPacket.source); michael@0: sourceClient.source(function ({error, source}) { michael@0: do_check_true(!error, "should be able to grab the source"); michael@0: do_check_eq(source, "foo", michael@0: "Should load the source from the sourcesContent field"); michael@0: finishClient(gClient); michael@0: }); michael@0: }); michael@0: michael@0: let code = "'nothing here';\n"; michael@0: code += "//# sourceMappingURL=data:text/json," + JSON.stringify({ michael@0: version: 3, michael@0: file: "foo.js", michael@0: sources: ["/a"], michael@0: names: [], michael@0: mappings: "AACA", michael@0: sourcesContent: ["foo"] michael@0: }); michael@0: Components.utils.evalInSandbox(code, gDebuggee, "1.8", michael@0: "http://example.com/foo.js", 1); michael@0: }