toolkit/mozapps/extensions/test/addons/test_bootstrap1_3/bootstrap.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/mozapps/extensions/test/addons/test_bootstrap1_3/bootstrap.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,31 @@
     1.4 +Components.utils.import("resource://gre/modules/Services.jsm");
     1.5 +
     1.6 +// Test steps chain from pref observers on *_reason,
     1.7 +// so always set that last
     1.8 +function install(data, reason) {
     1.9 +  Components.utils.import(data.resourceURI.spec + "version.jsm");
    1.10 +  Services.prefs.setIntPref("bootstraptest.installed_version", VERSION);
    1.11 +  Services.prefs.setIntPref("bootstraptest.install_oldversion", data.oldVersion);
    1.12 +  Components.utils.unload(data.resourceURI.spec + "version.jsm");
    1.13 +  Services.prefs.setIntPref("bootstraptest.install_reason", reason);
    1.14 +}
    1.15 +
    1.16 +function startup(data, reason) {
    1.17 +  Components.utils.import(data.resourceURI.spec + "version.jsm");
    1.18 +  Services.prefs.setIntPref("bootstraptest.active_version", VERSION);
    1.19 +  Services.prefs.setIntPref("bootstraptest.startup_oldversion", data.oldVersion);
    1.20 +  Components.utils.unload(data.resourceURI.spec + "version.jsm");
    1.21 +  Services.prefs.setIntPref("bootstraptest.startup_reason", reason);
    1.22 +}
    1.23 +
    1.24 +function shutdown(data, reason) {
    1.25 +  Services.prefs.setIntPref("bootstraptest.active_version", 0);
    1.26 +  Services.prefs.setIntPref("bootstraptest.shutdown_newversion", data.newVersion);
    1.27 +  Services.prefs.setIntPref("bootstraptest.shutdown_reason", reason);
    1.28 +}
    1.29 +
    1.30 +function uninstall(data, reason) {
    1.31 +  Services.prefs.setIntPref("bootstraptest.installed_version", 0);
    1.32 +  Services.prefs.setIntPref("bootstraptest.uninstall_newversion", data.newVersion);
    1.33 +  Services.prefs.setIntPref("bootstraptest.uninstall_reason", reason);
    1.34 +}

mercurial