Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(909)

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/WebIDL/ecmascript-binding/legacy-platform-object.html

Issue 2832923003: v8binding: Don't allow author script to define indexed accessor prop. (Closed)
Patch Set: Updated test expectations. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/external/wpt/WebIDL/ecmascript-binding/legacy-platform-object.html
diff --git a/third_party/WebKit/LayoutTests/external/wpt/WebIDL/ecmascript-binding/legacy-platform-object.html b/third_party/WebKit/LayoutTests/external/wpt/WebIDL/ecmascript-binding/legacy-platform-object.html
new file mode 100644
index 0000000000000000000000000000000000000000..9c767928d2b3934baebf4bf507e52e5ce1045411
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/WebIDL/ecmascript-binding/legacy-platform-object.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Legacy platform objects</title>
+<link rel="help" href="https://heycam.github.io/webidl/#es-legacy-platform-objects">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+// https://heycam.github.io/webidl/#legacy-platform-object-defineownproperty
+// 3.9.3. [[DefineOwnProperty]]
+
+test(function() {
+ let span = document.createElement("span");
+ // DOMTokenList supports an indexed property getter but not a setter.
+ let domTokenList = span.classList;
+ assert_throws(new TypeError(), () => {
+ Object.defineProperty(domTokenList, "0", {value: true, writable: true});
+ });
+ assert_throws(new TypeError(), () => {
+ Object.defineProperty(domTokenList, "0", {
+ get: () => {},
+ set: () => {},
+ });
+ });
+ assert_equals(domTokenList[0], undefined);
+ domTokenList[0] = true;
+ assert_equals(domTokenList[0], undefined);
+ assert_throws(new TypeError(), () => {
+ "use strict";
+ domTokenList[0] = true;
+ });
+}, "Test [[DefineOwnProperty]] with no indexed property setter support.");
+
+test(function() {
+ // HTMLSelectElement supports an indexed property setter.
+ let select = document.createElement("select");
+ assert_throws(new TypeError(), () => {
+ Object.defineProperty(select, "0", {
+ get: () => {},
+ set: () => {},
+ });
+ });
+}, "Test [[DefineOwnProperty]] with indexed property setter support.");
+</script>

Powered by Google App Engine
This is Rietveld 408576698