MicrosoftEdge / MicrosoftEdge/WebView2Feedback
[Problem/Bug]: FrameCreated event sometimes doesn't fire for nested iframes
@krbharadwaj is already working on this.
Since Feb 19, 2025.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
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:
- open the WebView2 Sample WinForms app
- In BrowserForm.cs, replace the body of
WebView_HandleIFrameswith:
var frame = args.Frame;
if (frame.Name == "myFrame")
{
var breakHere = true;
}
frame.FrameCreated += WebView_HandleIFrames;
- Set a breakpoint on the
breakHerevariable
Repro steps:
- start the app and navigate to https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_iframe
- Replace the iframe in that page with:
<iframe src="https://example.com" name="myFrame"></iframe> - 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
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.