Title: [290899] trunk
Revision
290899
Author
cdu...@apple.com
Date
2022-03-07 11:21:15 -0800 (Mon, 07 Mar 2022)

Log Message

Make "true" count as truthy in window.open()'s boolean features
https://bugs.webkit.org/show_bug.cgi?id=237530

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Import WPT test coverage.

* resources/resource-files.json:
* web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-is-popup-condition.html:
* web-platform-tests/html/browsers/the-window-object/support/w3c-import.log:
* web-platform-tests/html/browsers/the-window-object/support/windowFeature-values-target.html: Added.
* web-platform-tests/html/browsers/the-window-object/w3c-import.log:
* web-platform-tests/html/browsers/the-window-object/window-open-noopener.html:
* web-platform-tests/html/browsers/the-window-object/window-open-windowfeatures-values-expected.txt: Added.
* web-platform-tests/html/browsers/the-window-object/window-open-windowfeatures-values.html: Added.

Source/WebCore:

Make "true" count as truthy in window.open()'s boolean features, as per:
- https://github.com/whatwg/html/pull/7425

Test: imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-windowfeatures-values.html

* page/WindowFeatures.cpp:
(WebCore::setWindowFeature):

LayoutTests:

* tests-options.json:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (290898 => 290899)


--- trunk/LayoutTests/ChangeLog	2022-03-07 19:13:52 UTC (rev 290898)
+++ trunk/LayoutTests/ChangeLog	2022-03-07 19:21:15 UTC (rev 290899)
@@ -1,5 +1,14 @@
 2022-03-07  Chris Dumez  <cdu...@apple.com>
 
+        Make "true" count as truthy in window.open()'s boolean features
+        https://bugs.webkit.org/show_bug.cgi?id=237530
+
+        Reviewed by Alex Christensen.
+
+        * tests-options.json:
+
+2022-03-07  Chris Dumez  <cdu...@apple.com>
+
         [Catalina Release wk1] imported/w3c/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html is a flaky failure
         https://bugs.webkit.org/show_bug.cgi?id=230729
         <rdar://problem/83469625>

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (290898 => 290899)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-03-07 19:13:52 UTC (rev 290898)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-03-07 19:21:15 UTC (rev 290899)
@@ -1,3 +1,21 @@
+2022-03-07  Chris Dumez  <cdu...@apple.com>
+
+        Make "true" count as truthy in window.open()'s boolean features
+        https://bugs.webkit.org/show_bug.cgi?id=237530
+
+        Reviewed by Alex Christensen.
+
+        Import WPT test coverage.
+
+        * resources/resource-files.json:
+        * web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-is-popup-condition.html:
+        * web-platform-tests/html/browsers/the-window-object/support/w3c-import.log:
+        * web-platform-tests/html/browsers/the-window-object/support/windowFeature-values-target.html: Added.
+        * web-platform-tests/html/browsers/the-window-object/w3c-import.log:
+        * web-platform-tests/html/browsers/the-window-object/window-open-noopener.html:
+        * web-platform-tests/html/browsers/the-window-object/window-open-windowfeatures-values-expected.txt: Added.
+        * web-platform-tests/html/browsers/the-window-object/window-open-windowfeatures-values.html: Added.
+
 2022-03-07  Antoine Quint  <grao...@webkit.org>
 
         [web-animations] animating "fill" and "stroke" to or from "currentColor" should work

Modified: trunk/LayoutTests/imported/w3c/resources/resource-files.json (290898 => 290899)


--- trunk/LayoutTests/imported/w3c/resources/resource-files.json	2022-03-07 19:13:52 UTC (rev 290898)
+++ trunk/LayoutTests/imported/w3c/resources/resource-files.json	2022-03-07 19:21:15 UTC (rev 290899)
@@ -2238,6 +2238,7 @@
         "web-platform-tests/html/browsers/the-window-object/support/same-origin-iframe.html",
         "web-platform-tests/html/browsers/the-window-object/support/sizing-target.html",
         "web-platform-tests/html/browsers/the-window-object/support/window-open-popup-target.html",
