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

Changeset 267680 in webkit


Ignore:
Timestamp:
Sep 27, 2020, 1:00:32 PM (6 years ago)
Author:
Alan Coon
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

Location:
branches/safari-610-branch
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-610-branch/Source/WebKit/ChangeLog

    r267677 r267680  
     12020-09-27  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r267305. rdar://problem/69594350
     4
     5    [macOS] REGRESSION (r265702): System Services receive 0 bytes when extracting selected content as rich text data
     6    https://bugs.webkit.org/show_bug.cgi?id=216718
     7    <rdar://problem/69150358>
     8   
     9    Reviewed by Tim Horton.
     10   
     11    Source/WebKit:
     12   
     13    Test: CopyHTML.WriteRichTextSelectionToPasteboard
     14   
     15    * UIProcess/mac/WebPageProxyMac.mm:
     16    (WebKit::WebPageProxy::dataSelectionForPasteboard):
     17   
     18    After r265702, the `IPCHandle` received in the UI process was always being converted into a buffer of size 0,
     19    due to using the `size` local variable (which is no longer set as an outparam of the sync IPC message). Instead,
     20    use `ipcHandle.dataSize`.
     21   
     22    Tools:
     23   
     24    Add a new API test to verify that we get non-empty web archive data when using
     25    `-writeSelectionToPasteboard:types:` to grab selected content as rich text data.
     26   
     27    * TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm:
     28   
     29   
     30    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267305 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     31
     32    2020-09-18  Wenson Hsieh  <wenson_hsieh@apple.com>
     33
     34            [macOS] REGRESSION (r265702): System Services receive 0 bytes when extracting selected content as rich text data
     35            https://bugs.webkit.org/show_bug.cgi?id=216718
     36            <rdar://problem/69150358>
     37
     38            Reviewed by Tim Horton.
     39
     40            Test: CopyHTML.WriteRichTextSelectionToPasteboard
     41
     42            * UIProcess/mac/WebPageProxyMac.mm:
     43            (WebKit::WebPageProxy::dataSelectionForPasteboard):
     44
     45            After r265702, the `IPCHandle` received in the UI process was always being converted into a buffer of size 0,
     46            due to using the `size` local variable (which is no longer set as an outparam of the sync IPC message). Instead,
     47            use `ipcHandle.dataSize`.
     48
    1492020-09-27  Alan Coon  <alancoon@apple.com>
    250
  • branches/safari-610-branch/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm

    r265702 r267680  
    252252
    253253    SharedMemory::IPCHandle ipcHandle;
    254     uint64_t size = 0;
    255254    const Seconds messageTimeout(20);
    256255    sendSync(Messages::WebPage::GetDataSelectionForPasteboard(pasteboardType), Messages::WebPage::GetDataSelectionForPasteboard::Reply(ipcHandle), messageTimeout);
     
    260259    if (!sharedMemoryBuffer)
    261260        return nullptr;
    262     return SharedBuffer::create(static_cast<unsigned char *>(sharedMemoryBuffer->data()), static_cast<size_t>(size));
     261    return SharedBuffer::create(static_cast<unsigned char *>(sharedMemoryBuffer->data()), ipcHandle.dataSize);
    263262}
    264263
  • branches/safari-610-branch/Tools/ChangeLog

    r267627 r267680  
     12020-09-27  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r267305. rdar://problem/69594350
     4
     5    [macOS] REGRESSION (r265702): System Services receive 0 bytes when extracting selected content as rich text data
     6    https://bugs.webkit.org/show_bug.cgi?id=216718
     7    <rdar://problem/69150358>
     8   
     9    Reviewed by Tim Horton.
     10   
     11    Source/WebKit:
     12   
     13    Test: CopyHTML.WriteRichTextSelectionToPasteboard
     14   
     15    * UIProcess/mac/WebPageProxyMac.mm:
     16    (WebKit::WebPageProxy::dataSelectionForPasteboard):
     17   
     18    After r265702, the `IPCHandle` received in the UI process was always being converted into a buffer of size 0,
     19    due to using the `size` local variable (which is no longer set as an outparam of the sync IPC message). Instead,
     20    use `ipcHandle.dataSize`.
     21   
     22    Tools:
     23   
     24    Add a new API test to verify that we get non-empty web archive data when using
     25    `-writeSelectionToPasteboard:types:` to grab selected content as rich text data.
     26   
     27    * TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm:
     28   
     29   
     30    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267305 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     31
     32    2020-09-18  Wenson Hsieh  <wenson_hsieh@apple.com>
     33
     34            [macOS] REGRESSION (r265702): System Services receive 0 bytes when extracting selected content as rich text data
     35            https://bugs.webkit.org/show_bug.cgi?id=216718
     36            <rdar://problem/69150358>
     37
     38            Reviewed by Tim Horton.
     39
     40            Add a new API test to verify that we get non-empty web archive data when using
     41            `-writeSelectionToPasteboard:types:` to grab selected content as rich text data.
     42
     43            * TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm:
     44
    1452020-09-25  Alan Coon  <alancoon@apple.com>
    246
  • branches/safari-610-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm

    r261395 r267680  
    4747#if PLATFORM(MAC)
    4848
     49@interface WKWebView () <NSServicesMenuRequestor>
     50@end
     51
    4952NSData *readHTMLDataFromPasteboard()
    5053{
     
    194197}
    195198
     199TEST(CopyHTML, WriteRichTextSelectionToPasteboard)
     200{
     201    auto webView = createWebViewWithCustomPasteboardDataEnabled();
     202    [webView synchronouslyLoadHTMLString:@"<strong style='color: rgb(255, 0, 0);'>This is some text to copy.</strong>"];
     203    [webView stringByEvaluatingJavaScript:@"getSelection().selectAllChildren(document.body)"];
     204
     205    auto pasteboard = [NSPasteboard pasteboardWithUniqueName];
     206    [webView writeSelectionToPasteboard:pasteboard types:@[ (__bridge NSString *)kUTTypeWebArchive ]];
     207
     208    EXPECT_GT([pasteboard dataForType:(__bridge NSString *)kUTTypeWebArchive].length, 0U);
     209}
     210
    196211#endif // PLATFORM(MAC)
    197212
Note: See TracChangeset for help on using the changeset viewer.