summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2019-06-08 17:32:46 -0400
committerGaming4JC <g4jc@hyperbola.info>2019-07-18 22:38:20 -0400
commit0bc46526909e579acf7f7dc5c59668fd79662437 (patch)
treeb8ef0dd37cc02cafdf4e6c31e33b22207d28a323 /testing/web-platform/tests/html
parentcefee262b7059d035667b148d56ebc7af5120d37 (diff)
downloadUXP-0bc46526909e579acf7f7dc5c59668fd79662437.tar
UXP-0bc46526909e579acf7f7dc5c59668fd79662437.tar.gz
UXP-0bc46526909e579acf7f7dc5c59668fd79662437.tar.lz
UXP-0bc46526909e579acf7f7dc5c59668fd79662437.tar.xz
UXP-0bc46526909e579acf7f7dc5c59668fd79662437.zip
1333045 - Update Location object properties to current spec.
Specifically, three changes: 1) valueOf should be non-enumerable. 2) valueOf should be === to Object.prototype.valueOf. 3) There should be no toJSON.
Diffstat (limited to 'testing/web-platform/tests/html')
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/location-stringifier.html13
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/location-symbol-toprimitive.html14
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/location-tojson.html13
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/location-valueof.html15
4 files changed, 55 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location-stringifier.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location-stringifier.html
index d23323b37..bde54b266 100644
--- a/testing/web-platform/tests/html/browsers/history/the-location-interface/location-stringifier.html
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location-stringifier.html
@@ -8,4 +8,17 @@
<div id=log></div>
<script>
test_stringifier_attribute(location, "href", true);
+
+test(function() {
+ const prop1 = Object.getOwnPropertyDescriptor(location, "toString"),
+ prop2 = Object.getOwnPropertyDescriptor(location, "href")
+
+ assert_true(prop1.enumerable)
+ assert_false(prop1.writable)
+ assert_false(prop1.configurable)
+
+ assert_true(prop2.enumerable)
+ assert_false(prop2.configurable)
+ assert_equals(typeof prop2.get, "function")
+})
</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location-symbol-toprimitive.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location-symbol-toprimitive.html
new file mode 100644
index 000000000..e666a3e70
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location-symbol-toprimitive.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<title>Location Symbol.toPrimitive</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<div id=log></div>
+<script>
+test(() => {
+ assert_equals(location[Symbol.toPrimitive], undefined)
+ const prop = Object.getOwnPropertyDescriptor(location, Symbol.toPrimitive)
+ assert_false(prop.enumerable)
+ assert_false(prop.writable)
+ assert_false(prop.configurable)
+})
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location-tojson.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location-tojson.html
new file mode 100644
index 000000000..5f20a6e15
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location-tojson.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<title>Location has no toJSON</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<div id=log></div>
+<script>
+test(() => {
+ assert_equals(location.toJSON, undefined)
+ assert_equals(Object.getOwnPropertyDescriptor(location, "toJSON"), undefined)
+ assert_false(location.hasOwnProperty("toJSON"))
+})
+</script>
+<!-- See https://github.com/whatwg/html/pull/2294 for context. (And the HTML Standard of course.) -->
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location-valueof.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location-valueof.html
new file mode 100644
index 000000000..978bbb63a
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location-valueof.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<title>Location valueOf</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<div id=log></div>
+<script>
+test(() => {
+ assert_equals(location.valueOf, Object.prototype.valueOf)
+ assert_equals(typeof location.valueOf.call(5), "object")
+ const prop = Object.getOwnPropertyDescriptor(location, "valueOf")
+ assert_false(prop.enumerable)
+ assert_false(prop.writable)
+ assert_false(prop.configurable)
+})
+</script>