blob: 665f2d9a17c29b19d4aaeb272a27e89a814b2400 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<link rel="help" href="https://html.spec.whatwg.org/#crossoriginproperties-(-o-)">
<link rel="help" href="https://html.spec.whatwg.org/#crossorigingetownpropertyhelper-(-o,-p-)">
<script src="/js-test-resources/js-test-pre.js"></script>
</head>
<body>
<iframe src="http://localhost:8000/security/resources/iframe-with-element.html"></iframe>
<script>
description("Test the descriptors returns by Object.getOwnPropertyDescriptor() cross origin.");
jsTestIsAsync = true;
function testDescriptor(object, propertyName, shouldHaveGetter, shouldHaveSetter)
{
descriptor = Object.getOwnPropertyDescriptor(object, propertyName);
if (shouldHaveGetter || shouldHaveSetter) {
if (shouldHaveGetter)
shouldBeType("descriptor.get", "Function");
else
shouldBeUndefined("descriptor.get");
if (shouldHaveSetter)
shouldBeType("descriptor.set", "Function");
else
shouldBeUndefined("descriptor.set");
} else {
shouldBeType("descriptor.value", "Function");
shouldBeFalse("descriptor.writable");
}
shouldBeFalse("descriptor.enumerable");
shouldBeTrue("descriptor.configurable");
}
onload = function() {
var crossOriginLocationProperties = [
["href", false, true],
["replace", false, false],
];
for (var property of crossOriginLocationProperties) {
debug("* Location." + property[0]);
testDescriptor(frames[0].location, property[0], property[1], property[2]);
}
debug("");
var crossOriginWindowProperties = [
["window", true, false],
["self", true, false],
["location", true, true],
["close", false, false],
["closed", true, false],
["focus", false, false],
["blur", false, false],
["frames", true, false],
["length", true, false],
["top", true, false],
["opener", true, false],
["parent", true, false],
["postMessage", false, false]
];
for (var property of crossOriginWindowProperties) {
debug("* Window." + property[0]);
testDescriptor(frames[0], property[0], property[1], property[2]);
}
debug("");
finishJSTest();
};
</script>
<script src="/js-test-resources/js-test-post.js"></script>
</body>
</html>