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

Unified Diff: lib/prefs.js

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 | « bootstrap.js.tmpl ('k') | packagerGecko.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/prefs.js
===================================================================
--- a/lib/prefs.js
+++ b/lib/prefs.js
@@ -12,23 +12,19 @@ let preconfiguredBranch =
Services.prefs.getBranch(branchName + "preconfigured.");
let ignorePrefChanges = false;
function init()
{
// Load default preferences and set up properties for them
let defaultBranch = Services.prefs.getDefaultBranch(branchName);
- let request = new XMLHttpRequest();
- request.open("GET", addonRoot + "defaults/prefs.json", false);
- request.responseType = "json";
- request.send();
-
- let defaults = request.response.defaults;
- let preconfigurable = new Set(request.response.preconfigurable);
+ let prefsData = require("prefs.json");
+ let defaults = prefsData.defaults;
+ let preconfigurable = new Set(prefsData.preconfigurable);
for (let pref in defaults)
{
let value = defaults[pref];
let [getter, setter] = typeMap[typeof value];
if (preconfigurable.has(pref))
{
try
{
« no previous file with comments | « bootstrap.js.tmpl ('k') | packagerGecko.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld