RESOLVED FIXED Bug 167979
Implement URL's toJSON()
https://bugs.webkit.org/show_bug.cgi?id=167979
Summary Implement URL's toJSON()
Attachments
WIP Patch (10.96 KB, patch)
2017-02-10 15:38 PST, Chris Dumez
no flags
Patch (16.89 KB, patch)
2017-02-10 20:39 PST, Chris Dumez
no flags
Chris Dumez
Comment 1 2017-02-10 15:38:46 PST
Created attachment 301204 [details] WIP Patch
Alex Christensen
Comment 2 2017-02-10 15:47:15 PST
I think we should add a test like "https://example.com/#\"" to verify what happens when a " appears in the serialized URL.
Chris Dumez
Comment 3 2017-02-10 16:02:53 PST
(In reply to comment #2) > I think we should add a test like "https://example.com/#\"" to verify what > happens when a " appears in the serialized URL. In Firefox nightly: JSON.stringify(new URL("https://example.com/#\"")) "https://example.com/#%22" With my patch: JSON.stringify(new URL("https://example.com/#\"")) "\"https://example.com/#\\\"\""
Chris Dumez
Comment 4 2017-02-10 19:22:18 PST
(In reply to comment #3) > (In reply to comment #2) > > I think we should add a test like "https://example.com/#\"" to verify what > > happens when a " appears in the serialized URL. > > In Firefox nightly: > JSON.stringify(new URL("https://example.com/#\"")) > "https://example.com/#%22" > > With my patch: > JSON.stringify(new URL("https://example.com/#\"")) > "\"https://example.com/#\\\"\"" Alex, any thoughts on this? Not super familiar with this so I am not sure what's expected. The URL serialization merely says to append the fragment. Either way, this would be an issue with our serialization and would also impact the stringier, not only the new toJSON.
Chris Dumez
Comment 5 2017-02-10 20:39:15 PST
Anne van Kesteren
Comment 6 2017-02-10 23:44:52 PST
Chris, the difference you are seeing is because Firefox encodes more code points during parsing of the URL fragment. Firefox is the only browser to do so, so I think the results of your patch are indeed what you should be seeing here. See https://url.spec.whatwg.org/#fragment-state in particular.
Chris Dumez
Comment 7 2017-02-11 06:50:10 PST
(In reply to comment #6) > Chris, the difference you are seeing is because Firefox encodes more code > points during parsing of the URL fragment. Firefox is the only browser to do > so, so I think the results of your patch are indeed what you should be > seeing here. See https://url.spec.whatwg.org/#fragment-state in particular. Thanks for confirming.
WebKit Commit Bot
Comment 8 2017-02-11 07:16:23 PST
Comment on attachment 301240 [details] Patch Clearing flags on attachment: 301240 Committed r212193: <http://trac.webkit.org/changeset/212193>
WebKit Commit Bot
Comment 9 2017-02-11 07:16:29 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.