Closed Bug 990271 Opened 10 years ago Closed 6 years ago

L10n calls before l10n context is ready

Categories

(Firefox OS Graveyard :: Gaia::System::Lockscreen, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: zbraniecki, Unassigned)

References

Details

LockScreen.refreshClock unconditionally calls L10n.get functions without waiting for l10n resources to be available.

The stack:
 
* LockScreen.refreshClock - https://github.com/mozilla-b2g/gaia/blob/master/apps/system/js/lockscreen.js#L848-L851

* Clock.start - https://github.com/mozilla-b2g/gaia/blob/master/apps/system/js/statusbar.js#L38

* LockScreen.handleEvent(screenchange) - https://github.com/mozilla-b2g/gaia/blob/master/apps/system/js/lockscreen.js#L170

* ScreenManager.fireScreenChangeEvent - https://github.com/mozilla-b2g/gaia/blob/master/apps/system/js/screen_manager.js#L575

* ScreenManager.turnScreenOn - https://github.com/mozilla-b2g/gaia/blob/master/apps/system/js/screen_manager.js#L428

* Startup - https://github.com/mozilla-b2g/gaia/blob/master/apps/system/js/bootstrap.js#L70

* window.onload

We either should block turning screen on until we have the resources available, or we delay refreshing LockScreen Clock until that.
Greg, you seem to be the last editor of this code. Can you advise on the route here or point me to someone who can?
Flags: needinfo?(gweng)
I have no clue now. One thing now I've found is that:

https://github.com/mozilla-b2g/gaia/blob/master/apps/system/js/lockscreen.js#L418

This would wait for L10n ready and then

https://github.com/mozilla-b2g/gaia/blob/master/apps/system/js/lockscreen.js#L449

Call the clock to refresh, and 

https://github.com/mozilla-b2g/gaia/blob/master/apps/system/js/lockscreen.js#L863

Get the L10n resource. So if this flow is actually followed, this situation should not happen.
Unless there is some error code which are out of this control.

However I must said I didn't modify L10n since the first refactoring (except re-arrange the code order). So I must take some time to investigate this.

Can you post some raw log or STR to help me reproduce this on my local machine?
Flags: needinfo?(gweng)
Yeah,

Just apply this patch https://pastebin.mozilla.org/4742076 and restart the phone with default locale.
The patch I'm using to make this error not appear is https://pastebin.mozilla.org/4742097 - but I think that they may be a better solution.
Blocks: 914414
I've found that the line:

https://github.com/mozilla-b2g/gaia/blob/master/apps/system/js/lockscreen.js#L170

may call refreshing the clock while the L10n is not ready. But I still need a investigation.
Any progress on that?
Flags: needinfo?(gweng)
Since I'm now resolving some tough regressions I've no change to solve this bug yet...

I can only (sincerely) guarantee I would take a look ASAP...
Flags: needinfo?(gweng)
ok. I can help you. I just need to know if we can delay the clock refresh until resources are loaded, or do you prefer to just skip the string updating in the clock_refresh function until resources are available?
Thanks. I think the later may be better.
hmm.. it seems that when I skip the localization, the function is empty. Which means that it burns CPU cycles.

I can also just start the interval when l10n resources become available.

Does it make sense to you?
Flags: needinfo?(gweng)
OK. We can discuss more detail when you done your patch. Thanks for your effort.
Flags: needinfo?(gweng)
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.