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 upMake Metadata use ContentType #5544
Conversation
highfive
commented
Apr 6, 2015
|
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @mbrubeck (or someone else) soon. |
hoppipolla-critic-bot
commented
Apr 6, 2015
|
Critic review: https://critic.hoppipolla.co.uk/r/4531 This is an external review system which you may optionally use for the code review of your pull request. In order to help critic track your changes, please do not make in-place history rewrites (e.g. via |
| let page = format!("<html><body><img src='{}' /></body></html>", url.serialize()); | ||
| parser.parse_chunk(page); | ||
| }, | ||
| Some((ref t, ref st)) if t.as_slice().eq_ignore_ascii_case("text") && | ||
| st.as_slice().eq_ignore_ascii_case("plain") => { | ||
| Some(ContentType(Mime(ref t, ref st, _))) if *t == TopLevel::Text && |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
boghison
Apr 6, 2015
Author
Contributor
Oh, yes, totally, I was just keeping the original structure :)
| @@ -291,12 +293,12 @@ pub fn parse_html(document: JSRef<Document>, | |||
| } | |||
| HTMLInput::InputUrl(load_response) => { | |||
| match load_response.metadata.content_type { | |||
| Some((ref t, _)) if t.as_slice().eq_ignore_ascii_case("image") => { | |||
| Some(ContentType(Mime(ref t, _, _))) if *t == TopLevel::Image => { | |||
This comment has been minimized.
This comment has been minimized.
| @@ -1067,8 +1069,8 @@ impl ScriptTask { | |||
| }); | |||
|
|
|||
| let content_type = match response.metadata.content_type { | |||
| Some((ref t, ref st)) if t.as_slice().eq_ignore_ascii_case("text") && | |||
| st.as_slice().eq_ignore_ascii_case("plain") => { | |||
| Some(ContentType(Mime(ref t, ref st, _))) if *t == TopLevel::Text && | |||
This comment has been minimized.
This comment has been minimized.
|
Looks good, aside from some minor fixes in the match. Thanks! |
|
@bors-servo: r+ |
|
|
|
|
|
Sorry, looks like #5005 added some code that needs to be adjusted now.
|
|
@jdm so what am I supposed to do, edit the whole mime classifier or just send toplevel and sublevel as strings? |
|
I would go ahead and edit the classifier code. |
|
@jdm That is going to need a lot of rewriting, mostly because almost everything has been fixed to use strings there |
|
Oh, hmm. Go ahead and pass it strings, in that case. We can file a follow-up to rewrite it separately. |
|
@jdm Yes, that would be best, the hardest part is probably dealing with non standard types like application+xml |
|
@jdm How do I actually convert a mime to a string? |
|
You might need to resort to |
|
@bors-servo: r+ |
|
|
Fixes #5538 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5544) <!-- Reviewable:end -->
|
|
You can reproduce this with |
|
@jdm To fix this test I'd have to add hyper as an external dependency, is it ok? |
|
Yes, to the unit tests crate. |
|
@Manishearth Yes, obviously |
|
@bors-servo: r+ |
|
|
Fixes #5538 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5544) <!-- Reviewable:end -->
boghison commentedApr 6, 2015
Fixes #5538