Index: bootstrap.js.tmpl |
=================================================================== |
--- a/bootstrap.js.tmpl |
+++ b/bootstrap.js.tmpl |
@@ -78,17 +78,17 @@ function shutdown(params, reason) |
require.scopes = null; |
addonData = null; |
} |
function install(params, reason) {} |
function uninstall(params, reason) |
{ |
- {%- if hasVersionPref %} |
+ {%- if 'currentVersion' in jsonRequires.get('prefs.json', {}).get('defaults', {}) %} |
const ADDON_UNINSTALL = 6; // https://developer.mozilla.org/en/Extensions/Bootstrapped_extensions#Reason_constants |
if (reason == ADDON_UNINSTALL) |
{ |
// Users often uninstall/reinstall extension to "fix" issues. Clear current |
// version number on uninstall to rerun first-run actions in this scenario. |
Services.prefs.clearUserPref("extensions.{{metadata.get('general', 'basename')}}.currentVersion"); |
} |
{%- endif %} |
@@ -168,16 +168,19 @@ function require(module) |
Services.scriptloader.loadSubScript(url, scopes[module]); |
{%- if 'info' in requires %} |
} |
{%- endif %} |
} |
return scopes[module].exports; |
} |
require.scopes = Object.create(null); |
+{%- for name, data in jsonRequires.iteritems() %} |
+require.scopes[{{name|json}}] = {exports: {{data|json}}}; |
+{%- endfor %} |
{%- if hasChromeRequires %} |
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); |
let RequireObserver = |
{ |
observe: function(subject, topic, data) |
{ |