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 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | /* |
michael@0 | 7 | * |
michael@0 | 8 | * Date: 10 February 2003 |
michael@0 | 9 | * SUMMARY: Object.toSource() recursion should check stack overflow |
michael@0 | 10 | * |
michael@0 | 11 | * See http://bugzilla.mozilla.org/show_bug.cgi?id=192465 |
michael@0 | 12 | * |
michael@0 | 13 | * MODIFIED: 27 February 2003 |
michael@0 | 14 | * |
michael@0 | 15 | * We are adding an early return to this testcase, since it is causing |
michael@0 | 16 | * big problems on Linux RedHat8! For a discussion of this issue, see |
michael@0 | 17 | * http://bugzilla.mozilla.org/show_bug.cgi?id=174341#c24 and following. |
michael@0 | 18 | * |
michael@0 | 19 | * |
michael@0 | 20 | * MODIFIED: 20 March 2003 |
michael@0 | 21 | * |
michael@0 | 22 | * Removed the early return and changed |N| below from 1000 to 90. |
michael@0 | 23 | * Note |make_deep_nest(N)| returns an object graph of length N(N+1). |
michael@0 | 24 | * So the graph has now been reduced from 1,001,000 to 8190. |
michael@0 | 25 | * |
michael@0 | 26 | * With this reduction, the bug still manifests on my WinNT and Linux |
michael@0 | 27 | * boxes (crash due to stack overflow). So the testcase is again of use |
michael@0 | 28 | * on those boxes. At the same time, Linux RedHat8 boxes can now run |
michael@0 | 29 | * the test in a reasonable amount of time. |
michael@0 | 30 | */ |
michael@0 | 31 | //----------------------------------------------------------------------------- |
michael@0 | 32 | var UBound = 0; |
michael@0 | 33 | var BUGNUMBER = 192465; |
michael@0 | 34 | var summary = 'Object.toSource() recursion should check stack overflow'; |
michael@0 | 35 | var status = ''; |
michael@0 | 36 | var statusitems = []; |
michael@0 | 37 | var actual = ''; |
michael@0 | 38 | var actualvalues = []; |
michael@0 | 39 | var expect= ''; |
michael@0 | 40 | var expectedvalues = []; |
michael@0 | 41 | |
michael@0 | 42 | |
michael@0 | 43 | /* |
michael@0 | 44 | * We're just testing that this script will compile and run. |
michael@0 | 45 | * Set both |actual| and |expect| to a dummy value. |
michael@0 | 46 | */ |
michael@0 | 47 | status = inSection(1); |
michael@0 | 48 | var N = 90; |
michael@0 | 49 | try |
michael@0 | 50 | { |
michael@0 | 51 | make_deep_nest(N); |
michael@0 | 52 | } |
michael@0 | 53 | catch (e) |
michael@0 | 54 | { |
michael@0 | 55 | // An exception is OK, as the runtime can throw one in response to too deep |
michael@0 | 56 | // recursion. We haven't crashed; good! Continue on to set the dummy values - |
michael@0 | 57 | } |
michael@0 | 58 | actual = 1; |
michael@0 | 59 | expect = 1; |
michael@0 | 60 | addThis(); |
michael@0 | 61 | |
michael@0 | 62 | |
michael@0 | 63 | |
michael@0 | 64 | //----------------------------------------------------------------------------- |
michael@0 | 65 | test(); |
michael@0 | 66 | //----------------------------------------------------------------------------- |
michael@0 | 67 | |
michael@0 | 68 | |
michael@0 | 69 | /* |
michael@0 | 70 | * EXAMPLE: |
michael@0 | 71 | * |
michael@0 | 72 | * If the global variable |N| is 2, then for |level| == 0, 1, 2, the return |
michael@0 | 73 | * value of this function will be toSource() of these objects, respectively: |
michael@0 | 74 | * |
michael@0 | 75 | * {next:{next:END}} |
michael@0 | 76 | * {next:{next:{next:{next:END}}}} |
michael@0 | 77 | * {next:{next:{next:{next:{next:{next:END}}}}}} |
michael@0 | 78 | * |
michael@0 | 79 | */ |
michael@0 | 80 | function make_deep_nest(level) |
michael@0 | 81 | { |
michael@0 | 82 | var head = {}; |
michael@0 | 83 | var cursor = head; |
michael@0 | 84 | |
michael@0 | 85 | for (var i=0; i!=N; ++i) |
michael@0 | 86 | { |
michael@0 | 87 | cursor.next = {}; |
michael@0 | 88 | cursor = cursor.next; |
michael@0 | 89 | } |
michael@0 | 90 | |
michael@0 | 91 | cursor.toSource = function() |
michael@0 | 92 | { |
michael@0 | 93 | if (level != 0) |
michael@0 | 94 | return make_deep_nest(level - 1); |
michael@0 | 95 | return "END"; |
michael@0 | 96 | } |
michael@0 | 97 | |
michael@0 | 98 | return head.toSource(); |
michael@0 | 99 | } |
michael@0 | 100 | |
michael@0 | 101 | |
michael@0 | 102 | function addThis() |
michael@0 | 103 | { |
michael@0 | 104 | statusitems[UBound] = status; |
michael@0 | 105 | actualvalues[UBound] = actual; |
michael@0 | 106 | expectedvalues[UBound] = expect; |
michael@0 | 107 | UBound++; |
michael@0 | 108 | } |
michael@0 | 109 | |
michael@0 | 110 | |
michael@0 | 111 | function test() |
michael@0 | 112 | { |
michael@0 | 113 | enterFunc('test'); |
michael@0 | 114 | printBugNumber(BUGNUMBER); |
michael@0 | 115 | printStatus(summary); |
michael@0 | 116 | |
michael@0 | 117 | for (var i=0; i<UBound; i++) |
michael@0 | 118 | { |
michael@0 | 119 | reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); |
michael@0 | 120 | } |
michael@0 | 121 | |
michael@0 | 122 | exitFunc ('test'); |
michael@0 | 123 | } |