Skip to content

Crash on Windows when WebView2 returns an unknown permission resource #2875

Description

@Zeinab-Kouhkan

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

On Windows, the application crashes when a website requests an unsupported WebView2 permission resource.

The crash occurs in PermissionRequest.fromMap with the following exception:

Null check operator used on a null value

This happens because PermissionResourceType.fromNativeValue(...) returns null for unknown permission resource IDs (e.g. resource ID 13 from https://web.whatsapp.com/), and the result is force-unwrapped.

Expected Behavior

Unknown WebView2 permission resource IDs should be handled gracefully instead of causing a crash.

If a permission resource is not recognized, it should be ignored or filtered out, allowing the WebView to continue running normally.

Steps with code example to reproduce

  1. Create an InAppWebView on Windows.

  2. Load the following URL:

InAppWebView(
  initialUrlRequest: URLRequest(
    url: WebUri(" https://web.whatsapp.com/"),
  ),
)
  1. Wait until the website requests a permission.

  2. The application crashes with:

Null check operator used on a null value

PermissionRequest.fromMap

Stacktrace/Logs

Stacktrace/Logs
[WindowsInAppWebViewController] (windows) WebView ID 1702660057664 calling "onProgressChanged" using {progress: 100}
[WindowsInAppWebViewController] (windows) WebView ID 1702660057664 calling "onLoadStop" using {url: https://web.whatsapp.com/}
Permission: [] from https://web.whatsapp.com/
[WindowsInAppWebViewController] (windows) WebView ID 1702660057664 calling "onPermissionRequest" using {origin: https://web.whatsapp.com/, resources: [13]}
[WindowsInAppWebViewController] (windows) WebView ID 1702660057664 calling "onTitleChanged" using {title: WhatsApp}
[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: ProcessException: The system cannot find the file specified (at ../../../flutter/third_party/dart/runtime/bin/process_win.cc:577)

Flutter version

3.44.0

Operating System, Device-specific and/or Tool

Windows

Plugin version

6.1.5

Additional information

No response

Self grab

  • I'm ready to work on this issue!

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

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions