Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
- CLI: 5.2.1
- Cross-platform modules: 5.2.2
- Android Runtime: 5.2.1
- iOS Runtime: 5.2.0
- Plugin(s): none
Describe the bug
On iOS, the WebView's loadFinished event is never emitted when a DNS lookup error occurs, meaning there's no way to detect and react to this type of error.
To Reproduce
In a NativeScript Angular component, create a WebView:
<WebView src="https://some.fake.domain.example" (loadFinished)="loadFinished($event)"></WebView>
And a corresponding function in the component:
loadFinished(event: LoadEventData) {
console.log("Finished. Error:", event.error);
}
If you set src to a working URL, this outputs Finished. Error: null, but if the hostname doesn't exist, loadFinished is never called.
Expected behavior
Based on the documentation, the loadFinished event should be emitted with the error property set. (The docs mention the error might be attached to the loadStarted event, but I tested this, and it isn't set there.)
On Android this works as expected - the loadFinished event is emitted with an error set, so this seems to be an issue with the iOS implementation.
Sample project
https://play.nativescript.org/?template=play-ng&id=3z456S&v=3
Additional context
I believe I know what's causing this. The WebView delegate in tns-core-modules is missing an error handling function. I'll submit a pull request with a working fix in a few minutes.
Edit: I submitted #6988 with my proposed fix.
Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
Describe the bug
On iOS, the WebView's loadFinished event is never emitted when a DNS lookup error occurs, meaning there's no way to detect and react to this type of error.
To Reproduce
In a NativeScript Angular component, create a WebView:
And a corresponding function in the component:
loadFinished(event: LoadEventData) { console.log("Finished. Error:", event.error); }If you set src to a working URL, this outputs Finished. Error: null, but if the hostname doesn't exist, loadFinished is never called.
Expected behavior
Based on the documentation, the loadFinished event should be emitted with the error property set. (The docs mention the error might be attached to the loadStarted event, but I tested this, and it isn't set there.)
On Android this works as expected - the loadFinished event is emitted with an error set, so this seems to be an issue with the iOS implementation.
Sample project
https://play.nativescript.org/?template=play-ng&id=3z456S&v=3
Additional context
I believe I know what's causing this. The WebView delegate in tns-core-modules is missing an error handling function. I'll submit a pull request with a working fix in a few minutes.
Edit: I submitted #6988 with my proposed fix.