+        "web-platform-tests/html/browsers/the-window-object/support/windowFeature-values-target.html",
         "web-platform-tests/html/browsers/windows/browsing-context-names/001-1.html",
         "web-platform-tests/html/browsers/windows/browsing-context-names/002-1.html",
         "web-platform-tests/html/browsers/windows/browsing-context-names/existing.html",

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-is-popup-condition.html (290898 => 290899)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-is-popup-condition.html	2022-03-07 19:13:52 UTC (rev 290898)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-is-popup-condition.html	2022-03-07 19:21:15 UTC (rev 290899)
@@ -26,48 +26,59 @@
     // The explicit popup feature.
     ["popup", false],
     ["popup=1", false],
+    ["popup=true", false],
     ["popup=0", true],
 
     // Other feature alone results in popup.
     ["location", false],
     ["location=yes", false],
+    ["location=true", false],
     ["location=no", false],
 
     ["toolbar", false],
     ["toolbar=yes", false],
+    ["toolbar=true", false],
     ["toolbar=no", false],
 
     ["menubar", false],
     ["menubar=yes", false],
+    ["menubar=true", false],
     ["menubar=no", false],
 
     ["resizable", false],
     ["resizable=yes", false],
+    ["resizable=true", false],
     ["resizable=no", false],
   ],
   "single-2": [
     ["scrollbars", false],
     ["scrollbars=yes", false],
+    ["scrollbars=true", false],
     ["scrollbars=no", false],
 
     ["status", false],
     ["status=yes", false],
+    ["status=true", false],
     ["status=no", false],
 
     ["titlebar", false],
     ["titlebar=yes", false],
+    ["titlebar=true", false],
     ["titlebar=no", false],
 
     ["close", false],
     ["close=yes", false],
+    ["close=true", false],
     ["close=no", false],
 
     ["minimizable", false],
     ["minimizable=yes", false],
+    ["minimizable=true", false],
     ["minimizable=no", false],
 
     ["personalbar", false],
     ["personalbar=yes", false],
+    ["personalbar=true", false],
     ["personalbar=no", false],
   ],
   "position": [
@@ -113,6 +124,8 @@
 
     // The explicit popup feature has priority than others.
     ["popup=1,location,toolbar,menubar,resizable,scrollbars,status", false],
+    ["popup=yes,location,toolbar,menubar,resizable,scrollbars,status", false],
+    ["popup=true,location,toolbar,menubar,resizable,scrollbars,status", false],
     ["popup=0,location,toolbar,menubar,resizable,scrollbars", true],
   ],
 };

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/w3c-import.log (290898 => 290899)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/w3c-import.log	2022-03-07 19:13:52 UTC (rev 290898)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/w3c-import.log	2022-03-07 19:21:15 UTC (rev 290899)
@@ -21,3 +21,4 @@
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/same-origin-iframe.html
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/sizing-target.html
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/window-open-popup-target.html
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/windowFeature-values-target.html

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/windowFeature-values-target.html (0 => 290899)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/windowFeature-values-target.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/support/windowFeature-values-target.html	2022-03-07 19:21:15 UTC (rev 290899)
@@ -0,0 +1,24 @@
+<script>
+  const channelName = location.search.substr(1),
+        channel = new BroadcastChannel(channelName);
+
+  const haveOpener = window.opener !== null;
+  const haveReferrer = document.referrer !== null && document.referrer !== "";
+  const allBarProps = [
+    window.locationbar.visible,
+    window.menubar.visible,
+    window.personalbar.visible,
+    window.scrollbars.visible,
+    window.statusbar.visible,
+    window.toolbar.visible
+  ];
+  const isPopup = allBarProps.every(x=>!x);
+
+  channel.postMessage({haveOpener, haveReferrer, isPopup});
+
+  // Because messages are not delivered synchronously and because closing a
+  // browsing context prompts the eventual clearing of all task sources, this
+  // document should not be closed until the opener document has confirmed
+  // receipt.
+  channel._onmessage_ = () => window.close();
+</script>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/w3c-import.log (290898 => 290899)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/w3c-import.log	2022-03-07 19:13:52 UTC (rev 290898)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/w3c-import.log	2022-03-07 19:21:15 UTC (rev 290899)
@@ -38,6 +38,7 @@
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-noopener.html
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-noreferrer.html
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-popup-behavior.html
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-windowfeatures-values.html
 /LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-opener-unconfigurable.window.js
 /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

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-noopener.html (290898 => 290899)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-noopener.html	2022-03-07 19:13:52 UTC (rev 290898)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-noopener.html	2022-03-07 19:21:15 UTC (rev 290899)
@@ -18,6 +18,9 @@
   { testDescription: "noopener=1 means the same as noopener",
     secondWindowFeatureString: "noopener=1",
     shouldReturnWindow: false },
