Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!doctype html>
<meta charset=utf-8>
<title>Cross-origin methods and accessors are created with correct 'name' property</title>
<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>