mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Handle session history navigation across a document.open with nothing written. Bug 376064, r=biesi, sr=jst, a=schrep
This commit is contained in:
parent
e2a623f614
commit
e988f1f7ae
@ -46,7 +46,7 @@
|
||||
#include "nsICacheService.h"
|
||||
#include "nsICacheSession.h"
|
||||
#include "nsIParser.h"
|
||||
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
PRLogModuleInfo * gWyciwygLog = nsnull;
|
||||
|
||||
@ -305,7 +305,17 @@ nsWyciwygChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctx)
|
||||
|
||||
// open a cache entry for this channel...
|
||||
PRBool delayed = PR_FALSE;
|
||||
nsresult rv = OpenCacheEntry(spec, nsICache::ACCESS_READ, &delayed);
|
||||
nsresult rv = OpenCacheEntry(spec, nsICache::ACCESS_READ, &delayed);
|
||||
if (rv == NS_ERROR_CACHE_KEY_NOT_FOUND) {
|
||||
nsCOMPtr<nsIRunnable> ev =
|
||||
new nsRunnableMethod<nsWyciwygChannel>(this,
|
||||
&nsWyciwygChannel::NotifyListener);
|
||||
// Overwrite rv on purpose; if event dispatch fails we'll bail, and
|
||||
// otherwise we'll wait until the event fires before calling back.
|
||||
rv = NS_DispatchToCurrentThread(ev);
|
||||
delayed = PR_TRUE;
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
LOG(("nsWyciwygChannel::OpenCacheEntry failed [rv=%x]\n", rv));
|
||||
return rv;
|
||||
@ -477,18 +487,7 @@ nsWyciwygChannel::OnCacheEntryAvailable(nsICacheEntryDescriptor * aCacheEntry, n
|
||||
if (NS_FAILED(rv)) {
|
||||
CloseCacheEntry(rv);
|
||||
|
||||
if (mListener) {
|
||||
mListener->OnStartRequest(this, mListenerContext);
|
||||
mListener->OnStopRequest(this, mListenerContext, mStatus);
|
||||
mListener = 0;
|
||||
mListenerContext = 0;
|
||||
}
|
||||
|
||||
mIsPending = PR_FALSE;
|
||||
|
||||
// Remove ourselves from the load group.
|
||||
if (mLoadGroup)
|
||||
mLoadGroup->RemoveRequest(this, nsnull, mStatus);
|
||||
NotifyListener();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -652,4 +651,22 @@ nsWyciwygChannel::WriteCharsetAndSourceToCache(PRInt32 aSource,
|
||||
mCacheEntry->SetMetaDataElement("charset-source", source.get());
|
||||
}
|
||||
|
||||
void
|
||||
nsWyciwygChannel::NotifyListener()
|
||||
{
|
||||
if (mListener) {
|
||||
mListener->OnStartRequest(this, mListenerContext);
|
||||
mListener->OnStopRequest(this, mListenerContext, mStatus);
|
||||
mListener = 0;
|
||||
mListenerContext = 0;
|
||||
}
|
||||
|
||||
mIsPending = PR_FALSE;
|
||||
|
||||
// Remove ourselves from the load group.
|
||||
if (mLoadGroup) {
|
||||
mLoadGroup->RemoveRequest(this, nsnull, mStatus);
|
||||
}
|
||||
}
|
||||
|
||||
// vim: ts=2 sw=2
|
||||
|
@ -86,6 +86,8 @@ protected:
|
||||
|
||||
void WriteCharsetAndSourceToCache(PRInt32 aSource,
|
||||
const nsCString& aCharset);
|
||||
|
||||
void NotifyListener();
|
||||
|
||||
nsresult mStatus;
|
||||
PRPackedBool mIsPending;
|
||||
|
Loading…
Reference in New Issue
Block a user