+  { testDescription: "noopener=true means the same as noopener",
+    secondWindowFeatureString: "noopener=true",
+    shouldReturnWindow: false },
   { testDescription: "noopener=0 means lack of noopener",
     secondWindowFeatureString: "noopener=0",
     shouldReturnWindow: true },

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-windowfeatures-values-expected.txt (0 => 290899)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-windowfeatures-values-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-windowfeatures-values-expected.txt	2022-03-07 19:21:15 UTC (rev 290899)
@@ -0,0 +1,95 @@
+
+PASS Test noreferrer, expected interpretation is true
+PASS Test noopener, expected interpretation is true
+FAIL Test popup, expected interpretation is true assert_equals: expected true but got false
+PASS Test noreferrer=yes, expected interpretation is true
+PASS Test noopener=yes, expected interpretation is true
+FAIL Test popup=yes, expected interpretation is true assert_equals: expected true but got false
+PASS Test noreferrer="yes", expected interpretation is false
+PASS Test noopener="yes", expected interpretation is false
+PASS Test popup="yes", expected interpretation is false
+PASS Test noreferrer='yes', expected interpretation is false
+PASS Test noopener='yes', expected interpretation is false
+PASS Test popup='yes', expected interpretation is false
+PASS Test noreferrer=true, expected interpretation is true
+PASS Test noopener=true, expected interpretation is true
+FAIL Test popup=true, expected interpretation is true assert_equals: expected true but got false
+PASS Test noreferrer="true", expected interpretation is false
+PASS Test noopener="true", expected interpretation is false
+PASS Test popup="true", expected interpretation is false
+PASS Test noreferrer='true', expected interpretation is false
+PASS Test noopener='true', expected interpretation is false
+PASS Test popup='true', expected interpretation is false
+PASS Test noreferrer=foo, expected interpretation is false
+PASS Test noopener=foo, expected interpretation is false
+PASS Test popup=foo, expected interpretation is false
+PASS Test noreferrer="foo", expected interpretation is false
+PASS Test noopener="foo", expected interpretation is false
+PASS Test popup="foo", expected interpretation is false
+PASS Test noreferrer='foo', expected interpretation is false
+PASS Test noopener='foo', expected interpretation is false
+PASS Test popup='foo', expected interpretation is false
+PASS Test noreferrer=0, expected interpretation is false
+PASS Test noopener=0, expected interpretation is false
+PASS Test popup=0, expected interpretation is false
+PASS Test noreferrer="0", expected interpretation is false
+PASS Test noopener="0", expected interpretation is false
+PASS Test popup="0", expected interpretation is false
+PASS Test noreferrer='0', expected interpretation is false
+PASS Test noopener='0', expected interpretation is false
+PASS Test popup='0', expected interpretation is false
+PASS Test noreferrer=00, expected interpretation is false
+PASS Test noopener=00, expected interpretation is false
+PASS Test popup=00, expected interpretation is false
+PASS Test noreferrer="00", expected interpretation is false
+PASS Test noopener="00", expected interpretation is false
+PASS Test popup="00", expected interpretation is false
+PASS Test noreferrer='00', expected interpretation is false
+PASS Test noopener='00', expected interpretation is false
+PASS Test popup='00', expected interpretation is false
+PASS Test noreferrer=1, expected interpretation is true
+PASS Test noopener=1, expected interpretation is true
+FAIL Test popup=1, expected interpretation is true assert_equals: expected true but got false
+PASS Test noreferrer="1", expected interpretation is false
+PASS Test noopener="1", expected interpretation is false
+PASS Test popup="1", expected interpretation is false
+PASS Test noreferrer='1', expected interpretation is false
+PASS Test noopener='1', expected interpretation is false
+PASS Test popup='1', expected interpretation is false
+PASS Test noreferrer=99999, expected interpretation is true
+PASS Test noopener=99999, expected interpretation is true
+FAIL Test popup=99999, expected interpretation is true assert_equals: expected true but got false
+PASS Test noreferrer="99999", expected interpretation is false
+PASS Test noopener="99999", expected interpretation is false
+PASS Test popup="99999", expected interpretation is false
+PASS Test noreferrer='99999', expected interpretation is false
+PASS Test noopener='99999', expected interpretation is false
+PASS Test popup='99999', expected interpretation is false
+PASS Test noreferrer=-1, expected interpretation is true
+PASS Test noopener=-1, expected interpretation is true
+FAIL Test popup=-1, expected interpretation is true assert_equals: expected true but got false
+PASS Test noreferrer="-1", expected interpretation is false
+PASS Test noopener="-1", expected interpretation is false
+PASS Test popup="-1", expected interpretation is false
+PASS Test noreferrer='-1', expected interpretation is false
+PASS Test noopener='-1', expected interpretation is false
+PASS Test popup='-1', expected interpretation is false
+PASS Test noreferrer=1foo, expected interpretation is true
+PASS Test noopener=1foo, expected interpretation is true
+FAIL Test popup=1foo, expected interpretation is true assert_equals: expected true but got false
+PASS Test noreferrer="1foo", expected interpretation is false
+PASS Test noopener="1foo", expected interpretation is false
+PASS Test popup="1foo", expected interpretation is false
+PASS Test noreferrer='1foo', expected interpretation is false
+PASS Test noopener='1foo', expected interpretation is false
+PASS Test popup='1foo', expected interpretation is false
+PASS Test noreferrer=0foo, expected interpretation is false
+PASS Test noopener=0foo, expected interpretation is false
+PASS Test popup=0foo, expected interpretation is false
+PASS Test noreferrer="0foo", expected interpretation is false
+PASS Test noopener="0foo", expected interpretation is false
+PASS Test popup="0foo", expected interpretation is false
+PASS Test noreferrer='0foo', expected interpretation is false
+PASS Test noopener='0foo', expected interpretation is false
+PASS Test popup='0foo', expected interpretation is false
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-windowfeatures-values.html (0 => 290899)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-windowfeatures-values.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-windowfeatures-values.html	2022-03-07 19:21:15 UTC (rev 290899)
@@ -0,0 +1,72 @@
+<!doctype html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>window.open() windowFeature value parsing</title>
+<link rel="author" href=""
+<link rel="help" href=""
+<script src=""
+<script src=""
+<script>
+function testValueGeneric(val, expectTrue, property, testFn) {
+  const windowFeatureStr = val === "" ? property : `${property}=${val}`;
+  async_test(t => {
+    const windowName = '' + Math.round(Math.random()*1e12);
+    const channel = new BroadcastChannel(windowName);
+    channel._onmessage_ = t.step_func_done(e => {
+      // Send message first so if asserts throw the popup is still closed
+      channel.postMessage(null);
+      testFn(e.data);
+    });
+    window.open("support/windowFeature-values-target.html?" + windowName, windowName, windowFeatureStr);
+  },`Test ${windowFeatureStr}, expected interpretation is ${expectTrue ? 'true' : 'false'}`);
+}
+
+function testValueForNoReferrer(val, expectTrue) {
+  testValueGeneric(val, expectTrue, "noreferrer", (data) => {
+    if (expectTrue) {
+      assert_false(data.haveReferrer);
+      assert_false(data.haveOpener);
+    } else {
+      assert_true(data.haveReferrer);
+      assert_true(data.haveOpener);
+    }
+  });
+}
+
+function testValueForNoOpener(val, expectTrue) {
+  testValueGeneric(val, expectTrue, "noopener", (data) => {
+    assert_equals(data.haveOpener, !expectTrue);
+  });
+}
+
+function testValueForPopup(val, expectTrue) {
+  testValueGeneric(val, expectTrue, "popup", (data) => {
+    assert_equals(data.isPopup, expectTrue);
+  });
+}
+
+function testValue(val, expectTrue) {
+  const quotes = val === "" ? [''] : ['','"',"'"];
+  let noQuotes = true;
+  for (const quote of quotes) {
+    const thisExpectTrue = expectTrue && noQuotes;
+    const thisVal = quote + val + quote;
+    testValueForNoReferrer(thisVal, thisExpectTrue);
+    testValueForNoOpener(thisVal, thisExpectTrue);
+    testValueForPopup(thisVal, thisExpectTrue);
+    noQuotes = false;
+  }
+}
+
+testValue('',true); // Just the parameter means true
+testValue('yes',true); // Yes means true
+testValue('true',true); // True means true
+testValue('foo',false); // If parsing as an integer is an error, false
+testValue('0',false);   // 0 is false
+testValue('00',false);  // 0 is false
+testValue('1',true);    // Non-zero is true
+testValue('99999',true);    // Non-zero is true
+testValue('-1',true);    // Non-zero is true
+testValue('1foo',true); // This parses to 1
+testValue('0foo',false); // This parses to 0
+</script>

