Changeset 221415 in webkit


Ignore:
Timestamp:
Aug 30, 2017 9:07:34 PM (7 years ago)
Author:
mitz@apple.com
Message:

[iOS] REGRESSION (r218144) -[WKContentView targetForAction:withSender:] returns the content view for actions implemented only by the WKWebView, causing a crash
https://bugs.webkit.org/show_bug.cgi?id=176077
<rdar://problem/34145200>

Reviewed by Sam Weinig.

Source/WebKit:

Test: TestWebKitAPI/Tests/WebKitCocoa/WKContentViewTargetForAction.mm

  • UIProcess/API/Cocoa/WKWebView.mm:

(-[WKWebView targetForAction:withSender:]): Override and forward WKContentView actions to

-[WKContentView targetForActionForWebView:withSender:].

  • UIProcess/ios/WKContentViewInteraction.h: Declare -targetForActionForWebView:withSender:.
  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView targetForAction:withSender:]): Forward to the WKWebView.
(-[WKContentView targetForActionForWebView:withSender:]): Call super’s

-targetForAction:withSender:.

Tools:

  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WebKitCocoa/WKContentViewTargetForAction.mm: Added.

(-[TestWKContentViewTargetForActionView testAction:]):
(TEST):

  • TestWebKitAPI/ios/UIKitSPI.h:
