SamsungInternet / support

For general Samsung Internet support. You can use the Issues register here as a way to ask support questions.
MIT License
17 stars 0 forks source link

URLSearchParams doesn't filter out leading '?' from the search string #8

Closed NOtherDev closed 7 years ago

NOtherDev commented 7 years ago

Quote from the standard: https://url.spec.whatwg.org/#urlsearchparams

The URLSearchParams(init) constructor, when invoked, must run these steps: If init is given, is a string, and starts with U+003F (?), remove the first code point from init.

Now, see the code gist here: https://codepen.io/anon/pen/QvOPJp?orderId=test&editors=0010#0

const queryParams = new window.URLSearchParams(window.location.search);

alert('orderId: ' + queryParams.has('orderId'))
alert('?orderId: ' + queryParams.has('?orderId'))

Chrome alerts me with orderId: true and ?orderId: false as expected. Samsung Internet 5.2.10-24 on Samsung Galaxy S8 (SAMSUNG SM-G950F Build/NRD90M) alerts me with orderId: false and ?orderId: true instead (the second time the pen is initialized - disregard the first one).

hjrchung commented 7 years ago

Thank you for the bug report!

Samsung Internet 5.0, 5.2 and 5.4 are based on Chromium m51 The fix for the URLSearchParam issue (https://bugs.chromium.org/p/chromium/issues/detail?id=601425 ) was included in Chromium 52.0.2714.0 - so wasn't included in Samsung Internet 5.x. Samsung Internet 6.0 will have the fix - and will be deployed in the 2nd half of this year.

poshaughnessy commented 7 years ago

Thank you for reporting this @NOtherDev. I have checked in our v6.2 beta and I actually get 4 alerts: false, false, true, false - presumably it's running twice due to multiple frames or something on Codepen? This is the same behaviour as in Chrome for Android though, so I believe the bug is fixed now.

v6.0 is now out in the wild with the Galaxy Note 8 release and v6.2 stable will be following up for all supported devices shortly, so I'll close this issue now (but feel free to follow up again if you need to).