options-property-accesses.js (1217B)
1 // |reftest| skip-if(!this.hasOwnProperty("Intl")) 2 3 var log; 4 var proxy = new Proxy({ 5 year: "numeric", 6 hour: "numeric", 7 }, new Proxy({ 8 get(t, pk, r) { 9 log.push(pk); 10 return Reflect.get(t, pk, r); 11 } 12 }, { 13 get(t, pk, r) { 14 assertEq(pk, "get"); 15 return Reflect.get(t, pk, r); 16 } 17 })); 18 19 var constructorAccesses = [ 20 // InitializeDateTimeFormat 21 "localeMatcher", "calendar", "numberingSystem", "hour12", "hourCycle", "timeZone", 22 23 // Table 5: Components of date and time formats 24 "weekday", "era", "year", "month", "day", "dayPeriod", "hour", "minute", "second", 25 "fractionalSecondDigits", "timeZoneName", 26 27 // InitializeDateTimeFormat 28 "formatMatcher", 29 "dateStyle", "timeStyle", 30 ]; 31 32 log = []; 33 new Intl.DateTimeFormat(undefined, proxy); 34 35 assertEqArray(log, constructorAccesses); 36 37 log = []; 38 new Date().toLocaleString(undefined, proxy); 39 40 assertEqArray(log, constructorAccesses); 41 42 log = []; 43 new Date().toLocaleDateString(undefined, proxy); 44 45 assertEqArray(log, constructorAccesses); 46 47 log = []; 48 new Date().toLocaleTimeString(undefined, proxy); 49 50 assertEqArray(log, constructorAccesses); 51 52 if (typeof reportCompare === "function") 53 reportCompare(0, 0);