Skip to content

Commit

Permalink
Bug 1629707 - make SessionStorage support StoragePrincipal; r=baku
Browse files Browse the repository at this point in the history
  • Loading branch information
xeonchen committed Apr 29, 2020
1 parent 0047d68 commit 100b60e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion dom/storage/SessionStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ NS_IMPL_RELEASE_INHERITED(SessionStorage, Storage)

SessionStorage::SessionStorage(nsPIDOMWindowInner* aWindow,
nsIPrincipal* aPrincipal,
nsIPrincipal* aStoragePrincipal,
SessionStorageCache* aCache,
SessionStorageManager* aManager,
const nsAString& aDocumentURI, bool aIsPrivate)
: Storage(aWindow, aPrincipal, aPrincipal),
: Storage(aWindow, aPrincipal, aStoragePrincipal),
mCache(aCache),
mManager(aManager),
mDocumentURI(aDocumentURI),
Expand Down
5 changes: 3 additions & 2 deletions dom/storage/SessionStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ class SessionStorage final : public Storage {
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SessionStorage, Storage)

SessionStorage(nsPIDOMWindowInner* aWindow, nsIPrincipal* aPrincipal,
SessionStorageCache* aCache, SessionStorageManager* aManager,
const nsAString& aDocumentURI, bool aIsPrivate);
nsIPrincipal* aStoragePrincipal, SessionStorageCache* aCache,
SessionStorageManager* aManager, const nsAString& aDocumentURI,
bool aIsPrivate);

StorageType Type() const override { return eSessionStorage; }

Expand Down
11 changes: 6 additions & 5 deletions dom/storage/SessionStorageManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ SessionStorageManager::CreateStorage(mozIDOMWindow* aWindow,

nsCOMPtr<nsPIDOMWindowInner> inner = nsPIDOMWindowInner::From(aWindow);

// No StoragePrincipal for sessionStorage.
RefPtr<SessionStorage> storage = new SessionStorage(
inner, aPrincipal, cache, this, aDocumentURI, aPrivate);
RefPtr<SessionStorage> storage =
new SessionStorage(inner, aPrincipal, aStoragePrincipal, cache, this,
aDocumentURI, aPrivate);

storage.forget(aRetval);
return NS_OK;
Expand All @@ -194,8 +194,9 @@ SessionStorageManager::GetStorage(mozIDOMWindow* aWindow,

nsCOMPtr<nsPIDOMWindowInner> inner = nsPIDOMWindowInner::From(aWindow);

RefPtr<SessionStorage> storage = new SessionStorage(
inner, aStoragePrincipal, cache, this, EmptyString(), aPrivate);
RefPtr<SessionStorage> storage =
new SessionStorage(inner, aPrincipal, aStoragePrincipal, cache, this,
EmptyString(), aPrivate);

storage.forget(aRetval);
return NS_OK;
Expand Down

0 comments on commit 100b60e

Please sign in to comment.