toolkit/devtools/sourcemap/tests/unit/test_dog_fooding.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 /*
     2  * WARNING!
     3  *
     4  * Do not edit this file directly, it is built from the sources at
     5  * https://github.com/mozilla/source-map/
     6  */
     8 Components.utils.import('resource://test/Utils.jsm');
     9 /* -*- Mode: js; js-indent-level: 2; -*- */
    10 /*
    11  * Copyright 2011 Mozilla Foundation and contributors
    12  * Licensed under the New BSD license. See LICENSE or:
    13  * http://opensource.org/licenses/BSD-3-Clause
    14  */
    15 define("test/source-map/test-dog-fooding", ["require", "exports", "module"], function (require, exports, module) {
    17   var SourceMapConsumer = require('source-map/source-map-consumer').SourceMapConsumer;
    18   var SourceMapGenerator = require('source-map/source-map-generator').SourceMapGenerator;
    20   exports['test eating our own dog food'] = function (assert, util) {
    21     var smg = new SourceMapGenerator({
    22       file: 'testing.js',
    23       sourceRoot: '/wu/tang'
    24     });
    26     smg.addMapping({
    27       source: 'gza.coffee',
    28       original: { line: 1, column: 0 },
    29       generated: { line: 2, column: 2 }
    30     });
    32     smg.addMapping({
    33       source: 'gza.coffee',
    34       original: { line: 2, column: 0 },
    35       generated: { line: 3, column: 2 }
    36     });
    38     smg.addMapping({
    39       source: 'gza.coffee',
    40       original: { line: 3, column: 0 },
    41       generated: { line: 4, column: 2 }
    42     });
    44     smg.addMapping({
    45       source: 'gza.coffee',
    46       original: { line: 4, column: 0 },
    47       generated: { line: 5, column: 2 }
    48     });
    50     var smc = new SourceMapConsumer(smg.toString());
    52     // Exact
    53     util.assertMapping(2, 2, '/wu/tang/gza.coffee', 1, 0, null, smc, assert);
    54     util.assertMapping(3, 2, '/wu/tang/gza.coffee', 2, 0, null, smc, assert);
    55     util.assertMapping(4, 2, '/wu/tang/gza.coffee', 3, 0, null, smc, assert);
    56     util.assertMapping(5, 2, '/wu/tang/gza.coffee', 4, 0, null, smc, assert);
    58     // Fuzzy
    60     // Original to generated
    61     util.assertMapping(2, 0, null, null, null, null, smc, assert, true);
    62     util.assertMapping(2, 9, '/wu/tang/gza.coffee', 1, 0, null, smc, assert, true);
    63     util.assertMapping(3, 0, '/wu/tang/gza.coffee', 1, 0, null, smc, assert, true);
    64     util.assertMapping(3, 9, '/wu/tang/gza.coffee', 2, 0, null, smc, assert, true);
    65     util.assertMapping(4, 0, '/wu/tang/gza.coffee', 2, 0, null, smc, assert, true);
    66     util.assertMapping(4, 9, '/wu/tang/gza.coffee', 3, 0, null, smc, assert, true);
    67     util.assertMapping(5, 0, '/wu/tang/gza.coffee', 3, 0, null, smc, assert, true);
    68     util.assertMapping(5, 9, '/wu/tang/gza.coffee', 4, 0, null, smc, assert, true);
    70     // Generated to original
    71     util.assertMapping(2, 2, '/wu/tang/gza.coffee', 1, 1, null, smc, assert, null, true);
    72     util.assertMapping(3, 2, '/wu/tang/gza.coffee', 2, 3, null, smc, assert, null, true);
    73     util.assertMapping(4, 2, '/wu/tang/gza.coffee', 3, 6, null, smc, assert, null, true);
    74     util.assertMapping(5, 2, '/wu/tang/gza.coffee', 4, 9, null, smc, assert, null, true);
    75   };
    77 });
    78 function run_test() {
    79   runSourceMapTests('test/source-map/test-dog-fooding', do_throw);
    80 }

mercurial