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.
8 var format;
10 // Locale en-US; default options.
11 format = new Intl.NumberFormat("en-us");
12 assertEq(format.format(0), "0");
13 assertEq(format.format(-1), "-1");
14 assertEq(format.format(123456789.123456789), "123,456,789.123");
16 // Locale en-US; currency USD.
17 // The US dollar uses two fractional digits, and negative values are commonly
18 // parenthesized.
19 format = new Intl.NumberFormat("en-us", {style: "currency", currency: "USD"});
20 assertEq(format.format(0), "$0.00");
21 assertEq(format.format(-1), "-$1.00");
22 assertEq(format.format(123456789.123456789), "$123,456,789.12");
24 // Locale ja-JP; currency JPY.
25 // The Japanese yen has no subunit in real life.
26 format = new Intl.NumberFormat("ja-jp", {style: "currency", currency: "JPY"});
27 assertEq(format.format(0), "¥0");
28 assertEq(format.format(-1), "-¥1");
29 assertEq(format.format(123456789.123456789), "¥123,456,789");
31 // Locale ar-JO; currency JOD.
32 // The Jordanian Dinar divides into 1000 fils. Jordan uses (real) Arabic digits.
33 format = new Intl.NumberFormat("ar-jo", {style: "currency", currency: "JOD"});
34 assertEq(format.format(0), "د.أ. ٠٫٠٠٠");
35 assertEq(format.format(-1), "-د.أ. ١٫٠٠٠");
36 assertEq(format.format(123456789.123456789), "د.أ. ١٢٣٬٤٥٦٬٧٨٩٫١٢٣");
38 // Locale th-TH; Thai digits, percent, two significant digits.
39 format = new Intl.NumberFormat("th-th-u-nu-thai",
40 {style: "percent",
41 minimumSignificantDigits: 2,
42 maximumSignificantDigits: 2});
43 assertEq(format.format(0), "๐.๐%");
44 assertEq(format.format(-0.01), "-๑.๐%");
45 assertEq(format.format(1.10), "๑๑๐%");
47 reportCompare(0, 0, 'ok');