Skip to content
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

Browsers not interoperable for first argument of window.open when undefined is passed #4762

Closed
bzbarsky opened this issue Jul 10, 2019 · 3 comments · Fixed by #4851
Closed
Labels
interop Implementations are not interoperable with each other

Comments

@bzbarsky
Copy link
Contributor

Consider this testcase:

<iframe name="foo" src="http://example.com"></iframe>
<button type="button" onclick="doIt()">Click me</button>
<script>
  function doIt() {
      window.open(undefined, "foo");
  }
</script>

What should happen? Per spec the IDL is:

  WindowProxy? open(optional USVString url = "about:blank", optional DOMString target = "_blank", optional [TreatNullAs=EmptyString] DOMString features = "");

so this should be equivalent to passing "about:blank" as the first argument. And in Safari it is: it loads about:blank in the subframe. But in Firefox and Chrome it's a no-op, which is what the spec calls for if "" is passed as the first argument.

When passing "" explicitly as first argument, all browsers treat this testcase as a no-op, so that part is interoperable.

So the real question is whether the default value should be "" or "about:blank".

Note that if the open call creates a new window, both "" and "about:blank" have the same behavior, because https://html.spec.whatwg.org/multipage/window-object.html#window-open-steps step 13 starts off urlRecord as "about:blank" and then step 14 actually runs in the "empty string and new window" case but does not change urlRecord in the empty-string case. So this only matters for the not-creating-a-new-window case.

@annevk
Copy link
Member

annevk commented Aug 15, 2019

@cdumez what do you think? Probably safer to change Safari and the HTML Standard, right?

@annevk annevk added the interop Implementations are not interoperable with each other label Aug 15, 2019
@cdumez
Copy link

cdumez commented Aug 16, 2019

Ok, let's update the spec then. Just please file a bug against WebKit so I can align our behavior.

annevk added a commit that referenced this issue Aug 19, 2019
This aligns the HTML Standard with Chrome and Firefox rather than Safari.

Tests: ...

Fixes #4762.
@annevk
Copy link
Member

annevk commented Aug 19, 2019

PR at #4851 and test at web-platform-tests/wpt#18536. Review of both appreciated. WebKit bug at https://bugs.webkit.org/show_bug.cgi?id=200882.

annevk added a commit that referenced this issue Aug 20, 2019
This aligns the HTML Standard with Chrome and Firefox rather than Safari.

Tests: web-platform-tests/wpt#18536.

Fixes #4762.
bertogg pushed a commit to Igalia/webkit that referenced this issue Aug 27, 2019
https://bugs.webkit.org/show_bug.cgi?id=200882

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline WPT test now that it is passing.

* web-platform-tests/html/browsers/the-window-object/window-open-defaults.window-expected.txt:

Source/WebCore:

Update default URL parameter value for window.open() to be "" instead of "about:blank", as per:
- whatwg/html#4762

This aligns our behavior with other Web browser engines.

No new tests, rebaselined existing test.

* page/DOMWindow.idl:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@249130 268f45cc-cd09-0410-ab3c-d52691b4dbfc
zcorpan pushed a commit that referenced this issue Nov 6, 2019
This aligns the HTML Standard with Chrome and Firefox rather than Safari.

Tests: web-platform-tests/wpt#18536.

Fixes #4762.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interop Implementations are not interoperable with each other
Development

Successfully merging a pull request may close this issue.

3 participants