cross-compartment.js (832B)
1 // |reftest| skip-if(!this.hasOwnProperty("Intl")) 2 3 var otherGlobal = newGlobal(); 4 5 var collator = new Intl.Collator(); 6 var ccwCollator = new otherGlobal.Intl.Collator(); 7 8 // Test Intl.Collator.prototype.compare with a CCW object. 9 var Intl_Collator_compare_get = Object.getOwnPropertyDescriptor(Intl.Collator.prototype, "compare").get; 10 11 assertEq(Intl_Collator_compare_get.call(ccwCollator)("a", "A"), 12 Intl_Collator_compare_get.call(collator)("a", "A")); 13 14 // Test Intl.Collator.prototype.resolvedOptions with a CCW object. 15 var Intl_Collator_resolvedOptions = Intl.Collator.prototype.resolvedOptions; 16 17 assertEq(deepEqual(Intl_Collator_resolvedOptions.call(ccwCollator), 18 Intl_Collator_resolvedOptions.call(collator)), 19 true); 20 21 if (typeof reportCompare === "function") 22 reportCompare(true, true);