From https://bugs.webkit.org/show_bug.cgi?id=161191 +FAIL Setting <https://example.net?lang=en-US#nav>.search = '??lang=fr' assert_equals: expected "https://example.net/??lang=fr#nav" but got "https://example.net/?lang=fr#nav" I noticed today that http://software.hixie.ch/utilities/js/live-dom-viewer/saved/5000 has different results in webkit, chromium, and gecko. :-( <!DOCTYPE html> <a href id=a></a> <script> a.search='?'; w(a.href); a.search='??'; w(a.href); var u = new URL('https://test/'); u.search = '?'; w(u.href); u.search = '??'; w(u.href); </script> Result in Safari TP: log: http://software.hixie.ch/utilities/js/live-dom-viewer/? log: http://software.hixie.ch/utilities/js/live-dom-viewer/? log: https://test/? log: https://test/? Expected (per URL standard and as in Gecko): log: http://software.hixie.ch/utilities/js/live-dom-viewer/? log: http://software.hixie.ch/utilities/js/live-dom-viewer/?? log: https://test/? log: https://test/?? (Issue for chromium which has incorrect behavior for url.search = '?' instead: https://bugs.chromium.org/p/chromium/issues/detail?id=682150#c7 )
We match the behavior of Chromium when setting the query to "??", and if I interpret https://url.spec.whatwg.org/#dom-url-search correctly, then Firefox and the web platform tests are not following the specification: "Let input be the given value with a single leading U+003F (?) removed, if any." I interpret this to mean that if the given value starts with one or more '?' then one will be removed. Firefox seems to interpret this to mean that the leading '?' is only to be removed if it is followed by a non-question-mark character, which I don't think makes any sense. I'm interested in Anne's interpretation. With the setting of the query to "?" I believe Firefox, WebKit, and the specification are "correct" and Chromium needs to change.
I think you are correct. I created https://github.com/w3c/web-platform-tests/pull/5387 to fix web-platform-tests. Haven't filed a bug against the other browsers thus far.
Actually, as Simon pointed out in web-platform-tests review, while a leading "?" is removed, the search getter adds it back. So therefore you'd still see two of them. So this is bug in WebKit after all.
Created attachment 402961 [details] Patch
Committed r263637: <https://trac.webkit.org/changeset/263637> All reviewed patches have been landed. Closing bug and clearing flags on attachment 402961 [details].
<rdar://problem/64867705>
Is URLDecomposition used anywhere else besides the URL, <a>, and <area> cases that are covered by WPT?
(In reply to Darin Adler from comment #7) > Is URLDecomposition used anywhere else besides the URL, <a>, and <area> > cases that are covered by WPT? It is only web exposed to URL, <a>, and <area>. The derived DOMURL is used in internals API and editing/.