mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1509132 - Inform the 3rd party tracker window when the storage permission is granted, r=ehsan
This is needed for the LocalStorage Next-Generation project which sends storage notifications only to content processes with an existing LocalStorage object. I cannot write a test for this, because the current localStorage all works fine.
This commit is contained in:
parent
b9f5f08c7f
commit
5368c7288c
@ -7986,6 +7986,25 @@ nsGlobalWindowInner::ForgetSharedWorker(SharedWorker* aSharedWorker)
|
||||
mSharedWorkers.RemoveElement(aSharedWorker);
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindowInner::StorageAccessGranted()
|
||||
{
|
||||
// If we have a partitioned localStorage, it's time to replace it with a real
|
||||
// one in order to receive notifications.
|
||||
|
||||
if (mLocalStorage &&
|
||||
mLocalStorage->Type() == Storage::ePartitionedLocalStorage) {
|
||||
IgnoredErrorResult error;
|
||||
GetLocalStorage(error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mLocalStorage &&
|
||||
mLocalStorage->Type() == Storage::eLocalStorage);
|
||||
}
|
||||
}
|
||||
|
||||
mozilla::dom::TabGroup*
|
||||
nsPIDOMWindowInner::TabGroup()
|
||||
{
|
||||
|
@ -1241,6 +1241,11 @@ public:
|
||||
// area.
|
||||
nsIPrincipal* GetTopLevelStorageAreaPrincipal();
|
||||
|
||||
// This method is called if this window loads a 3rd party tracking resource
|
||||
// and the storage is just been granted. The window can reset the partitioned
|
||||
// storage objects and switch to the first party cookie jar.
|
||||
void StorageAccessGranted();
|
||||
|
||||
protected:
|
||||
static void NotifyDOMWindowDestroyed(nsGlobalWindowInner* aWindow);
|
||||
void NotifyWindowIDDestroyed(const char* aTopic);
|
||||
|
@ -536,6 +536,9 @@ AntiTrackingCommon::AddFirstPartyStorageAccessGrantedFor(nsIPrincipal* aPrincipa
|
||||
// Let's store the permission in the current parent window.
|
||||
topInnerWindow->SaveStorageAccessGranted(permissionKey);
|
||||
|
||||
// Let's inform the parent window.
|
||||
parentWindow->StorageAccessGranted();
|
||||
|
||||
nsIChannel* channel =
|
||||
pwin->GetCurrentInnerWindow()->GetExtantDoc()->GetChannel();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user