MicrosoftEdge / MicrosoftEdge/WebView2Feedback
[Problem/Bug]: conflict between existing script and webview
@vbryh-msft is already working on this.
Since Dec 11, 2023.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.