Title: [249693] branches/safari-608-branch
- Revision
- 249693
- Author
- alanc...@apple.com
- Date
- 2019-09-09 20:19:42 -0700 (Mon, 09 Sep 2019)
Log Message
Cherry-pick r249514. rdar://problem/55182886
MobileSafari may crash when invoking the C++ lambda in -[WKContentView _shareForWebView:]
https://bugs.webkit.org/show_bug.cgi?id=201479
<rdar://problem/51511834>
Reviewed by Tim Horton.
Source/WebKit:
Fix the crash by making -_shareForWebView: robust in the case where there are no selection rects
known in the UI process when -[WKContentView _share:] is invoked.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _shareForWebView:]):
Tools:
Add a test to verify that the UI process doesn't crash when invoking `_share:` while there's no selection.
* TestWebKitAPI/Tests/WebKitCocoa/WKContentViewEditingActions.mm:
* TestWebKitAPI/ios/UIKitSPI.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-608-branch/Source/WebKit/ChangeLog (249692 => 249693)
--- branches/safari-608-branch/Source/WebKit/ChangeLog 2019-09-10 03:19:40 UTC (rev 249692)
+++ branches/safari-608-branch/Source/WebKit/ChangeLog 2019-09-10 03:19:42 UTC (rev 249693)
@@ -1,5 +1,47 @@
2019-09-09 Kocsen Chung <kocsen_ch...@apple.com>
+ Cherry-pick r249514. rdar://problem/55182886
+
+ MobileSafari may crash when invoking the C++ lambda in -[WKContentView _shareForWebView:]
+ https://bugs.webkit.org/show_bug.cgi?id=201479
+ <rdar://problem/51511834>
+
+ Reviewed by Tim Horton.
+
+ Source/WebKit:
+
+ Fix the crash by making -_shareForWebView: robust in the case where there are no selection rects
+ known in the UI process when -[WKContentView _share:] is invoked.
+
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView _shareForWebView:]):
+
+ Tools:
+
+ Add a test to verify that the UI process doesn't crash when invoking `_share:` while there's no selection.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/WKContentViewEditingActions.mm:
+ * TestWebKitAPI/ios/UIKitSPI.h:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-09-04 Wenson Hsieh <wenson_hs...@apple.com>
+
+ MobileSafari may crash when invoking the C++ lambda in -[WKContentView _shareForWebView:]
+ https://bugs.webkit.org/show_bug.cgi?id=201479
+ <rdar://problem/51511834>
+
+ Reviewed by Tim Horton.
+
+ Fix the crash by making -_shareForWebView: robust in the case where there are no selection rects
+ known in the UI process when -[WKContentView _share:] is invoked.
+
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView _shareForWebView:]):
+
+2019-09-09 Kocsen Chung <kocsen_ch...@apple.com>
+
Cherry-pick r249454. rdar://problem/55198071
[macOS] Unable to open local file from favorites bar
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (249692 => 249693)
--- branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-09-10 03:19:40 UTC (rev 249692)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-09-10 03:19:42 UTC (rev 249693)
@@ -2805,13 +2805,15 @@
_page->getSelectionOrContentsAsString([view](const String& string, WebKit::CallbackBase::Error error) {
if (error != WebKit::CallbackBase::Error::None)
return;
- if (!string)
+
+ if (!view->_textSelectionAssistant || !string || view->_page->editorState().isMissingPostLayoutData)
return;
- CGRect presentationRect = view->_page->editorState().postLayoutData().selectionRects[0].rect();
+ auto& selectionRects = view->_page->editorState().postLayoutData().selectionRects;
+ if (selectionRects.isEmpty())
+ return;
- if (view->_textSelectionAssistant)
- [view->_textSelectionAssistant showShareSheetFor:string fromRect:presentationRect];
+ [view->_textSelectionAssistant showShareSheetFor:string fromRect:selectionRects.first().rect()];
});
}
Modified: branches/safari-608-branch/Tools/ChangeLog (249692 => 249693)
--- branches/safari-608-branch/Tools/ChangeLog 2019-09-10 03:19:40 UTC (rev 249692)
+++ branches/safari-608-branch/Tools/ChangeLog 2019-09-10 03:19:42 UTC (rev 249693)
@@ -1,3 +1,44 @@
+2019-09-09 Kocsen Chung <kocsen_ch...@apple.com>
+
+ Cherry-pick r249514. rdar://problem/55182886
+
+ MobileSafari may crash when invoking the C++ lambda in -[WKContentView _shareForWebView:]
+ https://bugs.webkit.org/show_bug.cgi?id=201479
+ <rdar://problem/51511834>
+
+ Reviewed by Tim Horton.
+
+ Source/WebKit:
+
+ Fix the crash by making -_shareForWebView: robust in the case where there are no selection rects
+ known in the UI process when -[WKContentView _share:] is invoked.
+
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView _shareForWebView:]):
+
+ Tools:
+
+ Add a test to verify that the UI process doesn't crash when invoking `_share:` while there's no selection.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/WKContentViewEditingActions.mm:
+ * TestWebKitAPI/ios/UIKitSPI.h:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-09-04 Wenson Hsieh <wenson_hs...@apple.com>
+
+ MobileSafari may crash when invoking the C++ lambda in -[WKContentView _shareForWebView:]
+ https://bugs.webkit.org/show_bug.cgi?id=201479
+ <rdar://problem/51511834>
+
+ Reviewed by Tim Horton.
+
+ Add a test to verify that the UI process doesn't crash when invoking `_share:` while there's no selection.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/WKContentViewEditingActions.mm:
+ * TestWebKitAPI/ios/UIKitSPI.h:
+
2019-09-05 Kocsen Chung <kocsen_ch...@apple.com>
Apply patch. rdar://problem/55001140
Modified: branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKContentViewEditingActions.mm (249692 => 249693)
--- branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKContentViewEditingActions.mm 2019-09-10 03:19:40 UTC (rev 249692)
+++ branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKContentViewEditingActions.mm 2019-09-10 03:19:42 UTC (rev 249693)
@@ -31,6 +31,7 @@
#import "Test.h"
#import "TestNavigationDelegate.h"
#import "TestWKWebView.h"
+#import "UIKitSPI.h"
#import <WebKit/WebKit.h>
#import <wtf/RetainPtr.h>
@@ -62,4 +63,12 @@
EXPECT_WK_STREQ("Hello world", [[UIPasteboard generalPasteboard] string]);
}
+TEST(WebKit, InvokeShareWithoutSelection)
+{
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 568)]);
+ [webView synchronouslyLoadTestPageNamed:@"simple"];
+ [[webView textInputContentView] _share:nil];
+ [webView waitForNextPresentationUpdate];
+}
+
#endif
Modified: branches/safari-608-branch/Tools/TestWebKitAPI/ios/UIKitSPI.h (249692 => 249693)
--- branches/safari-608-branch/Tools/TestWebKitAPI/ios/UIKitSPI.h 2019-09-10 03:19:40 UTC (rev 249692)
+++ branches/safari-608-branch/Tools/TestWebKitAPI/ios/UIKitSPI.h 2019-09-10 03:19:42 UTC (rev 249693)
@@ -249,4 +249,8 @@
- (CGRect)_selectionClipRect;
@end
+@interface UIResponder (Internal)
+- (void)_share:(id)sender;
+@end
+
#endif // PLATFORM(IOS_FAMILY)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes