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 | File Name: 15.4.5.1-1.js |
michael@0 | 9 | ECMA Section: [[ Put]] (P, V) |
michael@0 | 10 | Description: |
michael@0 | 11 | Array objects use a variation of the [[Put]] method used for other native |
michael@0 | 12 | ECMAScript objects (section 8.6.2.2). |
michael@0 | 13 | |
michael@0 | 14 | Assume A is an Array object and P is a string. |
michael@0 | 15 | |
michael@0 | 16 | When the [[Put]] method of A is called with property P and value V, the |
michael@0 | 17 | following steps are taken: |
michael@0 | 18 | |
michael@0 | 19 | 1. Call the [[CanPut]] method of A with name P. |
michael@0 | 20 | 2. If Result(1) is false, return. |
michael@0 | 21 | 3. If A doesn't have a property with name P, go to step 7. |
michael@0 | 22 | 4. If P is "length", go to step 12. |
michael@0 | 23 | 5. Set the value of property P of A to V. |
michael@0 | 24 | 6. Go to step 8. |
michael@0 | 25 | 7. Create a property with name P, set its value to V and give it empty |
michael@0 | 26 | attributes. |
michael@0 | 27 | 8. If P is not an array index, return. |
michael@0 | 28 | 9. If A itself has a property (not an inherited property) named "length", |
michael@0 | 29 | andToUint32(P) is less than the value of the length property of A, then |
michael@0 | 30 | return. |
michael@0 | 31 | 10. Change (or set) the value of the length property of A to ToUint32(P)+1. |
michael@0 | 32 | 11. Return. |
michael@0 | 33 | 12. Compute ToUint32(V). |
michael@0 | 34 | 13. For every integer k that is less than the value of the length property |
michael@0 | 35 | of A but not less than Result(12), if A itself has a property (not an |
michael@0 | 36 | inherited property) named ToString(k), then delete that property. |
michael@0 | 37 | 14. Set the value of property P of A to Result(12). |
michael@0 | 38 | 15. Return. |
michael@0 | 39 | Author: christine@netscape.com |
michael@0 | 40 | Date: 12 november 1997 |
michael@0 | 41 | */ |
michael@0 | 42 | |
michael@0 | 43 | var SECTION = "15.4.5.1-1"; |
michael@0 | 44 | var VERSION = "ECMA_1"; |
michael@0 | 45 | startTest(); |
michael@0 | 46 | var TITLE = "Array [[Put]] (P, V)"; |
michael@0 | 47 | |
michael@0 | 48 | writeHeaderToLog( SECTION + " "+ TITLE); |
michael@0 | 49 | |
michael@0 | 50 | |
michael@0 | 51 | // P is "length" |
michael@0 | 52 | |
michael@0 | 53 | new TestCase( SECTION, |
michael@0 | 54 | "var A = new Array(); A.length = 1000; A.length", |
michael@0 | 55 | 1000, |
michael@0 | 56 | eval("var A = new Array(); A.length = 1000; A.length") ); |
michael@0 | 57 | |
michael@0 | 58 | // A has Property P, and P is not length or an array index |
michael@0 | 59 | new TestCase( SECTION, |
michael@0 | 60 | "var A = new Array(1000); A.name = 'name of this array'; A.name", |
michael@0 | 61 | 'name of this array', |
michael@0 | 62 | eval("var A = new Array(1000); A.name = 'name of this array'; A.name") ); |
michael@0 | 63 | |
michael@0 | 64 | new TestCase( SECTION, |
michael@0 | 65 | "var A = new Array(1000); A.name = 'name of this array'; A.length", |
michael@0 | 66 | 1000, |
michael@0 | 67 | eval("var A = new Array(1000); A.name = 'name of this array'; A.length") ); |
michael@0 | 68 | |
michael@0 | 69 | |
michael@0 | 70 | // A has Property P, P is not length, P is an array index, and ToUint32(p) is less than the |
michael@0 | 71 | // value of length |
michael@0 | 72 | |
michael@0 | 73 | new TestCase( SECTION, |
michael@0 | 74 | "var A = new Array(1000); A[123] = 'hola'; A[123]", |
michael@0 | 75 | 'hola', |
michael@0 | 76 | eval("var A = new Array(1000); A[123] = 'hola'; A[123]") ); |
michael@0 | 77 | |
michael@0 | 78 | new TestCase( SECTION, |
michael@0 | 79 | "var A = new Array(1000); A[123] = 'hola'; A.length", |
michael@0 | 80 | 1000, |
michael@0 | 81 | eval("var A = new Array(1000); A[123] = 'hola'; A.length") ); |
michael@0 | 82 | |
michael@0 | 83 | |
michael@0 | 84 | for ( var i = 0X0020, TEST_STRING = "var A = new Array( " ; i < 0x00ff; i++ ) { |
michael@0 | 85 | if (i === "u".charCodeAt(0) || i === "x".charCodeAt(0)) |
michael@0 | 86 | continue; |
michael@0 | 87 | TEST_STRING += "\'\\"+ String.fromCharCode( i ) +"\'"; |
michael@0 | 88 | if ( i < 0x00FF - 1 ) { |
michael@0 | 89 | TEST_STRING += ","; |
michael@0 | 90 | } else { |
michael@0 | 91 | TEST_STRING += ");" |
michael@0 | 92 | } |
michael@0 | 93 | } |
michael@0 | 94 | |
michael@0 | 95 | var LENGTH = 0x00ff - 0x0020 - 2 /* "u"/"x" exclusions above */; |
michael@0 | 96 | |
michael@0 | 97 | new TestCase( SECTION, |
michael@0 | 98 | TEST_STRING +" A[150] = 'hello'; A[150]", |
michael@0 | 99 | 'hello', |
michael@0 | 100 | eval( TEST_STRING + " A[150] = 'hello'; A[150]" ) ); |
michael@0 | 101 | |
michael@0 | 102 | new TestCase( SECTION, |
michael@0 | 103 | TEST_STRING +" A[150] = 'hello'; A[150]", |
michael@0 | 104 | LENGTH, |
michael@0 | 105 | eval( TEST_STRING + " A[150] = 'hello'; A.length" ) ); |
michael@0 | 106 | |
michael@0 | 107 | // A has Property P, P is not length, P is an array index, and ToUint32(p) is not less than the |
michael@0 | 108 | // value of length |
michael@0 | 109 | |
michael@0 | 110 | new TestCase( SECTION, |
michael@0 | 111 | "var A = new Array(); A[123] = true; A.length", |
michael@0 | 112 | 124, |
michael@0 | 113 | eval("var A = new Array(); A[123] = true; A.length") ); |
michael@0 | 114 | |
michael@0 | 115 | new TestCase( SECTION, |
michael@0 | 116 | "var A = new Array(0,1,2,3,4,5,6,7,8,9,10); A[15] ='15'; A.length", |
michael@0 | 117 | 16, |
michael@0 | 118 | eval("var A = new Array(0,1,2,3,4,5,6,7,8,9,10); A[15] ='15'; A.length") ); |
michael@0 | 119 | |
michael@0 | 120 | for ( var i = 0; i < A.length; i++ ) { |
michael@0 | 121 | new TestCase( SECTION, |
michael@0 | 122 | "var A = new Array(0,1,2,3,4,5,6,7,8,9,10); A[15] ='15'; A[" +i +"]", |
michael@0 | 123 | (i <= 10) ? i : ( i == 15 ? '15' : void 0 ), |
michael@0 | 124 | A[i] ); |
michael@0 | 125 | } |
michael@0 | 126 | // P is not an array index, and P is not "length" |
michael@0 | 127 | |
michael@0 | 128 | new TestCase( SECTION, |
michael@0 | 129 | "var A = new Array(); A.join.length = 4; A.join.length", |
michael@0 | 130 | 1, |
michael@0 | 131 | eval("var A = new Array(); A.join.length = 4; A.join.length") ); |
michael@0 | 132 | |
michael@0 | 133 | new TestCase( SECTION, |
michael@0 | 134 | "var A = new Array(); A.join.length = 4; A.length", |
michael@0 | 135 | 0, |
michael@0 | 136 | eval("var A = new Array(); A.join.length = 4; A.length") ); |
michael@0 | 137 | |
michael@0 | 138 | test(); |