Open NineBerry opened 1 year ago
Another website that is affected is codepen. You can use for example this pen for testing: https://codepen.io/NineBerry/pen/rNowbLO
@NineBerry could you please check if you see Runtime.consoleAPICalled
in DevTools Protocol Monitor to isolate if it is wv2 API issue/ wv2 DevTools or those pages behave differently in CDP? Can try in wv2 DevTools and Edge one with triggered/ not triggered cases.
I can see the Runtime.consoleAPICalled
event in the Protocol Monitor for both websites in both the Standalone Edge and the C# Winforms application with the WebView2 control embedded.
So that means: For the normal webpage that uses console.log directly, I can see the event triggered in Protocol Monitor and at the same time the Runtime_ConsoleAPICalled in my app is triggered and shows the message box. For the jsfiddle, I can see the event triggered in Protocol Monitor, but the Runtime_ConsoleAPICalled in my app is not triggered and no message box is shown.
Working:
Broken: (Notice no message box)
I had cleared the Protocol Monitor before clicking "Test" button both times.
Using Runtime_ConsoleAPICalled event in an embedded WebView2 control to receive messages sent to the developer console via JavaScript console.log(), this works fine on normal web pages, but fails when the webpage uses the proxy pattern to replace window.console. Mostly online development tools like jsfiddle do that, but also some other webpages. However, the console messages are shown in the developer tools itself (opened via F12)
The same also applies to Console.messageAdded.
See below for full source code to reproduce.
Version SDK: 1.0.1938.49 Runtime: 116.0.1938.76 Framework: Winforms .net Framework, but can also reproduce in Delphi VCL TEdgeBrowser OS: Windows 11 22H2
Regression Was this working before but has regressed? no (As far as I am aware)
Repro Steps
Using the following test application in Visual Studio 2022 in an WinForms (.net Framework 4.8 project)
Form1.cs
Form1.Designer.cs
Content of file D:\Downloads\Windows\A.html (Same as the source code in the fiddle https://jsfiddle.net/mnctx9a5/ )