[Webkit-unassigned] [Bug 228122] Expand URL class query parameter functions

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jul 30 18:58:39 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=228122

--- Comment #22 from John Wilander <wilander at apple.com> ---
(In reply to Risul Islam from comment #20)
> Comment on attachment 434669 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=434669&action=review
> 
> >>>> Source/WTF/ChangeLog:8
> >>>> +        Added more functionalities for parsing URL query parameters.
> >>> 
> >>> I don’t fully understand why adding more functions that are not yet used is important for WebKIt, but I trust there is some reason.
> >> 
> >> Thank you Darin for your valuable comments and insights. We are trying to come up with a feature that restricts tracking parameters from the URL while loading or sharing by copying. Thats why we are adding the functionalities in this patch.
> > 
> > I'd say "Added parsing of URL query strings."
> 
> Great. On it.
> 
> >> Tools/TestWebKitAPI/Tests/WTF/URL.cpp:522
> >> +    EXPECT_EQ(url9.string(), url12.string());
> > 
> > You need to have a section of negative tests, for instance named URLMalformedQueryStrings. There your test things like:
> > · http://www.webkit.org/??
> > · http://www.webkit.org/?/?test=test
> > · http://www.webkit.org/?=test
> > · http://www.webkit.org/?==
> > · http://www.webkit.org/?=?
> > · http://www.webkit.org/=?
> > · http://www.webkit.org??
> > · http://www.webkit.org?/?test=test
> > · http://www.webkit.org?=test
> > · http://www.webkit.org?==
> > · http://www.webkit.org?=?
> > · http://www.webkit.org=?
> 
> We assumed that the first '?' is the start of the query string. Then the
> query parameters are separated by '&' and finally parameter key and value is
> separated by '=' . Since there is no standard we got this assumption from
>  https://www.freeformatter.com/url-parser-query-string-splitter.html 
> 
> There are some test cases added for the above kinds of URLs. Do we want more
> tests?

Yes. Your tests are not just there to confirm intended functionality but also to defend against future mistakes. You want to explore a bunch of corner cases and make sure your code handles them gracefully. Then two years later, someone may change your code and make a simple mistake. That’s when your fleshed out test suite will pay off.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210731/cbd334e3/attachment.htm>


More information about the webkit-unassigned mailing list