mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 923926 - Allow content authors to cancel the directory scan initiated when the user picks a directory. r=smaug
This commit is contained in:
parent
6b77bdfe77
commit
ec1e721c24
@ -548,12 +548,17 @@ public:
|
|||||||
mInput->mProgressTimer->Cancel();
|
mInput->mProgressTimer->Cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mInput->MaybeDispatchProgressEvent(true); // Last progress event.
|
||||||
|
mInput->mDirPickerFileListBuilderTask = nullptr; // Now null out.
|
||||||
|
|
||||||
|
if (mCanceled) { // The last progress event may have canceled us
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
// The text control frame (if there is one) isn't going to send a change
|
// The text control frame (if there is one) isn't going to send a change
|
||||||
// event because it will think this is done by a script.
|
// event because it will think this is done by a script.
|
||||||
// So, we can safely send one by ourself.
|
// So, we can safely send one by ourself.
|
||||||
mInput->SetFiles(mFileList, true);
|
mInput->SetFiles(mFileList, true);
|
||||||
mInput->MaybeDispatchProgressEvent(true); // Last progress event.
|
|
||||||
mInput->mDirPickerFileListBuilderTask = nullptr; // Now null out.
|
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
nsContentUtils::DispatchTrustedEvent(mInput->OwnerDoc(),
|
nsContentUtils::DispatchTrustedEvent(mInput->OwnerDoc(),
|
||||||
static_cast<nsIDOMHTMLInputElement*>(mInput.get()),
|
static_cast<nsIDOMHTMLInputElement*>(mInput.get()),
|
||||||
@ -2609,12 +2614,16 @@ HTMLInputElement::DispatchProgressEvent(const nsAString& aType,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
progress->InitProgressEvent(aType, false, false, aLengthComputable,
|
progress->InitProgressEvent(aType, false, true, aLengthComputable,
|
||||||
aLoaded, (aTotal == UINT64_MAX) ? 0 : aTotal);
|
aLoaded, (aTotal == UINT64_MAX) ? 0 : aTotal);
|
||||||
|
|
||||||
event->SetTrusted(true);
|
event->SetTrusted(true);
|
||||||
|
|
||||||
DispatchDOMEvent(nullptr, event, nullptr, nullptr);
|
bool doDefaultAction;
|
||||||
|
rv = DispatchEvent(event, &doDefaultAction);
|
||||||
|
if (NS_SUCCEEDED(rv) && !doDefaultAction) {
|
||||||
|
CancelDirectoryPickerScanIfRunning();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
Loading…
Reference in New Issue
Block a user