LibWeb: Don't crash when querying the CDataSection.assignedSlot property

This commit is contained in:
Tim Ledbetter 2024-03-23 15:46:08 +00:00 committed by Andreas Kling
parent 3518f39b60
commit 521a1be97f
Notes: sideshowbarker 2024-07-17 01:28:15 +09:00
3 changed files with 11 additions and 1 deletions

View file

@ -0,0 +1 @@
PASS (didn't crash)

View file

@ -0,0 +1,9 @@
<script src="../include.js"></script>
<script>
test(() => {
const xmlDocument = new DOMParser().parseFromString(`<xml></xml>`, "application/xml");
const cdata = xmlDocument.createCDATASection("Test CDATA");
const assignedSlot = cdata.assignedSlot;
println("PASS (didn't crash)")
});
</script>

View file

@ -66,7 +66,7 @@ public:
bool is_character_data() const { return type() == NodeType::TEXT_NODE || type() == NodeType::COMMENT_NODE; }
bool is_document_fragment() const { return type() == NodeType::DOCUMENT_FRAGMENT_NODE; }
bool is_parent_node() const { return is_element() || is_document() || is_document_fragment(); }
bool is_slottable() const { return is_element() || is_text(); }
bool is_slottable() const { return is_element() || is_text() || is_cdata_section(); }
bool is_attribute() const { return type() == NodeType::ATTRIBUTE_NODE; }
bool is_cdata_section() const { return type() == NodeType::CDATA_SECTION_NODE; }
virtual bool is_shadow_root() const { return false; }