cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sgrebnov <...@git.apache.org>
Subject [GitHub] cordova-plugin-test-framework pull request: CB-8385 Ensure plugin-...
Date Wed, 04 Feb 2015 08:36:02 GMT
Github user sgrebnov commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-test-framework/pull/10#discussion_r24069058
  
    --- Diff: www/medic.js ---
    @@ -35,30 +35,27 @@ 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 jsonMedic = 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
    +    jsonMedic = xhr.responseText;
    +  } catch (ex) { }
    +
    +  // config is available
    +  if (jsonMedic) {
    +    exports.logurl = JSON.parse(jsonMedic).logurl;
    --- End diff --
    
    Ops, I'll fix this shortly. Thx @nikhilkh 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Mime
View raw message