Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Problem/Bug]: conflict between existing script and webview #4227

Open
vovanb opened this issue Dec 11, 2023 · 0 comments
Open

[Problem/Bug]: conflict between existing script and webview #4227

vovanb opened this issue Dec 11, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@vovanb
Copy link

vovanb commented Dec 11, 2023

What happened?

I am using .Net core winforms with webview2. When I call CoreWebView2.PostWebMessageAsString , I got error :

VM7:1  Uncaught TypeError: Failed to execute 'dispatchEvent' on 'EventTarget': parameter 1 is not of type 'Event'.
    at EmbeddedBrowserWebView.<anonymous> (<anonymous>:1:40673)

in below code, which is coming from webview2 implementation:

                embeddedBrowserWebView.addEventListener("message", native_event=>{
                if (logNativeEvent)
                    console.log("native event:", native_event);
                let eventArg = new Event("message");
                Object.defineProperty(eventArg, 'data', {
                    value: JSON.parse(native_event.data)
                });
                Object.defineProperty(eventArg, 'source', {
                    value: webview
                });
                webview.dispatchEvent(eventArg);

So I think object Event is conflicting with one of own classes, which is not possible to change. What is possible to do? Is it possible to modify webview2 JS to use another name for Event class?

Importance

Blocking. My app's basic functions are not working due to this issue.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

No response

SDK Version

No response

Framework

Winforms

Operating System

Windows 10

OS Version

No response

Repro steps

create winform application using our client

Repros in Edge Browser

No

Regression

No, this never worked

Last working version (if regression)

No response

@vovanb vovanb added the bug Something isn't working label Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants