Bug 989576 - Followup, stop using mParser->GetEncoding(). r=neil
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Thu, 03 Apr 2014 16:24:21 +0900
changeset 176845 b1c988d5a43de8ef7af8ac54986127218d6edb36
parent 176844 a95e1a0fb26bb399d75ee0a396fc4a71ca012e0b
child 176846 bd6042e867113dd6a4a142b33453a29ea7c95e97
push id41861
push userVYV03354@nifty.ne.jp
push dateThu, 03 Apr 2014 07:27:14 +0000
treeherdermozilla-inbound@b1c988d5a43d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersneil
bugs989576
milestone31.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 989576 - Followup, stop using mParser->GetEncoding(). r=neil
netwerk/streamconv/converters/nsIndexedToHTML.cpp
--- a/netwerk/streamconv/converters/nsIndexedToHTML.cpp
+++ b/netwerk/streamconv/converters/nsIndexedToHTML.cpp
@@ -728,20 +728,16 @@ nsIndexedToHTML::OnIndexAvailable(nsIReq
             break;
         default:
             pushBuffer.AppendLiteral("file");
             break;
     }
 
     pushBuffer.AppendLiteral("\" href=\"");
 
-    nsXPIDLCString encoding;
-    rv = mParser->GetEncoding(getter_Copies(encoding));
-    if (NS_FAILED(rv)) return rv;
-
     // need to escape links
     nsAutoCString locEscaped;
 
     // Adding trailing slash helps to recognize whether the URL points to a file
     // or a directory (bug #214405).
     if ((type == nsIDirIndex::TYPE_DIRECTORY) && (loc.Last() != '/')) {
         loc.Append('/');
     }
@@ -749,36 +745,30 @@ nsIndexedToHTML::OnIndexAvailable(nsIReq
     // now minimally re-escape the location...
     uint32_t escFlags;
     // for some protocols, we expect the location to be absolute.
     // if so, and if the location indeed appears to be a valid URI, then go
     // ahead and treat it like one.
     if (mExpectAbsLoc &&
         NS_SUCCEEDED(net_ExtractURLScheme(loc, nullptr, nullptr, nullptr))) {
         // escape as absolute 
-        escFlags = esc_Forced | esc_OnlyASCII | esc_AlwaysCopy | esc_Minimal;
+        escFlags = esc_Forced | esc_AlwaysCopy | esc_Minimal;
     }
     else {
         // escape as relative
         // esc_Directory is needed because directories have a trailing slash.
         // Without it, the trailing '/' will be escaped, and links from within
         // that directory will be incorrect
-        escFlags = esc_Forced | esc_OnlyASCII | esc_AlwaysCopy | esc_FileBaseName | esc_Colon | esc_Directory;
+        escFlags = esc_Forced | esc_AlwaysCopy | esc_FileBaseName | esc_Colon | esc_Directory;
     }
     NS_EscapeURL(loc.get(), loc.Length(), escFlags, locEscaped);
     // esc_Directory does not escape the semicolons, so if a filename
     // contains semicolons we need to manually escape them.
     // This replacement should be removed in bug #473280
     locEscaped.ReplaceSubstring(";", "%3b");
-    if (!encoding.EqualsLiteral("UTF-8")) {
-        // Escape all non-ASCII bytes to preserve the raw value.
-        nsAutoCString outstr;
-        NS_EscapeURL(locEscaped, esc_AlwaysCopy | esc_OnlyNonASCII, outstr);
-        locEscaped = outstr;
-    }
     nsAdoptingCString htmlEscapedURL(nsEscapeHTML(locEscaped.get()));
     pushBuffer.Append(htmlEscapedURL);
 
     pushBuffer.AppendLiteral("\">");
 
     if (type == nsIDirIndex::TYPE_FILE || type == nsIDirIndex::TYPE_UNKNOWN) {
         pushBuffer.AppendLiteral("<img src=\"moz-icon://");
         int32_t lastDot = locEscaped.RFindChar('.');