toolkit/devtools/server/tests/unit/test_sourcemaps-04.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 /**
michael@0 5 * Check that absolute source map urls work.
michael@0 6 */
michael@0 7
michael@0 8 var gDebuggee;
michael@0 9 var gClient;
michael@0 10 var gThreadClient;
michael@0 11
michael@0 12 Components.utils.import('resource:///modules/devtools/SourceMap.jsm');
michael@0 13
michael@0 14 // Deep in the complicated labyrinth of code that this test invokes, beneath
michael@0 15 // debugger callbacks, sandboxes and nested event loops, lies an exception.
michael@0 16 // This exception lay sleeping since the dawn of time, held captive in a
michael@0 17 // delicate balance of custom xpcshell error reporters and garbage data about
michael@0 18 // the XPCCallContext stack. But bholley dug too greedily, and too deep, and
michael@0 19 // awoke shadow and flame in the darkness of nsExternalHelperAppService.cpp.
michael@0 20 // We must now trust in deep magic to ensure that it does not awaken again.
michael@0 21 ignoreReportedErrors(true);
michael@0 22
michael@0 23 function run_test()
michael@0 24 {
michael@0 25 initTestDebuggerServer();
michael@0 26 gDebuggee = addTestGlobal("test-source-map");
michael@0 27 gClient = new DebuggerClient(DebuggerServer.connectPipe());
michael@0 28 gClient.connect(function() {
michael@0 29 attachTestTabAndResume(gClient, "test-source-map", function(aResponse, aTabClient, aThreadClient) {
michael@0 30 gThreadClient = aThreadClient;
michael@0 31 test_absolute_source_map();
michael@0 32 });
michael@0 33 });
michael@0 34 do_test_pending();
michael@0 35 }
michael@0 36
michael@0 37 function test_absolute_source_map()
michael@0 38 {
michael@0 39 gClient.addOneTimeListener("newSource", function _onNewSource(aEvent, aPacket) {
michael@0 40 do_check_eq(aEvent, "newSource");
michael@0 41 do_check_eq(aPacket.type, "newSource");
michael@0 42 do_check_true(!!aPacket.source);
michael@0 43
michael@0 44 do_check_true(aPacket.source.url.indexOf("sourcemapped.coffee") !== -1,
michael@0 45 "The new source should be a coffee file.");
michael@0 46 do_check_eq(aPacket.source.url.indexOf("sourcemapped.js"), -1,
michael@0 47 "The new source should not be a js file.");
michael@0 48
michael@0 49 finishClient(gClient);
michael@0 50 });
michael@0 51
michael@0 52 code = readFile("sourcemapped.js")
michael@0 53 + "\n//# sourceMappingURL=" + getFileUrl("source-map-data/sourcemapped.map");
michael@0 54
michael@0 55 Components.utils.evalInSandbox(code, gDebuggee, "1.8",
michael@0 56 getFileUrl("sourcemapped.js"), 1);
michael@0 57 }

mercurial