Bug 203168 - [Clipboard API] Implement ClipboardItem.getType() for platform clipboard items
Summary: [Clipboard API] Implement ClipboardItem.getType() for platform clipboard items
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Wenson Hsieh
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-10-18 15:54 PDT by Wenson Hsieh
Modified: 2019-10-21 13:21 PDT (History)
12 users (show)

See Also:


Attachments
Patch (47.53 KB, patch)
2019-10-19 17:49 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff
Fix Win/GTK/WPE (47.42 KB, patch)
2019-10-19 17:58 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff
Fix & new layout test (51.32 KB, patch)
2019-10-21 11:07 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wenson Hsieh 2019-10-18 15:54:48 PDT
ClipboardItem.getType returns a promise that resolves to a Blob containing data for the given type.
Comment 1 Wenson Hsieh 2019-10-19 17:49:09 PDT Comment hidden (obsolete)
Comment 2 Wenson Hsieh 2019-10-19 17:58:27 PDT Comment hidden (obsolete)
Comment 3 Tim Horton 2019-10-21 10:29:07 PDT
Comment on attachment 381381 [details]
Fix Win/GTK/WPE

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

> Source/WebCore/Modules/async-clipboard/Clipboard.cpp:148
> +        m_activeSession = WTF::nullopt;

Why does trying to get the type of a non-active item clear the Clipboard's "active session"?
Comment 4 Wenson Hsieh 2019-10-21 10:37:24 PDT
Comment on attachment 381381 [details]
Fix Win/GTK/WPE

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

>> Source/WebCore/Modules/async-clipboard/Clipboard.cpp:148
>> +        m_activeSession = WTF::nullopt;
> 
> Why does trying to get the type of a non-active item clear the Clipboard's "active session"?

Good catch! Yeah, this would mean that trying to fetch an invalid clipboard item’s data would cause currently valid items to become invalidated, which is wrong.

Removed the `m_activeSession = WTF::nullopt;`; I will also add a new layout test to exercise this scenario.
Comment 5 Wenson Hsieh 2019-10-21 11:07:44 PDT
Created attachment 381419 [details]
Fix & new layout test
Comment 6 WebKit Commit Bot 2019-10-21 13:20:01 PDT
Comment on attachment 381419 [details]
Fix & new layout test

Clearing flags on attachment: 381419

Committed r251377: <https://trac.webkit.org/changeset/251377>
Comment 7 WebKit Commit Bot 2019-10-21 13:20:03 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 Radar WebKit Bug Importer 2019-10-21 13:21:21 PDT
<rdar://problem/56473973>