mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Auto merge of #15264 - servo:content-type, r=nox
Always set the Document::contentType attribute in ScriptThread::load(). <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15264) <!-- Reviewable:end -->
This commit is contained in:
commit
cc2011c050
9 changed files with 7 additions and 43 deletions
|
@ -1710,15 +1710,9 @@ impl ScriptThread {
|
||||||
headers.get().map(|&LastModified(HttpDate(ref tm))| dom_last_modified(tm))
|
headers.get().map(|&LastModified(HttpDate(ref tm))| dom_last_modified(tm))
|
||||||
});
|
});
|
||||||
|
|
||||||
let content_type = metadata.content_type.as_ref().and_then(|&Serde(ContentType(ref mimetype))| {
|
let content_type = metadata.content_type
|
||||||
match *mimetype {
|
.as_ref()
|
||||||
Mime(TopLevel::Application, SubLevel::Xml, _) |
|
.map(|&Serde(ContentType(ref mimetype))| DOMString::from(mimetype.to_string()));
|
||||||
Mime(TopLevel::Application, SubLevel::Ext(_), _) |
|
|
||||||
Mime(TopLevel::Text, SubLevel::Xml, _) |
|
|
||||||
Mime(TopLevel::Text, SubLevel::Plain, _) => Some(DOMString::from(mimetype.to_string())),
|
|
||||||
_ => None,
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
let loader = DocumentLoader::new_with_threads(self.resource_threads.clone(),
|
let loader = DocumentLoader::new_with_threads(self.resource_threads.clone(),
|
||||||
Some(final_url.clone()));
|
Some(final_url.clone()));
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[contenttype_bmp.html]
|
|
||||||
type: testharness
|
|
||||||
[BMP document.contentType === 'image/bmp']
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[contenttype_css.html]
|
|
||||||
type: testharness
|
|
||||||
[CSS document.contentType === 'text/css']
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[contenttype_gif.html]
|
|
||||||
type: testharness
|
|
||||||
[GIF document.contentType === 'image/gif']
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[contenttype_jpg.html]
|
|
||||||
type: testharness
|
|
||||||
[JPG document.contentType === 'image/jpeg']
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[contenttype_png.html]
|
|
||||||
type: testharness
|
|
||||||
[PNG document.contentType === 'image/png']
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[pageload-image.html]
|
|
||||||
type: testharness
|
|
||||||
[The document for a standalone media file should have one child in the body.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
function frameLoaded() {
|
function frameLoaded() {
|
||||||
var testframe = document.getElementById('testframe');
|
var testframe = document.getElementById('testframe');
|
||||||
|
assert_equals(testframe.contentDocument.contentType, "image/png");
|
||||||
var testframeChildren = testframe.contentDocument.body.childNodes;
|
var testframeChildren = testframe.contentDocument.body.childNodes;
|
||||||
assert_equals(testframeChildren.length, 1, "Body of image document has 1 child");
|
assert_equals(testframeChildren.length, 1, "Body of image document has 1 child");
|
||||||
assert_equals(testframeChildren[0].nodeName, "IMG", "Only child of body must be an <img> element");
|
assert_equals(testframeChildren[0].nodeName, "IMG", "Only child of body must be an <img> element");
|
||||||
|
@ -24,7 +25,6 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="log"></div>
|
<div id="log"></div>
|
||||||
<iframe id="testframe" onload="t.step(frameLoaded)"
|
<iframe id="testframe" onload="t.step(frameLoaded)" src="/images/blue.png"></iframe>
|
||||||
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9oMFgQGMyFwHucAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAADElEQVQI12P4//8/AAX+Av7czFnnAAAAAElFTkSuQmCC"></iframe>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
function frameLoaded() {
|
function frameLoaded() {
|
||||||
var testframe = document.getElementById('testframe');
|
var testframe = document.getElementById('testframe');
|
||||||
|
assert_equals(testframe.contentDocument.contentType, "video/webm");
|
||||||
var testframeChildren = testframe.contentDocument.body.childNodes;
|
var testframeChildren = testframe.contentDocument.body.childNodes;
|
||||||
assert_equals(testframeChildren.length, 1, "Body of image document has 1 child");
|
assert_equals(testframeChildren.length, 1, "Body of image document has 1 child");
|
||||||
assert_equals(testframeChildren[0].nodeName, "VIDEO", "Only child of body must be an <video> element");
|
assert_equals(testframeChildren[0].nodeName, "VIDEO", "Only child of body must be an <video> element");
|
||||||
|
@ -24,7 +25,6 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="log"></div>
|
<div id="log"></div>
|
||||||
<iframe id="testframe" onload="t.step(frameLoaded)"
|
<iframe id="testframe" onload="t.step(frameLoaded)" src="/media/white.webm"></iframe>
|
||||||
src="data:video/webm,"></iframe>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue