Title: [267680] branches/safari-610-branch
- Revision
- 267680
- Author
- [email protected]
- Date
- 2020-09-27 13:00:32 -0700 (Sun, 27 Sep 2020)
Log Message
Cherry-pick r267305. rdar://problem/69594350
[macOS] REGRESSION (r265702): System Services receive 0 bytes when extracting selected content as rich text data
https://bugs.webkit.org/show_bug.cgi?id=216718
<rdar://problem/69150358>
Reviewed by Tim Horton.
Source/WebKit:
Test: CopyHTML.WriteRichTextSelectionToPasteboard
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::dataSelectionForPasteboard):
After r265702, the `IPCHandle` received in the UI process was always being converted into a buffer of size 0,
due to using the `size` local variable (which is no longer set as an outparam of the sync IPC message). Instead,
use `ipcHandle.dataSize`.
Tools:
Add a new API test to verify that we get non-empty web archive data when using
`-writeSelectionToPasteboard:types:` to grab selected content as rich text data.
* TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267305 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-610-branch/Source/WebKit/ChangeLog (267679 => 267680)
--- branches/safari-610-branch/Source/WebKit/ChangeLog 2020-09-27 20:00:30 UTC (rev 267679)
+++ branches/safari-610-branch/Source/WebKit/ChangeLog 2020-09-27 20:00:32 UTC (rev 267680)
@@ -1,5 +1,53 @@
2020-09-27 Alan Coon <[email protected]>
+ Cherry-pick r267305. rdar://problem/69594350
+
+ [macOS] REGRESSION (r265702): System Services receive 0 bytes when extracting selected content as rich text data
+ https://bugs.webkit.org/show_bug.cgi?id=216718
+ <rdar://problem/69150358>
+
+ Reviewed by Tim Horton.
+
+ Source/WebKit:
+
+ Test: CopyHTML.WriteRichTextSelectionToPasteboard
+
+ * UIProcess/mac/WebPageProxyMac.mm:
+ (WebKit::WebPageProxy::dataSelectionForPasteboard):
+
+ After r265702, the `IPCHandle` received in the UI process was always being converted into a buffer of size 0,
+ due to using the `size` local variable (which is no longer set as an outparam of the sync IPC message). Instead,
+ use `ipcHandle.dataSize`.
+
+ Tools:
+
+ Add a new API test to verify that we get non-empty web archive data when using
+ `-writeSelectionToPasteboard:types:` to grab selected content as rich text data.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267305 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-09-18 Wenson Hsieh <[email protected]>
+
+ [macOS] REGRESSION (r265702): System Services receive 0 bytes when extracting selected content as rich text data
+ https://bugs.webkit.org/show_bug.cgi?id=216718
+ <rdar://problem/69150358>
+
+ Reviewed by Tim Horton.
+
+ Test: CopyHTML.WriteRichTextSelectionToPasteboard
+
+ * UIProcess/mac/WebPageProxyMac.mm:
+ (WebKit::WebPageProxy::dataSelectionForPasteboard):
+
+ After r265702, the `IPCHandle` received in the UI process was always being converted into a buffer of size 0,
+ due to using the `size` local variable (which is no longer set as an outparam of the sync IPC message). Instead,
+ use `ipcHandle.dataSize`.
+
+2020-09-27 Alan Coon <[email protected]>
+
Cherry-pick r267215. rdar://problem/69594225
Per-app accent color overrides are broken
Modified: branches/safari-610-branch/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm (267679 => 267680)
--- branches/safari-610-branch/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm 2020-09-27 20:00:30 UTC (rev 267679)
+++ branches/safari-610-branch/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm 2020-09-27 20:00:32 UTC (rev 267680)
@@ -251,7 +251,6 @@
return nullptr;
SharedMemory::IPCHandle ipcHandle;
- uint64_t size = 0;
const Seconds messageTimeout(20);
sendSync(Messages::WebPage::GetDataSelectionForPasteboard(pasteboardType), Messages::WebPage::GetDataSelectionForPasteboard::Reply(ipcHandle), messageTimeout);
MESSAGE_CHECK_WITH_RETURN_VALUE(!ipcHandle.handle.isNull(), nullptr);
@@ -259,7 +258,7 @@
auto sharedMemoryBuffer = SharedMemory::map(ipcHandle.handle, SharedMemory::Protection::ReadOnly);
if (!sharedMemoryBuffer)
return nullptr;
- return SharedBuffer::create(static_cast<unsigned char *>(sharedMemoryBuffer->data()), static_cast<size_t>(size));
+ return SharedBuffer::create(static_cast<unsigned char *>(sharedMemoryBuffer->data()), ipcHandle.dataSize);
}
bool WebPageProxy::readSelectionFromPasteboard(const String& pasteboardName)
Modified: branches/safari-610-branch/Tools/ChangeLog (267679 => 267680)
--- branches/safari-610-branch/Tools/ChangeLog 2020-09-27 20:00:30 UTC (rev 267679)
+++ branches/safari-610-branch/Tools/ChangeLog 2020-09-27 20:00:32 UTC (rev 267680)
@@ -1,3 +1,47 @@
+2020-09-27 Alan Coon <[email protected]>
+
+ Cherry-pick r267305. rdar://problem/69594350
+
+ [macOS] REGRESSION (r265702): System Services receive 0 bytes when extracting selected content as rich text data
+ https://bugs.webkit.org/show_bug.cgi?id=216718
+ <rdar://problem/69150358>
+
+ Reviewed by Tim Horton.
+
+ Source/WebKit:
+
+ Test: CopyHTML.WriteRichTextSelectionToPasteboard
+
+ * UIProcess/mac/WebPageProxyMac.mm:
+ (WebKit::WebPageProxy::dataSelectionForPasteboard):
+
+ After r265702, the `IPCHandle` received in the UI process was always being converted into a buffer of size 0,
+ due to using the `size` local variable (which is no longer set as an outparam of the sync IPC message). Instead,
+ use `ipcHandle.dataSize`.
+
+ Tools:
+
+ Add a new API test to verify that we get non-empty web archive data when using
+ `-writeSelectionToPasteboard:types:` to grab selected content as rich text data.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267305 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-09-18 Wenson Hsieh <[email protected]>
+
+ [macOS] REGRESSION (r265702): System Services receive 0 bytes when extracting selected content as rich text data
+ https://bugs.webkit.org/show_bug.cgi?id=216718
+ <rdar://problem/69150358>
+
+ Reviewed by Tim Horton.
+
+ Add a new API test to verify that we get non-empty web archive data when using
+ `-writeSelectionToPasteboard:types:` to grab selected content as rich text data.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm:
+
2020-09-25 Alan Coon <[email protected]>
Cherry-pick r266798. rdar://problem/69583118
Modified: branches/safari-610-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm (267679 => 267680)
--- branches/safari-610-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm 2020-09-27 20:00:30 UTC (rev 267679)
+++ branches/safari-610-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm 2020-09-27 20:00:32 UTC (rev 267680)
@@ -46,6 +46,9 @@
#if PLATFORM(MAC)
+@interface WKWebView () <NSServicesMenuRequestor>
+@end
+
NSData *readHTMLDataFromPasteboard()
{
return [[NSPasteboard generalPasteboard] dataForType:NSHTMLPboardType];
@@ -193,6 +196,18 @@
EXPECT_TRUE([types containsObject:(__bridge NSString *)NSPasteboardTypeHTML]);
}
+TEST(CopyHTML, WriteRichTextSelectionToPasteboard)
+{
+ auto webView = createWebViewWithCustomPasteboardDataEnabled();
+ [webView synchronouslyLoadHTMLString:@"<strong style='color: rgb(255, 0, 0);'>This is some text to copy.</strong>"];
+ [webView stringByEvaluatingJavaScript:@"getSelection().selectAllChildren(document.body)"];
+
+ auto pasteboard = [NSPasteboard pasteboardWithUniqueName];
+ [webView writeSelectionToPasteboard:pasteboard types:@[ (__bridge NSString *)kUTTypeWebArchive ]];
+
+ EXPECT_GT([pasteboard dataForType:(__bridge NSString *)kUTTypeWebArchive].length, 0U);
+}
+
#endif // PLATFORM(MAC)
#endif // PLATFORM(COCOA)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes