Bug 182326

Summary: Should choose the best match during 'route' if there are multiple matches.
Product: WebKit Reporter: dewei_zhu
Component: Tools / TestsAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: dewei_zhu, rniwa
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch rniwa: review+

Description dewei_zhu 2018-01-31 01:13:47 PST
Should chose the best match during 'route' when there are multiple matches.
Comment 1 dewei_zhu 2018-01-31 01:23:49 PST
Created attachment 332750 [details]
Patch
Comment 2 Ryosuke Niwa 2018-01-31 11:34:40 PST
Comment on attachment 332750 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=332750&action=review

r- due to the lack of testing.

> Websites/perf.webkit.org/public/v3/pages/page-router.js:43
> +                } else if (hashUrl.startsWith(routeName) && hashUrl.charAt(routeName.length) == '/' && bestMatchingRouteName.length < routeName.length) {

What's hashUrl.charAt(routeName.length) == '/' about?
Comment 3 dewei_zhu 2018-01-31 13:33:15 PST
Comment on attachment 332750 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=332750&action=review

>> Websites/perf.webkit.org/public/v3/pages/page-router.js:43
>> +                } else if (hashUrl.startsWith(routeName) && hashUrl.charAt(routeName.length) == '/' && bestMatchingRouteName.length < routeName.length) {
> 
> What's hashUrl.charAt(routeName.length) == '/' about?

This check exists before. I would assume we want '/apple/xxxx' matches '/apple', and do not want it matches '/applepile/...'
Comment 4 dewei_zhu 2018-01-31 14:22:31 PST
Created attachment 332802 [details]
Patch
Comment 5 Ryosuke Niwa 2018-01-31 15:00:10 PST
Comment on attachment 332802 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=332802&action=review

> Websites/perf.webkit.org/public/v3/pages/page-router.js:32
> +            let bestMatchingRouteName = '';

Initialize this to null instead.