-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should 'true' count as truthy in parsing windowFeatures booleans? #7399
Comments
This hasn't been a problem for the other features thus far, e.g., |
See #2600 -- the spec matched what browsers did for the legacy booleans. I don't mind supporting Do people expect |
cc @cdumez |
WebKit already allows "1" / "on" / "yes". I don't mind adding support for "true" too if other browser engines do the same. I don't really like the idea of |
"on" wasn't specified in #4079 . Testing with http://software.hixie.ch/utilities/js/live-dom-viewer/saved/9908 webkit/chromium/gecko do not support it.
|
Indeed, it looks like I was wrong, we allow "on" only for some features: center, resizable, status, scroll. For noopener, it seems we allow "yes" and any numeric value other than 0 (not sure why noopener is not treated like our other boolean features). |
The one concern I have here is if we do want to switch to using a dictionary for "cool window features" (such as noopener, noreferrer, and popup) this seems a lot less worth it. |
Here is my proposal for "switching to a dictionary for cool window features": #7485 I don't really want to block small improvements everyone is on-board with in favor of larger changes though, so take it with a grain of salt... |
This is a very small amount of work to treat 'true' as truthy so I don't mind doing it, even if there is modern API proposal. |
+1 - I support this. The modern syntax is nice, but I think it can coexist with this small change to the old syntax. |
Great, so what's required now before landing #7425 is web platform tests. Per the triage meeting, as a bonus, it'd be great if we also made sure the web platform tests were comprehensive for "on" / "off", "yes" / "no", and non-zero numeric values as well, since it sounds like there's probably some divergence from the spec there, and perhaps interop issues. |
I'm happy to tackle the WPT enhancements as part of implementing this change in Chromium, assuming we can land #7425 to make that easier for me. |
@mfreed7 great! This file (used by noopener and noreferrer tests) may be of interest in addition to the test for html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/resources/tokenization-noopener-noreferrer.js We can land the spec change when there's a CL in review with tests. |
Thanks for the pointer. I thought about adding another set of cases there for =true but ended up just writing a fresh test that looks at just values for noopener, noreferrer, and popup. (The other boolean window features seem like overkill to test, and a bit nebulous given our recent changes to how popups work.) One question did come out of my new test though. What do we think about these? noreferrer=true // With the new PR, this will result in noreferrer being *true*
noreferrer="true" // The quotes cause a parse error, and noreferrer is *false*
noreferrer='true' // Same here, *false* Currently, the rules, and browsers, treat quotation marks as a parse error and the quoted values are interpreted as |
I think they should continue to be
Does this have |
Prior to this CL, window.open(url, '', 'noopener=true') would treat 'noopener=true' as if noopener is false. This is currently per-spec [1] but there is a desire [2][3] to change that. [1] https://html.spec.whatwg.org/multipage/window-object.html#concept-window-open-features-parse-boolean [2] whatwg/html#7425 [3] whatwg/html#7399 Fixed: 1277613 Change-Id: I5b3a7e985a9bb392c2150846b50369cfcd9b05fa
Right - that's a great point. Ok, I agree with you, quotes should parse as false. Ok, quick and dirty tests have been added here: web-platform-tests/wpt#33029 |
Prior to this CL, window.open(url, '', 'noopener=true') would treat 'noopener=true' as if noopener is false. This is currently per-spec [1] but there is a desire [2][3] to change that. [1] https://html.spec.whatwg.org/multipage/window-object.html#concept-window-open-features-parse-boolean [2] whatwg/html#7425 [3] whatwg/html#7399 Fixed: 1277613 Change-Id: I5b3a7e985a9bb392c2150846b50369cfcd9b05fa
Prior to this CL, window.open(url, '', 'noopener=true') would treat 'noopener=true' as if noopener is false. This is currently per-spec [1] but there is a desire [2][3] to change that. The I2S is here: https://groups.google.com/a/chromium.org/g/blink-dev/c/ePJ4GE6VzVc/m/urs3-4rHDAAJ [1] https://html.spec.whatwg.org/multipage/window-object.html#concept-window-open-features-parse-boolean [2] whatwg/html#7425 [3] whatwg/html#7399 Fixed: 1277613 Change-Id: I5b3a7e985a9bb392c2150846b50369cfcd9b05fa
Prior to this CL, window.open(url, '', 'noopener=true') would treat 'noopener=true' as if noopener is false. This is currently per-spec [1] but there is a desire [2][3] to change that. The I2S is here: https://groups.google.com/a/chromium.org/g/blink-dev/c/ePJ4GE6VzVc/m/urs3-4rHDAAJ [1] https://html.spec.whatwg.org/multipage/window-object.html#concept-window-open-features-parse-boolean [2] whatwg/html#7425 [3] whatwg/html#7399 Fixed: 1277613 Change-Id: I5b3a7e985a9bb392c2150846b50369cfcd9b05fa Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3495659 Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#977722}
Prior to this CL, window.open(url, '', 'noopener=true') would treat 'noopener=true' as if noopener is false. This is currently per-spec [1] but there is a desire [2][3] to change that. The I2S is here: https://groups.google.com/a/chromium.org/g/blink-dev/c/ePJ4GE6VzVc/m/urs3-4rHDAAJ [1] https://html.spec.whatwg.org/multipage/window-object.html#concept-window-open-features-parse-boolean [2] whatwg/html#7425 [3] whatwg/html#7399 Fixed: 1277613 Change-Id: I5b3a7e985a9bb392c2150846b50369cfcd9b05fa Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3495659 Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#977722}
…dowFeatures, a=testonly Automatic update from web-platform-tests Add "true" to truthy values list for windowFeatures Prior to this CL, window.open(url, '', 'noopener=true') would treat 'noopener=true' as if noopener is false. This is currently per-spec [1] but there is a desire [2][3] to change that. The I2S is here: https://groups.google.com/a/chromium.org/g/blink-dev/c/ePJ4GE6VzVc/m/urs3-4rHDAAJ [1] https://html.spec.whatwg.org/multipage/window-object.html#concept-window-open-features-parse-boolean [2] whatwg/html#7425 [3] whatwg/html#7399 Fixed: 1277613 Change-Id: I5b3a7e985a9bb392c2150846b50369cfcd9b05fa Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3495659 Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#977722} -- wpt-commits: 2026041556d8c61e167d0a0d3d0bbbeaf99dcd70 wpt-pr: 33029
…dowFeatures, a=testonly Automatic update from web-platform-tests Add "true" to truthy values list for windowFeatures Prior to this CL, window.open(url, '', 'noopener=true') would treat 'noopener=true' as if noopener is false. This is currently per-spec [1] but there is a desire [2][3] to change that. The I2S is here: https://groups.google.com/a/chromium.org/g/blink-dev/c/ePJ4GE6VzVc/m/urs3-4rHDAAJ [1] https://html.spec.whatwg.org/multipage/window-object.html#concept-window-open-features-parse-boolean [2] whatwg/html#7425 [3] whatwg/html#7399 Fixed: 1277613 Change-Id: I5b3a7e985a9bb392c2150846b50369cfcd9b05fa Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3495659 Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#977722} -- wpt-commits: 2026041556d8c61e167d0a0d3d0bbbeaf99dcd70 wpt-pr: 33029
Prior to this CL, window.open(url, '', 'noopener=true') would treat 'noopener=true' as if noopener is false. This is currently per-spec [1] but there is a desire [2][3] to change that. The I2S is here: https://groups.google.com/a/chromium.org/g/blink-dev/c/ePJ4GE6VzVc/m/urs3-4rHDAAJ [1] https://html.spec.whatwg.org/multipage/window-object.html#concept-window-open-features-parse-boolean [2] whatwg/html#7425 [3] whatwg/html#7399 Fixed: 1277613 Change-Id: I5b3a7e985a9bb392c2150846b50369cfcd9b05fa Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3495659 Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#977722} NOKEYCHECK=True GitOrigin-RevId: 0c49a8d7e96bbad1102c934687836d3795073603
The parse a boolean feature spec says:
...which means that something like
window.open('about:blank','','popup=true')
interprets thepopup=true
to meanpopup
is false. Not very intuitive.Should we add "true" as a value that results in
true
?This was brought up as a bug against Chromium related to the implementation of the new popup standardization work.
The text was updated successfully, but these errors were encountered: