Fix panic in parser-reentrancy-customelement.window.js (#33162)

* Try to fix panic in parser-reentrancy-customelement.window.js

Signed-off-by: Taym <haddadi.taym@gmail.com>

* ./mach fmt

Signed-off-by: Taym <haddadi.taym@gmail.com>

* Only return with ToTokenizerMsg::End and continue for others

Signed-off-by: Taym <haddadi.taym@gmail.com>

---------

Signed-off-by: Taym <haddadi.taym@gmail.com>
This commit is contained in:
Taym Haddadi 2024-08-28 13:01:21 +02:00 committed by GitHub
parent 9639d36550
commit bb5547a5d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 8 deletions

View file

@ -318,7 +318,7 @@ impl Tokenizer {
let script = self.get_node(&script.id);
return TokenizerResult::Script(DomRoot::from_ref(script.downcast().unwrap()));
},
ToTokenizerMsg::End => unreachable!(),
_ => unreachable!(),
};
}
}
@ -334,8 +334,12 @@ impl Tokenizer {
.expect("Unexpected channel panic in main thread.")
{
ToTokenizerMsg::ProcessOperation(parse_op) => self.process_operation(parse_op),
ToTokenizerMsg::TokenizerResultDone { updated_input: _ } |
ToTokenizerMsg::TokenizerResultScript {
script: _,
updated_input: _,
} => continue,
ToTokenizerMsg::End => return,
_ => unreachable!(),
};
}
}

View file

@ -1,6 +0,0 @@
[parser-reentrancy-customelement.window.html?default]
prefs: ["dom.servoparser.async_html_tokenizer.enabled:false"]
[parser-reentrancy-customelement.window.html?async]
expected: CRASH
prefs: ["dom.servoparser.async_html_tokenizer.enabled:true"]