⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 194060 in webkit


Ignore:
Timestamp:
Dec 14, 2015, 2:12:02 PM (11 years ago)
Author:
timothy_horton@apple.com
Message:

Frequent crash under -[WKPDFView web_setMinimumSize:]_block_invoke
https://bugs.webkit.org/show_bug.cgi?id=152266
<rdar://problem/22092676>

Reviewed by Simon Fraser.

Source/WebKit2:

  • UIProcess/ios/WKPDFView.mm:

(-[WKPDFView web_setMinimumSize:]):
We weren't retaining the UIScrollView, but depending on it surviving
into this block's invocation.

We don't need to do this asynchronously anymore because the referenced
bug is fixed, so make it happen synchronously. This also fixes the crash
because there's no opportunity for the scroll view to be released.

Tools:

  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WebKit2Cocoa/WKPDFViewResizeCrash.mm: Added.

Add a test that crashed before this change, and doesn't crash after.

Location:
trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r194046 r194060  
     12015-12-14  Tim Horton  <timothy_horton@apple.com>
     2
     3        Frequent crash under -[WKPDFView web_setMinimumSize:]_block_invoke
     4        https://bugs.webkit.org/show_bug.cgi?id=152266
     5        <rdar://problem/22092676>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * UIProcess/ios/WKPDFView.mm:
     10        (-[WKPDFView web_setMinimumSize:]):
     11        We weren't retaining the UIScrollView, but depending on it surviving
     12        into this block's invocation.
     13
     14        We don't need to do this asynchronously anymore because the referenced
     15        bug is fixed, so make it happen synchronously. This also fixes the crash
     16        because there's no opportunity for the scroll view to be released.
     17
    1182015-12-14  Tim Horton  <timothy_horton@apple.com>
    219
  • trunk/Source/WebKit2/UIProcess/ios/WKPDFView.mm

    r193481 r194060  
    220220    [self _computePageAndDocumentFrames];
    221221
    222     // FIXME: This dispatch_async is unnecessary except to work around rdar://problem/15035620.
    223     // Once that is resolved, we should do the setContentOffset without the dispatch_async.
    224     RetainPtr<WKPDFView> retainedSelf = self;
    225     dispatch_async(dispatch_get_main_queue(), [retainedSelf, oldDocumentLeftFraction, oldDocumentTopFraction] {
    226         CGSize contentSize = retainedSelf->_scrollView.contentSize;
    227         UIEdgeInsets contentInset = retainedSelf->_scrollView.contentInset;
    228         [retainedSelf->_scrollView setContentOffset:CGPointMake((oldDocumentLeftFraction * contentSize.width) - contentInset.left, (oldDocumentTopFraction * contentSize.height) - contentInset.top) animated:NO];
    229 
    230         [retainedSelf _revalidateViews];
    231     });
     222    CGSize newContentSize = _scrollView.contentSize;
     223    UIEdgeInsets contentInset = _scrollView.contentInset;
     224    [_scrollView setContentOffset:CGPointMake((oldDocumentLeftFraction * newContentSize.width) - contentInset.left, (oldDocumentTopFraction * newContentSize.height) - contentInset.top) animated:NO];
     225
     226    [self _revalidateViews];
    232227}
    233228
  • trunk/Tools/ChangeLog

    r194054 r194060  
     12015-12-14  Tim Horton  <timothy_horton@apple.com>
     2
     3        Frequent crash under -[WKPDFView web_setMinimumSize:]_block_invoke
     4        https://bugs.webkit.org/show_bug.cgi?id=152266
     5        <rdar://problem/22092676>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     10        * TestWebKitAPI/Tests/WebKit2Cocoa/WKPDFViewResizeCrash.mm: Added.
     11        Add a test that crashed before this change, and doesn't crash after.
     12
    1132015-12-14  Chris Fleizach  <cfleizach@apple.com>
    214
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r192113 r194060  
    3636                290F4275172A221C00939FF0 /* custom-protocol-sync-xhr.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 290F4274172A1FDE00939FF0 /* custom-protocol-sync-xhr.html */; };
    3737                297234B7173AFAC700983601 /* CustomProtocolsInvalidScheme_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 297234B5173AFAC700983601 /* CustomProtocolsInvalidScheme_Bundle.cpp */; };
     38                2D00065F1C1F589A0088E6A7 /* WKPDFViewResizeCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D00065D1C1F58940088E6A7 /* WKPDFViewResizeCrash.mm */; };
    3839                2D1FE0B01AD465C1006CD9E6 /* FixedLayoutSize.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D1FE0AF1AD465C1006CD9E6 /* FixedLayoutSize.mm */; };
    3940                2D8104CC1BEC13E70020DA46 /* FindInPage.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D8104CB1BEC13E70020DA46 /* FindInPage.mm */; };
     
    519520                29AB8AA2164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TestBrowsingContextLoadDelegate.mm; sourceTree = "<group>"; };
    520521                29AB8AA3164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestBrowsingContextLoadDelegate.h; sourceTree = "<group>"; };
     522                2D00065D1C1F58940088E6A7 /* WKPDFViewResizeCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKPDFViewResizeCrash.mm; sourceTree = "<group>"; };
    521523                2D1FE0AF1AD465C1006CD9E6 /* FixedLayoutSize.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FixedLayoutSize.mm; sourceTree = "<group>"; };
    522524                2D640B5417875DFF00BFAF99 /* ScrollPinningBehaviors.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollPinningBehaviors.cpp; sourceTree = "<group>"; };
     
    947949                                2D9A53AE1B31FA8D0074D5AA /* ShrinkToFit.mm */,
    948950                                7CC3E1FA197E234100BE6252 /* UserContentController.mm */,
     951                                2D00065D1C1F58940088E6A7 /* WKPDFViewResizeCrash.mm */,
    949952                                0F3B94A51A77266C00DE3272 /* WKWebViewEvaluateJavaScript.mm */,
    950953                        );
     
    17281731                                7CCE7F101A411AE600447C4C /* ResponsivenessTimerDoesntFireEarly.cpp in Sources */,
    17291732                                7CCE7F111A411AE600447C4C /* RestoreSessionStateContainingFormData.cpp in Sources */,
     1733                                2D00065F1C1F589A0088E6A7 /* WKPDFViewResizeCrash.mm in Sources */,
    17301734                                7CCE7F4E1A411BA400447C4C /* RetainPtr.cpp in Sources */,
    17311735                                7CCE7F4D1A411B9F00447C4C /* RetainPtr.mm in Sources */,
Note: See TracChangeset for help on using the changeset viewer.