2015-05-03 19:32:37 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2015-03-18 16:46:38 +00: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/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_workers_ServiceWorkerScriptCache_h
|
|
|
|
#define mozilla_dom_workers_ServiceWorkerScriptCache_h
|
|
|
|
|
|
|
|
#include "nsString.h"
|
|
|
|
|
2015-07-02 12:54:00 +00:00
|
|
|
class nsILoadGroup;
|
2015-03-18 16:46:38 +00:00
|
|
|
class nsIPrincipal;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
namespace workers {
|
|
|
|
|
2016-03-16 18:51:11 +00:00
|
|
|
class ServiceWorkerRegistrationInfo;
|
|
|
|
|
2015-03-18 16:46:38 +00:00
|
|
|
namespace serviceWorkerScriptCache {
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
PurgeCache(nsIPrincipal* aPrincipal, const nsAString& aCacheName);
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
GenerateCacheName(nsAString& aName);
|
|
|
|
|
2015-03-18 16:52:54 +00:00
|
|
|
class CompareCallback
|
|
|
|
{
|
|
|
|
public:
|
2015-04-14 04:05:28 +00:00
|
|
|
/*
|
|
|
|
* If there is an error, ignore aInCacheAndEqual and aNewCacheName.
|
|
|
|
* On success, if the cached result and network result matched,
|
|
|
|
* aInCacheAndEqual will be true and no new cache name is passed, otherwise
|
|
|
|
* use the new cache name to load the ServiceWorker.
|
|
|
|
*/
|
|
|
|
virtual void
|
|
|
|
ComparisonResult(nsresult aStatus,
|
|
|
|
bool aInCacheAndEqual,
|
2015-05-06 05:17:20 +00:00
|
|
|
const nsAString& aNewCacheName,
|
|
|
|
const nsACString& aMaxScope) = 0;
|
2015-03-18 16:52:54 +00:00
|
|
|
|
2015-03-24 22:54:25 +00:00
|
|
|
NS_IMETHOD_(MozExternalRefCountType) AddRef() = 0;
|
|
|
|
NS_IMETHOD_(MozExternalRefCountType) Release() = 0;
|
2015-03-18 16:52:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nsresult
|
2015-10-26 02:59:48 +00:00
|
|
|
Compare(ServiceWorkerRegistrationInfo* aRegistration,
|
|
|
|
nsIPrincipal* aPrincipal, const nsAString& aCacheName,
|
2015-06-23 17:50:04 +00:00
|
|
|
const nsAString& aURL, CompareCallback* aCallback, nsILoadGroup* aLoadGroup);
|
2015-03-18 16:52:54 +00:00
|
|
|
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace serviceWorkerScriptCache
|
2015-03-18 16:46:38 +00:00
|
|
|
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace workers
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2015-03-18 16:46:38 +00:00
|
|
|
|
|
|
|
#endif // mozilla_dom_workers_ServiceWorkerScriptCache_h
|