Modified: trunk/LayoutTests/tests-options.json (290898 => 290899)


--- trunk/LayoutTests/tests-options.json	2022-03-07 19:13:52 UTC (rev 290898)
+++ trunk/LayoutTests/tests-options.json	2022-03-07 19:21:15 UTC (rev 290899)
@@ -2549,6 +2549,9 @@
     "imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-popup-behavior.html": [
         "slow"
     ],
+    "imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-windowfeatures-values.html": [
+        "slow"
+    ],
     "imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-setter.html": [
         "slow"
     ],

Modified: trunk/Source/WebCore/ChangeLog (290898 => 290899)


--- trunk/Source/WebCore/ChangeLog	2022-03-07 19:13:52 UTC (rev 290898)
+++ trunk/Source/WebCore/ChangeLog	2022-03-07 19:21:15 UTC (rev 290899)
@@ -1,3 +1,18 @@
+2022-03-07  Chris Dumez  <cdu...@apple.com>
+
+        Make "true" count as truthy in window.open()'s boolean features
+        https://bugs.webkit.org/show_bug.cgi?id=237530
+
+        Reviewed by Alex Christensen.
+
+        Make "true" count as truthy in window.open()'s boolean features, as per:
+        - https://github.com/whatwg/html/pull/7425
+
+        Test: imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-windowfeatures-values.html
+
+        * page/WindowFeatures.cpp:
+        (WebCore::setWindowFeature):
+
 2022-03-07  Antoine Quint  <grao...@webkit.org>
 
         [web-animations] animating "fill" and "stroke" to or from "currentColor" should work

Modified: trunk/Source/WebCore/page/WindowFeatures.cpp (290898 => 290899)


--- trunk/Source/WebCore/page/WindowFeatures.cpp	2022-03-07 19:13:52 UTC (rev 290898)
+++ trunk/Source/WebCore/page/WindowFeatures.cpp	2022-03-07 19:21:15 UTC (rev 290899)
@@ -130,7 +130,7 @@
 {
     // Listing a key with no value is shorthand for key=yes
     int numericValue;
-    if (value.isEmpty() || equalLettersIgnoringASCIICase(value, "yes"))
+    if (value.isEmpty() || equalLettersIgnoringASCIICase(value, "yes") || equalLettersIgnoringASCIICase(value, "true"))
         numericValue = 1;
     else
         numericValue = parseIntegerAllowingTrailingJunk<int>(value).value_or(0);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to