Closed Bug 1946964 Opened 14 days ago Closed 12 days ago

TranslationsEngine fails to load due to "setTimeout is not defined"

Categories

(Firefox :: Translations, defect, P1)

Firefox 137
defect

Tracking

()

RESOLVED FIXED
137 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr128 --- unaffected
firefox135 --- unaffected
firefox136 --- unaffected
firefox137 --- fixed

People

(Reporter: tgnff242, Assigned: nordzilla)

References

(Regression)

Details

(Keywords: nightly-community, regression)

Attachments

(1 file)

Steps to reproduce:

Try to translate any page. Language isn't important.

Actual results:

The translation fails with the displayed error being: "There was a problem translating. Please try again."

Expected results:

Regressed by Bug 1942128.

https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=90f0b0004226da5025acc6f9b45d2d2371bf71cb&tochange=b95de61de7638546897604c446045ce42782b388

Has STR: --- → yes
Regressed by: 1942128

On Linux, in case it's important.

:nika, since you are the author of the regressor, bug 1942128, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(nika)

It does look like Translations is currently broken in Nightly, unfortunately.

I investigated this a bit, and it appears to be the use of setTimeout() for the TranslationsEngine cache timers.

Error Log

Translations: The engine failed to load for translating "es -> en". Removing it from the cache. 

ReferenceError: setTimeout is not defined
    keepAlive chrome://global/content/translations/translations-engine.sys.mjs:332
    isReady chrome://global/content/translations/translations-engine.sys.mjs:396
    TranslationsEngine** chrome://global/content/translations/translations-engine.sys.mjs:375
    create chrome://global/content/translations/translations-engine.sys.mjs:260

Note

This didn't fail our integration or end-to-end tests in CI because we manually manage the lifetimes of the engines in the test cleanup functions to ensure the state of the engine cache is deterministic and consistent between test cases, but in production they are managed by a keep-alive timeout here.


I'm marking this as S2 P1, matching the following description:

S2: (Serious) Major functionality/product severely impaired or a high impact issue and a satisfactory workaround does not exist

This is only in Nightly right now, but we should get this fixed ASAP, since it appears to be broken on all platforms.


:nika, I am leaving your NI open because I am not sure how you patch affected this behavior, or if it is intended that setTimeout() should no longer be available within the inference process. I'm interested to hear your input.

Severity: -- → S2
Priority: -- → P1
Status: UNCONFIRMED → NEW
Ever confirmed: true
Component: IPC → Translations
Product: Core → Firefox
Summary: Translations fail → TranslationsEngine fails to load due to "setTimeout is not defined"

(In reply to Erik Nordin [:nordzilla] from comment #3)

:nika, I am leaving your NI open because I am not sure how you patch affected this behavior, or if it is intended that setTimeout() should no longer be available within the inference process. I'm interested to hear your input.

This is happening because the translations-engine.sys.mjs file is now actually being loaded as a sys.mjs file, rather than as a module loaded in a content window. In the system js module scope there is no function named setTimeout, meaning that this call fails, but it wasn't caught in automation because of the Cu.isInAutomation check disabling this codepath in tests.

The easiest solution here is probably to import the js setTimeout implementation from "resource://gre/modules/Timer.sys.mjs".

I'm guessing that perhaps I should've removed the /* eslint-env browser */ annotation from the top of the file as well, and perhaps that would've caught it, but I'm not familiar with how our eslint setup works.

Flags: needinfo?(nika) → needinfo?(enordin)
Assignee: nobody → enordin

Fixes an issue where translations-engine.sys.mjs was not properly
importing the setTimeout and clearTimeout functions from Timer.sys.mjs

Pushed by enordin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/648bae25f186 Fix setTimeout and clearTimeout imports in translations-engine r=nika
Status: NEW → RESOLVED
Closed: 12 days ago
Resolution: --- → FIXED
Target Milestone: --- → 137 Branch
Flags: needinfo?(enordin)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: