[jira] [Commented] (CB-3393) plugin_loader.js and path issue

2013-05-16 Thread Andrew Grieve (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-3393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13659574#comment-13659574
 ] 

Andrew Grieve commented on CB-3393:
---

One of the things we discussed originally was to embed the JSON right in 
cordova.js. Given the number of things that have gone wrong with loading this 
file so far, I think it might warrant re-visiting this idea.

E.g., within pluginloader.js:

// PLUGINS JSON START /
stuff that gets replaced with each pluginstall.
// PLUGINS JSON END /

 plugin_loader.js and path issue
 ---

 Key: CB-3393
 URL: https://issues.apache.org/jira/browse/CB-3393
 Project: Apache Cordova
  Issue Type: Bug
  Components: CordovaJS, Plugman
Reporter: Steve Gill
Assignee: Filip Maj

 Blackberry dudes added a commit to plugin_loader.js that made the path to 
 cordova_plugins.js absolute. This broke plugin loading for ios + android. See 
 https://github.com/apache/cordova-js/commit/8d59461c6f796f2c88a0eae2467cc663897ccce9
 I reverted that commit with 
 https://github.com/apache/cordova-js/commit/757fa3c93d078fc9d1e393e671f81c6ed237bc06
 It works again on Android and iOS. Issue that arises now is that cordova.js 
 expects cordova_plugins.json to be in the same directory as it. If you have 
 cordova.js in a js directory and cordova_plugins.json exists in a directory 
 above, the plugin will not load because it won't be able to find 
 cordova_plugins.
 Can we reference cordova_plugins in a way that will work across platform?

--
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


[jira] [Commented] (CB-3393) plugin_loader.js and path issue

2013-05-16 Thread Bryan Higgins (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-3393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13659593#comment-13659593
 ] 

Bryan Higgins commented on CB-3393:
---

That would fix loading of JSON, but does nothing for the actual injection of 
script tags. Those need to be written relative to the page.

Code similar to what Jesse posted would work for that scenario, assuming 
cordova.js is in application root.

 plugin_loader.js and path issue
 ---

 Key: CB-3393
 URL: https://issues.apache.org/jira/browse/CB-3393
 Project: Apache Cordova
  Issue Type: Bug
  Components: CordovaJS, Plugman
Reporter: Steve Gill
Assignee: Filip Maj

 Blackberry dudes added a commit to plugin_loader.js that made the path to 
 cordova_plugins.js absolute. This broke plugin loading for ios + android. See 
 https://github.com/apache/cordova-js/commit/8d59461c6f796f2c88a0eae2467cc663897ccce9
 I reverted that commit with 
 https://github.com/apache/cordova-js/commit/757fa3c93d078fc9d1e393e671f81c6ed237bc06
 It works again on Android and iOS. Issue that arises now is that cordova.js 
 expects cordova_plugins.json to be in the same directory as it. If you have 
 cordova.js in a js directory and cordova_plugins.json exists in a directory 
 above, the plugin will not load because it won't be able to find 
 cordova_plugins.
 Can we reference cordova_plugins in a way that will work across platform?

--
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


[jira] [Commented] (CB-3393) plugin_loader.js and path issue

2013-05-16 Thread Andrew Grieve (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-3393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13659648#comment-13659648
 ] 

Andrew Grieve commented on CB-3393:
---

Good point!

 plugin_loader.js and path issue
 ---

 Key: CB-3393
 URL: https://issues.apache.org/jira/browse/CB-3393
 Project: Apache Cordova
  Issue Type: Bug
  Components: CordovaJS, Plugman
Reporter: Steve Gill
Assignee: Filip Maj

 Blackberry dudes added a commit to plugin_loader.js that made the path to 
 cordova_plugins.js absolute. This broke plugin loading for ios + android. See 
 https://github.com/apache/cordova-js/commit/8d59461c6f796f2c88a0eae2467cc663897ccce9
 I reverted that commit with 
 https://github.com/apache/cordova-js/commit/757fa3c93d078fc9d1e393e671f81c6ed237bc06
 It works again on Android and iOS. Issue that arises now is that cordova.js 
 expects cordova_plugins.json to be in the same directory as it. If you have 
 cordova.js in a js directory and cordova_plugins.json exists in a directory 
 above, the plugin will not load because it won't be able to find 
 cordova_plugins.
 Can we reference cordova_plugins in a way that will work across platform?

