toolkit/devtools/server/tests/unit/test_sourcemaps-08.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.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 /**
     5  * Regression test for bug 882986 regarding sourcesContent and absolute source
     6  * URLs.
     7  */
     9 var gDebuggee;
    10 var gClient;
    11 var gThreadClient;
    13 Components.utils.import("resource:///modules/devtools/SourceMap.jsm");
    15 function run_test()
    16 {
    17   initTestDebuggerServer();
    18   gDebuggee = addTestGlobal("test-source-map");
    19   gClient = new DebuggerClient(DebuggerServer.connectPipe());
    20   gClient.connect(function() {
    21     attachTestTabAndResume(gClient, "test-source-map", function(aResponse, aTabClient, aThreadClient) {
    22       gThreadClient = aThreadClient;
    23       test_source_maps();
    24     });
    25   });
    26   do_test_pending();
    27 }
    29 function test_source_maps()
    30 {
    31   gClient.addOneTimeListener("newSource", function (aEvent, aPacket) {
    32     let sourceClient = gThreadClient.source(aPacket.source);
    33     sourceClient.source(function ({error, source}) {
    34       do_check_true(!error, "should be able to grab the source");
    35       do_check_eq(source, "foo",
    36                   "Should load the source from the sourcesContent field");
    37       finishClient(gClient);
    38     });
    39   });
    41   let code = "'nothing here';\n";
    42   code += "//# sourceMappingURL=data:text/json," + JSON.stringify({
    43     version: 3,
    44     file: "foo.js",
    45     sources: ["/a"],
    46     names: [],
    47     mappings: "AACA",
    48     sourcesContent: ["foo"]
    49   });
    50   Components.utils.evalInSandbox(code, gDebuggee, "1.8",
    51                                  "http://example.com/foo.js", 1);
    52 }

mercurial