Bug 475344 Need a cancellation code to indicate successful load from cache r+sr=bz

This commit is contained in:
Neil Rashbrook 2009-02-16 11:27:22 +00:00
Родитель a727e0e60e
Коммит 1dd09e631a
9 изменённых файлов: 20 добавлений и 15 удалений

Просмотреть файл

@ -75,6 +75,7 @@ REQUIRES = xpcom \
editor \
plugin \
txtsvc \
uriloader \
$(NULL)
CPPSRCS = \

Просмотреть файл

@ -68,7 +68,7 @@
#include "nsIDOMElement.h"
#include "nsIDOMNSHTMLElement.h"
#include "nsContentErrors.h"
#include "ImageErrors.h"
#include "nsURILoader.h"
#include "nsIDocShell.h"
#include "nsIContentViewer.h"
#include "nsIMarkupDocumentViewer.h"
@ -235,9 +235,9 @@ ImageListener::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
imageLoader->RemoveObserver(imgDoc);
}
// |status| is NS_IMAGELIB_ERROR_LOAD_ABORTED if the image was found in
// the cache (bug 177747 comment 51).
if (status == NS_IMAGELIB_ERROR_LOAD_ABORTED) {
// |status| is NS_ERROR_PARSED_DATA_CACHED if the image was found in
// the cache (bug 177747 comment 51, bug 475344).
if (status == NS_ERROR_PARSED_DATA_CACHED) {
status = NS_OK;
}

Просмотреть файл

@ -71,7 +71,7 @@ REQUIRES = xpcom \
unicharutil \
appshell \
util \
imglib2 \
uriloader \
$(NULL)
CPPSRCS = nsXULControllers.cpp

Просмотреть файл

@ -125,7 +125,7 @@
#include "nsIXULWindow.h"
#include "nsXULPopupManager.h"
#include "nsCCUncollectableMarker.h"
#include "ImageErrors.h"
#include "nsURILoader.h"
//----------------------------------------------------------------------
//
@ -4514,8 +4514,7 @@ NS_IMETHODIMP
nsXULDocument::CachedChromeStreamListener::OnStartRequest(nsIRequest *request,
nsISupports* acontext)
{
// XXX need a proper cancel-but-run-onload-handlers return code (bug 475344)
return NS_IMAGELIB_ERROR_LOAD_ABORTED;
return NS_ERROR_PARSED_DATA_CACHED;
}

Просмотреть файл

@ -124,7 +124,7 @@
#include "nsITimelineService.h"
#include "nsGfxCIID.h"
#include "nsStyleSheetService.h"
#include "ImageErrors.h"
#include "nsURILoader.h"
#include "nsIPrompt.h"
#include "imgIContainer.h" // image animation mode constants
@ -971,11 +971,11 @@ DocumentViewerImpl::LoadComplete(nsresult aStatus)
// Now, fire either an OnLoad or OnError event to the document...
PRBool restoring = PR_FALSE;
// XXXbz imagelib kills off the document load for a full-page image with
// NS_IMAGELIB_ERROR_LOAD_ABORTED if it's in the cache. So we want to treat
// NS_ERROR_PARSED_DATA_CACHED if it's in the cache. So we want to treat
// that one as a success code; otherwise whether we fire onload for the image
// will depend on whether it's cached!
if(window &&
(NS_SUCCEEDED(aStatus) || aStatus == NS_IMAGELIB_ERROR_LOAD_ABORTED)) {
(NS_SUCCEEDED(aStatus) || aStatus == NS_ERROR_PARSED_DATA_CACHED)) {
if (mDocument)
mDocument->SetReadyStateInternal(nsIDocument::READYSTATE_COMPLETE);
nsEventStatus status = nsEventStatus_eIgnore;

Просмотреть файл

@ -48,6 +48,5 @@
#define NS_IMAGELIB_ERROR_FAILURE NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_IMGLIB, 5)
#define NS_IMAGELIB_ERROR_NO_DECODER NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_IMGLIB, 6)
#define NS_IMAGELIB_ERROR_NOT_FINISHED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_IMGLIB, 7)
#define NS_IMAGELIB_ERROR_LOAD_ABORTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_IMGLIB, 8)
#define NS_IMAGELIB_ERROR_NO_ENCODER NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_IMGLIB, 9)

Просмотреть файл

@ -58,6 +58,7 @@ REQUIRES = xpcom \
caps \
xpconnect \
js \
uriloader \
$(NULL)
CPPSRCS = \

Просмотреть файл

@ -59,7 +59,7 @@
#include "imgRequest.h"
#include "imgRequestProxy.h"
#include "ImageErrors.h"
#include "nsURILoader.h"
#include "ImageLogging.h"
#include "nsIComponentRegistrar.h"
@ -1210,7 +1210,7 @@ NS_IMETHODIMP imgLoader::LoadImageWithChannel(nsIChannel *channel, imgIDecoderOb
if (request) {
// we have this in our cache already.. cancel the current (document) load
channel->Cancel(NS_IMAGELIB_ERROR_LOAD_ABORTED); // this should fire an OnStopRequest
channel->Cancel(NS_ERROR_PARSED_DATA_CACHED); // this should fire an OnStopRequest
*listener = nsnull; // give them back a null nsIStreamListener
} else {

Просмотреть файл

@ -103,6 +103,11 @@ protected:
* Used when "Save Link As..." doesn't see the headers quickly enough to choose
* a filename. See nsContextMenu.js.
*/
#define NS_ERROR_SAVE_LINK_AS_TIMEOUT NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_URILOADER, 32);
#define NS_ERROR_SAVE_LINK_AS_TIMEOUT NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_URILOADER, 32)
/** Used when the data from a channel has already been parsed and cached
* so it doesn't need to be reparsed from the original source.
*/
#define NS_ERROR_PARSED_DATA_CACHED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_URILOADER, 33)
#endif /* nsURILoader_h__ */