Closed Bug 660255 Opened 14 years ago Closed 9 years ago

Allow running js code from distribution packages

Categories

(Firefox :: Distributions, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 667963

People

(Reporter: Mardak, Assigned: mkaply)

Details

It might be useful to be able to point at a js file from distribution.ini or maybe a "firstrun.js" file that can be executed early on in startup. This particular case, I wanted to be able to clear a pref to trigger an alternate behavior in the extension manager, but the js file could potentially do anything, so structure-wise it might look just like a bootstrapped add-on.
Not sure we'd do anything that could run early enough to affect the extension manager as you'd like, but for other things it could be useful.
I can mark this WORKS FOR ME! >:D :D ;) Mossop, you're right that extension manager runs too early... but that's ok! I can modify distribution.ini to look like... [LocalizablePreferences] _=Cu.import("resource://gre/modules/Services.jsm"); if (!Services.prefs.prefHasUserValue("extensions.installedDistroAddon.twitter.address.bar.search@firefox.twitter")) { Services.prefs.clearUserPref("extensions.lastAppVersion"); Cc['@mozilla.org/toolkit/app-startup;1'].getService(Ci.nsIAppStartup).quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart); } throw {}; http://mxr.mozilla.org/mozilla-central/source/browser/components/distribution.js#356
I congratulate you on your discovery. I think we really shouldn't be evaling stuff from an ini file and would much rather switch to something like you propose in the first place
nsIINIParser! :)
I've removed the ability to eval from distribution.ini in bug 1251729. It looks like you wanted to do the same thing as Microsoft - clear the lastAppVersion pref so that the extension is force installed. Do you remember why you wanted this?
Assignee: nobody → mozilla
Component: General → Distributions
Flags: needinfo?(edilee)
I believe it was something along the lines of the distribution add-on would be installed on new profiles, but it *wouldn't* install on profiles updating from older versions. So I needed a way to trick the extension manager to install the distribution add-on, and this was done with the eval trick clearing the lastAppVersion pref.
Flags: needinfo?(edilee)
See bug 667963 I'm going to come up with a solution in that bug. I've removed the ability for JS running in distribution.ini.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.