зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1402858 - Remove ENABLE_INTL_API conditional and non-Intl legacy codepaths from IndexedDB. r=janv
This commit is contained in:
Родитель
1b1aafb2e8
Коммит
853c408d06
|
@ -7715,12 +7715,10 @@ private:
|
|||
void
|
||||
SendResults() override;
|
||||
|
||||
#ifdef ENABLE_INTL_API
|
||||
static nsresult
|
||||
UpdateLocaleAwareIndex(mozIStorageConnection* aConnection,
|
||||
const IndexMetadata& aIndexMetadata,
|
||||
const nsCString& aLocale);
|
||||
#endif
|
||||
};
|
||||
|
||||
class OpenDatabaseOp::VersionChangeOp final
|
||||
|
@ -19914,9 +19912,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());
|
||||
|
@ -19954,7 +19949,6 @@ DatabaseOperationBase::BindKeyRangeToStatement(
|
|||
}
|
||||
|
||||
return NS_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -22017,7 +22011,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());
|
||||
|
@ -22047,7 +22040,6 @@ OpenDatabaseOp::LoadDatabaseInformation(mozIStorageConnection* aConnection)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (NS_WARN_IF(!objectStoreMetadata->mIndexes.Put(indexId, indexMetadata,
|
||||
fallible))) {
|
||||
|
@ -22073,7 +22065,6 @@ OpenDatabaseOp::LoadDatabaseInformation(mozIStorageConnection* aConnection)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_INTL_API
|
||||
/* static */
|
||||
nsresult
|
||||
OpenDatabaseOp::UpdateLocaleAwareIndex(mozIStorageConnection* aConnection,
|
||||
|
@ -22191,7 +22182,6 @@ OpenDatabaseOp::UpdateLocaleAwareIndex(mozIStorageConnection* aConnection,
|
|||
rv = metaStmt->Execute();
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
OpenDatabaseOp::BeginVersionChange()
|
||||
|
@ -27966,15 +27956,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);
|
||||
|
@ -27982,7 +27969,6 @@ OpenOp::GetRangeKeyInfo(bool aLowerBound, Key* aKey, bool* aOpen)
|
|||
range.upper().ToLocaleBasedKey(*aKey, mCursor->mLocale);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
*aOpen = false;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -1316,9 +1316,7 @@ IDBObjectStore::AppendIndexUpdateInfo(
|
|||
{
|
||||
nsresult rv;
|
||||
|
||||
#ifdef ENABLE_INTL_API
|
||||
const bool localeAware = !aLocale.IsEmpty();
|
||||
#endif
|
||||
|
||||
if (!aMultiEntry) {
|
||||
Key key;
|
||||
|
@ -1336,14 +1334,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;
|
||||
}
|
||||
|
@ -1383,14 +1379,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 {
|
||||
|
@ -1404,14 +1398,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;
|
||||
|
@ -2277,11 +2269,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,
|
||||
|
|
|
@ -45,6 +45,8 @@
|
|||
#include "ScriptErrorHelper.h"
|
||||
#include "WorkerScope.h"
|
||||
#include "WorkerPrivate.h"
|
||||
#include "nsCharSeparatedTokenizer.h"
|
||||
#include "unicode/locid.h"
|
||||
|
||||
// Bindings for ResolveConstructors
|
||||
#include "mozilla/dom/IDBCursorBinding.h"
|
||||
|
@ -59,11 +61,6 @@
|
|||
#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"
|
||||
|
||||
// The two possible values for the data argument when receiving the disk space
|
||||
|
@ -430,7 +427,6 @@ IndexedDatabaseManager::Init()
|
|||
Preferences::RegisterCallbackAndCall(MaxSerializedMsgSizePrefChangeCallback,
|
||||
kPrefMaxSerilizedMsgSize);
|
||||
|
||||
#ifdef ENABLE_INTL_API
|
||||
nsAutoCString acceptLang;
|
||||
Preferences::GetLocalizedCString("intl.accept_languages", acceptLang);
|
||||
|
||||
|
@ -449,7 +445,6 @@ IndexedDatabaseManager::Init()
|
|||
if (mLocale.IsEmpty()) {
|
||||
mLocale.AssignLiteral("en_US");
|
||||
}
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1093,7 +1088,6 @@ IndexedDatabaseManager::LoggingModePrefChangedCallback(
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef ENABLE_INTL_API
|
||||
// static
|
||||
const nsCString&
|
||||
IndexedDatabaseManager::GetLocale()
|
||||
|
@ -1103,7 +1097,6 @@ IndexedDatabaseManager::GetLocale()
|
|||
|
||||
return idbManager->mLocale;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMPL_ADDREF(IndexedDatabaseManager)
|
||||
NS_IMPL_RELEASE_WITH_DESTROY(IndexedDatabaseManager, Destroy())
|
||||
|
|
|
@ -189,10 +189,8 @@ public:
|
|||
nsresult
|
||||
FlushPendingFileDeletions();
|
||||
|
||||
#ifdef ENABLE_INTL_API
|
||||
static const nsCString&
|
||||
GetLocale();
|
||||
#endif
|
||||
|
||||
static mozilla::Mutex&
|
||||
FileMutex()
|
||||
|
@ -241,9 +239,7 @@ private:
|
|||
// and FileInfo.mSliceRefCnt
|
||||
mozilla::Mutex mFileMutex;
|
||||
|
||||
#ifdef ENABLE_INTL_API
|
||||
nsCString mLocale;
|
||||
#endif
|
||||
|
||||
indexedDB::BackgroundUtilsChild* mBackgroundActor;
|
||||
|
||||
|
|
|
@ -22,11 +22,8 @@
|
|||
#include "nsAlgorithm.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "ReportInternalError.h"
|
||||
#include "xpcpublic.h"
|
||||
|
||||
#ifdef ENABLE_INTL_API
|
||||
#include "unicode/ucol.h"
|
||||
#endif
|
||||
#include "xpcpublic.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -110,7 +107,7 @@ 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
|
||||
{
|
||||
|
@ -207,7 +204,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,
|
||||
|
@ -507,7 +503,6 @@ Key::EncodeAsString(const T* aStart, const T* aEnd, uint8_t aType)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_INTL_API
|
||||
nsresult
|
||||
Key::EncodeLocaleString(const nsDependentString& aString, uint8_t aTypeOffset,
|
||||
const nsCString& aLocale)
|
||||
|
@ -545,7 +540,6 @@ Key::EncodeLocaleString(const nsDependentString& aString, uint8_t aTypeOffset,
|
|||
keyBuffer.Elements()+sortKeyLength,
|
||||
aTypeOffset);
|
||||
}
|
||||
#endif
|
||||
|
||||
// static
|
||||
nsresult
|
||||
|
|
|
@ -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:
|
|||
nsresult
|
||||
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);
|
||||
|
|
|
@ -7,7 +7,10 @@
|
|||
with Files("**"):
|
||||
BUG_COMPONENT = ("Core", "DOM: IndexedDB")
|
||||
|
||||
MOCHITEST_MANIFESTS += ['test/mochitest.ini']
|
||||
MOCHITEST_MANIFESTS += [
|
||||
'test/mochitest-intl-api.ini',
|
||||
'test/mochitest.ini',
|
||||
]
|
||||
|
||||
BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
|
||||
|
||||
|
@ -18,9 +21,6 @@ XPCSHELL_TESTS_MANIFESTS += [
|
|||
'test/unit/xpcshell-parent-process.ini'
|
||||
]
|
||||
|
||||
if CONFIG['ENABLE_INTL_API']:
|
||||
MOCHITEST_MANIFESTS += ['test/mochitest-intl-api.ini']
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
'IDBCursor.h',
|
||||
'IDBDatabase.h',
|
||||
|
|
Загрузка…
Ссылка в новой задаче