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| skip-if(!this.hasOwnProperty("Intl")) |
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 | // Tests the format function with a diverse set of locales and options. |
michael@0 | 7 | // Always use UTC to avoid dependencies on test environment. |
michael@0 | 8 | |
michael@0 | 9 | var format; |
michael@0 | 10 | var date = Date.UTC(2012, 11, 12, 3, 0, 0); |
michael@0 | 11 | var longFormatOptions = {timeZone: "UTC", |
michael@0 | 12 | year: "numeric", month: "long", day: "numeric", |
michael@0 | 13 | hour: "numeric", minute: "numeric", second: "numeric"}; |
michael@0 | 14 | |
michael@0 | 15 | // Locale en-US; default options. |
michael@0 | 16 | format = new Intl.DateTimeFormat("en-us", {timeZone: "UTC"}); |
michael@0 | 17 | assertEq(format.format(date), "12/12/2012"); |
michael@0 | 18 | |
michael@0 | 19 | // Locale th-TH; default options. |
michael@0 | 20 | // Thailand uses the Buddhist calendar. |
michael@0 | 21 | format = new Intl.DateTimeFormat("th-th", {timeZone: "UTC"}); |
michael@0 | 22 | assertEq(format.format(date), "12/12/2555"); |
michael@0 | 23 | |
michael@0 | 24 | // Locale th-TH; long format, Thai digits. |
michael@0 | 25 | format = new Intl.DateTimeFormat("th-th-u-nu-thai", longFormatOptions); |
michael@0 | 26 | assertEq(format.format(date), "๑๒ ธันวาคม ๒๕๕๕ ๐๓:๐๐:๐๐"); |
michael@0 | 27 | |
michael@0 | 28 | // Locale ja-JP; long format. |
michael@0 | 29 | format = new Intl.DateTimeFormat("ja-jp", longFormatOptions); |
michael@0 | 30 | assertEq(format.format(date), "2012年12月12日 3:00:00"); |
michael@0 | 31 | |
michael@0 | 32 | // Locale ar-MA; long format, Islamic civilian calendar. |
michael@0 | 33 | format = new Intl.DateTimeFormat("ar-ma-u-ca-islamicc", longFormatOptions); |
michael@0 | 34 | assertEq(format.format(date), "28 محرم، 1434 3:00:00 ص"); |
michael@0 | 35 | |
michael@0 | 36 | reportCompare(0, 0, 'ok'); |