mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
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:
parent
a61eb9e8d3
commit
25f3d350f0
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user