зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1698525 [wpt PR 28078] - v8bindings: Fix indexed/named set on named properties object, a=testonly
Automatic update from web-platform-tests v8bindings: Fix indexed/named set on named properties object V8 interceptor's setter doesn't fallback to definer automatically, so we have to define both of setter and definer interceptors if we'd like to forbid properties to be set/defined on a named properties object. https://github.com/heycam/webidl/pull/963 Change-Id: I5386ffaac06c2275fd847c7d47cec87054a138d6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2759574 Reviewed-by: Kentaro Hara <haraken@chromium.org> Commit-Queue: Yuki Shiino <yukishiino@chromium.org> Cr-Commit-Position: refs/heads/master@{#862830} -- wpt-commits: 398cdd520373bd27384419b6926be816637994e8 wpt-pr: 28078
This commit is contained in:
Родитель
400cc9b2f2
Коммит
7a7df916d2
|
@ -0,0 +1,33 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>named properties object</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://heycam.github.io/webidl/#named-properties-object">
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
test(() => {
|
||||
const npo = Object.getPrototypeOf(Window.prototype);
|
||||
|
||||
assert_equals(npo.nonExistingProp, undefined);
|
||||
assert_throws_js(TypeError, () => {
|
||||
const desc = Object.create(null);
|
||||
Object.defineProperty(npo, "nonExistingProp", desc);
|
||||
}, "Cannot define a property with Object.defineProperty (string)");
|
||||
assert_throws_js(TypeError, () => {
|
||||
npo.nonExistingProp = "peach";
|
||||
}, "Cannot create a property through assignment (string)");
|
||||
|
||||
assert_equals(npo[123], undefined);
|
||||
assert_throws_js(TypeError, () => {
|
||||
const desc = Object.create(null);
|
||||
Object.defineProperty(npo, 123, desc);
|
||||
}, "Cannot define a property with Object.defineProperty (index)");
|
||||
assert_throws_js(TypeError, () => {
|
||||
npo[123] = "peach";
|
||||
}, "Cannot create a property through assignment (index)");
|
||||
}, "Cannot create a property on a named property object");
|
||||
|
||||
</script>
|
Загрузка…
Ссылка в новой задаче