| <!DOCTYPE html> |
| <meta charset="utf-8"> |
| <title>window.opener setter throws TypeError if [[DefineOwnProperty]] fails</title> |
| <link rel="help" href="https://html.spec.whatwg.org/multipage/browsers.html#dom-opener"> |
| |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| |
| <body> |
| <script> |
| test(() => { |
| const { set } = Object.getOwnPropertyDescriptor(window, "opener"); |
| Object.defineProperty(window, "opener", { value: 1, writable: false, configurable: false }); |
| assert_throws(new TypeError, () => { set.call(window, 2); }); |
| |
| const desc = Object.getOwnPropertyDescriptor(window, "opener"); |
| assert_equals(desc.value, 1); |
| assert_false(desc.writable); |
| assert_true(desc.enumerable); |
| assert_false(desc.configurable); |
| }, "window.opener setter throws TypeError if called on non-configurable non-writable data property"); |
| </script> |