Resync web-platform-tests/html/browsers/the-window-object from upstream
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Aug 2019 23:20:45 +0000 (23:20 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Aug 2019 23:20:45 +0000 (23:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=201145

Reviewed by Youenn Fablet.

Resync web-platform-tests/html/browsers/the-window-object from upstream 552bd3bf8bc1be.

* resources/resource-files.json:
* web-platform-tests/html/browsers/the-window-object/*:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249123 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
LayoutTests/TestExpectations
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/resources/resource-files.json
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/closed-attribute.window-expected.txt
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-BarProp.window-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-BarProp.window.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-BarProp.window.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-sizing.window-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-sizing.window.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-sizing.window.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/BarProp-target.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/closed.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/noreferrer-target.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/sizing-target.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/w3c-import.log
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/w3c-import.log
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-defaults.window-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-defaults.window.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-defaults.window.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-noopener-expected.txt
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-noopener.html

index e2e50f8..6ea5e55 100644 (file)
@@ -239,6 +239,10 @@ imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening
 imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/ignore-opens-during-unload.window.html [ Skip ]
 imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/tasks.window.html [ Skip ]
 
+# Requires BroadcastChannel.
+imported/w3c/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-BarProp.window.html [ Skip ]
+imported/w3c/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-sizing.window.html [ Skip ]
+
 # Requires additional test infrastructure.
 imported/w3c/web-platform-tests/service-workers/service-worker/update-after-oneday.https.html [ Skip ]
 
index 0b934ac..d5b5a24 100644 (file)
@@ -1,3 +1,15 @@
+2019-08-26  Chris Dumez  <cdumez@apple.com>
+
+        Resync web-platform-tests/html/browsers/the-window-object from upstream
+        https://bugs.webkit.org/show_bug.cgi?id=201145
+
+        Reviewed by Youenn Fablet.
+
+        Resync web-platform-tests/html/browsers/the-window-object from upstream 552bd3bf8bc1be.
+
+        * resources/resource-files.json:
+        * web-platform-tests/html/browsers/the-window-object/*:
+
 2019-08-26  Youenn Fablet  <youenn@apple.com>
 
         Add a WebsiteDataStore delegate to handle AuthenticationChallenge that do not come from pages
index a7c960c..0ee834d 100644 (file)
         "web-platform-tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_2-2.html",
         "web-platform-tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_2-3.html",
         "web-platform-tests/html/browsers/the-window-object/named-access-on-the-window-object/test.html",
+        "web-platform-tests/html/browsers/the-window-object/support/BarProp-target.html",
+        "web-platform-tests/html/browsers/the-window-object/support/closed.html",
         "web-platform-tests/html/browsers/the-window-object/support/noopener-target.html",
+        "web-platform-tests/html/browsers/the-window-object/support/noreferrer-target.html",
+        "web-platform-tests/html/browsers/the-window-object/support/sizing-target.html",
         "web-platform-tests/html/browsers/windows/browsing-context-names/001-1.html",
         "web-platform-tests/html/browsers/windows/browsing-context-names/002-1.html",
         "web-platform-tests/html/browsers/windows/browsing-context-names/existing.html",
index 3b1889a..dd87bb0 100644 (file)
@@ -1,10 +1,8 @@
 
-Harness Error (TIMEOUT), message = null
-
 PASS closed and same-origin nested browsing context 
 PASS closed/close() and same-origin auxiliary browsing context 
-TIMEOUT closed and cross-origin nested browsing context Test timed out
-TIMEOUT closed/close() and cross-origin auxiliary browsing context Test timed out
-TIMEOUT closed and cross-site nested browsing context Test timed out
-TIMEOUT closed/close() and cross-site auxiliary browsing context Test timed out
+PASS closed and cross-origin nested browsing context 
+PASS closed/close() and cross-origin auxiliary browsing context 
+PASS closed and cross-site nested browsing context 
+PASS closed/close() and cross-site auxiliary browsing context 
 
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-BarProp.window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-BarProp.window-expected.txt
new file mode 100644 (file)
index 0000000..3d77640
--- /dev/null
@@ -0,0 +1,5 @@
+
+PASS All bars visible 
+FAIL window.open() with noopener should have all bars visible Can't find variable: BroadcastChannel
+FAIL window.open() with noreferrer should have all bars visible Can't find variable: BroadcastChannel
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-BarProp.window.html b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-BarProp.window.html
new file mode 100644 (file)
index 0000000..2382913
--- /dev/null
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-BarProp.window.js b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-BarProp.window.js
new file mode 100644 (file)
index 0000000..a75a034
--- /dev/null
@@ -0,0 +1,23 @@
+const barProps = ["locationbar", "menubar", "personalbar", "scrollbars", "statusbar", "toolbar"];
+
+test(() => {
+  for(const prop of barProps) {
+    assert_true(window[prop].visible);
+  }
+}, "All bars visible");
+
+["noopener", "noreferrer"].forEach(openerStyle => {
+  async_test(t => {
+    const channelName = "5454" + openerStyle + "34324";
+    const channel = new BroadcastChannel(channelName);
+    window.open("support/BarProp-target.html?" + channelName, "", openerStyle);
+    channel.onmessage = t.step_func_done(e => {
+      // Send message first so if asserts throw the popup is still closed
+      channel.postMessage(null);
+
+      for(const prop of barProps) {
+        assert_true(e.data[prop]);
+      }
+    });
+  }, `window.open() with ${openerStyle} should have all bars visible`);
+});
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-sizing.window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-sizing.window-expected.txt
new file mode 100644 (file)
index 0000000..7492caf
--- /dev/null
@@ -0,0 +1,4 @@
+
+FAIL window.open() with noopener should have equal viewport width and height Can't find variable: BroadcastChannel
+FAIL window.open() with noreferrer should have equal viewport width and height Can't find variable: BroadcastChannel
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-sizing.window.html b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-sizing.window.html
new file mode 100644 (file)
index 0000000..2382913
--- /dev/null
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-sizing.window.js b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-sizing.window.js
new file mode 100644 (file)
index 0000000..cc53ba5
--- /dev/null
@@ -0,0 +1,17 @@
+const windowProps = ["innerWidth", "innerHeight"];
+
+["noopener", "noreferrer"].forEach(openerStyle => {
+  async_test(t => {
+    const channelName = "34342" + openerStyle + "8907";
+    const channel = new BroadcastChannel(channelName);
+    window.open("support/sizing-target.html?" + channelName, "", openerStyle);
+    channel.onmessage = t.step_func_done(e => {
+      // Send message first so if asserts throw the popup is still closed
+      channel.postMessage(null);
+
+      for(const prop of windowProps) {
+        assert_equals(window[prop], e.data[prop]);
+      }
+    });
+  }, `window.open() with ${openerStyle} should have equal viewport width and height`);
+});
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/BarProp-target.html b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/BarProp-target.html
new file mode 100644 (file)
index 0000000..9921e7a
--- /dev/null
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<script>
+  const barProps = ["locationbar", "menubar", "personalbar", "scrollbars", "statusbar", "toolbar"];
+  const barPropsObj = {};
+  const channelName = location.search.substr(1);
+  const channel = new BroadcastChannel(channelName);
+  for (const prop of barProps) {
+    barPropsObj[prop] = window[prop].visible;
+  }
+  channel.postMessage(barPropsObj);
+
+  // Because messages are not delivered synchronously and because closing a
+  // browsing context prompts the eventual clearing of all task sources, this
+  // document should not be closed until the opener document has confirmed
+  // receipt.
+  channel.onmessage = () => { window.close() };
+</script>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/closed.html b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/closed.html
new file mode 100644 (file)
index 0000000..3b70598
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<!--
+  There's two URL parameters supported here:
+
+  window: The property name of a getter on the global object that returns the relevant WindowProxy
+          object to message.
+  ident:  A reasonably unique identifier that will be echoed as the message.
+-->
+<script>
+  const params = new URLSearchParams(location.search);
+  self[params.get("window")].postMessage(params.get("ident"), "*");
+</script>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/noreferrer-target.html b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/noreferrer-target.html
new file mode 100644 (file)
index 0000000..c2446c6
--- /dev/null
@@ -0,0 +1,13 @@
+<script>
+  const channelName = location.search.substr(1),
+        channel = new BroadcastChannel(channelName);
+  channel.postMessage({ name: window.name,
+                        haveOpener: window.opener !== null,
+                        referrer: document.referrer });
+
+  // Because messages are not delivered synchronously and because closing a
+  // browsing context prompts the eventual clearing of all task sources, this
+  // document should not be closed until the opener document has confirmed
+  // receipt.
+  channel.onmessage = () => window.close();
+</script>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/sizing-target.html b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/sizing-target.html
new file mode 100644 (file)
index 0000000..7cd5348
--- /dev/null
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<script>
+  const windowProps = ["innerWidth", "innerHeight"];
+  const windowPropsObj = {};
+  const channelName = location.search.substr(1);
+  const channel = new BroadcastChannel(channelName);
+  for (const prop of windowProps) {
+    windowPropsObj[prop] = window[prop];
+  }
+  channel.postMessage(windowPropsObj);
+
+  // Because messages are not delivered synchronously and because closing a
+  // browsing context prompts the eventual clearing of all task sources, this
+  // document should not be closed until the opener document has confirmed
+  // receipt.
+  channel.onmessage = () => { window.close() };
+</script>
index ca3a7e1..7e8d26e 100644 (file)
@@ -1,7 +1,7 @@
 The tests in this directory were imported from the W3C repository.
 Do NOT modify these tests directly in WebKit.
 Instead, create a pull request on the WPT github:
-       https://github.com/w3c/web-platform-tests
+       https://github.com/web-platform-tests/wpt
 
 Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
 
@@ -14,4 +14,8 @@ Property values requiring vendor prefixes:
 None
 ------------------------------------------------------------------------
 List of files:
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/BarProp-target.html
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/closed.html
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/noopener-target.html
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/noreferrer-target.html
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/sizing-target.html
index 3d8cbce..5c39862 100644 (file)
@@ -24,10 +24,13 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/historical.window.js
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/length-attribute.window.js
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/name-attribute.window.js
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-BarProp.window.js
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-sizing.window.js
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/self-et-al.window.js
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-aliases.html
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-indexed-properties-strict.html
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-indexed-properties.html
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-defaults.window.js
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-noopener.html
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-noreferrer.html
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-properties.https.html
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-defaults.window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-defaults.window-expected.txt
new file mode 100644 (file)
index 0000000..690a8b2
--- /dev/null
@@ -0,0 +1,3 @@
+
+FAIL window.open()'s url parameter default assert_unreached: Reached unreachable code
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-defaults.window.html b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-defaults.window.html
new file mode 100644 (file)
index 0000000..2382913
--- /dev/null
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-defaults.window.js b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-defaults.window.js
new file mode 100644 (file)
index 0000000..1b2d68a
--- /dev/null
@@ -0,0 +1,12 @@
+async_test(t => {
+  const frame = document.createElement("iframe");
+  t.add_cleanup(() => frame.remove());
+  frame.name = "foo";
+  frame.src = "/common/blank.html";
+  frame.onload = t.step_func(() => {
+    frame.onload = t.unreached_func();
+    t.step_timeout(() => t.done(), 500);
+    assert_equals(window[0], window.open(undefined, "foo"));
+  });
+  document.body.append(frame);
+}, "window.open()'s url parameter default");
index dbbe2ca..5e490b6 100644 (file)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: line 117: testError: special target must be one of: _self, _parent, _top
+CONSOLE MESSAGE: line 120: testError: special target must be one of: _self, _parent, _top
 
 FAIL window.open() with "noopener" tests testError: special target must be one of: _self, _parent, _top
 
index cdda633..c3c7066 100644 (file)
 <script src=/resources/testharnessreport.js></script>
 <script>
 var testData = [
-  { testDescription: "window.open() with 'noopener' should not reuse existing target",
+  { testDescription: "window.open() with 'noopener' should reuse existing target",
     secondWindowFeatureString: "noopener",
-    shouldReuse: false },
+    shouldReturnWindow: false },
   { testDescription: "noopener=1 means the same as noopener",
     secondWindowFeatureString: "noopener=1",
-    shouldReuse: false },
+    shouldReturnWindow: false },
   { testDescription: "noopener=0 means lack of noopener",
     secondWindowFeatureString: "noopener=0",
-    shouldReuse: true },
-  { testDescription: "noopener needs to be present as a token on its own",
+    shouldReturnWindow: true },
+  { testDescription: "noopener separated only by spaces should work",
     secondWindowFeatureString: "make me noopener",
-    shouldReuse: true },
+    shouldReturnWindow: false },
   { testDescription: "Trailing noopener should work",
     secondWindowFeatureString: "abc def,  \n\r noopener",
-    shouldReuse: false },
+    shouldReturnWindow: false },
   { testDescription: "Leading noopener should work",
     secondWindowFeatureString: "noopener \f\t , hey, there",
-    shouldReuse: false },
+    shouldReturnWindow: false },
   { testDescription: "Interior noopener should work",
     secondWindowFeatureString: "and now, noopener   , hey, there",
-    shouldReuse: false },
+    shouldReturnWindow: false },
+  { testDescription: "noreferrer should also suppress opener when reusing existing target",
+    secondWindowFeatureString: "noreferrer",
+    shouldReturnWindow: false },
 ];
 
 /**
@@ -54,7 +57,7 @@ function indexedTests() {
     t.secondWindowFeatureString = test.secondWindowFeatureString;
     t.windowName = "someuniquename" + i;
 
-    if (test.shouldReuse) {
+    if (test.shouldReturnWindow) {
       t.step(function() {
         var windowName = this.windowName;
 
@@ -83,9 +86,9 @@ function indexedTests() {
         channel.onmessage = this.step_func_done(function(e) {
           var data = e.data;
           assert_equals(data.name, windowName, "Should have the right name");
-          assert_equals(data.haveOpener, false, "Should not have opener");
+          assert_equals(data.haveOpener, true, "Should still have opener");
           assert_equals(w1.opener, window);
-          assert_equals(w1.location.href, "about:blank");
+          assert_not_equals(w1.location.href, "about:blank", "Should have navigated");
         });
 
         w1 = window.open("", windowName);