commit e1a20b25e5e4ff99a3c2d4e4dc8e6644ce481b67
parent 87050d5baa5982cad005ad781c6c54ec70c0a400
Author: Emilio Cobos Álvarez <emilio@crisal.io>
Date: Mon, 10 Nov 2025 22:23:28 +0000
Bug 1998438 - Don't call InitPrimaryFrame() twice for subdocuments. r=layout-reviewers,dholbert
nsSubDocumentFrame::Init calls SetPrimaryFrame relatively early, and
we're calling InitPrimaryFrame() twice because of that.
Differential Revision: https://phabricator.services.mozilla.com/D271923
Diffstat:
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h
@@ -2579,6 +2579,9 @@ class nsIFrame : public nsQueryFrame {
bool IsPrimaryFrame() const { return mIsPrimaryFrame; }
void SetIsPrimaryFrame(bool aIsPrimary) {
+ if (mIsPrimaryFrame == aIsPrimary) {
+ return;
+ }
mIsPrimaryFrame = aIsPrimary;
if (aIsPrimary) {
InitPrimaryFrame();
diff --git a/testing/web-platform/tests/css/css-anchor-position/iframe-anchor-name-crash.html b/testing/web-platform/tests/css/css-anchor-position/iframe-anchor-name-crash.html
@@ -0,0 +1,13 @@
+<!doctype html>
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1998438">
+<style>
+* {
+ anchor-name: --anchor-name_0;
+}
+</style>
+<script>
+window.addEventListener("load", async () => {
+ const iframe = document.createElementNS("http://www.w3.org/1999/xhtml", "iframe")
+ document.documentElement.appendChild(iframe)
+})
+</script>