Notalib / nativescript-webview-ext

Nativescript plugin with extended WebView functionality
Apache License 2.0
76 stars 37 forks source link

(iOS) issues after webViewDidFailProvisionalNavigationWithError #85

Closed two-bridges closed 4 years ago

two-bridges commented 4 years ago

Occasionally, I'm seeing memory issues on iPad due to a URL being offline (b/c web server is down).

This causes the iOS error: webViewDidFailProvisionalNavigationWithError

This error then causes an unhandled Promise rejections.

Avoid unhandled rejection

Can you please consider handling the promise rejection from _onLoadFinished, to avoid the ensuing console dump

I guess it should be caught here: https://github.com/Notalib/nativescript-webview-ext/blob/e6c3e59c7c81fd52611a815aafa6196b76b0beac/src/webview-ext.ios.ts#L678

The unhandled rejection dumps a lot of data

The reference args.object causes a huge memory dump to occur into the console (25MB+).

For safety, can you please consider excluding object from args before passing calling Promise.reject(args):

511: delete args.object;
512: Promise.reject(args);

https://github.com/Notalib/nativescript-webview-ext/blob/e6c3e59c7c81fd52611a815aafa6196b76b0beac/src/webview-ext-common.ts#L500-L514

m-abs commented 4 years ago

Thank you for reporting this. The promise rejection will no longer be unhandled.

I don't think it is a good idea to delete the object-property, but this shouldn't be a problem when the rejection is handled.

I hope to publish a new version later today.

two-bridges commented 4 years ago

legend, thanks 👍

m-abs commented 4 years ago

Should be fixed in v6.5.4.