|
184 | 184 | }, "[[GetOwnProperty]] - Properties on cross-origin objects should be reported |own|");
|
185 | 185 |
|
186 | 186 | function checkPropertyDescriptor(desc, propName, expectWritable) {
|
187 |
| - var isSymbol = (typeof(propName) == "symbol"); |
| 187 | + const isSymbol = typeof(propName) === "symbol"; |
| 188 | + const isArrayIndexPropertyName = !isSymbol && !isNaN(parseInt(propName, 10)); |
188 | 189 | propName = String(propName);
|
189 | 190 | assert_true(isObject(desc), "property descriptor for " + propName + " should exist");
|
190 | 191 | assert_equals(desc.configurable, true, "property descriptor for " + propName + " should be configurable");
|
191 |
| - if (isSymbol) { |
192 |
| - assert_equals(desc.enumerable, false, "symbol-property descriptor for " + propName + " should not be enumerable"); |
193 |
| - assert_true("value" in desc, |
194 |
| - "property descriptor for " + propName + " should be a value descriptor"); |
195 |
| - assert_equals(desc.value, undefined, |
| 192 | + if (!isArrayIndexPropertyName) { |
| 193 | + assert_equals(desc.enumerable, false, "property descriptor for " + propName + " should not be enumerable"); |
| 194 | + if(isSymbol) { |
| 195 | + assert_true("value" in desc, |
| 196 | + "property descriptor for " + propName + " should be a value descriptor"); |
| 197 | + assert_equals(desc.value, undefined, |
196 | 198 | "symbol-named cross-origin visible prop " + propName +
|
197 | 199 | " should come back as undefined");
|
| 200 | + } |
198 | 201 | } else {
|
199 | 202 | assert_equals(desc.enumerable, true, "property descriptor for " + propName + " should be enumerable");
|
200 | 203 | }
|
|
265 | 268 | let i = 0;
|
266 | 269 | for (var prop in C) {
|
267 | 270 | i++;
|
268 |
| - assert_true(whitelistedWindowPropNames.includes(prop), prop + " is not safelisted for a cross-origin Window"); |
| 271 | + assert_true(whitelistedWindowIndices.includes(prop), prop + " is not safelisted for a cross-origin Window"); |
269 | 272 | }
|
270 |
| - assert_equals(i, whitelistedWindowPropNames.length, "Enumerate all safelisted cross-origin Window properties"); |
| 273 | + assert_equals(i, whitelistedWindowIndices.length, "Enumerate all enumerable safelisted cross-origin Window properties"); |
271 | 274 | i = 0;
|
272 | 275 | for (var prop in C.location) {
|
273 | 276 | i++;
|
274 |
| - assert_true(whitelistedLocationPropNames.includes(prop), prop + " is not safelisted for a cross-origin Location"); |
275 | 277 | }
|
276 |
| - assert_equals(i, whitelistedLocationPropNames.length, "Enumerate all safelisted cross-origin Location properties"); |
277 |
| -}, "Can only enumerate safelisted properties"); |
| 278 | + assert_equals(i, 0, "There's nothing to enumerate for cross-origin Location properties"); |
| 279 | +}, "Can only enumerate safelisted enumerable properties"); |
278 | 280 |
|
279 | 281 | /*
|
280 | 282 | * [[OwnPropertyKeys]]
|
|
285 | 287 | whitelistedWindowPropNames,
|
286 | 288 | "Object.getOwnPropertyNames() gives the right answer for cross-origin Window");
|
287 | 289 | assert_array_equals(Object.keys(C).sort(),
|
288 |
| - whitelistedWindowPropNames, |
| 290 | + whitelistedWindowIndices, |
289 | 291 | "Object.keys() gives the right answer for cross-origin Window");
|
290 | 292 | assert_array_equals(Object.getOwnPropertyNames(C.location).sort(),
|
291 | 293 | whitelistedLocationPropNames,
|
292 | 294 | "Object.getOwnPropertyNames() gives the right answer for cross-origin Location");
|
293 |
| - assert_array_equals(Object.keys(C.location).sort(), |
294 |
| - whitelistedLocationPropNames, |
295 |
| - "Object.keys() gives the right answer for cross-origin Location"); |
| 295 | + assert_equals(Object.keys(C.location).length, 0, |
| 296 | + "Object.keys() gives the right answer for cross-origin Location"); |
296 | 297 | }, "[[OwnPropertyKeys]] should return all properties from cross-origin objects");
|
297 | 298 |
|
298 | 299 | addTest(function() {
|
|
0 commit comments