tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

cross-compartment.js (1073B)


      1 // |reftest| skip-if(!this.hasOwnProperty('Intl'))
      2 
      3 var g = newGlobal();
      4 
      5 var tag = "de-Latn-AT-1996-u-ca-gregory-nu-latn-co-phonebk-kf-false-kn-hc-h23";
      6 var locale = new Intl.Locale(tag);
      7 var ccwLocale = new g.Intl.Locale(tag);
      8 
      9 for (var [key, {get, value = get}] of Object.entries(Object.getOwnPropertyDescriptors(Intl.Locale.prototype))) {
     10    if (typeof value === "function") {
     11        if (key !== "constructor") {
     12            var expectedValue = value.call(locale);
     13 
     14            if (typeof expectedValue === "string" || typeof expectedValue === "boolean") {
     15                assertEq(value.call(ccwLocale), expectedValue, key);
     16            } else if (expectedValue instanceof Intl.Locale) {
     17                assertEq(value.call(ccwLocale).toString(), expectedValue.toString(), key);
     18            } else {
     19                throw new Error("unexpected result value");
     20            }
     21        } else {
     22            assertEq(new value(ccwLocale).toString(), new value(locale).toString(), key);
     23        }
     24    }
     25 }
     26 
     27 if (typeof reportCompare === "function")
     28    reportCompare(0, 0);