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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/dom/collections/HTMLCollection-supported-property-indices.html

Issue 2408083002: Revert of Import wpt@357b83b809e3cbc7a1805e7c3ca108a7980d782f (Closed)
Patch Set: Created 4 years, 2 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
1 <!doctype html> 1 <!doctype html>
2 <meta charset=utf-8> 2 <meta charset=utf-8>
3 <title></title> 3 <title></title>
4 <script src=/resources/testharness.js></script> 4 <script src=/resources/testharness.js></script>
5 <script src=/resources/testharnessreport.js></script> 5 <script src=/resources/testharnessreport.js></script>
6 <!-- We want to use a tag name that will not interact with our test harness, 6 <!-- We want to use a tag name that will not interact with our test harness,
7 so just make one up. "foo" is a good one --> 7 so just make one up. "foo" is a good one -->
8 8
9 <!-- Ids that look like negative indices. These should come first, so we can 9 <!-- Ids that look like negative indices. These should come first, so we can
10 assert that lookups for nonnegative indices find these by index --> 10 assert that lookups for nonnegative indices find these by index -->
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 assert_equals(collection.namedItem(4294967296), 90 assert_equals(collection.namedItem(4294967296),
91 document.getElementById("4294967296")); 91 document.getElementById("4294967296"));
92 assert_equals(collection.namedItem(4294967297), 92 assert_equals(collection.namedItem(4294967297),
93 document.getElementById("4294967297")); 93 document.getElementById("4294967297"));
94 assert_equals(collection[4294967293], undefined); 94 assert_equals(collection[4294967293], undefined);
95 assert_equals(collection[4294967294], undefined); 95 assert_equals(collection[4294967294], undefined);
96 assert_equals(collection[4294967295], document.getElementById("4294967295")); 96 assert_equals(collection[4294967295], document.getElementById("4294967295"));
97 assert_equals(collection[4294967296], document.getElementById("4294967296")); 97 assert_equals(collection[4294967296], document.getElementById("4294967296"));
98 assert_equals(collection[4294967297], document.getElementById("4294967297")); 98 assert_equals(collection[4294967297], document.getElementById("4294967297"));
99 }, "Handling of property names that look like integers around 2^32"); 99 }, "Handling of property names that look like integers around 2^32");
100
101 test(function() {
102 var elements = document.getElementsByTagName("foo");
103 var old_item = elements[0];
104 var old_desc = Object.getOwnPropertyDescriptor(elements, 0);
105 assert_equals(old_desc.value, old_item);
106 assert_true(old_desc.enumerable);
107 assert_true(old_desc.configurable);
108 assert_false(old_desc.writable);
109
110 elements[0] = 5;
111 assert_equals(elements[0], old_item);
112 assert_throws(new TypeError(), function() {
113 "use strict";
114 elements[0] = 5;
115 });
116 assert_throws(new TypeError(), function() {
117 Object.defineProperty(elements, 0, { value: 5 });
118 });
119
120 delete elements[0];
121 assert_equals(elements[0], old_item);
122
123 assert_throws(new TypeError(), function() {
124 "use strict";
125 delete elements[0];
126 });
127 assert_equals(elements[0], old_item);
128 }, 'Trying to set an expando that would shadow an already-existing indexed prope rty');
129
130 test(function() {
131 var elements = document.getElementsByTagName("foo");
132 var idx = elements.length;
133 var old_item = elements[idx];
134 var old_desc = Object.getOwnPropertyDescriptor(elements, idx);
135 assert_equals(old_item, undefined);
136 assert_equals(old_desc, undefined);
137
138 // [[DefineOwnProperty]] will disallow defining an indexed expando.
139 elements[idx] = 5;
140 assert_equals(elements[idx], undefined);
141 assert_throws(new TypeError(), function() {
142 "use strict";
143 elements[idx] = 5;
144 });
145 assert_throws(new TypeError(), function() {
146 Object.defineProperty(elements, idx, { value: 5 });
147 });
148
149 // Check that deletions out of range do not throw
150 delete elements[idx];
151 (function() {
152 "use strict";
153 delete elements[idx];
154 })();
155 }, 'Trying to set an expando with an indexed property name past the end of the l ist');
156
157 test(function(){
158 var elements = document.getElementsByTagName("foo");
159 var old_item = elements[0];
160 var old_desc = Object.getOwnPropertyDescriptor(elements, 0);
161 assert_equals(old_desc.value, old_item);
162 assert_true(old_desc.enumerable);
163 assert_true(old_desc.configurable);
164 assert_false(old_desc.writable);
165
166 Object.prototype[0] = 5;
167 this.add_cleanup(function () { delete Object.prototype[0]; });
168 assert_equals(elements[0], old_item);
169
170 delete elements[0];
171 assert_equals(elements[0], old_item);
172
173 assert_throws(new TypeError(), function() {
174 "use strict";
175 delete elements[0];
176 });
177 assert_equals(elements[0], old_item);
178 }, 'Trying to delete an indexed property name should never work');
179 </script> 100 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698