Closed Bug 1174234 Opened 7 years ago Closed 6 years ago

Mulet probably reads prefs in the wrong order

Categories

(Core :: Preferences: Backend, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: kats, Unassigned)

References

Details

The app.mozbuild file for mulet puts b2g/dev/app into the DIRS variable before the browser dir, which means the JS_PREFERENCE_FILES at [1] probably gets added first, followed by [2]. Most probably (haven't confirmed) this means that prefs from firefox.js will override the prefs from b2g.js and mulet.js which is kind of bad. One would expect mulet.js to override all other prefs files when building mulet. Somebody should confirm and fix if necessary.

[1] https://mxr.mozilla.org/mozilla-central/source/b2g/dev/app/moz.build?rev=38764a9bae60#8
[2] https://mxr.mozilla.org/mozilla-central/source/browser/app/moz.build?rev=5d8c22617d0d#14
So, I now think the build files don't matter too much...  the build system just copies each file to defaults/pref.  The load order is the more interesting part, as Fabrice suggested on IRC.

Today's mind bending Gecko code of the day:

"Load default pref files from a directory. The files in the directory are sorted reverse-alphabetically"[1]

So, this suggests the files are processed as:

* mulet.js
* firefox.js
* b2g.js

[1]: https://dxr.allizom.org/mozilla-central/source/modules/libpref/Preferences.cpp#1056
This is something that was dealt with in bug 1053185. Did it regressed?
Well I think mulet.js was added after bug 1053185. So the b2g.js might still take precedence over firefox.js, but mulet.js, which should beat them both, doesn't (which I still haven't actually confirmed, btw).
Maksim confirmed in bug 1166347 that firefox.js ends up overriding mulet.js for Mulet, which is a bad footgun. Moving this bug to Core::Preferences since it seems like we should allow specifying order in the API somehow.
Component: General → Preferences: Backend
Product: Firefox OS → Core
Hi Fabrice, do you have any ideas if we still need it for Connected Devices? Thanks!
Flags: needinfo?(fabrice)
(In reply to Hsin-Yi Tsai [:hsinyi] from comment #5)
> Hi Fabrice, do you have any ideas if we still need it for Connected Devices?
> Thanks!

Hi Hsin-Yi!
We still use Mulet for B2G OS, but as far as I know we have no issues with preferences.
Flags: needinfo?(fabrice)
Thanks Fabrice for the comment. I'll close is as WORKSFORME for now, but do feel free to reopen it if you see any issues.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.