Bug 1961170 part 5 - make SendDispatchToDropTargetAndResumeEndDragSession() take allowedFiles r=dlp-reviewers,handyman
Differential Revision: https://phabricator.services.mozilla.com/D248522
This commit is contained in:
committed by
gstoll@mozilla.com
parent
793a2194f8
commit
51930f6e5c
@@ -1302,11 +1302,27 @@ nsBaseDragSession::SendStoreDropTargetAndDelayEndDragSession(
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBaseDragSession::SendDispatchToDropTargetAndResumeEndDragSession(
|
||||
bool aShouldDrop) {
|
||||
bool aShouldDrop, const nsTArray<RefPtr<nsIFile>>& aAllowedFiles) {
|
||||
MOZ_ASSERT(mDelayedDropBrowserParent);
|
||||
nsTHashSet<nsString> allowedFilePaths;
|
||||
if (aShouldDrop) {
|
||||
for (const auto& allowedFile : aAllowedFiles) {
|
||||
nsString filePath;
|
||||
nsresult rv = allowedFile->GetPath(filePath);
|
||||
if (NS_FAILED(rv)) {
|
||||
// Something has gone wrong, cancel the drop
|
||||
Unused << mDelayedDropBrowserParent
|
||||
->SendDispatchToDropTargetAndResumeEndDragSession(
|
||||
false /* aShouldDrop */, nsTHashSet<nsString>());
|
||||
mDelayedDropBrowserParent = nullptr;
|
||||
return rv;
|
||||
}
|
||||
allowedFilePaths.Insert(filePath);
|
||||
}
|
||||
}
|
||||
Unused << mDelayedDropBrowserParent
|
||||
->SendDispatchToDropTargetAndResumeEndDragSession(
|
||||
aShouldDrop, allowedFilePaths);
|
||||
aShouldDrop, std::move(allowedFilePaths));
|
||||
mDelayedDropBrowserParent = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ class BrowserParent;
|
||||
%}
|
||||
|
||||
interface nsIContentSecurityPolicy;
|
||||
interface nsIFile;
|
||||
|
||||
[ptr] native BrowserParentPtr(mozilla::dom::BrowserParent);
|
||||
native EventMessage(mozilla::EventMessage);
|
||||
@@ -235,7 +236,7 @@ interface nsIDragSession : nsISupports
|
||||
* @param aShouldDrop True to send drop event, false to send dragexit event
|
||||
*/
|
||||
void sendDispatchToDropTargetAndResumeEndDragSession(
|
||||
in boolean aShouldDrop);
|
||||
in boolean aShouldDrop, in Array<nsIFile> aAllowedFiles);
|
||||
|
||||
/**
|
||||
* Store aElement and aDocFrame as the future drop/dragexit context, and
|
||||
|
||||
Reference in New Issue
Block a user