Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: bootstrap.js.tmpl

Issue 29337900: Issue 2850 - Get rid of synchronous XMLHttpRequest on startup, embed JSON files directly instead (Closed)
Patch Set: Created March 7, 2016, 12:26 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/prefs.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
{
« no previous file with comments | « no previous file | lib/prefs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld