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.
1 // |reftest| skip-if(!this.hasOwnProperty("Intl"))
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 // Tests the format function with a diverse set of locales and options.
7 // Always use UTC to avoid dependencies on test environment.
9 var format;
10 var date = Date.UTC(2012, 11, 12, 3, 0, 0);
11 var longFormatOptions = {timeZone: "UTC",
12 year: "numeric", month: "long", day: "numeric",
13 hour: "numeric", minute: "numeric", second: "numeric"};
15 // Locale en-US; default options.
16 format = new Intl.DateTimeFormat("en-us", {timeZone: "UTC"});
17 assertEq(format.format(date), "12/12/2012");
19 // Locale th-TH; default options.
20 // Thailand uses the Buddhist calendar.
21 format = new Intl.DateTimeFormat("th-th", {timeZone: "UTC"});
22 assertEq(format.format(date), "12/12/2555");
24 // Locale th-TH; long format, Thai digits.
25 format = new Intl.DateTimeFormat("th-th-u-nu-thai", longFormatOptions);
26 assertEq(format.format(date), "๑๒ ธันวาคม ๒๕๕๕ ๐๓:๐๐:๐๐");
28 // Locale ja-JP; long format.
29 format = new Intl.DateTimeFormat("ja-jp", longFormatOptions);
30 assertEq(format.format(date), "2012年12月12日 3:00:00");
32 // Locale ar-MA; long format, Islamic civilian calendar.
33 format = new Intl.DateTimeFormat("ar-ma-u-ca-islamicc", longFormatOptions);
34 assertEq(format.format(date), "28 محرم، 1434 3:00:00 ص");
36 reportCompare(0, 0, 'ok');