зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1626846 - Disable useDOSDevicePathSyntax for QuotaStorage on Windows; r=dom-workers-and-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D69318 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
b3e5220e8b
Коммит
02b4a20039
|
@ -3940,6 +3940,10 @@ void QuotaManager::CollectPendingOriginsForListing(P aPredicate) {
|
|||
nsresult QuotaManager::Init(const nsAString& aBasePath) {
|
||||
mBasePath = aBasePath;
|
||||
|
||||
#ifdef XP_WIN
|
||||
CacheUseDOSDevicePathSyntaxPrefValue();
|
||||
#endif
|
||||
|
||||
auto baseDirOrErr = QM_NewLocalFile(aBasePath);
|
||||
if (NS_WARN_IF(baseDirOrErr.isErr())) {
|
||||
return baseDirOrErr.unwrapErr();
|
||||
|
|
|
@ -8,7 +8,11 @@
|
|||
|
||||
#include "mozilla/Logging.h" // LazyLogModule
|
||||
#include "nsIFile.h"
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#ifdef XP_WIN
|
||||
# include "mozilla/ipc/BackgroundParent.h"
|
||||
# include "mozilla/StaticPrefs_dom.h"
|
||||
# include "nsILocalFileWin.h"
|
||||
#endif
|
||||
#include "nsXPCOM.h"
|
||||
|
@ -19,6 +23,10 @@ namespace quota {
|
|||
|
||||
namespace {
|
||||
|
||||
#ifdef XP_WIN
|
||||
Atomic<int32_t> gUseDOSDevicePathSyntax(-1);
|
||||
#endif
|
||||
|
||||
LazyLogModule gLogger("QuotaManager");
|
||||
|
||||
void AnonymizeCString(nsACString& aCString, uint32_t aStart) {
|
||||
|
@ -72,6 +80,19 @@ void AnonymizeOriginString(nsACString& aOriginString) {
|
|||
AnonymizeCString(aOriginString, start);
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
void CacheUseDOSDevicePathSyntaxPrefValue() {
|
||||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
AssertIsOnBackgroundThread();
|
||||
|
||||
if (gUseDOSDevicePathSyntax == -1) {
|
||||
bool useDOSDevicePathSyntax =
|
||||
StaticPrefs::dom_quotaManager_useDOSDevicePathSyntax_DoNotUseDirectly();
|
||||
gUseDOSDevicePathSyntax = useDOSDevicePathSyntax ? 1 : 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Result<nsCOMPtr<nsIFile>, nsresult> QM_NewLocalFile(const nsAString& aPath) {
|
||||
nsCOMPtr<nsIFile> file;
|
||||
nsresult rv =
|
||||
|
@ -81,13 +102,17 @@ Result<nsCOMPtr<nsIFile>, nsresult> QM_NewLocalFile(const nsAString& aPath) {
|
|||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
nsCOMPtr<nsILocalFileWin> winFile = do_QueryInterface(file, &rv);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return Err(rv);
|
||||
}
|
||||
MOZ_ASSERT(gUseDOSDevicePathSyntax != -1);
|
||||
|
||||
MOZ_ASSERT(winFile);
|
||||
winFile->SetUseDOSDevicePathSyntax(true);
|
||||
if (gUseDOSDevicePathSyntax) {
|
||||
nsCOMPtr<nsILocalFileWin> winFile = do_QueryInterface(file, &rv);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return Err(rv);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(winFile);
|
||||
winFile->SetUseDOSDevicePathSyntax(true);
|
||||
}
|
||||
#endif
|
||||
|
||||
return file;
|
||||
|
|
|
@ -163,6 +163,10 @@ void StringifyTableKeys(const T& aTable, nsACString& aResult) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
void CacheUseDOSDevicePathSyntaxPrefValue();
|
||||
#endif
|
||||
|
||||
Result<nsCOMPtr<nsIFile>, nsresult> QM_NewLocalFile(const nsAString& aPath);
|
||||
|
||||
class IntString : public nsAutoString {
|
||||
|
|
|
@ -97,12 +97,18 @@ function continueToNextStepSync() {
|
|||
|
||||
function enableTesting() {
|
||||
SpecialPowers.setBoolPref("dom.quotaManager.testing", true);
|
||||
if (Services.appinfo.OS === "WINNT") {
|
||||
SpecialPowers.setBoolPref("dom.quotaManager.useDOSDevicePathSyntax", true);
|
||||
}
|
||||
SpecialPowers.setBoolPref("dom.simpleDB.enabled", true);
|
||||
SpecialPowers.setBoolPref("dom.storage.next_gen", true);
|
||||
}
|
||||
|
||||
function resetTesting() {
|
||||
SpecialPowers.clearUserPref("dom.quotaManager.testing");
|
||||
if (Services.appinfo.OS === "WINNT") {
|
||||
SpecialPowers.clearUserPref("dom.quotaManager.useDOSDevicePathSyntax");
|
||||
}
|
||||
SpecialPowers.clearUserPref("dom.simpleDB.enabled");
|
||||
SpecialPowers.clearUserPref("dom.storage.next_gen");
|
||||
}
|
||||
|
|
|
@ -2254,6 +2254,19 @@
|
|||
value: false
|
||||
mirror: always
|
||||
|
||||
#ifdef XP_WIN
|
||||
# Preference that is used to set nsILocalFileWin::useDOSDevicePathSyntax
|
||||
# attribute for all local file instances created by QuotaManager and its
|
||||
# clients. The value of this preference is cached so changing the preference
|
||||
# during runtime has no effect.
|
||||
# See bug 1626846 for setting this to false by default.
|
||||
- name: dom.quotaManager.useDOSDevicePathSyntax
|
||||
type: RelaxedAtomicBool
|
||||
value: false
|
||||
mirror: always
|
||||
do_not_use_directly: true
|
||||
#endif
|
||||
|
||||
# Reporting API.
|
||||
- name: dom.reporting.enabled
|
||||
type: RelaxedAtomicBool
|
||||
|
|
Загрузка…
Ссылка в новой задаче