2008-08-27 03:09:02 +04:00
|
|
|
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
*
|
2012-05-21 15:12:37 +04:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2008-08-27 03:09:02 +04:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
|
|
|
interface nsIApplicationCache;
|
2012-06-06 06:08:30 +04:00
|
|
|
interface nsIFile;
|
2012-07-31 10:36:00 +04:00
|
|
|
interface nsIURI;
|
2013-09-20 13:11:25 +04:00
|
|
|
interface nsILoadContextInfo;
|
2008-08-27 03:09:02 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The application cache service manages the set of application cache
|
|
|
|
* groups.
|
|
|
|
*/
|
2016-01-18 22:20:08 +03:00
|
|
|
[scriptable, uuid(b8b6546c-6cec-4bda-82df-08e006a97b56)]
|
2008-08-27 03:09:02 +04:00
|
|
|
interface nsIApplicationCacheService : nsISupports
|
|
|
|
{
|
2012-07-31 10:36:00 +04:00
|
|
|
/**
|
|
|
|
* Create group string identifying cache group according the manifest
|
2016-01-18 22:20:08 +03:00
|
|
|
* URL and the given principal.
|
2012-07-31 10:36:00 +04:00
|
|
|
*/
|
2016-01-18 22:20:08 +03:00
|
|
|
ACString buildGroupIDForInfo(in nsIURI aManifestURL,
|
|
|
|
in nsILoadContextInfo aLoadContextInfo);
|
|
|
|
ACString buildGroupIDForSuffix(in nsIURI aManifestURL,
|
|
|
|
in ACString aOriginSuffix);
|
2012-10-02 17:55:00 +04:00
|
|
|
|
2008-08-27 03:09:02 +04:00
|
|
|
/**
|
|
|
|
* Create a new, empty application cache for the given cache
|
|
|
|
* group.
|
|
|
|
*/
|
|
|
|
nsIApplicationCache createApplicationCache(in ACString group);
|
|
|
|
|
2012-06-04 18:12:24 +04:00
|
|
|
/**
|
|
|
|
* Create a new, empty application cache for the given cache
|
|
|
|
* group residing in a custom directory with a custom quota.
|
|
|
|
*
|
|
|
|
* @param group
|
|
|
|
* URL of the manifest
|
|
|
|
* @param directory
|
|
|
|
* Actually a reference to a profile directory where to
|
|
|
|
* create the OfflineCache sub-dir.
|
|
|
|
* @param quota
|
|
|
|
* Optional override of the default quota.
|
|
|
|
*/
|
|
|
|
nsIApplicationCache createCustomApplicationCache(in ACString group,
|
2012-06-06 06:08:30 +04:00
|
|
|
in nsIFile profileDir,
|
2012-08-22 19:56:38 +04:00
|
|
|
in int32_t quota);
|
2012-06-04 18:12:24 +04:00
|
|
|
|
2008-08-27 03:09:02 +04:00
|
|
|
/**
|
|
|
|
* Get an application cache object for the given client ID.
|
|
|
|
*/
|
|
|
|
nsIApplicationCache getApplicationCache(in ACString clientID);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the currently active cache object for a cache group.
|
|
|
|
*/
|
|
|
|
nsIApplicationCache getActiveCache(in ACString group);
|
|
|
|
|
2008-11-04 21:59:12 +03:00
|
|
|
/**
|
|
|
|
* Deactivate the currently-active cache object for a cache group.
|
|
|
|
*/
|
|
|
|
void deactivateGroup(in ACString group);
|
|
|
|
|
2012-10-03 04:39:09 +04:00
|
|
|
/**
|
2016-01-18 22:20:08 +03:00
|
|
|
* Evict offline cache entries, either all of them or those belonging
|
|
|
|
* to the given origin.
|
|
|
|
*/
|
|
|
|
void evict(in nsILoadContextInfo aLoadContextInfo);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Delete caches whom origin attributes matches the given pattern.
|
2012-10-03 04:39:09 +04:00
|
|
|
*/
|
2016-01-18 22:20:08 +03:00
|
|
|
void evictMatchingOriginAttributes(in AString aPattern);
|
2012-10-03 04:39:09 +04:00
|
|
|
|
2008-08-27 03:09:02 +04:00
|
|
|
/**
|
|
|
|
* Try to find the best application cache to serve a resource.
|
|
|
|
*/
|
2012-07-31 10:36:00 +04:00
|
|
|
nsIApplicationCache chooseApplicationCache(in ACString key,
|
2013-09-20 13:11:25 +04:00
|
|
|
[optional] in nsILoadContextInfo aLoadContextInfo);
|
2008-09-30 22:34:23 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Flags the key as being opportunistically cached.
|
|
|
|
*
|
|
|
|
* This method should also propagate the entry to other
|
|
|
|
* application caches with the same opportunistic namespace, but
|
|
|
|
* this is not currently implemented.
|
|
|
|
*
|
|
|
|
* @param cache
|
|
|
|
* The cache in which the entry is cached now.
|
|
|
|
* @param key
|
|
|
|
* The cache entry key.
|
|
|
|
*/
|
|
|
|
void cacheOpportunistically(in nsIApplicationCache cache, in ACString key);
|
2009-02-22 22:09:10 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the list of application cache groups.
|
|
|
|
*/
|
2009-11-04 22:23:20 +03:00
|
|
|
void getGroups([optional] out unsigned long count,
|
2009-02-22 22:09:10 +03:00
|
|
|
[array, size_is(count), retval] out string groupIDs);
|
2012-03-31 04:52:06 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the list of application cache groups in the order of
|
|
|
|
* activating time.
|
|
|
|
*/
|
|
|
|
void getGroupsTimeOrdered([optional] out unsigned long count,
|
|
|
|
[array, size_is(count), retval] out string groupIDs);
|
2008-08-27 03:09:02 +04:00
|
|
|
};
|