diff --git a/android17.d.ts b/android17.d.ts index 381438b68..66224c830 100644 --- a/android17.d.ts +++ b/android17.d.ts @@ -151344,7 +151344,8 @@ declare module android { * @param description A String describing the error. * @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. * @param view The WebView that is initiating the callback. diff --git a/ui/web-view/web-view.android.ts b/ui/web-view/web-view.android.ts index d6033f32e..6587c4d75 100644 --- a/ui/web-view/web-view.android.ts +++ b/ui/web-view/web-view.android.ts @@ -37,13 +37,33 @@ class WebViewClientClass extends android.webkit.WebViewClient { } } - public onReceivedError(view: android.webkit.WebView, errorCode: number, description: string, failingUrl: string) { - super.onReceivedError(view, errorCode, description, failingUrl); + public onReceivedError() { + var view: android.webkit.WebView = arguments[0]; - if (this._view) { - trace.write("WebViewClientClass.onReceivedError(" + errorCode + ", " + description + ", " + failingUrl + ")", trace.categories.Debug); - this._view._onLoadFinished(failingUrl, description + "(" + errorCode + ")"); - } + 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); + + if (this._view) { + trace.write("WebViewClientClass.onReceivedError(" + errorCode + ", " + description + ", " + failingUrl + ")", trace.categories.Debug); + 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() + ")"); + } + } } };