Bug 1061469 - part 8: Encoding for Imports. r=mrbkap

This commit is contained in:
Gabor Krizsanits 2014-10-06 11:43:58 +02:00
parent 5aa5cda7d5
commit 1cc3094af2
4 changed files with 41 additions and 0 deletions

View File

@ -3520,6 +3520,10 @@ nsDocument::SetDocumentCharacterSet(const nsACString& aCharSetID)
// but before we figure out what to do about non-Encoding Standard
// encodings in the charset menu and in mailnews, assertions are futile.
if (!mCharacterSet.Equals(aCharSetID)) {
if (mMasterDocument && !aCharSetID.EqualsLiteral("UTF-8")) {
// Imports are always UTF-8
return;
}
mCharacterSet = aCharSetID;
int32_t n = mCharSetObservers.Length();

View File

@ -0,0 +1,5 @@
<!DOCTYPE html>
<head>
<meta charset="EUC-KR">
</head>
<body>Ignore my encoding</body>

View File

@ -35,6 +35,7 @@ support-files =
file_cycle_5_B.html
file_cycle_5_C.html
file_cycle_5_D.html
file_encoding.html
[test_cycle_1.html]
skip-if = toolkit == 'gonk' # nested imports fail on b2g emulator
@ -46,3 +47,4 @@ skip-if = toolkit == 'gonk' # nested imports fail on b2g emulator
skip-if = toolkit == 'gonk' # nested imports fail on b2g emulator
[test_cycle_5.html]
skip-if = toolkit == 'gonk' # nested imports fail on b2g emulator
[test_encoding.html]

View File

@ -0,0 +1,30 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1061469
-->
<head>
<title>Test for Bug 1061469</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1061469">Mozilla Bug 1061469</a>
<script type="text/javascript">
SimpleTest.waitForExplicitFinish();
var success = false;
function loaded() {
success = true;
}
function failed() {
ok(false, "Import loading failed");
}
</script>
<link rel="import" href="file_encoding.html" id="import" onload="loaded()" onerror="failed()"></link>
<script type="text/javascript">
is(document.getElementById("import").import.characterSet, "UTF-8", "characterSet should be UTF-8 for imports");
SimpleTest.finish();
</script>
</body>
</html>