Bug 639362 - Display text/cache-manifest data as text. r=bz

--HG--
extra : rebase_source : e8e30229a029b68b199efe7f0fba71dc142de980
This commit is contained in:
Matthew Noorenberghe 2012-07-13 23:13:20 -07:00
parent 09579d192a
commit 6ad5ac7bec
7 changed files with 36 additions and 0 deletions

View File

@ -555,6 +555,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
bool xhtml = !html && contentType.EqualsLiteral(APPLICATION_XHTML_XML);
bool plainText = !html && !xhtml && (contentType.EqualsLiteral(TEXT_PLAIN) ||
contentType.EqualsLiteral(TEXT_CSS) ||
contentType.EqualsLiteral(TEXT_CACHE_MANIFEST) ||
contentType.EqualsLiteral(APPLICATION_JAVASCRIPT) ||
contentType.EqualsLiteral(APPLICATION_XJAVASCRIPT) ||
contentType.EqualsLiteral(TEXT_ECMASCRIPT) ||

View File

@ -60,6 +60,7 @@ NS_NewContentViewer(nsIContentViewer** aResult);
static const char* const gHTMLTypes[] = {
TEXT_HTML,
TEXT_PLAIN,
TEXT_CACHE_MANIFEST,
TEXT_CSS,
TEXT_JAVASCRIPT,
TEXT_ECMASCRIPT,

View File

@ -67,6 +67,7 @@ NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult);
#define CONTENTDLF_CATEGORIES \
{ "Gecko-Content-Viewers", TEXT_HTML, "@mozilla.org/content/document-loader-factory;1" }, \
{ "Gecko-Content-Viewers", TEXT_PLAIN, "@mozilla.org/content/document-loader-factory;1" }, \
{ "Gecko-Content-Viewers", TEXT_CACHE_MANIFEST, "@mozilla.org/content/document-loader-factory;1" }, \
{ "Gecko-Content-Viewers", TEXT_CSS, "@mozilla.org/content/document-loader-factory;1" }, \
{ "Gecko-Content-Viewers", TEXT_JAVASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
{ "Gecko-Content-Viewers", TEXT_ECMASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \

View File

@ -127,6 +127,7 @@
#define TEXT_JAVASCRIPT "text/javascript"
#define TEXT_XSL "text/xsl"
#define TEXT_EVENT_STREAM "text/event-stream"
#define TEXT_CACHE_MANIFEST "text/cache-manifest"
#define VIDEO_MPEG "video/mpeg"
#define VIDEO_MP4 "video/mp4"

View File

@ -792,6 +792,7 @@ DetermineParseMode(const nsString& aBuffer, nsDTDMode& aParseMode,
if (aMimeType.EqualsLiteral(TEXT_HTML)) {
DetermineHTMLParseMode(aBuffer, aParseMode, aDocType);
} else if (aMimeType.EqualsLiteral(TEXT_PLAIN) ||
aMimeType.EqualsLiteral(TEXT_CACHE_MANIFEST) ||
aMimeType.EqualsLiteral(TEXT_CSS) ||
aMimeType.EqualsLiteral(APPLICATION_JAVASCRIPT) ||
aMimeType.EqualsLiteral(APPLICATION_XJAVASCRIPT) ||

View File

@ -56,11 +56,13 @@ MOCHITEST_FILES = parser_datreader.js \
iframe_bug599584.html \
test_bug613662.html \
test_bug613662.xhtml \
test_bug639362.html \
test_bug642908.html \
file_bug642908.sjs \
test_bug645115.html \
test_bug655682.html \
file_bug655682.sjs \
test_bug667533.html \
file_bug672453_not_declared.html \
file_bug672453_late_meta.html \
file_bug672453_meta_restart.html \

View File

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=639362
-->
<head>
<title>Test for Bug 639362</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=639362">Mozilla Bug 639362</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
function loaded(iframe) {
is(iframe.contentWindow.location.href, iframe.src, "should load correct URL");
is(iframe.contentDocument.body.textContent, 'CACHE MANIFEST', "text/cache-manifest should be treated as text");
SimpleTest.finish();
}
</script>
<iframe src="data:text/cache-manifest,CACHE MANIFEST" onload="loaded(this);"></iframe>
</body>
</html>