TiWebViewClient.java 文件源码

java
阅读 28 收藏 0 点赞 0 评论 0

项目:movento-webview 作者:
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error)
{
    /*
     * in theory this should be checked to make sure it's not null but if there is some failure 
     * in the association then usage of webViewProxy should trigger a NPE to make sure the issue 
     * is not ignored
     */
    KrollProxy webViewProxy = this.webView.getProxy();

    KrollDict data = new KrollDict();
    data.put(TiC.ERROR_PROPERTY_CODE, error.getPrimaryError());
    webView.getProxy().fireSyncEvent(TiC.EVENT_SSL_ERROR, data);

    boolean ignoreSslError = false;
    try {
        ignoreSslError = webViewProxy.getProperties().optBoolean(TiC.PROPERTY_WEBVIEW_IGNORE_SSL_ERROR, false);

    } catch(IllegalArgumentException e) {
        Log.e(TAG, TiC.PROPERTY_WEBVIEW_IGNORE_SSL_ERROR + " property does not contain a boolean value, ignoring"); 
    }

    if (ignoreSslError == true) {
        Log.w(TAG, "ran into SSL error but ignoring...");
        handler.proceed();

    } else {
        Log.e(TAG, "SSL error occurred: " + error.toString());
        handler.cancel();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号