Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<meta charset="utf-8">
<title>Same-origin Location objects have non-configurable "toString" and "valueOf" properties</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
"use strict";
test(() => {
assert_own_property(location, "toString");
const origToString = location.toString;
assert_throws_js(TypeError, () => {
Object.defineProperty(location, "toString", {
get() {},
set(_v) {},
enumerable: true,
configurable: true,
});
});
assert_equals(location.toString, origToString);
}, "'toString' redefinition with accessor fails");
test(() => {
assert_own_property(location, "valueOf");
const origValueOf = location.valueOf;
assert_throws_js(TypeError, () => {
Object.defineProperty(location, "valueOf", {
get() {},
enumerable: false,
configurable: true,
});
});
assert_equals(location.valueOf, origValueOf);
}, "'valueOf' redefinition with accessor fails");
</script>