[jbosstools-issues] [JBoss JIRA] (JBIDE-14453) CordovaSim: add support of 2.7.0
Ilya Buziuk (JIRA)
jira-events at lists.jboss.org
Wed May 15 10:11:06 EDT 2013
[ https://issues.jboss.org/browse/JBIDE-14453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12774487#comment-12774487 ]
Ilya Buziuk edited comment on JBIDE-14453 at 5/15/13 10:10 AM:
---------------------------------------------------------------
In cordova 2.6.0 loading of cordova_plugins.json was implemented the following way, and there were no problems for CordovaSim:
{code}
try { // we commented we were going to try, so let us actually try and catch
var xhr = new context.XMLHttpRequest();
xhr.onreadystatechange = function() {
if (this.readyState != 4) { // not DONE
return;
}
// If the response is a JSON string which composes an array, call handlePluginsObject.
// If the request fails, or the response is not a JSON array, just call finishPluginLoading.
if (this.status == 200) {
var obj = JSON.parse(this.responseText);
if (obj && obj instanceof Array && obj.length > 0) {
handlePluginsObject(obj);
} else {
finishPluginLoading();
}
} else {
finishPluginLoading();
}
};
xhr.open('GET', 'cordova_plugins.json', true); // Async
xhr.send();
}
catch(err) {
finishPluginLoading();
}
}(window));
{code}
However in cordova-2.7.0 the code was changed, and CordovaSim stopped working correctly ( https://issues.apache.org/jira/browse/CB-3379 ):
{code}
try { // we commented we were going to try, so let us actually try and catch
var xhr = new context.XMLHttpRequest();
xhr.onload = function() {
// If the response is a JSON string which composes an array, call handlePluginsObject.
// If the request fails, or the response is not a JSON array, just call finishPluginLoading.
var obj = this.responseText && JSON.parse(this.responseText);
if (obj && obj instanceof Array && obj.length > 0) {
handlePluginsObject(obj);
} else {
finishPluginLoading();
}
};
xhr.onerror = function() {
finishPluginLoading();
};
xhr.open('GET', 'cordova_plugins.json', true); // Async
xhr.send();
}
catch(err){
finishPluginLoading();
}
}(window));
{code}
Fortunately, cordova team has already fixed that issue - https://git-wip-us.apache.org/repos/asf?p=cordova-js.git;a=commit;h=26796d79e42d12c4cce3536e192fbc79404fc71d, and everything will be fine in the next release of cordova)
was (Author: ibuziuk):
In cordova 2.6.0 loading of cordova_plugins.json was implemented the following way, and there were no problems for CordovaSim:
{code}
try { // we commented we were going to try, so let us actually try and catch
var xhr = new context.XMLHttpRequest();
xhr.onreadystatechange = function() {
if (this.readyState != 4) { // not DONE
return;
}
// If the response is a JSON string which composes an array, call handlePluginsObject.
// If the request fails, or the response is not a JSON array, just call finishPluginLoading.
if (this.status == 200) {
var obj = JSON.parse(this.responseText);
if (obj && obj instanceof Array && obj.length > 0) {
handlePluginsObject(obj);
} else {
finishPluginLoading();
}
} else {
finishPluginLoading();
}
};
xhr.open('GET', 'cordova_plugins.json', true); // Async
xhr.send();
}
catch(err) {
finishPluginLoading();
}
}(window));
{code}
However in cordova-2.7.0 the code was changed, and CordovaSim stopped working correctly (https://issues.apache.org/jira/browse/CB-3379):
{code}
try { // we commented we were going to try, so let us actually try and catch
var xhr = new context.XMLHttpRequest();
xhr.onload = function() {
// If the response is a JSON string which composes an array, call handlePluginsObject.
// If the request fails, or the response is not a JSON array, just call finishPluginLoading.
var obj = this.responseText && JSON.parse(this.responseText);
if (obj && obj instanceof Array && obj.length > 0) {
handlePluginsObject(obj);
} else {
finishPluginLoading();
}
};
xhr.onerror = function() {
finishPluginLoading();
};
xhr.open('GET', 'cordova_plugins.json', true); // Async
xhr.send();
}
catch(err){
finishPluginLoading();
}
}(window));
{code}
Fortunately, cordova team has already fixed that issue - https://git-wip-us.apache.org/repos/asf?p=cordova-js.git;a=commit;h=26796d79e42d12c4cce3536e192fbc79404fc71d, and everything will be fine in the next release of cordova)
> CordovaSim: add support of 2.7.0
> --------------------------------
>
> Key: JBIDE-14453
> URL: https://issues.jboss.org/browse/JBIDE-14453
> Project: Tools (JBoss Tools)
> Issue Type: Feature Request
> Components: browsersim
> Affects Versions: 4.1.0.Alpha2
> Reporter: Yahor Radtsevich
> Assignee: Ilya Buziuk
>
> The latest supported version of cordova.js is 2.6.
> We need to add support for 2.7, which is came out April 30th 2013.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jbosstools-issues
mailing list