RESOLVED FIXED 85635
Exception in [WebFrame loadRequest:] breaks some WebKit apps
https://bugs.webkit.org/show_bug.cgi?id=85635
Summary Exception in [WebFrame loadRequest:] breaks some WebKit apps
Brady Eidson
Reported 2012-05-04 10:10:57 PDT
Starting in http://trac.webkit.org/changeset/112571 some apps started seeing exceptions in [WebFrame loadRequest:] The exception is -[NSURL initFileURLWithPath:]: nil string parameter Some API clients incorrectly use full paths instead of actual file: URLs so r112571 started assuming all invalid URLs might "path as URL" attempts and tried rewriting them. Other WebKit clients use loadRequest: with a nil NSURLRequest, or with a request that has a nil NSURL. These URLs are invalid, therefore we started trying to rewrite them, therefore we got the exception. To continue supporting such clients, we should only rewrite invalid URLs that are also non-null. In radar as <rdar://problem/11312853>
Attachments
Patch v1 (2.11 KB, patch)
2012-05-04 10:22 PDT, Brady Eidson
ap: review+
Brady Eidson
Comment 1 2012-05-04 10:22:17 PDT
Created attachment 140264 [details] Patch v1
Alexey Proskuryakov
Comment 2 2012-05-04 10:24:17 PDT
Comment on attachment 140264 [details] Patch v1 r=me, however I have a sinking feeling that the same issue may be present in other code I added for the same reason.
Brady Eidson
Comment 3 2012-05-04 10:38:06 PDT
(In reply to comment #2) > (From update of attachment 140264 [details]) > r=me, however I have a sinking feeling that the same issue may be present in other code I added for the same reason. Auditing the sites you changed in 112571 and 107355: [WebView setMainFrameURL:] was changed to use [NSURL _web_URLWithDataAsString:] on the passed in URL string. If the URL string is nil, [NSURL _web_URLWithDataAsString] already does the right thing. [WebFrame loadHTMLString:baseURL:] and [WebFrame loadAlternateHTMLString:baseURL:forUnreachableURL:] and [WebFrame loadData:MIMEType:textEncodingName:baseURL:] ...were all changed to use [NSURL _webkit_URLFromURLOrPath] on the passed in URLs. So if those URLs are nil, [NSURL _webkit_URLFromURLOrPath] will also return nil. So the case I fixed here was the only one that needed fixing.
Brady Eidson
Comment 4 2012-05-04 10:44:29 PDT
Note You need to log in before you can comment on or make changes to this bug.