summaryrefslogtreecommitdiffstats
path: root/mobile/android/modules/geckoview/GeckoViewTranslations.sys.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'mobile/android/modules/geckoview/GeckoViewTranslations.sys.mjs')
-rw-r--r--mobile/android/modules/geckoview/GeckoViewTranslations.sys.mjs13
1 files changed, 10 insertions, 3 deletions
diff --git a/mobile/android/modules/geckoview/GeckoViewTranslations.sys.mjs b/mobile/android/modules/geckoview/GeckoViewTranslations.sys.mjs
index 7e74e7bf30..45b43ac9f9 100644
--- a/mobile/android/modules/geckoview/GeckoViewTranslations.sys.mjs
+++ b/mobile/android/modules/geckoview/GeckoViewTranslations.sys.mjs
@@ -50,8 +50,11 @@ export class GeckoViewTranslations extends GeckoViewModule {
aData.toLanguage
);
try {
- this.getActor("Translations").translate(fromLanguage, toLanguage);
- aCallback.onSuccess();
+ this.getActor("Translations")
+ .translate(fromLanguage, toLanguage)
+ .then(() => {
+ aCallback.onSuccess();
+ });
} catch (error) {
aCallback.onError(`Could not translate: ${error}`);
}
@@ -101,10 +104,11 @@ export class GeckoViewTranslations extends GeckoViewModule {
type: "GeckoView:Translations:Offer",
});
break;
- case "TranslationsParent:LanguageState":
+ case "TranslationsParent:LanguageState": {
const {
detectedLanguages,
requestedTranslationPair,
+ hasVisibleChange,
error,
isEngineReady,
} = aEvent.detail.actor.languageState;
@@ -112,6 +116,7 @@ export class GeckoViewTranslations extends GeckoViewModule {
const data = {
detectedLanguages,
requestedTranslationPair,
+ hasVisibleChange,
error,
isEngineReady,
};
@@ -120,7 +125,9 @@ export class GeckoViewTranslations extends GeckoViewModule {
type: "GeckoView:Translations:StateChange",
data,
});
+
break;
+ }
}
}
}