--
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


[jira] [Commented] (CB-3393) plugin_loader.js and path issue

2013-05-16 Thread Filip Maj (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-3393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13660136#comment-13660136
 ] 

Filip Maj commented on CB-3393:
---

I've got a patch based on Jesse's comment ready to go. Tested on iOS and 
Android and works well. As soon as the apache git servers are back up ill push 
it.

 plugin_loader.js and path issue
 ---

 Key: CB-3393
 URL: https://issues.apache.org/jira/browse/CB-3393
 Project: Apache Cordova
  Issue Type: Bug
  Components: CordovaJS, Plugman
Reporter: Steve Gill
Assignee: Filip Maj

 Blackberry dudes added a commit to plugin_loader.js that made the path to 
 cordova_plugins.js absolute. This broke plugin loading for ios + android. See 
 https://github.com/apache/cordova-js/commit/8d59461c6f796f2c88a0eae2467cc663897ccce9
 I reverted that commit with 
 https://github.com/apache/cordova-js/commit/757fa3c93d078fc9d1e393e671f81c6ed237bc06
 It works again on Android and iOS. Issue that arises now is that cordova.js 
 expects cordova_plugins.json to be in the same directory as it. If you have 
 cordova.js in a js directory and cordova_plugins.json exists in a directory 
 above, the plugin will not load because it won't be able to find 
 cordova_plugins.
 Can we reference cordova_plugins in a way that will work across platform?

--
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


[jira] [Commented] (CB-3393) plugin_loader.js and path issue

2013-05-15 Thread Braden Shepherdson (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-3393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13658470#comment-13658470
 ] 

Braden Shepherdson commented on CB-3393:


Ugh, this is nasty.

It isn't safe to use an absolute path, because it's possible to serve an app 
from an arbitrary http:// URL, and the app need not be served from the root of 
the host.

Since the cordova_plugins.json is at the root of the Cordova project always, no 
matter where cordova.js lives on that platform, it would be possible to tweak 
the loading code in cordova.js to search for cordova_plugins.json, 
../cordova_plugins.json, ../../cordova_plugins.json, etc., up maybe three or 
four levels.

This sucks, but it would solve the problem in the case of putting cordova.js 
into a subfolder, or having sub-apps like in mobile-spec.

 plugin_loader.js and path issue
 ---

 Key: CB-3393
 URL: https://issues.apache.org/jira/browse/CB-3393
 Project: Apache Cordova
  Issue Type: Bug
  Components: CordovaJS, Plugman
Reporter: Steve Gill
Assignee: Filip Maj

 Blackberry dudes added a commit to plugin_loader.js that made the path to 
 cordova_plugins.js absolute. This broke plugin loading for ios + android. See 
 https://github.com/apache/cordova-js/commit/8d59461c6f796f2c88a0eae2467cc663897ccce9
 I reverted that commit with 
 https://github.com/apache/cordova-js/commit/757fa3c93d078fc9d1e393e671f81c6ed237bc06
 It works again on Android and iOS. Issue that arises now is that cordova.js 
 expects cordova_plugins.json to be in the same directory as it. If you have 
 cordova.js in a js directory and cordova_plugins.json exists in a directory 
 above, the plugin will not load because it won't be able to find 
 cordova_plugins.
 Can we reference cordova_plugins in a way that will work across platform?

--
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


[jira] [Commented] (CB-3393) plugin_loader.js and path issue

2013-05-15 Thread Jesse MacFadyen (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-3393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13659036#comment-13659036
 ] 

Jesse MacFadyen commented on CB-3393:
-

