Title: [217956] trunk/Source/WebKit2
- Revision
- 217956
- Author
- [email protected]
- Date
- 2017-06-08 17:46:38 -0700 (Thu, 08 Jun 2017)
Log Message
Crash under -[WKWebView _updateVisibleContentRects]
https://bugs.webkit.org/show_bug.cgi?id=173123
rdar://problem/32650112
Reviewed by Tim Horton.
Make sure the WKWebView is valid in places where we dispatch_async or use
a pre-commit handler.
Speculative fix for a rare crasher.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _isValid]):
(-[WKWebView _addUpdateVisibleContentRectPreCommitHandler]):
(-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (217955 => 217956)
--- trunk/Source/WebKit2/ChangeLog 2017-06-09 00:31:17 UTC (rev 217955)
+++ trunk/Source/WebKit2/ChangeLog 2017-06-09 00:46:38 UTC (rev 217956)
@@ -1,3 +1,21 @@
+2017-06-08 Simon Fraser <[email protected]>
+
+ Crash under -[WKWebView _updateVisibleContentRects]
+ https://bugs.webkit.org/show_bug.cgi?id=173123
+ rdar://problem/32650112
+
+ Reviewed by Tim Horton.
+
+ Make sure the WKWebView is valid in places where we dispatch_async or use
+ a pre-commit handler.
+
+ Speculative fix for a rare crasher.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _isValid]):
+ (-[WKWebView _addUpdateVisibleContentRectPreCommitHandler]):
+ (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]):
+
2017-06-07 Simon Fraser <[email protected]>
Use initializers in WebPageProxy
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (217955 => 217956)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2017-06-09 00:31:17 UTC (rev 217955)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2017-06-09 00:46:38 UTC (rev 217956)
@@ -316,6 +316,11 @@
return [self initWithFrame:frame configuration:adoptNS([[WKWebViewConfiguration alloc] init]).get()];
}
+- (BOOL)_isValid
+{
+ return _page && _page->isValid();
+}
+
#if PLATFORM(IOS)
static int32_t deviceOrientationForUIInterfaceOrientation(UIInterfaceOrientation orientation)
{
@@ -2353,6 +2358,8 @@
auto retainedSelf = retainPtr(self);
[CATransaction addCommitHandler:[retainedSelf] {
WKWebView *webView = retainedSelf.get();
+ if (![webView _isValid])
+ return;
[webView _updateVisibleContentRects];
webView->_hasScheduledVisibleRectUpdate = NO;
} forPhase:kCATransactionPhasePreCommit];
@@ -2377,6 +2384,8 @@
dispatch_async(dispatch_get_main_queue(), [retainedSelf = retainPtr(self)] {
WKWebView *webView = retainedSelf.get();
+ if (![webView _isValid])
+ return;
[webView _addUpdateVisibleContentRectPreCommitHandler];
});
}
@@ -3788,12 +3797,15 @@
- (pid_t)_webProcessIdentifier
{
- return _page->isValid() ? _page->processIdentifier() : 0;
+ if (![self _isValid])
+ return 0;
+
+ return _page->processIdentifier();
}
- (void)_killWebContentProcess
{
- if (!_page->isValid())
+ if (![self _isValid])
return;
_page->process().terminate();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes