Closed Bug 1237783 Opened 4 years ago Closed 4 years ago

Add a pref to disable appcache

Categories

(Core :: Networking: HTTP, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla47
Tracking Status
firefox47 --- fixed

People

(Reporter: ehsan, Assigned: mayhemer)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

The pref needs to disable using appcache at the HTTP level, and also remove the DOM APIs.
Status: NEW → ASSIGNED
So, we already have following prefs for this:

- browser.cache.offline.enable 
- offline-apps.allow_by_default
- browser.offline-apps.notify

All are now by default true.  

Switching the *first two to false* will cause appcache be bypassed: no notification for update, no automatic updates (even for already cached content), no loading from appcache.

This tho causes "Offline mode" error when loading pages that have been offline-cached before this pref switch.  We need to patch that.
Attached patch v1 (obsolete) — Splinter Review
- fixes "offline mode" error page for previously offline-cached pages
- those pages now load from net as normal web pages
Attachment #8714940 - Flags: review?(ehsan)
(In reply to Honza Bambas (:mayhemer) from comment #1)
> Switching the *first two to false* 

With the fix the prompt has woken up.  *All three prefs* has to be switched to false.
We also need a pref for window.applicationCache and friends, right?
Comment on attachment 8714940 [details] [diff] [review]
v1

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

Is this not an issue in other places where we access nsIApplicationCacheChannel?
Attachment #8714940 - Flags: review?(ehsan) → review+
(In reply to :Ehsan Akhgari from comment #4)
> We also need a pref for window.applicationCache and friends, right?

I assume you want to make the window.applicationCache undefined?  I think there are no friends, this is the only object related to appcache we expose, AFAIK.  

These days I don't know how to do this.  Can you advise please?

(In reply to :Ehsan Akhgari from comment #5)
> Is this not an issue in other places where we access
> nsIApplicationCacheChannel?

Not sure what you mean, what is the concern.  The prefs when disabled do:

- browser.cache.offline.enable -> makes the appcache portion of HTTP cache disabled (cannot find existing entries, cannot create new ones, means stuff doesn't load from appcache at the first place)
- offline-apps.allow_by_default -> doesn't auto-grant offline-app permission on <html manifest="manifest">, so that we don't store appcache manifest and the resources
- browser.offline-apps.notify -> disables the notification "this app wants to store offline" that pops up when allow_by_default = false

Nothing else.  Consumers are OK to not find what they need on that interface.
Comment 5
Flags: needinfo?(ehsan)
(In reply to Honza Bambas (:mayhemer) from comment #6)
> (In reply to :Ehsan Akhgari from comment #4)
> > We also need a pref for window.applicationCache and friends, right?
> 
> I assume you want to make the window.applicationCache undefined?  I think
> there are no friends, this is the only object related to appcache we expose,
> AFAIK.  
> 
> These days I don't know how to do this.  Can you advise please?

Adding a [Pref] annotation in the WebIDL file should do it: <https://developer.mozilla.org/en-US/docs/Mozilla/WebIDL_bindings#Pref>

> (In reply to :Ehsan Akhgari from comment #5)
> > Is this not an issue in other places where we access
> > nsIApplicationCacheChannel?
> 
> Not sure what you mean, what is the concern.  The prefs when disabled do:
> 
> - browser.cache.offline.enable -> makes the appcache portion of HTTP cache
> disabled (cannot find existing entries, cannot create new ones, means stuff
> doesn't load from appcache at the first place)
> - offline-apps.allow_by_default -> doesn't auto-grant offline-app permission
> on <html manifest="manifest">, so that we don't store appcache manifest and
> the resources
> - browser.offline-apps.notify -> disables the notification "this app wants
> to store offline" that pops up when allow_by_default = false
> 
> Nothing else.  Consumers are OK to not find what they need on that interface.

OK, great!
Flags: needinfo?(ehsan)
Attached patch v1.1Splinter Review
and here we go, with windows.applicationCache object being preffed as well (tested both pref states)
Attachment #8714940 - Attachment is obsolete: true
Attachment #8716340 - Flags: review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/859e630d963c
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
Blocks: 1584984
You need to log in before you can comment on or make changes to this bug.