Can't we just insist that cordova_plugins.json is in the same location as 
cordova.js, and all paths specified in it are relative to the location of 
cordova.js?

 plugin_loader.js and path issue
 ---

 Key: CB-3393
 URL: https://issues.apache.org/jira/browse/CB-3393
 Project: Apache Cordova
  Issue Type: Bug
  Components: CordovaJS, Plugman
Reporter: Steve Gill
Assignee: Filip Maj

 Blackberry dudes added a commit to plugin_loader.js that made the path to 
 cordova_plugins.js absolute. This broke plugin loading for ios + android. See 
 https://github.com/apache/cordova-js/commit/8d59461c6f796f2c88a0eae2467cc663897ccce9
 I reverted that commit with 
 https://github.com/apache/cordova-js/commit/757fa3c93d078fc9d1e393e671f81c6ed237bc06
 It works again on Android and iOS. Issue that arises now is that cordova.js 
 expects cordova_plugins.json to be in the same directory as it. If you have 
 cordova.js in a js directory and cordova_plugins.json exists in a directory 
 above, the plugin will not load because it won't be able to find 
 cordova_plugins.
 Can we reference cordova_plugins in a way that will work across platform?

--
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


[jira] [Commented] (CB-3393) plugin_loader.js and path issue

2013-05-15 Thread Filip Maj (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-3393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13659048#comment-13659048
 ] 

Filip Maj commented on CB-3393:
---

[~purplecabbage] the problem is that XHR resolves URLs based on the current 
HTML page, not based on the location of the JavaScript file that the XHR 
originates from.

cordova.js makes an XHR to the relative URL cordova_plugins.json. This works 
fine for an HTML page in the root of your app, but if you have subdirectories 
containing HTML files that reference cordova.js, the relative URL employed in 
cordova.js gets resolved relative to the HTML page.

 plugin_loader.js and path issue
 ---

 Key: CB-3393
 URL: https://issues.apache.org/jira/browse/CB-3393
 Project: Apache Cordova
  Issue Type: Bug
  Components: CordovaJS, Plugman
Reporter: Steve Gill
Assignee: Filip Maj

 Blackberry dudes added a commit to plugin_loader.js that made the path to 
 cordova_plugins.js absolute. This broke plugin loading for ios + android. See 
 https://github.com/apache/cordova-js/commit/8d59461c6f796f2c88a0eae2467cc663897ccce9
 I reverted that commit with 
 https://github.com/apache/cordova-js/commit/757fa3c93d078fc9d1e393e671f81c6ed237bc06
 It works again on Android and iOS. Issue that arises now is that cordova.js 
 expects cordova_plugins.json to be in the same directory as it. If you have 
 cordova.js in a js directory and cordova_plugins.json exists in a directory 
 above, the plugin will not load because it won't be able to find 
 cordova_plugins.
 Can we reference cordova_plugins in a way that will work across platform?

--
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


[jira] [Commented] (CB-3393) plugin_loader.js and path issue

2013-05-15 Thread Filip Maj (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-3393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13659061#comment-13659061
 ] 

Filip Maj commented on CB-3393:
---

I'm OK with Braden's suggesting of searching up in the directory tree some 
reasonable amount of times until the XHR returns with a status 200.

We can likely do better than this.. but that can happen later :D

 plugin_loader.js and path issue
 ---

 Key: CB-3393
 URL: https://issues.apache.org/jira/browse/CB-3393
 Project: Apache Cordova
  Issue Type: Bug
  Components: CordovaJS, Plugman
Reporter: Steve Gill
Assignee: Filip Maj

 Blackberry dudes added a commit to plugin_loader.js that made the path to 
 cordova_plugins.js absolute. This broke plugin loading for ios + android. See 
 https://github.com/apache/cordova-js/commit/8d59461c6f796f2c88a0eae2467cc663897ccce9
 I reverted that commit with 
 https://github.com/apache/cordova-js/commit/757fa3c93d078fc9d1e393e671f81c6ed237bc06
 It works again on Android and iOS. Issue that arises now is that cordova.js 
 expects cordova_plugins.json to be in the same directory as it. If you have 
 cordova.js in a js directory and cordova_plugins.json exists in a directory 
 above, the plugin will not load because it won't be able to find 
 cordova_plugins.
 Can we reference cordova_plugins in a way that will work across platform?

