зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1337056 - Part 5: Add support for finer-grained permission update messages to ContentParent, r=baku
MozReview-Commit-ID: 6y6eBLWPTue
This commit is contained in:
Родитель
ce8ac3bacf
Коммит
13c3e3acbe
|
@ -2055,7 +2055,6 @@ ContentParent::ContentParent(ContentParent* aOpener,
|
|||
, mNumDestroyingTabs(0)
|
||||
, mIsAvailable(true)
|
||||
, mIsAlive(true)
|
||||
, mSendPermissionUpdates(false)
|
||||
, mIsForBrowser(!mRemoteType.IsEmpty())
|
||||
, mCalledClose(false)
|
||||
, mCalledKillHard(false)
|
||||
|
@ -5046,6 +5045,12 @@ ContentParent::EnsurePermissionsByKey(const nsCString& aKey)
|
|||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::NeedsPermissionsUpdate(const nsACString& aPermissionKey) const
|
||||
{
|
||||
return mActivePermissionKeys.Contains(aPermissionKey);
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
ContentParent::RecvAccumulateChildHistograms(
|
||||
InfallibleTArray<Accumulation>&& aAccumulations)
|
||||
|
|
|
@ -377,10 +377,7 @@ public:
|
|||
return mScriptableHelper;
|
||||
}
|
||||
|
||||
bool NeedsPermissionsUpdate() const
|
||||
{
|
||||
return mSendPermissionUpdates;
|
||||
}
|
||||
bool NeedsPermissionsUpdate(const nsACString& aPermissionKey) const;
|
||||
|
||||
/**
|
||||
* Kill our subprocess and make sure it dies. Should only be used
|
||||
|
@ -1168,7 +1165,6 @@ private:
|
|||
// still pass through.
|
||||
bool mIsAlive;
|
||||
|
||||
bool mSendPermissionUpdates;
|
||||
bool mIsForBrowser;
|
||||
|
||||
// These variables track whether we've called Close() and KillHard() on our
|
||||
|
|
|
@ -1568,11 +1568,14 @@ nsPermissionManager::AddInternal(nsIPrincipal* aPrincipal,
|
|||
IPC::Permission permission(origin, aType, aPermission,
|
||||
aExpireType, aExpireTime);
|
||||
|
||||
nsAutoCString permissionKey;
|
||||
GetKeyForPrincipal(aPrincipal, permissionKey);
|
||||
|
||||
nsTArray<ContentParent*> cplist;
|
||||
ContentParent::GetAll(cplist);
|
||||
for (uint32_t i = 0; i < cplist.Length(); ++i) {
|
||||
ContentParent* cp = cplist[i];
|
||||
if (cp->NeedsPermissionsUpdate())
|
||||
if (cp->NeedsPermissionsUpdate(permissionKey))
|
||||
Unused << cp->SendAddPermission(permission);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче