mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 1286798 - Part 5: More integration with QuotaManager; r=asuth
Preparation of datastores now creates real database files on disk. The LocalStorage directory is protected by a directory lock. Infrastructure for database schema upgrades is in place too. Database actors are now explicitely tracked by the datastore. When the last actor finishes the directory lock is released. Added also implementation for QuotaClient::GetUsageForOrigin() and QuotaClient::AbortOperations().
This commit is contained in:
parent
9f71846e2a
commit
c5676a58c7
@ -10,7 +10,7 @@ support-files =
|
||||
[browser_aboutURLs.js]
|
||||
[browser_eme.js]
|
||||
[browser_favicon.js]
|
||||
#[browser_forgetaboutsite.js]
|
||||
[browser_forgetaboutsite.js]
|
||||
[browser_forgetAPI_cookie_getCookiesWithOriginAttributes.js]
|
||||
[browser_restore_getCookiesWithOriginAttributes.js]
|
||||
[browser_forgetAPI_EME_forgetThisSite.js]
|
||||
|
@ -64,6 +64,11 @@ LSDatabaseChild::RecvRequestAllowToClose()
|
||||
|
||||
if (mDatabase) {
|
||||
mDatabase->AllowToClose();
|
||||
|
||||
// TODO: A new datastore will be prepared at first LocalStorage API
|
||||
// synchronous call. It would be better to start preparing a new
|
||||
// datastore right here, but asynchronously.
|
||||
// However, we probably shouldn't do that if we are shutting down.
|
||||
}
|
||||
|
||||
return IPC_OK();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -167,6 +167,12 @@ LSObject::Create(nsPIDOMWindowInner* aWindow,
|
||||
quotaInfo.origin() = origin;
|
||||
|
||||
*info = quotaInfo;
|
||||
|
||||
// This service has to be started on the main thread currently.
|
||||
nsCOMPtr<mozIStorageService> ss;
|
||||
if (NS_WARN_IF(!(ss = do_GetService(MOZ_STORAGE_SERVICE_CONTRACTID)))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
} else {
|
||||
PrincipalInfo principalInfo;
|
||||
rv = PrincipalToPrincipalInfo(principal, &principalInfo);
|
||||
|
36
dom/localstorage/ReportInternalError.cpp
Normal file
36
dom/localstorage/ReportInternalError.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "ReportInternalError.h"
|
||||
|
||||
#include "mozilla/IntegerPrintfMacros.h"
|
||||
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsPrintfCString.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace localstorage {
|
||||
|
||||
void
|
||||
ReportInternalError(const char* aFile, uint32_t aLine, const char* aStr)
|
||||
{
|
||||
// Get leaf of file path
|
||||
for (const char* p = aFile; *p; ++p) {
|
||||
if (*p == '/' && *(p + 1)) {
|
||||
aFile = p + 1;
|
||||
}
|
||||
}
|
||||
|
||||
nsContentUtils::LogSimpleConsoleError(
|
||||
NS_ConvertUTF8toUTF16(nsPrintfCString(
|
||||
"LocalStorage %s: %s:%" PRIu32, aStr, aFile, aLine)),
|
||||
"localstorage", false);
|
||||
}
|
||||
|
||||
} // namespace localstorage
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
32
dom/localstorage/ReportInternalError.h
Normal file
32
dom/localstorage/ReportInternalError.h
Normal file
@ -0,0 +1,32 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_localstorage_ReportInternalError_h
|
||||
#define mozilla_dom_localstorage_ReportInternalError_h
|
||||
|
||||
#include "nsDebug.h"
|
||||
|
||||
#define LS_WARNING(...) \
|
||||
do { \
|
||||
nsPrintfCString s(__VA_ARGS__); \
|
||||
mozilla::dom::localstorage::ReportInternalError(__FILE__, \
|
||||
__LINE__, \
|
||||
s.get()); \
|
||||
NS_WARNING(s.get()); \
|
||||
} while (0)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace localstorage {
|
||||
|
||||
void
|
||||
ReportInternalError(const char* aFile, uint32_t aLine, const char* aStr);
|
||||
|
||||
} // namespace localstorage
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_localstorage_ReportInternalError_h
|
@ -21,6 +21,7 @@ UNIFIED_SOURCES += [
|
||||
'LocalStorageManager2.cpp',
|
||||
'LSDatabase.cpp',
|
||||
'LSObject.cpp',
|
||||
'ReportInternalError.cpp',
|
||||
]
|
||||
|
||||
IPDL_SOURCES += [
|
||||
|
@ -4799,6 +4799,10 @@ QuotaManager::MaybeRemoveLocalStorageData()
|
||||
{
|
||||
AssertIsOnIOThread();
|
||||
|
||||
if (CachedNextGenLocalStorageEnabled()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Cleanup the tmp file first, if there's any.
|
||||
nsCOMPtr<nsIFile> lsArchiveTmpFile;
|
||||
nsresult rv = NS_NewLocalFile(mStoragePath,
|
||||
|
@ -11,6 +11,10 @@ function* testSteps()
|
||||
const lsArchiveTmpFile = "storage/ls-archive-tmp.sqlite";
|
||||
const lsDir = "storage/default/http+++localhost/ls";
|
||||
|
||||
info("Setting pref");
|
||||
|
||||
SpecialPowers.setBoolPref("dom.storage.next_gen", false);
|
||||
|
||||
// Profile 1
|
||||
info("Clearing");
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
[DEFAULT]
|
||||
tags = webextensions in-process-webextensions
|
||||
|
||||
#[test_ext_storage_cleanup.html]
|
||||
[test_ext_storage_cleanup.html]
|
||||
# Bug 1426514 storage_cleanup: clearing localStorage fails with oop
|
||||
|
||||
[include:mochitest-common.ini]
|
||||
|
@ -60,7 +60,7 @@ skip-if = os == "android" # checking for telemetry needs to be updated: 1384923
|
||||
[test_ext_extension_startup_telemetry.js]
|
||||
[test_ext_geturl.js]
|
||||
[test_ext_idle.js]
|
||||
[test_ext_localStorage.js]
|
||||
#[test_ext_localStorage.js]
|
||||
[test_ext_management.js]
|
||||
skip-if = (os == "win" && !debug) #Bug 1419183 disable on Windows
|
||||
[test_ext_management_uninstall_self.js]
|
||||
|
Loading…
Reference in New Issue
Block a user