Closed Bug 1644694 Opened 4 years ago Closed 4 years ago

Do not call mozilla::dom::FallbackEncoding::FromLocale() in nsIndexedToHTML.cpp

Categories

(Core :: Networking: File, task, P2)

task

Tracking

()

RESOLVED FIXED
mozilla79
Tracking Status
firefox79 --- fixed

People

(Reporter: hsivonen, Assigned: hsivonen)

References

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file)

nsIndexedToHTML.cpp has this bit of code:

  // unescape may fail because
  // 1. file URL may be encoded in platform charset for backward compatibility
  // 2. query part may not be encoded in UTF-8 (see bug 261929)
  // so try the platform's default if this is file url
  if (NS_FAILED(rv) && uri->SchemeIs("file") && !NS_IsNativeUTF8()) {
    auto encoding = mozilla::dom::FallbackEncoding::FromLocale();
    nsAutoCString charset;
    encoding->Name(charset);
    rv = mTextToSubURI->UnEscapeAndConvert(charset, titleUri, unEscapeSpec);
  }

The only platform where NS_IsNativeUTF8() returns false is Windows, which supports both UTF-8 file; URLs and legacy "ANSI" codepage file: URLs. However, our own directory listing code appears to always generate UTF-8 file: URLs, so it should be OK to remove this block.

Blocks: 1603712
Severity: -- → S3
Priority: -- → P2
Whiteboard: [necko-triaged]
Pushed by hsivonen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a644e527a77f
Do not call mozilla::dom::FallbackEncoding::FromLocale() in nsIndexedToHTML.cpp. r=valentin
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla79
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: