You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Joe Bowser (JIRA)" <ji...@apache.org> on 2015/12/03 22:37:11 UTC

[jira] [Commented] (CB-10127) Internal XMLHttpRequest Error calling rest API from Android release build

    [ https://issues.apache.org/jira/browse/CB-10127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15038641#comment-15038641 ] 

Joe Bowser commented on CB-10127:
---------------------------------

Can we see a logcat for this error? This sounds more like a browser error than something we can do.  When we block XHRs with the whitelist, we return a blank document, not errors.

> Internal XMLHttpRequest Error calling rest API from Android release build
> -------------------------------------------------------------------------
>
>                 Key: CB-10127
>                 URL: https://issues.apache.org/jira/browse/CB-10127
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android, CordovaJS
>         Environment: Node JS, cordova whitelist plugin, android release build, hybrid app
>            Reporter: alastair
>
> I have an android build that works well in debug builds, but, gives me 'Internal XMLHttpRequest Error' when I run it using an Android release build (I'm using console.log through an NPM module along with adb logcat to monitor the logs).
> Here's the set up that I have:
> * single page hybrid app with following in index.html
> {noformat}
> <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">
> {noformat}
> * cordova whitelist plugin being used. Following settings in config.xml
> {noformat}
> <plugin name="cordova-plugin-whitelist" spec="^1.1.0" />
> <access origin="*" />
> {noformat}
> The app uses crosswalk to render content - it's a node JS, react app.
> On startup, the app hits a CGI hosted on an HTTP server to get JSON data - this works well in debug and in release mode.
> The app then hits REST APIs on HTTPS - this works well in debug but fails in release builds with the 'Internal XMLHttpRequest Error'. 
> The REST API call does not make it out of the phone and never hits the server, so, I assume that the problem is security related on the handset. I have tried all sorts of combinations of settings in my config.xml and in my index.html to loosen security/CSP and still see the problem with the 'relaxed' settings I have pasted in the ticket.
> Plugins that I am using:
> {noformat}
>     <plugin name="cordova-plugin-device" spec="^1.0.0" />
>     <plugin name="cordova-plugin-splashscreen" spec="^2.0.0" />
>     <plugin name="cordova-plugin-statusbar" spec="^1.0.0" />
>     <plugin name="cordova-plugin-whitelist" spec="^1.1.0" />
>     <plugin name="cordova-sqlite-storage" spec="^0.7.13" />
>     <plugin name="cordova-plugin-x-toast" spec="~2.2.1" />
>     <plugin name="cordova-plugin-x-socialsharing" spec="~5.0.5" />
>     <plugin name="phonegap-plugin-push" spec="^1.4.0" />
>     <plugin name="cordova-plugin-console" spec="^1.0.1" />
>     <plugin name="cordova-plugin-dialogs" spec="~1.1.1" />
>     <plugin name="cordova-plugin-app-version" spec="~0.1.7" />
> {noformat}
> Here's the generated config from the Android res/xmml directory:
> {noformat}
>     <preference name="loglevel" value="DEBUG" />
>     <feature name="PushPlugin">
>         <param name="android-package" value="com.plugin.gcm.PushPlugin" />
>     </feature>
>     <preference name="webView" value="org.crosswalk.engine.XWalkWebViewEngine" />
>     <preference default="15+" name="xwalkVersion" />
>     <preference default="--disable-pull-to-refresh-effect" name="xwalkCommandLine" />
>     <preference default="embedded" name="xwalkMode" />
>     <preference default="true" name="xwalkMultipleApk" />
>     <feature name="Device">
>         <param name="android-package" value="org.apache.cordova.device.Device" />
>     </feature>
>     <feature name="Notification">
>         <param name="android-package" value="org.apache.cordova.dialogs.Notification" />
>     </feature>
>     <feature name="SplashScreen">
>         <param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen" />
>         <param name="onload" value="true" />
>     </feature>
>     <feature name="StatusBar">
>         <param name="android-package" value="org.apache.cordova.statusbar.StatusBar" />
>         <param name="onload" value="true" />
>     </feature>
>     <feature name="Whitelist">
>         <param name="android-package" value="org.apache.cordova.whitelist.WhitelistPlugin" />
>         <param name="onload" value="true" />
>     </feature>
>     <feature name="SocialSharing">
>         <param name="android-package" value="nl.xservices.plugins.SocialSharing" />
>     </feature>
>     <feature name="Toast">
>         <param name="android-package" value="nl.xservices.plugins.Toast" />
>     </feature>
>     <feature name="SQLitePlugin">
>         <param name="android-package" value="io.liteglue.SQLitePlugin" />
>     </feature>
>     <feature name="PushNotification">
>         <param name="android-package" value="com.adobe.phonegap.push.PushPlugin" />
>     </feature>
>     <feature name="AppVersion">
>         <param name="android-package" value="uk.co.whiteoctober.cordova.AppVersion" />
>     </feature>
> <....snip....removed app specific details...>
>     <content src="index.html" />
>     <preference name="DisallowOverscroll" value="true" />
>     <preference name="SplashScreen" value="screen" />
>     <preference name="SplashScreenDelay" value="10000" />
>     <preference name="AutoHideSplashScreen" value="false" />
>     <preference name="Orientation" value="portrait" />
>     <preference name="xwalkVersion" value="15+" />
>     <preference name="xwalkCommandLine" value="--disable-pull-to-refresh-effect" />
>     <preference name="xwalkMode" value="embedded" />
>     <preference name="xwalkMultipleApk" value="true" />
>     <access origin="*" />
>     <allow-intent href="tel:*" />
>     <allow-intent href="geo:*" />
> {noformat}
> Has anybody had the same problem or can anybody suggest a workaround/fix?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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