--
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


[jira] [Commented] (CB-3393) plugin_loader.js and path issue

2013-05-15 Thread Jesse MacFadyen (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-3393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13659063#comment-13659063
 ] 

Jesse MacFadyen commented on CB-3393:
-

Yes, but can't I glean the absolute url by using a combination of 
window.location + cordova.js script src path?

 plugin_loader.js and path issue
 ---

 Key: CB-3393
 URL: https://issues.apache.org/jira/browse/CB-3393
 Project: Apache Cordova
  Issue Type: Bug
  Components: CordovaJS, Plugman
Reporter: Steve Gill
Assignee: Filip Maj

 Blackberry dudes added a commit to plugin_loader.js that made the path to 
 cordova_plugins.js absolute. This broke plugin loading for ios + android. See 
 https://github.com/apache/cordova-js/commit/8d59461c6f796f2c88a0eae2467cc663897ccce9
 I reverted that commit with 
 https://github.com/apache/cordova-js/commit/757fa3c93d078fc9d1e393e671f81c6ed237bc06
 It works again on Android and iOS. Issue that arises now is that cordova.js 
 expects cordova_plugins.json to be in the same directory as it. If you have 
 cordova.js in a js directory and cordova_plugins.json exists in a directory 
 above, the plugin will not load because it won't be able to find 
 cordova_plugins.
 Can we reference cordova_plugins in a way that will work across platform?

--
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


[jira] [Commented] (CB-3393) plugin_loader.js and path issue

2013-05-15 Thread Filip Maj (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-3393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13659079#comment-13659079
 ] 

Filip Maj commented on CB-3393:
---

That makes sense. [~stevegill] have you tried that?

 plugin_loader.js and path issue
 ---

 Key: CB-3393
 URL: https://issues.apache.org/jira/browse/CB-3393
 Project: Apache Cordova
  Issue Type: Bug
  Components: CordovaJS, Plugman
Reporter: Steve Gill
Assignee: Filip Maj

 Blackberry dudes added a commit to plugin_loader.js that made the path to 
 cordova_plugins.js absolute. This broke plugin loading for ios + android. See 
 https://github.com/apache/cordova-js/commit/8d59461c6f796f2c88a0eae2467cc663897ccce9
 I reverted that commit with 
 https://github.com/apache/cordova-js/commit/757fa3c93d078fc9d1e393e671f81c6ed237bc06
 It works again on Android and iOS. Issue that arises now is that cordova.js 
 expects cordova_plugins.json to be in the same directory as it. If you have 
 cordova.js in a js directory and cordova_plugins.json exists in a directory 
 above, the plugin will not load because it won't be able to find 
 cordova_plugins.
 Can we reference cordova_plugins in a way that will work across platform?

--
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


[jira] [Commented] (CB-3393) plugin_loader.js and path issue

2013-05-15 Thread Jesse MacFadyen (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-3393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13659089#comment-13659089
 ] 

Jesse MacFadyen commented on CB-3393:
-

Probably more than is required to get the point across, but oh well.

{code:javascript}
function getCordovaJSBasePath() {
var scripts = document.getElementsByTagName('script');
var termLength = 'cordova.js'.length;
for(var n=scripts.length-1; n-1;n--) {
if(scripts[n].src.indexOf('cordova.js') == scripts[n].src.length - 
termLength ) {
return scripts[n].src.substring(0,scripts[n].src.length - 
termLength);
}
}
}
{code}

 plugin_loader.js and path issue
 ---

 Key: CB-3393
 URL: https://issues.apache.org/jira/browse/CB-3393
 Project: Apache Cordova
  Issue Type: Bug
  Components: CordovaJS, Plugman
