Closed Bug 1286792 Opened 8 years ago Closed 8 years ago

Remove DecodeRFC2047Header() from nsMIMEHeaderParamImpl.cpp

Categories

(Core :: Networking, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: jorgk-bmo, Unassigned)

Details

(Whiteboard: [necko-would-take])

DecodeRFC2047Header() is no longer used since Thunderbird completely switched over to using its own JSMime implementation in bug 1146099.

Therefore DecodeRFC2047Header() can be removed. It is also not used by any add-on:
https://dxr.mozilla.org/addons/search?q=DecodeRFC2047Header&redirect=false

So as per bug 1146099 comment #37, quoting Patrick McManus:
  if you searched the addons repo for it you can make a patch to remove it.
Whiteboard: [necko-would-take]
I've looked into it further. The function which is no longer in use is:

NS_IMETHODIMP
nsMIMEHeaderParamImpl::DecodeRFC2047Header(const char* aHeaderVal, 
                                           const char* aDefaultCharset, 
                                           bool aOverrideCharset, 
                                           bool aEatContinuations,
                                           nsACString& aResult)
{
  return internalDecodeRFC2047Header(aHeaderVal, aDefaultCharset,
                                     aOverrideCharset, aEatContinuations,
                                     aResult);
}

Removing this would only make sense if the worker function internalDecodeRFC2047Header could also be removed.

However, this is called via nsMIMEHeaderParamImpl::GetParameterHTTP. Some basic browsing brought up this call stack:

internalDecodeRFC2047Header(...) Line 738	C++
internalDecodeParameter(...) Line 945	C++
nsMIMEHeaderParamImpl::DoGetParameter(...) Line 95	C++
nsMIMEHeaderParamImpl::GetParameterHTTP(...) Line 67	C++
nsContentTypeParser::GetParameter(...) Line 6034	C++
nsContentTypeParser::GetType(...) Line 6039	C++
ParseTypeAttribute(...) Line 1188	C++
nsScriptLoader::ProcessScriptElement(...) Line 1287	C++
nsScriptElement::MaybeProcessScript(...) Line 141	C++
nsIScriptElement::AttemptToExecute(...) Line 221	C++
nsXMLContentSink::CloseElement(...) Line 562	C++
nsXMLContentSink::HandleEndElement(...) Line 1055	C++
nsXMLContentSink::HandleEndElement(...) Line 1013	C++
nsExpatDriver::HandleEndElement(...) Line 397	C++
Driver_HandleEndElement(...) Line 80	C++
doContent(...) Line 2474	C
contentProcessor(...) Line 2098	C
doProlog(...) Line 4078	C
prologProcessor(...) Line 3812	C
MOZ_XML_ResumeParser(...) Line 1824	C
nsExpatDriver::ParseBuffer(...) Line 1003	C++
nsExpatDriver::ConsumeToken(...) Line 1105	C++
nsParser::Tokenize(...) Line 1944	C++
nsParser::ResumeParse(...) Line 1462	C++

Conclusion: Sounded like a nice idea to remove dead code, but it's not really dead at all.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.