1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-07 16:27:35 +00:00
serenity/Userland/Libraries/LibWeb/DOM
Andreas Kling bbb96d65b1 LibWeb: Don't crash on live range offset update during node insertion
When inserting a node into a parent, any live DOM ranges that reference
the parent may need to be updated. The spec does this by increasing or
decreasing the start/end offsets of each live range *before* actually
performing the insertion.

This caused us to crash with a verification failure, since it was
possible to set the range offset to an invalid value (that would go on
to immediately become valid after the insertion was finished).

This patch fixes the issue by adding special badged helpers on Range for
Node to reach into it and increase/decrease the offsets during node
insertion. This skips the offset validity check and actually makes our
code read slightly more like the spec.

Found by Domato :^)
2024-03-12 16:30:39 +01:00
..
AbortController.cpp LibWeb: Port Intrinsics from DeprecatedString 2023-11-28 17:15:27 -05:00
AbortController.h LibWeb: Put most LibWeb GC objects in type-specific heap blocks 2023-11-19 22:00:48 +01:00
AbortController.idl LibWeb: Add comments and missing items of various IDL files 2023-10-25 19:45:41 +02:00
AbortSignal.cpp LibWeb: Implement AbortSignal.any() 2024-03-12 09:31:41 +01:00
AbortSignal.h LibWeb: Implement AbortSignal.any() 2024-03-12 09:31:41 +01:00
AbortSignal.idl LibWeb: Implement AbortSignal.any() 2024-03-12 09:31:41 +01:00
AbstractRange.cpp LibWeb: Use WebIDL typedefs in Range/AbstractRange 2024-01-04 10:10:44 +01:00
AbstractRange.h LibWeb: Use WebIDL typedefs in Range/AbstractRange 2024-01-04 10:10:44 +01:00
AbstractRange.idl IDL: Add missing #imports 2023-11-11 08:51:51 +01:00
AccessibilityTreeNode.cpp Userland+Tests: Remove unused <AK/Tuple.h> includes 2024-03-01 14:05:53 -07:00
AccessibilityTreeNode.h LibWeb: Put most LibWeb GC objects in type-specific heap blocks 2023-11-19 22:00:48 +01:00
AdoptedStyleSheets.cpp LibWeb: Add styleSheets and adoptedStyleSheets attributes in ShadowRoot 2024-03-09 16:13:32 +01:00
AdoptedStyleSheets.h LibWeb: Add styleSheets and adoptedStyleSheets attributes in ShadowRoot 2024-03-09 16:13:32 +01:00
Attr.cpp LibWeb: Port Intrinsics from DeprecatedString 2023-11-28 17:15:27 -05:00
Attr.h LibWeb: Put most LibWeb GC objects in type-specific heap blocks 2023-11-19 22:00:48 +01:00
Attr.idl LibWeb: Add comments and missing items of various IDL files 2023-10-25 19:45:41 +02:00
CDATASection.cpp LibWeb: Port Intrinsics from DeprecatedString 2023-11-28 17:15:27 -05:00
CDATASection.h LibWeb: Put most LibWeb GC objects in type-specific heap blocks 2023-11-19 22:00:48 +01:00
CDATASection.idl IDL: Add missing #imports 2023-11-11 08:51:51 +01:00
CharacterData.cpp LibWeb: Use correct offset value when replacing character data 2024-02-10 11:18:51 +01:00
CharacterData.h LibWeb: Use UTF-16 code unit offsets and lengths in CharacterData 2023-12-23 20:41:41 +01:00
CharacterData.idl LibWeb: Use UTF-16 code unit offsets and lengths in CharacterData 2023-12-23 20:41:41 +01:00
ChildNode.h LibWeb: Fix infinite loop in ChildNode's before() and after() 2024-03-11 18:29:10 +01:00
ChildNode.idl IDL: Add missing #imports 2023-11-11 08:51:51 +01:00
Comment.cpp LibWeb: Port Intrinsics from DeprecatedString 2023-11-28 17:15:27 -05:00
Comment.h LibWeb: Put most LibWeb GC objects in type-specific heap blocks 2023-11-19 22:00:48 +01:00
Comment.idl LibWeb: Port Comment interface from DeprecatedString to String 2023-09-06 11:44:45 -04:00
CustomEvent.cpp LibWeb: Port Intrinsics from DeprecatedString 2023-11-28 17:15:27 -05:00
CustomEvent.h LibWeb: Put most LibWeb GC objects in type-specific heap blocks 2023-11-19 22:00:48 +01:00
CustomEvent.idl LibWeb: Add comments and missing items of various IDL files 2023-10-25 19:45:41 +02:00
Document.cpp LibWeb: Ignore window-forwarded document.body.onfoo in detached DOM 2024-03-11 18:29:10 +01:00
Document.h LibWeb: Ignore window-forwarded document.body.onfoo in detached DOM 2024-03-11 18:29:10 +01:00
Document.idl LibWeb: Add styleSheets and adoptedStyleSheets attributes in ShadowRoot 2024-03-09 16:13:32 +01:00
DocumentFragment.cpp LibWeb: Port Intrinsics from DeprecatedString 2023-11-28 17:15:27 -05:00
DocumentFragment.h LibWeb: Put most LibWeb GC objects in type-specific heap blocks 2023-11-19 22:00:48 +01:00
DocumentFragment.idl LibWeb: Add comments and missing items of various IDL files 2023-10-25 19:45:41 +02:00
DocumentLoadEventDelayer.cpp LibWeb+LibJS: Make the EventTarget hierarchy (incl. DOM) GC-allocated 2022-09-06 00:27:09 +02:00
DocumentLoadEventDelayer.h LibWeb+LibJS: Make the EventTarget hierarchy (incl. DOM) GC-allocated 2022-09-06 00:27:09 +02:00
DocumentLoading.cpp LibWeb: Use file's URL as document's URL when loading markdown files 2024-02-08 07:58:07 -07:00
DocumentLoading.h Everywhere: Use unqualified AK::URL 2024-02-25 08:54:31 +01:00
DocumentObserver.cpp LibWeb: Put most LibWeb GC objects in type-specific heap blocks 2023-11-19 22:00:48 +01:00
DocumentObserver.h LibWeb: Put most LibWeb GC objects in type-specific heap blocks 2023-11-19 22:00:48 +01:00
DocumentOrShadowRoot.idl LibWeb: Add styleSheets and adoptedStyleSheets attributes in ShadowRoot 2024-03-09 16:13:32 +01:00
DocumentType.cpp LibWeb: Port Intrinsics from DeprecatedString 2023-11-28 17:15:27 -05:00
DocumentType.h LibWeb: Put most LibWeb GC objects in type-specific heap blocks 2023-11-19 22:00:48 +01:00
DocumentType.idl LibWeb: Switch IDL from UseNewAKString to UseDeprecatedAKString 2023-09-02 19:23:41 +01:00
DOMEventListener.cpp LibWeb: Put most LibWeb GC objects in type-specific heap blocks 2023-11-19 22:00:48 +01:00
DOMEventListener.h LibWeb: Put most LibWeb GC objects in type-specific heap blocks 2023-11-19 22:00:48 +01:00
DOMImplementation.cpp LibWeb: Make DOMImplementation.createHTMLDocument() create HTMLDocument 2024-03-11 18:29:10 +01:00
DOMImplementation.h LibWeb: Use Optional<FlyString> directly in Document & DOMImplementation 2024-01-13 08:33:10 +01:00
DOMImplementation.idl LibWeb: Use Optional<FlyString> directly in Document & DOMImplementation 2024-01-13 08:33:10 +01:00
DOMTokenList.cpp LibWeb: Remove DOM element deprecated_get_attribute() 2024-01-19 13:12:54 -07:00
DOMTokenList.h LibWeb: Delete LegacyPlatformObject and move behavior to PlatformObject 2024-01-12 09:11:18 +01:00
DOMTokenList.idl LibWeb: Switch IDL from UseNewAKString to UseDeprecatedAKString 2023-09-02 19:23:41 +01:00
Element.cpp LibWeb: Make a Layout::BlockContainer for MathML boxes 2024-03-11 18:29:10 +01:00
Element.h LibWeb: Add style sheets to the shadow root if applicable 2024-03-09 16:13:32 +01:00
Element.idl LibWeb: Add Animatable interface to Element 2024-02-19 12:21:48 +01:00
ElementFactory.cpp LibWeb: Add initial support for SVG <textPath> 2023-12-19 21:29:03 +01:00
ElementFactory.h LibWeb: Use FlyString for create_element() namespace strings 2023-11-04 21:28:30 +01:00
Event.cpp LibWeb: Port Intrinsics from DeprecatedString 2023-11-28 17:15:27 -05:00
Event.h LibWeb: Make UIEvents from the chrome the only default trusted Events 2024-01-19 11:47:59 +01:00
Event.idl LibWeb: Add comments and missing items of various IDL files 2023-10-25 19:45:41 +02:00
EventDispatcher.cpp LibWeb: Port call_user_object_operation from DeprecatedString 2023-12-02 22:54:53 +01:00
EventDispatcher.h LibWeb+LibJS: Make the EventTarget hierarchy (incl. DOM) GC-allocated 2022-09-06 00:27:09 +02:00
EventHandler.idl LibWeb: Emit "focusin" and "focusout" events 2024-02-25 10:17:25 +01:00
EventTarget.cpp LibWeb: Ignore window-forwarded document.body.onfoo in detached DOM 2024-03-11 18:29:10 +01:00
EventTarget.h LibWeb: Use NonnullGCPtr in EventTarget's event handler map 2024-03-11 18:29:10 +01:00
EventTarget.idl LibWeb: Switch IDL from UseNewAKString to UseDeprecatedAKString 2023-09-02 19:23:41 +01:00
HTMLCollection.cpp LibWeb: Use cached element name and id where possible 2024-01-13 12:05:36 +01:00
HTMLCollection.h LibWeb: Delete LegacyPlatformObject and move behavior to PlatformObject 2024-01-12 09:11:18 +01:00
HTMLCollection.idl LibWeb: Add comments and missing items of various IDL files 2023-10-25 19:45:41 +02:00
HTMLFormControlsCollection.cpp LibWeb: Port Element::name to a cached FlyString 2024-01-13 12:05:36 +01:00
HTMLFormControlsCollection.h LibWeb: Support RadioNodeList named items in HTMLFormControlsCollection 2023-12-23 20:53:11 +01:00
HTMLFormControlsCollection.idl LibWeb: Format all .idl files to use four space indentation 2024-01-18 14:00:06 +01:00
IDLEventListener.cpp LibWeb/LibJS: Avoid GC visit of raw pointers where possible 2023-11-19 08:05:45 +00:00
IDLEventListener.h LibJS: Make Heap::allocate<T>() infallible 2023-08-13 15:38:42 +02:00
InnerHTML.idl LibWeb: Resolve circular IDL imports 2022-07-30 13:20:47 +02:00
LiveNodeList.cpp LibWeb: Make LiveNodeList store a NonnullGCPtr<Node const> root 2023-12-23 20:53:11 +01:00
LiveNodeList.h LibWeb: Make LiveNodeList store a NonnullGCPtr<Node const> root 2023-12-23 20:53:11 +01:00
MutationObserver.cpp LibWeb: Port Intrinsics from DeprecatedString 2023-11-28 17:15:27 -05:00
MutationObserver.h LibWeb: Put most LibWeb GC objects in type-specific heap blocks 2023-11-19 22:00:48 +01:00
MutationObserver.idl LibWeb: Add comments and missing items of various IDL files 2023-10-25 19:45:41 +02:00
MutationRecord.cpp LibWeb: Port Intrinsics from DeprecatedString 2023-11-28 17:15:27 -05:00
MutationRecord.h LibWeb: Put most LibWeb GC objects in type-specific heap blocks 2023-11-19 22:00:48 +01:00
MutationRecord.idl LibWeb: Add comments and missing items of various IDL files 2023-10-25 19:45:41 +02:00
MutationType.cpp AK: Make "foo"_fly_string infallible 2023-08-07 16:03:27 +02:00
MutationType.h AK: Make "foo"_fly_string infallible 2023-08-07 16:03:27 +02:00
NamedNodeMap.cpp LibWeb: Fix normalizing namespace in NamedNodeMap::get_attribute_ns 2024-01-13 08:33:10 +01:00
NamedNodeMap.h LibWeb: Delete LegacyPlatformObject and move behavior to PlatformObject 2024-01-12 09:11:18 +01:00
NamedNodeMap.idl LibWeb: Use Optional<FlyString> const& in Element and NamedNodeMap 2024-01-03 10:13:47 +01:00
Node.cpp LibWeb: Don't crash on live range offset update during node insertion 2024-03-12 16:30:39 +01:00
Node.h LibWeb: Null layout and paintable pointers of removed DOM::Node 2024-02-20 10:55:10 +01:00
Node.idl LibWeb: Port Node interface from DeprecatedString to String 2023-09-17 20:29:18 +02:00
NodeFilter.cpp LibWeb: Put most LibWeb GC objects in type-specific heap blocks 2023-11-19 22:00:48 +01:00
NodeFilter.h LibWeb: Put most LibWeb GC objects in type-specific heap blocks 2023-11-19 22:00:48 +01:00
NodeFilter.idl IDL: Add missing spec links 2023-11-11 08:51:51 +01:00
NodeIterator.cpp LibWeb: Port call_user_object_operation from DeprecatedString 2023-12-02 22:54:53 +01:00
NodeIterator.h LibWeb: Put most LibWeb GC objects in type-specific heap blocks 2023-11-19 22:00:48 +01:00
NodeIterator.idl LibWeb: Add comments and missing items of various IDL files 2023-10-25 19:45:41 +02:00
NodeList.cpp LibWeb: Delete LegacyPlatformObject and move behavior to PlatformObject 2024-01-12 09:11:18 +01:00
NodeList.h LibWeb: Delete LegacyPlatformObject and move behavior to PlatformObject 2024-01-12 09:11:18 +01:00
NodeList.idl LibWeb: Add comments and missing items of various IDL files 2023-10-25 19:45:41 +02:00
NodeOperations.cpp Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
NodeOperations.h LibWeb: Remove DeprecatedString support from {Child,Parent}Node 2023-10-06 08:25:40 +02:00
NonDocumentTypeChildNode.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
NonElementParentNode.h LibWeb: Use Element::id() in getElementById() 2023-11-02 17:09:34 +01:00
ParentNode.cpp LibWeb: Remove DeprecatedString impls of get_elements_by_tag_name{_ns} 2023-11-06 11:37:08 +01:00
ParentNode.h LibWeb: Remove DeprecatedString impls of get_elements_by_tag_name{_ns} 2023-11-06 11:37:08 +01:00
ParentNode.idl LibWeb: Resolve circular IDL imports 2022-07-30 13:20:47 +02:00
Position.cpp LibWeb: Add missing DOM::Position::visit_edges() 2023-12-12 01:08:07 +01:00
Position.h LibWeb: Fix crashing after input into empty contenteditable 2024-02-24 08:09:01 +01:00
ProcessingInstruction.cpp LibWeb: Port ProcessingInstruction from ByteString 2023-12-24 13:26:50 +01:00
ProcessingInstruction.h LibWeb: Port ProcessingInstruction from ByteString 2023-12-24 13:26:50 +01:00
ProcessingInstruction.idl LibWeb: Add Exposed attribute and IDL spec links where missing 2022-10-09 10:14:57 +02:00
QualifiedName.cpp LibWeb: Remove some now unused deprecated functions from QualifiedName 2023-11-06 11:37:08 +01:00
QualifiedName.h LibWeb: Remove some now unused deprecated functions from QualifiedName 2023-11-06 11:37:08 +01:00
RadioNodeList.cpp LibWeb: Make LiveNodeList store a NonnullGCPtr<Node const> root 2023-12-23 20:53:11 +01:00
RadioNodeList.h LibWeb: Make LiveNodeList store a NonnullGCPtr<Node const> root 2023-12-23 20:53:11 +01:00
RadioNodeList.idl LibWeb: Switch IDL from UseNewAKString to UseDeprecatedAKString 2023-09-02 19:23:41 +01:00
Range.cpp LibWeb: Don't crash on live range offset update during node insertion 2024-03-12 16:30:39 +01:00
Range.h LibWeb: Don't crash on live range offset update during node insertion 2024-03-12 16:30:39 +01:00
Range.idl LibWeb: Stub Range::get_client_rects() 2024-01-20 08:56:52 +01:00
ShadowRoot.cpp LibWeb: Apply shadow root style sheets in StyleComputer 2024-03-09 16:13:32 +01:00
ShadowRoot.h LibWeb: Apply shadow root style sheets in StyleComputer 2024-03-09 16:13:32 +01:00
ShadowRoot.idl LibWeb: Add styleSheets and adoptedStyleSheets attributes in ShadowRoot 2024-03-09 16:13:32 +01:00
Slot.cpp LibWeb: Introduce the slot concept for HTML slot elements 2023-09-13 13:45:47 +02:00
Slot.h LibWeb: Introduce the slot concept for HTML slot elements 2023-09-13 13:45:47 +02:00
Slottable.cpp LibWeb: Skip assigning slottables for non-shadow roots 2023-11-03 20:50:34 +01:00
Slottable.h LibWeb: Implement manual slottable assignment 2023-09-13 13:45:47 +02:00
Slottable.idl IDL: Add missing #imports 2023-11-11 08:51:51 +01:00
StaticNodeList.cpp LibWeb: Put most LibWeb GC objects in type-specific heap blocks 2023-11-19 22:00:48 +01:00
StaticNodeList.h LibWeb: Put most LibWeb GC objects in type-specific heap blocks 2023-11-19 22:00:48 +01:00
StaticRange.cpp LibWeb: Port Intrinsics from DeprecatedString 2023-11-28 17:15:27 -05:00
StaticRange.h LibWeb: Put most LibWeb GC objects in type-specific heap blocks 2023-11-19 22:00:48 +01:00
StaticRange.idl LibWeb: Add comments and missing items of various IDL files 2023-10-25 19:45:41 +02:00
StyleElementUtils.cpp LibWeb: Add style sheets to the shadow root if applicable 2024-03-09 16:13:32 +01:00
StyleElementUtils.h LibWeb: Add style sheets to the shadow root if applicable 2024-03-09 16:13:32 +01:00
Text.cpp LibWeb: Port Intrinsics from DeprecatedString 2023-11-28 17:15:27 -05:00
Text.h LibWeb: Add input and textarea minlength and maxlength support 2024-03-03 10:02:30 -05:00
Text.idl LibWeb: Introduce the slottable concept for DOM elements and text nodes 2023-09-13 13:45:47 +02:00
TreeWalker.cpp LibWeb: Don't get stuck in TreeWalker.nextNode() when current detached 2023-12-03 23:16:26 +01:00
TreeWalker.h LibWeb: Put most LibWeb GC objects in type-specific heap blocks 2023-11-19 22:00:48 +01:00
TreeWalker.idl LibWeb: Add comments and missing items of various IDL files 2023-10-25 19:45:41 +02:00
XMLDocument.cpp Everywhere: Use unqualified AK::URL 2024-02-25 08:54:31 +01:00
XMLDocument.h Everywhere: Use unqualified AK::URL 2024-02-25 08:54:31 +01:00
XMLDocument.idl LibWeb: Add comments and missing items of various IDL files 2023-10-25 19:45:41 +02:00