Skip to content

shouldInterceptRequest is not called on main thread (android) causing UB + race conditions #1379

@jkelleyrtp

Description

@jkelleyrtp

Describe the bug

The mechanism driving handleRequest on android has an unsafe impl Sync bound that allows it to be called from shouldInterceptRequest.

However, this is wrong, since shouldInterceptRequest is not called from the main thread:

Note: This method is called on a thread other than the UI thread so clients should exercise caution when accessing private data or the view system.

https://developer.android.com/reference/android/webkit/WebViewClient#shouldInterceptRequest(android.webkit.WebView,%20android.webkit.WebResourceRequest)

This is causing dioxus to segfault, locks to fail, RC to double-drop, etc.

This function should instead use a channel to block until the response is ready from the main thread.

It's likely there are more functions being called from not-the-main-thread.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions