blob: 76d1b6883db562faab188abe063bc5b8bb7ef90c [file] [log] [blame]
<DOCTYPE html>
<html>
<body>
<script src="../../../resources/js-test.js"></script>
<script>
description("Tests shadowing of window.opener property");
shouldBeNull("window.opener");
evalAndLog("desc = Object.getOwnPropertyDescriptor(window, 'opener')");
shouldBeType("desc.get", "Function");
shouldBeType("desc.set", "Function");
shouldBeTrue("desc.enumerable");
shouldBeTrue("desc.configurable");
openerGetter = desc.get;
shouldNotThrow("window.opener = 'foo'");
shouldBeEqualToString("window.opener", "foo");
evalAndLog("desc = Object.getOwnPropertyDescriptor(window, 'opener')");
shouldBeEqualToString("desc.value", "foo");
shouldBeTrue("desc.writable");
shouldBeTrue("desc.enumerable");
shouldBeTrue("desc.configurable");
shouldBeNull("openerGetter.call(window)");
shouldNotThrow("window.opener = null");
shouldBeNull("window.opener");
shouldBeNull("openerGetter.call(window)");
evalAndLog("desc = Object.getOwnPropertyDescriptor(window, 'opener')");
shouldBe("desc.value", "null");
shouldBeTrue("desc.writable");
shouldBeTrue("desc.enumerable");
shouldBeTrue("desc.configurable");
shouldNotThrow("delete window.opener");
shouldBeUndefined("window.opener");
shouldBeNull("openerGetter.call(window)");
evalAndLog("desc = Object.getOwnPropertyDescriptor(window, 'opener')");
shouldBeUndefined("desc");
</script>
</body>
</html>