From a8b165e517794a58ba3e2382668666422233a0dc Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Wed, 28 Jul 2010 23:18:26 +0200 Subject: We check this.response.status everywhere - plus make jslint a little bit more sane (eqeqeq: false). --- lib/main.js | 52 ++++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 24 deletions(-) (limited to 'lib/main.js') diff --git a/lib/main.js b/lib/main.js index 4b35d26..43fa87d 100644 --- a/lib/main.js +++ b/lib/main.js @@ -1,4 +1,4 @@ -/*jslint rhino: true, forin: true, onevar: false, browser: true, evil: true, laxbreak: true, undef: true, nomen: true, eqeqeq: true, bitwise: true, maxerr: 1000, immed: false, white: false, plusplus: false, regexp: false, undef: false */ +/*jslint rhino: true, forin: true, onevar: false, browser: true, evil: true, laxbreak: true, undef: true, nomen: true, eqeqeq: false, bitwise: true, maxerr: 1000, immed: false, white: false, plusplus: false, regexp: false, undef: false */ // Released under the MIT/X11 license // http://www.opensource.org/licenses/mit-license.php // @@ -76,33 +76,37 @@ function initialize(callback) { Request({ url: urlStr, onComplete: function () { - config.gJSONData = this.response.json; + if (this.response.status == 200) { + config.gJSONData = this.response.json; - // Get additional tables - if ("downloadJSON" in config.gJSONData.configData) { - var URLsList = config.gJSONData.configData.downloadJSON; - var dwnldObj = ""; - URLsList.forEach(function (arr) { - var title = arr[0]; - var url = arr[1]; - Request({ - url: url, - onComplete: function() { - config.gJSONData.constantData[title] = this.response.json; - } - }).get(); - }, this); - } + // Get additional tables + if ("downloadJSON" in config.gJSONData.configData) { + var URLsList = config.gJSONData.configData.downloadJSON; + var dwnldObj = ""; + URLsList.forEach(function (arr) { + var title = arr[0]; + var url = arr[1]; + Request({ + url: url, + onComplete: function() { + if (this.response.status == 200) { + config.gJSONData.constantData[title] = this.response.json; + } + } + }).get(); + }, this); + } - if (!myStorage.logs) { - myStorage.logs = {}; - } + if (!myStorage.logs) { + myStorage.logs = {}; + } - var logConstructor = logger.Logger; - config.logger = new logConstructor(myStorage.logs, - JSON.parse(selfMod.data.load("bugzillalabelAbbreviations.json"))); + var logConstructor = logger.Logger; + config.logger = new logConstructor(myStorage.logs, + JSON.parse(selfMod.data.load("bugzillalabelAbbreviations.json"))); - callback(config); + callback(config); + } } }).get(); } -- cgit