Debian Codegraph @

js/src/tests/non262/Intl/RelativeTimeFormat/cross-compartment.js

raw
1 // |reftest| skip-if(!this.hasOwnProperty("Intl"))
2
3 var otherGlobal = newGlobal();
4
5 var relativeTimeFormat = new Intl.RelativeTimeFormat();
6 var ccwRelativeTimeFormat = new otherGlobal.Intl.RelativeTimeFormat();
7
8 // Test Intl.RelativeTimeFormat.prototype.format with a CCW object.
9 var Intl_RelativeTimeFormat_format = Intl.RelativeTimeFormat.prototype.format;
10
11 assertEq(Intl_RelativeTimeFormat_format.call(ccwRelativeTimeFormat, 0, "hour"),
12 Intl_RelativeTimeFormat_format.call(relativeTimeFormat, 0, "hour"));
13
14 // Test Intl.RelativeTimeFormat.prototype.resolvedOptions with a CCW object.
15 var Intl_RelativeTimeFormat_resolvedOptions = Intl.RelativeTimeFormat.prototype.resolvedOptions;
16
17 assertEq(deepEqual(Intl_RelativeTimeFormat_resolvedOptions.call(ccwRelativeTimeFormat),
18 Intl_RelativeTimeFormat_resolvedOptions.call(relativeTimeFormat)),
19 true);
20
21 if (typeof reportCompare === "function")
22 reportCompare(true, true);