Closed Bug 1843463 Opened 3 years ago Closed 3 years ago

[wpt-sync] Sync PR 41033 - [Clipboard] Fix null ExecutionContext crash in Clipboard.

Categories

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

task

Tracking

()

RESOLVED INVALID

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

Anupam Snigdha <snianu@microsoft.com> wrote:

[Clipboard] Fix null ExecutionContext crash in Clipboard.

There are cases where the ExecutionContext of the Clipboard object is
destroyed after the promise to the Blob is resolved.
The microtask queue which is fetched from the ExecutionContext of the
callback's CallbackRelevantScriptState, runs the promise fulfill
reaction job which calls into
ClipboardPromise::BlobPromiseResolverFunction::Call. In this call,
when we fetch the ExecutionContext from the ClipboardPromise object,
it is null. e.g. If a script function takes longer to produce an
image blob and the ExecutionContext is destroyed after the promise is
resolved, then we would crash with null ExecutionContext.
To avoid this crash, we check if the ExecutionContext is null, and if
it is, we reject the promise with InvalidStateError.

Bug: 1463148
Change-Id: I8dde08a6e5972fb4301ddf1c430524ed99ad1a12

Reviewed-on: https://chromium-review.googlesource.com/4670588
WPT-Export-Revision: b2ab64efdf9f04a363271f7b0ce12e1161798c6d

Component: web-platform-tests → DOM: Core & HTML
Product: Testing → Core
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.