Merge pull request #992 from NativeScript/android6-webview

android 6 support
This commit is contained in:
Vladimir Enchev
2015-10-29 10:24:26 +02:00
2 changed files with 28 additions and 7 deletions

1
android17.d.ts vendored
View File

@ -151345,6 +151345,7 @@ declare module android {
* @param failingUrl The url that failed to load. * @param failingUrl The url that failed to load.
*/ */
public onReceivedError(view: android.webkit.WebView, errorCode: number, description: string, failingUrl: string): void; public onReceivedError(view: android.webkit.WebView, errorCode: number, description: string, failingUrl: string): void;
public onReceivedError(view: android.webkit.WebView, request, error): void;
/** /**
* As the host application if the browser should resend data as the requested page was a result of a POST. The default is to not resend the data. * As the host application if the browser should resend data as the requested page was a result of a POST. The default is to not resend the data.
* @param view The WebView that is initiating the callback. * @param view The WebView that is initiating the callback.

View File

@ -37,13 +37,33 @@ class WebViewClientClass extends android.webkit.WebViewClient {
} }
} }
public onReceivedError(view: android.webkit.WebView, errorCode: number, description: string, failingUrl: string) { public onReceivedError() {
var view: android.webkit.WebView = arguments[0];
if (arguments.length === 4) {
var errorCode: number = arguments[1];
var description: string = arguments[2];
var failingUrl: string = arguments[3];
super.onReceivedError(view, errorCode, description, failingUrl); super.onReceivedError(view, errorCode, description, failingUrl);
if (this._view) { if (this._view) {
trace.write("WebViewClientClass.onReceivedError(" + errorCode + ", " + description + ", " + failingUrl + ")", trace.categories.Debug); trace.write("WebViewClientClass.onReceivedError(" + errorCode + ", " + description + ", " + failingUrl + ")", trace.categories.Debug);
this._view._onLoadFinished(failingUrl, description + "(" + errorCode + ")"); this._view._onLoadFinished(failingUrl, description + "(" + errorCode + ")");
} }
} else {
var request: any = arguments[1];
var error: any = arguments[2];
super.onReceivedError(view, request, error);
if (this._view) {
trace.write("WebViewClientClass.onReceivedError(" + error.getErrorCode() + ", " + error.getDescription() + ", " + error.getUrl() + ")", trace.categories.Debug);
this._view._onLoadFinished(error.getUrl(), error.getDescription() + "(" + error.getErrorCode() + ")");
}
}
} }
}; };