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