FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

iOS WebView silently ignores hostname lookup failures · Issue #6987 · NativeScript/NativeScript · GitHub

iOS WebView silently ignores hostname lookup failures #6987

Description

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL