mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 20:30:41 +00:00
Bug 1896709 - Part 11: Add PContent::ClearScriptCache. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215880
This commit is contained in:
parent
ae6f6b7552
commit
e3ca7477be
@ -41,6 +41,7 @@
|
||||
#include "mozilla/SchedulerGroup.h"
|
||||
#include "mozilla/ScopeExit.h"
|
||||
#include "mozilla/SharedStyleSheetCache.h"
|
||||
#include "mozilla/dom/SharedScriptCache.h"
|
||||
#include "mozilla/SimpleEnumerator.h"
|
||||
#include "mozilla/SpinEventLoopUntil.h"
|
||||
#include "mozilla/StaticPrefs_browser.h"
|
||||
@ -2130,6 +2131,16 @@ mozilla::ipc::IPCResult ContentChild::RecvClearStyleSheetCache(
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentChild::RecvClearScriptCache(
|
||||
const Maybe<RefPtr<nsIPrincipal>>& aForPrincipal,
|
||||
const Maybe<nsCString>& aBaseDomain) {
|
||||
nsIPrincipal* principal =
|
||||
aForPrincipal ? aForPrincipal.value().get() : nullptr;
|
||||
const nsCString* baseDomain = aBaseDomain ? aBaseDomain.ptr() : nullptr;
|
||||
SharedScriptCache::Clear(principal, baseDomain);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentChild::RecvClearImageCacheFromPrincipal(
|
||||
nsIPrincipal* aPrincipal) {
|
||||
imgLoader* loader;
|
||||
|
@ -252,6 +252,10 @@ class ContentChild final : public PContentChild,
|
||||
const Maybe<RefPtr<nsIPrincipal>>& aForPrincipal,
|
||||
const Maybe<nsCString>& aBaseDomain);
|
||||
|
||||
mozilla::ipc::IPCResult RecvClearScriptCache(
|
||||
const Maybe<RefPtr<nsIPrincipal>>& aForPrincipal,
|
||||
const Maybe<nsCString>& aBaseDomain);
|
||||
|
||||
mozilla::ipc::IPCResult RecvClearImageCacheFromPrincipal(
|
||||
nsIPrincipal* aPrincipal);
|
||||
mozilla::ipc::IPCResult RecvClearImageCacheFromBaseDomain(
|
||||
|
@ -666,6 +666,9 @@ child:
|
||||
async ClearStyleSheetCache(nullable nsIPrincipal? aForPrincipal,
|
||||
nsCString? aBaseDomain);
|
||||
|
||||
async ClearScriptCache(nullable nsIPrincipal? aForPrincipal,
|
||||
nsCString? aBaseDomain);
|
||||
|
||||
async SetOffline(bool offline);
|
||||
async SetConnectivity(bool connectivity);
|
||||
async SetCaptivePortalState(int32_t aState);
|
||||
|
@ -139,7 +139,16 @@ SharedScriptCache::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
|
||||
void SharedScriptCache::Clear(nsIPrincipal* aForPrincipal,
|
||||
const nsACString* aBaseDomain) {
|
||||
// TODO: Send message to content process.
|
||||
using ContentParent = dom::ContentParent;
|
||||
|
||||
if (XRE_IsParentProcess()) {
|
||||
auto forPrincipal = aForPrincipal ? Some(RefPtr(aForPrincipal)) : Nothing();
|
||||
auto baseDomain = aBaseDomain ? Some(nsCString(*aBaseDomain)) : Nothing();
|
||||
|
||||
for (auto* cp : ContentParent::AllProcesses(ContentParent::eLive)) {
|
||||
Unused << cp->SendClearScriptCache(forPrincipal, baseDomain);
|
||||
}
|
||||
}
|
||||
|
||||
if (sInstance) {
|
||||
sInstance->ClearInProcess(aForPrincipal, aBaseDomain);
|
||||
|
Loading…
x
Reference in New Issue
Block a user