Bug 1948808 - Part 3: Add ChromeUtils.clearResourceCache. r=emilio,tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D238582
This commit is contained in:
@@ -70,6 +70,7 @@
|
||||
#include "nsDocShell.h"
|
||||
#include "nsIException.h"
|
||||
#include "VsyncSource.h"
|
||||
#include "imgLoader.h"
|
||||
|
||||
#ifdef XP_UNIX
|
||||
# include <errno.h>
|
||||
@@ -1611,6 +1612,15 @@ void ChromeUtils::ClearScriptCache(GlobalObject&,
|
||||
: Nothing());
|
||||
}
|
||||
|
||||
void ChromeUtils::ClearResourceCache(GlobalObject&,
|
||||
const Optional<bool>& aChrome) {
|
||||
Maybe<bool> chrome = aChrome.WasPassed() ? Some(aChrome.Value()) : Nothing();
|
||||
SharedStyleSheetCache::Clear(chrome);
|
||||
SharedScriptCache::Clear(chrome);
|
||||
imgLoader::PrivateBrowsingLoader()->ClearCache(chrome);
|
||||
imgLoader::NormalLoader()->ClearCache(chrome);
|
||||
}
|
||||
|
||||
#define PROCTYPE_TO_WEBIDL_CASE(_procType, _webidl) \
|
||||
case mozilla::ProcType::_procType: \
|
||||
return WebIDLProcType::_webidl
|
||||
|
||||
@@ -216,6 +216,9 @@ class ChromeUtils {
|
||||
static void ClearScriptCache(GlobalObject& aGlobal,
|
||||
const Optional<bool>& aChrome);
|
||||
|
||||
static void ClearResourceCache(GlobalObject& aGlobal,
|
||||
const Optional<bool>& aChrome);
|
||||
|
||||
static void SetPerfStatsCollectionMask(GlobalObject& aGlobal, uint64_t aMask);
|
||||
|
||||
static already_AddRefed<Promise> CollectPerfStats(GlobalObject& aGlobal,
|
||||
|
||||
@@ -269,6 +269,15 @@ namespace ChromeUtils {
|
||||
*/
|
||||
undefined clearScriptCache(optional boolean chrome);
|
||||
|
||||
/**
|
||||
* Clears the entire resource cache (stylesheets, JavaScripts, and images).
|
||||
*
|
||||
* If chrome parameter is passed and true, this clears chrome cache.
|
||||
* If chrome parameter is passed and false, this clears content cache.
|
||||
* If chrome parameter is not passed, this clears all cache.
|
||||
*/
|
||||
undefined clearResourceCache(optional boolean chrome);
|
||||
|
||||
/**
|
||||
* Clears the Messaging Layer Security state by schemeless site.
|
||||
* This includes associated state-partitioned cache.
|
||||
|
||||
Reference in New Issue
Block a user