summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/the-window-object/open-close
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /testing/web-platform/tests/html/browsers/the-window-object/open-close
parentInitial commit. (diff)
downloadthunderbird-upstream.tar.xz
thunderbird-upstream.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/browsers/the-window-object/open-close')
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/callback.js1
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/close_beforeunload-1.html7
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/close_beforeunload.html16
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/close_script_defer-1.html1
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/close_script_defer.html18
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/close_unload-1.html7
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/close_unload.html16
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/creating_browsing_context_test_01.html39
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/no_window_open_when_term_nesting_level_nonzero.window.js113
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/non_automated/001-1.html2
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/non_automated/001-2.html16
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/non_automated/001.html3
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/non_automated/002-1.html8
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/non_automated/002-2.html16
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/non_automated/002.html3
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-is-popup-condition.html149
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-negative-innerwidth-innerheight.html75
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-negative-screenx-screeny.html67
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-negative-top-left.html68
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-negative-width-height.html75
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-height.html91
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-innerheight.html76
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-innerwidth.html75
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-left.html76
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-screenx.html75
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-screeny.html76
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-top.html73
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-width.html91
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-tokenization-innerheight-innerwidth.html55
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-tokenization-noopener.html11
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-tokenization-noreferrer.html11
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-tokenization-screenx-screeny.html55
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-tokenization-top-left.html69
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-tokenization-width-height.html71
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/resources/close-self.html3
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/resources/is-popup-barprop.html15
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/resources/message-opener.html52
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/open-close/resources/tokenization-noopener-noreferrer.js152
38 files changed, 1827 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/callback.js b/testing/web-platform/tests/html/browsers/the-window-object/open-close/callback.js
new file mode 100644
index 0000000000..ae51265a21
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/callback.js
@@ -0,0 +1 @@
+opener.callback() \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/close_beforeunload-1.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/close_beforeunload-1.html
new file mode 100644
index 0000000000..6f44d8a83e
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/close_beforeunload-1.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<script>
+onload = function() {opener.postMessage("loaded", "*")};
+onbeforeunload = function() {
+ opener.callback();
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/close_beforeunload.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/close_beforeunload.html
new file mode 100644
index 0000000000..dcb8830ab6
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/close_beforeunload.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<title>Running beforeunload handler in window.close()</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test();
+var w = window.open("close_beforeunload-1.html");
+onmessage = t.step_func(function(event) {
+ if (event.data != "loaded") {
+ return;
+ }
+ w.close();
+});
+callback = function() {t.done()}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/close_script_defer-1.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/close_script_defer-1.html
new file mode 100644
index 0000000000..c50eddd41f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/close_script_defer-1.html
@@ -0,0 +1 @@
+<!doctype html>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/close_script_defer.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/close_script_defer.html
new file mode 100644
index 0000000000..1217882b16
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/close_script_defer.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<title>Running defer script in window.close()</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test();
+t.step(function() {
+ var w = window.open("close_script_defer-1.html");
+ w.document.open()
+ w.document.write("<script defer src='callback.js'><\/script>")
+ setTimeout(function() {
+ w.close();
+ }, 1000);
+})
+setTimeout(function() {t.done();}, 1000)
+callback = t.step(function() {assert_unreached()})
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/close_unload-1.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/close_unload-1.html
new file mode 100644
index 0000000000..9a9e304e84
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/close_unload-1.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<script>
+onload = function() {opener.postMessage("loaded", "*")};
+onunload = function() {
+ opener.callback();
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/close_unload.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/close_unload.html
new file mode 100644
index 0000000000..e4d231b285
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/close_unload.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<title>Running unload handler in window.close()</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test();
+var w = window.open("close_unload-1.html");
+onmessage = t.step_func(function(event) {
+ if (event.data != "loaded") {
+ return;
+ }
+ w.close();
+});
+callback = function() {t.done()}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/creating_browsing_context_test_01.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/creating_browsing_context_test_01.html
new file mode 100644
index 0000000000..062f61949d
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/creating_browsing_context_test_01.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>[Browsing Context] : [APIs for creating browsing_contexts by name]</title>
+<link rel="author" title="Duhyeong Kim" href="mailto:dduskim@gmail.com">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#apis-for-creating-and-navigating-browsing-contexts-by-name">
+<meta name=timeout content=long>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+async_test(function() {
+ var currentUrl = 'http://' + window.location.host + '/common/blank.html';
+ var win = window.open(currentUrl, '', 'height=1,width=1');
+ this.add_cleanup(function() { win.close(); });
+ win.onload = this.step_func_done(function () {
+ assert_equals(win.location.href, currentUrl, 'should be equal to result url');
+ });
+}, 'first argument: absolute url');
+
+test(function() {
+ var win = window.open('', '', 'height=1,width=1');
+ this.add_cleanup(function() { win.close(); });
+ assert_equals(win.location.href, 'about:blank', 'win.location.href');
+ assert_equals(win.document.charset, 'UTF-8', 'win.document.charset');
+}, 'first argument: empty url');
+
+test(function () {
+ var win = window.open('', 'testWindow', 'height=1,width=1');
+ win.close();
+ assert_equals(win.name, 'testWindow', 'should have a browsing context name');
+}, 'second argument: passing a non-empty name');
+
+test(function () {
+ var win = window.open('', '', 'height=1,width=1');
+ this.add_cleanup(function() { win.close(); });
+ assert_equals(win.name, '', 'window should not have a name');
+ win.name = 'testWindow';
+ assert_equals(win.name, 'testWindow', 'window should have a name');
+}, 'second argument: setting name after opening');
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/no_window_open_when_term_nesting_level_nonzero.window.js b/testing/web-platform/tests/html/browsers/the-window-object/open-close/no_window_open_when_term_nesting_level_nonzero.window.js
new file mode 100644
index 0000000000..3dff403b9c
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/no_window_open_when_term_nesting_level_nonzero.window.js
@@ -0,0 +1,113 @@
+test(function() {
+ var test_window = window.open('', '', 'height=1,width=1');
+ var test_document = test_window.document;
+
+ var frame = test_document.createElement('iframe');
+ test_document.body.appendChild(frame);
+
+ frame.contentWindow.onpagehide = function(evt) {
+ assert_equals(frame.contentWindow.open('', '', 'height=1,width=1'), null,
+ "expected no popup during pagehide");
+ };
+ frame.contentDocument.onvisibilitychange = function(evt) {
+ assert_equals(frame.contentWindow.open('', '', 'height=1,width=1'), null,
+ "expected no popup during visibilitychange");
+ };
+ frame.contentWindow.onbeforeunload = function(evt) {
+ assert_equals(frame.contentWindow.open('', '', 'height=1,width=1'), null,
+ "expected no popup during beforeunload");
+ };
+ frame.contentWindow.onunload = function(evt) {
+ assert_equals(frame.contentWindow.open('', '', 'height=1,width=1'), null,
+ "expected no popup during unload");
+ };
+
+ frame.remove();
+}, 'no popups with frame removal');
+
+async_test(function(t) {
+ var test_window = window.open('', '', 'height=1,width=1');
+ var test_document = test_window.document;
+
+ var frame = test_document.createElement('iframe');
+ test_document.body.appendChild(frame);
+
+ frame.contentWindow.onpagehide = t.step_func(function(evt) {
+ assert_equals(frame.contentWindow.open('', '', 'height=1,width=1'), null,
+ "expected no popup during pagehide");
+ });
+ frame.contentDocument.onvisibilitychange = t.step_func(function(evt) {
+ assert_equals(frame.contentWindow.open('', '', 'height=1,width=1'), null,
+ "expected no popup during visibilitychange");
+ });
+ frame.contentWindow.onbeforeunload = t.step_func(function(evt) {
+ assert_equals(frame.contentWindow.open('', '', 'height=1,width=1'), null,
+ "expected no popup during beforeunload");
+ });
+ frame.contentWindow.onunload = t.step_func(function(evt) {
+ assert_equals(frame.contentWindow.open('', '', 'height=1,width=1'), null,
+ "expected no popup during unload");
+ });
+
+ frame.onload = t.step_func_done();
+
+ frame.contentWindow.location.href = "about:blank";
+}, 'no popups with frame navigation');
+
+async_test(function(t) {
+ var test_window = window.open('', '', 'height=1,width=1');
+ var test_document = test_window.document;
+
+ var frame = test_document.createElement('iframe');
+ test_document.body.appendChild(frame);
+
+ frame.contentWindow.onpagehide = t.step_func(function(evt) {
+ assert_equals(test_window.open('', '', 'height=1,width=1'), null,
+ "expected no popup during pagehide");
+ });
+ frame.contentDocument.onvisibilitychange = t.step_func(function(evt) {
+ assert_equals(test_window.open('', '', 'height=1,width=1'), null,
+ "expected no popup during visibilitychange");
+ });
+ frame.contentWindow.onbeforeunload = t.step_func(function(evt) {
+ assert_equals(test_window.open('', '', 'height=1,width=1'), null,
+ "expected no popup during beforeunload");
+ });
+ frame.contentWindow.onunload = t.step_func(function(evt) {
+ assert_equals(test_window.open('', '', 'height=1,width=1'), null,
+ "expected no popup during unload");
+ });
+
+ frame.onload = t.step_func_done();
+
+ frame.contentWindow.location.href = "about:blank";
+}, 'no popups from synchronously reachable window');
+
+async_test(function(t) {
+ var test_window = window.open('', '', 'height=1,width=1');
+ var test_document = test_window.document;
+
+ var frame = test_document.createElement('iframe');
+ test_document.body.appendChild(frame);
+
+ frame.contentWindow.onpagehide = t.step_func(function(evt) {
+ assert_equals(window.open('', '', 'height=1,width=1'), null,
+ "expected no popup during pagehide");
+ });
+ frame.contentDocument.onvisibilitychange = t.step_func(function(evt) {
+ assert_equals(window.open('', '', 'height=1,width=1'), null,
+ "expected no popup during visibilitychange");
+ });
+ frame.contentWindow.onbeforeunload = t.step_func(function(evt) {
+ assert_equals(window.open('', '', 'height=1,width=1'), null,
+ "expected no popup during beforeunload");
+ });
+ frame.contentWindow.onunload = t.step_func(function(evt) {
+ assert_equals(window.open('', '', 'height=1,width=1'), null,
+ "expected no popup during unload");
+ });
+
+ frame.onload = t.step_func_done();
+
+ frame.contentWindow.location.href = "about:blank";
+}, 'no popups from another synchronously reachable window');
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/non_automated/001-1.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/non_automated/001-1.html
new file mode 100644
index 0000000000..7dd48b41c2
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/non_automated/001-1.html
@@ -0,0 +1,2 @@
+<!doctype html>
+<p>Now open a new tab and navigate to <a href="001-2.html">001-2</a></p>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/non_automated/001-2.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/non_automated/001-2.html
new file mode 100644
index 0000000000..b1413861a3
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/non_automated/001-2.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<script>
+var result = "FAIL";
+if (opener != null) {
+ result = "FAIL (did you open this page in a new tab?)";
+} else {
+ var w = window.open("", "test_name");
+ if (w.location.href !== "about:blank") {
+ result = "FAIL (didn't open an about:blank browsing context)";
+ } else {
+ w.close();
+ result = "PASS";
+ }
+ document.write(result);
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/non_automated/001.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/non_automated/001.html
new file mode 100644
index 0000000000..7b0f21ec04
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/non_automated/001.html
@@ -0,0 +1,3 @@
+<!doctype html>
+<title>Accessing named windows from outside the unit of related browsing contexts</title>
+<a href="001-1.html" target="test_name">Click here</a>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/non_automated/002-1.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/non_automated/002-1.html
new file mode 100644
index 0000000000..0e210f351b
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/non_automated/002-1.html
@@ -0,0 +1,8 @@
+<!doctype html>
+<p>Now open a new tab and navigate to <a></a></p>
+<script>
+href = window.location.href.replace("http://", "http://www.").replace("002-1.html", "002-2.html");
+var a = document.getElementsByTagName("a")[0];
+a.href = href;
+a.textContent = href;
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/non_automated/002-2.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/non_automated/002-2.html
new file mode 100644
index 0000000000..b1413861a3
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/non_automated/002-2.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<script>
+var result = "FAIL";
+if (opener != null) {
+ result = "FAIL (did you open this page in a new tab?)";
+} else {
+ var w = window.open("", "test_name");
+ if (w.location.href !== "about:blank") {
+ result = "FAIL (didn't open an about:blank browsing context)";
+ } else {
+ w.close();
+ result = "PASS";
+ }
+ document.write(result);
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/non_automated/002.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/non_automated/002.html
new file mode 100644
index 0000000000..b568ae8d48
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/non_automated/002.html
@@ -0,0 +1,3 @@
+<!doctype html>
+<title>Accessing different-origin named windows from outside the unit of related browsing contexts</title>
+<a href="002-1.html" target="test_name">Click here</a>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-is-popup-condition.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-is-popup-condition.html
new file mode 100644
index 0000000000..4f52e2e8de
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-is-popup-condition.html
@@ -0,0 +1,149 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML: window.open `features`: condition for is popup</title>
+<meta name="variant" content="?single-1">
+<meta name="variant" content="?single-2">
+<meta name="variant" content="?position">
+<meta name="variant" content="?combination">
+<meta name=timeout content=long>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/window-object.html#window-open-steps">
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/PrefixedPostMessage.js"></script>
+<script>
+var windowURL = 'resources/is-popup-barprop.html';
+
+var target = document.location.search.substring(1);
+
+// features, visible
+// NOTE: visible == !isPopup
+var tests = {
+ "single-1": [
+ // Empty feature results in non-popup.
+ [undefined, true],
+
+ // The explicit popup feature.
+ ["popup", false],
+ ["popup=1", false],
+ ["popup=true", false],
+ ["popup=0", true],
+
+ // Other feature alone results in popup.
+ ["location", false],
+ ["location=yes", false],
+ ["location=true", false],
+ ["location=no", false],
+
+ ["toolbar", false],
+ ["toolbar=yes", false],
+ ["toolbar=true", false],
+ ["toolbar=no", false],
+
+ ["menubar", false],
+ ["menubar=yes", false],
+ ["menubar=true", false],
+ ["menubar=no", false],
+
+ ["resizable", false],
+ ["resizable=yes", false],
+ ["resizable=true", false],
+ ["resizable=no", false],
+ ],
+ "single-2": [
+ ["scrollbars", false],
+ ["scrollbars=yes", false],
+ ["scrollbars=true", false],
+ ["scrollbars=no", false],
+
+ ["status", false],
+ ["status=yes", false],
+ ["status=true", false],
+ ["status=no", false],
+
+ ["titlebar", false],
+ ["titlebar=yes", false],
+ ["titlebar=true", false],
+ ["titlebar=no", false],
+
+ ["close", false],
+ ["close=yes", false],
+ ["close=true", false],
+ ["close=no", false],
+
+ ["minimizable", false],
+ ["minimizable=yes", false],
+ ["minimizable=true", false],
+ ["minimizable=no", false],
+
+ ["personalbar", false],
+ ["personalbar=yes", false],
+ ["personalbar=true", false],
+ ["personalbar=no", false],
+ ],
+ "position": [
+ ["left=500", false],
+ ["screenX=500", false],
+
+ ["top=500", false],
+ ["screenY=500", false],
+
+ ["width=500", false],
+ ["innerWidth=500", false],
+
+ ["outerWidth=500", false],
+
+ ["height=500", false],
+ ["innerHeight=500", false],
+
+ ["outerHeight=500", false],
+ ],
+ "combination": [
+ // The following combination results in non-popup.
+ ["location,toolbar,menubar,resizable,scrollbars,status", true],
+
+ // Either location or toolbar is required for non-popup.
+ ["location,menubar,resizable,scrollbars,status", true],
+ ["toolbar,menubar,resizable,scrollbars,status", true],
+
+ ["resizable,scrollbars,status", false],
+ ["location=no,menubar=no,resizable,scrollbars,status", false],
+
+ // menubar is required for non-popup.
+ ["location,toolbar,resizable,scrollbars,status", false],
+
+ // resizable is required for non-popup, but defaults to true
+ ["location,toolbar,menubar,scrollbars,status", true],
+ ["location,toolbar,menubar,resizable=no,scrollbars,status", false],
+
+ // scrollbars is required for non-popup.
+ ["location,toolbar,menubar,resizable,status", false],
+
+ // status is required for non-popup.
+ ["location,toolbar,menubar,resizable,scrollbars", false],
+
+ // The explicit popup feature has priority than others.
+ ["popup=1,location,toolbar,menubar,resizable,scrollbars,status", false],
+ ["popup=yes,location,toolbar,menubar,resizable,scrollbars,status", false],
+ ["popup=true,location,toolbar,menubar,resizable,scrollbars,status", false],
+ ["popup=0,location,toolbar,menubar,resizable,scrollbars", true],
+ ],
+};
+
+tests[target].forEach(([features, visible]) => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.locationbar, visible, `window.locationbar.visible`);
+ assert_equals(data.menubar, visible, `window.menubar.visible`);
+ assert_equals(data.personalbar, visible, `window.personalbar.visible`);
+ assert_equals(data.scrollbars, visible, `window.scrollbars.visible`);
+ assert_equals(data.statusbar, visible, `window.statusbar.visible`);
+ assert_equals(data.toolbar, visible, `window.toolbar.visible`);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL), '', features);
+ }, `${format_value(features)} should set BarProp visibility to ${visible}`);
+});
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-negative-innerwidth-innerheight.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-negative-innerwidth-innerheight.html
new file mode 100644
index 0000000000..019ee9d730
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-negative-innerwidth-innerheight.html
@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML: window.open `features`: negative values for legacy `innerwidth`, `innerheight`</title>
+<meta name=timeout content=long>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#apis-for-creating-and-navigating-browsing-contexts-by-name">
+
+<!-- user agents are not required to support open features other than `noopener`
+ and on some platforms position and size features don't make sense -->
+<meta name="flags" content="may" />
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/PrefixedPostMessage.js"></script>
+<script>
+var windowURL = 'resources/message-opener.html';
+var featuresPrefix = `top=0,left=0,`;
+
+// https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-integers
+
+setup (() => {
+ // Before running tests, open a window using features that mimic
+ // what would happen if the features tested here were set to invalid
+ // values in later tests.
+ // In cases where the value for `innerwidth` or `innerheight` is
+ // is less than the browser's minimum allowed value for that dimension,
+ // but NOT 0, the value affected will become the browser's minimum allowed value.
+
+ // This should result in a minimally-sized window for later comparison
+ var featureString = `${featuresPrefix}innerwidth=1,innerheight=1`;
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage((data, e) => {
+ e.source.close();
+ runWindowTests(data);
+ });
+ var win = window.open(prefixedMessage.url(windowURL), '', featureString);
+});
+
+function runWindowTests (baselineDimensions) {
+
+ // Negative values for `innerwidth` should result in a window with minimum
+ // valid allowed width
+ [ 'innerwidth=-404',
+ 'innerwidth=-404.5',
+ 'innerwidth=-404e1'
+ ].forEach(feature => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ var featureString = `${featuresPrefix}height=405,${feature}`;
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.width, baselineDimensions.width, `"${feature} is negative and should result in a minimally-wide window"`);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + "&expected_innerWidth=" + baselineDimensions.width, '', featureString);
+ }, `features "${feature}" should NOT set "width=404"`);
+ });
+
+ // Negative values for `innerheight` should result in a window with minimum
+ // valid allowed height
+ [ 'innerheight=-404',
+ 'innerheight=-404.5',
+ 'innerheight=-404e1'
+ ].forEach(feature => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ var featureString = `${featuresPrefix}width=404,${feature}`;
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.height, baselineDimensions.height, `"${feature} is negative and should result in a minimal-height window"`);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_innerHeight=' + baselineDimensions.height, '', featureString);
+ }, `features "${feature}" should NOT set "height=404"`);
+ });
+}
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-negative-screenx-screeny.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-negative-screenx-screeny.html
new file mode 100644
index 0000000000..6e316db482
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-negative-screenx-screeny.html
@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML: window.open `features`: negative values for legacy `screenx`, `screeny`</title>
+<meta name=timeout content=long>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#apis-for-creating-and-navigating-browsing-contexts-by-name">
+
+<!-- user agents are not required to support open features other than `noopener`
+ and on some platforms position and size features don't make sense -->
+<meta name="flags" content="may" />
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/PrefixedPostMessage.js"></script>
+<script>
+var featuresPrefix = `width=401,height=404,`;
+var windowURL = 'resources/message-opener.html';
+
+// https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-integers
+
+setup (() => {
+ // Before running tests, open a window using features that mimic
+ // what would happen if the feature tested here were set to 0
+ // for comparison later.
+ var featureString = `${featuresPrefix}top=0,left=0`;
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage((data, e) => {
+ e.source.close();
+ runWindowTests(data);
+ });
+ var win = window.open(prefixedMessage.url(windowURL), '', featureString);
+});
+
+function runWindowTests (baselineDimensions) {
+ // Negative values should be interpreted as 0
+ [ 'screeny=-204',
+ 'screeny=-204.5',
+ 'screeny=-0'
+ ].forEach(feature => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ var featureString = `${featuresPrefix}left=0,${feature}`;
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.top, baselineDimensions.top, `"${feature} is negative and should be set to 0"`);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_screenY=' + baselineDimensions.top, '', featureString);
+ }, `features "${feature}" should NOT set "top=204"`);
+ });
+
+ // Negative values should be interpreted as 0
+ [ 'screenx=-204',
+ 'screenx=-204.5',
+ 'screenx=-0'
+ ].forEach(feature => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ var featureString = `${featuresPrefix}top=0,${feature}`;
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.left, baselineDimensions.left, `"${feature} is negative and should be set to 0"`);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_screenX=' + baselineDimensions.left, '', featureString);
+ }, `features "${feature}" should NOT set "left=204"`);
+ });
+}
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-negative-top-left.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-negative-top-left.html
new file mode 100644
index 0000000000..316b01a401
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-negative-top-left.html
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML: window.open `features`: negative values for `top`, `left`</title>
+<meta name=timeout content=long>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#apis-for-creating-and-navigating-browsing-contexts-by-name">
+
+<!-- user agents are not required to support open features other than `noopener`
+ and on some platforms position and size features don't make sense -->
+<meta name="flags" content="may" />
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/PrefixedPostMessage.js"></script>
+<script>
+var featuresPrefix = `width=401,height=404,`;
+var windowURL = 'resources/message-opener.html';
+
+// https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-integers
+
+setup (() => {
+ // Before running tests, open a window using features that mimic
+ // what would happen if the feature tested here were set to 0
+ // for comparison later.
+ var featureString = `${featuresPrefix}top=0,left=0`;
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage((data, e) => {
+ e.source.close();
+ runWindowTests(data);
+ });
+ var win = window.open(prefixedMessage.url(windowURL), '', featureString);
+});
+
+function runWindowTests (baselineDimensions) {
+
+ // Negative values for `top`, `left` should be interpreted as 0
+ [ 'top=-204',
+ 'top=-204.5',
+ 'top=-0'
+ ].forEach(feature => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ var featureString = `${featuresPrefix}left=0,${feature}`;
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.top, baselineDimensions.top, `"${feature} is negative and should be set to 0"`);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_screenY=' + baselineDimensions.top, '', featureString);
+ }, `features "${feature}" should NOT set "top=204"`);
+ });
+
+// Negative values for `top`, `left` should be interpreted as 0
+ [ 'left=-204',
+ 'left=-204.5',
+ 'left=-0'
+ ].forEach(feature => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ var featureString = `${featuresPrefix}top=0,${feature}`;
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.left, baselineDimensions.left, `"${feature} is negative and should be set to 0"`);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_screenX=' + baselineDimensions.left, '', featureString);
+ }, `features "${feature}" should NOT set "left=204"`);
+ });
+}
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-negative-width-height.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-negative-width-height.html
new file mode 100644
index 0000000000..3cb155620d
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-negative-width-height.html
@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML: window.open `features`: negative values for `width`, `height`</title>
+<meta name=timeout content=long>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#apis-for-creating-and-navigating-browsing-contexts-by-name">
+
+<!-- user agents are not required to support open features other than `noopener`
+ and on some platforms position and size features don't make sense -->
+<meta name="flags" content="may" />
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/PrefixedPostMessage.js"></script>
+<script>
+var featuresPrefix = `top=0,left=0,`;
+var windowURL = 'resources/message-opener.html';
+
+// https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-integers
+
+setup (() => {
+ // Before running tests, open a window using features that mimic
+ // what would happen if the features tested here were set to invalid
+ // values in later tests.
+ // In cases where the value for `width` or `height` is
+ // is less than the browser's minimum allowed value for that dimension,
+ // but NOT 0, the value affected will become the browser's minimum allowed value.
+
+ // This should result in a minimally-sized window for later comparison
+ var featureString = `${featuresPrefix}width=1,height=1`;
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage((data, e) => {
+ e.source.close();
+ runWindowTests(data);
+ });
+ var win = window.open(prefixedMessage.url(windowURL), '', featureString);
+});
+
+function runWindowTests (baselineDimensions) {
+
+ // Negative values for `width` should result in a window with minimum
+ // valid allowed width
+ [ 'width=-404',
+ 'width=-404.5',
+ 'width=-404e1'
+ ].forEach(feature => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ var featureString = `${featuresPrefix}height=405,${feature}`;
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.width, baselineDimensions.width, `"${feature} is negative and should result in a minimally-wide window"`);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_innerWidth=' + baselineDimensions.width, '', featureString);
+ }, `features "${feature}" should NOT set "width=404"`);
+ });
+
+ // Negative values for `height` should result in a window with minimum
+ // valid allowed height
+ [ 'height=-404',
+ 'height=-404.5',
+ 'height=-404e1'
+ ].forEach(feature => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ var featureString = `${featuresPrefix}width=404,${feature}`;
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.height, baselineDimensions.height, `"${feature} is negative and should result in a minimal-height window"`);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_innerHeight=' + baselineDimensions.height, '', featureString);
+ }, `features "${feature}" should NOT set "height=404"`);
+ });
+}
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-height.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-height.html
new file mode 100644
index 0000000000..d8ee866c50
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-height.html
@@ -0,0 +1,91 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML: window.open `features`: non-integer values for feature `height`</title>
+<meta name=timeout content=long>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#apis-for-creating-and-navigating-browsing-contexts-by-name">
+
+<!-- user agents are not required to support open features other than `noopener`
+ and on some platforms position and size features don't make sense -->
+<meta name="flags" content="may" />
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/PrefixedPostMessage.js"></script>
+<script>
+var featuresPrefix = `top=0,left=0,width=401,`;
+var windowURL = 'resources/message-opener.html';
+
+// https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-integers
+
+setup (() => {
+ // Before running tests, open a window using features that mimic
+ // what would happen if the feature tested here were set to 0
+ // for comparison later.
+ var featureString = `${featuresPrefix}height=0`;
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage((data, e) => {
+ e.source.close();
+ runWindowTests(data);
+ });
+ var win = window.open(prefixedMessage.url(windowURL), '', featureString);
+});
+
+function runWindowTests (baselineDimensions) {
+ // The absence of the sizing feature should have the same behavior
+ // as that feature set to 0
+ [ featuresPrefix,
+ 'top=0,left=0',
+ ].forEach(feature => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.height, baselineDimensions.height);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_innerHeight=' + baselineDimensions.height, '', feature);
+ }, `${feature}: absence of feature "height" should be treated same as "height=0"`);
+ });
+
+ // When code point in first position is not an ASCII digit, "+" or "-",
+ // that's an error and the value becomes 0
+ [ 'height=/404',
+ 'height=_404',
+ 'height=L404'
+ ].forEach(feature => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ var featureString = `${featuresPrefix}${feature}`;
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.height, baselineDimensions.height, `"${feature} begins with an invalid character and should be ignored"`);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_innerHeight=' + baselineDimensions.height, '', featureString);
+ }, `features "${feature}" should NOT set "height=404"`);
+ });
+
+ // Codepoints that are valid ASCII digits should be collected
+ // Non-ASCII digits and subsequent code points are ignored
+ [ 'height=405.5',
+ 'height=405.32',
+ 'height=405LLl',
+ 'height=405^4',
+ 'height=405*3',
+ 'height=405/5',
+ 'height=405 ',
+ 'height=405e1',
+ 'height=405e-1'
+ ].forEach(feature => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ var featureString = `${featuresPrefix}${feature}`;
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.height, 405, `"${featureString} value after first non-digit will be ignored"`);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + "&expected_innerHeight=405", '', featureString);
+ }, `features "${feature}" should set "height=405"`);
+ });
+
+}
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-innerheight.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-innerheight.html
new file mode 100644
index 0000000000..f191d875d8
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-innerheight.html
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML: window.open `features`: non-integer values for legacy feature `innerheight`</title>
+<meta name=timeout content=long>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#apis-for-creating-and-navigating-browsing-contexts-by-name">
+
+<!-- user agents are not required to support open features other than `noopener`
+ and on some platforms position and size features don't make sense -->
+<meta name="flags" content="may" />
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/PrefixedPostMessage.js"></script>
+<script>
+var featuresPrefix = `top=0,left=0,width=401,`;
+var windowURL = 'resources/message-opener.html';
+
+// https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-integers
+
+setup (() => {
+ // Before running tests, open a window using features that mimic
+ // what would happen if the feature tested here were set to 0
+ // for comparison later.
+ var featureString = `${featuresPrefix}height=0`;
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage((data, e) => {
+ e.source.close();
+ runWindowTests(data);
+ });
+ var win = window.open(prefixedMessage.url(windowURL), '', featureString);
+});
+
+function runWindowTests (baselineDimensions) {
+ // When code point in first position is not an ASCII digit, "+" or "-",
+ // that's an error and the value becomes 0
+ [ 'innerheight=/404',
+ 'innerheight=_404',
+ 'innerheight=L404'
+ ].forEach(feature => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ var featureString = `${featuresPrefix}${feature}`;
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.height, baselineDimensions.height, `"${feature} begins with an invalid character and should be ignored"`);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_innerHeight=' + baselineDimensions.height, '', featureString);
+ }, `features "${feature}" should NOT set "height=404"`);
+ });
+
+ // Codepoints that are valid ASCII digits should be collected
+ // Non-ASCII digits and subsequent code points are ignored
+ [ 'innerheight=405.5',
+ 'innerheight=405.32',
+ 'innerheight=405LLl',
+ 'innerheight=405^4',
+ 'innerheight=405*3',
+ 'innerheight=405/5',
+ 'innerheight=405 ',
+ 'innerheight=405e1',
+ 'innerheight=405e-1'
+ ].forEach(feature => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ var featureString = `${featuresPrefix}${feature}`;
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.height, 405, `"${featureString} value after first non-digit will be ignored"`);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + "&expected_innerHeight=405", '', featureString);
+ }, `features "${feature}" should set "height=405"`);
+ });
+
+}
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-innerwidth.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-innerwidth.html
new file mode 100644
index 0000000000..d1ddc5e43a
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-innerwidth.html
@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML: window.open `features`: non-integer values for legacy feature `innerwidth`</title>
+<meta name=timeout content=long>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#apis-for-creating-and-navigating-browsing-contexts-by-name">
+
+<!-- user agents are not required to support open features other than `noopener`
+ and on some platforms position and size features don't make sense -->
+<meta name="flags" content="may" />
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/PrefixedPostMessage.js"></script>
+<script>
+var featuresPrefix = `top=0,left=0,height=401,`;
+var windowURL = 'resources/message-opener.html';
+
+// https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-integers
+
+setup (() => {
+ // Before running tests, open a window using features that mimic
+ // what would happen if the feature tested here were set to 0
+ // for comparison later.
+ var featureString = `${featuresPrefix}width=0`;
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage((data, e) => {
+ e.source.close();
+ runWindowTests(data);
+ });
+ var win = window.open(prefixedMessage.url(windowURL), '', featureString);
+});
+
+function runWindowTests (baselineDimensions) {
+ // When code point in first position is not an ASCII digit, "+" or "-",
+ // that's an error and the value becomes 0
+ [ 'innerwidth=/404',
+ 'innerwidth=_404',
+ 'innerwidth=L404'
+ ].forEach(feature => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ var featureString = `${featuresPrefix}${feature}`;
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.width, baselineDimensions.width, `"${feature} begins with an invalid character and should be ignored"`);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_innerWidth=' + baselineDimensions.width, '', featureString);
+ }, `features "${feature}" should NOT set "width=404"`);
+ });
+
+ // Codepoints that are valid ASCII digits should be collected
+ // Non-ASCII digits and subsequent code points are ignored
+ [ 'innerwidth=405.5',
+ 'innerwidth=405.32',
+ 'innerwidth=405LLl',
+ 'innerwidth=405^4',
+ 'innerwidth=405*3',
+ 'innerwidth=405/5',
+ 'innerwidth=405 ',
+ 'innerwidth=405e1',
+ 'innerwidth=405e-1'
+ ].forEach(feature => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ var featureString = `${featuresPrefix}${feature}`;
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.width, 405, `"${featureString} value after first non-digit will be ignored"`);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_innerWidth=405', '', featureString);
+ }, `features "${feature}" should set "width=405"`);
+ });
+}
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-left.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-left.html
new file mode 100644
index 0000000000..c771204dc4
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-left.html
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML: window.open `features`: non-integer values for feature `left`</title>
+<meta name=timeout content=long>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#apis-for-creating-and-navigating-browsing-contexts-by-name">
+
+<!-- user agents are not required to support open features other than `noopener`
+ and on some platforms position and size features don't make sense -->
+<meta name="flags" content="may" />
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/PrefixedPostMessage.js"></script>
+<script>
+
+var featuresPrefix = `width=401,height=204,top=0,`;
+var windowURL = 'resources/message-opener.html';
+
+// https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-integers
+
+setup (() => {
+ // Before running tests, open a window using features that mimic
+ // what would happen if the feature tested here were set to 0
+ // for comparison later.
+ var featureString = `${featuresPrefix}left=0`;
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage((data, e) => {
+ e.source.close();
+ runWindowTests(data);
+ });
+ var win = window.open(prefixedMessage.url(windowURL), '', featureString);
+});
+
+function runWindowTests (baselineDimensions) {
+ // When code point in first position is not an ASCII digit, "+" or "-",
+ // that's an error and the value becomes 0
+ [ 'left=/104',
+ 'left=_104',
+ 'left=L104'
+ ].forEach(feature => {
+ async_test(t => {
+ var featureString = `${featuresPrefix}${feature}`;
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.left, baselineDimensions.left, `"${feature} begins with an invalid character and should be ignored"`);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_screenX=' + baselineDimensions.left, '', featureString);
+ }, `features "${feature}" should NOT set "left=104"`);
+ });
+
+ // Codepoints that are valid ASCII digits should be collected
+ // Non-ASCII digits and subsequent code points are ignored
+ [ 'left=105.5',
+ 'left=105.32',
+ 'left=105LLl',
+ 'left=105^4',
+ 'left=105*3',
+ 'left=105/5',
+ 'left=105 ',
+ 'left=105e1',
+ 'left=105e-1'
+ ].forEach(feature => {
+ async_test(t => {
+ var featureString = `${featuresPrefix}${feature}`;
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.left, 105, `"${featureString} value after first non-digit will be ignored"`);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_screenX=105', '', featureString);
+ }, `features "${feature}" should set "left=105"`);
+ });
+}
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-screenx.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-screenx.html
new file mode 100644
index 0000000000..49a3783257
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-screenx.html
@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML: window.open `features`: non-integer values for legacy feature `screenx`</title>
+<meta name=timeout content=long>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#apis-for-creating-and-navigating-browsing-contexts-by-name">
+
+<!-- user agents are not required to support open features other than `noopener`
+ and on some platforms position and size features don't make sense -->
+<meta name="flags" content="may" />
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/PrefixedPostMessage.js"></script>
+<script>
+var featuresPrefix = `width=401,height=204,top=0,`;
+var windowURL = 'resources/message-opener.html';
+
+// https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-integers
+
+setup (() => {
+ // Before running tests, open a window using features that mimic
+ // what would happen if the feature tested here were set to 0
+ // for comparison later.
+ var featureString = `${featuresPrefix}left=0`;
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage((data, e) => {
+ e.source.close();
+ runWindowTests(data);
+ });
+ var win = window.open(prefixedMessage.url(windowURL), '', featureString);
+});
+
+function runWindowTests (baselineDimensions) {
+ // When code point in first position is not an ASCII digit, "+" or "-",
+ // that's an error and the value becomes 0
+ [ 'screenx=/104',
+ 'screenx=_104',
+ 'screenx=L104'
+ ].forEach(feature => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ var featureString = `${featuresPrefix}${feature}`;
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.left, baselineDimensions.left, `"${feature} begins with an invalid character and should be ignored"`);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_screenX=' + baselineDimensions.left, '', featureString);
+ }, `features "${feature}" should NOT set "screenx=104"`);
+ });
+
+ // Codepoints that are valid ASCII digits should be collected
+ // Non-ASCII digits and subsequent code points are ignored
+ [ 'screenx=105.5',
+ 'screenx=105.32',
+ 'screenx=105LLl',
+ 'screenx=105^4',
+ 'screenx=105*3',
+ 'screenx=105/5',
+ 'screenx=105 ',
+ 'screenx=105e1',
+ 'screenx=105e-1'
+ ].forEach(feature => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ var featureString = `${featuresPrefix}${feature}`;
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.left, 105, `"${featureString} value after first non-digit will be ignored"`);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_screenX=105', '', featureString);
+ }, `features "${feature}" should set "screenx=105"`);
+ });
+}
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-screeny.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-screeny.html
new file mode 100644
index 0000000000..5183405445
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-screeny.html
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML: window.open `features`: non-integer values for legacy feature `screeny`</title>
+<meta name=timeout content=long>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#apis-for-creating-and-navigating-browsing-contexts-by-name">
+
+<!-- user agents are not required to support open features other than `noopener`
+ and on some platforms position and size features don't make sense -->
+<meta name="flags" content="may" />
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/PrefixedPostMessage.js"></script>
+<script>
+var featuresPrefix = `height=401,width=402,left=0,`;
+var windowURL = 'resources/message-opener.html';
+
+// https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-integers
+
+setup (() => {
+ // Before running tests, open a window using features that mimic
+ // what would happen if the feature tested here were set to 0
+ // for comparison later.
+ var featureString = `${featuresPrefix}top=0`;
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage((data, e) => {
+ e.source.close();
+ runWindowTests(data);
+ });
+ var win = window.open(prefixedMessage.url(windowURL), '', featureString);
+});
+
+function runWindowTests (baselineDimensions) {
+ // When code point in first position is not an ASCII digit, "+" or "-",
+ // that's an error and the value becomes 0
+ [ 'screeny=/404',
+ 'screeny=_404',
+ 'screeny=L404'
+ ].forEach(feature => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ var featureString = `${featuresPrefix}${feature}`;
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.top, baselineDimensions.top, `"${feature} begins with an invalid character and should be ignored"`);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_screenY=' + baselineDimensions.top, '', featureString);
+ }, `features "${feature}" should NOT set "screeny=404"`);
+ });
+
+ // Codepoints that are valid ASCII digits should be collected
+ // Non-ASCII digits and subsequent code points are ignored
+ [ 'screeny=405.5',
+ 'screeny=405.32',
+ 'screeny=405LLl',
+ 'screeny=405^4',
+ 'screeny=405*3',
+ 'screeny=405/5',
+ 'screeny=405 ',
+ 'screeny=405e1',
+ 'screeny=405e-1'
+ ].forEach(feature => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ var featureString = `${featuresPrefix}${feature}`;
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.top, 405, `"${featureString} value after first non-digit will be ignored"`);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_screenY=405', '', featureString);
+ }, `features "${feature}" should set "screeny=405"`);
+ });
+
+}
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-top.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-top.html
new file mode 100644
index 0000000000..a7926e748b
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-top.html
@@ -0,0 +1,73 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML: window.open `features`: non-integer values for feature `top`</title>
+<meta name=timeout content=long>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#apis-for-creating-and-navigating-browsing-contexts-by-name">
+
+<!-- user agents are not required to support open features other than `noopener`
+ and on some platforms position and size features don't make sense -->
+<meta name="flags" content="may" />
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/PrefixedPostMessage.js"></script>
+<script>
+var windowURL = 'resources/message-opener.html';
+var featuresPrefix = `width=401,height=204,left=0,`;
+
+setup (() => {
+ // Before running tests, open a window using features that mimic
+ // what would happen if the feature tested here were set to 0
+ // for comparison later.
+ var featureString = `${featuresPrefix}top=0`;
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage((data, e) => {
+ e.source.close();
+ runWindowTests(data);
+ });
+ var win = window.open(prefixedMessage.url(windowURL), '', featureString);
+});
+
+function runWindowTests (baselineDimensions) {
+ // When code point in first position is not an ASCII digit, "+" or "-",
+ // that's an error and the value becomes 0
+ [ 'top=/104',
+ 'top=_104',
+ 'top=L104'
+ ].forEach(feature => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ var featureString = `${featuresPrefix}${feature}`;
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.top, baselineDimensions.top, `"${feature} begins with an invalid character and should be ignored"`);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_screenY=' + baselineDimensions.top, '', featureString);
+ }, `features "${feature}" should NOT set "top=104"`);
+ });
+
+ // Codepoints that are valid ASCII digits should be collected
+ // Non-ASCII digits and subsequent code points are ignored
+ [ 'top=105.5',
+ 'top=105.32',
+ 'top=105LLl',
+ 'top=105^4',
+ 'top=105*3',
+ 'top=105/5',
+ 'top=105 ',
+ 'top=105e1',
+ 'top=105e-1'
+ ].forEach(feature => {
+ async_test(t => {
+ var featureString = `${featuresPrefix}${feature}`;
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.top, 105, `"${feature} value after first non-digit will be ignored"`);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_screenY=105', '', featureString);
+ }, `features "${feature}" should set "top=105"`);
+ });
+}
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-width.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-width.html
new file mode 100644
index 0000000000..6878063ed7
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-non-integer-width.html
@@ -0,0 +1,91 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML: window.open `features`: non-integer values for feature `width`</title>
+<meta name=timeout content=long>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#apis-for-creating-and-navigating-browsing-contexts-by-name">
+
+<!-- user agents are not required to support open features other than `noopener`
+ and on some platforms position and size features don't make sense -->
+<meta name="flags" content="may" />
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/PrefixedPostMessage.js"></script>
+<script>
+var featuresPrefix = `top=0,left=0,height=401,`;
+var windowURL = 'resources/message-opener.html';
+
+// https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-integers
+
+setup (() => {
+ // Before running tests, open a window using features that mimic
+ // what would happen if the feature tested here were set to 0
+ // for comparison later.
+ var featureString = `${featuresPrefix}width=0`;
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage((data, e) => {
+ e.source.close();
+ runWindowTests(data);
+ });
+ var win = window.open(prefixedMessage.url(windowURL), '', featureString);
+});
+
+function runWindowTests (baselineDimensions) {
+
+ // The absence of the sizing feature should have the same behavior
+ // as that feature set to 0
+ [ featuresPrefix,
+ 'top=0,left=0',
+ ].forEach(feature => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.width, baselineDimensions.width);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_innerWidth=' + baselineDimensions.width, '', feature);
+ }, `${feature}: absence of feature "width" should be treated same as "width=0"`);
+ });
+
+ // When code point in first position is not an ASCII digit, "+" or "-",
+ // that's an error and the value becomes 0
+ [ 'width=/404',
+ 'width=_404',
+ 'width=L404'
+ ].forEach(feature => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ var featureString = `${featuresPrefix}${feature}`;
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.width, baselineDimensions.width, `"${feature} begins with an invalid character and should be ignored"`);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_innerWidth=' + baselineDimensions.width, '', featureString);
+ }, `features "${feature}" should NOT set "width=404"`);
+ });
+
+ // Codepoints that are valid ASCII digits should be collected
+ // Non-ASCII digits and subsequent code points are ignored
+ [ 'width=405.5',
+ 'width=405.32',
+ 'width=405LLl',
+ 'width=405^4',
+ 'width=405*3',
+ 'width=405/5',
+ 'width=405 ',
+ 'width=405e1',
+ 'width=405e-1'
+ ].forEach(feature => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ var featureString = `${featuresPrefix}${feature}`;
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.width, 405, `"${featureString} value after first non-digit will be ignored"`);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + "&expected_innerWidth=405", '', featureString);
+ }, `features "${feature}" should set "width=405"`);
+ });
+}
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-tokenization-innerheight-innerwidth.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-tokenization-innerheight-innerwidth.html
new file mode 100644
index 0000000000..cf3ad25514
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-tokenization-innerheight-innerwidth.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML: window.open `features`: tokenization -- legacy size features `innerheight`, `innerwidth`</title>
+<meta name=timeout content=long>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#apis-for-creating-and-navigating-browsing-contexts-by-name">
+
+<!-- user agents are not required to support open features other than `noopener`
+ and on some platforms position and size features don't make sense -->
+<meta name="flags" content="may" />
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/PrefixedPostMessage.js"></script>
+<script>
+var windowURL = 'resources/message-opener.html';
+var width = 'width=401,';
+var height = 'height=402,';
+
+[ 'innerwidth=401',
+ ' innerwidth = 401',
+ 'innerwidth==401',
+ '\ninnerwidth= 401',
+ ',innerwidth=401,,',
+ 'INNERWIDTH=401',
+ 'innerWidth=401'
+].forEach((features, idx, arr) => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.width, 401);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_innerWidth=401', '', height + features);
+ }, `${format_value(features)} should set width of opened window`);
+});
+
+[ 'innerheight=402',
+ ' innerheight = 402',
+ 'innerheight==402',
+ '\ninnerheight= 402',
+ ',innerheight=402,,',
+ 'INNERHEIGHT=402',
+ 'innerHeight=402'
+].forEach((features, idx, arr) => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.height, 402);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_innerHeight=402', '', width + features);
+ }, `${format_value(features)} should set height of opened window`);
+});
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-tokenization-noopener.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-tokenization-noopener.html
new file mode 100644
index 0000000000..c955e67789
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-tokenization-noopener.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML: window.open `features`: tokenization -- `noopener`</title>
+<meta name=timeout content=long>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#apis-for-creating-and-navigating-browsing-contexts-by-name">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/tokenization-noopener-noreferrer.js"></script>
+<script>
+ booleanTests("noopener");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-tokenization-noreferrer.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-tokenization-noreferrer.html
new file mode 100644
index 0000000000..4807f634fd
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-tokenization-noreferrer.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML: window.open `features`: tokenization -- `noreferrer`</title>
+<meta name=timeout content=long>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#apis-for-creating-and-navigating-browsing-contexts-by-name">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/tokenization-noopener-noreferrer.js"></script>
+<script>
+ booleanTests("noreferrer");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-tokenization-screenx-screeny.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-tokenization-screenx-screeny.html
new file mode 100644
index 0000000000..5a53fefc40
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-tokenization-screenx-screeny.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML: window.open `features`: tokenization -- legacy position features `screenx`, `screeny`</title>
+<meta name=timeout content=long>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#apis-for-creating-and-navigating-browsing-contexts-by-name">
+
+<!-- user agents are not required to support open features other than `noopener`
+ and on some platforms position and size features don't make sense -->
+<meta name="flags" content="may" />
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/PrefixedPostMessage.js"></script>
+<script>
+var windowURL = 'resources/message-opener.html';
+var width = 'width=401,';
+var height = 'height=402,';
+
+[ 'screenx=141',
+ ' screenx = 141',
+ 'screenx==141',
+ '\nscreenx= 141',
+ ',screenx=141,,',
+ 'SCREENX=141',
+ 'screenX=141'
+].forEach((features, idx, arr) => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.left, 141);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_screenX=141', '', width + height + features);
+ }, `${format_value(features)} should set left position of opened window`);
+});
+
+[ 'screeny=142',
+ ' screeny = 142',
+ 'screeny==142',
+ '\nscreeny= 142',
+ ',screeny=142,,',
+ 'SCREENY=142',
+ 'screenY=142'
+].forEach((features, idx, arr) => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.top, 142);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_screenY=142', '', width + height + features);
+ }, `${format_value(features)} should set top position of opened window`);
+});
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-tokenization-top-left.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-tokenization-top-left.html
new file mode 100644
index 0000000000..842cbcf820
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-tokenization-top-left.html
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML: window.open `features`: tokenization -- position features `top` and `left`</title>
+<meta name=timeout content=long>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#apis-for-creating-and-navigating-browsing-contexts-by-name">
+
+<!-- user agents are not required to support open features other than `noopener`
+ and on some platforms position and size features don't make sense -->
+<meta name="flags" content="may" />
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/PrefixedPostMessage.js"></script>
+<script>
+var windowURL = 'resources/message-opener.html';
+var width = 'width=401,';
+var height = 'height=402,';
+
+[ 'left=141',
+ ' left = 141',
+ 'left==141',
+ '\nleft= 141',
+ ',left=141,,',
+ 'LEFT=141'
+].forEach((features, idx, arr) => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.left, 141);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_screenX=141', '', width + height + features);
+ }, `"${features}" should set left position of opened window`);
+});
+
+[ 'top=142',
+ ' top = 142',
+ 'top==142',
+ '\ttop= 142',
+ ',top=142,,',
+ 'TOP=142'
+].forEach((features, idx, arr) => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.top, 142);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_screenY=142', '', width + height + features);
+ }, `${format_value(features)} should set top position of opened window`);
+});
+
+[ 'top=152,left=152',
+ 'top=152,,left=152,',
+ 'top=152==left=152',
+ ',,top= 152, left=152'
+].forEach((features, idx, arr) => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.top, 152);
+ assert_equals(data.left, 152);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_screenX=152&expected_screenY=152', '', width + height + features);
+ }, `${format_value(features)} should set top and left position of opened window`);
+});
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-tokenization-width-height.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-tokenization-width-height.html
new file mode 100644
index 0000000000..ff61199179
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/open-features-tokenization-width-height.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML: window.open `features`: tokenization -- size features `width` and `height`</title>
+<meta name=timeout content=long>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#apis-for-creating-and-navigating-browsing-contexts-by-name">
+
+<!-- user agents are not required to support open features other than `noopener`
+ and on some platforms position and size features don't make sense -->
+<meta name="flags" content="may" />
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/PrefixedPostMessage.js"></script>
+<script>
+var windowURL = 'resources/message-opener.html';
+var width = 'width=401,';
+var height = 'height=402,';
+
+[ 'width=401',
+ ' width = 401',
+ 'width==401',
+ '\nwidth= 401',
+ ',width=401,,',
+ 'WIDTH=401'
+].forEach((features, idx, arr) => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.width, 401);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_innerWidth=401', '', height + features);
+ }, `${format_value(features)} should set width of opened window`);
+});
+
+[ 'height=402',
+ ' height = 402',
+ 'height==402',
+ '\nheight= 402',
+ ',height=402,,',
+ 'HEIGHT=402'
+].forEach((features, idx, arr) => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.height, 402);
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_innerHeight=402', '', width + features);
+ }, `${format_value(features)} should set height of opened window`);
+});
+
+[ 'height=402,width=401',
+ ' height = 402 , width = 401 ,',
+ 'height==402 width = 401',
+ '\nheight= 402,,width=\n401',
+ ',height=402,,width==401',
+ 'HEIGHT=402, WIDTH=401'
+].forEach((features, idx, arr) => {
+ async_test(t => {
+ var prefixedMessage = new PrefixedMessageTest();
+ prefixedMessage.onMessage(t.step_func_done((data, e) => {
+ e.source.close();
+ assert_equals(data.height, 402);
+ assert_equals(data.width, 401)
+ }));
+ var win = window.open(prefixedMessage.url(windowURL) + '&expected_innerHeight=402&expected_innerWidth=401', '', features);
+ }, `${format_value(features)} should set height and width of opened window`);
+});
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/resources/close-self.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/resources/close-self.html
new file mode 100644
index 0000000000..0c0cf9fc49
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/resources/close-self.html
@@ -0,0 +1,3 @@
+<script>
+ window.close();
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/resources/is-popup-barprop.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/resources/is-popup-barprop.html
new file mode 100644
index 0000000000..5636e29878
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/resources/is-popup-barprop.html
@@ -0,0 +1,15 @@
+<script src="/common/PrefixedPostMessage.js"></script>
+<script>
+var prefixedMessage = new PrefixedMessageResource();
+function sendBarProps() {
+ prefixedMessage.postToOpener({
+ locationbar: window.locationbar.visible,
+ menubar: window.menubar.visible,
+ personalbar: window.personalbar.visible,
+ scrollbars: window.scrollbars.visible,
+ statusbar: window.statusbar.visible,
+ toolbar: window.toolbar.visible,
+ });
+}
+window.addEventListener('load', sendBarProps);
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/resources/message-opener.html b/testing/web-platform/tests/html/browsers/the-window-object/open-close/resources/message-opener.html
new file mode 100644
index 0000000000..39ad139769
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/resources/message-opener.html
@@ -0,0 +1,52 @@
+<script src="/common/PrefixedPostMessage.js"></script>
+<script>
+var prefixedMessage = new PrefixedMessageResource();
+var max = 150, attempts = 0;
+
+const urlParams = new URLSearchParams(location.search);
+const expected_innerWidth = urlParams.get('expected_innerWidth');
+const expected_innerHeight = urlParams.get('expected_innerHeight');
+const expected_screenX = urlParams.get('expected_screenX');
+const expected_screenY = urlParams.get('expected_screenY');
+let should_wait_until_settled = expected_innerWidth === null && expected_innerHeight === null && expected_screenX === null && expected_screenY === null;
+
+function sendCoordinates() {
+ // Certain windowing systems position windows asynchronously.
+ // As a result, the window may not be positioned yet when the
+ // load event fires. To accommodate this, allow waiting up to
+ // 15 seconds for positioning to take place.
+ if ((!window.screenX && expected_screenX) &&
+ (!window.screenY && expected_screenY) && ++attempts < max) {
+ setTimeout(sendCoordinates, 100);
+ return;
+ }
+ if (expected_innerWidth && window.innerWidth != expected_innerWidth && ++attempts < max) {
+ setTimeout(sendCoordinates, 10);
+ return;
+ }
+ if (expected_innerHeight && window.innerHeight != expected_innerHeight && ++attempts < max) {
+ setTimeout(sendCoordinates, 10);
+ return;
+ }
+ if (expected_screenX && window.screenX != expected_screenX && ++attempts < max) {
+ setTimeout(sendCoordinates, 10);
+ return;
+ }
+ if (expected_screenY && window.screenY != expected_screenY && ++attempts < max) {
+ setTimeout(sendCoordinates, 10);
+ return;
+ }
+ if (should_wait_until_settled) {
+ should_wait_until_settled = false;
+ setTimeout(sendCoordinates, 300);
+ return;
+ }
+ prefixedMessage.postToOpener({
+ left: window.screenX,
+ top: window.screenY,
+ width: window.innerWidth,
+ height: window.innerHeight
+ });
+}
+window.addEventListener('load', sendCoordinates);
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/open-close/resources/tokenization-noopener-noreferrer.js b/testing/web-platform/tests/html/browsers/the-window-object/open-close/resources/tokenization-noopener-noreferrer.js
new file mode 100644
index 0000000000..a9d42e26de
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/open-close/resources/tokenization-noopener-noreferrer.js
@@ -0,0 +1,152 @@
+function booleanTests(feature) {
+ const windowURL = 'resources/close-self.html';
+ // Tests for how windows features are tokenized into 'name', 'value'
+ // window features separators are ASCII whitespace, '=' and ','
+
+ const featureUpper = feature.toUpperCase(),
+ featureSplitBegin = feature.slice(0, 2),
+ featureSplitEnd = feature.slice(2),
+ featureMixedCase = featureSplitBegin.toUpperCase() + featureSplitEnd;
+ featureMixedCase2 = featureSplitBegin + featureSplitEnd.toUpperCase();
+
+ test (t => {
+ // Tokenizing `name`: initial window features separators are ignored
+ // Each of these variants should tokenize to (`${feature}`, '')
+ [
+ ` ${feature}`,
+ `=${feature}`,
+ `,,${feature}`,
+ `,=, ${feature}`,
+ `\n=${feature}=`,
+ `\t${feature}`,
+ `\r,,,=${feature}`,
+ `\u000C${feature}`
+ ].forEach(variant => {
+ const win = window.open(windowURL, "", variant);
+ assert_equals(win, null, `"${variant}" should activate feature "${feature}"`);
+ });
+ }, `Tokenization of "${feature}" should skip window features separators before feature`);
+
+ test (t => {
+ // Tokenizing `name`: lowercase conversion
+ // Each of these variants should tokenize as feature (`${feature}`, '')
+ // except where indicated
+ // Note also that `value` is lowercased during tokenization
+ [
+ `${featureUpper}`,
+ `${featureMixedCase}`,
+ ` ${featureMixedCase2}`,
+ `=${featureUpper}`,
+ `${featureUpper}=1`,
+ `${featureUpper}=1`,
+ `${featureUpper}=yes`,
+ `${feature}=YES`,
+ ].forEach(variant => {
+ const win = window.open(windowURL, '', variant);
+ assert_equals(win, null, `"${variant}" should activate feature "${feature}"`);
+ });
+ }, `Feature "${feature}" should be converted to ASCII lowercase`);
+
+ test (t => {
+ // After `name` has been collected, ignore any window features separators until '='
+ // except ',' OR a non-window-features-separator — break in those cases
+ // i.e. ignore whitespace until '=' unless a ',' is encountered first
+ // Each of these variants should tokenize as feature ('noopener', '')
+ [
+ `${feature}`,
+ ` ${feature}\r`,
+ `${feature}\n =`,
+ `${feature},`,
+ `${feature} =,`,
+ `, ${feature} =`,
+ `${feature},=`,
+ `${feature} foo`,
+ `foo ${feature}=1`,
+ `foo=\u000Cbar\u000C${feature}`
+ ].forEach(variant => {
+ const win = window.open(windowURL, '', variant);
+ assert_equals(win, null, `"${variant}" should activate feature "${feature}"`);
+ });
+ }, `After "${feature}", tokenization should skip window features separators that are not "=" or ","`);
+
+ test (t => {
+ // After initial '=', tokenizing should ignore all separators except ','
+ // before collecting `value`
+ // Each of these variants should tokenize as feature ('noopener', '')
+ // Except where indicated
+ [
+ `${feature}= yes`,
+ `${feature}==,`,
+ `${feature}=\n ,`,
+ `${feature} = \t ,`,
+ `${feature}\n=\r 1,`,
+ `${feature}=,yes`,
+ `${feature}= yes=,`,
+ `${feature} = \u000Cyes`
+ ].forEach(variant => {
+ const win = window.open(windowURL, '', variant);
+ assert_equals(win, null, `"${variant}" should activate feature "${feature}"`);
+ });
+ }, `Tokenizing "${feature}" should ignore window feature separators except "," after initial "=" and before value`);
+
+ test (t => {
+ // Tokenizing `value` should collect any non-separator code points until first separator
+ [
+ `${feature}=1`,
+ `${feature}=yes`,
+ `${feature} = yes ,`,
+ `${feature}=\nyes ,`,
+ `${feature}=yes yes`,
+ `${feature}=yes\ts`,
+ `${feature}==`,
+ `${feature}=1\n,`,
+ `==${feature}===`,
+ `${feature}==\u000C`
+ ].forEach(variant => {
+ const win = window.open(windowURL, '', variant);
+ assert_equals(win, null, `"${variant}" should set "${feature}"`);
+ });
+ }, `Tokenizing "${feature}" should read characters until first window feature separator as \`value\``);
+
+ test (t => {
+ [
+ `${feature}=1`,
+ `${feature}=2`,
+ `${feature}=12345`,
+ `${feature}=1.5`,
+ `${feature}=-1`,
+ ].forEach(variant => {
+ const win = window.open(windowURL, '', variant);
+ assert_equals(win, null, `"${variant}" should activate feature "${feature}"`);
+ });
+ }, 'Integer values other than 0 should activate the feature');
+
+ test (t => {
+ [
+ `${feature}=0`,
+ `${feature}=0.5`,
+ `${feature}=error`,
+ ].forEach(variant => {
+ const win = window.open(windowURL, '', variant);
+ assert_not_equals(win, null, `"${variant}" should NOT activate feature "${feature}"`);
+ });
+ }, `Integer value of 0 should not activate "${feature}"`);
+
+ test (t => {
+ [
+ `-${feature}`,
+ `${featureUpper}RRR`,
+ `${featureMixedCase}R`,
+ `${featureSplitBegin}_${featureSplitEnd}`,
+ ` ${featureSplitBegin} ${featureSplitEnd}`,
+ `${featureSplitBegin}\n${featureSplitEnd}`,
+ `${featureSplitBegin},${featureSplitEnd}`,
+ `\0${feature}`,
+ `${feature}\u0000=yes`,
+ `foo=\u000C${feature}`
+ ].forEach(variant => {
+ const win = window.open(windowURL, '', variant);
+ assert_not_equals(win, null, `"${variant}" should NOT activate feature "${feature}"`);
+ });
+ }, `Invalid feature names should not tokenize as "${feature}"`);
+}