commit 035573a95082ea8a179981aad216f01013db910e
parent 8d7de57247465a85c0ba45e81411dca9ba3a9cc2
Author: Julian Descottes <jdescottes@mozilla.com>
Date: Mon, 10 Nov 2025 16:58:23 +0000
Bug 1999229 - Emit observer notification when input type file triggers a filepicker r=dom-core,smaug
Differential Revision: https://phabricator.services.mozilla.com/D271790
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp
@@ -912,6 +912,14 @@ nsresult HTMLInputElement::InitFilePicker(FilePickerType aType) {
nsCOMPtr<nsIFilePickerShownCallback> callback =
new HTMLInputElement::nsFilePickerShownCallback(this, filePicker);
+ nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
+ if (obs) {
+ // Used by WebDriver BiDi to emit input.fileDialogOpened whenever an input
+ // type=file opens a file picker.
+ obs->NotifyObservers(ToSupports(this), "file-input-picker-opening",
+ nullptr);
+ }
+
if (!oldFiles.IsEmpty() && aType != FILE_PICKER_DIRECTORY) {
nsAutoString path;