From 7f2cb14e3cd31200f4767185e7125884c5e348b5 Mon Sep 17 00:00:00 2001
From: crowlkats <13135287+crowlKats@users.noreply.github.com>
Date: Sat, 27 Mar 2021 11:04:28 +0000
Subject: [PATCH] Bug 1686602 [wpt PR 27176] - Use .window.js for webstorage
tests, a=testonly
Automatic update from web-platform-tests
Use .window.js for storage tests.
--
Reindent storage tests
--
wpt-commits: 314edf402162a6a96819bcd86463d50dcb28802d, a7ff355e88929913036932ed16598b4682541d59
wpt-pr: 27176
---
.../tests/webstorage/event_constructor.html | 81 ----------------------
.../tests/webstorage/event_constructor.window.js | 69 ++++++++++++++++++
.../tests/webstorage/event_initstorageevent.html | 72 -------------------
.../webstorage/event_initstorageevent.window.js | 60 ++++++++++++++++
.../tests/webstorage/missing_arguments.html | 29 --------
.../tests/webstorage/missing_arguments.window.js | 17 +++++
...ge_builtins.html => storage_builtins.window.js} | 8 ---
...{storage_clear.html => storage_clear.window.js} | 8 ---
..._enumerate.html => storage_enumerate.window.js} | 14 ----
...=> storage_functions_not_overwritten.window.js} | 14 ----
...rage_getitem.html => storage_getitem.window.js} | 8 ---
.../{storage_in.html => storage_in.window.js} | 8 ---
...ge_indexing.html => storage_indexing.window.js} | 8 ---
.../{storage_key.html => storage_key.window.js} | 8 ---
.../tests/webstorage/storage_key_empty_string.html | 20 ------
.../webstorage/storage_key_empty_string.window.js | 10 +++
...torage_length.html => storage_length.window.js} | 8 ---
.../storage_local_setitem_quotaexceedederr.html | 31 ---------
...torage_local_setitem_quotaexceedederr.window.js | 16 +++++
...en.html => storage_local_window_open.window.js} | 15 ----
...emoveitem.html => storage_removeitem.window.js} | 8 ---
.../storage_session_setitem_quotaexceedederr.html | 31 ---------
...rage_session_setitem_quotaexceedederr.window.js | 16 +++++
...l => storage_session_window_noopener.window.js} | 15 ----
....html => storage_session_window_open.window.js} | 15 ----
.../webstorage/storage_set_value_enumerate.html | 30 --------
.../storage_set_value_enumerate.window.js | 21 ++++++
...rage_setitem.html => storage_setitem.window.js} | 8 ---
...on.html => storage_string_conversion.window.js} | 14 ----
.../storage_supported_property_names.html | 23 ------
.../storage_supported_property_names.window.js | 15 ++++
31 files changed, 224 insertions(+), 476 deletions(-)
delete mode 100644 testing/web-platform/tests/webstorage/event_constructor.html
create mode 100644 testing/web-platform/tests/webstorage/event_constructor.window.js
delete mode 100644 testing/web-platform/tests/webstorage/event_initstorageevent.html
create mode 100644 testing/web-platform/tests/webstorage/event_initstorageevent.window.js
delete mode 100644 testing/web-platform/tests/webstorage/missing_arguments.html
create mode 100644 testing/web-platform/tests/webstorage/missing_arguments.window.js
rename testing/web-platform/tests/webstorage/{storage_builtins.html => storage_builtins.window.js} (78%)
rename testing/web-platform/tests/webstorage/{storage_clear.html => storage_clear.window.js} (71%)
rename testing/web-platform/tests/webstorage/{storage_enumerate.html => storage_enumerate.window.js} (88%)
rename testing/web-platform/tests/webstorage/{storage_functions_not_overwritten.html => storage_functions_not_overwritten.window.js} (82%)
rename testing/web-platform/tests/webstorage/{storage_getitem.html => storage_getitem.window.js} (87%)
rename testing/web-platform/tests/webstorage/{storage_in.html => storage_in.window.js} (75%)
rename testing/web-platform/tests/webstorage/{storage_indexing.html => storage_indexing.window.js} (81%)
rename testing/web-platform/tests/webstorage/{storage_key.html => storage_key.window.js} (87%)
delete mode 100644 testing/web-platform/tests/webstorage/storage_key_empty_string.html
create mode 100644 testing/web-platform/tests/webstorage/storage_key_empty_string.window.js
rename testing/web-platform/tests/webstorage/{storage_length.html => storage_length.window.js} (75%)
delete mode 100644 testing/web-platform/tests/webstorage/storage_local_setitem_quotaexceedederr.html
create mode 100644 testing/web-platform/tests/webstorage/storage_local_setitem_quotaexceedederr.window.js
rename testing/web-platform/tests/webstorage/{storage_local_window_open.html => storage_local_window_open.window.js} (67%)
rename testing/web-platform/tests/webstorage/{storage_removeitem.html => storage_removeitem.window.js} (85%)
delete mode 100644 testing/web-platform/tests/webstorage/storage_session_setitem_quotaexceedederr.html
create mode 100644 testing/web-platform/tests/webstorage/storage_session_setitem_quotaexceedederr.window.js
rename testing/web-platform/tests/webstorage/{storage_session_window_noopener.html => storage_session_window_noopener.window.js} (73%)
rename testing/web-platform/tests/webstorage/{storage_session_window_open.html => storage_session_window_open.window.js} (68%)
delete mode 100644 testing/web-platform/tests/webstorage/storage_set_value_enumerate.html
create mode 100644 testing/web-platform/tests/webstorage/storage_set_value_enumerate.window.js
rename testing/web-platform/tests/webstorage/{storage_setitem.html => storage_setitem.window.js} (96%)
rename testing/web-platform/tests/webstorage/{storage_string_conversion.html => storage_string_conversion.window.js} (78%)
delete mode 100644 testing/web-platform/tests/webstorage/storage_supported_property_names.html
create mode 100644 testing/web-platform/tests/webstorage/storage_supported_property_names.window.js
diff --git a/testing/web-platform/tests/webstorage/event_constructor.html b/testing/web-platform/tests/webstorage/event_constructor.html
deleted file mode 100644
index e0bb3f374f43..000000000000
--- a/testing/web-platform/tests/webstorage/event_constructor.html
+++ /dev/null
@@ -1,81 +0,0 @@
-
-
-
- WebStorage Test: StorageEvent - constructor
-
-
-
-
-
-
-
diff --git a/testing/web-platform/tests/webstorage/event_constructor.window.js b/testing/web-platform/tests/webstorage/event_constructor.window.js
new file mode 100644
index 000000000000..ba7dd919654e
--- /dev/null
+++ b/testing/web-platform/tests/webstorage/event_constructor.window.js
@@ -0,0 +1,69 @@
+test(function() {
+ assert_throws_js(TypeError, () => new StorageEvent());
+ // should be redundant, but .length can be wrong with custom bindings
+ assert_equals(StorageEvent.length, 1, 'StorageEvent.length');
+}, 'constructor with no arguments');
+
+test(function() {
+ var event = new StorageEvent('type');
+ assert_equals(event.type, 'type', 'type');
+ assert_equals(event.key, null, 'key');
+ assert_equals(event.oldValue, null, 'oldValue');
+ assert_equals(event.newValue, null, 'newValue');
+ assert_equals(event.url, '', 'url');
+ assert_equals(event.storageArea, null, 'storageArea');
+}, 'constructor with just type argument');
+
+test(function() {
+ assert_not_equals(localStorage, null, 'localStorage'); // precondition
+
+ var event = new StorageEvent('storage', {
+ bubbles: true,
+ cancelable: true,
+ key: 'key',
+ oldValue: 'oldValue',
+ newValue: 'newValue',
+ url: 'url', // not an absolute URL to ensure it isn't resolved
+ storageArea: localStorage
+ });
+ assert_equals(event.type, 'storage', 'type');
+ assert_equals(event.bubbles, true, 'bubbles');
+ assert_equals(event.cancelable, true, 'cancelable');
+ assert_equals(event.key, 'key', 'key');
+ assert_equals(event.oldValue, 'oldValue', 'oldValue');
+ assert_equals(event.newValue, 'newValue', 'newValue');
+ assert_equals(event.url, 'url', 'url');
+ assert_equals(event.storageArea, localStorage, 'storageArea');
+}, 'constructor with sensible type argument and members');
+
+test(function() {
+ var event = new StorageEvent(null, {
+ key: null,
+ oldValue: null,
+ newValue: null,
+ url: null,
+ storageArea: null
+ });
+ assert_equals(event.type, 'null', 'type');
+ assert_equals(event.key, null, 'key');
+ assert_equals(event.oldValue, null, 'oldValue');
+ assert_equals(event.newValue, null, 'newValue');
+ assert_equals(event.url, 'null', 'url');
+ assert_equals(event.storageArea, null, 'storageArea');
+}, 'constructor with null type argument and members');
+
+test(function() {
+ var event = new StorageEvent(undefined, {
+ key: undefined,
+ oldValue: undefined,
+ newValue: undefined,
+ url: undefined,
+ storageArea: undefined
+ });
+ assert_equals(event.type, 'undefined', 'type');
+ assert_equals(event.key, null, 'key');
+ assert_equals(event.oldValue, null, 'oldValue');
+ assert_equals(event.newValue, null, 'newValue');
+ assert_equals(event.url, '', 'url'); // not 'undefined'!
+ assert_equals(event.storageArea, null, 'storageArea');
+}, 'constructor with undefined type argument and members');
diff --git a/testing/web-platform/tests/webstorage/event_initstorageevent.html b/testing/web-platform/tests/webstorage/event_initstorageevent.html
deleted file mode 100644
index b06a01617a83..000000000000
--- a/testing/web-platform/tests/webstorage/event_initstorageevent.html
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-
- WebStorage Test: StorageEvent - initStorageEvent
-
-
-
-
-
-
-
diff --git a/testing/web-platform/tests/webstorage/event_initstorageevent.window.js b/testing/web-platform/tests/webstorage/event_initstorageevent.window.js
new file mode 100644
index 000000000000..ac0a75702106
--- /dev/null
+++ b/testing/web-platform/tests/webstorage/event_initstorageevent.window.js
@@ -0,0 +1,60 @@
+test(() => {
+ const event = new StorageEvent('storage');
+ assert_throws_js(TypeError, () => event.initStorageEvent());
+ // should be redundant, but .length can be wrong with custom bindings
+ assert_equals(event.initStorageEvent.length, 1, 'event.initStorageEvent.length');
+}, 'initStorageEvent with 0 arguments');
+
+test(() => {
+ const event = new StorageEvent('storage');
+ event.initStorageEvent('type');
+ assert_equals(event.type, 'type', 'event.type');
+ assert_equals(event.bubbles, false, 'event.bubbles');
+ assert_equals(event.cancelable, false, 'event.cancelable');
+ assert_equals(event.key, null, 'event.key');
+ assert_equals(event.oldValue, null, 'event.oldValue');
+ assert_equals(event.newValue, null, 'event.newValue');
+ assert_equals(event.url, '', 'event.url');
+ assert_equals(event.storageArea, null, 'event.storageArea');
+}, 'initStorageEvent with 1 argument');
+
+test(() => {
+ assert_not_equals(localStorage, null, 'localStorage'); // precondition
+
+ const event = new StorageEvent('storage');
+ event.initStorageEvent('type', true, true, 'key', 'oldValue', 'newValue', 'url', localStorage);
+ assert_equals(event.type, 'type', 'event.type');
+ assert_equals(event.bubbles, true, 'event.bubbles');
+ assert_equals(event.cancelable, true, 'event.cancelable');
+ assert_equals(event.key, 'key', 'event.key');
+ assert_equals(event.oldValue, 'oldValue', 'event.oldValue');
+ assert_equals(event.newValue, 'newValue', 'event.newValue');
+ assert_equals(event.url, 'url', 'event.url');
+ assert_equals(event.storageArea, localStorage, 'event.storageArea');
+}, 'initStorageEvent with 8 sensible arguments');
+
+test(() => {
+ const event = new StorageEvent('storage');
+ event.initStorageEvent(null, null, null, null, null, null, null, null);
+ assert_equals(event.type, 'null', 'event.type');
+ assert_equals(event.bubbles, false, 'event.bubbles');
+ assert_equals(event.cancelable, false, 'event.cancelable');
+ assert_equals(event.key, null, 'event.key');
+ assert_equals(event.oldValue, null, 'event.oldValue');
+ assert_equals(event.newValue, null, 'event.newValue');
+ assert_equals(event.url, 'null', 'event.url');
+ assert_equals(event.storageArea, null, 'event.storageArea');
+}, 'initStorageEvent with 8 null arguments');
+
+test(() => {
+ const event = new StorageEvent('storage');
+ event.initStorageEvent(undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
+ assert_equals(event.type, 'undefined', 'event.type');
+ assert_equals(event.bubbles, false, 'event.bubbles');
+ assert_equals(event.cancelable, false, 'event.cancelable');
+ assert_equals(event.key, null, 'event.key');
+ assert_equals(event.oldValue, null, 'event.oldValue');
+ assert_equals(event.newValue, null, 'event.newValue');
+ assert_equals(event.url, '', 'event.url');
+ assert_equals(event.storageArea, null, 'event.storageArea');
+}, 'initStorageEvent with 8 undefined arguments');
diff --git a/testing/web-platform/tests/webstorage/missing_arguments.html b/testing/web-platform/tests/webstorage/missing_arguments.html
deleted file mode 100644
index 1c8a1a448158..000000000000
--- a/testing/web-platform/tests/webstorage/missing_arguments.html
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
- WebStorage Test: missing arguments
-
-
-
-
-
-
-
diff --git a/testing/web-platform/tests/webstorage/missing_arguments.window.js b/testing/web-platform/tests/webstorage/missing_arguments.window.js
new file mode 100644
index 000000000000..2e41a22ec70c
--- /dev/null
+++ b/testing/web-platform/tests/webstorage/missing_arguments.window.js
@@ -0,0 +1,17 @@
+var tests = [
+ function() { localStorage.key(); },
+ function() { localStorage.getItem(); },
+ function() { localStorage.setItem(); },
+ function() { localStorage.setItem("a"); },
+ function() { localStorage.removeItem(); },
+ function() { sessionStorage.key(); },
+ function() { sessionStorage.getItem(); },
+ function() { sessionStorage.setItem(); },
+ function() { sessionStorage.setItem("a"); },
+ function() { sessionStorage.removeItem(); },
+];
+tests.forEach(function(fun) {
+ test(function() {
+ assert_throws_js(TypeError, fun);
+ }, "Should throw TypeError for " + format_value(fun) + ".");
+});
diff --git a/testing/web-platform/tests/webstorage/storage_builtins.html b/testing/web-platform/tests/webstorage/storage_builtins.window.js
similarity index 78%
rename from testing/web-platform/tests/webstorage/storage_builtins.html
rename to testing/web-platform/tests/webstorage/storage_builtins.window.js
index 2ae06d55b007..72bb90db2127 100644
--- a/testing/web-platform/tests/webstorage/storage_builtins.html
+++ b/testing/web-platform/tests/webstorage/storage_builtins.window.js
@@ -1,10 +1,3 @@
-
-
-WebStorage Test: Storage - builtins
-
-
-
-
diff --git a/testing/web-platform/tests/webstorage/storage_clear.html b/testing/web-platform/tests/webstorage/storage_clear.window.js
similarity index 71%
rename from testing/web-platform/tests/webstorage/storage_clear.html
rename to testing/web-platform/tests/webstorage/storage_clear.window.js
index 1d81f5391743..6f42bf85f7f1 100644
--- a/testing/web-platform/tests/webstorage/storage_clear.html
+++ b/testing/web-platform/tests/webstorage/storage_clear.window.js
@@ -1,10 +1,3 @@
-
-
-WebStorage Test: Storage - clear()
-
-
-
-
diff --git a/testing/web-platform/tests/webstorage/storage_enumerate.html b/testing/web-platform/tests/webstorage/storage_enumerate.window.js
similarity index 88%
rename from testing/web-platform/tests/webstorage/storage_enumerate.html
rename to testing/web-platform/tests/webstorage/storage_enumerate.window.js
index bc68ae656f03..fcc71e1c9e27 100644
--- a/testing/web-platform/tests/webstorage/storage_enumerate.html
+++ b/testing/web-platform/tests/webstorage/storage_enumerate.window.js
@@ -1,13 +1,3 @@
-
-
-
-WebStorage Test: Storage - enumerate and built-in properties
-
-
-
-
-
-
-
-
-
diff --git a/testing/web-platform/tests/webstorage/storage_functions_not_overwritten.html b/testing/web-platform/tests/webstorage/storage_functions_not_overwritten.window.js
similarity index 82%
rename from testing/web-platform/tests/webstorage/storage_functions_not_overwritten.html
rename to testing/web-platform/tests/webstorage/storage_functions_not_overwritten.window.js
index 47608b9864fb..693743de9016 100644
--- a/testing/web-platform/tests/webstorage/storage_functions_not_overwritten.html
+++ b/testing/web-platform/tests/webstorage/storage_functions_not_overwritten.window.js
@@ -1,13 +1,3 @@
-
-
-
-WebStorage Test: Storage - set key with the same name as storage function
-
-
-
-
-
-
-
-
-
diff --git a/testing/web-platform/tests/webstorage/storage_getitem.html b/testing/web-platform/tests/webstorage/storage_getitem.window.js
similarity index 87%
rename from testing/web-platform/tests/webstorage/storage_getitem.html
rename to testing/web-platform/tests/webstorage/storage_getitem.window.js
index b735b2eaf76b..8a5896836d2a 100644
--- a/testing/web-platform/tests/webstorage/storage_getitem.html
+++ b/testing/web-platform/tests/webstorage/storage_getitem.window.js
@@ -1,10 +1,3 @@
-
-
-WebStorage Test: Storage - getItem(key) and named getter
-
-
-
-
diff --git a/testing/web-platform/tests/webstorage/storage_in.html b/testing/web-platform/tests/webstorage/storage_in.window.js
similarity index 75%
rename from testing/web-platform/tests/webstorage/storage_in.html
rename to testing/web-platform/tests/webstorage/storage_in.window.js
index 8b336047c8a0..148285a1ebef 100644
--- a/testing/web-platform/tests/webstorage/storage_in.html
+++ b/testing/web-platform/tests/webstorage/storage_in.window.js
@@ -1,10 +1,3 @@
-
-
-WebStorage Test: Storage - in operator
-
-
-
-
diff --git a/testing/web-platform/tests/webstorage/storage_indexing.html b/testing/web-platform/tests/webstorage/storage_indexing.window.js
similarity index 81%
rename from testing/web-platform/tests/webstorage/storage_indexing.html
rename to testing/web-platform/tests/webstorage/storage_indexing.window.js
index 7bce1051437e..685b6b67fb9f 100644
--- a/testing/web-platform/tests/webstorage/storage_indexing.html
+++ b/testing/web-platform/tests/webstorage/storage_indexing.window.js
@@ -1,10 +1,3 @@
-
-
-WebStorage Test: Storage - indexed getter
-
-
-
-
diff --git a/testing/web-platform/tests/webstorage/storage_key.html b/testing/web-platform/tests/webstorage/storage_key.window.js
similarity index 87%
rename from testing/web-platform/tests/webstorage/storage_key.html
rename to testing/web-platform/tests/webstorage/storage_key.window.js
index c70b536fb07d..723f6563d783 100644
--- a/testing/web-platform/tests/webstorage/storage_key.html
+++ b/testing/web-platform/tests/webstorage/storage_key.window.js
@@ -1,10 +1,3 @@
-
-
-WebStorage Test: Storage - key(index)
-
-
-
-
diff --git a/testing/web-platform/tests/webstorage/storage_key_empty_string.html b/testing/web-platform/tests/webstorage/storage_key_empty_string.html
deleted file mode 100644
index 55e08df22a32..000000000000
--- a/testing/web-platform/tests/webstorage/storage_key_empty_string.html
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-WebStorage Test: Storage - key with empty string
-
-
-
-
-
-
diff --git a/testing/web-platform/tests/webstorage/storage_key_empty_string.window.js b/testing/web-platform/tests/webstorage/storage_key_empty_string.window.js
new file mode 100644
index 000000000000..c3d59c42b801
--- /dev/null
+++ b/testing/web-platform/tests/webstorage/storage_key_empty_string.window.js
@@ -0,0 +1,10 @@
+["localStorage", "sessionStorage"].forEach(function(name) {
+ test(function () {
+ var storage = window[name];
+ storage.clear();
+
+ storage.setItem("", "empty string");
+ assert_equals(storage.getItem(""), "empty string");
+
+ }, name + ".key with empty string");
+});
diff --git a/testing/web-platform/tests/webstorage/storage_length.html b/testing/web-platform/tests/webstorage/storage_length.window.js
similarity index 75%
rename from testing/web-platform/tests/webstorage/storage_length.html
rename to testing/web-platform/tests/webstorage/storage_length.window.js
index ecee6ec9b21d..9648e48c8d88 100644
--- a/testing/web-platform/tests/webstorage/storage_length.html
+++ b/testing/web-platform/tests/webstorage/storage_length.window.js
@@ -1,10 +1,3 @@
-
-
-WebStorage Test: Storage - length
-
-
-
-
diff --git a/testing/web-platform/tests/webstorage/storage_local_setitem_quotaexceedederr.html b/testing/web-platform/tests/webstorage/storage_local_setitem_quotaexceedederr.html
deleted file mode 100644
index b55ace2fa21f..000000000000
--- a/testing/web-platform/tests/webstorage/storage_local_setitem_quotaexceedederr.html
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
- WebStorage Test: localStorage - setItem throws QuotaExceededError
-
-
-
-
-
- storage_local_setItem_QUOTA_EXCEEDED_ERR
-
-
-
-
diff --git a/testing/web-platform/tests/webstorage/storage_local_setitem_quotaexceedederr.window.js b/testing/web-platform/tests/webstorage/storage_local_setitem_quotaexceedederr.window.js
new file mode 100644
index 000000000000..fff7d6444a03
--- /dev/null
+++ b/testing/web-platform/tests/webstorage/storage_local_setitem_quotaexceedederr.window.js
@@ -0,0 +1,16 @@
+test(function() {
+ localStorage.clear();
+
+ var index = 0;
+ var key = "name";
+ var val = "x".repeat(1024);
+
+ assert_throws_dom("QUOTA_EXCEEDED_ERR", function() {
+ while (true) {
+ index++;
+ localStorage.setItem("" + key + index, "" + val + index);
+ }
+ });
+
+ localStorage.clear();
+}, "Throws QuotaExceededError when the quota has been exceeded");
diff --git a/testing/web-platform/tests/webstorage/storage_local_window_open.html b/testing/web-platform/tests/webstorage/storage_local_window_open.window.js
similarity index 67%
rename from testing/web-platform/tests/webstorage/storage_local_window_open.html
rename to testing/web-platform/tests/webstorage/storage_local_window_open.window.js
index 867b3195911d..8c672894005c 100644
--- a/testing/web-platform/tests/webstorage/storage_local_window_open.html
+++ b/testing/web-platform/tests/webstorage/storage_local_window_open.window.js
@@ -1,14 +1,3 @@
-
-
-
-WebStorage Test: localStorage - open a existing browsing context
-
-
-
-
-
-
-
-
diff --git a/testing/web-platform/tests/webstorage/storage_removeitem.html b/testing/web-platform/tests/webstorage/storage_removeitem.window.js
similarity index 85%
rename from testing/web-platform/tests/webstorage/storage_removeitem.html
rename to testing/web-platform/tests/webstorage/storage_removeitem.window.js
index 58d66ec3751e..be3174a89b3e 100644
--- a/testing/web-platform/tests/webstorage/storage_removeitem.html
+++ b/testing/web-platform/tests/webstorage/storage_removeitem.window.js
@@ -1,10 +1,3 @@
-
-
-WebStorage Test: Storage - removeItem(key)
-
-
-
-
diff --git a/testing/web-platform/tests/webstorage/storage_session_setitem_quotaexceedederr.html b/testing/web-platform/tests/webstorage/storage_session_setitem_quotaexceedederr.html
deleted file mode 100644
index 7096c1610c7f..000000000000
--- a/testing/web-platform/tests/webstorage/storage_session_setitem_quotaexceedederr.html
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
- WebStorage Test: sessionStorage - setItem throws QuotaExceededError
-
-
-
-
-
- storage_session_setItem_QUOTA_EXCEEDED_ERR
-
-
-
-
diff --git a/testing/web-platform/tests/webstorage/storage_session_setitem_quotaexceedederr.window.js b/testing/web-platform/tests/webstorage/storage_session_setitem_quotaexceedederr.window.js
new file mode 100644
index 000000000000..42a895470efa
--- /dev/null
+++ b/testing/web-platform/tests/webstorage/storage_session_setitem_quotaexceedederr.window.js
@@ -0,0 +1,16 @@
+test(function() {
+ sessionStorage.clear();
+
+ var index = 0;
+ var key = "name";
+ var val = "x".repeat(1024);
+
+ assert_throws_dom("QUOTA_EXCEEDED_ERR", function() {
+ while (true) {
+ index++;
+ sessionStorage.setItem("" + key + index, "" + val + index);
+ }
+ });
+
+ sessionStorage.clear();
+}, "Throws QuotaExceededError when the quota has been exceeded");
diff --git a/testing/web-platform/tests/webstorage/storage_session_window_noopener.html b/testing/web-platform/tests/webstorage/storage_session_window_noopener.window.js
similarity index 73%
rename from testing/web-platform/tests/webstorage/storage_session_window_noopener.html
rename to testing/web-platform/tests/webstorage/storage_session_window_noopener.window.js
index 034402f5ef8c..fe131059d874 100644
--- a/testing/web-platform/tests/webstorage/storage_session_window_noopener.html
+++ b/testing/web-platform/tests/webstorage/storage_session_window_noopener.window.js
@@ -1,14 +1,3 @@
-
-
-
-WebStorage Test: sessionStorage - open a new window with noopener
-
-
-
-
-
-
-
-
diff --git a/testing/web-platform/tests/webstorage/storage_session_window_open.html b/testing/web-platform/tests/webstorage/storage_session_window_open.window.js
similarity index 68%
rename from testing/web-platform/tests/webstorage/storage_session_window_open.html
rename to testing/web-platform/tests/webstorage/storage_session_window_open.window.js
index b3e987e7f6f8..83d444701720 100644
--- a/testing/web-platform/tests/webstorage/storage_session_window_open.html
+++ b/testing/web-platform/tests/webstorage/storage_session_window_open.window.js
@@ -1,14 +1,3 @@
-
-
-
-WebStorage Test: sessionStorage - open a existing browsing context
-
-
-
-
-
-
-
-
diff --git a/testing/web-platform/tests/webstorage/storage_set_value_enumerate.html b/testing/web-platform/tests/webstorage/storage_set_value_enumerate.html
deleted file mode 100644
index fc53441a32a3..000000000000
--- a/testing/web-platform/tests/webstorage/storage_set_value_enumerate.html
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-WebStorage Test: Storage - set value with enumerate
-
-
-
-
-
-
diff --git a/testing/web-platform/tests/webstorage/storage_set_value_enumerate.window.js b/testing/web-platform/tests/webstorage/storage_set_value_enumerate.window.js
new file mode 100644
index 000000000000..09a55ad45480
--- /dev/null
+++ b/testing/web-platform/tests/webstorage/storage_set_value_enumerate.window.js
@@ -0,0 +1,21 @@
+var store_list = [
+ ["key0", "value0"],
+ ["key1", "value1"],
+ ["key2", "value2"]
+];
+["localStorage", "sessionStorage"].forEach(function(name) {
+ test(function () {
+ var storage = window[name];
+ storage.clear();
+
+ store_list.forEach(function(item) {
+ storage.setItem(item[0], item[1]);
+ });
+
+ for (var i = 0; i < store_list.length; i++) {
+ var value = storage.getItem("key" + i);
+ assert_equals(value, "value" + i);
+ }
+ }, "enumerate a " + name + " object with the key and get the values");
+});
+
diff --git a/testing/web-platform/tests/webstorage/storage_setitem.html b/testing/web-platform/tests/webstorage/storage_setitem.window.js
similarity index 96%
rename from testing/web-platform/tests/webstorage/storage_setitem.html
rename to testing/web-platform/tests/webstorage/storage_setitem.window.js
index be82df1ecdb0..97817da1d86b 100644
--- a/testing/web-platform/tests/webstorage/storage_setitem.html
+++ b/testing/web-platform/tests/webstorage/storage_setitem.window.js
@@ -1,10 +1,3 @@
-
-
-WebStorage Test: Storage - setItem(key, value)
-
-
-
-
diff --git a/testing/web-platform/tests/webstorage/storage_string_conversion.html b/testing/web-platform/tests/webstorage/storage_string_conversion.window.js
similarity index 78%
rename from testing/web-platform/tests/webstorage/storage_string_conversion.html
rename to testing/web-platform/tests/webstorage/storage_string_conversion.window.js
index c76eddfec3e6..51b07a3a38b8 100644
--- a/testing/web-platform/tests/webstorage/storage_string_conversion.html
+++ b/testing/web-platform/tests/webstorage/storage_string_conversion.window.js
@@ -1,13 +1,3 @@
-
-
-
-WebStorage Test: Storage only store strings
-
-
-
-
-
-
-
-
diff --git a/testing/web-platform/tests/webstorage/storage_supported_property_names.html b/testing/web-platform/tests/webstorage/storage_supported_property_names.html
deleted file mode 100644
index d2911d867fef..000000000000
--- a/testing/web-platform/tests/webstorage/storage_supported_property_names.html
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-Storage Test: Supported property names
-
-
-
-
diff --git a/testing/web-platform/tests/webstorage/storage_supported_property_names.window.js b/testing/web-platform/tests/webstorage/storage_supported_property_names.window.js
new file mode 100644
index 000000000000..08c5d77afc2d
--- /dev/null
+++ b/testing/web-platform/tests/webstorage/storage_supported_property_names.window.js
@@ -0,0 +1,15 @@
+["localStorage", "sessionStorage"].forEach(function(name) {
+ test(function() {
+ var storage = window[name];
+ storage.clear();
+
+ storage["name"] = "user1";
+ assert_array_equals(Object.getOwnPropertyNames(storage), ['name']);
+ }, "Object.getOwnPropertyNames on " + name + " Storage");
+
+ test(function() {
+ var storage = window[name];
+ storage.clear();
+ assert_array_equals(Object.getOwnPropertyNames(storage), []);
+ }, "Object.getOwnPropertyNames on " + name + " storage with empty collection");
+});
--
2.11.4.GIT