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 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | |
michael@0 | 3 | /* |
michael@0 | 4 | * Any copyright is dedicated to the Public Domain. |
michael@0 | 5 | * http://creativecommons.org/licenses/publicdomain/ |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | function obj() { |
michael@0 | 9 | var o = {all: 1, nowrite: 1, noconfig: 1, noble: 1}; |
michael@0 | 10 | Object.defineProperty(o, 'nowrite', {writable: false}); |
michael@0 | 11 | Object.defineProperty(o, 'noconfig', {configurable: false}); |
michael@0 | 12 | Object.defineProperty(o, 'noble', {writable: false, configurable: false}); |
michael@0 | 13 | return o; |
michael@0 | 14 | } |
michael@0 | 15 | |
michael@0 | 16 | assertEq(testLenientAndStrict('var o = obj(); o.all = 2; o.all', |
michael@0 | 17 | returns(2), returns(2)), |
michael@0 | 18 | true); |
michael@0 | 19 | |
michael@0 | 20 | assertEq(testLenientAndStrict('var o = obj(); o.nowrite = 2; o.nowrite', |
michael@0 | 21 | returns(1), raisesException(TypeError)), |
michael@0 | 22 | true); |
michael@0 | 23 | |
michael@0 | 24 | assertEq(testLenientAndStrict('var o = obj(); o.noconfig = 2; o.noconfig', |
michael@0 | 25 | returns(2), returns(2)), |
michael@0 | 26 | true); |
michael@0 | 27 | |
michael@0 | 28 | assertEq(testLenientAndStrict('var o = obj(); o.noble = 2; o.noble', |
michael@0 | 29 | returns(1), raisesException(TypeError)), |
michael@0 | 30 | true); |
michael@0 | 31 | |
michael@0 | 32 | assertEq(testLenientAndStrict('obj().nowrite++', |
michael@0 | 33 | returns(1), raisesException(TypeError)), |
michael@0 | 34 | true); |
michael@0 | 35 | assertEq(testLenientAndStrict('++obj().nowrite', |
michael@0 | 36 | returns(2), raisesException(TypeError)), |
michael@0 | 37 | true); |
michael@0 | 38 | assertEq(testLenientAndStrict('obj().nowrite--', |
michael@0 | 39 | returns(1), raisesException(TypeError)), |
michael@0 | 40 | true); |
michael@0 | 41 | assertEq(testLenientAndStrict('--obj().nowrite', |
michael@0 | 42 | returns(0), raisesException(TypeError)), |
michael@0 | 43 | true); |
michael@0 | 44 | |
michael@0 | 45 | |
michael@0 | 46 | function arr() { |
michael@0 | 47 | return Object.defineProperties([1, 1, 1, 1], |
michael@0 | 48 | { 1: { writable: false }, |
michael@0 | 49 | 2: { configurable: false }, |
michael@0 | 50 | 3: { writable: false, configurable: false }}); |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | assertEq(testLenientAndStrict('var a = arr(); a[0] = 2; a[0]', |
michael@0 | 54 | returns(2), returns(2)), |
michael@0 | 55 | true); |
michael@0 | 56 | |
michael@0 | 57 | assertEq(testLenientAndStrict('var a = arr(); a[1] = 2; a[1]', |
michael@0 | 58 | returns(1), raisesException(TypeError)), |
michael@0 | 59 | true); |
michael@0 | 60 | |
michael@0 | 61 | assertEq(testLenientAndStrict('var a = arr(); a[2] = 2; a[2]', |
michael@0 | 62 | returns(2), returns(2)), |
michael@0 | 63 | true); |
michael@0 | 64 | |
michael@0 | 65 | assertEq(testLenientAndStrict('var a = arr(); a[3] = 2; a[3]', |
michael@0 | 66 | returns(1), raisesException(TypeError)), |
michael@0 | 67 | true); |
michael@0 | 68 | |
michael@0 | 69 | assertEq(testLenientAndStrict('arr()[1]++', |
michael@0 | 70 | returns(1), raisesException(TypeError)), |
michael@0 | 71 | true); |
michael@0 | 72 | assertEq(testLenientAndStrict('++arr()[1]', |
michael@0 | 73 | returns(2), raisesException(TypeError)), |
michael@0 | 74 | true); |
michael@0 | 75 | assertEq(testLenientAndStrict('arr()[1]--', |
michael@0 | 76 | returns(1), raisesException(TypeError)), |
michael@0 | 77 | true); |
michael@0 | 78 | assertEq(testLenientAndStrict('--arr()[1]', |
michael@0 | 79 | returns(0), raisesException(TypeError)), |
michael@0 | 80 | true); |
michael@0 | 81 | |
michael@0 | 82 | reportCompare(true, true); |