InjectedBundlePageLoaderClient::willSendRequestForFrame, which calls WKBundlePageLoaderClient::willSendRequestForFrame (see URL), refs the result. This implies that willSendRequestForFrame should return a WKURLRequestRef whose refcount hasn't been incremented. But that makes returning a newly-constructed WKURLRequestRef very hard to do without causing a leak, since it requires the client to release the WKURLRequestRef *after* returning it from willSendRequestForFrame. Probably the best way to fix this is to give willSendRequestForFrame Create semantics, just like WKPageUIClient::createPage. InjectedBundlePageLoaderClient::willSendRequestForFrame should adopt the WKURLRequestRef instead of reffing it. We may want to rename willSendRequestForFrame if we do this.
<rdar://problem/8966020>
The code has moved to WKBundlePageResourceLoadClient::willSendRequestForFrame, but the bug still exists. :-(
Created attachment 84822 [details] [PATCH] Fix
Landed in r80392.
This change broke WK2 layout tests (existing early after 20 crashes). Do you want to roll it out?
(In reply to comment #5) > This change broke WK2 layout tests (existing early after 20 crashes). Do you want to roll it out? It looks like the issue is I didn't touch WebKitTestRunner. I'm looking into a fix now.
Created attachment 84871 [details] [PATCH] Crash fix
Comment on attachment 84871 [details] [PATCH] Crash fix View in context: https://bugs.webkit.org/attachment.cgi?id=84871&action=review > Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:348 > + WKRetain(returnedRequest); This is incorrect. The other willSendRequestForFrame should do the WKRetain.
Created attachment 84872 [details] [PATCH] crash Fix (Take 2)
Landed crash fix in r80427.