From 5b4533cab8854032947b358e270092dbaabe7f81 Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Thu, 29 Feb 2024 21:53:58 +0000 Subject: [PATCH] LibWeb: Don't crash in offset_parent() if no ancestor element found The specification says the final step of this algorithm is to return null. Previously, the browser would crash if the content of an iframe was appended to the document before its offsetParent property was queried. --- .../Element-offsetParent-of-iframe.txt | 1 + .../input/Element-offsetParent-of-iframe.html | 22 +++++++++++++++++++ .../Libraries/LibWeb/HTML/HTMLElement.cpp | 3 ++- 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 Tests/LibWeb/Text/expected/Element-offsetParent-of-iframe.txt create mode 100644 Tests/LibWeb/Text/input/Element-offsetParent-of-iframe.html diff --git a/Tests/LibWeb/Text/expected/Element-offsetParent-of-iframe.txt b/Tests/LibWeb/Text/expected/Element-offsetParent-of-iframe.txt new file mode 100644 index 00000000000..4c43e847960 --- /dev/null +++ b/Tests/LibWeb/Text/expected/Element-offsetParent-of-iframe.txt @@ -0,0 +1 @@ +iframe offsetParent value: null diff --git a/Tests/LibWeb/Text/input/Element-offsetParent-of-iframe.html b/Tests/LibWeb/Text/input/Element-offsetParent-of-iframe.html new file mode 100644 index 00000000000..5bd23ec53a1 --- /dev/null +++ b/Tests/LibWeb/Text/input/Element-offsetParent-of-iframe.html @@ -0,0 +1,22 @@ + + + +