Bug 1414292 followup. Indexed properties are enumerable on Window per spec, and thus we fix the CLOSED TREE.

MozReview-Commit-ID: 6Q76VqwSiEx
This commit is contained in:
Boris Zbarsky 2017-11-07 16:55:29 -05:00
parent a61eb9e8d3
commit 25f3d350f0

View File

@ -13,16 +13,27 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=862380
/** Test for Bug 862380 **/
SimpleTest.waitForExplicitFinish();
function go() {
checkNotEnumerable($('ifr').contentWindow);
checkNotEnumerable($('ifr').contentWindow.location);
checkNotEnumerable($('ifr').contentWindow, true);
checkNotEnumerable($('ifr').contentWindow.location, false);
SimpleTest.finish();
}
function checkNotEnumerable(obj) {
function checkNotEnumerable(obj, isWindow) {
try {
is(Object.keys(obj).length, 0, "Object.keys gives empty array");
const expectedWindow = ["0"];
const expectedLocation = [];
const expected = isWindow ? expectedWindow : expectedLocation;
is(Object.keys(obj).length, expected.length,
"Object.keys gives right array length");
var actual = [];
for (var i in obj)
ok(false, "Enumerated something: " + i);
actual.push(i);
is(actual.length, expected.length,
"Enumeration sees the right number of props");
actual.sort();
expected.sort();
for (var i = 0; i < actual.length; ++i)
is(actual[i], expected[i], "Arrays should be the same " + i);
} catch (e) {
ok(false, "threw: " + e);
}