You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/08/12 00:22:13 UTC

[GitHub] [cordova-plugin-whitelist] nomaam opened a new issue #47: XMLHttpRequest No Longer Working

nomaam opened a new issue #47: XMLHttpRequest No Longer Working
URL: https://github.com/apache/cordova-plugin-whitelist/issues/47
 
 
   ## Problem
   All XMLHttpRequest's are denied immediately
   
   # Bug Report
   App worked great until I updated Android SDK and Cordova, removed Android platform and added it back for a fresh build. All XMLHttpRequest's are denied immediately. Can't even get to the onload event to get an error code. 
   
   I have removed and added all plugins again to ensure newest versions. 
   
   config.xml
   <allow-navigation href="*" />
   <access origin="*" />
   <allow-intent href="*" />
   
   Index.html
   <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">
   
   Also tried a dozen different Content-Security-Policy's trying to open it up as much as possible, no luck. 
   
   ### What is expected to happen?
   
   XMLHttpRequest should be permitted to execute. At least return a proper error code if there is actually a problem. 
   
   ### What does actually happen?
   
   Returns no error code, just fails. 
   
   ## Information
   <!-- Include all relevant information that might help understand and reproduce the problem -->
   
   https://stackoverflow.com/questions/57453789/cordova-android-update-broke-xmlhttprequest-downloads
   
   ### Command or Code
   <!-- What command or code is needed to reproduce the problem? -->
   
   https://stackoverflow.com/questions/57453789/cordova-android-update-broke-xmlhttprequest-downloads
   
   var dlUrl = "http://myserver.com/" + fileName;
   var fileSystem = cordova.file.externalApplicationStorageDirectory;
   
   window.resolveLocalFileSystemURL(fileSystem, function (dir) {
   dir.getFile(fileName, {create: true}, function (file) {
   
   var oReq = new XMLHttpRequest();
   oReq.addEventListener("load", transferCompleteDb);
   oReq.responseType = "blob";
   oReq.open("GET", dlUrl, true);
   oReq.onload = function (oEvent) {
   var blob = oReq.response; 
   
   if (oReq.status == '523' || oReq.status == '404') {
      //...
   } else {
   if (blob) {
       var writeToFile = saveFile(file, blob);
   } else {
   //...            
   } } };
   
   oReq.onloadend = function () {
      //...
   };
   
   oReq.onerror = function (e) {
   
   alert('xml error. status [' + e.target.status + '] [' + oReq.status );
   //***
   //*** This is where it fails. The error code is just 0, no other info  
   //     The request isn't even getting a chance to get a response
   //      Cordova is blocking it in some setting              
   };
   
   
   ### Environment, Platform, Device
   <!-- In what environment, on what platform or on which device are you experiencing the issue? -->
   Windows, Gradle, Android, Physical device S9+
   
   ### Version information
   
   Newest version as of 2019-08-11
   
   <!-- 
   What are relevant versions you are using?
   For example:
   Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins 
   Other Frameworks: Ionic Framework and CLI version
   Operating System, Android Studio, Xcode etc.
   -->
   
   
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [x ] I searched for existing GitHub issues
   - [ x] I updated all Cordova tooling to most recent version
   - [ x] I included all the necessary information above
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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