You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2015/02/05 15:37:11 UTC
cordova-plugin-test-framework git commit: CB-8385 Ensure
plugin-test-framework trigger tests only once
Repository: cordova-plugin-test-framework
Updated Branches:
refs/heads/master 8538cad07 -> f11ea3a65
CB-8385 Ensure plugin-test-framework trigger tests only once
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/commit/f11ea3a6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/tree/f11ea3a6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/diff/f11ea3a6
Branch: refs/heads/master
Commit: f11ea3a6502429a91273271611839a23f977f768
Parents: 8538cad
Author: sgrebnov <v-...@microsoft.com>
Authored: Wed Feb 4 13:04:09 2015 +0300
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Thu Feb 5 17:36:50 2015 +0300
----------------------------------------------------------------------
www/medic.js | 40 +++++++++++++++++++---------------------
1 file changed, 19 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/blob/f11ea3a6/www/medic.js
----------------------------------------------------------------------
diff --git a/www/medic.js b/www/medic.js
index f94365c..740ad84 100644
--- a/www/medic.js
+++ b/www/medic.js
@@ -35,30 +35,28 @@ exports.log = function() {
};
exports.load = function (callback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", "../medic.json", true);
- xhr.onload = function() {
- if (xhr.readyState == 4 && (xhr.status == 0 || xhr.status == 200)) {
- var cfg = JSON.parse(xhr.responseText);
- exports.logurl = cfg.couchdb || cfg.logurl;
- exports.enabled = true;
- exports.sha = cfg.sha;
- console.log('Loaded Medic Config: logurl=' + exports.logurl);
- }
- callback();
- }
- xhr.onerror = function() {
- callback();
- }
+ var cfg = null;
try {
+ // attempt to synchronously load medic config
+ var xhr = new XMLHttpRequest();
+ xhr.open("GET", "../medic.json", false);
xhr.send(null);
- }
- catch(ex) {
- // some platforms throw on a file not found
+ cfg = JSON.parse(xhr.responseText);
+ } catch (ex) { }
+
+ // config is available
+ if (cfg) {
+ exports.logurl = cfg.couchdb || cfg.logurl;
+ exports.sha = cfg.sha;
+ exports.enabled = true;
+ console.log('Loaded Medic Config: logurl=' + exports.logurl);
+ } else {
+ // config does not exist
console.log('Did not find medic config file');
- setTimeout(function(){
- callback();
- },0);
}
+
+ setTimeout(function () {
+ callback();
+ }, 0);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org