Debian Codegraph @

js/src/jit-test/tests/resist-fingerprinting/locale.js

raw
1 // |jit-test| skip-if: typeof Intl === 'undefined'
2
3 function test(locale, timeZone) {
4 let global = newGlobal({locale, forceUTC: true});
5
6 const constructors = ["Collator", "DateTimeFormat", "ListFormat",
7 "NumberFormat", "PluralRules", "RelativeTimeFormat"];
8 for (const constructor of constructors) {
9 let intl = new global.Intl[constructor];
10 assertEq(intl.resolvedOptions().locale, locale);
11 }
12
13 const date = new global.Date(2012, 0, 10);
14 let tzRE = /\(([^\)]+)\)/;
15 assertEq(tzRE.exec(date)[1], timeZone)
16 }
17
18 test("de-CH", "Mittlere Greenwich-Zeit");
19 test("en", "Greenwich Mean Time");