Bug 1622407 [wpt PR 6786] - Webidl legacy platform object tests, a=testonly
authorTobie Langel <tobie@unlockopen.com>
Sat, 14 Mar 2020 11:30:39 +0000
changeset 518868 f321fd5d5975e1a05abf16718c543e4c9d1678ee
parent 518867 976a2bd5b5b19b06acdab612bdbc8d68c43420ea
child 518869 2014080dbf937f7a20a88981ba0a90d535ec9308
push id37217
push userccoroiu@mozilla.com
push dateSun, 15 Mar 2020 21:37:59 +0000
treeherdermozilla-central@f9fc9427476e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1622407
milestone76.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1622407 [wpt PR 6786] - Webidl legacy platform object tests, a=testonly Automatic update from web-platform-tests Webidl legacy platform object tests (#6786) Co-authored-by: Tobie Langel <tobie@codespeaks.com> -- wpt-commits: 2f25e04b72f67b07001cb21a226f179342728f41 wpt-pr: 6786
testing/web-platform/tests/WebIDL/ecmascript-binding/legacy-platform-object.html
testing/web-platform/tests/WebIDL/ecmascript-binding/legacy-platform-object/DefineOwnProperty.html
testing/web-platform/tests/WebIDL/ecmascript-binding/legacy-platform-object/GetOwnProperty.html
testing/web-platform/tests/WebIDL/ecmascript-binding/legacy-platform-object/OwnPropertyKeys.html
testing/web-platform/tests/WebIDL/ecmascript-binding/legacy-platform-object/Set.html
testing/web-platform/tests/WebIDL/ecmascript-binding/legacy-platform-object/helper.js
deleted file mode 100644
--- a/testing/web-platform/tests/WebIDL/ecmascript-binding/legacy-platform-object.html
+++ /dev/null
@@ -1,191 +0,0 @@
-<!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>
-function assert_prop_desc_equals(object, property_key, expected) {
-  let actual = Object.getOwnPropertyDescriptor(object, property_key);
-  if (expected === undefined) {
-    assert_equals(
-        actual, undefined,
-        "(assert_prop_desc_equals: no property descriptor expected)");
-    return;
-  }
-  for (p in actual) {
-    assert_true(
-        expected.hasOwnProperty(p),
-        "(assert_prop_desc_equals: property '" + p + "' is not expected)");
-    assert_equals(
-        actual[p], expected[p],
-        "(assert_prop_desc_equals: property '" + p + "')");
-  }
-  for (p in expected) {
-    assert_true(
-        actual.hasOwnProperty(p),
-        "(assert_prop_desc_equals: expected property '" + p + "' missing)");
-  }
-}
-
-// https://heycam.github.io/webidl/#legacy-platform-object-getownproperty
-// https://heycam.github.io/webidl/#LegacyPlatformObjectGetOwnProperty
-
-test(function() {
-  // DOMTokenList has an indexed property getter, no indexed property setter
-  // and no named property handlers.
-  let div = document.createElement("div");
-  div.classList.add("baz", "quux");
-  const domTokenList = div.classList;
-  assert_prop_desc_equals(
-      domTokenList, "1",
-      {value: "quux", writable: false, enumerable: true, configurable: true},
-      "[[GetOwnProperty]] for indexed properties returns the right descriptor");
-  assert_prop_desc_equals(
-      domTokenList, "42", undefined,
-      "[[GetOwnProperty]] with invalid index returns undefined");
-  assert_array_equals(Object.keys(domTokenList), ["0", "1"]);
-  assert_array_equals(Object.values(domTokenList), ["baz", "quux"]);
-
-  // getElementsByTagName() returns an HTMLCollection.
-  // HTMLCollection has indexed and named property getters, no setters. Its IDL
-  // interface declaration has [LegacyUnenumerableNamedProperties] so its named
-  // properties are not enumerable.
-  let span1 = document.createElement("span");
-  span1.id = "foo";
-  let span2 = document.createElement("span");
-  span2.id = "bar";
-  document.head.appendChild(span1);
-  document.head.appendChild(span2);
-  const elementList = document.getElementsByTagName("span");
-  assert_prop_desc_equals(
-      elementList, "foo",
-      {value: span1, writable: false, enumerable: false, configurable: true},
-      "[[GetOwnProperty]] for named properties returns the right descriptor");
-  assert_prop_desc_equals(
-      elementList, "1",
-      {value: span2, writable: false, enumerable: true, configurable: true},
-      "[[GetOwnProperty]] for indexed properties returns the right descriptor");
-  assert_prop_desc_equals(
-      elementList, "unknown", undefined,
-      "[[GetOwnProperty]] with invalid property name returns undefined");
-  assert_array_equals(Object.keys(elementList), ["0", "1"]);
-  assert_array_equals(Object.values(elementList), [span1, span2]);
-}, "[[GetOwnProperty]] with getters and no setters");
-
-test(function() {
-  // DOMStringMap supports named property getters and setters, but not indexed
-  // properties.
-  let span = document.createElement("span");
-  span.dataset.foo = "bar";
-  assert_prop_desc_equals(
-      span.dataset, "foo",
-      {value: "bar", writable: true, enumerable: true, configurable: true},
-      "[[GetOwnProperty]] for named properties returns the right descriptor");
-  assert_prop_desc_equals(
-      span.dataset, "unknown", undefined,
-      "[[GetOwnProperty]] with invalid property name returns undefined");
-  assert_array_equals(Object.keys(span.dataset), ["foo"]);
-  assert_array_equals(Object.values(span.dataset), ["bar"]);
-}, "[[GetOwnProperty]] with named property getters and setters");
-
-test(function() {
-  // HTMLSelectElement has indexed property getters and setters, but no support
-  // for named properties.
-  let selectElement = document.createElement("select");
-  assert_prop_desc_equals(
-      selectElement, "0", undefined,
-      "[[GetOwnProperty]] with invalid property index returns undefined");
-  let optionElement = document.createElement("option");
-  selectElement.appendChild(optionElement);
-  assert_prop_desc_equals(
-      selectElement, "0",
-      {value: optionElement, writable: true, enumerable: true, configurable: true},
-      "[[GetOwnProperty]] for indexed properties returns the right descriptor");
-  assert_array_equals(Object.keys(selectElement), ["0"]);
-  assert_array_equals(Object.values(selectElement), [optionElement]);
-}, "[[GetOwnProperty]] with indexed property getters and setters");
-
-// https://heycam.github.io/webidl/#legacy-platform-object-defineownproperty
-// 3.9.3. [[DefineOwnProperty]]
-
-test(function() {
-  let span = document.createElement("span");
-  span.className = "foo";
-  // DOMTokenList supports an indexed property getter but not a setter.
-  let domTokenList = span.classList;
-  // Confirm the test settings.
-  assert_equals(domTokenList.length, 1);
-  assert_prop_desc_equals(domTokenList, "0",
-                          {value: "foo", writable: false, enumerable: true,
-                           configurable: true});
-  assert_prop_desc_equals(domTokenList, "1", undefined);
-  // Actual test
-  assert_throws_js(TypeError, () =>
-      Object.defineProperty(domTokenList, "0", {value: true, writable: true}));
-  assert_throws_js(TypeError, () =>
-      Object.defineProperty(domTokenList, "1", {value: true, writable: true}));
-  assert_throws_js(TypeError, () =>
-      Object.defineProperty(domTokenList, "0", {get: () => {}}));
-  assert_throws_js(TypeError, () =>
-      Object.defineProperty(domTokenList, "0", {set: () => {}}));
-  assert_throws_js(TypeError, () =>
-      Object.defineProperty(domTokenList, "1", {get: () => {}}));
-  assert_throws_js(TypeError, () =>
-      Object.defineProperty(domTokenList, "1", {set: () => {}}));
-  assert_equals(domTokenList[0], "foo");
-  assert_equals(domTokenList[1], undefined);
-  domTokenList[0] = "bar";
-  domTokenList[1] = "bar";
-  assert_equals(domTokenList[0], "foo");
-  assert_equals(domTokenList[1], undefined);
-  assert_throws_js(TypeError, () => {
-    "use strict";
-    domTokenList[0] = "bar";
-  });
-  assert_throws_js(TypeError, () => {
-    "use strict";
-    domTokenList[1] = "bar";
-  });
-  // Nothing must change after all.
-  assert_equals(domTokenList.length, 1);
-  assert_prop_desc_equals(domTokenList, "0",
-                          {value: "foo", writable: false, enumerable: true,
-                           configurable: true});
-  assert_prop_desc_equals(domTokenList, "1", undefined);
-}, "Test [[DefineOwnProperty]] with no indexed property setter support.");
-
-test(function() {
-  // HTMLSelectElement supports an indexed property setter.
-  let select = document.createElement("select");
-  let option0 = document.createElement("option");
-  let option1 = document.createElement("option");
-  // Confirm the test settings.
-  assert_equals(select.length, 0);
-  assert_prop_desc_equals(select, "0", undefined);
-  // Try to define an accessor property with non supported property index.
-  assert_throws_js(TypeError, () =>
-      Object.defineProperty(select, "0", {get: () => {}}));
-  assert_throws_js(TypeError, () =>
-      Object.defineProperty(select, "0", {set: () => {}}));
-  assert_prop_desc_equals(select, "0", undefined);
-  // writable, enumerable, configurable will be ignored.
-  Object.defineProperty(select, "0", {value: option0, writable: false,
-                                      enumerable: false, configurable: false});
-  assert_prop_desc_equals(select, "0",
-                          {value: option0, writable: true, enumerable: true,
-                           configurable: true});
-  select[1] = option1;
-  assert_prop_desc_equals(select, "1",
-                          {value: option1, writable: true, enumerable: true,
-                           configurable: true});
-  // Try to define an accessor property with a supported property index.
-  assert_throws_js(TypeError, () =>
-      Object.defineProperty(select, "0", {get: () => {}}));
-  assert_throws_js(TypeError, () =>
-      Object.defineProperty(select, "0", {set: () => {}}));
-  assert_prop_desc_equals(select, "0",
-                          {value: option0, writable: true, enumerable: true,
-                           configurable: true});
-}, "Test [[DefineOwnProperty]] with indexed property setter support.");
-</script>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/WebIDL/ecmascript-binding/legacy-platform-object/DefineOwnProperty.html
@@ -0,0 +1,89 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Legacy platform objects [[DefineOwnProperty]] method</title>
+<link rel="help" href="https://heycam.github.io/webidl/#legacy-platform-object-defineownproperty">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="./helper.js"></script>
+<script>
+
+test(function() {
+  let span = document.createElement("span");
+  span.className = "foo";
+  // DOMTokenList supports an indexed property getter but not a setter.
+  let domTokenList = span.classList;
+  // Confirm the test settings.
+  assert_equals(domTokenList.length, 1);
+  assert_prop_desc_equals(domTokenList, "0",
+                          {value: "foo", writable: false, enumerable: true,
+                           configurable: true});
+  assert_prop_desc_equals(domTokenList, "1", undefined);
+  // Actual test
+  assert_throws_js(TypeError, () =>
+      Object.defineProperty(domTokenList, "0", {value: true, writable: true}));
+  assert_throws_js(TypeError, () =>
+      Object.defineProperty(domTokenList, "1", {value: true, writable: true}));
+  assert_throws_js(TypeError, () =>
+      Object.defineProperty(domTokenList, "0", {get: () => {}}));
+  assert_throws_js(TypeError, () =>
+      Object.defineProperty(domTokenList, "0", {set: () => {}}));
+  assert_throws_js(TypeError, () =>
+      Object.defineProperty(domTokenList, "1", {get: () => {}}));
+  assert_throws_js(TypeError, () =>
+      Object.defineProperty(domTokenList, "1", {set: () => {}}));
+  assert_equals(domTokenList[0], "foo");
+  assert_equals(domTokenList[1], undefined);
+  domTokenList[0] = "bar";
+  domTokenList[1] = "bar";
+  assert_equals(domTokenList[0], "foo");
+  assert_equals(domTokenList[1], undefined);
+  assert_throws_js(TypeError, () => {
+    "use strict";
+    domTokenList[0] = "bar";
+  });
+  assert_throws_js(TypeError, () => {
+    "use strict";
+    domTokenList[1] = "bar";
+  });
+  // Nothing must change after all.
+  assert_equals(domTokenList.length, 1);
+  assert_prop_desc_equals(domTokenList, "0",
+                          {value: "foo", writable: false, enumerable: true,
+                           configurable: true});
+  assert_prop_desc_equals(domTokenList, "1", undefined);
+}, "Test [[DefineOwnProperty]] with no indexed property setter support.");
+
+test(function() {
+  // HTMLSelectElement supports an indexed property setter.
+  let select = document.createElement("select");
+  let option0 = document.createElement("option");
+  let option1 = document.createElement("option");
+  // Confirm the test settings.
+  assert_equals(select.length, 0);
+  assert_prop_desc_equals(select, "0", undefined);
+  // Try to define an accessor property with non supported property index.
+  assert_throws_js(TypeError, () =>
+      Object.defineProperty(select, "0", {get: () => {}}));
+  assert_throws_js(TypeError, () =>
+      Object.defineProperty(select, "0", {set: () => {}}));
+  assert_prop_desc_equals(select, "0", undefined);
+  // writable, enumerable, configurable will be ignored.
+  Object.defineProperty(select, "0", {value: option0, writable: false,
+                                      enumerable: false, configurable: false});
+  assert_prop_desc_equals(select, "0",
+                          {value: option0, writable: true, enumerable: true,
+                           configurable: true});
+  select[1] = option1;
+  assert_prop_desc_equals(select, "1",
+                          {value: option1, writable: true, enumerable: true,
+                           configurable: true});
+  // Try to define an accessor property with a supported property index.
+  assert_throws_js(TypeError, () =>
+      Object.defineProperty(select, "0", {get: () => {}}));
+  assert_throws_js(TypeError, () =>
+      Object.defineProperty(select, "0", {set: () => {}}));
+  assert_prop_desc_equals(select, "0",
+                          {value: option0, writable: true, enumerable: true,
+                           configurable: true});
+}, "Test [[DefineOwnProperty]] with indexed property setter support.");
+</script>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/WebIDL/ecmascript-binding/legacy-platform-object/GetOwnProperty.html
@@ -0,0 +1,84 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Legacy platform objects [[GetOwnProperty]] method</title>
+<link rel="help" href="https://heycam.github.io/webidl/#legacy-platform-object-getownproperty">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="./helper.js"></script>
+<script>
+
+test(function() {
+  // DOMTokenList has an indexed property getter, no indexed property setter
+  // and no named property handlers.
+  let div = document.createElement("div");
+  div.classList.add("baz", "quux");
+  const domTokenList = div.classList;
+  assert_prop_desc_equals(
+      domTokenList, "1",
+      {value: "quux", writable: false, enumerable: true, configurable: true},
+      "[[GetOwnProperty]] for indexed properties returns the right descriptor");
+  assert_prop_desc_equals(
+      domTokenList, "42", undefined,
+      "[[GetOwnProperty]] with invalid index returns undefined");
+  assert_array_equals(Object.keys(domTokenList), ["0", "1"]);
+  assert_array_equals(Object.values(domTokenList), ["baz", "quux"]);
+
+  // getElementsByTagName() returns an HTMLCollection.
+  // HTMLCollection has indexed and named property getters, no setters. Its IDL
+  // interface declaration has [LegacyUnenumerableNamedProperties] so its named
+  // properties are not enumerable.
+  let span1 = document.createElement("span");
+  span1.id = "foo";
+  let span2 = document.createElement("span");
+  span2.id = "bar";
+  document.head.appendChild(span1);
+  document.head.appendChild(span2);
+  const elementList = document.getElementsByTagName("span");
+  assert_prop_desc_equals(
+      elementList, "foo",
+      {value: span1, writable: false, enumerable: false, configurable: true},
+      "[[GetOwnProperty]] for named properties returns the right descriptor");
+  assert_prop_desc_equals(
+      elementList, "1",
+      {value: span2, writable: false, enumerable: true, configurable: true},
+      "[[GetOwnProperty]] for indexed properties returns the right descriptor");
+  assert_prop_desc_equals(
+      elementList, "unknown", undefined,
+      "[[GetOwnProperty]] with invalid property name returns undefined");
+  assert_array_equals(Object.keys(elementList), ["0", "1"]);
+  assert_array_equals(Object.values(elementList), [span1, span2]);
+}, "[[GetOwnProperty]] with getters and no setters");
+
+test(function() {
+  // DOMStringMap supports named property getters and setters, but not indexed
+  // properties.
+  let span = document.createElement("span");
+  span.dataset.foo = "bar";
+  assert_prop_desc_equals(
+      span.dataset, "foo",
+      {value: "bar", writable: true, enumerable: true, configurable: true},
+      "[[GetOwnProperty]] for named properties returns the right descriptor");
+  assert_prop_desc_equals(
+      span.dataset, "unknown", undefined,
+      "[[GetOwnProperty]] with invalid property name returns undefined");
+  assert_array_equals(Object.keys(span.dataset), ["foo"]);
+  assert_array_equals(Object.values(span.dataset), ["bar"]);
+}, "[[GetOwnProperty]] with named property getters and setters");
+
+test(function() {
+  // HTMLSelectElement has indexed property getters and setters, but no support
+  // for named properties.
+  let selectElement = document.createElement("select");
+  assert_prop_desc_equals(
+      selectElement, "0", undefined,
+      "[[GetOwnProperty]] with invalid property index returns undefined");
+  let optionElement = document.createElement("option");
+  selectElement.appendChild(optionElement);
+  assert_prop_desc_equals(
+      selectElement, "0",
+      {value: optionElement, writable: true, enumerable: true, configurable: true},
+      "[[GetOwnProperty]] for indexed properties returns the right descriptor");
+  assert_array_equals(Object.keys(selectElement), ["0"]);
+  assert_array_equals(Object.values(selectElement), [optionElement]);
+}, "[[GetOwnProperty]] with indexed property getters and setters");
+</script>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/WebIDL/ecmascript-binding/legacy-platform-object/OwnPropertyKeys.html
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Legacy platform objects [[OwnPropertyKeys]] method</title>
+<link rel="help" href="https://heycam.github.io/webidl/#legacy-platform-object-ownpropertykeys">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+    function custom_assert_array_equals(actual, expected, msg) {
+        function replacer(k, v) {
+          if (typeof v === "symbol") {
+            return v.toString();
+          }
+          return v;
+        }
+        assert_array_equals(actual, expected, " actual " + JSON.stringify(actual, replacer) + " expected " + JSON.stringify(expected, replacer));
+    }
+
+    test(function() {
+        var element = document.createElement("div");
+        element.appendChild(document.createElement("div"));
+        element.appendChild(document.createElement("div"));
+        element.appendChild(document.createElement("div"));
+        custom_assert_array_equals(Reflect.ownKeys(element.childNodes), ["0", "1", "2"]);
+    }, "must enumerate property indices in ascending numerical order");
+
+    test(function() {
+        var element = document.createElement("div");
+        element.setAttribute("data-foo", "foo content");
+        element.setAttribute("data-bar", "bar content");
+        element.setAttribute("data-baz", "baz content");
+        custom_assert_array_equals(Reflect.ownKeys(element.dataset), ["foo", "bar", "baz"]);
+    }, "must enumerate property names in list order");
+
+
+    test(function() {
+        var element = document.createElement("div");
+        element.setAttribute("id", "foo");
+        element.setAttribute("class", "bar");
+        custom_assert_array_equals(Reflect.ownKeys(element.attributes), ["0", "1", "id", "class"]);
+    }, "must first enumerate property indices in ascending numerical order, then named properties in list order");
+
+
+    test(function() {
+        var element = document.createElement("div");
+        element.attributes.foo = "some value";
+        element.attributes.bar = "and another";
+        element.setAttribute("id", "foo");
+        element.setAttribute("class", "bar");
+        custom_assert_array_equals(Reflect.ownKeys(element.attributes), ["0", "1", "id", "class", "foo", "bar"]);
+    }, "must enumerate own properties after indexed and named properties even when they're added first");
+
+    test(function() {
+        var symb1 = Symbol();
+        var symb2 = Symbol();
+        var element = document.createElement("div");
+        element.attributes.foo = "some value";
+        element.attributes[symb1] = "symb1";
+        element.attributes[symb2] = "symb2";
+        element.attributes.bar = "and another";
+        element.setAttribute("id", "foo");
+        element.setAttribute("class", "bar");
+        custom_assert_array_equals(Reflect.ownKeys(element.attributes),
+            ["0", "1", "id", "class", "foo", "bar", symb1, symb2]);
+    }, "must enumerate symbols after strings, regardless of which ones got added first");
+</script>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/WebIDL/ecmascript-binding/legacy-platform-object/Set.html
@@ -0,0 +1,79 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Legacy platform objects [[Set]] method</title>
+<link rel="help" href="https://heycam.github.io/webidl/#legacy-platform-object-set">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+    test(function() {
+        var element = document.createElement("div");
+        element.appendChild(document.createElement("div"));
+        element.childNodes["5"] = "foo";
+        assert_equals(element.childNodes["5"], undefined);
+    }, "must not set the property value when assigning to a numeric property on an object which implements an indexed property getter but not a setter when not in strict mode");
+
+    test(function() {
+        "use strict";
+        var element = document.createElement("div");
+        element.appendChild(document.createElement("div"));
+        assert_throws_js(TypeError, function() { element.childNodes["5"] = "foo"; });
+    }, "must throw when assigning to a numeric property on an object which implements a indexed property getter but not a setter in strict mode");
+
+    test(function() {
+        var element = document.createElement("div");
+        element.attributes.foo = "foo";
+        assert_equals(element.attributes.foo, "foo");
+    }, "must allow assigning to a named property on an object which implements a named property getter but not a setter when not in strict mode");
+
+    test(function() {
+        "use strict";
+        var element = document.createElement("div");
+        element.attributes.foo = "foo";
+        assert_equals(element.attributes.foo, "foo");
+    }, "must allow assigning to a named property on an object which implements a named property getter but not a setter in strict mode");
+
+    var symbol = Symbol();
+
+    test(function() {
+        var element = document.createElement("div");
+        element.appendChild(document.createElement("div"));
+        element.childNodes[symbol] = "foo";
+        assert_equals(element.childNodes[symbol], "foo");
+    }, "must allow assigning to a symbol property on an object which implements an indexed property getter but not a setter when not in strict mode");
+
+    test(function() {
+        "use strict";
+        var element = document.createElement("div");
+        element.appendChild(document.createElement("div"));
+        element.childNodes[symbol] = "foo";
+        assert_equals(element.childNodes[symbol], "foo");
+    }, "must allow assigning to a symbol property on an object which implements an indexed property getter but not a setter in strict mode");
+
+    test(function() {
+        var element = document.createElement("div");
+        element.attributes[symbol] = "foo";
+        assert_equals(element.attributes[symbol], "foo");
+    }, "must allow assigning to a symbol property on an object which implements indexed and named property getters but no setters when not in strict mode");
+
+    test(function() {
+        "use strict";
+        var element = document.createElement("div");
+        element.attributes[symbol] = "foo";
+        assert_equals(element.attributes[symbol], "foo");
+    }, "must allow assigning to a symbol property on an object which implements indexed and named property getters but no setters in strict mode");
+
+    test(function() {
+        sessionStorage.clear();
+        this.add_cleanup(function() { sessionStorage.clear(); });
+        sessionStorage[symbol] = "foo";
+        assert_equals(sessionStorage[symbol], "foo");
+    }, "must allow assigning to a symbol property on an object which implements indexed and named property getters and setters when not in strict mode");
+
+    test(function() {
+        "use strict";
+        sessionStorage.clear();
+        this.add_cleanup(function() { sessionStorage.clear(); });
+        sessionStorage[symbol] = "foo";
+        assert_equals(sessionStorage[symbol], "foo");
+    }, "must allow assigning to a symbol property on an object which implements indexed and named property getters and setters in strict mode");
+</script>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/WebIDL/ecmascript-binding/legacy-platform-object/helper.js
@@ -0,0 +1,22 @@
+function assert_prop_desc_equals(object, property_key, expected) {
+  let actual = Object.getOwnPropertyDescriptor(object, property_key);
+  if (expected === undefined) {
+    assert_equals(
+        actual, undefined,
+        "(assert_prop_desc_equals: no property descriptor expected)");
+    return;
+  }
+  for (p in actual) {
+    assert_true(
+        expected.hasOwnProperty(p),
+        "(assert_prop_desc_equals: property '" + p + "' is not expected)");
+    assert_equals(
+        actual[p], expected[p],
+        "(assert_prop_desc_equals: property '" + p + "')");
+  }
+  for (p in expected) {
+    assert_true(
+        actual.hasOwnProperty(p),
+        "(assert_prop_desc_equals: expected property '" + p + "' missing)");
+  }
+}