Re-sync web-platform-tests/html/browsers/the-window-object/ from upstream
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Mar 2019 01:43:31 +0000 (01:43 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Mar 2019 01:43:31 +0000 (01:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196379

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Re-sync web-platform-tests/html/browsers/the-window-object/ from upstream 3bfdeb8976fc.

* web-platform-tests/html/browsers/the-window-object/*: Updated.

LayoutTests:

* tests-options.json:

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

59 files changed:
LayoutTests/ChangeLog
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/BarProp.window-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/BarProp.window.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/BarProp.window.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/accessing-other-browsing-contexts/w3c-import.log
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/close_script_defer.html
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noopener-expected.txt
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noopener.html
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noreferrer-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noreferrer.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/resources/message-opener.html
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/resources/tokenization-noopener-noreferrer.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/resources/w3c-import.log
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/w3c-import.log
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/close-method.window-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/close-method.window.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/close-method.window.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/closed-attribute.window-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/closed-attribute.window.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/closed-attribute.window.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/document-attribute.window-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/document-attribute.window.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/document-attribute.window.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/focus.window-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/focus.window.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/focus.window.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_3.html
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/w3c-import.log
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/w3c-import.log
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/historical.window-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/historical.window.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/length-attribute.window-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/length-attribute.window.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/length-attribute.window.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/name-attribute.window-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/name-attribute.window.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/name-attribute.window.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/named-access-on-the-window-object/navigated-named-objects.window-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/named-access-on-the-window-object/navigated-named-objects.window.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/named-access-on-the-window-object/navigated-named-objects.window.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/named-access-on-the-window-object/w3c-import.log
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/named-access-on-the-window-object/window-named-properties-expected.txt [moved from LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-named-properties-expected.txt with 91% similarity]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/named-access-on-the-window-object/window-named-properties.html [moved from LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-named-properties.html with 93% similarity]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/security-window/w3c-import.log
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/security-window/window-security.https-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/security-window/window-security.https.html [moved from LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/security-window/window-security.html with 98% similarity]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/self-et-al.window-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/self-et-al.window.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/self-et-al.window.js [new file with mode: 0644]
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-noopener-expected.txt
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-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-noreferrer.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-properties.https-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-properties.https.html [moved from LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-properties.html with 98% similarity]
LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/browsers/the-window-object/BarProp.window-expected.txt [new file with mode: 0644]
LayoutTests/tests-options.json

index 6d715d8..3ed84d9 100644 (file)
@@ -1,3 +1,12 @@
+2019-03-28  Chris Dumez  <cdumez@apple.com>
+
+        Re-sync web-platform-tests/html/browsers/the-window-object/ from upstream
+        https://bugs.webkit.org/show_bug.cgi?id=196379
+
+        Reviewed by Ryosuke Niwa.
+
+        * tests-options.json:
+
 2019-03-28  John Wilander  <wilander@apple.com>
 
         Resource Load Statistics: IPC to the WebsiteDataStore in the UI process from NetworkProcess::deleteWebsiteDataForRegistrableDomains()
index 9995769..d7fcc29 100644 (file)
@@ -1,5 +1,16 @@
 2019-03-28  Chris Dumez  <cdumez@apple.com>
 
+        Re-sync web-platform-tests/html/browsers/the-window-object/ from upstream
+        https://bugs.webkit.org/show_bug.cgi?id=196379
+
+        Reviewed by Ryosuke Niwa.
+
+        Re-sync web-platform-tests/html/browsers/the-window-object/ from upstream 3bfdeb8976fc.
+
+        * web-platform-tests/html/browsers/the-window-object/*: Updated.
+
+2019-03-28  Chris Dumez  <cdumez@apple.com>
+
         Unreviewed, rebaseline web-platform-tests/html/dom/interfaces.html
 
         * web-platform-tests/html/dom/interfaces-expected.txt:
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/BarProp.window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/BarProp.window-expected.txt
new file mode 100644 (file)
index 0000000..d64a6e6
--- /dev/null
@@ -0,0 +1,4 @@
+
+PASS BarBrop objects of a nested Window 
+PASS BarProp objects of an auxiliary Window 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/BarProp.window.html b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/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/BarProp.window.js b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/BarProp.window.js
new file mode 100644 (file)
index 0000000..27a357c
--- /dev/null
@@ -0,0 +1,59 @@
+function assert_barProps(barPropObjects, visible) {
+  let lastBarProp = undefined;
+  for (const currentBarProp of barPropObjects) {
+    assert_not_equals(currentBarProp, lastBarProp, "BarBrop objects of different properties are identical");
+    assert_equals(currentBarProp.visible, visible, "a BarProp's visible is wrong");
+    lastBarProp = currentBarProp;
+  }
+}
+
+function assert_identical_barProps(barProps, w, oldBarPropObjects, visible) {
+  barProps.map(val => w[val]).map((val, index) => {
+    assert_equals(val, oldBarPropObjects[index], "BarProp identity not preserved");
+  });
+  assert_barProps(oldBarPropObjects, visible);
+}
+
+async_test(t => {
+  const frame = document.body.appendChild(document.createElement("iframe")),
+        frameW = frame.contentWindow,
+        barProps = ["locationbar", "menubar", "personalbar", "scrollbars", "statusbar", "toolbar"],
+        barPropObjects = barProps.map(val => frameW[val]);
+
+  assert_barProps(barPropObjects, true);
+  frame.remove();
+  assert_identical_barProps(barProps, frameW, barPropObjects, false);
+  t.step_timeout(() => {
+    assert_identical_barProps(barProps, frameW, barPropObjects, false);
+    t.done();
+  }, 0);
+}, "BarBrop objects of a nested Window");
+
+async_test(t => {
+  const openee = window.open("/common/blank.html"),
+        barProps = ["locationbar", "menubar", "personalbar", "scrollbars", "statusbar", "toolbar"],
+        barPropObjects = barProps.map(val => openee[val]);
+
+  // This is used to demonstrate that the Document is replaced while the global object (not the
+  // global this object) stays the same
+  openee.tiedToGlobalObject = openee.document;
+
+  assert_barProps(barPropObjects, true);
+  openee.onload = t.step_func(() => {
+    assert_own_property(openee, "tiedToGlobalObject");
+    assert_not_equals(openee.tiedToGlobalObject, openee.document);
+
+    assert_identical_barProps(barProps, openee, barPropObjects, true);
+
+    openee.onunload = t.step_func(() => {
+      assert_identical_barProps(barProps, openee, barPropObjects, true);
+      t.step_timeout(() => {
+        assert_identical_barProps(barProps, openee, barPropObjects, false);
+        t.done();
+      }, 0);
+    });
+
+    openee.close();
+    assert_identical_barProps(barProps, openee, barPropObjects, true);
+  });
+}, "BarProp objects of an auxiliary Window");
index c26ed57..6247569 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
 
index 0caad26..5afdc11 100644 (file)
@@ -1,10 +1,10 @@
 
-PASS tokenization should skip window features separators before `name` 
-PASS feature `name` should be converted to ASCII lowercase 
-PASS after `name`, tokenization should skip window features separators that are not "=" or "," 
-PASS Tokenizing should ignore window feature separators except "," after initial "=" and before value 
-PASS Tokenizing should read characters until first window feature separator as `value` 
+PASS Tokenization of "noopener" should skip window features separators before feature 
+PASS Feature "noopener" should be converted to ASCII lowercase 
+PASS After "noopener", tokenization should skip window features separators that are not "=" or "," 
+PASS Tokenizing "noopener" should ignore window feature separators except "," after initial "=" and before value 
+PASS Tokenizing "noopener" should read characters until first window feature separator as `value` 
 PASS Integer values other than 0 should activate the feature 
-PASS Integer value of 0 should not activate the feature 
-PASS invalid feature names should not tokenize as "noopener" 
+PASS Integer value of 0 should not activate "noopener" 
+PASS Invalid feature names should not tokenize as "noopener" 
 
index c31e75f..c955e67 100644 (file)
@@ -5,158 +5,7 @@
 <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>
-var windowURL = 'resources/close-self.html';
-
-// Tests for how windows features are tokenized into 'name', 'value'
-// window features separators are ASCII whitespace, '=' and  ','
-
-test (t => {
-  // Tokenizing `name`: initial window features separators are ignored
-  // Each of these variants should tokenize to ('noopener', '')
-  var featureVariants = [
-    ' noopener',
-    '=noopener',
-    ',,noopener',
-    ',=, noopener',
-    '\n=noopener=',
-    '\tnoopener',
-    '\r,,,=noopener',
-    '\u000Cnoopener'
-  ];
-  featureVariants.forEach(feature => {
-    var win = window.open(windowURL, '', feature);
-    assert_equals(win, null, `"${feature}" should activate feature "noopener"`);
-  });
-}, 'tokenization should skip window features separators before `name`');
-
-test (t => {
-  // Tokenizing `name`: lowercase conversion
-  // Each of these variants should tokenize as feature ('noopener', '')
-  // except where indicated
-  // Note also that `value` is lowercased during tokenization
-  var featureVariants = [
-    'NOOPENER',
-    'noOpenER',
-    '  NOopener',
-    '=NOOPENER',
-    'noopener=1',
-    'NOOPENER=1',
-    'NOOPENER=yes',
-    'noopener=YES',
-  ];
-  featureVariants.forEach(feature => {
-    var win = window.open(windowURL, '', feature);
-    assert_equals(win, null, `"${feature}" should activate feature "noopener"`);
-  });
-}, 'feature `name` 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', '')
-  var featureVariants = [
-    'noopener',
-    ' noopener\r',
-    'noopener\n =',
-    'noopener,',
-    'noopener  =,',
-    ', noopener   =',
-    'noopener,=',
-    'noopener foo', // => ('noopener', ''), ('foo', '')
-    'foo noopener=1', // => ('foo', ''), ('noopener', '1')
-    'foo=\u000Cbar\u000Cnoopener' // => ('foo', 'bar'), ('noopener', '')
-  ];
-  featureVariants.forEach(feature => {
-    var win = window.open(windowURL, '', feature);
-    assert_equals(win, null, `"${feature}" should activate feature "noopener"`);
-  });
-}, 'after `name`, 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
-  var featureVariants = [
-    'noopener=  yes', // => ('noopener', 'yes')
-    'noopener==,',
-    'noopener=\n ,',
-    'noopener = \t ,',
-    'noopener\n=\r 1,', // => ('noopener', '1')
-    'noopener=,yes', // => ('noopener'), ('yes')
-    'noopener= yes=,', // => ('noopener', 'yes')
-    'noopener = \u000Cyes' // => ('noopener', 'yes')
-  ];
-  featureVariants.forEach(feature => {
-    var win = window.open(windowURL, '', feature);
-    assert_equals(win, null, `"${feature}" should activate feature "noopener"`);
-  });
-}, 'Tokenizing 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
-  var featureVariants = [
-    'noopener=1', // => ('noopener', 'noopener')
-    'noopener=yes', // => ('noopener', 'yes')
-    'noopener = yes ,', // => ('noopener', 'yes')
-    'noopener=\nyes  ,', // => ('noopener', 'yes')
-    'noopener=yes yes', // => ('noopener', 'yes'), ('yes', '')
-    'noopener=yes\ts', // => ('noopener', 'yes'), ('s', '')
-    'noopener==', // => ('noopener', '')
-    'noopener=1\n,', // => ('noopener', '1')
-    '==noopener===', // => ('noopener', '')
-    'noopener==\u000C' // => ('noopener', '')
-  ];
-  featureVariants.forEach(feature => {
-    var win = window.open(windowURL, '', feature);
-    assert_equals(win, null, `"${feature}" should set "noopener"`);
-  });
-}, 'Tokenizing should read characters until first window feature separator as `value`');
-
-test (t => {
-  var featureVariants = [
-    'noopener=1',
-    'noopener=2',
-    'noopener=12345',
-    'noopener=1.5',
-    'noopener=-1',
-  ];
-  featureVariants.forEach(feature => {
-    var win = window.open(windowURL, '', feature);
-    assert_equals(win, null, `"${feature}" should activate feature "noopener"`);
-  });
-}, 'Integer values other than 0 should activate the feature');
-
-test (t => {
-  var featureVariants = [
-    'noopener=0',
-    'noopener=0.5',
-    'noopener=error',
-  ];
-  featureVariants.forEach(feature => {
-    var win = window.open(windowURL, '', feature);
-    assert_not_equals(win, null, `"${feature}" should NOT activate feature "noopener"`);
-  });
-}, 'Integer value of 0 should not activate the feature');
-
-test (t => {
-  var invalidFeatureVariants = [
-    '-noopener', //     => ('-noopener', '')
-    'NOOPENERRRR', //   => ('noopenerrr', '')
-    'noOpenErR', //     => ('noopenerr', '')
-    'no_opener', //     => ('no_opener', '')
-    ' no opener', //    => ('no', ''), ('opener', '')
-    'no\nopener', //    => ('no', ''), ('opener', '')
-    'no,opener', //     => ('no', ''), ('opener', '')
-    '\0noopener', //    => ('\0noopener', '')
-    'noopener\u0000=yes', // => ('noopener\0', 'yes')
-    'foo=\u000Cnoopener' // => ('foo', 'noopener')
-  ];
-  invalidFeatureVariants.forEach(feature => {
-    var win = window.open(windowURL, '', feature);
-    assert_not_equals(win, null, `"${feature}" should NOT activate feature "noopener"`);
-  });
-}, 'invalid feature names should not tokenize as "noopener"');
+  booleanTests("noopener");
 </script>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noreferrer-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noreferrer-expected.txt
new file mode 100644 (file)
index 0000000..6c914e0
--- /dev/null
@@ -0,0 +1,10 @@
+
+FAIL Tokenization of "noreferrer" should skip window features separators before feature assert_equals: " noreferrer" should activate feature "noreferrer" expected null but got object "[object Window]"
+FAIL Feature "noreferrer" should be converted to ASCII lowercase assert_equals: "NOREFERRER" should activate feature "noreferrer" expected null but got object "[object Window]"
+FAIL After "noreferrer", tokenization should skip window features separators that are not "=" or "," assert_equals: "noreferrer" should activate feature "noreferrer" expected null but got object "[object Window]"
+FAIL Tokenizing "noreferrer" should ignore window feature separators except "," after initial "=" and before value assert_equals: "noreferrer=  yes" should activate feature "noreferrer" expected null but got object "[object Window]"
+FAIL Tokenizing "noreferrer" should read characters until first window feature separator as `value` assert_equals: "noreferrer=1" should set "noreferrer" expected null but got object "[object Window]"
+FAIL Integer values other than 0 should activate the feature assert_equals: "noreferrer=1" should activate feature "noreferrer" expected null but got object "[object Window]"
+PASS Integer value of 0 should not activate "noreferrer" 
+PASS Invalid feature names should not tokenize as "noreferrer" 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noreferrer.html b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noreferrer.html
new file mode 100644 (file)
index 0000000..4807f63
--- /dev/null
@@ -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>
index 12836f5..07662c6 100644 (file)
@@ -1,12 +1,12 @@
 <script src="/common/PrefixedPostMessage.js"></script>
 <script>
 var prefixedMessage = new PrefixedMessageResource();
-var max = 50, attempts = 0;
+var max = 150, attempts = 0;
 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
-  // 5 seconds for positioning to take place.
+  // 15 seconds for positioning to take place.
   if (!window.screenX && !window.screenY && ++attempts < max) {
     setTimeout(sendCoordinates, 100);
     return;
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/resources/tokenization-noopener-noreferrer.js b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/resources/tokenization-noopener-noreferrer.js
new file mode 100644 (file)
index 0000000..a9d42e2
--- /dev/null
@@ -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}"`);
+}
index 5af2f8a..3e63d24 100644 (file)
@@ -16,3 +16,4 @@ None
 List of files:
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/resources/close-self.html
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/resources/message-opener.html
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/resources/tokenization-noopener-noreferrer.js
index a266a10..0eaa551 100644 (file)
@@ -37,6 +37,7 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-non-integer-width.html
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-innerheight-innerwidth.html
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noopener.html
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noreferrer.html
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-screenx-screeny.html
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-top-left.html
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-width-height.html
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/close-method.window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/close-method.window-expected.txt
new file mode 100644 (file)
index 0000000..b991992
--- /dev/null
@@ -0,0 +1,4 @@
+
+FAIL window.close() queues a task to discard, but window.closed knows immediately assert_equals: expected true but got false
+FAIL window.close() affects name targeting immediately assert_equals: expected true but got false
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/close-method.window.html b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/close-method.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/close-method.window.js b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/close-method.window.js
new file mode 100644 (file)
index 0000000..0288f9c
--- /dev/null
@@ -0,0 +1,39 @@
+function assert_closed_opener(w, closed, opener) {
+  assert_equals(w.closed, closed);
+  assert_equals(w.opener, opener);
+}
+
+async_test(t => {
+  const openee = window.open();
+  assert_closed_opener(openee, false, self);
+  openee.onunload = t.step_func(() => {
+    assert_closed_opener(openee, true, self);
+    t.step_timeout(() => {
+      assert_closed_opener(openee, true, null);
+      t.done();
+    }, 0);
+  });
+  openee.close();
+  assert_closed_opener(openee, true, self);
+}, "window.close() queues a task to discard, but window.closed knows immediately");
+
+async_test(t => {
+  const openee = window.open("", "greatname");
+  assert_closed_opener(openee, false, self);
+  openee.close();
+  assert_closed_opener(openee, true, self);
+  const openee2 = window.open("", "greatname");
+  assert_not_equals(openee, openee2);
+  assert_closed_opener(openee, true, self); // Ensure second window.open() call was synchronous
+  openee2.onunload = t.step_func(() => {
+    assert_closed_opener(openee2, true, self);
+    t.step_timeout(() => {
+      assert_closed_opener(openee, true, null);
+      assert_closed_opener(openee2, true, null);
+      t.done();
+    }, 0);
+  });
+  openee2.close();
+  assert_closed_opener(openee, true, self); // Ensure second close() call was synchronous
+  assert_closed_opener(openee2, true, self);
+}, "window.close() affects name targeting immediately");
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/closed-attribute.window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/closed-attribute.window-expected.txt
new file mode 100644 (file)
index 0000000..2f7e0c2
--- /dev/null
@@ -0,0 +1,10 @@
+
+Harness Error (TIMEOUT), message = null
+
+PASS closed and same-origin nested browsing context 
+FAIL closed/close() and same-origin auxiliary browsing context assert_equals: expected true but got false
+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
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/closed-attribute.window.html b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/closed-attribute.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/closed-attribute.window.js b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/closed-attribute.window.js
new file mode 100644 (file)
index 0000000..88a3beb
--- /dev/null
@@ -0,0 +1,69 @@
+// META: script=/common/get-host-info.sub.js
+
+function closedTest(newWindow, closeNewWindowsBrowsingContext) {
+  assert_equals(newWindow.closed, false);
+  closeNewWindowsBrowsingContext();
+  assert_equals(newWindow.closed, true);
+}
+
+test(() => {
+  const frame = document.body.appendChild(document.createElement("iframe"));
+  closedTest(frame.contentWindow, () => frame.remove());
+}, "closed and same-origin nested browsing context");
+
+test(() => {
+  const openee = window.open();
+  closedTest(openee, () => openee.close());
+
+  // close() is a no-op once "is closing" is set
+  openee.close();
+  assert_equals(openee.closed, true);
+}, "closed/close() and same-origin auxiliary browsing context");
+
+const support = new URL("support/closed.html", location.href).pathname;
+[
+  {
+    type: "cross-origin",
+    url: `${get_host_info().HTTP_REMOTE_ORIGIN}${support}`
+  },
+  {
+    type: "cross-site",
+    url: `${get_host_info().HTTP_NOTSAMESITE_ORIGIN}${support}`
+  }
+].forEach(val => {
+  async_test(t => {
+    const frame = document.createElement("iframe"),
+          ident = `${val.type}-nested-bc`;
+    frame.src = `${val.url}?window=parent&ident=${ident}`;
+    const listener = t.step_func(e => {
+      if (e.data === ident) {
+        closedTest(frame.contentWindow, () => frame.remove());
+        self.removeEventListener("message", listener);
+        t.done();
+      }
+    });
+    // Use a message event rather than onload for consistency with auxiliary browsing contexts.
+    self.addEventListener("message", listener);
+    document.body.append(frame);
+  }, `closed and ${val.type} nested browsing context`);
+
+  async_test(t => {
+    const ident = `${val.type}-auxiliary-bc`,
+          support = new URL("support/closed.html", location.href).pathname,
+          openee = window.open(`${val.url}?window=opener&ident=${ident}`),
+          listener = t.step_func(e => {
+      if (e.data === ident) {
+        closedTest(openee, () => openee.close());
+
+        // close() is a no-op once "is closing" is set
+        openee.close();
+        assert_equals(openee.closed, true);
+
+        self.removeEventListener("message", listener);
+        t.done();
+      }
+    });
+    // As there's no cross-origin onload, use a message event.
+    self.addEventListener("message", listener);
+  }, `closed/close() and ${val.type} auxiliary browsing context`);
+});
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/document-attribute.window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/document-attribute.window-expected.txt
new file mode 100644 (file)
index 0000000..3db98b2
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS Window object's document IDL attribute and discarding the browsing context 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/document-attribute.window.html b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/document-attribute.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/document-attribute.window.js b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/document-attribute.window.js
new file mode 100644 (file)
index 0000000..f13acdb
--- /dev/null
@@ -0,0 +1,15 @@
+async_test(t => {
+  const frame = document.createElement("iframe");
+  frame.onload = t.step_func(() => {
+    const frameW = frame.contentWindow,
+          frameD = frame.contentDocument;
+    assert_equals(frameW.document, frameD);
+    frame.remove();
+    assert_equals(frameW.document, frameD);
+    t.step_timeout(() => {
+      assert_equals(frameW.document, frameD);
+      t.done();
+    }, 100);
+  });
+  document.body.append(frame);
+}, "Window object's document IDL attribute and discarding the browsing context");
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/focus.window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/focus.window-expected.txt
new file mode 100644 (file)
index 0000000..c2c15e0
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS Untitled 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/focus.window.html b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/focus.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/focus.window.js b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/focus.window.js
new file mode 100644 (file)
index 0000000..6ec7fee
--- /dev/null
@@ -0,0 +1,15 @@
+async_test(t => {
+  const input = document.body.appendChild(document.createElement("input"));
+  input.onfocus = t.step_func(() => {
+    const frame = document.body.appendChild(document.createElement("iframe")),
+          frameW = frame.contentWindow;
+    frameW.onfocus = t.unreached_func();
+    frame.remove();
+    frameW.focus();
+    t.step_timeout(() => {
+      assert_equals(document.activeElement, input);
+      t.done();
+    }, 100);
+  });
+  input.focus();
+});
index d32b986..5e8abd2 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
 
index 5e98014..e8d2846 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
 
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/historical.window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/historical.window-expected.txt
new file mode 100644 (file)
index 0000000..950713a
--- /dev/null
@@ -0,0 +1,3 @@
+
+FAIL showModalDialog() has been removed from the platform assert_false: expected false got true
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/historical.window.html b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/historical.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/length-attribute.window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/length-attribute.window-expected.txt
new file mode 100644 (file)
index 0000000..0158525
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS Window object's length IDL attribute (and named access) 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/length-attribute.window.html b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/length-attribute.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/length-attribute.window.js b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/length-attribute.window.js
new file mode 100644 (file)
index 0000000..d56e1e4
--- /dev/null
@@ -0,0 +1,24 @@
+async_test(t => {
+  const frame = document.createElement("iframe");
+  frame.srcdoc = "<iframe name=x srcdoc='<iframe name=z></iframe>'></iframe><iframe name=y></iframe>";
+  frame.onload = t.step_func_done(() => {
+    const frameW = frame.contentWindow;
+    assert_equals(frameW.length, 2);
+    assert_not_equals(frameW.x, undefined);
+    assert_not_equals(frameW.y, undefined);
+    assert_equals(frameW.z, undefined);
+    assert_equals(frameW.x, frameW[0]);
+    assert_equals(frameW.y, frameW[1]);
+    const xFrameW = frameW.x;
+    assert_equals(xFrameW.length, 1);
+    assert_not_equals(xFrameW.z, undefined);
+    assert_equals(xFrameW.z, xFrameW[0]);
+    frame.remove();
+    assert_equals(frameW.length, 0);
+    assert_equals(frameW.x, undefined);
+    assert_equals(frameW[0], undefined);
+    assert_equals(xFrameW.length, 0);
+    assert_equals(xFrameW.z, undefined);
+  });
+  document.body.append(frame);
+}, "Window object's length IDL attribute (and named access)");
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/name-attribute.window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/name-attribute.window-expected.txt
new file mode 100644 (file)
index 0000000..8f04c7c
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS Window object's name IDL attribute 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/name-attribute.window.html b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/name-attribute.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/name-attribute.window.js b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/name-attribute.window.js
new file mode 100644 (file)
index 0000000..f266dd7
--- /dev/null
@@ -0,0 +1,18 @@
+test(() => {
+  const frame = document.createElement("iframe"),
+        name = "A",
+        name2 = "B";
+  frame.setAttribute("name", name);
+  document.body.append(frame);
+  const frameW = frame.contentWindow;
+  assert_equals(frameW.name, name);
+  frameW.name = name2;
+  assert_equals(frame.getAttribute("name"), name);
+  assert_equals(frameW.name, name2);
+  frame.remove();
+  assert_equals(frame.getAttribute("name"), name);
+  assert_equals(frameW.name, "");
+  frameW.name = name2;
+  assert_equals(frame.getAttribute("name"), name);
+  assert_equals(frameW.name, "");
+}, "Window object's name IDL attribute");
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/named-access-on-the-window-object/navigated-named-objects.window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/named-access-on-the-window-object/navigated-named-objects.window-expected.txt
new file mode 100644 (file)
index 0000000..eb0e106
--- /dev/null
@@ -0,0 +1,14 @@
+
+PASS Window's associated Document object is used for finding named objects (<div> via srcdoc <iframe>) 
+PASS Window's associated Document object is used for finding named objects (<object> via srcdoc <iframe>) 
+PASS Window's associated Document object is used for finding named objects (<iframe> via srcdoc <iframe>) 
+FAIL Window's associated Document object is used for finding named objects (<object> with browsing ccontext via srcdoc <iframe)> assert_equals: expected (object) null but got (undefined) undefined
+FAIL Window's associated Document object is used for finding named objects (<div> via same-origin <iframe>) f is not a function. (In 'f()', 'f' is undefined)
+FAIL Window's associated Document object is used for finding named objects (<object> via same-origin <iframe>) f is not a function. (In 'f()', 'f' is undefined)
+FAIL Window's associated Document object is used for finding named objects (<iframe> via same-origin <iframe>) f is not a function. (In 'f()', 'f' is undefined)
+FAIL Window's associated Document object is used for finding named objects (<object> with browsing ccontext via same-origin <iframe)> f is not a function. (In 'f()', 'f' is undefined)
+FAIL Window's associated Document object is used for finding named objects (<div> via cross-site <iframe>) f is not a function. (In 'f()', 'f' is undefined)
+FAIL Window's associated Document object is used for finding named objects (<object> via cross-site <iframe>) f is not a function. (In 'f()', 'f' is undefined)
+FAIL Window's associated Document object is used for finding named objects (<iframe> via cross-site <iframe>) f is not a function. (In 'f()', 'f' is undefined)
+FAIL Window's associated Document object is used for finding named objects (<object> with browsing ccontext via cross-site <iframe)> f is not a function. (In 'f()', 'f' is undefined)
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/named-access-on-the-window-object/navigated-named-objects.window.html b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/named-access-on-the-window-object/navigated-named-objects.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/named-access-on-the-window-object/navigated-named-objects.window.js b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/named-access-on-the-window-object/navigated-named-objects.window.js
new file mode 100644 (file)
index 0000000..59d94ef
--- /dev/null
@@ -0,0 +1,67 @@
+// META: script=/common/get-host-info.sub.js
+
+function echoURL(content) {
+  return `/common/echo.py?content=${encodeURIComponent(content)}`;
+}
+
+function setSrc(frame, type, content) {
+  if (type === "same-origin") {
+    frame.src = echoURL(content);
+  } else if (type === "cross-site") {
+    frame.src = `${get_host_info().HTTP_NOTSAMESITE_ORIGIN}${echoURL(content)}`;
+  } else {
+    frame.srcdoc = content;
+  }
+}
+
+["srcdoc", "same-origin", "cross-site"].forEach(type => {
+  const initialType = type === "srcdoc" ? type : "same-origin";
+
+  [
+    {
+      "namedObject": "<div id=abc></div>",
+      "namedObjectLocalName": "div"
+    },
+    {
+      "namedObject": "<object name=abc></object>",
+      "namedObjectLocalName": "object"
+    },
+    {
+      "namedObject": "<iframe id=abc></iframe>",
+      "namedObjectLocalName": "iframe"
+    }
+  ].forEach(testData => {
+    async_test(t => {
+      const frame = document.createElement("iframe");
+      t.add_cleanup(() => frame.remove());
+      setSrc(frame, initialType, `<script>function f() { return abc }</script>${testData.namedObject}`);
+      frame.onload = t.step_func(() => {
+        const f = frame.contentWindow.f,
+              associatedAbc = f();
+        frame.onload = t.step_func_done(() => {
+          assert_equals(f(), associatedAbc);
+          assert_equals(associatedAbc.localName, testData.namedObjectLocalName);
+        });
+        setSrc(frame, type, "<span id=abc></span>");
+      });
+      document.body.append(frame);
+    }, `Window's associated Document object is used for finding named objects (<${testData.namedObjectLocalName}> via ${type} <iframe>)`);
+  });
+
+  async_test(t => {
+    const frame = document.createElement("iframe");
+    t.add_cleanup(() => frame.remove());
+    setSrc(frame, initialType, "<script>function f() { return abc }</script><object name=abc data='about:blank'></object>");
+    frame.onload = t.step_func(() => {
+      const f = frame.contentWindow.f,
+            associatedAbc = f(),
+            associatedAbcContainer = associatedAbc.frameElement;
+      frame.onload = t.step_func_done(() => {
+        assert_equals(f(), associatedAbcContainer);
+        assert_equals(associatedAbcContainer.contentWindow, null);
+      });
+      setSrc(frame, type, "<span id=abc></span>");
+    });
+    document.body.append(frame);
+  }, `Window's associated Document object is used for finding named objects (<object> with browsing ccontext via ${type} <iframe)>`);
+});
index b7b8c3b..c3c13e7 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
 
@@ -15,5 +15,7 @@ None
 ------------------------------------------------------------------------
 List of files:
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/named-access-on-the-window-object/named-objects.html
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/named-access-on-the-window-object/navigated-named-objects.window.js
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/named-access-on-the-window-object/test.html
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/named-access-on-the-window-object/window-named-properties.html
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/named-access-on-the-window-object/window-null-names.html
@@ -13,6 +13,7 @@
 <iframe name="baz"></iframe>
 <iframe name="baz"></iframe>
 <iframe name="constructor"></iframe>
+<iframe id="quux"></iframe>
 <script>
 function assert_data_propdesc(pd, Writable, Enumerable, Configurable) {
   assert_equals(typeof pd, "object");
@@ -25,6 +26,13 @@ test(function() {
   assert_equals(window["bar"],
                 document.getElementsByTagName("iframe")[0].contentWindow);
 }, "Static name");
+
+test(function() {
+  assert_true("quux" in window, "quux not in window");
+  assert_equals(window["quux"],
+                document.getElementsByTagName("iframe")[4]);
+}, "Static id");
+
 test(function() {
   assert_true("bar" in Window.prototype, "bar in Window.prototype");
   assert_false(Window.prototype.hasOwnProperty("bar"), "Window.prototype.hasOwnProperty(\"bar\")");
index 385fd86..58f9bfe 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,4 @@ Property values requiring vendor prefixes:
 None
 ------------------------------------------------------------------------
 List of files:
-/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/security-window/window-security.html
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/security-window/window-security.https.html
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/security-window/window-security.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/security-window/window-security.https-expected.txt
new file mode 100644 (file)
index 0000000..50c6dc1
--- /dev/null
@@ -0,0 +1,127 @@
+
+PASS Window Security testing 
+PASS A SecurityError exception must be thrown when window.applicationCache is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.devicePixelRatio is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.document is accessed from a different origin. 
+FAIL A SecurityError exception must be thrown when window.external is accessed from a different origin. assert_true: window.external should exist. expected true got false
+PASS A SecurityError exception must be thrown when window.frameElement is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.history is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.innerWidth is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.innerHeight is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.locationbar is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.localStorage is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.menubar is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.name is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.navigator is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onabort is accessed from a different origin. 
+FAIL A SecurityError exception must be thrown when window.onafterprint is accessed from a different origin. assert_true: window.onafterprint should exist. expected true got false
+FAIL A SecurityError exception must be thrown when window.onbeforeprint is accessed from a different origin. assert_true: window.onbeforeprint should exist. expected true got false
+PASS A SecurityError exception must be thrown when window.onbeforeunload is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onblur is accessed from a different origin. 
+FAIL A SecurityError exception must be thrown when window.oncancel is accessed from a different origin. assert_true: window.oncancel should exist. expected true got false
+PASS A SecurityError exception must be thrown when window.oncanplay is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.oncanplaythrough is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onchange is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onclick is accessed from a different origin. 
+FAIL A SecurityError exception must be thrown when window.onclose is accessed from a different origin. assert_true: window.onclose should exist. expected true got false
+PASS A SecurityError exception must be thrown when window.oncontextmenu is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.oncuechange is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.ondblclick is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.ondrag is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.ondragend is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.ondragenter is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.ondragleave is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.ondragover is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.ondragstart is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.ondrop is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.ondurationchange is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onemptied is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onended is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onerror is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onfocus is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onhashchange is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.oninput is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.oninvalid is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onkeydown is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onkeypress is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onkeyup is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onload is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onloadeddata is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onloadedmetadata is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onloadstart is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onmessage is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onmousedown is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onmousemove is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onmouseout is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onmouseover is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onmouseup is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onmousewheel is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onoffline is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.ononline is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onpause is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onplay is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onplaying is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onpagehide is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onpageshow is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onpopstate is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onprogress is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onratechange is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onreset is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onresize is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onscroll is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onseeked is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onseeking is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onselect is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onstalled is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onstorage is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onsubmit is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onsuspend is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.ontimeupdate is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onunload is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onvolumechange is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.onwaiting is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.pageXOffset is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.pageYOffset is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.personalbar is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.screen is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.scrollbars is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.statusbar is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.status is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.screenX is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.screenY is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.sessionStorage is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.toolbar is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.alert is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.clearInterval is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.clearTimeout is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.confirm is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.getComputedStyle is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.getSelection is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.matchMedia is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.moveBy is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.moveTo is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.open is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.print is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.prompt is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.resizeTo is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.resizeBy is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.scroll is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.scrollTo is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.scrollBy is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.setInterval is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.setTimeout is accessed from a different origin. 
+PASS A SecurityError exception must be thrown when window.stop is accessed from a different origin. 
+PASS A SecurityError exception should not be thrown when window.closed is accessed from a different origin. 
+PASS A SecurityError exception should not be thrown when window.frames is accessed from a different origin. 
+PASS A SecurityError exception should not be thrown when window.length is accessed from a different origin. 
+PASS A SecurityError exception should not be thrown when window.location is accessed from a different origin. 
+PASS A SecurityError exception should not be thrown when window.opener is accessed from a different origin. 
+PASS A SecurityError exception should not be thrown when window.parent is accessed from a different origin. 
+PASS A SecurityError exception should not be thrown when window.self is accessed from a different origin. 
+PASS A SecurityError exception should not be thrown when window.top is accessed from a different origin. 
+PASS A SecurityError exception should not be thrown when window.window is accessed from a different origin. 
+PASS A SecurityError exception should not be thrown when window.blur is accessed from a different origin. 
+PASS A SecurityError exception should not be thrown when window.close is accessed from a different origin. 
+PASS A SecurityError exception should not be thrown when window.focus is accessed from a different origin. 
+PASS A SecurityError exception should not be thrown when window.postMessage is accessed from a different origin. 
+
@@ -96,7 +96,6 @@ function fr_load() {
       {name: "onseeked"},
       {name: "onseeking"},
       {name: "onselect"},
-      {name: "onshow"},
       {name: "onstalled"},
       {name: "onstorage"},
       {name: "onsubmit"},
@@ -195,7 +194,7 @@ onload = function() {
   var frame = document.createElement('iframe');
   frame.id = "fr";
   frame.setAttribute("style", "display:none");
-  frame.setAttribute('src', get_host_info().HTTP_REMOTE_ORIGIN + "/");
+  frame.setAttribute('src', get_host_info().HTTPS_REMOTE_ORIGIN + "/");
   frame.setAttribute("onload", "fr_load()");
   document.body.appendChild(frame);
 }
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/self-et-al.window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/self-et-al.window-expected.txt
new file mode 100644 (file)
index 0000000..40dae1e
--- /dev/null
@@ -0,0 +1,10 @@
+
+FAIL iframeWindow.frames before and after removal assert_equals: frames got cleared after browsing context removal expected object "[object Window]" but got null
+FAIL popupWindow.frames before, after closing, and after discarding assert_true: expected true got false
+PASS iframeWindow.globalThis before and after removal 
+FAIL popupWindow.globalThis before, after closing, and after discarding assert_true: expected true got false
+FAIL iframeWindow.self before and after removal assert_equals: self got cleared after browsing context removal expected object "[object Window]" but got null
+FAIL popupWindow.self before, after closing, and after discarding assert_true: expected true got false
+FAIL iframeWindow.window before and after removal assert_equals: window got cleared after browsing context removal expected object "[object Window]" but got null
+FAIL popupWindow.window before, after closing, and after discarding assert_true: expected true got false
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/self-et-al.window.html b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/self-et-al.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/self-et-al.window.js b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/self-et-al.window.js
new file mode 100644 (file)
index 0000000..1b0fa12
--- /dev/null
@@ -0,0 +1,43 @@
+function delayed_assert_done(t, w, windowProxySelfReference) {
+  // Let's make sure nobody is being sneaky
+  t.step_timeout(() => {
+    t.step_timeout(() => {
+      assert_equals(w[windowProxySelfReference], w, `${windowProxySelfReference} got cleared after some time`);
+      t.done();
+    }, 0);
+  }, 0);
+}
+
+[
+  "frames",
+  "globalThis",
+  "self",
+  "window"
+].forEach(windowProxySelfReference => {
+  async_test(t => {
+    const frame = document.body.appendChild(document.createElement("iframe")),
+          otherW = frame.contentWindow;
+    assert_equals(otherW[windowProxySelfReference], otherW, `${windowProxySelfReference} is broken`);
+    frame.remove();
+    assert_equals(otherW[windowProxySelfReference], otherW, `${windowProxySelfReference} got cleared after browsing context removal`);
+    assert_true(otherW.closed);
+
+    delayed_assert_done(t, otherW, windowProxySelfReference);
+  }, `iframeWindow.${windowProxySelfReference} before and after removal`);
+
+  async_test(t => {
+    const otherW = window.open();
+    assert_equals(otherW[windowProxySelfReference], otherW, `${windowProxySelfReference} is broken`);
+    otherW.onunload = t.step_func(() => {
+      assert_equals(otherW[windowProxySelfReference], otherW, `${windowProxySelfReference} got cleared after browsing context unload`);
+      t.step_timeout(() => {
+        assert_equals(otherW.opener, null); // Ensure browsing context is discarded
+        assert_equals(otherW[windowProxySelfReference], otherW, `${windowProxySelfReference} got cleared after browsing context removal`);
+        delayed_assert_done(t, otherW, windowProxySelfReference);
+      }, 0);
+    });
+    otherW.close();
+    assert_equals(otherW[windowProxySelfReference], otherW, `${windowProxySelfReference} got cleared after browsing context closure`);
+    assert_true(otherW.closed);
+  }, `popupWindow.${windowProxySelfReference} before, after closing, and after discarding`)
+});
index c4c5f82..3d8cbce 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,13 +14,21 @@ Property values requiring vendor prefixes:
 None
 ------------------------------------------------------------------------
 List of files:
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/BarProp.window.js
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/Document-defaultView.html
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/Window-document.html
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/close-method.window.js
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/closed-attribute.window.js
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/document-attribute.window.js
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/focus.window.js
 /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/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-named-properties.html
 /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-properties.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
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-prototype-chain.html
index b924fa0..dbbe2ca 100644 (file)
@@ -1,17 +1,4 @@
-CONSOLE MESSAGE: line 1: TypeError: this.checkValues is not a function. (In 'this.checkValues(w2)', 'this.checkValues' is undefined)
-CONSOLE MESSAGE: line 1: TypeError: this.checkValues is not a function. (In 'this.checkValues(w2)', 'this.checkValues' is undefined)
-CONSOLE MESSAGE: line 1: TypeError: this.checkValues is not a function. (In 'this.checkValues(w2)', 'this.checkValues' is undefined)
+CONSOLE MESSAGE: line 117: testError: special target must be one of: _self, _parent, _top
 
-Harness Error (FAIL), message = Test named 'window.open() with 'noopener' should not reuse existing target' specified 1 'cleanup' function, and 1 failed.
-
-FAIL window.open() with 'noopener' should not reuse existing target Can't find variable: BroadcastChannel
-NOTRUN noopener needs to be present as a token on its own 
-NOTRUN noopener needs to be present as a token on its own again 
-NOTRUN noopener needs to be present as a token on its own yet again 
-NOTRUN Trailing noopener should work 
-NOTRUN Leading noopener should work 
-NOTRUN Interior noopener should work 
-NOTRUN noopener window.open targeting _self 
-NOTRUN noopener window.open targeting _parent 
-NOTRUN noopener window.open targeting _top 
+FAIL window.open() with "noopener" tests testError: special target must be one of: _self, _parent, _top
 
index f9489c3..cdda633 100644 (file)
@@ -1,6 +1,13 @@
 <!doctype html>
 <meta charset=utf-8>
 <title>window.open() with "noopener" tests</title>
+
+<meta name="variant" content="?indexed">
+<meta name="variant" content="?_self">
+<meta name="variant" content="?_parent">
+<meta name="variant" content="?_top">
+<meta name=timeout content=long>
+
 <script src=/resources/testharness.js></script>
 <script src=/resources/testharnessreport.js></script>
 <script>
@@ -8,13 +15,13 @@ var testData = [
   { testDescription: "window.open() with 'noopener' should not reuse existing target",
     secondWindowFeatureString: "noopener",
     shouldReuse: false },
-  { testDescription: "noopener needs to be present as a token on its own",
+  { testDescription: "noopener=1 means the same as noopener",
     secondWindowFeatureString: "noopener=1",
-    shouldReuse: true },
-  { testDescription: "noopener needs to be present as a token on its own again",
+    shouldReuse: 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 yet again",
+  { testDescription: "noopener needs to be present as a token on its own",
     secondWindowFeatureString: "make me noopener",
     shouldReuse: true },
   { testDescription: "Trailing noopener should work",
@@ -28,7 +35,6 @@ var testData = [
     shouldReuse: false },
 ];
 
-var tests = [];
 /**
  * Loop over our testData array and kick off an async test for each entry.  Each
  * async test opens a window using window.open() with some per-test unique name,
@@ -39,56 +45,59 @@ var tests = [];
  * cases and non-null in the cases when the existing window gets reused) and so
  * forth.
  */
-for (var i = 0; i < testData.length; ++i) {
-  var test = testData[i];
-  var t = async_test(test.testDescription);
-  tests.push(t);
-  t.secondWindowFeatureString = test.secondWindowFeatureString;
-  t.windowName = "someuniquename" + i;
+function indexedTests() {
+  var tests = [];
+  for(var i = 0; i < testData.length; ++i) {
+    var test = testData[i];
+    var t = async_test(test.testDescription);
+    tests.push(t);
+    t.secondWindowFeatureString = test.secondWindowFeatureString;
+    t.windowName = "someuniquename" + i;
 
-  if (test.shouldReuse) {
-    t.step(function() {
-      var windowName = this.windowName;
+    if (test.shouldReuse) {
+      t.step(function() {
+        var windowName = this.windowName;
 
-      var w1 = window.open("", windowName);
-      this.add_cleanup(function() { w1.close(); });
+        var w1 = window.open("", windowName);
+        this.add_cleanup(function() { w1.close(); });
 
-      assert_equals(w1.opener, window);
+        assert_equals(w1.opener, window);
 
-      var w2 = window.open("", windowName, this.secondWindowFeatureString);
-      assert_equals(w2, w1);
-      assert_equals(w2.opener, w1.opener);
-      assert_equals(w2.opener, window);
-      this.done();
-    });
-  } else {
-    t.step(function() {
-      var w1;
-      this.add_cleanup(function() {
-        w1.close();
-        channel.postMessage(null);
+        var w2 = window.open("", windowName, this.secondWindowFeatureString);
+        assert_equals(w2, w1);
+        assert_equals(w2.opener, w1.opener);
+        assert_equals(w2.opener, window);
+        this.done();
       });
+    } else {
+      t.step(function() {
+        var w1;
+        this.add_cleanup(function() {
+          w1.close();
+          channel.postMessage(null);
+        });
 
-      var windowName = this.windowName;
-      var channel = new BroadcastChannel(windowName);
+        var windowName = this.windowName;
+        var channel = new BroadcastChannel(windowName);
 
-      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(w1.opener, window);
-        assert_equals(w1.location.href, "about:blank");
-      });
+        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(w1.opener, window);
+          assert_equals(w1.location.href, "about:blank");
+        });
 
-      w1 = window.open("", windowName);
-      assert_equals(w1.opener, window);
+        w1 = window.open("", windowName);
+        assert_equals(w1.opener, window);
 
-      var w2 = window.open("support/noopener-target.html?" + windowName,
-                           windowName, this.secondWindowFeatureString);
-      assert_equals(w2, null);
+        var w2 = window.open("support/noopener-target.html?" + windowName,
+                            windowName, this.secondWindowFeatureString);
+        assert_equals(w2, null);
 
-      assert_equals(w1.opener, window);
-    });
+        assert_equals(w1.opener, window);
+      });
+    }
   }
 }
 
@@ -96,13 +105,27 @@ for (var i = 0; i < testData.length; ++i) {
  * Loop over the special targets that ignore noopener and check that doing a
  * window.open() with those targets correctly reuses the existing window.
  */
-for (var target of ["_self", "_parent", "_top"]) {
-  var t = async_test("noopener window.open targeting " + target);
-  tests.push(t);
-  t.openedWindow = window.open(`javascript:var w2 = window.open("", "${target}", "noopener"); this.checkValues(w2); this.close(); void(0);`);
-  assert_equals(t.openedWindow.opener, window);
-  t.openedWindow.checkValues = t.step_func_done(function(win) {
-    assert_equals(win, this.openedWindow);
-  });
+function specialTargetTest(target) {
+  if (["_self", "_parent", "_top"].includes(target)) {
+    var t = async_test("noopener window.open targeting " + target);
+    t.openedWindow = window.open(`javascript:var w2 = window.open("", "${target}", "noopener"); this.checkValues(w2); this.close(); void(0);`);
+    assert_equals(t.openedWindow.opener, window);
+    t.openedWindow.checkValues = t.step_func_done(function(win) {
+      assert_equals(win, this.openedWindow);
+    });
+  } else {
+    throw 'testError: special target must be one of: _self, _parent, _top'
+  }
+}
+
+/**
+ * Parse the Query string, check if it matches keyword 'indexed' to run the indexed tests,
+ * otherwise test it as a special target
+ */
+var variant = window.location.href.split("?")[1]
+if(variant == "indexed") {
+  indexedTests();
+} else {
+  specialTargetTest(variant);
 }
 </script>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-noreferrer-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-noreferrer-expected.txt
new file mode 100644 (file)
index 0000000..1597c30
--- /dev/null
@@ -0,0 +1,3 @@
+
+FAIL window.open() with "noreferrer" tests Can't find variable: BroadcastChannel
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-noreferrer.html b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-noreferrer.html
new file mode 100644 (file)
index 0000000..92b72cd
--- /dev/null
@@ -0,0 +1,20 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>window.open() with "noreferrer" tests</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script>
+async_test(t => {
+  const channelName = "343243423432",
+        channel = new BroadcastChannel(channelName);
+  window.open("support/noreferrer-target.html?" + channelName, "", "noreferrer");
+  channel.onmessage = t.step_func_done(e => {
+    // Send message first so if asserts throw the popup is still closed
+    channel.postMessage(null);
+
+    assert_equals(e.data.name, "");
+    assert_equals(e.data.referrer, "");
+    assert_equals(e.data.haveOpener, false);
+  });
+});
+</script>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-properties.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-properties.https-expected.txt
new file mode 100644 (file)
index 0000000..4a2b432
--- /dev/null
@@ -0,0 +1,176 @@
+
+PASS Value Properties of the Global Object 
+PASS Value Property: NaN 
+PASS Value Property: Infinity 
+PASS Value Property: undefined 
+PASS Function Properties of the Global Object 
+PASS Function Property: eval 
+PASS Function Property: parseInt 
+PASS Function Property: parseFloat 
+PASS Function Property: isNaN 
+PASS Function Property: isFinite 
+PASS URI Handling Function Properties 
+PASS URI Handling Function Property: decodeURI 
+PASS URI Handling Function Property: decodeURIComponent 
+PASS URI Handling Function Property: encodeURI 
+PASS URI Handling Function Property: encodeURIComponent 
+PASS Constructor Properties of the Global Object 
+PASS Constructor Property: Object 
+PASS Constructor Property: Function 
+PASS Constructor Property: Array 
+PASS Constructor Property: String 
+PASS Constructor Property: Boolean 
+PASS Constructor Property: Number 
+PASS Constructor Property: Date 
+PASS Constructor Property: RegExp 
+PASS Constructor Property: Error 
+PASS Constructor Property: EvalError 
+PASS Constructor Property: RangeError 
+PASS Constructor Property: ReferenceError 
+PASS Constructor Property: SyntaxError 
+PASS Constructor Property: TypeError 
+PASS Constructor Property: URIError 
+PASS Other Properties of the Global Object 
+PASS Other Property: Math 
+PASS Other Property: JSON 
+PASS EventTarget interface 
+PASS EventTarget method: addEventListener 
+PASS EventTarget method: removeEventListener 
+PASS EventTarget method: dispatchEvent 
+PASS Window interface 
+PASS Window method: close 
+PASS Window method: stop 
+PASS Window method: focus 
+PASS Window method: blur 
+PASS Window method: open 
+PASS Window method: alert 
+PASS Window method: confirm 
+PASS Window method: prompt 
+PASS Window method: print 
+PASS Window method: postMessage 
+PASS Window method: btoa 
+PASS Window method: atob 
+PASS Window method: setTimeout 
+PASS Window method: clearTimeout 
+PASS Window method: setInterval 
+PASS Window method: clearInterval 
+PASS Window method: queueMicrotask 
+PASS Window method: createImageBitmap 
+PASS Window method: getSelection 
+PASS Window method: getComputedStyle 
+PASS Window method: matchMedia 
+PASS Window method: moveBy 
+PASS Window method: moveTo 
+PASS Window method: resizeBy 
+PASS Window method: resizeTo 
+PASS Window method: scroll 
+PASS Window method: scrollTo 
+PASS Window method: scrollBy 
+PASS Window readonly attribute: history 
+PASS Window readonly attribute: frameElement 
+PASS Window readonly attribute: navigator 
+PASS Window readonly attribute: applicationCache 
+PASS Window readonly attribute: sessionStorage 
+PASS Window readonly attribute: localStorage 
+PASS Window attribute: name 
+PASS Window attribute: status 
+PASS Window attribute: opener 
+PASS Window attribute: onabort 
+FAIL Window attribute: onafterprint assert_true: onafterprint in window expected true got false
+FAIL Window attribute: onbeforeprint assert_true: onbeforeprint in window expected true got false
+PASS Window attribute: onbeforeunload 
+PASS Window attribute: onblur 
+FAIL Window attribute: oncancel assert_true: oncancel in window expected true got false
+PASS Window attribute: oncanplay 
+PASS Window attribute: oncanplaythrough 
+PASS Window attribute: onchange 
+PASS Window attribute: onclick 
+FAIL Window attribute: onclose assert_true: onclose in window expected true got false
+PASS Window attribute: oncontextmenu 
+PASS Window attribute: oncuechange 
+PASS Window attribute: ondblclick 
+PASS Window attribute: ondrag 
+PASS Window attribute: ondragend 
+PASS Window attribute: ondragenter 
+PASS Window attribute: ondragleave 
+PASS Window attribute: ondragover 
+PASS Window attribute: ondragstart 
+PASS Window attribute: ondrop 
+PASS Window attribute: ondurationchange 
+PASS Window attribute: onemptied 
+PASS Window attribute: onended 
+PASS Window attribute: onerror 
+PASS Window attribute: onfocus 
+PASS Window attribute: onhashchange 
+PASS Window attribute: oninput 
+PASS Window attribute: oninvalid 
+PASS Window attribute: onkeydown 
+PASS Window attribute: onkeypress 
+PASS Window attribute: onkeyup 
+PASS Window attribute: onload 
+PASS Window attribute: onloadeddata 
+PASS Window attribute: onloadedmetadata 
+PASS Window attribute: onloadstart 
+PASS Window attribute: onmessage 
+PASS Window attribute: onmousedown 
+PASS Window attribute: onmousemove 
+PASS Window attribute: onmouseout 
+PASS Window attribute: onmouseover 
+PASS Window attribute: onmouseup 
+PASS Window attribute: onmousewheel 
+PASS Window attribute: onoffline 
+PASS Window attribute: ononline 
+PASS Window attribute: onpause 
+PASS Window attribute: onplay 
+PASS Window attribute: onplaying 
+PASS Window attribute: onpagehide 
+PASS Window attribute: onpageshow 
+PASS Window attribute: onpopstate 
+PASS Window attribute: onprogress 
+PASS Window attribute: onratechange 
+PASS Window attribute: onreset 
+PASS Window attribute: onresize 
+PASS Window attribute: onscroll 
+PASS Window attribute: onseeked 
+PASS Window attribute: onseeking 
+PASS Window attribute: onselect 
+PASS Window attribute: onstalled 
+PASS Window attribute: onstorage 
+PASS Window attribute: onsubmit 
+PASS Window attribute: onsuspend 
+PASS Window attribute: ontimeupdate 
+PASS Window attribute: onunload 
+PASS Window attribute: onvolumechange 
+PASS Window attribute: onwaiting 
+PASS Window unforgeable attribute: window 
+PASS Window unforgeable attribute: document 
+PASS Window unforgeable attribute: location 
+PASS Window unforgeable attribute: top 
+PASS Window replaceable attribute: self 
+PASS Window replaceable attribute: locationbar 
+PASS Window replaceable attribute: menubar 
+PASS Window replaceable attribute: personalbar 
+PASS Window replaceable attribute: scrollbars 
+PASS Window replaceable attribute: statusbar 
+PASS Window replaceable attribute: toolbar 
+PASS Window replaceable attribute: frames 
+PASS Window replaceable attribute: parent 
+FAIL Window replaceable attribute: external assert_true: external in window expected true got false
+PASS Window replaceable attribute: length 
+PASS Window replaceable attribute: origin 
+PASS Window replaceable attribute: screen 
+PASS Window replaceable attribute: scrollX 
+PASS Window replaceable attribute: scrollY 
+PASS Window replaceable attribute: pageXOffset 
+PASS Window replaceable attribute: pageYOffset 
+PASS Window replaceable attribute: innerWidth 
+PASS Window replaceable attribute: innerHeight 
+PASS Window replaceable attribute: screenLeft 
+PASS Window replaceable attribute: screenTop 
+PASS Window replaceable attribute: screenX 
+PASS Window replaceable attribute: screenY 
+PASS Window replaceable attribute: outerWidth 
+PASS Window replaceable attribute: outerHeight 
+PASS Window replaceable attribute: devicePixelRatio 
+PASS constructor 
+
@@ -54,6 +54,7 @@ var replaceableAttributes = [
   "parent",
   "external",
   "length",
+  "origin",
 
   // CSSOM-View
   "screen",
@@ -63,6 +64,8 @@ var replaceableAttributes = [
   "pageYOffset",
   "innerWidth",
   "innerHeight",
+  "screenLeft",
+  "screenTop",
   "screenX",
   "screenY",
   "outerWidth",
@@ -92,6 +95,12 @@ var methods = [
   "setInterval",
   "clearInterval",
 
+  // Microtask queuing
+  "queueMicrotask",
+
+  // ImageBitmap
+  "createImageBitmap",
+
   // HTML Editing APIs
   "getSelection",
 
@@ -100,6 +109,10 @@ var methods = [
 
   // CSSOM-View
   "matchMedia",
+  "moveBy",
+  "moveTo",
+  "resizeBy",
+  "resizeTo",
   "scroll",
   "scrollTo",
   "scrollBy"
@@ -181,7 +194,6 @@ var writableAttributes = [
   "onseeked",
   "onseeking",
   "onselect",
-  "onshow",
   "onstalled",
   "onstorage",
   "onsubmit",
diff --git a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/browsers/the-window-object/BarProp.window-expected.txt b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/browsers/the-window-object/BarProp.window-expected.txt
new file mode 100644 (file)
index 0000000..278cce0
--- /dev/null
@@ -0,0 +1,4 @@
+
+FAIL BarBrop objects of a nested Window assert_equals: a BarProp's visible is wrong expected true but got false
+FAIL BarProp objects of an auxiliary Window assert_equals: a BarProp's visible is wrong expected true but got false
+
index ffa1115..63008c2 100644 (file)
     "imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noopener.html": [
         "slow"
     ],
+    "imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noreferrer.html": [
+        "slow"
+    ],
     "imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-screenx-screeny.html": [
         "slow"
     ],
     "imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-width-height.html": [
         "slow"
     ],
+    "imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-noopener.html": [
+        "slow"
+    ],
     "imported/w3c/web-platform-tests/html/dom/interfaces.html": [
         "slow"
     ],