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: 26 November 2000 |
michael@0 | 9 | * |
michael@0 | 10 | *SUMMARY: Testing numeric literals that begin with 0. |
michael@0 | 11 | *This test arose from Bugzilla bug 49233. |
michael@0 | 12 | *The best explanation is from jsscan.c: |
michael@0 | 13 | * |
michael@0 | 14 | * "We permit 08 and 09 as decimal numbers, which makes |
michael@0 | 15 | * our behaviour a superset of the ECMA numeric grammar. |
michael@0 | 16 | * We might not always be so permissive, so we warn about it." |
michael@0 | 17 | * |
michael@0 | 18 | *Thus an expression 010 will evaluate, as always, as an octal (to 8). |
michael@0 | 19 | *However, 018 will evaluate as a decimal, to 18. Even though the |
michael@0 | 20 | *user began the expression as an octal, he later used a non-octal |
michael@0 | 21 | *digit. We forgive this and assume he intended a decimal. If the |
michael@0 | 22 | *JavaScript "strict" option is set though, we will give a warning. |
michael@0 | 23 | */ |
michael@0 | 24 | |
michael@0 | 25 | //------------------------------------------------------------------------------------------------- |
michael@0 | 26 | var BUGNUMBER = '49233'; |
michael@0 | 27 | var summary = 'Testing numeric literals that begin with 0'; |
michael@0 | 28 | var statprefix = 'Testing '; |
michael@0 | 29 | var quote = "'"; |
michael@0 | 30 | var asString = new Array(); |
michael@0 | 31 | var actual = new Array(); |
michael@0 | 32 | var expect = new Array(); |
michael@0 | 33 | |
michael@0 | 34 | |
michael@0 | 35 | asString[0]='01' |
michael@0 | 36 | actual[0]=01 |
michael@0 | 37 | expect[0]=1 |
michael@0 | 38 | |
michael@0 | 39 | asString[1]='07' |
michael@0 | 40 | actual[1]=07 |
michael@0 | 41 | expect[1]=7 |
michael@0 | 42 | |
michael@0 | 43 | asString[2]='08' |
michael@0 | 44 | actual[2]=08 |
michael@0 | 45 | expect[2]=8 |
michael@0 | 46 | |
michael@0 | 47 | asString[3]='09' |
michael@0 | 48 | actual[3]=09 |
michael@0 | 49 | expect[3]=9 |
michael@0 | 50 | |
michael@0 | 51 | asString[4]='010' |
michael@0 | 52 | actual[4]=010 |
michael@0 | 53 | expect[4]=8 |
michael@0 | 54 | |
michael@0 | 55 | asString[5]='017' |
michael@0 | 56 | actual[5]=017 |
michael@0 | 57 | expect[5]=15 |
michael@0 | 58 | |
michael@0 | 59 | asString[6]='018' |
michael@0 | 60 | actual[6]=018 |
michael@0 | 61 | expect[6]=18 |
michael@0 | 62 | |
michael@0 | 63 | asString[7]='019' |
michael@0 | 64 | actual[7]=019 |
michael@0 | 65 | expect[7]=19 |
michael@0 | 66 | |
michael@0 | 67 | asString[8]='079' |
michael@0 | 68 | actual[8]=079 |
michael@0 | 69 | expect[8]=79 |
michael@0 | 70 | |
michael@0 | 71 | asString[9]='0079' |
michael@0 | 72 | actual[9]=0079 |
michael@0 | 73 | expect[9]=79 |
michael@0 | 74 | |
michael@0 | 75 | asString[10]='099' |
michael@0 | 76 | actual[10]=099 |
michael@0 | 77 | expect[10]=99 |
michael@0 | 78 | |
michael@0 | 79 | asString[11]='0099' |
michael@0 | 80 | actual[11]=0099 |
michael@0 | 81 | expect[11]=99 |
michael@0 | 82 | |
michael@0 | 83 | asString[12]='000000000077' |
michael@0 | 84 | actual[12]=000000000077 |
michael@0 | 85 | expect[12]=63 |
michael@0 | 86 | |
michael@0 | 87 | asString[13]='000000000078' |
michael@0 | 88 | actual[13]=000000000078 |
michael@0 | 89 | expect[13]=78 |
michael@0 | 90 | |
michael@0 | 91 | asString[14]='0000000000770000' |
michael@0 | 92 | actual[14]=0000000000770000 |
michael@0 | 93 | expect[14]=258048 |
michael@0 | 94 | |
michael@0 | 95 | asString[15]='0000000000780000' |
michael@0 | 96 | actual[15]=0000000000780000 |
michael@0 | 97 | expect[15]=780000 |
michael@0 | 98 | |
michael@0 | 99 | asString[16]='0765432198' |
michael@0 | 100 | actual[16]=0765432198 |
michael@0 | 101 | expect[16]=765432198 |
michael@0 | 102 | |
michael@0 | 103 | asString[17]='00076543219800' |
michael@0 | 104 | actual[17]=00076543219800 |
michael@0 | 105 | expect[17]=76543219800 |
michael@0 | 106 | |
michael@0 | 107 | asString[18]='0000001001007' |
michael@0 | 108 | actual[18]=0000001001007 |
michael@0 | 109 | expect[18]=262663 |
michael@0 | 110 | |
michael@0 | 111 | asString[19]='0000001001009' |
michael@0 | 112 | actual[19]=0000001001009 |
michael@0 | 113 | expect[19]=1001009 |
michael@0 | 114 | |
michael@0 | 115 | asString[20]='070' |
michael@0 | 116 | actual[20]=070 |
michael@0 | 117 | expect[20]=56 |
michael@0 | 118 | |
michael@0 | 119 | asString[21]='080' |
michael@0 | 120 | actual[21]=080 |
michael@0 | 121 | expect[21]=80 |
michael@0 | 122 | |
michael@0 | 123 | |
michael@0 | 124 | |
michael@0 | 125 | //------------------------------------------------------------------------------------------------- |
michael@0 | 126 | test(); |
michael@0 | 127 | //------------------------------------------------------------------------------------------------- |
michael@0 | 128 | |
michael@0 | 129 | |
michael@0 | 130 | function showStatus(msg) |
michael@0 | 131 | { |
michael@0 | 132 | return (statprefix + quote + msg + quote); |
michael@0 | 133 | } |
michael@0 | 134 | |
michael@0 | 135 | |
michael@0 | 136 | function test() |
michael@0 | 137 | { |
michael@0 | 138 | enterFunc ('test'); |
michael@0 | 139 | printBugNumber(BUGNUMBER); |
michael@0 | 140 | printStatus (summary); |
michael@0 | 141 | |
michael@0 | 142 | |
michael@0 | 143 | for (i=0; i !=asString.length; i++) |
michael@0 | 144 | { |
michael@0 | 145 | reportCompare (expect[i], actual[i], showStatus(asString[i])); |
michael@0 | 146 | } |
michael@0 | 147 | |
michael@0 | 148 | exitFunc ('test'); |
michael@0 | 149 | } |