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 upImplemementing context-based MIME type sniffing #8190
Conversation
|
r? @glennw for the font-loading changes. |
| metadata.content_type.as_ref().map(|content_type| { | ||
| let mime = &content_type.0; | ||
| is_supported_font_type(&mime.0, &mime.1) | ||
| }).unwrap_or(false); |
This comment has been minimized.
This comment has been minimized.
| Some(MediaType::AudioVideo) => self.audio_video_classifier.classify(data), | ||
| None => None | ||
| }.unwrap_or(supplied_type.clone()) | ||
| data: &[u8]) -> Option<(String, String)> { |
This comment has been minimized.
This comment has been minimized.
eefriedman
Oct 25, 2015
Contributor
Is there some reason you're changing this? It will substantially simplify downstream code if we can assume MIME sniffing always returns something (even if it's just application/octet-stream or something).
This comment has been minimized.
This comment has been minimized.
jdm
Oct 25, 2015
Author
Member
That's a good point; I didn't consider just turning a missing Content-Type and unclassifiable into application/octet-stream.
|
|
|
@jdm Sorry, I missed this one - is it waiting on my review now, or are other changes required before it is worth looking at it? |
|
I don't think the requested changes have any effect on the stuff you're reviewing. |
|
@jdm The font load changes look ok to me, apart from the question about the mutex usage. |
|
r? @eefriedman for the most recent changes. |
|
I'd also like to see a test to make sure that content served as application/xhtml+xml is never sniffed as a font, even if it is one. |
|
Review status: 0 of 25 files reviewed at latest revision, 6 unresolved discussions, some commit checks failed. components/gfx/font_cache_task.rs, line 381 [r7] (raw file): components/net/mime_classifier.rs, line 46 [r7] (raw file): components/net/mime_classifier.rs, line 235 [r7] (raw file): components/script/document_loader.rs, line 38 [r7] (raw file): Comments from the review on Reviewable.io |
|
|
|
I realize I never responded. @jdm, yes, this lgtm. |
|
@bors-servo: try |
Implemementing context-based MIME type sniffing This is a rebase of #7842 that also adds a test. Fixes #4183. @Yoric, how's this look to you? <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8190) <!-- Reviewable:end -->
|
|
|
…tore the status quo.
|
There. All tests pass locally for me now. |
|
@bors-servo r=eefriedman |
|
|
Implemementing context-based MIME type sniffing This is a rebase of #7842 that also adds a test. Fixes #4183. @Yoric, how's this look to you? <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8190) <!-- Reviewable:end -->
|
|
jdm commentedOct 25, 2015
This is a rebase of #7842 that also adds a test.
Fixes #4183.
@Yoric, how's this look to you?