Bug 1919537 - don't crash with DLP on when drag/drop text to a site on Deny list r=dlp-reviewers,reusable-components-reviewers,handyman,mstriemer

This prevents a problem where Content Analysis responds synchronously (because
the site is on the deny list), which causes a modal window to pop up, which
cancels the drag session. This causes MOZ_ASSERTs() where we expect the drag
session to still be active.

Differential Revision: https://phabricator.services.mozilla.com/D222668
This commit is contained in:
Greg Stoll 2024-09-23 13:18:56 +00:00
parent 8e42aaf044
commit 5600b8b8a1

View File

@ -193,6 +193,10 @@
// Create a request for each text and file item in the DataTransfer
try {
// Tell browser to record the event target and to delay EndDragSession
// until the content analysis results are given.
dragSession.sendStoreDropTargetAndDelayEndDragSession(event);
// Submit a content analysis request for each checkable entry in the
// DataTransfer and stop dispatching this drop event. Reissue the
// drop if all requests are permitted.
@ -251,13 +255,12 @@
if (!caPromises.length) {
// Nothing was analyzable.
dragSession.sendDispatchToDropTargetAndResumeEndDragSession(
true
);
return;
}
// Tell browser to record the event target and to delay EndDragSession
// until the results are given.
dragSession.sendStoreDropTargetAndDelayEndDragSession(event);
// Only permit the drop if all requests were approved. Issue dragexit
// instead of drop if CA rejected the content or there was an error.
Promise.all(caPromises).then(