diff -urN firefox-152.0.3-orig/widget/gtk/nsFilePicker.cpp firefox-152.0.3/widget/gtk/nsFilePicker.cpp --- firefox-152.0.3-orig/widget/gtk/nsFilePicker.cpp 2026-06-25 10:03:14 +0900 +++ firefox-152.0.3/widget/gtk/nsFilePicker.cpp 2026-07-03 04:34:57 +0900 @@ -52,14 +52,6 @@ static nsIFile* sPrevDisplayDirectory = nullptr; -// Use an application-defined response ID (non-negative) for the accept button -// instead of GTK_RESPONSE_ACCEPT (-3). GTK's built-in negative response IDs -// cause the button to be treated as the dialog's default widget, meaning it -// activates on Enter. A non-negative ID prevents this, so a page that tricks -// the user into holding Enter before the dialog appears cannot auto-confirm -// an unintended file upload. See bug 2033848 and the equivalent Chrome fix. -static const gint kFilePickerAccept = 0; - void nsFilePicker::Shutdown() { NS_IF_RELEASE(sPrevDisplayDirectory); } #ifdef MOZ_ENABLE_DBUS @@ -698,7 +690,7 @@ GtkFileChooser* file_chooser = GTK_FILE_CHOOSER(gtk_file_chooser_dialog_new( title.get(), parent_widget, action, g_dgettext("gtk30", "_Cancel"), - GTK_RESPONSE_CANCEL, accept_button, kFilePickerAccept, nullptr)); + GTK_RESPONSE_CANCEL, accept_button, GTK_RESPONSE_ACCEPT, nullptr)); // If we have --enable-proxy-bypass-protection, then don't allow // remote URLs to be used. @@ -774,6 +766,11 @@ } } + if (GTK_IS_DIALOG(file_chooser)) { + gtk_dialog_set_default_response(GTK_DIALOG(file_chooser), + GTK_RESPONSE_ACCEPT); + } + size_t count = mFilters.Length(); for (size_t i = 0; i < count; ++i) { GtkFileFilter* filter = NewFilter(mFilters[i], mFilterNames[i]); @@ -878,8 +875,7 @@ nsIFilePicker::ResultCode result; switch (response) { case GTK_RESPONSE_OK: - case GTK_RESPONSE_ACCEPT: // emitted by GTK internally on double-click - case kFilePickerAccept: + case GTK_RESPONSE_ACCEPT: ReadValuesFromNonPortalFileChooser(GTK_FILE_CHOOSER(file_chooser)); result = nsIFilePicker::returnOK; break;