Location:
trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r221412 r221415  
     12017-08-30  Dan Bernstein  <mitz@apple.com>
     2
     3        [iOS] REGRESSION (r218144) -[WKContentView targetForAction:withSender:] returns the content view for actions implemented only by the WKWebView, causing a crash
     4        https://bugs.webkit.org/show_bug.cgi?id=176077
     5        <rdar://problem/34145200>
     6
     7        Reviewed by Sam Weinig.
     8
     9        Test: TestWebKitAPI/Tests/WebKitCocoa/WKContentViewTargetForAction.mm
     10
     11        * UIProcess/API/Cocoa/WKWebView.mm:
     12        (-[WKWebView targetForAction:withSender:]): Override and forward WKContentView actions to
     13          -[WKContentView targetForActionForWebView:withSender:].
     14        * UIProcess/ios/WKContentViewInteraction.h: Declare -targetForActionForWebView:withSender:.
     15        * UIProcess/ios/WKContentViewInteraction.mm:
     16        (-[WKContentView targetForAction:withSender:]): Forward to the WKWebView.
     17        (-[WKContentView targetForActionForWebView:withSender:]): Call super’s
     18          -targetForAction:withSender:.
     19
    1202017-08-30  Brent Fulgham  <bfulgham@apple.com>
    221
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm

    r221233 r221415  
    12521252
    12531253    return [super canPerformAction:action withSender:sender];
     1254}
     1255
     1256- (id)targetForAction:(SEL)action withSender:(id)sender
     1257{
     1258    #define FORWARD_TARGETFORACTION_TO_WKCONTENTVIEW(_action) \
     1259        if (action == @selector(_action:) && self.usesStandardContentView) \
     1260            return [_contentView targetForActionForWebView:action withSender:sender];
     1261
     1262    FOR_EACH_WKCONTENTVIEW_ACTION(FORWARD_TARGETFORACTION_TO_WKCONTENTVIEW)
     1263
     1264    #undef FORWARD_TARGETFORACTION_TO_WKCONTENTVIEW
     1265
     1266    return [super targetForAction:action withSender:sender];
    12541267}
    12551268
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h

    r221233 r221415  
    289289- (BOOL)resignFirstResponderForWebView;
    290290- (BOOL)canPerformActionForWebView:(SEL)action withSender:(id)sender;
     291- (id)targetForActionForWebView:(SEL)action withSender:(id)sender;
    291292
    292293#define DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW(_action) \
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r221233 r221415  
    21642164
    21652165    return [super canPerformAction:action withSender:sender];
     2166}
     2167
     2168- (id)targetForAction:(SEL)action withSender:(id)sender
     2169{
     2170    return [_webView targetForAction:action withSender:sender];
     2171}
     2172
     2173- (id)targetForActionForWebView:(SEL)action withSender:(id)sender
     2174{
     2175    return [super targetForAction:action withSender:sender];
    21662176}
    21672177
  • trunk/Tools/ChangeLog

    r221413 r221415  
     12017-08-30  Dan Bernstein  <mitz@apple.com>
     2
     3        [iOS] REGRESSION (r218144) -[WKContentView targetForAction:withSender:] returns the content view for actions implemented only by the WKWebView, causing a crash
     4        https://bugs.webkit.org/show_bug.cgi?id=176077
     5        <rdar://problem/34145200>
     6
     7        Reviewed by Sam Weinig.
     8
     9        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     10        * TestWebKitAPI/Tests/WebKitCocoa/WKContentViewTargetForAction.mm: Added.
     11        (-[TestWKContentViewTargetForActionView testAction:]):
     12        (TEST):
     13        * TestWebKitAPI/ios/UIKitSPI.h:
     14
    1152017-08-30  Carlos Alberto Lopez Perez  <clopez@igalia.com>
    216
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r221233 r221415  
    115115                33DC89141419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33DC89131419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp */; };
    116116                33E79E06137B5FD900E32D99 /* mouse-move-listener.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */; };
     117                370CE22A1F57343400E7410B /* WKContentViewTargetForAction.mm in Sources */ = {isa = PBXBuildFile; fileRef = 370CE2291F57343400E7410B /* WKContentViewTargetForAction.mm */; };
    117118                374B7A601DF36EEE00ACCB6C /* BundleEditingDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 374B7A5E1DF36EEE00ACCB6C /* BundleEditingDelegate.mm */; };
    118119                374B7A611DF371CF00ACCB6C /* BundleEditingDelegatePlugIn.mm in Sources */ = {isa = PBXBuildFile; fileRef = 374B7A5F1DF36EEE00ACCB6C /* BundleEditingDelegatePlugIn.mm */; };
     
    11451146                33DC89131419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoadCanceledNoServerRedirectCallback_Bundle.cpp; sourceTree = "<group>"; };
    11461147                33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "mouse-move-listener.html"; sourceTree = "<group>"; };
     1148                370CE2291F57343400E7410B /* WKContentViewTargetForAction.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WKContentViewTargetForAction.mm; sourceTree = "<group>"; };
    11471149                3722C8681461E03E00C45D00 /* RenderedImageFromDOMRange.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RenderedImageFromDOMRange.mm; sourceTree = "<group>"; };
    11481150                374B7A5E1DF36EEE00ACCB6C /* BundleEditingDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BundleEditingDelegate.mm; sourceTree = "<group>"; };
     
    19721974                                5CE354D81E70D9C300BEFE3B /* WKContentExtensionStore.mm */,
    19731975                                2D838B1E1EEF3A5B009B980E /* WKContentViewEditingActions.mm */,
     1976                                370CE2291F57343400E7410B /* WKContentViewTargetForAction.mm */,
    19741977                                51D124971E763AF8002B2820 /* WKHTTPCookieStore.mm */,
    19751978                                375E0E151D66674400EFEC2C /* WKNSNumber.mm */,
     
    26112614                                C08587F913FEC39B001EF4E5 /* TestWebKitAPI */,
    26122615                                440A1D3614A01000008A66F2 /* WebCore */,
    2613                                 CDC8E4981BC728AE00594FEC /* WebKitLegacy */,
    26142616                                BC9096411255616000083756 /* WebKit */,
    26152617                                1ABC3DEC1899BE55004F0626 /* WebKit Cocoa */,
    26162618                                BC3C4C6F14575B1D0025FB62 /* WebKit Objective-C */,
     2619                                CDC8E4981BC728AE00594FEC /* WebKitLegacy */,
    26172620                                BC9096461255618900083756 /* WTF */,
    26182621                        );
     
    33763379                                5CE354D91E70DA5C00BEFE3B /* WKContentExtensionStore.mm in Sources */,
    33773380                                2D838B1F1EEF3A5C009B980E /* WKContentViewEditingActions.mm in Sources */,
     3381                                370CE22A1F57343400E7410B /* WKContentViewTargetForAction.mm in Sources */,
    33783382                                51D124981E763B02002B2820 /* WKHTTPCookieStore.mm in Sources */,
    33793383                                7CCE7F1D1A411AE600447C4C /* WKImageCreateCGImageCrash.cpp in Sources */,
Note: See TracChangeset for help on using the changeset viewer.