Closed Bug 2071718 Opened 2 months ago Closed 2 months ago

[wpt-sync] Sync PR 62662 - Ensure default paste behavior doesn't leak changed clipboard content

Categories

(Core :: DOM: Editor, task, P4)

task

Tracking

()

RESOLVED FIXED
158 Branch
Tracking Status
firefox158 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Attachments

(1 file)

Sync web-platform-tests PR 62662 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/62662
Details from upstream follow.

Daniel Clark <daniec@microsoft.com> wrote:

Ensure default paste behavior doesn't leak changed clipboard content

A synchronous paste reads the clipboard lazily, so if the paste event
handler doesn't read the clipboard, the clipboard read only happens
after the paste event when the default paste behavior runs.

The page could potentially slow down the paste event handler with a busy
loop, creating a gap where the clipboard contents could change. The
result is that the default paste behavior could paste the new content
rather than the content on the clipboard at the time the paste action
was invoked. ClipboardPromise or DataObjectItem each have their own
sequence number checks, but the default paste behavior doesn't go
through either.

In this CL, fix this by having ClipboardCommand record the sequence
number at the start of the paste. If these diverge, don't perform
the default paste action that would inject the content into the
page. Also, don't pass actual clipboard data to the beforeinput event
if we detect that the clipboard has changed by that point.

ClipboardCommands::ExecutePasteAndMatchStyle was missing a
ScopedSystemClipboardSnapshot, so add one so that it gets the same
sequence number checking and IPC coalescing as Paste.

Fixed: 517584808
Change-Id: I29fc34d6e84b74914287f819bb3f66e44459ab7d

Reviewed-on: https://chromium-review.googlesource.com/8217390
WPT-Export-Revision: 5a8d70a9497f9743c3a6964c7d5c0f4ed4f0972d

Component: web-platform-tests → DOM: Editor
Product: Testing → Core
Whiteboard: [wptsync downstream] → [wptsync downstream error]
Whiteboard: [wptsync downstream error] → [wptsync downstream]
Whiteboard: [wptsync downstream] → [wptsync downstream error]
Whiteboard: [wptsync downstream error] → [wptsync downstream]
Whiteboard: [wptsync downstream] → [wptsync downstream error]
Whiteboard: [wptsync downstream error] → [wptsync downstream]
Whiteboard: [wptsync downstream] → [wptsync downstream error]
Whiteboard: [wptsync downstream error] → [wptsync downstream]
Attached file Notable wpt changes —

CI Results

Ran 9 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 510 tests and 4 subtests

Status Summary

Firefox

OK : 2[GitHub] 504[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-linux2404-64-debug, Gecko-windows11-32-25h2-debug, Gecko-windows11-64-25h2-debug] 509[Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-opt]
PASS : 14610[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-windows11-32-25h2-debug, Gecko-windows11-64-25h2-debug] 14612[Gecko-linux2404-64-debug] 14650[Gecko-linux2404-64-opt, Gecko-windows11-64-25h2-opt] 14652[Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-windows11-32-25h2-opt]
FAIL : 4[GitHub] 1669[Gecko-linux2404-64-debug] 1671[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-windows11-32-25h2-debug, Gecko-windows11-64-25h2-debug] 1684[Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-windows11-32-25h2-opt] 1686[Gecko-linux2404-64-opt, Gecko-windows11-64-25h2-opt]
ERROR: 1

Chrome

OK : 2
FAIL : 4

Safari

OK : 2
FAIL : 4

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

(See attachment for full changes)

Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 158 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: