Open Bug 1064611 Opened 10 years ago Updated 2 years ago

Allow requesting cached content from nsIWebNavigation

Categories

(Core :: DOM: Navigation, defect)

x86_64
Linux
defect

Tracking

()

People

(Reporter: wesj, Unassigned)

References

Details

Attachments

(1 file)

For Fennec, we'd like some way for users to get to cache content when they're offline. That may be through a button on the error page ("Load a cached version of this page"), or maybe by just using cached content when we detect there's no network (or both?).

Currently, Channels and requests have a way to requested cache content, but there's nothing exposed to nsIWebNavigation. I'd like to expose one.
Attached patch WIP PatchSplinter Review
bz, I heard you talked to finkle about this a bit once. Ignoring the Fennec bits, does this look like the right track?
Attachment #8486107 - Flags: feedback?(bzbarsky)
Adding some other bugs that could use this feature.

A link to some recent buzz about this kind of feature in Chrome:
http://addyosmani.com/blog/offline-mode-chrome/
Comment on attachment 8486107 [details] [diff] [review]
WIP Patch

>+++ b/docshell/base/nsDocShellLoadTypes.h

The change to this file is not needed.

The interaction with the LOAD_FLAGS_BYPASS_CACHE flag needs to at least be documented.  Ideally, one or the other would be explicitly ignored by masking it off if the other is set, because I expect that setting both nsIRequest::LOAD_FROM_CACHE and nsIRequest::LOAD_BYPASS_CACHE on the channel will at best do something random and at worst make necko very confused.

Apart from that this looks reasonable.
Attachment #8486107 - Flags: feedback?(bzbarsky) → feedback+
I was looking into writing some tests for this and noticed that setting this on the webnavigation object won't actually load pages in subframes from the cache. Conversely, setting it as defaultLoadFlags of the docshell will, so I think maybe that's a better approach for us anyway. I'm chasing that approach unless someone tells me its crazy.
Attachment #8486107 - Flags: feedback?(mconley)
Comment on attachment 8486107 [details] [diff] [review]
WIP Patch

Review of attachment 8486107 [details] [diff] [review]:
-----------------------------------------------------------------

The docshell changes look reasonable to me.

I'm not 100% sure when adding constants like that, but do you need to bump the UUID's on the IDL's you've changed?
Attachment #8486107 - Flags: feedback?(mconley) → feedback+
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: