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 \ editor \
plugin \ plugin \
txtsvc \ txtsvc \
uriloader \
$(NULL) $(NULL)
CPPSRCS = \ CPPSRCS = \

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -103,6 +103,11 @@ protected:
* Used when "Save Link As..." doesn't see the headers quickly enough to choose * Used when "Save Link As..." doesn't see the headers quickly enough to choose
* a filename. See nsContextMenu.js. * 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__ */ #endif /* nsURILoader_h__ */