Closed Bug 475344 Opened 11 years ago Closed 11 years ago

Need a cancellation code to indicate successful load from cache

Categories

(Core :: Networking, defect)

defect
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: neil, Assigned: neil)

Details

Attachments

(1 file)

Currently the code NS_IMAGELIB_ERROR_LOAD_ABORTED is handled specially in nsDocumentViewer to fire onload handlers even though the channel was cancelled (in this case because the image was in the image cache). The XUL prototype cache could do with this behaviour too; it currently works around it by providing a dummy channel that doesn't need to be aborted. See bug 206691.
I don't really like putting an error code into nsNetError that's not used by necko in any way. I'm not really sure what a better place would be though :/

uriloader might be low enough in the dependency tree, and it also doesn't seem entirely inappropriate to put it there.
OK, so my #define now looks like this:

>diff uriloader/base/nsURILoader.h
>@@ 107,0 107,6 @@
>+
>+/**
>+ * Used when a load can be satisfied from a cache of decoded data,
>+ * rather than having to load from the original source or the network cache.
>+ */
>+#define NS_ERROR_something NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_URILOADER, something /*33?*/)
nsURILoader.h is not exported.  You might want to just create a new header that is and put this in it.

We could call it NS_ERROR_PARSED_DATA_CACHED perhaps?
Attached patch Proposed patchSplinter Review
Not sure who else I can ask for review here :-(
Assignee: nobody → neil
Status: NEW → ASSIGNED
Attachment #361485 - Flags: review?(bzbarsky)
Attachment #361485 - Flags: superreview+
Attachment #361485 - Flags: review?(bzbarsky)
Attachment #361485 - Flags: review+
Comment on attachment 361485 [details] [diff] [review]
Proposed patch

Yeah, this looks fine.
Pushed changeset 1e74329357e3 to mozilla-central.
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Comment on attachment 361485 [details] [diff] [review]
Proposed patch

I need this on branch for the media cache, which is P1...
Comment on attachment 361485 [details] [diff] [review]
Proposed patch

Actually, let me just cancel this request and use ImageErrors.h on branch.
You need to log in before you can comment on or make changes to this bug.