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

Add new URL(someUrl, undefined) feature testing for URL polyfill #656

Closed
trotyl opened this issue Oct 2, 2019 · 3 comments
Closed

Add new URL(someUrl, undefined) feature testing for URL polyfill #656

trotyl opened this issue Oct 2, 2019 · 3 comments
Labels

Comments

@trotyl
Copy link

trotyl commented Oct 2, 2019

From URL specification, the URL constructor has an optional base parameter:

interface URL {
  constructor(USVString url, optional USVString base);
};

From Web IDL spec, explicit passed undefined is treated as missing value:

In the ECMAScript binding, a value of undefined is treated as not present, or will trigger the default value where applicable.

So that new URL(text, undefined) should be equivalent to new URL(text), but which failed in Safari (tested in 13.0.1) by throwing a TypeError:

image

This should be a BUG in JavaScriptCore implementation, where in Chrome and Firefox it works properly:

image
image

Currently the native-url testing cannot detect this failure and may resulting a malfunctioning Safari native URL being used even when this polyfill loaded.

@zloirock
Copy link
Owner

zloirock commented Oct 2, 2019

native-url test relaxed because at the moment of writing core-js URL polyfill no one from browsers implementations were enough correct by the spec at least in some aspects. However, I think makes sense to make it a little more strict at least at this moment.

@dilyanpalauzov
Copy link

dilyanpalauzov commented Sep 22, 2020

Filed https://bugs.webkit.org/show_bug.cgi?id=216841 for new URL('https://x', undefined) throwing an error in WebKit.

@dilyanpalauzov
Copy link

Which test fails on Safari for URLSearchParams, so that 8699b9a#diff-6016a0a7725ceb1f68ed6ea1c7b96491 requires polyfill only for it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants