Closed Bug 862785 Opened 11 years ago Closed 11 years ago

[system updates] no error message is shown when the update.xml url leads to a 404 error

Categories

(Firefox OS Graveyard :: Gaia::Settings, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(blocking-b2g:-, b2g18+ fixed)

RESOLVED FIXED
blocking-b2g -
Tracking Status
b2g18 + fixed

People

(Reporter: julienw, Assigned: rik)

References

Details

(Whiteboard: u=fx-os-user c=may-6-17 p=1)

Attachments

(1 file)

STR:
* have an update URL that is wrong
* check for updates from Settings > Device Information

Expected:
* the system update fails, we should have a message stating that

Actual:
* no message is displayed but the line that should display the message is still there

Bug 816306 introduced that feature. I feel sad because I reviewed it.

So here is the actual code that fails :

  systemStatus.textContent = _(value, null, _('check-error'));

The 3rd argument is the fallback argument, but the problem is that the l10n library does not handle this fallback argument correctly if it's a simple string.

In Bug 816306 I suggested to use this line instead :

  systemStatus.textContent = _(value) || _('check-error');

However we must first check that the l10n library is returning a falsy value when the key is not found.

So there are basically 2 simple paths here :
* either fix the fallback argument
* or don't use the fallback argument and make the l10n library return a falsy value when the key is not found

Talking with kaze, we'd prefer the second path, but this is more risky if this bug is tef+ (which I'm asking). The first path is less risky because we could fix it in a "backward compatible" way if necessary (ie: if any other app use this argument too).
Tracking but not blocking, given the fact that this won't change user behavior when they run into a 404 update. Please nominate for approval once this is resolved.
blocking-b2g: tef? → -
tracking-b2g18: --- → +
Assignee: nobody → anthony
Whiteboard: u=fx-os-user c=may-6-17 p=0
Whiteboard: u=fx-os-user c=may-6-17 p=0 → u=fx-os-user c=may-6-17 p=1
(In reply to Julien Wajsberg [:julienw] (PTO until Monday 13th May) from comment #0)
> Talking with kaze, we'd prefer the second path

I confirm. In retrospect, I realized this optional « fallbackString » parameter in webL10n.get() is a huge mistake, and I’d like to get rid of it.
So l10n.js does return an empty string but when looking at the code I'm not sure that was intended. Anyway, that means we can just do |systemStatus.textContent = _(value) || _('check-error');|
Comment on attachment 748027 [details]
Pointer to Github pull request: https://github.com/mozilla-b2g/gaia/pull/9684

To test, you can put this in build/custom-prefs.js
pref("app.update.url", "http://update.boot2gecko.org/nightly/update_with_404_test.xml");

and then
|rm -rf profile|
|make reset-gaia|
Attachment #748027 - Flags: review?(kaze)
I'd love a test for the l10n library that somehow checks that getting an unknown l10n key will yield a falsy value. I'd rather have |null| but |''| works for me too. I'm only afraid that, as you said, returning |''| was not really intended, and then might be "fixed" at one point.
also, webl10n's fallback capacity is badly implemented, so if we don't fix it here I'd like another bug to get rid of it.
I've updated the pull request with a test! It was a lot of trial/error, but it works. That means we'll now be able to test the L10n lib.
\o/
Comment on attachment 748027 [details]
Pointer to Github pull request: https://github.com/mozilla-b2g/gaia/pull/9684

Nice, thanks!
Attachment #748027 - Flags: review?(kaze) → review+
merged on master:
https://github.com/mozilla-b2g/gaia/commit/30683cf76e43c3f85681f568d489d4f8d45380ce
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
I've opened bug 872527 for the followup to clean up l10n.js.
And a followup commit because I broke the linter tests :( I thought I ran |make lint| before submitting that patch.

https://github.com/mozilla-b2g/gaia/commit/b81008e15aef5060930430b41816044197e8b47b
v1-train: c2852a0
v1-train: c845ccb
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: