Closed Bug 2094945 Opened 11 days ago Closed 8 days ago

[wpt-sync] Sync PR 65038 - WebKit export of https://bugs.webkit.org/show_bug.cgi?id=330861

Categories

(Core :: DOM: Core & HTML, task, P4)

task

Tracking

()

RESOLVED FIXED
163 Branch
Tracking Status
firefox163 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

Ahmad Saleem <ahmad.saleem792+github@gmail.com> wrote:

WebKit export of https://bugs.webkit.org/show_bug.cgi?id=330861

WebKit export from bug: Crash in DataTransfer:<!---->:<!---->updateFileList(<!---->)<!----> because the dragstart DataTransfer stays writable after dispatch

<pre>
Crash in DataTransfer::updateFileList() because the dragstart DataTransfer stays writable after dispatch

EventHandler::handleDrag() dispatches dragstart with a separate
read/write DataTransfer, then calls moveDragState() to move its state
into dragState().dataTransfer. Only dragState().dataTransfer was then
made invalid for security. The DataTransfer that script can see stayed
in read/write mode for as long as script kept a reference to it.

moveDragState() also moves m_fileList away from that object. If script
used dataTransfer.items during dragstart and later, for example in a
setTimeout, called items.add(file) and then items.remove(0), add()
succeeded, didAddFileToItemList() returned early because m_fileList was
null, and remove() called updateFileList(), which dereferenced the null
m_fileList.

Per the HTML spec, once a DND event has been dispatched the DataTransfer
is no longer associated with the drag data store, so its item list is in
disabled mode: add() must return null and remove() must throw an
InvalidStateError.

Fix this by making the dragstart DataTransfer invalid for security
before moving its state. Also make updateFileList() return early when
m_fileList is null, matching didAddFileToItemList().

WebKit-Bug: <a href="https://bugs.webkit.org/show_bug.cgi?id=330861">https://bugs.webkit.org/show_bug.cgi?id=330861</a>
WebKit-Canonical-Link: <a href="https://commits.webkit.org/326392@main">https://commits.webkit.org/326392@main</a>
</pre>

Component: web-platform-tests → DOM: Core & HTML
Product: Testing → Core

CI Results

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

Total 2 tests and 3 subtests

Status Summary

Firefox

OK : 2
PASS : 4

Chrome

OK : 2
PASS : 4

Safari

OK : 1
PASS : 3
ERROR: 1

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

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