Bug 1860041 - Make sure frameloader is initialized after lazy-loading if there's a frame. r=CanadaHonk

Differential Revision: https://phabricator.services.mozilla.com/D191750
This commit is contained in:
Emilio Cobos Álvarez 2023-10-24 15:06:17 +00:00
parent 1d67199ec6
commit 0cc6566d47
3 changed files with 20 additions and 1 deletions

View File

@ -13,7 +13,7 @@
#include "mozilla/MappedDeclarationsBuilder.h"
#include "mozilla/NullPrincipal.h"
#include "mozilla/StaticPrefs_dom.h"
#include "nsAttrValueInlines.h"
#include "nsSubDocumentFrame.h"
#include "nsError.h"
#include "nsContentUtils.h"
#include "nsSandboxFlags.h"
@ -363,6 +363,9 @@ void HTMLIFrameElement::StopLazyLoading() {
LoadSrc();
mLazyLoadState.Clear();
if (nsSubDocumentFrame* ourFrame = do_QueryFrame(GetPrimaryFrame())) {
ourFrame->ResetFrameLoader(nsSubDocumentFrame::RetainPaintData::No);
}
}
void HTMLIFrameElement::NodeInfoChanged(Document* aOldDoc) {

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<meta charset="utf-8">
<link rel="match" href="iframe-loading-lazy-in-viewport-ref.html">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1860041">
</head>
<body>
<iframe loading="lazy" src="data:text/html,PASS" onload="document.documentElement.className = ''"></iframe>
<script>
document.querySelector("iframe").getBoundingClientRect();
</script>
</body>
</html>

View File

@ -0,0 +1,2 @@
<!DOCTYPE html>
<iframe src="data:text/html,PASS"></iframe>