| Summary: | WKWebView crashes on deallocation | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Eugene But <eugenebut> | ||||||||
| Component: | WebKit2 | Assignee: | Simon Fraser (smfr) <simon.fraser> | ||||||||
| Status: | RESOLVED FIXED | ||||||||||
| Severity: | Major | CC: | ap, commit-queue, njaiswal, simon.fraser, stuartmorgan, wenpkpk | ||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||
| Version: | 528+ (Nightly build) | ||||||||||
| Hardware: | iPhone / iPad | ||||||||||
| OS: | All | ||||||||||
| Attachments: |
|
||||||||||
Created attachment 244196 [details]
Crash Log
Radar ID: 19036018 *** Bug 140915 has been marked as a duplicate of this bug. *** Created attachment 245398 [details]
Patch
Comment on attachment 245398 [details]
Patch
Sam said Yeah.
Attachment 245398 [details] did not pass style-queue:
ERROR: Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewEvaluateJavaScript.mm:45: Place brace on its own line for function definitions. [whitespace/braces] [4]
Total errors found: 1 in 5 files
If any of these errors are false positives, please file a bug against check-webkit-style.
Thanks! Is there any reasonable way for us to work around this in versions of the OS that don't have the fix? Try calling -copy on the completion block that you send into -[WKWebView evaluateJavaScript:completionHandler:], and manage the lifetime of the resulting block yourself. Hi,I fixed the WebKit's bug. The code below:
- (void)evaluateJavaScript:(NSString *)javaScriptString completionHandler:(void (^)(id, NSError *))completionHandler
{
id strongSelf = self;
[super evaluateJavaScript:javaScriptString completionHandler:^(id r, NSError *e) {
[strongSelf title];
if (completionHandler) {
completionHandler(r, e);
}
}];
}
|
Created attachment 244195 [details] Test App Summary: [Chrome] WKWebView crashes on deallocation if it has pending JavaScript evaluation. Steps to Reproduce: 1. Unarchive WKWebView.zip 2. Build and run test project on device or simulator Expected Results: "No error" should appear in console Actual Results: App crashes