RESOLVED FIXED 119583
[Win] URL printing code in DumpRenderTree doesn't match WTR or Mac DRT
https://bugs.webkit.org/show_bug.cgi?id=119583
Summary [Win] URL printing code in DumpRenderTree doesn't match WTR or Mac DRT
Alexey Proskuryakov
Reported 2013-08-08 11:18:43 PDT
urlSuitableForTestResult() in DumpRenderTree/win/DumpRenderTree.cpp removes a prefix from url without checking whether the url actually has this prefix: -------------------------- RetainPtr<CFStringRef> basePath = adoptCF(CFURLCopyPath(baseURL.get())); RetainPtr<CFStringRef> path = adoptCF(CFURLCopyPath(url.get())); return cfStringRefToWString(substringFromIndex(path.get(), CFStringGetLength(basePath.get())).get()); -------------------------- When it doesn't match - or when base URL cannot be determined - we should print last path component.
Attachments
Patch (1.67 KB, patch)
2013-08-16 10:01 PDT, Brent Fulgham
no flags
Patch (2.19 KB, patch)
2013-08-16 10:04 PDT, Brent Fulgham
no flags
Patch (3.24 KB, patch)
2013-08-16 10:40 PDT, Brent Fulgham
ap: review+
Alexey Proskuryakov
Comment 1 2013-08-16 09:37:47 PDT
Either WebKitTestRunner code or Mac DRT could probably serve as a good model to follow.
Brent Fulgham
Comment 2 2013-08-16 10:01:43 PDT
Brent Fulgham
Comment 3 2013-08-16 10:04:18 PDT
Alexey Proskuryakov
Comment 4 2013-08-16 10:14:18 PDT
Comment on attachment 208929 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=208929&action=review There are more instances of "return urlString;" above the changed code, all except the very first one should be changed to return the last path component. We never want a full file:// path! > Tools/DumpRenderTree/win/DumpRenderTree.cpp:172 > + if (path.get() && CFStringHasPrefix(path.get(), basePath.get())) This null check should be for basePath, not for path.
Brent Fulgham
Comment 5 2013-08-16 10:15:16 PDT
Comment on attachment 208929 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=208929&action=review >> Tools/DumpRenderTree/win/DumpRenderTree.cpp:172 >> + if (path.get() && CFStringHasPrefix(path.get(), basePath.get())) > > This null check should be for basePath, not for path. Oops!
Brent Fulgham
Comment 6 2013-08-16 10:40:29 PDT
Alexey Proskuryakov
Comment 7 2013-08-16 10:52:09 PDT
Comment on attachment 208931 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=208931&action=review Great, thank you for tackling this! > Tools/DumpRenderTree/win/DumpRenderTree.cpp:144 > +static wstring fallbackString(CFURLRef url) I'd name this function after what it does - in this case, it seems more straightforward than naming it by what it is used for. What about lastPathComponent() as the name?
Alexey Proskuryakov
Comment 8 2013-08-16 10:52:49 PDT
Or something like lastPathComponentAsWString().
Brent Fulgham
Comment 9 2013-08-16 10:54:11 PDT
(In reply to comment #8) > Or something like lastPathComponentAsWString(). That's a good idea. I'll change it while landing.
Brent Fulgham
Comment 10 2013-08-16 11:05:01 PDT
Note You need to log in before you can comment on or make changes to this bug.