Bug 1769907 - Don't register desktop's SelectChild and SelectParent in GeckoView. r=geckoview-reviewers,agi

Actually, GeckoView registers both desktop and mobile actor for `<select>`
element. It is unnecessary to use desktop's `<select>` actor.

But, if GeckoView doesn't register desktop's `<select>` actor,
`layout/forms/test/test_select_reframe.html` will be failure since GV doesn't
handle `mozhidedropdown` that is a event when the control is unbinded from
layout tree.

So we need to handle this for this situation that is one of dismissed cases.

Differential Revision: https://phabricator.services.mozilla.com/D149526
This commit is contained in:
Makoto Kato 2022-06-22 05:27:28 +00:00
Родитель c1c9a048ec
Коммит 22bcab84b6
2 изменённых файлов: 40 добавлений и 18 удалений

Просмотреть файл

@ -160,6 +160,15 @@ class PromptFactory {
const dismissPrompt = () => prompt.dismiss();
aElement.addEventListener("blur", dismissPrompt, { mozSystemGroup: true });
const hidedropdown = event => {
if (aElement === event.target) {
prompt.dismiss();
}
};
const chromeEventHandler = aElement.ownerGlobal.docShell.chromeEventHandler;
chromeEventHandler.addEventListener("mozhidedropdown", hidedropdown, {
mozSystemGroup: true,
});
prompt.asyncShowPrompt(
{
@ -173,6 +182,11 @@ class PromptFactory {
aElement.removeEventListener("blur", dismissPrompt, {
mozSystemGroup: true,
});
chromeEventHandler.removeEventListener(
"mozhidedropdown",
hidedropdown,
{ mozSystemGroup: true }
);
if (aIsDropDown) {
aElement.openInParentProcess = false;

Просмотреть файл

@ -15,6 +15,9 @@ const { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"
);
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
/**
* Fission-compatible JSProcess implementations.
@ -411,24 +414,6 @@ let JSWINDOWACTORS = {
allFrames: true,
},
Select: {
parent: {
moduleURI: "resource://gre/actors/SelectParent.jsm",
},
child: {
moduleURI: "resource://gre/actors/SelectChild.jsm",
events: {
mozshowdropdown: {},
"mozshowdropdown-sourcetouch": {},
mozhidedropdown: { mozSystemGroup: true },
},
},
includeChrome: true,
allFrames: true,
},
// This actor is available for all pages that one can
// view the source of, however it won't be created until a
// request to view the source is made via the message
@ -528,6 +513,29 @@ if (!Services.prefs.getBoolPref("browser.pagedata.enabled", false)) {
};
}
/**
* Note that GeckoView has another implementation in mobile/android/actors.
*/
if (AppConstants.platform != "android") {
JSWINDOWACTORS.Select = {
parent: {
moduleURI: "resource://gre/actors/SelectParent.jsm",
},
child: {
moduleURI: "resource://gre/actors/SelectChild.jsm",
events: {
mozshowdropdown: {},
"mozshowdropdown-sourcetouch": {},
mozhidedropdown: { mozSystemGroup: true },
},
},
includeChrome: true,
allFrames: true,
};
}
var ActorManagerParent = {
_addActors(actors, kind) {
let register, unregister;