зеркало из https://github.com/mozilla/gecko-dev.git
Fix orange from bug 390168 by adopting a slightly different approach. Reviews from jst pending.
This commit is contained in:
Родитель
477faceaa0
Коммит
5c53461a8a
|
@ -57,7 +57,7 @@ PRLogModuleInfo * gWyciwygLog = nsnull;
|
||||||
nsWyciwygChannel::nsWyciwygChannel()
|
nsWyciwygChannel::nsWyciwygChannel()
|
||||||
: mStatus(NS_OK),
|
: mStatus(NS_OK),
|
||||||
mIsPending(PR_FALSE),
|
mIsPending(PR_FALSE),
|
||||||
mCharsetSet(PR_FALSE),
|
mNeedToWriteCharset(PR_FALSE),
|
||||||
mCharsetSource(kCharsetUninitialized),
|
mCharsetSource(kCharsetUninitialized),
|
||||||
mContentLength(-1),
|
mContentLength(-1),
|
||||||
mLoadFlags(LOAD_NORMAL)
|
mLoadFlags(LOAD_NORMAL)
|
||||||
|
@ -350,12 +350,9 @@ nsWyciwygChannel::WriteToCacheEntry(const nsAString &aData)
|
||||||
mCacheEntry->SetSecurityInfo(mSecurityInfo);
|
mCacheEntry->SetSecurityInfo(mSecurityInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mCharsetSet) {
|
if (mNeedToWriteCharset) {
|
||||||
mCacheEntry->SetMetaDataElement("charset", mCharset.get());
|
WriteCharsetAndSourceToCache(mCharsetSource, mCharset);
|
||||||
|
mNeedToWriteCharset = PR_FALSE;
|
||||||
nsCAutoString source;
|
|
||||||
source.AppendInt(mCharsetSource);
|
|
||||||
mCacheEntry->SetMetaDataElement("charset-source", source.get());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PRUint32 out;
|
PRUint32 out;
|
||||||
|
@ -406,9 +403,13 @@ nsWyciwygChannel::SetCharsetAndSource(PRInt32 aSource,
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG(!aCharset.IsEmpty());
|
NS_ENSURE_ARG(!aCharset.IsEmpty());
|
||||||
|
|
||||||
mCharsetSet = PR_TRUE;
|
if (mCacheEntry) {
|
||||||
mCharsetSource = aSource;
|
WriteCharsetAndSourceToCache(aSource, PromiseFlatCString(aCharset));
|
||||||
mCharset = aCharset;
|
} else {
|
||||||
|
mNeedToWriteCharset = PR_TRUE;
|
||||||
|
mCharsetSource = aSource;
|
||||||
|
mCharset = aCharset;
|
||||||
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -638,4 +639,17 @@ nsWyciwygChannel::ReadFromCache()
|
||||||
return mPump->AsyncRead(this, nsnull);
|
return mPump->AsyncRead(this, nsnull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsWyciwygChannel::WriteCharsetAndSourceToCache(PRInt32 aSource,
|
||||||
|
const nsCString& aCharset)
|
||||||
|
{
|
||||||
|
NS_PRECONDITION(mCacheEntry, "Better have cache entry!");
|
||||||
|
|
||||||
|
mCacheEntry->SetMetaDataElement("charset", aCharset.get());
|
||||||
|
|
||||||
|
nsCAutoString source;
|
||||||
|
source.AppendInt(aSource);
|
||||||
|
mCacheEntry->SetMetaDataElement("charset-source", source.get());
|
||||||
|
}
|
||||||
|
|
||||||
// vim: ts=2 sw=2
|
// vim: ts=2 sw=2
|
||||||
|
|
|
@ -84,9 +84,12 @@ protected:
|
||||||
nsresult ReadFromCache();
|
nsresult ReadFromCache();
|
||||||
nsresult OpenCacheEntry(const nsACString & aCacheKey, nsCacheAccessMode aWriteAccess, PRBool * aDelayFlag = nsnull);
|
nsresult OpenCacheEntry(const nsACString & aCacheKey, nsCacheAccessMode aWriteAccess, PRBool * aDelayFlag = nsnull);
|
||||||
|
|
||||||
|
void WriteCharsetAndSourceToCache(PRInt32 aSource,
|
||||||
|
const nsCString& aCharset);
|
||||||
|
|
||||||
nsresult mStatus;
|
nsresult mStatus;
|
||||||
PRPackedBool mIsPending;
|
PRPackedBool mIsPending;
|
||||||
PRPackedBool mCharsetSet;
|
PRPackedBool mNeedToWriteCharset;
|
||||||
PRInt32 mCharsetSource;
|
PRInt32 mCharsetSource;
|
||||||
nsCString mCharset;
|
nsCString mCharset;
|
||||||
PRInt32 mContentLength;
|
PRInt32 mContentLength;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче