BruceHill
BruceHill

Reputation: 7164

WebView throws “Unknown chromium error: 0”

I have an application that is based on Cordova 3.5.0 which we are now upgrading to version 5.2.0. I am encountering the following exception when trying to load the html/javascript sources from a remote server:

Unknown chromium error: 0

From what I have read I understand that this is caused by location being loaded into the webview not being in the Cordova whitelist. This question for example pertains to this error message, but the answers given are from the perspective of how to configure Cordova. What I am wanting to know is where in the java source this functionality is implemented. So I am looking specifically for an answer from the perspective of the Java source, not from the perspective of Cordova. (ie. saying "add this to your config.xml" is not the answer I am looking for).

This error message is a particularly unhelpful one and it would be useful to know what configuration of the Android Webview causes this and how it this restriction can be removed.

Upvotes: 1

Views: 1028

Answers (1)

lifeisfoo
lifeisfoo

Reputation: 16294

I think that you should look at these files:

This is a piece of code from the method shouldInterceptRequest from the SystemWebViewClient class:

        // Check the against the whitelist and lock out access to the WebView directory
        // Changing this will cause problems for your application
        if (!parentEngine.pluginManager.shouldAllowRequest(url)) {
            LOG.w(TAG, "URL blocked by whitelist: " + url);
            // Results in a 404.
            return new WebResourceResponse("text/plain", "UTF-8", null);
        }

Upvotes: 2

Related Questions