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 | // |reftest| fails-if(xulRuntime.OS=="WINNT") skip-if(xulRuntime.OS=="WINNT"&&isDebugBuild) |
michael@0 | 2 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | //----------------------------------------------------------------------------- |
michael@0 | 8 | var BUGNUMBER = 291494; |
michael@0 | 9 | var summary = 'Date.prototype.toLocaleFormat extension'; |
michael@0 | 10 | var actual = ''; |
michael@0 | 11 | var expect = ''; |
michael@0 | 12 | var temp; |
michael@0 | 13 | |
michael@0 | 14 | /* |
michael@0 | 15 | * SpiderMonkey only. |
michael@0 | 16 | * |
michael@0 | 17 | * This test uses format strings which are not supported cross |
michael@0 | 18 | * platform and are expected to fail on at least some platforms |
michael@0 | 19 | * however they all currently pass on Linux (Fedora Core 6). They are |
michael@0 | 20 | * included here in order to increase coverage for cases where a crash |
michael@0 | 21 | * may occur. These failures will be tracked in the |
michael@0 | 22 | * mozilla/js/tests/public-failures.txt list. |
michael@0 | 23 | * |
michael@0 | 24 | */ |
michael@0 | 25 | |
michael@0 | 26 | enterFunc ('test'); |
michael@0 | 27 | printBugNumber(BUGNUMBER); |
michael@0 | 28 | printStatus (summary); |
michael@0 | 29 | |
michael@0 | 30 | var date = new Date("06/05/2005 00:00:00 GMT-0000"); |
michael@0 | 31 | |
michael@0 | 32 | expect = '20'; |
michael@0 | 33 | actual = date.toLocaleFormat('%C'); |
michael@0 | 34 | reportCompare(expect, actual, 'Date.toLocaleFormat("%C")'); |
michael@0 | 35 | |
michael@0 | 36 | expect = date.toLocaleFormat('%C%y'); |
michael@0 | 37 | actual = date.toLocaleFormat('%Y'); |
michael@0 | 38 | reportCompare(expect, actual, 'Date.toLocaleFormat("%C%y") == ' + |
michael@0 | 39 | 'Date.toLocaleFormat("%Y")'); |
michael@0 | 40 | |
michael@0 | 41 | expect = date.toLocaleFormat('%m/%d/%y'); |
michael@0 | 42 | actual = date.toLocaleFormat('%D'); |
michael@0 | 43 | reportCompare(expect, actual, 'Date.toLocaleFormat("%m/%d/%y") == ' + |
michael@0 | 44 | 'Date.toLocaleFormat("%D")'); |
michael@0 | 45 | |
michael@0 | 46 | expect = (date.getTimezoneOffset() > 0) ? ' 4' : ' 5'; |
michael@0 | 47 | actual = date.toLocaleFormat('%e'); |
michael@0 | 48 | reportCompare(expect, actual, 'Date.toLocaleFormat("%e")'); |
michael@0 | 49 | |
michael@0 | 50 | expect = date.toLocaleFormat('%Y-%m-%d'); |
michael@0 | 51 | actual = date.toLocaleFormat('%F'); |
michael@0 | 52 | reportCompare(expect, actual, 'Date.toLocaleFormat("%Y-%m-%d") == ' + |
michael@0 | 53 | 'Date.toLocaleFormat("%F")'); |
michael@0 | 54 | |
michael@0 | 55 | expect = '05'; |
michael@0 | 56 | actual = date.toLocaleFormat('%g'); |
michael@0 | 57 | reportCompare(expect, actual, 'Date.toLocaleFormat("%g")'); |
michael@0 | 58 | |
michael@0 | 59 | expect = '2005'; |
michael@0 | 60 | actual = date.toLocaleFormat('%G'); |
michael@0 | 61 | reportCompare(expect, actual, 'Date.toLocaleFormat("%G")'); |
michael@0 | 62 | |
michael@0 | 63 | expect = date.toLocaleFormat('%b'); |
michael@0 | 64 | actual = date.toLocaleFormat('%h'); |
michael@0 | 65 | reportCompare(expect, actual, 'Date.toLocaleFormat("%b") == ' + |
michael@0 | 66 | 'Date.toLocaleFormat("%h")'); |
michael@0 | 67 | |
michael@0 | 68 | expect = '\n'; |
michael@0 | 69 | actual = date.toLocaleFormat('%n'); |
michael@0 | 70 | reportCompare(expect, actual, 'Date.toLocaleFormat("%n") == "\\n"'); |
michael@0 | 71 | |
michael@0 | 72 | expect = date.toLocaleFormat('%I:%M:%S %p'); |
michael@0 | 73 | actual = date.toLocaleFormat('%r'); |
michael@0 | 74 | reportCompare(expect, actual, 'Date.toLocaleFormat("%I:%M:%S %p") == ' + |
michael@0 | 75 | 'Date.toLocaleFormat("%r")'); |
michael@0 | 76 | |
michael@0 | 77 | expect = date.toLocaleFormat('%H:%M'); |
michael@0 | 78 | actual = date.toLocaleFormat('%R'); |
michael@0 | 79 | reportCompare(expect, actual, 'Date.toLocaleFormat("%H:%M") == ' + |
michael@0 | 80 | 'Date.toLocaleFormat("%R")'); |
michael@0 | 81 | |
michael@0 | 82 | expect = '\t'; |
michael@0 | 83 | actual = date.toLocaleFormat('%t'); |
michael@0 | 84 | reportCompare(expect, actual, 'Date.toLocaleFormat("%t") == "\\t"'); |
michael@0 | 85 | |
michael@0 | 86 | expect = date.toLocaleFormat('%H:%M:%S'); |
michael@0 | 87 | actual = date.toLocaleFormat('%T'); |
michael@0 | 88 | reportCompare(expect, actual, 'Date.toLocaleFormat("%H:%M:%S") == ' + |
michael@0 | 89 | 'Date.toLocaleFormat("%T")'); |
michael@0 | 90 | |
michael@0 | 91 | expect = String(6 + ((date.getTimezoneOffset() > 0) ? 0 : 1)); |
michael@0 | 92 | actual = date.toLocaleFormat('%u'); |
michael@0 | 93 | reportCompare(expect, actual, 'Date.toLocaleFormat("%u")'); |
michael@0 | 94 | |
michael@0 | 95 | expect = '22'; |
michael@0 | 96 | actual = date.toLocaleFormat('%V'); |
michael@0 | 97 | reportCompare(expect, actual, 'Date.toLocaleFormat("%V")'); |
michael@0 | 98 | |
michael@0 | 99 | print('Note: For Date.toLocaleFormat("%m/%d/%y") == Date.toLocaleFormat("%x") ' + |
michael@0 | 100 | 'to pass in Windows, the Regional Setting for the short date must be ' + |
michael@0 | 101 | 'set to mm/dd/yyyy'); |
michael@0 | 102 | expect = date.toLocaleFormat('%m/%d/%Y'); |
michael@0 | 103 | actual = date.toLocaleFormat('%x'); |
michael@0 | 104 | reportCompare(expect, actual, 'Date.toLocaleFormat("%m/%d/%Y") == ' + |
michael@0 | 105 | 'Date.toLocaleFormat("%x")'); |