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

Side by Side 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: Fixed typo. 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <meta charset="utf-8">
3 <title>Legacy platform objects</title>
4 <link rel="help" href="https://heycam.github.io/webidl/#es-legacy-platform-objec ts">
5 <script src="/resources/testharness.js"></script>
6 <script src="/resources/testharnessreport.js"></script>
7 <script>
8 // https://heycam.github.io/webidl/#legacy-platform-object-defineownproperty
9 // 3.9.3. [[DefineOwnProperty]]
10
11 test(function() {
12 let span = document.createElement("span");
13 // DOMTokenList supports an indexed property getter but not a setter.
14 let domTokenList = span.classList;
15 assert_throws(new TypeError(), () => {
16 Object.defineProperty(domTokenList, "0", {value: true, writable: true});
17 });
18 assert_throws(new TypeError(), () => {
19 Object.defineProperty(domTokenList, "0", {
20 get: () => {},
21 set: () => {},
22 });
23 });
24 assert_equals(domTokenList[0], undefined);
25 domTokenList[0] = true;
26 assert_equals(domTokenList[0], undefined);
27 assert_throws(new TypeError(), () => {
28 "use strict";
29 domTokenList[0] = true;
30 });
domenic 2017/07/05 20:12:26 Like below, it would be good to check that the pro
Yuki 2017/07/06 09:14:46 Done.
31 }, "Test [[DefineOwnProperty]] with no indexed property setter support.");
32
33 test(function() {
34 // HTMLSelectElement supports an indexed property setter.
35 let select = document.createElement("select");
36 assert_throws(new TypeError(), () => {
37 Object.defineProperty(select, "0", {
38 get: () => {},
39 set: () => {},
40 });
domenic 2017/07/05 20:12:26 You should also test the success case. In particul
Yuki 2017/07/06 09:14:46 Done.
41 });
42 }, "Test [[DefineOwnProperty]] with indexed property setter support.");
43 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/external/wpt/dom/collections/HTMLCollection-supported-property-indices-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698