Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upcalled `Result::unwrap()` on an `Err` value: HierarchyRequest #20218
Comments
|
Hi, I'd like to take a stab at this issue. |
|
@patgronowski Have you made any progress with this? |
|
I came across a similar crash when working on #21882 with this test: a minimal repro: <iframe id="test"></iframe>
<script>
const frame = document.getElementById('test');
frame.contentDocument.open();
frame.contentDocument.appendChild(frame.contentDocument.createElement('div'));
frame.contentDocument.close();
</script>A few lines from the trace in common with the original issue: 12: 0x10ff88c92 - <html5ever::tree_builder::TreeBuilder<Handle, Sink>>::create_root::h3ea9842e7334b29f
13: 0x10ffadb4b - <html5ever::tree_builder::TreeBuilder<Handle, Sink>>::step::h972cc3290bdd0e11
14: 0x10ffa3b4c - <html5ever::tree_builder::TreeBuilder<Handle, Sink>>::process_to_completion::h27615fc794bb6b50It seems like the problem is when modifying the DOM directly, like using |
|
I would like to work on this issue. |
|
You're welcome to it. I don't have time to investigate the underlying cause right now, but the previous comment sounds very plausible to me. You will find the parser-related code in components/script/dom/document.rs, components/script/dom/servoparser/mod.rs, and components/script/dom/servoparser/html.rs. |
|
I have narrowed down the code block where the Err originates. When the Basically, the problem only occurs when an element node is being appended to the document itself but while the document still has an element child. If the parent isn't the document or the node being appended isn't an element node, the problem goes away. I ran a modified test case where the Node was appended to a 'div' tag and it worked without fault. I ran another test where I appended an empty DocumentFragment to the document and that worked as well.
I'm not entirely sure why the Document seems to have an element child after calling document.open(). I'll try to figure that out now. |
|
I'm trying to narrow down and continue the research by nipunG314 but the stacktrace I'm getting isn't matching my experience in the debugger. I have the stacktrace below but when I step through and past "components\script\dom\servoparser\mod.rs:970" it doesn't actually panic there. I'm trying to trace it but I just wanted to check if I'm reading the stacktrace wrong?
|
|
@chotchki perhaps the parser moves through line 970 multiple times, and you are stepping through it one of the earlier, successful iterations? |
Found fuzzing with domato.