Skip to content

Commit

Permalink
Bug 1381408. Make cross-origin-exposed non-symbol properties enumerab…
Browse files Browse the repository at this point in the history
…le. r=bholley

The list of exposed properties can be gotten via
Object.getOwnPropertyNames/Symbols already, so there's nothing to be won from
the non-enumerability.

The web platform test changes are backports of
web-platform-tests/wpt#6538 and
web-platform-tests/wpt#6571 and
web-platform-tests/wpt#6583

The js/xpconnect/tests/mochitest/*crossOriginObject* tests being removed are
just older versions of the web platfrom test.
  • Loading branch information
bzbarsky committed Jul 19, 2017
1 parent 62ab8fa commit c783734
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 444 deletions.
35 changes: 0 additions & 35 deletions js/xpconnect/tests/mochitest/file_crossOriginObjects.html

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions js/xpconnect/tests/mochitest/mochitest.ini
Expand Up @@ -22,8 +22,6 @@ support-files =
file_bug799348.html
file_bug802557.html
file_bug860494.html
file_crossOriginObjects.html
file_crossOriginObjects_documentDomain.html
file_crosscompartment_weakmap.html
file_documentdomain.html
file_doublewrappedcompartments.html
Expand Down Expand Up @@ -94,7 +92,6 @@ support-files =
[test_bug1005806.html]
[test_bug1094930.html]
[test_bug1158558.html]
[test_crossOriginObjects.html]
[test_crosscompartment_weakmap.html]
[test_frameWrapping.html]
# The JS test component we use below is only available in debug builds.
Expand Down
23 changes: 18 additions & 5 deletions js/xpconnect/tests/mochitest/test_bug862380.html
Expand Up @@ -13,16 +13,29 @@
/** 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", "window", "location", "top", "close",
"focus", "blur", "postMessage", "self", "closed",
"frames", "length", "opener", "parent"];
const expectedLocation = ["replace", "href"];
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);
}
Expand Down

0 comments on commit c783734

Please sign in to comment.