Bug 67794

Summary: WebKit2: Assertion when calling didPerform*Redirect on null source/destination URL string
Product: WebKit Reporter: Brian Weinstein <bweinstein>
Component: WebKit2Assignee: Brian Weinstein <bweinstein>
Status: RESOLVED FIXED    
Severity: Normal CC: beidson, sam
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
[PATCH] Fix + Test
none
[PATCH] Fix + Test + Better ChangeLog beidson: review+

Description Brian Weinstein 2011-09-08 12:39:23 PDT
We shouldn't call WebHistoryClient::didPerformClientRedirect or WebHistoryClient::didPerformServerRedirect when the source or destination URL string is empty or null. When we are creating a CFURLRef from a WKURL in WKURLCF.cpp, we assert that the string inside the WKURLRef is non-null.

Calling WebHistoryClient::didPerform*Redirect will turn the URL strings into URLs, and we don't want that in the case where they are null or empty.

<rdar://problem/9892024>
Comment 1 Brian Weinstein 2011-09-08 15:07:55 PDT
Created attachment 106797 [details]
[PATCH] Fix + Test
Comment 2 Adam Roben (:aroben) 2011-09-08 15:10:59 PDT
Comment on attachment 106797 [details]
[PATCH] Fix + Test

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

> Source/WebKit2/ChangeLog:4
> +        WebKit2: Don't call WebHistoryClient didPerform*Redirect when source or destination is empty
> +        https://bugs.webkit.org/show_bug.cgi?id=67794

It would be better if the bug title described a user-visible symptom.

> Source/WebKit2/ChangeLog:8
> +        Don't call didPerformClientRedirect or didPerformServerRedirect when source or destination URL string
> +        is empty or null.

If the bug title described an actual problem, your ChangeLog might become more informative.
Comment 3 Brian Weinstein 2011-09-08 15:18:54 PDT
(In reply to comment #2)
> (From update of attachment 106797 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=106797&action=review
> 
> > Source/WebKit2/ChangeLog:4
> > +        WebKit2: Don't call WebHistoryClient didPerform*Redirect when source or destination is empty
> > +        https://bugs.webkit.org/show_bug.cgi?id=67794
> 
> It would be better if the bug title described a user-visible symptom.

Changed it to mention the assert.

> 
> > Source/WebKit2/ChangeLog:8
> > +        Don't call didPerformClientRedirect or didPerformServerRedirect when source or destination URL string
> > +        is empty or null.
> 
> If the bug title described an actual problem, your ChangeLog might become more informative.

Added some more detail to the ChangeLog.
Comment 4 Brian Weinstein 2011-09-08 15:20:23 PDT
Created attachment 106801 [details]
[PATCH] Fix + Test + Better ChangeLog
Comment 5 Brian Weinstein 2011-09-08 15:44:37 PDT
Landed in r94812.
Comment 6 Adam Roben (:aroben) 2011-09-08 16:42:17 PDT
Comment on attachment 106801 [details]
[PATCH] Fix + Test + Better ChangeLog

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

> Source/WebKit2/ChangeLog:3
> +        WebKit2: Assertion when calling didPerform*Redirect on null source/destination URL string

It would be even better to describe this in terms of what a client app does that results in the assertion.

> Source/WebKit2/ChangeLog:11
> +        Don't call didPerformClientRedirect or didPerformServerRedirect when source or destination URL string
> +        is empty or null.
> +        
> +        If we call didPerformClientRedirect or didPerformServerRedirect when the source or destination is null,
> +        it causes an assert in WKURLCF::WKURLCopyCFURL when we try to convert the WKURLRef into a CFURLRef.

This still doesn't explain why it's OK not to call the callbacks.