Bug 176077 - [iOS] REGRESSION (r218144) -[WKContentView targetForAction:withSender:] returns the content view for actions implemented only by the WKWebView, causing a crash
Summary: [iOS] REGRESSION (r218144) -[WKContentView targetForAction:withSender:] retur...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P1 Normal
Assignee: mitz
URL:
Keywords: InRadar, Regression
Depends on:
Blocks:
 
Reported: 2017-08-29 15:51 PDT by mitz
Modified: 2017-08-30 21:07 PDT (History)
5 users (show)

See Also:


Attachments
Forward -targetForAction:withSender: from the content view to the web view (12.30 KB, patch)
2017-08-30 12:42 PDT, mitz
no flags Details | Formatted Diff | Diff
Forward -targetForAction:withSender: from the content view to the web view (12.09 KB, patch)
2017-08-30 13:50 PDT, mitz
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description mitz 2017-08-29 15:51:52 PDT
<https://trac.webkit.org/r218144> made -[WKContentView canPerformAction:withSender:] return YES for actions implemented by the WKWebView, but didn’t take care to override -targetForAction:withSender: to return the WKWebView as well. Without an override, the base implementation returns the WKContentView itself, which then gets sent an unrecognized selector.
Comment 1 mitz 2017-08-29 15:54:14 PDT
<rdar://problem/34145200>
Comment 2 mitz 2017-08-30 12:42:34 PDT
Created attachment 319387 [details]
Forward -targetForAction:withSender: from the content view to the web view
Comment 3 Build Bot 2017-08-30 12:44:33 PDT
Attachment 319387 [details] did not pass style-queue:


ERROR: Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:1258:  preprocessor directives (e.g., #ifdef, #define, #import) should never be indented.  [whitespace/indent] [4]
ERROR: Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:1264:  preprocessor directives (e.g., #ifdef, #define, #import) should never be indented.  [whitespace/indent] [4]
Total errors found: 2 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Wenson Hsieh 2017-08-30 12:48:03 PDT
Comment on attachment 319387 [details]
Forward -targetForAction:withSender: from the content view to the web view

View in context: https://bugs.webkit.org/attachment.cgi?id=319387&action=review

> Tools/TestWebKitAPI/Tests/WebKitCocoa/WKContentViewTargetForAction.mm:36
> +static UIView *recursiveFindWKContentView(UIView *view)

Hm...I wonder if this functionality should be in a testing category on WKWebView in TestWKWebView.h instead -- I imagine it could be useful for other tests as well, not just this test (at a brief glance, WKContentViewEditingActions.mm also needs the same functionality).

> Tools/TestWebKitAPI/Tests/WebKitCocoa/WKContentViewTargetForAction.mm:63
> +    RetainPtr<TestWKContentViewTargetForActionView> webView = adoptNS([[TestWKContentViewTargetForActionView alloc] init]);

Nit - I would prefer auto here.
Comment 5 mitz 2017-08-30 13:50:10 PDT
Created attachment 319393 [details]
Forward -targetForAction:withSender: from the content view to the web view
Comment 6 Build Bot 2017-08-30 13:52:30 PDT
Attachment 319393 [details] did not pass style-queue:


ERROR: Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:1258:  preprocessor directives (e.g., #ifdef, #define, #import) should never be indented.  [whitespace/indent] [4]
ERROR: Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:1264:  preprocessor directives (e.g., #ifdef, #define, #import) should never be indented.  [whitespace/indent] [4]
Total errors found: 2 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 7 WebKit Commit Bot 2017-08-30 21:07:38 PDT
Comment on attachment 319393 [details]
Forward -targetForAction:withSender: from the content view to the web view

Clearing flags on attachment: 319393

Committed r221415: <http://trac.webkit.org/changeset/221415>
Comment 8 WebKit Commit Bot 2017-08-30 21:07:39 PDT
All reviewed patches have been landed.  Closing bug.