Bug 213568 - Allow the async clipboard API to write data when copying via menu action or key binding
Summary: Allow the async clipboard API to write data when copying via menu action or k...
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: 2020-06-24 11:25 PDT by Wenson Hsieh
Modified: 2020-06-24 17:17 PDT (History)
9 users (show)

See Also:


Attachments
Patch (12.45 KB, patch)
2020-06-24 14:02 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 2020-06-24 11:25:30 PDT
SSIA
Comment 1 Radar WebKit Bug Importer 2020-06-24 11:31:30 PDT
<rdar://problem/64711653>
Comment 2 Wenson Hsieh 2020-06-24 14:02:54 PDT
Created attachment 402684 [details]
Patch
Comment 3 Darin Adler 2020-06-24 14:10:07 PDT
Comment on attachment 402684 [details]
Patch

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

> Source/WebCore/Modules/async-clipboard/Clipboard.cpp:53
> +    if (settings.javaScriptCanAccessClipboard() || frame.editor().isCopyingFromMenuOrKeyBinding())

Is it always right to ask this Frame’s editor? Should we instead ask the main frame’s editor?
Comment 4 Wenson Hsieh 2020-06-24 14:35:49 PDT
Comment on attachment 402684 [details]
Patch

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

Thanks for the review!

>> Source/WebCore/Modules/async-clipboard/Clipboard.cpp:53
>> +    if (settings.javaScriptCanAccessClipboard() || frame.editor().isCopyingFromMenuOrKeyBinding())
> 
> Is it always right to ask this Frame’s editor? Should we instead ask the main frame’s editor?

I believe it's right to ask this Frame's editor, since (in the case of copying from menu/key binding) the information about the editor command source is propagated down to the Frame responsible for handling and dispatching the clipboard event, which might be a subframe instead of the mainframe.
Comment 5 EWS 2020-06-24 16:00:27 PDT
Committed r263480: <https://trac.webkit.org/changeset/263480>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 402684 [details].
Comment 6 Darin Adler 2020-06-24 17:14:20 PDT
Comment on attachment 402684 [details]
Patch

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

>>> Source/WebCore/Modules/async-clipboard/Clipboard.cpp:53
>>> +    if (settings.javaScriptCanAccessClipboard() || frame.editor().isCopyingFromMenuOrKeyBinding())
>> 
>> Is it always right to ask this Frame’s editor? Should we instead ask the main frame’s editor?
> 
> I believe it's right to ask this Frame's editor, since (in the case of copying from menu/key binding) the information about the editor command source is propagated down to the Frame responsible for handling and dispatching the clipboard event, which might be a subframe instead of the mainframe.

I bet you are right. Probably should add a test to prove it at some point.
Comment 7 Wenson Hsieh 2020-06-24 17:17:46 PDT
(In reply to Darin Adler from comment #6)
> Comment on attachment 402684 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=402684&action=review
> 
> >>> Source/WebCore/Modules/async-clipboard/Clipboard.cpp:53
> >>> +    if (settings.javaScriptCanAccessClipboard() || frame.editor().isCopyingFromMenuOrKeyBinding())
> >> 
> >> Is it always right to ask this Frame’s editor? Should we instead ask the main frame’s editor?
> > 
> > I believe it's right to ask this Frame's editor, since (in the case of copying from menu/key binding) the information about the editor command source is propagated down to the Frame responsible for handling and dispatching the clipboard event, which might be a subframe instead of the mainframe.
> 
> I bet you are right. Probably should add a test to prove it at some point.

Will do! <https://webkit.org/b/213581>