diff options
Diffstat (limited to 'testing/web-platform/tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-function-name.html')
-rw-r--r-- | testing/web-platform/tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-function-name.html | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-function-name.html b/testing/web-platform/tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-function-name.html new file mode 100644 index 0000000000..167c30e8f3 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-function-name.html @@ -0,0 +1,45 @@ +<!doctype html> +<meta charset=utf-8> +<title>Cross-origin methods and accessors are created with correct 'name' property</title> +<link rel="help" href="https://html.spec.whatwg.org/multipage/browsers.html#crossorigingetownpropertyhelper-(-o,-p-)"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/get-host-info.sub.js"></script> +<script src="cross-origin-objects-function-common.js"></script> +<div id=log></div> +<script> +"use strict"; + +promise_test(async t => { + const w = await makeCrossOriginWindow(t); + for (const {key} of crossOriginWindowMethods) { + assert_equals(w[key].name, key, `w.${key} via [[Get]]`); + const desc = Object.getOwnPropertyDescriptor(w, key); + assert_equals(desc.value.name, key, `w.${key} via [[GetOwnProperty]]`); + } +}, "Cross-origin Window methods have correct 'name'"); + +promise_test(async t => { + const w = await makeCrossOriginWindow(t); + for (const {key} of crossOriginWindowAccessors) { + const desc = Object.getOwnPropertyDescriptor(w, key); + assert_equals(desc.get.name, `get ${key}`); + if (key === "location") { + assert_equals(desc.set.name, `set ${key}`); + } + } +}, "Cross-origin Window accessors have correct 'name'"); + +promise_test(async t => { + const w = await makeCrossOriginWindow(t); + assert_equals(w.location.replace.name, "replace"); + const desc = Object.getOwnPropertyDescriptor(w.location, "replace"); + assert_equals(desc.value.name, "replace"); +}, "Cross-origin Location `replace` method has correct 'name'"); + +promise_test(async t => { + const w = await makeCrossOriginWindow(t); + const desc = Object.getOwnPropertyDescriptor(w.location, "href"); + assert_equals(desc.set.name, "set href"); +}, "Cross-origin Location `href` setter has correct 'name'"); +</script> |