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

html5ever::tokenizer::Tokenizer::process_token_and_continue needs to go away #496

Open
kevincox opened this issue Apr 11, 2023 · 3 comments

Comments

@kevincox
Copy link

It will panic if you don't return Continue and the callee has no way of knowing if they are being called from a "normal" code path where you are allowed to return whatever you want and or a special panic-if-not Continue codepath. Not cool.

This is dangerous and basically means that returning anything but Continue is forbidden if you don't want panics.

At they very least this should be documented.

@jdm
Copy link
Member

jdm commented Apr 12, 2023

What are you trying to do where this is an issue?

@jdm
Copy link
Member

jdm commented Apr 12, 2023

Oh, I see that it compares against the result of calling process_token on the sink.

@kevincox
Copy link
Author

I was implementing a TokenSink for rewriting some HTML in a streaming-ish fashion.

I'm not sure this is the best API for what I am trying to do but I didn't expect it to panic because I didn't return Continue.

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

No branches or pull requests

2 participants