Repository navigation
Use html5ever’s BytesParser. - #9677
SimonSapin wants to merge 4 commits into
Conversation
|
@bors-servo try |
Use html5ever’s BytesParser. This fixes the encoding issue in #9670, though it uncovers a font selection issue (at least for me). 
| ignore_missing_rules: true, | ||
| .. Default::default() | ||
| let html5ever_parser = parse_document(sink, Default::default()).from_bytes(BytesOpts { | ||
| // FIXME: get this from Hyper |
There was a problem hiding this comment.
See https://github.com/SimonSapin/kuchiki/blob/2e6d261cb39e555afad54d5cccdc9170df747cf9/src/parser.rs#L71-L75 for how to get this from an hyper::client::Response.
|
💔 Test failed - mac-rel-css |
`vec.remove(0)` is O(n)
b080c4a to
b0f1089
Compare
|
Enabled some more tests, some of which are fixed by this code change. |
|
Ok, so the problem in these failing tests is that
I don’t know yet why this timing difference causes a panic, but reverting just that fixes it. I’ll look into it tomorrow, but I’d take any idea in the mean time. The panic is in pub fn set_pending_parsing_blocking_script(&self, script: Option<&HTMLScriptElement>) {
assert!(self.get_pending_parsing_blocking_script().is_none() || script.is_none());
self.pending_parsing_blocking_script.set(script);
}The assertion fails because both options are |
|
Can you check which of the three script elements in that file are involved? |
|
I get the assertion error on the second call to |
This fixes the encoding issue in #9670, though it uncovers a font selection issue (at least for me).
|
@Ms2ger pointed out on IRC that fn finish(self) -> Self::Output {
match self.state {
BytesParserState::Initial { parser } => parser.finish(),
BytesParserState::Buffering { parser, buffer } => {
let encoding = detect_encoding(&buffer, &self.opts);
let mut decoder = LossyDecoder::new(encoding, parser);
decoder.process(buffer);
decoder.finish()
},
BytesParserState::Parsing { decoder } => decoder.finish(),
BytesParserState::Transient => unreachable!(),
}
}For small document, we’re in the On a high level, we need a way to suspend and resume parsing (possibly multiple times) after the end of the input has been signaled. IRC again:
It does sound to me that some architecture needs to change here, but that’s a much bigger task than I was expected to get when I started working on this PR. I’m gonna move on to something else for now, anyone feel free to take this over. |
b0f1089 to
fdbb9a0
Compare
|
☔ The latest upstream changes (presumably #9721) made this pull request unmergeable. Please resolve the merge conflicts. |
|
#198 should work around the issue. I updated this PR to include it. @jdm, are you ok with landing this PR with that work-around, and leave the underlying issue (servo/html5ever#198) for later? @bors-servo try |
Use html5ever’s BytesParser. This previously was #9677. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9730) <!-- Reviewable:end -->
|
Looks like I can’t reopen a PR if I force-pushed to its branch while it was closed, so #9730. |
This fixes the encoding issue in #9670, though it uncovers a font selection issue (at least for me).