Reporter: Steve Gill
Assignee: Filip Maj

 Blackberry dudes added a commit to plugin_loader.js that made the path to 
 cordova_plugins.js absolute. This broke plugin loading for ios + android. See 
 https://github.com/apache/cordova-js/commit/8d59461c6f796f2c88a0eae2467cc663897ccce9
 I reverted that commit with 
 https://github.com/apache/cordova-js/commit/757fa3c93d078fc9d1e393e671f81c6ed237bc06
 It works again on Android and iOS. Issue that arises now is that cordova.js 
 expects cordova_plugins.json to be in the same directory as it. If you have 
 cordova.js in a js directory and cordova_plugins.json exists in a directory 
 above, the plugin will not load because it won't be able to find 
 cordova_plugins.
 Can we reference cordova_plugins in a way that will work across platform?

--
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


[jira] [Commented] (CB-3393) plugin_loader.js and path issue

2013-05-15 Thread Steve Gill (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-3393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13659096#comment-13659096
 ] 

Steve Gill commented on CB-3393:


I have not tried it yet. I will look into solving this tomorrow unless Braden 
beats me too it :P

 plugin_loader.js and path issue
 ---

 Key: CB-3393
 URL: https://issues.apache.org/jira/browse/CB-3393
 Project: Apache Cordova
  Issue Type: Bug
  Components: CordovaJS, Plugman
Reporter: Steve Gill
Assignee: Filip Maj

 Blackberry dudes added a commit to plugin_loader.js that made the path to 
 cordova_plugins.js absolute. This broke plugin loading for ios + android. See 
 https://github.com/apache/cordova-js/commit/8d59461c6f796f2c88a0eae2467cc663897ccce9
 I reverted that commit with 
 https://github.com/apache/cordova-js/commit/757fa3c93d078fc9d1e393e671f81c6ed237bc06
 It works again on Android and iOS. Issue that arises now is that cordova.js 
 expects cordova_plugins.json to be in the same directory as it. If you have 
 cordova.js in a js directory and cordova_plugins.json exists in a directory 
 above, the plugin will not load because it won't be able to find 
 cordova_plugins.
 Can we reference cordova_plugins in a way that will work across platform?

--
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


[jira] [Commented] (CB-3393) plugin_loader.js and path issue

2013-05-14 Thread Steve Gill (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-3393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13657833#comment-13657833
 ] 

Steve Gill commented on CB-3393:


This issue hit me when I was using mobile spec. navigator.accelerometer was 
defined on my index.html after I installed the device motion plugin. Has no 
issue finding cordova_plugins.json. When I switched to the accelerometer tests, 
it reloads cordova.js but references it as ../cordova.js. This is fine because 
cordova.js is one directory above and the accelerometer tests are in the 
accelerometer directory. When it comes to plugin_loader.js code running, it 
can't find cordova_plugins.json. It looks for it in the accelerometer 
directory. 

Hope that makes sense

 plugin_loader.js and path issue
 ---

 Key: CB-3393
 URL: https://issues.apache.org/jira/browse/CB-3393
 Project: Apache Cordova
  Issue Type: Bug
  Components: CordovaJS, Plugman
Reporter: Steve Gill
Assignee: Filip Maj

 Blackberry dudes added a commit to plugin_loader.js that made the path to 
 cordova_plugins.js absolute. This broke plugin loading for ios + android. See 
 https://github.com/apache/cordova-js/commit/8d59461c6f796f2c88a0eae2467cc663897ccce9
 I reverted that commit with 
 https://github.com/apache/cordova-js/commit/757fa3c93d078fc9d1e393e671f81c6ed237bc06
 It works again on Android and iOS. Issue that arises now is that cordova.js 
 expects cordova_plugins.json to be in the same directory as it. If you have 
 cordova.js in a js directory and cordova_plugins.json exists in a directory 
 above, the plugin will not load because it won't be able to find 
 cordova_plugins.
 Can we reference cordova_plugins in a way that will work across platform?

--
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