mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Fix orange from bug 390168 by adopting a slightly different approach. Reviews from jst pending.
This commit is contained in:
parent
bbaf727b9d
commit
ee50c0fc2c
@ -57,7 +57,7 @@ PRLogModuleInfo * gWyciwygLog = nsnull;
|
||||
nsWyciwygChannel::nsWyciwygChannel()
|
||||
: mStatus(NS_OK),
|
||||
mIsPending(PR_FALSE),
|
||||
mCharsetSet(PR_FALSE),
|
||||
mNeedToWriteCharset(PR_FALSE),
|
||||
mCharsetSource(kCharsetUninitialized),
|
||||
mContentLength(-1),
|
||||
mLoadFlags(LOAD_NORMAL)
|
||||
@ -350,12 +350,9 @@ nsWyciwygChannel::WriteToCacheEntry(const nsAString &aData)
|
||||
mCacheEntry->SetSecurityInfo(mSecurityInfo);
|
||||
}
|
||||
|
||||
if (mCharsetSet) {
|
||||
mCacheEntry->SetMetaDataElement("charset", mCharset.get());
|
||||
|
||||
nsCAutoString source;
|
||||
source.AppendInt(mCharsetSource);
|
||||
mCacheEntry->SetMetaDataElement("charset-source", source.get());
|
||||
if (mNeedToWriteCharset) {
|
||||
WriteCharsetAndSourceToCache(mCharsetSource, mCharset);
|
||||
mNeedToWriteCharset = PR_FALSE;
|
||||
}
|
||||
|
||||
PRUint32 out;
|
||||
@ -406,9 +403,13 @@ nsWyciwygChannel::SetCharsetAndSource(PRInt32 aSource,
|
||||
{
|
||||
NS_ENSURE_ARG(!aCharset.IsEmpty());
|
||||
|
||||
mCharsetSet = PR_TRUE;
|
||||
mCharsetSource = aSource;
|
||||
mCharset = aCharset;
|
||||
if (mCacheEntry) {
|
||||
WriteCharsetAndSourceToCache(aSource, PromiseFlatCString(aCharset));
|
||||
} else {
|
||||
mNeedToWriteCharset = PR_TRUE;
|
||||
mCharsetSource = aSource;
|
||||
mCharset = aCharset;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -638,4 +639,17 @@ nsWyciwygChannel::ReadFromCache()
|
||||
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
|
||||
|
@ -83,10 +83,13 @@ public:
|
||||
protected:
|
||||
nsresult ReadFromCache();
|
||||
nsresult OpenCacheEntry(const nsACString & aCacheKey, nsCacheAccessMode aWriteAccess, PRBool * aDelayFlag = nsnull);
|
||||
|
||||
void WriteCharsetAndSourceToCache(PRInt32 aSource,
|
||||
const nsCString& aCharset);
|
||||
|
||||
nsresult mStatus;
|
||||
PRPackedBool mIsPending;
|
||||
PRPackedBool mCharsetSet;
|
||||
PRPackedBool mNeedToWriteCharset;
|
||||
PRInt32 mCharsetSource;
|
||||
nsCString mCharset;
|
||||
PRInt32 mContentLength;
|
||||
|
Loading…
Reference in New Issue
Block a user