diff options
author | Moonchild <moonchild@palemoon.org> | 2021-02-25 01:03:57 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2021-02-25 01:03:57 +0000 |
commit | ceadffab6b357723981a429e11222daf6cd6dcfb (patch) | |
tree | 5603053048d6a460f79b22bdf165fb74d32d39b0 /testing/web-platform/tests/dom/collections | |
parent | 14fb2f966e9b54598c451e3cb35b4aa0480dafed (diff) | |
parent | ad5a13bd501e379517da1a944c104a11d951a3f5 (diff) | |
download | UXP-RC_20210225.tar UXP-RC_20210225.tar.gz UXP-RC_20210225.tar.lz UXP-RC_20210225.tar.xz UXP-RC_20210225.zip |
Merge branch 'master' into releaseRC_20210225
Diffstat (limited to 'testing/web-platform/tests/dom/collections')
6 files changed, 0 insertions, 476 deletions
diff --git a/testing/web-platform/tests/dom/collections/HTMLCollection-as-proto-length-get-throws.html b/testing/web-platform/tests/dom/collections/HTMLCollection-as-proto-length-get-throws.html deleted file mode 100644 index 225c9e61a..000000000 --- a/testing/web-platform/tests/dom/collections/HTMLCollection-as-proto-length-get-throws.html +++ /dev/null @@ -1,13 +0,0 @@ -<!doctype html> -<meta charset=utf-8> -<title>Make sure browsers throw when getting .length on some random object whose proto is an HTMLCollection</title> -<script src=/resources/testharness.js></script> -<script src=/resources/testharnessreport.js></script> -<script> -test(function() { - var obj = Object.create(document.getElementsByTagName("script")); - assert_throws(new TypeError(), function() { - obj.length; - }); -}, "HTMLcollection as a prototype should not allow getting .length on the base object") -</script> diff --git a/testing/web-platform/tests/dom/collections/HTMLCollection-empty-name.html b/testing/web-platform/tests/dom/collections/HTMLCollection-empty-name.html deleted file mode 100644 index 4fc34db7f..000000000 --- a/testing/web-platform/tests/dom/collections/HTMLCollection-empty-name.html +++ /dev/null @@ -1,65 +0,0 @@ -<!doctype html> -<meta charset=utf-8> -<title>HTMLCollection and empty names</title> -<script src=/resources/testharness.js></script> -<script src=/resources/testharnessreport.js></script> -<div id=log></div> -<div id=test> -<div class=a id></div> -<div class=a name></div> -<a class=a name></a> -</div> -<script> -test(function() { - var c = document.getElementsByTagName("*"); - assert_false("" in c, "Empty string should not be in the collection."); - assert_equals(c[""], undefined, "Named getter should return undefined for empty string."); - assert_equals(c.namedItem(""), null, "namedItem should return null for empty string."); -}, "Empty string as a name for Document.getElementsByTagName"); - -test(function() { - var div = document.getElementById("test"); - var c = div.getElementsByTagName("*"); - assert_false("" in c, "Empty string should not be in the collection."); - assert_equals(c[""], undefined, "Named getter should return undefined for empty string."); - assert_equals(c.namedItem(""), null, "namedItem should return null for empty string."); -}, "Empty string as a name for Element.getElementsByTagName"); - -test(function() { - var c = document.getElementsByTagNameNS("http://www.w3.org/1999/xhtml", "a"); - assert_false("" in c, "Empty string should not be in the collection."); - assert_equals(c[""], undefined, "Named getter should return undefined for empty string."); - assert_equals(c.namedItem(""), null, "namedItem should return null for empty string."); -}, "Empty string as a name for Document.getElementsByTagNameNS"); - -test(function() { - var div = document.getElementById("test"); - var c = div.getElementsByTagNameNS("http://www.w3.org/1999/xhtml", "a"); - assert_false("" in c, "Empty string should not be in the collection."); - assert_equals(c[""], undefined, "Named getter should return undefined for empty string."); - assert_equals(c.namedItem(""), null, "namedItem should return null for empty string."); -}, "Empty string as a name for Element.getElementsByTagNameNS"); - -test(function() { - var c = document.getElementsByClassName("a"); - assert_false("" in c, "Empty string should not be in the collection."); - assert_equals(c[""], undefined, "Named getter should return undefined for empty string."); - assert_equals(c.namedItem(""), null, "namedItem should return null for empty string."); -}, "Empty string as a name for Document.getElementsByClassName"); - -test(function() { - var div = document.getElementById("test"); - var c = div.getElementsByClassName("a"); - assert_false("" in c, "Empty string should not be in the collection."); - assert_equals(c[""], undefined, "Named getter should return undefined for empty string."); - assert_equals(c.namedItem(""), null, "namedItem should return null for empty string."); -}, "Empty string as a name for Element.getElementsByClassName"); - -test(function() { - var div = document.getElementById("test"); - var c = div.children; - assert_false("" in c, "Empty string should not be in the collection."); - assert_equals(c[""], undefined, "Named getter should return undefined for empty string."); - assert_equals(c.namedItem(""), null, "namedItem should return null for empty string."); -}, "Empty string as a name for Element.children"); -</script> diff --git a/testing/web-platform/tests/dom/collections/HTMLCollection-supported-property-indices.html b/testing/web-platform/tests/dom/collections/HTMLCollection-supported-property-indices.html deleted file mode 100644 index 62ee6bb6a..000000000 --- a/testing/web-platform/tests/dom/collections/HTMLCollection-supported-property-indices.html +++ /dev/null @@ -1,179 +0,0 @@ -<!doctype html> -<meta charset=utf-8> -<title></title> -<script src=/resources/testharness.js></script> -<script src=/resources/testharnessreport.js></script> -<!-- We want to use a tag name that will not interact with our test harness, - so just make one up. "foo" is a good one --> - -<!-- Ids that look like negative indices. These should come first, so we can - assert that lookups for nonnegative indices find these by index --> -<foo id="-2"></foo> -<foo id="-1"></foo> - -<!-- Ids that look like nonnegative indices --> -<foo id="0"></foo> -<foo id="1"></foo> - -<!-- Ids that look like nonnegative indices near 2^31 = 2147483648 --> -<foo id="2147483645"></foo> <!-- 2^31 - 3 --> -<foo id="2147483646"></foo> <!-- 2^31 - 2 --> -<foo id="2147483647"></foo> <!-- 2^31 - 1 --> -<foo id="2147483648"></foo> <!-- 2^31 --> -<foo id="2147483649"></foo> <!-- 2^31 + 1 --> - -<!-- Ids that look like nonnegative indices near 2^32 = 4294967296 --> -<foo id="4294967293"></foo> <!-- 2^32 - 3 --> -<foo id="4294967294"></foo> <!-- 2^32 - 2 --> -<foo id="4294967295"></foo> <!-- 2^32 - 1 --> -<foo id="4294967296"></foo> <!-- 2^32 --> -<foo id="4294967297"></foo> <!-- 2^32 + 1 --> - -<script> -test(function() { - var collection = document.getElementsByTagName("foo"); - assert_equals(collection.item(-2), null); - assert_equals(collection.item(-1), null); - assert_equals(collection.namedItem(-2), document.getElementById("-2")); - assert_equals(collection.namedItem(-1), document.getElementById("-1")); - assert_equals(collection[-2], document.getElementById("-2")); - assert_equals(collection[-1], document.getElementById("-1")); -}, "Handling of property names that look like negative integers"); - -test(function() { - var collection = document.getElementsByTagName("foo"); - assert_equals(collection.item(0), document.getElementById("-2")); - assert_equals(collection.item(1), document.getElementById("-1")); - assert_equals(collection.namedItem(0), document.getElementById("0")); - assert_equals(collection.namedItem(1), document.getElementById("1")); - assert_equals(collection[0], document.getElementById("-2")); - assert_equals(collection[1], document.getElementById("-1")); -}, "Handling of property names that look like small nonnegative integers"); - -test(function() { - var collection = document.getElementsByTagName("foo"); - assert_equals(collection.item(2147483645), null); - assert_equals(collection.item(2147483646), null); - assert_equals(collection.item(2147483647), null); - assert_equals(collection.item(2147483648), null); - assert_equals(collection.item(2147483649), null); - assert_equals(collection.namedItem(2147483645), - document.getElementById("2147483645")); - assert_equals(collection.namedItem(2147483646), - document.getElementById("2147483646")); - assert_equals(collection.namedItem(2147483647), - document.getElementById("2147483647")); - assert_equals(collection.namedItem(2147483648), - document.getElementById("2147483648")); - assert_equals(collection.namedItem(2147483649), - document.getElementById("2147483649")); - assert_equals(collection[2147483645], undefined); - assert_equals(collection[2147483646], undefined); - assert_equals(collection[2147483647], undefined); - assert_equals(collection[2147483648], undefined); - assert_equals(collection[2147483649], undefined); -}, "Handling of property names that look like integers around 2^31"); - -test(function() { - var collection = document.getElementsByTagName("foo"); - assert_equals(collection.item(4294967293), null); - assert_equals(collection.item(4294967294), null); - assert_equals(collection.item(4294967295), null); - assert_equals(collection.item(4294967296), document.getElementById("-2")); - assert_equals(collection.item(4294967297), document.getElementById("-1")); - assert_equals(collection.namedItem(4294967293), - document.getElementById("4294967293")); - assert_equals(collection.namedItem(4294967294), - document.getElementById("4294967294")); - assert_equals(collection.namedItem(4294967295), - document.getElementById("4294967295")); - assert_equals(collection.namedItem(4294967296), - document.getElementById("4294967296")); - assert_equals(collection.namedItem(4294967297), - document.getElementById("4294967297")); - assert_equals(collection[4294967293], undefined); - assert_equals(collection[4294967294], undefined); - assert_equals(collection[4294967295], document.getElementById("4294967295")); - assert_equals(collection[4294967296], document.getElementById("4294967296")); - assert_equals(collection[4294967297], document.getElementById("4294967297")); -}, "Handling of property names that look like integers around 2^32"); - -test(function() { - var elements = document.getElementsByTagName("foo"); - var old_item = elements[0]; - var old_desc = Object.getOwnPropertyDescriptor(elements, 0); - assert_equals(old_desc.value, old_item); - assert_true(old_desc.enumerable); - assert_true(old_desc.configurable); - assert_false(old_desc.writable); - - elements[0] = 5; - assert_equals(elements[0], old_item); - assert_throws(new TypeError(), function() { - "use strict"; - elements[0] = 5; - }); - assert_throws(new TypeError(), function() { - Object.defineProperty(elements, 0, { value: 5 }); - }); - - delete elements[0]; - assert_equals(elements[0], old_item); - - assert_throws(new TypeError(), function() { - "use strict"; - delete elements[0]; - }); - assert_equals(elements[0], old_item); -}, 'Trying to set an expando that would shadow an already-existing indexed property'); - -test(function() { - var elements = document.getElementsByTagName("foo"); - var idx = elements.length; - var old_item = elements[idx]; - var old_desc = Object.getOwnPropertyDescriptor(elements, idx); - assert_equals(old_item, undefined); - assert_equals(old_desc, undefined); - - // [[DefineOwnProperty]] will disallow defining an indexed expando. - elements[idx] = 5; - assert_equals(elements[idx], undefined); - assert_throws(new TypeError(), function() { - "use strict"; - elements[idx] = 5; - }); - assert_throws(new TypeError(), function() { - Object.defineProperty(elements, idx, { value: 5 }); - }); - - // Check that deletions out of range do not throw - delete elements[idx]; - (function() { - "use strict"; - delete elements[idx]; - })(); -}, 'Trying to set an expando with an indexed property name past the end of the list'); - -test(function(){ - var elements = document.getElementsByTagName("foo"); - var old_item = elements[0]; - var old_desc = Object.getOwnPropertyDescriptor(elements, 0); - assert_equals(old_desc.value, old_item); - assert_true(old_desc.enumerable); - assert_true(old_desc.configurable); - assert_false(old_desc.writable); - - Object.prototype[0] = 5; - this.add_cleanup(function () { delete Object.prototype[0]; }); - assert_equals(elements[0], old_item); - - delete elements[0]; - assert_equals(elements[0], old_item); - - assert_throws(new TypeError(), function() { - "use strict"; - delete elements[0]; - }); - assert_equals(elements[0], old_item); -}, 'Trying to delete an indexed property name should never work'); -</script> diff --git a/testing/web-platform/tests/dom/collections/HTMLCollection-supported-property-names.html b/testing/web-platform/tests/dom/collections/HTMLCollection-supported-property-names.html deleted file mode 100644 index 0a9df1ad6..000000000 --- a/testing/web-platform/tests/dom/collections/HTMLCollection-supported-property-names.html +++ /dev/null @@ -1,135 +0,0 @@ -<!doctype html> -<meta charset=utf-8> -<link rel=help href=https://dom.spec.whatwg.org/#interface-htmlcollection> -<script src=/resources/testharness.js></script> -<script src=/resources/testharnessreport.js></script> - -<div id=log></div> - -<!-- with no attribute --> -<span></span> - -<!-- with `id` attribute --> -<span id=''></span> -<span id='some-id'></span> -<span id='some-id'></span><!-- to ensure no duplicates --> - -<!-- with `name` attribute --> -<span name=''></span> -<span name='some-name'></span> -<span name='some-name'></span><!-- to ensure no duplicates --> - -<!-- with `name` and `id` attribute --> -<span id='another-id' name='another-name'></span> - -<script> -test(function () { - var elements = document.getElementsByTagName("span"); - assert_array_equals( - Object.getOwnPropertyNames(elements), - ['0', '1', '2', '3', '4', '5', '6', '7', 'some-id', 'some-name', 'another-id', 'another-name'] - ); -}, 'Object.getOwnPropertyNames on HTMLCollection'); - -test(function () { - var elem = document.createElementNS('some-random-namespace', 'foo'); - this.add_cleanup(function () {elem.remove();}); - elem.setAttribute("name", "some-name"); - document.body.appendChild(elem); - - var elements = document.getElementsByTagName("foo"); - assert_array_equals(Object.getOwnPropertyNames(elements), ['0']); -}, 'Object.getOwnPropertyNames on HTMLCollection with non-HTML namespace'); - -test(function () { - var elem = document.createElement('foo'); - this.add_cleanup(function () {elem.remove();}); - document.body.appendChild(elem); - - var elements = document.getElementsByTagName("foo"); - elements.someProperty = "some value"; - - assert_array_equals(Object.getOwnPropertyNames(elements), ['0', 'someProperty']); -}, 'Object.getOwnPropertyNames on HTMLCollection with expando object'); - -test(function() { - var elements = document.getElementsByTagName("span"); - var old_item = elements["some-id"]; - var old_desc = Object.getOwnPropertyDescriptor(elements, "some-id"); - assert_equals(old_desc.value, old_item); - assert_false(old_desc.enumerable); - assert_true(old_desc.configurable); - assert_false(old_desc.writable); - - elements["some-id"] = 5; - assert_equals(elements["some-id"], old_item); - assert_throws(new TypeError(), function() { - "use strict"; - elements["some-id"] = 5; - }); - assert_throws(new TypeError(), function() { - Object.defineProperty(elements, "some-id", { value: 5 }); - }); - - delete elements["some-id"]; - assert_equals(elements["some-id"], old_item); - - assert_throws(new TypeError(), function() { - "use strict"; - delete elements["some-id"]; - }); - assert_equals(elements["some-id"], old_item); - -}, 'Trying to set an expando that would shadow an already-existing named property'); - -test(function() { - var elements = document.getElementsByTagName("span"); - var old_item = elements["new-id"]; - var old_desc = Object.getOwnPropertyDescriptor(elements, "new-id"); - assert_equals(old_item, undefined); - assert_equals(old_desc, undefined); - - elements["new-id"] = 5; - assert_equals(elements["new-id"], 5); - - var span = document.createElement("span"); - this.add_cleanup(function () {span.remove();}); - span.id = "new-id"; - document.body.appendChild(span); - - assert_equals(elements.namedItem("new-id"), span); - assert_equals(elements["new-id"], 5); - - delete elements["new-id"]; - assert_equals(elements["new-id"], span); -}, 'Trying to set an expando that shadows a named property that gets added later'); - -test(function() { - var elements = document.getElementsByTagName("span"); - var old_item = elements["new-id2"]; - var old_desc = Object.getOwnPropertyDescriptor(elements, "new-id2"); - assert_equals(old_item, undefined); - assert_equals(old_desc, undefined); - - Object.defineProperty(elements, "new-id2", { configurable: false, writable: - false, value: 5 }); - assert_equals(elements["new-id2"], 5); - - var span = document.createElement("span"); - this.add_cleanup(function () {span.remove();}); - span.id = "new-id2"; - document.body.appendChild(span); - - assert_equals(elements.namedItem("new-id2"), span); - assert_equals(elements["new-id2"], 5); - - delete elements["new-id2"]; - assert_equals(elements["new-id2"], 5); - - assert_throws(new TypeError(), function() { - "use strict"; - delete elements["new-id2"]; - }); - assert_equals(elements["new-id2"], 5); -}, 'Trying to set a non-configurable expando that shadows a named property that gets added later'); -</script> diff --git a/testing/web-platform/tests/dom/collections/domstringmap-supported-property-names.html b/testing/web-platform/tests/dom/collections/domstringmap-supported-property-names.html deleted file mode 100644 index 430aa44c3..000000000 --- a/testing/web-platform/tests/dom/collections/domstringmap-supported-property-names.html +++ /dev/null @@ -1,54 +0,0 @@ -<!DOCTYPE HTML> -<meta charset=utf-8> -<title>DOMStringMap Test: Supported property names</title> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<div id="log"></div> - -<div id="edge1" data-="012">Simple</div> - -<div id="edge2" data-id-="012">Simple</div> - -<div id="user" data-id="1234567890" data-user="johndoe" data-date-of-birth> - John Doe -</div> - -<div id="user2" data-unique-id="1234567890"> Jane Doe </div> - -<div id="user3" data-unique-id="4324324241"> Jim Doe </div> - -<script> - -test(function() { - var element = document.querySelector('#edge1'); - assert_array_equals(Object.getOwnPropertyNames(element.dataset), - [""]); -}, "Object.getOwnPropertyNames on DOMStringMap, empty data attribute"); - -test(function() { - var element = document.querySelector('#edge2'); - assert_array_equals(Object.getOwnPropertyNames(element.dataset), - ["id-"]); -}, "Object.getOwnPropertyNames on DOMStringMap, data attribute trailing hyphen"); - -test(function() { - var element = document.querySelector('#user'); - assert_array_equals(Object.getOwnPropertyNames(element.dataset), - ['id', 'user', 'dateOfBirth']); -}, "Object.getOwnPropertyNames on DOMStringMap, multiple data attributes"); - -test(function() { - var element = document.querySelector('#user2'); - element.dataset.middleName = "mark"; - assert_array_equals(Object.getOwnPropertyNames(element.dataset), - ['uniqueId', 'middleName']); -}, "Object.getOwnPropertyNames on DOMStringMap, attribute set on dataset in JS"); - -test(function() { - var element = document.querySelector('#user3'); - element.setAttribute("data-age", 30); - assert_array_equals(Object.getOwnPropertyNames(element.dataset), - ['uniqueId', 'age']); -}, "Object.getOwnPropertyNames on DOMStringMap, attribute set on element in JS"); - -</script> diff --git a/testing/web-platform/tests/dom/collections/namednodemap-supported-property-names.html b/testing/web-platform/tests/dom/collections/namednodemap-supported-property-names.html deleted file mode 100644 index 2c5dee4ef..000000000 --- a/testing/web-platform/tests/dom/collections/namednodemap-supported-property-names.html +++ /dev/null @@ -1,30 +0,0 @@ -<!DOCTYPE HTML> -<meta charset=utf-8> -<title>NamedNodeMap Test: Supported property names</title> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<div id="log"></div> -<div id="simple" class="fancy">Simple</div> -<input id="result" type="text" value="" width="200px"> -<script> - -test(function() { - var elt = document.querySelector('#simple'); - assert_array_equals(Object.getOwnPropertyNames(elt.attributes), - ['0','1','id','class']); -}, "Object.getOwnPropertyNames on NamedNodeMap"); - -test(function() { - var result = document.getElementById("result"); - assert_array_equals(Object.getOwnPropertyNames(result.attributes), - ['0','1','2','3','id','type','value','width']); -}, "Object.getOwnPropertyNames on NamedNodeMap of input"); - -test(function() { - var result = document.getElementById("result"); - result.removeAttribute("width"); - assert_array_equals(Object.getOwnPropertyNames(result.attributes), - ['0','1','2','id','type','value']); -}, "Object.getOwnPropertyNames on NamedNodeMap after attribute removal"); - -</script>
\ No newline at end of file |