diff options
Diffstat (limited to 'dom/indexedDB')
-rw-r--r-- | dom/indexedDB/ActorsParent.cpp | 87 | ||||
-rw-r--r-- | dom/indexedDB/IDBCursor.cpp | 10 | ||||
-rw-r--r-- | dom/indexedDB/IDBCursor.h | 2 | ||||
-rw-r--r-- | dom/indexedDB/IDBObjectStore.cpp | 28 | ||||
-rw-r--r-- | dom/indexedDB/IDBObjectStore.h | 2 | ||||
-rw-r--r-- | dom/indexedDB/IndexedDatabase.h | 4 | ||||
-rw-r--r-- | dom/indexedDB/IndexedDatabaseInlines.h | 11 | ||||
-rw-r--r-- | dom/indexedDB/IndexedDatabaseManager.cpp | 21 | ||||
-rw-r--r-- | dom/indexedDB/IndexedDatabaseManager.h | 4 | ||||
-rw-r--r-- | dom/indexedDB/Key.cpp | 6 | ||||
-rw-r--r-- | dom/indexedDB/Key.h | 4 | ||||
-rw-r--r-- | dom/indexedDB/moz.build | 3 | ||||
-rw-r--r-- | dom/indexedDB/test/browser_forgetThisSite.js | 7 | ||||
-rw-r--r-- | dom/indexedDB/test/unit/xpcshell-child-process.ini | 2 | ||||
-rw-r--r-- | dom/indexedDB/test/unit/xpcshell-parent-process.ini | 1 |
15 files changed, 40 insertions, 152 deletions
diff --git a/dom/indexedDB/ActorsParent.cpp b/dom/indexedDB/ActorsParent.cpp index 9d4e72f2f..e6fe9e2a8 100644 --- a/dom/indexedDB/ActorsParent.cpp +++ b/dom/indexedDB/ActorsParent.cpp @@ -121,7 +121,7 @@ LogLevel::Debug, \ _args ) -#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK) +#if defined(MOZ_WIDGET_ANDROID) #define IDB_MOBILE #endif @@ -3694,8 +3694,6 @@ UpgradeSchemaFrom18_0To19_0(mozIStorageConnection* aConnection) return NS_OK; } -#if !defined(MOZ_B2G) - class NormalJSContext; class UpgradeFileIdsFunction final @@ -3731,8 +3729,6 @@ private: nsIVariant** aResult) override; }; -#endif // MOZ_B2G - nsresult UpgradeSchemaFrom19_0To20_0(nsIFile* aFMDirectory, mozIStorageConnection* aConnection) @@ -3744,20 +3740,6 @@ UpgradeSchemaFrom19_0To20_0(nsIFile* aFMDirectory, "UpgradeSchemaFrom19_0To20_0", js::ProfileEntry::Category::STORAGE); -#if defined(MOZ_B2G) - - // We don't have to do the upgrade of file ids on B2G. The old format was - // only used by the previous single process implementation and B2G was - // always multi process. This is a nice optimization since the upgrade needs - // to deserialize all structured clones which reference a stored file or - // a mutable file. - nsresult rv = aConnection->SetSchemaVersion(MakeSchemaVersion(20, 0)); - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; - } - -#else // MOZ_B2G - nsCOMPtr<mozIStorageStatement> stmt; nsresult rv = aConnection->CreateStatement(NS_LITERAL_CSTRING( "SELECT count(*) " @@ -3856,8 +3838,6 @@ UpgradeSchemaFrom19_0To20_0(nsIFile* aFMDirectory, return rv; } -#endif // MOZ_B2G - return NS_OK; } @@ -7767,12 +7747,10 @@ private: virtual void SendResults() override; -#ifdef ENABLE_INTL_API static nsresult UpdateLocaleAwareIndex(mozIStorageConnection* aConnection, const IndexMetadata& aIndexMetadata, const nsCString& aLocale); -#endif }; class OpenDatabaseOp::VersionChangeOp final @@ -8462,12 +8440,12 @@ class ObjectStoreAddOrPutRequestOp::SCInputStream final : public nsIInputStream { const JSStructuredCloneData& mData; - JSStructuredCloneData::IterImpl mIter; + JSStructuredCloneData::Iterator mIter; public: explicit SCInputStream(const JSStructuredCloneData& aData) : mData(aData) - , mIter(aData.Iter()) + , mIter(aData.Start()) { } private: @@ -13492,10 +13470,6 @@ nsresult ConnectionPool:: ThreadRunnable::Run() { -#ifdef MOZ_ENABLE_PROFILER_SPS - char stackTopGuess; -#endif // MOZ_ENABLE_PROFILER_SPS - MOZ_ASSERT(!IsOnBackgroundThread()); MOZ_ASSERT(mContinueRunning); @@ -13512,10 +13486,6 @@ ThreadRunnable::Run() const nsPrintfCString threadName("IndexedDB #%lu", mSerialNumber); PR_SetCurrentThreadName(threadName.get()); - -#ifdef MOZ_ENABLE_PROFILER_SPS - profiler_register_thread(threadName.get(), &stackTopGuess); -#endif // MOZ_ENABLE_PROFILER_SPS } { @@ -13559,10 +13529,6 @@ ThreadRunnable::Run() } } -#ifdef MOZ_ENABLE_PROFILER_SPS - profiler_unregister_thread(); -#endif // MOZ_ENABLE_PROFILER_SPS - return NS_OK; } @@ -19666,8 +19632,6 @@ AutoProgressHandler::OnProgress(mozIStorageConnection* aConnection, NS_IMPL_ISUPPORTS(CompressDataBlobsFunction, mozIStorageFunction) NS_IMPL_ISUPPORTS(EncodeKeysFunction, mozIStorageFunction) -#if !defined(MOZ_B2G) - nsresult UpgradeFileIdsFunction::Init(nsIFile* aFMDirectory, mozIStorageConnection* aConnection) @@ -19723,7 +19687,7 @@ UpgradeFileIdsFunction::OnFunctionCall(mozIStorageValueArray* aArguments, return NS_ERROR_UNEXPECTED; } - StructuredCloneReadInfo cloneInfo; + StructuredCloneReadInfo cloneInfo(JS::StructuredCloneScope::DifferentProcess); DatabaseOperationBase::GetStructuredCloneReadInfoFromValueArray(aArguments, 1, 0, @@ -19762,8 +19726,6 @@ UpgradeFileIdsFunction::OnFunctionCall(mozIStorageValueArray* aArguments, return NS_OK; } -#endif // MOZ_B2G - // static void DatabaseOperationBase::GetBindingClauseForKeyRange( @@ -19930,7 +19892,7 @@ DatabaseOperationBase::GetStructuredCloneReadInfoFromBlob( return NS_ERROR_FILE_CORRUPTED; } - if (!aInfo->mData.WriteBytes(uncompressedBuffer, uncompressed.Length())) { + if (!aInfo->mData.AppendBytes(uncompressedBuffer, uncompressed.Length())) { return NS_ERROR_OUT_OF_MEMORY; } @@ -20016,7 +19978,7 @@ DatabaseOperationBase::GetStructuredCloneReadInfoFromExternalBlob( break; } - if (NS_WARN_IF(!aInfo->mData.WriteBytes(buffer, numRead))) { + if (NS_WARN_IF(!aInfo->mData.AppendBytes(buffer, numRead))) { rv = NS_ERROR_OUT_OF_MEMORY; break; } @@ -20064,9 +20026,6 @@ DatabaseOperationBase::BindKeyRangeToStatement( mozIStorageStatement* aStatement, const nsCString& aLocale) { -#ifndef ENABLE_INTL_API - return BindKeyRangeToStatement(aKeyRange, aStatement); -#else MOZ_ASSERT(!IsOnBackgroundThread()); MOZ_ASSERT(aStatement); MOZ_ASSERT(!aLocale.IsEmpty()); @@ -20104,7 +20063,6 @@ DatabaseOperationBase::BindKeyRangeToStatement( } return NS_OK; -#endif } // static @@ -22197,7 +22155,6 @@ OpenDatabaseOp::LoadDatabaseInformation(mozIStorageConnection* aConnection) indexMetadata->mCommonMetadata.multiEntry() = !!scratch; -#ifdef ENABLE_INTL_API const bool localeAware = !stmt->IsNull(6); if (localeAware) { rv = stmt->GetUTF8String(6, indexMetadata->mCommonMetadata.locale()); @@ -22227,7 +22184,6 @@ OpenDatabaseOp::LoadDatabaseInformation(mozIStorageConnection* aConnection) } } } -#endif if (NS_WARN_IF(!objectStoreMetadata->mIndexes.Put(indexId, indexMetadata, fallible))) { @@ -22253,7 +22209,6 @@ OpenDatabaseOp::LoadDatabaseInformation(mozIStorageConnection* aConnection) return NS_OK; } -#ifdef ENABLE_INTL_API /* static */ nsresult OpenDatabaseOp::UpdateLocaleAwareIndex(mozIStorageConnection* aConnection, @@ -22371,7 +22326,6 @@ OpenDatabaseOp::UpdateLocaleAwareIndex(mozIStorageConnection* aConnection, rv = metaStmt->Execute(); return rv; } -#endif nsresult OpenDatabaseOp::BeginVersionChange() @@ -25383,7 +25337,7 @@ UpdateIndexDataValuesFunction::OnFunctionCall(mozIStorageValueArray* aValues, } #endif - StructuredCloneReadInfo cloneInfo; + StructuredCloneReadInfo cloneInfo(JS::StructuredCloneScope::DifferentProcess); nsresult rv = GetStructuredCloneReadInfoFromValueArray(aValues, /* aDataIndex */ 3, @@ -26592,18 +26546,9 @@ ObjectStoreAddOrPutRequestOp::DoDatabaseWork(DatabaseConnection* aConnection) char keyPropBuffer[keyPropSize]; LittleEndian::writeUint64(keyPropBuffer, keyPropValue); - auto iter = cloneData.Iter(); - DebugOnly<bool> result = - iter.AdvanceAcrossSegments(cloneData, cloneInfo.offsetToKeyProp()); - MOZ_ASSERT(result); - - for (uint32_t index = 0; index < keyPropSize; index++) { - char* keyPropPointer = iter.Data(); - *keyPropPointer = keyPropBuffer[index]; - - result = iter.AdvanceAcrossSegments(cloneData, 1); - MOZ_ASSERT(result); - } + auto iter = cloneData.Start(); + MOZ_ALWAYS_TRUE(cloneData.Advance(iter, cloneInfo.offsetToKeyProp())); + MOZ_ALWAYS_TRUE(cloneData.UpdateBytes(iter, keyPropBuffer, keyPropSize)); } } @@ -26629,7 +26574,7 @@ ObjectStoreAddOrPutRequestOp::DoDatabaseWork(DatabaseConnection* aConnection) } else { nsCString flatCloneData; flatCloneData.SetLength(cloneDataSize); - auto iter = cloneData.Iter(); + auto iter = cloneData.Start(); cloneData.ReadBytes(iter, flatCloneData.BeginWriting(), cloneDataSize); // Compress the bytes before adding into the database. @@ -26886,7 +26831,7 @@ SCInputStream::ReadSegments(nsWriteSegmentFun aWriter, *_retval += count; aCount -= count; - mIter.Advance(mData, count); + mData.Advance(mIter, count); } return NS_OK; @@ -28075,7 +28020,7 @@ CursorOpBase::PopulateResponseFromStatement( switch (mCursor->mType) { case OpenCursorParams::TObjectStoreOpenCursorParams: { - StructuredCloneReadInfo cloneInfo; + StructuredCloneReadInfo cloneInfo(JS::StructuredCloneScope::DifferentProcess); rv = GetStructuredCloneReadInfoFromStatement(aStmt, 2, 1, @@ -28123,7 +28068,7 @@ CursorOpBase::PopulateResponseFromStatement( return rv; } - StructuredCloneReadInfo cloneInfo; + StructuredCloneReadInfo cloneInfo(JS::StructuredCloneScope::DifferentProcess); rv = GetStructuredCloneReadInfoFromStatement(aStmt, 4, 3, @@ -28191,15 +28136,12 @@ OpenOp::GetRangeKeyInfo(bool aLowerBound, Key* aKey, bool* aOpen) if (range.isOnly()) { *aKey = range.lower(); *aOpen = false; -#ifdef ENABLE_INTL_API if (mCursor->IsLocaleAware()) { range.lower().ToLocaleBasedKey(*aKey, mCursor->mLocale); } -#endif } else { *aKey = aLowerBound ? range.lower() : range.upper(); *aOpen = aLowerBound ? range.lowerOpen() : range.upperOpen(); -#ifdef ENABLE_INTL_API if (mCursor->IsLocaleAware()) { if (aLowerBound) { range.lower().ToLocaleBasedKey(*aKey, mCursor->mLocale); @@ -28207,7 +28149,6 @@ OpenOp::GetRangeKeyInfo(bool aLowerBound, Key* aKey, bool* aOpen) range.upper().ToLocaleBasedKey(*aKey, mCursor->mLocale); } } -#endif } } else { *aOpen = false; diff --git a/dom/indexedDB/IDBCursor.cpp b/dom/indexedDB/IDBCursor.cpp index e5d8913f9..7ae35e981 100644 --- a/dom/indexedDB/IDBCursor.cpp +++ b/dom/indexedDB/IDBCursor.cpp @@ -65,13 +65,11 @@ IDBCursor::IDBCursor(Type aType, } } -#ifdef ENABLE_INTL_API bool IDBCursor::IsLocaleAware() const { return mSourceIndex && !mSourceIndex->Locale().IsEmpty(); } -#endif IDBCursor::~IDBCursor() { @@ -437,7 +435,6 @@ IDBCursor::Continue(JSContext* aCx, return; } -#ifdef ENABLE_INTL_API if (IsLocaleAware() && !key.IsUnset()) { Key tmp; aRv = key.ToLocaleBasedKey(tmp, mSourceIndex->Locale()); @@ -448,9 +445,6 @@ IDBCursor::Continue(JSContext* aCx, } const Key& sortKey = IsLocaleAware() ? mSortKey : mKey; -#else - const Key& sortKey = mKey; -#endif if (!key.IsUnset()) { switch (mDirection) { @@ -547,7 +541,6 @@ IDBCursor::ContinuePrimaryKey(JSContext* aCx, return; } -#ifdef ENABLE_INTL_API if (IsLocaleAware() && !key.IsUnset()) { Key tmp; aRv = key.ToLocaleBasedKey(tmp, mSourceIndex->Locale()); @@ -558,9 +551,6 @@ IDBCursor::ContinuePrimaryKey(JSContext* aCx, } const Key& sortKey = IsLocaleAware() ? mSortKey : mKey; -#else - const Key& sortKey = mKey; -#endif if (key.IsUnset()) { aRv.Throw(NS_ERROR_DOM_INDEXEDDB_DATA_ERR); diff --git a/dom/indexedDB/IDBCursor.h b/dom/indexedDB/IDBCursor.h index 25be16bee..3a4bedcda 100644 --- a/dom/indexedDB/IDBCursor.h +++ b/dom/indexedDB/IDBCursor.h @@ -205,11 +205,9 @@ private: ~IDBCursor(); -#ifdef ENABLE_INTL_API // Checks if this is a locale aware cursor (ie. the index's sortKey is unset) bool IsLocaleAware() const; -#endif void DropJSObjects(); diff --git a/dom/indexedDB/IDBObjectStore.cpp b/dom/indexedDB/IDBObjectStore.cpp index c9ab24970..8a0b292ad 100644 --- a/dom/indexedDB/IDBObjectStore.cpp +++ b/dom/indexedDB/IDBObjectStore.cpp @@ -67,7 +67,7 @@ struct IDBObjectStore::StructuredCloneWriteInfo uint64_t mOffsetToKeyProp; explicit StructuredCloneWriteInfo(IDBDatabase* aDatabase) - : mCloneBuffer(JS::StructuredCloneScope::SameProcessSameThread, nullptr, + : mCloneBuffer(JS::StructuredCloneScope::DifferentProcessForIndexedDB, nullptr, nullptr) , mDatabase(aDatabase) , mOffsetToKeyProp(0) @@ -859,10 +859,6 @@ public: } }; -// We don't need to upgrade database on B2G. See the comment in ActorsParent.cpp, -// UpgradeSchemaFrom18_0To19_0() -#if !defined(MOZ_B2G) - class UpgradeDeserializationHelper { public: @@ -929,8 +925,6 @@ public: } }; -#endif // MOZ_B2G - template <class Traits> JSObject* CommonStructuredCloneReadCallback(JSContext* aCx, @@ -1086,9 +1080,7 @@ IDBObjectStore::AppendIndexUpdateInfo( { nsresult rv; -#ifdef ENABLE_INTL_API const bool localeAware = !aLocale.IsEmpty(); -#endif if (!aMultiEntry) { Key key; @@ -1106,14 +1098,12 @@ IDBObjectStore::AppendIndexUpdateInfo( IndexUpdateInfo* updateInfo = aUpdateInfoArray.AppendElement(); updateInfo->indexId() = aIndexID; updateInfo->value() = key; -#ifdef ENABLE_INTL_API if (localeAware) { rv = key.ToLocaleBasedKey(updateInfo->localizedValue(), aLocale); if (NS_WARN_IF(NS_FAILED(rv))) { return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR; } } -#endif return NS_OK; } @@ -1153,14 +1143,12 @@ IDBObjectStore::AppendIndexUpdateInfo( IndexUpdateInfo* updateInfo = aUpdateInfoArray.AppendElement(); updateInfo->indexId() = aIndexID; updateInfo->value() = value; -#ifdef ENABLE_INTL_API if (localeAware) { rv = value.ToLocaleBasedKey(updateInfo->localizedValue(), aLocale); if (NS_WARN_IF(NS_FAILED(rv))) { return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR; } } -#endif } } else { @@ -1174,14 +1162,12 @@ IDBObjectStore::AppendIndexUpdateInfo( IndexUpdateInfo* updateInfo = aUpdateInfoArray.AppendElement(); updateInfo->indexId() = aIndexID; updateInfo->value() = value; -#ifdef ENABLE_INTL_API if (localeAware) { rv = value.ToLocaleBasedKey(updateInfo->localizedValue(), aLocale); if (NS_WARN_IF(NS_FAILED(rv))) { return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR; } } -#endif } return NS_OK; @@ -1230,7 +1216,7 @@ IDBObjectStore::DeserializeValue(JSContext* aCx, // FIXME: Consider to use StructuredCloneHolder here and in other // deserializing methods. if (!JS_ReadStructuredClone(aCx, aCloneReadInfo.mData, JS_STRUCTURED_CLONE_VERSION, - JS::StructuredCloneScope::SameProcessSameThread, + JS::StructuredCloneScope::DifferentProcessForIndexedDB, aValue, &callbacks, &aCloneReadInfo)) { return false; } @@ -1263,7 +1249,7 @@ IDBObjectStore::DeserializeIndexValue(JSContext* aCx, }; if (!JS_ReadStructuredClone(aCx, aCloneReadInfo.mData, JS_STRUCTURED_CLONE_VERSION, - JS::StructuredCloneScope::SameProcessSameThread, + JS::StructuredCloneScope::DifferentProcessForIndexedDB, aValue, &callbacks, &aCloneReadInfo)) { return false; } @@ -1271,8 +1257,6 @@ IDBObjectStore::DeserializeIndexValue(JSContext* aCx, return true; } -#if !defined(MOZ_B2G) - // static bool IDBObjectStore::DeserializeUpgradeValue(JSContext* aCx, @@ -1301,7 +1285,7 @@ IDBObjectStore::DeserializeUpgradeValue(JSContext* aCx, }; if (!JS_ReadStructuredClone(aCx, aCloneReadInfo.mData, JS_STRUCTURED_CLONE_VERSION, - JS::StructuredCloneScope::SameProcessSameThread, + JS::StructuredCloneScope::DifferentProcessForIndexedDB, aValue, &callbacks, &aCloneReadInfo)) { return false; } @@ -1309,8 +1293,6 @@ IDBObjectStore::DeserializeUpgradeValue(JSContext* aCx, return true; } -#endif // MOZ_B2G - #ifdef DEBUG void @@ -2052,11 +2034,9 @@ IDBObjectStore::CreateIndex(const nsAString& aName, // Valid locale names are always ASCII as per BCP-47. nsCString locale = NS_LossyConvertUTF16toASCII(aOptionalParameters.mLocale); bool autoLocale = locale.EqualsASCII("auto"); -#ifdef ENABLE_INTL_API if (autoLocale) { locale = IndexedDatabaseManager::GetLocale(); } -#endif IndexMetadata* metadata = indexes.AppendElement( IndexMetadata(transaction->NextIndexId(), nsString(aName), keyPath, diff --git a/dom/indexedDB/IDBObjectStore.h b/dom/indexedDB/IDBObjectStore.h index 7a255a4af..994931afa 100644 --- a/dom/indexedDB/IDBObjectStore.h +++ b/dom/indexedDB/IDBObjectStore.h @@ -101,12 +101,10 @@ public: StructuredCloneReadInfo& aCloneReadInfo, JS::MutableHandle<JS::Value> aValue); -#if !defined(MOZ_B2G) static bool DeserializeUpgradeValue(JSContext* aCx, StructuredCloneReadInfo& aCloneReadInfo, JS::MutableHandle<JS::Value> aValue); -#endif static const JSClass* DummyPropClass() diff --git a/dom/indexedDB/IndexedDatabase.h b/dom/indexedDB/IndexedDatabase.h index b0c4cb877..b3c6ab725 100644 --- a/dom/indexedDB/IndexedDatabase.h +++ b/dom/indexedDB/IndexedDatabase.h @@ -65,6 +65,10 @@ struct StructuredCloneReadInfo bool mHasPreprocessInfo; // In IndexedDatabaseInlines.h + inline explicit + StructuredCloneReadInfo(JS::StructuredCloneScope aScope); + + // In IndexedDatabaseInlines.h inline StructuredCloneReadInfo(); diff --git a/dom/indexedDB/IndexedDatabaseInlines.h b/dom/indexedDB/IndexedDatabaseInlines.h index 830c2f110..8c34a81dd 100644 --- a/dom/indexedDB/IndexedDatabaseInlines.h +++ b/dom/indexedDB/IndexedDatabaseInlines.h @@ -45,14 +45,21 @@ StructuredCloneFile::operator==(const StructuredCloneFile& aOther) const } inline -StructuredCloneReadInfo::StructuredCloneReadInfo() - : mDatabase(nullptr) +StructuredCloneReadInfo::StructuredCloneReadInfo(JS::StructuredCloneScope aScope) + : mData(aScope) + , mDatabase(nullptr) , mHasPreprocessInfo(false) { MOZ_COUNT_CTOR(StructuredCloneReadInfo); } inline +StructuredCloneReadInfo::StructuredCloneReadInfo() + : StructuredCloneReadInfo(JS::StructuredCloneScope::DifferentProcessForIndexedDB) +{ +} + +inline StructuredCloneReadInfo::StructuredCloneReadInfo( StructuredCloneReadInfo&& aCloneReadInfo) : mData(Move(aCloneReadInfo.mData)) diff --git a/dom/indexedDB/IndexedDatabaseManager.cpp b/dom/indexedDB/IndexedDatabaseManager.cpp index 2590b0127..62ba51c08 100644 --- a/dom/indexedDB/IndexedDatabaseManager.cpp +++ b/dom/indexedDB/IndexedDatabaseManager.cpp @@ -59,10 +59,8 @@ #include "mozilla/dom/IDBTransactionBinding.h" #include "mozilla/dom/IDBVersionChangeEventBinding.h" -#ifdef ENABLE_INTL_API #include "nsCharSeparatedTokenizer.h" #include "unicode/locid.h" -#endif #define IDB_STR "indexedDB" @@ -155,7 +153,7 @@ const char kPrefMaxSerilizedMsgSize[] = IDB_PREF_BRANCH_ROOT "maxSerializedMsgSi const char kPrefLoggingEnabled[] = IDB_PREF_LOGGING_BRANCH_ROOT "enabled"; const char kPrefLoggingDetails[] = IDB_PREF_LOGGING_BRANCH_ROOT "details"; -#if defined(DEBUG) || defined(MOZ_ENABLE_PROFILER_SPS) +#if defined(DEBUG) const char kPrefLoggingProfiler[] = IDB_PREF_LOGGING_BRANCH_ROOT "profiler-marks"; #endif @@ -417,10 +415,7 @@ IndexedDatabaseManager::Init() Preferences::RegisterCallback(LoggingModePrefChangedCallback, kPrefLoggingDetails); -#ifdef MOZ_ENABLE_PROFILER_SPS - Preferences::RegisterCallback(LoggingModePrefChangedCallback, - kPrefLoggingProfiler); -#endif + Preferences::RegisterCallbackAndCall(LoggingModePrefChangedCallback, kPrefLoggingEnabled); @@ -430,7 +425,6 @@ IndexedDatabaseManager::Init() Preferences::RegisterCallbackAndCall(MaxSerializedMsgSizePrefChangeCallback, kPrefMaxSerilizedMsgSize); -#ifdef ENABLE_INTL_API const nsAdoptingCString& acceptLang = Preferences::GetLocalizedCString("intl.accept_languages"); @@ -449,7 +443,6 @@ IndexedDatabaseManager::Init() if (mLocale.IsEmpty()) { mLocale.AssignLiteral("en_US"); } -#endif return NS_OK; } @@ -483,10 +476,6 @@ IndexedDatabaseManager::Destroy() Preferences::UnregisterCallback(LoggingModePrefChangedCallback, kPrefLoggingDetails); -#ifdef MOZ_ENABLE_PROFILER_SPS - Preferences::UnregisterCallback(LoggingModePrefChangedCallback, - kPrefLoggingProfiler); -#endif Preferences::UnregisterCallback(LoggingModePrefChangedCallback, kPrefLoggingEnabled); @@ -1064,15 +1053,13 @@ IndexedDatabaseManager::LoggingModePrefChangedCallback( } bool useProfiler = -#if defined(DEBUG) || defined(MOZ_ENABLE_PROFILER_SPS) +#if defined(DEBUG) Preferences::GetBool(kPrefLoggingProfiler); -#if !defined(MOZ_ENABLE_PROFILER_SPS) if (useProfiler) { NS_WARNING("IndexedDB cannot create profiler marks because this build does " "not have profiler extensions enabled!"); useProfiler = false; } -#endif #else false; #endif @@ -1088,7 +1075,6 @@ IndexedDatabaseManager::LoggingModePrefChangedCallback( } } -#ifdef ENABLE_INTL_API // static const nsCString& IndexedDatabaseManager::GetLocale() @@ -1098,7 +1084,6 @@ IndexedDatabaseManager::GetLocale() return idbManager->mLocale; } -#endif NS_IMPL_ADDREF(IndexedDatabaseManager) NS_IMPL_RELEASE_WITH_DESTROY(IndexedDatabaseManager, Destroy()) diff --git a/dom/indexedDB/IndexedDatabaseManager.h b/dom/indexedDB/IndexedDatabaseManager.h index 8bb9d7003..d63c548ec 100644 --- a/dom/indexedDB/IndexedDatabaseManager.h +++ b/dom/indexedDB/IndexedDatabaseManager.h @@ -186,10 +186,8 @@ public: nsresult FlushPendingFileDeletions(); -#ifdef ENABLE_INTL_API static const nsCString& GetLocale(); -#endif static mozilla::Mutex& FileMutex() @@ -238,9 +236,7 @@ private: // and FileInfo.mSliceRefCnt mozilla::Mutex mFileMutex; -#ifdef ENABLE_INTL_API nsCString mLocale; -#endif indexedDB::BackgroundUtilsChild* mBackgroundActor; diff --git a/dom/indexedDB/Key.cpp b/dom/indexedDB/Key.cpp index 945320dd5..0f693b2c6 100644 --- a/dom/indexedDB/Key.cpp +++ b/dom/indexedDB/Key.cpp @@ -22,9 +22,7 @@ #include "ReportInternalError.h" #include "xpcpublic.h" -#ifdef ENABLE_INTL_API #include "unicode/ucol.h" -#endif namespace mozilla { namespace dom { @@ -108,7 +106,6 @@ namespace indexedDB { [1, 2] // 0x60 bf f0 0 0 0 0 0 0 0x10 c0 [[]] // 0x80 */ -#ifdef ENABLE_INTL_API nsresult Key::ToLocaleBasedKey(Key& aTarget, const nsCString& aLocale) const { @@ -202,7 +199,6 @@ Key::ToLocaleBasedKey(Key& aTarget, const nsCString& aLocale) const aTarget.TrimBuffer(); return NS_OK; } -#endif nsresult Key::EncodeJSValInternal(JSContext* aCx, JS::Handle<JS::Value> aVal, @@ -483,7 +479,6 @@ Key::EncodeAsString(const T* aStart, const T* aEnd, uint8_t aType) NS_ASSERTION(buffer == mBuffer.EndReading(), "Wrote wrong number of bytes"); } -#ifdef ENABLE_INTL_API nsresult Key::EncodeLocaleString(const nsDependentString& aString, uint8_t aTypeOffset, const nsCString& aLocale) @@ -522,7 +517,6 @@ Key::EncodeLocaleString(const nsDependentString& aString, uint8_t aTypeOffset, aTypeOffset); return NS_OK; } -#endif // static nsresult diff --git a/dom/indexedDB/Key.h b/dom/indexedDB/Key.h index 856089c97..9d70ce6ad 100644 --- a/dom/indexedDB/Key.h +++ b/dom/indexedDB/Key.h @@ -214,10 +214,8 @@ public: nsresult AppendItem(JSContext* aCx, bool aFirstOfArray, JS::Handle<JS::Value> aVal); -#ifdef ENABLE_INTL_API nsresult ToLocaleBasedKey(Key& aTarget, const nsCString& aLocale) const; -#endif void FinishArray() @@ -298,11 +296,9 @@ private: void EncodeAsString(const T* aStart, const T* aEnd, uint8_t aType); -#ifdef ENABLE_INTL_API nsresult EncodeLocaleString(const nsDependentString& aString, uint8_t aTypeOffset, const nsCString& aLocale); -#endif void EncodeNumber(double aFloat, uint8_t aType); diff --git a/dom/indexedDB/moz.build b/dom/indexedDB/moz.build index 1fb01135c..d8c217f38 100644 --- a/dom/indexedDB/moz.build +++ b/dom/indexedDB/moz.build @@ -17,8 +17,7 @@ XPCSHELL_TESTS_MANIFESTS += [ 'test/unit/xpcshell-parent-process.ini' ] -if CONFIG['ENABLE_INTL_API']: - MOCHITEST_MANIFESTS += ['test/mochitest-intl-api.ini'] +MOCHITEST_MANIFESTS += ['test/mochitest-intl-api.ini'] EXPORTS.mozilla.dom += [ 'IDBCursor.h', diff --git a/dom/indexedDB/test/browser_forgetThisSite.js b/dom/indexedDB/test/browser_forgetThisSite.js index c1177908f..02674922f 100644 --- a/dom/indexedDB/test/browser_forgetThisSite.js +++ b/dom/indexedDB/test/browser_forgetThisSite.js @@ -67,9 +67,10 @@ function test2() function test3() { // Remove database from domain 2 - ForgetAboutSite.removeDataFromDomain(domains[1]); - setPermission(testPageURL4, "indexedDB"); - executeSoon(test4); + ForgetAboutSite.removeDataFromDomain(domains[1]).then(() => { + setPermission(testPageURL4, "indexedDB"); + executeSoon(test4); + }); } function test4() diff --git a/dom/indexedDB/test/unit/xpcshell-child-process.ini b/dom/indexedDB/test/unit/xpcshell-child-process.ini index 970fe8c3d..5918471ea 100644 --- a/dom/indexedDB/test/unit/xpcshell-child-process.ini +++ b/dom/indexedDB/test/unit/xpcshell-child-process.ini @@ -6,7 +6,7 @@ dupe-manifest = head = xpcshell-head-child-process.js tail = -skip-if = toolkit == 'android' || toolkit == 'gonk' +skip-if = toolkit == 'android' support-files = GlobalObjectsChild.js GlobalObjectsComponent.js diff --git a/dom/indexedDB/test/unit/xpcshell-parent-process.ini b/dom/indexedDB/test/unit/xpcshell-parent-process.ini index 22bc861cc..04df5f552 100644 --- a/dom/indexedDB/test/unit/xpcshell-parent-process.ini +++ b/dom/indexedDB/test/unit/xpcshell-parent-process.ini @@ -6,7 +6,6 @@ dupe-manifest = head = xpcshell-head-parent-process.js tail = -skip-if = toolkit == 'gonk' support-files = bug1056939_profile.zip defaultStorageUpgrade_profile.zip |