Skip to content

Truly independent web browser

LibWeb: Check only a document's own frames for load event delays

Tim Ledbetterd2230905d235
diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp
index 8824ba22bca..bcd7e5fd958 100644
--- a/Libraries/LibWeb/DOM/Document.cpp
+++ b/Libraries/LibWeb/DOM/Document.cpp
@@ -5979,9 +5979,10 @@ bool Document::anything_is_delaying_the_load_event() const
return true;
// NB: The containers of a remote navigable's descendants live in its process.
- for (auto& navigable : descendant_navigables()) {
- auto container = navigable->container();
- if (container && container->currently_delays_the_load_event())
+ for (auto* container : HTML::NavigableContainer::all_instances()) {
+ if (&container->document() != this || !container->is_connected() || !container->content_navigable())
+ continue;
+ if (container->currently_delays_the_load_event())
return true;
}
diff --git a/Tests/LibWeb/Crash/HTML/deeply-nested-iframes.html b/Tests/LibWeb/Crash/HTML/deeply-nested-iframes.html
new file mode 100644
index 00000000000..0aa6e676564
--- /dev/null
+++ b/Tests/LibWeb/Crash/HTML/deeply-nested-iframes.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<body>
+<script>
+ let nestedDocument = document;
+ for (let depth = 0; depth < 30; ++depth) {
+ const iframe = nestedDocument.createElement("iframe");
+ nestedDocument.body.appendChild(iframe);
+ nestedDocument = iframe.contentDocument;
+ }
+</script>
+</body>