Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more tests and streaming interface #3

Merged
merged 13 commits into from
Nov 18, 2023
Merged

Add more tests and streaming interface #3

merged 13 commits into from
Nov 18, 2023

Conversation

aumetra
Copy link
Owner

@aumetra aumetra commented Nov 17, 2023

No description provided.

@aumetra aumetra marked this pull request as ready for review November 17, 2023 16:23
@aumetra
Copy link
Owner Author

aumetra commented Nov 18, 2023

I literally can't get lol_html to produce any output on the last two failing tests.
This is so frustrating..

@aumetra
Copy link
Owner Author

aumetra commented Nov 18, 2023

This kinda fixes it but is really ugly.
In the beginning it does two linear scans across the string, one to count the openings tags, and one to count the closing tags.

Then it balances out the amount of opening and closing tags in the string, providing each open tag with a closing tag somewhere, then lol_html considers these as tags.

This is an ugly fix. I don't wanna merge that.

@aumetra
Copy link
Owner Author

aumetra commented Nov 18, 2023

Okay, this kinda fixes it. It still does two linear scans, but using the bytecount crate, and therefore SIMD accelerated primitives (when available).

And instead of allocating the entire content and appending them to the allocated chunk, we count the amount of unclosed opening tags and push them in using a for loop and the streaming interface of lol_html.

And since we were already using the streaming interface, this also adds a streaming interface to the sanitizer.

So.. closes #5

This was linked to issues Nov 18, 2023
@aumetra aumetra changed the title Add more tests Add more tests and streaming interface Nov 18, 2023
@aumetra aumetra merged commit 1f5da20 into main Nov 18, 2023
3 checks passed
@aumetra aumetra deleted the aumetra/more-tests branch November 18, 2023 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Streaming interface Increase test coverage
1 participant