script: fix replaceChild panic when old child is not a child of this node - #822
Merged
Merged
Conversation
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dom/nodes/Node-replaceChild.htmlcrashed withOption::unwrap() on a None valueinDocumentMutator::insert_nodes_before(mutator.rs:646):replace_childcalledinsert_nodes_before(old_id, ...)unconditionally, and the anchor'sparent.unwrap()panics when the "old child" has no parent (e.g.a.replaceChild(b, c)wherecwas never inserted).Fix in
replace_child(blitz-vibey-script), per the DOM spec's replace steps:HierarchyRequestErrorif the new node is an inclusive ancestor of the context node (spec step 2) — this previously could also create a cycle in the node treeNotFoundErrorif the old child's parent is not the context node (spec step 3) — this was the panicinsertable_node_ids(matchinginsert_before/append_child)WPT result goes from CRASH to FAIL 9/29 subtests passing; remaining failures are the unimplemented full pre-insertion validation (node-type checks, document child constraints, doctype handling) which is a larger piece of work. No change to
Node-insertBefore/appendChild/removeChildresults.Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/967f095dfc0a48d3b73b3f13a579372b
Open in Devin Desktop: https://dioxus.staging.devinenterprise.com/desktop/session/967f095dfc0a48d3b73b3f13a579372b?variant=devin-insiders
Requested by: @nicoburns
WPT results
No changes in test results compared to
main.Generated by the WPT workflow.