зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1829819: Use persistenceType 'private' for private origins.r=janv,dom-storage-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D175916
This commit is contained in:
Родитель
278f7a5a30
Коммит
b249c3278f
|
@ -3460,8 +3460,10 @@ nsDOMWindowUtils::GetFileReferences(const nsAString& aDatabaseName, int64_t aId,
|
|||
RefPtr<IndexedDatabaseManager> mgr = IndexedDatabaseManager::Get();
|
||||
if (mgr) {
|
||||
nsresult rv = mgr->BlockAndGetFileReferences(
|
||||
quota::PERSISTENCE_TYPE_DEFAULT, principalMetadata.mOrigin,
|
||||
aDatabaseName, aId, aRefCnt, aDBRefCnt, aResult);
|
||||
principalMetadata.mIsPrivate ? quota::PERSISTENCE_TYPE_PRIVATE
|
||||
: quota::PERSISTENCE_TYPE_DEFAULT,
|
||||
principalMetadata.mOrigin, aDatabaseName, aId, aRefCnt, aDBRefCnt,
|
||||
aResult);
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else {
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/Document.h"
|
||||
#include "mozilla/dom/IDBFactoryBinding.h"
|
||||
#include "mozilla/dom/quota/PersistenceType.h"
|
||||
#include "mozilla/dom/quota/QuotaManager.h"
|
||||
#include "mozilla/dom/BrowserChild.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
|
@ -581,9 +582,15 @@ RefPtr<IDBOpenDBRequest> IDBFactory::OpenInternal(
|
|||
isInternal = QuotaManager::IsOriginInternal(origin);
|
||||
}
|
||||
|
||||
const bool isPrivate =
|
||||
principalInfo.type() == PrincipalInfo::TContentPrincipalInfo &&
|
||||
principalInfo.get_ContentPrincipalInfo().attrs().mPrivateBrowsingId > 0;
|
||||
|
||||
if (isInternal) {
|
||||
// Chrome privilege and internal origins always get persistent storage.
|
||||
persistenceType = PERSISTENCE_TYPE_PERSISTENT;
|
||||
} else if (isPrivate) {
|
||||
persistenceType = PERSISTENCE_TYPE_PRIVATE;
|
||||
} else {
|
||||
persistenceType = PERSISTENCE_TYPE_DEFAULT;
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ class IDBEncryptionPBM(MarionetteTestCase):
|
|||
sanitizedOrigin = origin.replace(":", "+").replace("/", "+")
|
||||
|
||||
storagePath = os.path.join(
|
||||
self.profilePath, "storage", "default", sanitizedOrigin, "idb"
|
||||
self.profilePath, "storage", "private", sanitizedOrigin, "idb"
|
||||
)
|
||||
|
||||
self.idbStoragePath = storagePath
|
||||
|
@ -137,7 +137,7 @@ class IDBEncryptionPBM(MarionetteTestCase):
|
|||
|
||||
function getOrigin() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let context = "default"
|
||||
let context = "private"
|
||||
let principal = Services.scriptSecurityManager.
|
||||
createContentPrincipalFromOrigin(url);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче