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.9.5.2.js |
michael@0 | 9 | ECMA Section: 15.9.5.2 Date.prototype.toString |
michael@0 | 10 | Description: |
michael@0 | 11 | This function returns a string value. The contents of the string are |
michael@0 | 12 | implementation dependent, but are intended to represent the Date in a |
michael@0 | 13 | convenient, human-readable form in the current time zone. |
michael@0 | 14 | |
michael@0 | 15 | The toString function is not generic; it generates a runtime error if its |
michael@0 | 16 | this value is not a Date object. Therefore it cannot be transferred to |
michael@0 | 17 | other kinds of objects for use as a method. |
michael@0 | 18 | |
michael@0 | 19 | Author: christine@netscape.com |
michael@0 | 20 | Date: 12 november 1997 |
michael@0 | 21 | */ |
michael@0 | 22 | |
michael@0 | 23 | var SECTION = "15.9.5.2"; |
michael@0 | 24 | var VERSION = "ECMA_1"; |
michael@0 | 25 | startTest(); |
michael@0 | 26 | var TITLE = "Date.prototype.toString"; |
michael@0 | 27 | |
michael@0 | 28 | writeHeaderToLog( SECTION + " "+ TITLE); |
michael@0 | 29 | |
michael@0 | 30 | new TestCase( SECTION, |
michael@0 | 31 | "Date.prototype.toString.length", |
michael@0 | 32 | 0, |
michael@0 | 33 | Date.prototype.toString.length ); |
michael@0 | 34 | |
michael@0 | 35 | var now = new Date(); |
michael@0 | 36 | |
michael@0 | 37 | // can't test the content of the string, but can verify that the string is |
michael@0 | 38 | // parsable by Date.parse |
michael@0 | 39 | |
michael@0 | 40 | new TestCase( SECTION, |
michael@0 | 41 | "Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000", |
michael@0 | 42 | true, |
michael@0 | 43 | Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000 ); |
michael@0 | 44 | |
michael@0 | 45 | new TestCase( SECTION, |
michael@0 | 46 | "typeof now.toString()", |
michael@0 | 47 | "string", |
michael@0 | 48 | typeof now.toString() ); |
michael@0 | 49 | // 1970 |
michael@0 | 50 | |
michael@0 | 51 | new TestCase( SECTION, |
michael@0 | 52 | "Date.parse( (new Date(0)).toString() )", |
michael@0 | 53 | 0, |
michael@0 | 54 | Date.parse( (new Date(0)).toString() ) ); |
michael@0 | 55 | |
michael@0 | 56 | new TestCase( SECTION, |
michael@0 | 57 | "Date.parse( (new Date("+TZ_ADJUST+")).toString() )", |
michael@0 | 58 | TZ_ADJUST, |
michael@0 | 59 | Date.parse( (new Date(TZ_ADJUST)).toString() ) ); |
michael@0 | 60 | |
michael@0 | 61 | // 1900 |
michael@0 | 62 | new TestCase( SECTION, |
michael@0 | 63 | "Date.parse( (new Date("+TIME_1900+")).toString() )", |
michael@0 | 64 | TIME_1900, |
michael@0 | 65 | Date.parse( (new Date(TIME_1900)).toString() ) ); |
michael@0 | 66 | |
michael@0 | 67 | new TestCase( SECTION, |
michael@0 | 68 | "Date.parse( (new Date("+TIME_1900 -TZ_ADJUST+")).toString() )", |
michael@0 | 69 | TIME_1900 -TZ_ADJUST, |
michael@0 | 70 | Date.parse( (new Date(TIME_1900 -TZ_ADJUST)).toString() ) ); |
michael@0 | 71 | |
michael@0 | 72 | // 2000 |
michael@0 | 73 | new TestCase( SECTION, |
michael@0 | 74 | "Date.parse( (new Date("+TIME_2000+")).toString() )", |
michael@0 | 75 | TIME_2000, |
michael@0 | 76 | Date.parse( (new Date(TIME_2000)).toString() ) ); |
michael@0 | 77 | |
michael@0 | 78 | new TestCase( SECTION, |
michael@0 | 79 | "Date.parse( (new Date("+TIME_2000 -TZ_ADJUST+")).toString() )", |
michael@0 | 80 | TIME_2000 -TZ_ADJUST, |
michael@0 | 81 | Date.parse( (new Date(TIME_2000 -TZ_ADJUST)).toString() ) ); |
michael@0 | 82 | |
michael@0 | 83 | // 29 Feb 2000 |
michael@0 | 84 | |
michael@0 | 85 | new TestCase( SECTION, |
michael@0 | 86 | "Date.parse( (new Date("+UTC_FEB_29_2000+")).toString() )", |
michael@0 | 87 | UTC_FEB_29_2000, |
michael@0 | 88 | Date.parse( (new Date(UTC_FEB_29_2000)).toString() ) ); |
michael@0 | 89 | |
michael@0 | 90 | new TestCase( SECTION, |
michael@0 | 91 | "Date.parse( (new Date("+(UTC_FEB_29_2000-1000)+")).toString() )", |
michael@0 | 92 | UTC_FEB_29_2000-1000, |
michael@0 | 93 | Date.parse( (new Date(UTC_FEB_29_2000-1000)).toString() ) ); |
michael@0 | 94 | |
michael@0 | 95 | |
michael@0 | 96 | new TestCase( SECTION, |
michael@0 | 97 | "Date.parse( (new Date("+(UTC_FEB_29_2000-TZ_ADJUST)+")).toString() )", |
michael@0 | 98 | UTC_FEB_29_2000-TZ_ADJUST, |
michael@0 | 99 | Date.parse( (new Date(UTC_FEB_29_2000-TZ_ADJUST)).toString() ) ); |
michael@0 | 100 | // 2O05 |
michael@0 | 101 | |
michael@0 | 102 | new TestCase( SECTION, |
michael@0 | 103 | "Date.parse( (new Date("+UTC_JAN_1_2005+")).toString() )", |
michael@0 | 104 | UTC_JAN_1_2005, |
michael@0 | 105 | Date.parse( (new Date(UTC_JAN_1_2005)).toString() ) ); |
michael@0 | 106 | |
michael@0 | 107 | new TestCase( SECTION, |
michael@0 | 108 | "Date.parse( (new Date("+(UTC_JAN_1_2005-1000)+")).toString() )", |
michael@0 | 109 | UTC_JAN_1_2005-1000, |
michael@0 | 110 | Date.parse( (new Date(UTC_JAN_1_2005-1000)).toString() ) ); |
michael@0 | 111 | |
michael@0 | 112 | new TestCase( SECTION, |
michael@0 | 113 | "Date.parse( (new Date("+(UTC_JAN_1_2005-TZ_ADJUST)+")).toString() )", |
michael@0 | 114 | UTC_JAN_1_2005-TZ_ADJUST, |
michael@0 | 115 | Date.parse( (new Date(UTC_JAN_1_2005-TZ_ADJUST)).toString() ) ); |
michael@0 | 116 | |
michael@0 | 117 | test(); |