Skip to content

[Problem/Bug]: FrameCreated event sometimes doesn't fire for nested iframes #5115

Open
@pushkin-

Description

What happened?

I'm seeing this issue in my app maybe 40-50% of the time, but in the WebView2 sample, I see it 100% of the time.

This might be specific to this website, but I'm seeing cases where FrameCreated isn't firing for a nested iframe.

For my general usecase, I haven't seen this problem, but since I don't know if this could start happening for the page I load in iframes, I'm marking this as Important out of caution. If we determine that this happens because of this specific site, then we can mark this Low.

Importance

Important. My app's user experience is significantly compromised.

Runtime Channel

Prerelease (Edge Canary/Dev/Beta)

Runtime Version

135.0.3146.0 canary

SDK Version

1.0.3116 pre-release

Framework

Winforms

Operating System

Windows 11

OS Version

24H2 OS Build 26100.2894

Repro steps

Setup:

  1. open the WebView2 Sample WinForms app
  2. In BrowserForm.cs, replace the body of WebView_HandleIFrames with:
var frame = args.Frame;
if (frame.Name == "myFrame")
{
    var breakHere = true;
}
frame.FrameCreated += WebView_HandleIFrames;
  1. Set a breakpoint on the breakHere variable

Repro steps:

  1. start the app and navigate to https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_iframe
  2. Replace the iframe in that page with: <iframe src="https://example.com" name="myFrame"></iframe>
  3. Notice that the breakpoint doesn't get hit

Alternatively, if you open devtools on that page and run this code: const a = document.createElement("iframe"); a.name = "myFrame"; a.src = "https://example.com"; document.body.appendChild(a);, then the breakpoint will get hit.

Like I said above, in my app, I see this roughly half the time, but can repro every time in the webview2 sample app. Maybe some kind of race condition?
Notably, this page creates a ton of iframes. Maybe this doesn't repro with a simpler page.

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

No, this never worked

Last working version (if regression)

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions