servo: Merge #16869 - Ignore mime type parameters in nosniff (fixes #16049) (from nox:mime); r=nox

Source-Repo: https://github.com/servo/servo
Source-Revision: f3c8f7e0d0fb42f32e3699d07fc0f8002bf564c8

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : d7ddf463cc31fc89f0d289b5739767e2ffff1de7
This commit is contained in:
Fabrice Desré 2017-05-15 10:15:37 -05:00
Родитель 45fdbb5730
Коммит b912f951ac
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -559,10 +559,10 @@ pub fn should_be_blocked_due_to_nosniff(request_type: Type, response_headers: &H
mime!(Text / ("x-javascript")),
];
javascript_mime_types.contains(mime_type)
javascript_mime_types.iter()
.any(|mime| mime.0 == mime_type.0 && mime.1 == mime_type.1)
}
let text_css: Mime = mime!(Text / Css);
// Assumes str::starts_with is equivalent to mime::TopLevel
return match request_type {
// Step 6
@ -575,8 +575,8 @@ pub fn should_be_blocked_due_to_nosniff(request_type: Type, response_headers: &H
// Step 7
Type::Style => {
match content_type_header {
Some(&ContentType(ref mime_type)) => mime_type != &text_css,
None => true
Some(&ContentType(Mime(TopLevel::Text, SubLevel::Css, _))) => false,
_ => true
}
}
// Step 8