Bug 1886904 - Use AppConstants instead of prefs to decide when to delegate autocomplete to GeckoView r=geckoview-reviewers,credential-management-reviewers,dimi,m_kato

Disabling this pref breaks autocomplete in GeckoView, it's not a useful configuration at all.

Differential Revision: https://phabricator.services.mozilla.com/D239273
This commit is contained in:
Gregory Pappas
2025-02-26 02:44:56 +00:00
parent d3459d0494
commit 9c70c467d2
3 changed files with 5 additions and 23 deletions

View File

@@ -399,9 +399,6 @@ pref("signon.firefoxRelay.feature", "not available");
pref("signon.showAutoCompleteFooter", true); pref("signon.showAutoCompleteFooter", true);
// Delegate autocomplete to GeckoView (bug 1618058)
pref("toolkit.autocomplete.delegate", true);
// Locked because any other value would break GeckoView // Locked because any other value would break GeckoView
pref("toolkit.defaultChromeURI", "chrome://geckoview/content/geckoview.xhtml", locked); pref("toolkit.defaultChromeURI", "chrome://geckoview/content/geckoview.xhtml", locked);

View File

@@ -2,17 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
const lazy = {}; const lazy = {};
XPCOMUtils.defineLazyPreferenceGetter(
lazy,
"DELEGATE_AUTOCOMPLETE",
"toolkit.autocomplete.delegate",
false
);
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
GeckoViewAutocomplete: "resource://gre/modules/GeckoViewAutocomplete.sys.mjs", GeckoViewAutocomplete: "resource://gre/modules/GeckoViewAutocomplete.sys.mjs",
setTimeout: "resource://gre/modules/Timer.sys.mjs", setTimeout: "resource://gre/modules/Timer.sys.mjs",
@@ -378,7 +371,7 @@ export class AutoCompleteParent extends JSWindowActorParent {
if ( if (
!browser || !browser ||
(!lazy.DELEGATE_AUTOCOMPLETE && !browser.autoCompletePopup) (!AppConstants.MOZ_GECKOVIEW && !browser.autoCompletePopup)
) { ) {
// If there is no browser or popup, just make sure that the popup has been closed. // If there is no browser or popup, just make sure that the popup has been closed.
if (this.openedPopup) { if (this.openedPopup) {
@@ -414,7 +407,7 @@ export class AutoCompleteParent extends JSWindowActorParent {
case "AutoComplete:MaybeOpenPopup": { case "AutoComplete:MaybeOpenPopup": {
let { results, rect, dir, inputElementIdentifier, formOrigin } = let { results, rect, dir, inputElementIdentifier, formOrigin } =
message.data; message.data;
if (lazy.DELEGATE_AUTOCOMPLETE) { if (AppConstants.MOZ_GECKOVIEW) {
lazy.GeckoViewAutocomplete.delegateSelection({ lazy.GeckoViewAutocomplete.delegateSelection({
browsingContext: this.browsingContext, browsingContext: this.browsingContext,
options: results, options: results,
@@ -439,7 +432,7 @@ export class AutoCompleteParent extends JSWindowActorParent {
} }
case "AutoComplete:ClosePopup": { case "AutoComplete:ClosePopup": {
if (lazy.DELEGATE_AUTOCOMPLETE) { if (AppConstants.MOZ_GECKOVIEW) {
lazy.GeckoViewAutocomplete.delegateDismiss(); lazy.GeckoViewAutocomplete.delegateDismiss();
break; break;
} }

View File

@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
const lazy = {}; const lazy = {};
@@ -26,13 +25,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
FORM_SUBMISSION_REASON: "resource://gre/actors/FormHandlerChild.sys.mjs", FORM_SUBMISSION_REASON: "resource://gre/actors/FormHandlerChild.sys.mjs",
}); });
XPCOMUtils.defineLazyPreferenceGetter(
lazy,
"DELEGATE_AUTOCOMPLETE",
"toolkit.autocomplete.delegate",
false
);
/** /**
* Handles content's interactions for the frame. * Handles content's interactions for the frame.
*/ */
@@ -413,7 +405,7 @@ export class FormAutofillChild extends JSWindowActorChild {
} }
if ( if (
lazy.DELEGATE_AUTOCOMPLETE || AppConstants.MOZ_GECKOVIEW ||
!lazy.FormAutofillContent.savedFieldNames !lazy.FormAutofillContent.savedFieldNames
) { ) {
this.debug("onFocusIn: savedFieldNames are not known yet"); this.debug("onFocusIn: savedFieldNames are not known yet");