michael@0: Components.utils.import("resource://gre/modules/Services.jsm"); michael@0: michael@0: // Test steps chain from pref observers on *_reason, michael@0: // so always set that last michael@0: function install(data, reason) { michael@0: Components.utils.import(data.resourceURI.spec + "version.jsm"); michael@0: Services.prefs.setIntPref("bootstraptest.installed_version", VERSION); michael@0: Services.prefs.setIntPref("bootstraptest.install_oldversion", data.oldVersion); michael@0: Components.utils.unload(data.resourceURI.spec + "version.jsm"); michael@0: Services.prefs.setIntPref("bootstraptest.install_reason", reason); michael@0: } michael@0: michael@0: function startup(data, reason) { michael@0: Components.utils.reportError("bootstrap startup"); michael@0: Components.utils.import(data.resourceURI.spec + "version.jsm"); michael@0: Services.prefs.setIntPref("bootstraptest.active_version", VERSION); michael@0: Services.prefs.setIntPref("bootstraptest.startup_oldversion", data.oldVersion); michael@0: Components.utils.unload(data.resourceURI.spec + "version.jsm"); michael@0: Services.prefs.setIntPref("bootstraptest.startup_reason", reason); michael@0: } michael@0: michael@0: function shutdown(data, reason) { michael@0: Services.prefs.setIntPref("bootstraptest.active_version", 0); michael@0: Services.prefs.setIntPref("bootstraptest.shutdown_newversion", data.newVersion); michael@0: Services.prefs.setIntPref("bootstraptest.shutdown_reason", reason); michael@0: } michael@0: michael@0: function uninstall(data, reason) { michael@0: Services.prefs.setIntPref("bootstraptest.installed_version", 0); michael@0: Services.prefs.setIntPref("bootstraptest.uninstall_newversion", data.newVersion); michael@0: Services.prefs.setIntPref("bootstraptest.uninstall_reason", reason); michael@0: }