зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1268380 - Part 1: Lower the precedence of SyntaxError next to ConstraintError in IDBObjectStore::CreateIndex(). r=khuey
--HG-- extra : rebase_source : 30c995da764e281636c1e134b421baf60a1d1c71
This commit is contained in:
Родитель
4881494273
Коммит
446e7384f0
|
@ -1815,45 +1815,7 @@ IDBObjectStore::DeleteInternal(JSContext* aCx,
|
|||
|
||||
already_AddRefed<IDBIndex>
|
||||
IDBObjectStore::CreateIndex(const nsAString& aName,
|
||||
const nsAString& aKeyPath,
|
||||
const IDBIndexParameters& aOptionalParameters,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
KeyPath keyPath(0);
|
||||
if (NS_FAILED(KeyPath::Parse(aKeyPath, &keyPath)) ||
|
||||
!keyPath.IsValid()) {
|
||||
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return CreateIndexInternal(aName, keyPath, aOptionalParameters, aRv);
|
||||
}
|
||||
|
||||
already_AddRefed<IDBIndex>
|
||||
IDBObjectStore::CreateIndex(const nsAString& aName,
|
||||
const Sequence<nsString >& aKeyPath,
|
||||
const IDBIndexParameters& aOptionalParameters,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
KeyPath keyPath(0);
|
||||
if (aKeyPath.IsEmpty() ||
|
||||
NS_FAILED(KeyPath::Parse(aKeyPath, &keyPath)) ||
|
||||
!keyPath.IsValid()) {
|
||||
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return CreateIndexInternal(aName, keyPath, aOptionalParameters, aRv);
|
||||
}
|
||||
|
||||
already_AddRefed<IDBIndex>
|
||||
IDBObjectStore::CreateIndexInternal(
|
||||
const nsAString& aName,
|
||||
const KeyPath& aKeyPath,
|
||||
const StringOrStringSequence& aKeyPath,
|
||||
const IDBIndexParameters& aOptionalParameters,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
|
@ -1883,7 +1845,24 @@ IDBObjectStore::CreateIndexInternal(
|
|||
}
|
||||
}
|
||||
|
||||
if (aOptionalParameters.mMultiEntry && aKeyPath.IsArray()) {
|
||||
KeyPath keyPath(0);
|
||||
if (aKeyPath.IsString()) {
|
||||
if (NS_FAILED(KeyPath::Parse(aKeyPath.GetAsString(), &keyPath)) ||
|
||||
!keyPath.IsValid()) {
|
||||
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
MOZ_ASSERT(aKeyPath.IsStringSequence());
|
||||
if (aKeyPath.GetAsStringSequence().IsEmpty() ||
|
||||
NS_FAILED(KeyPath::Parse(aKeyPath.GetAsStringSequence(), &keyPath)) ||
|
||||
!keyPath.IsValid()) {
|
||||
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (aOptionalParameters.mMultiEntry && keyPath.IsArray()) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1912,7 +1891,7 @@ IDBObjectStore::CreateIndexInternal(
|
|||
#endif
|
||||
|
||||
IndexMetadata* metadata = indexes.AppendElement(
|
||||
IndexMetadata(transaction->NextIndexId(), nsString(aName), aKeyPath,
|
||||
IndexMetadata(transaction->NextIndexId(), nsString(aName), keyPath,
|
||||
locale,
|
||||
aOptionalParameters.mUnique,
|
||||
aOptionalParameters.mMultiEntry,
|
||||
|
|
|
@ -30,6 +30,7 @@ class DOMStringList;
|
|||
class IDBCursor;
|
||||
class IDBRequest;
|
||||
class IDBTransaction;
|
||||
class StringOrStringSequence;
|
||||
template <typename> class Sequence;
|
||||
|
||||
namespace indexedDB {
|
||||
|
@ -209,13 +210,7 @@ public:
|
|||
|
||||
already_AddRefed<IDBIndex>
|
||||
CreateIndex(const nsAString& aName,
|
||||
const nsAString& aKeyPath,
|
||||
const IDBIndexParameters& aOptionalParameters,
|
||||
ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<IDBIndex>
|
||||
CreateIndex(const nsAString& aName,
|
||||
const Sequence<nsString>& aKeyPath,
|
||||
const StringOrStringSequence& aKeyPath,
|
||||
const IDBIndexParameters& aOptionalParameters,
|
||||
ErrorResult& aRv);
|
||||
|
||||
|
@ -345,12 +340,6 @@ private:
|
|||
const Optional<uint32_t>& aLimit,
|
||||
ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<IDBIndex>
|
||||
CreateIndexInternal(const nsAString& aName,
|
||||
const KeyPath& aKeyPath,
|
||||
const IDBIndexParameters& aOptionalParameters,
|
||||
ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<IDBRequest>
|
||||
OpenCursorInternal(bool aKeysOnly,
|
||||
JSContext* aCx,
|
||||
|
|
|
@ -42,14 +42,8 @@ interface IDBObjectStore {
|
|||
[Throws]
|
||||
IDBRequest openCursor (optional any range, optional IDBCursorDirection direction = "next");
|
||||
|
||||
// Bug 899972
|
||||
// IDBIndex createIndex (DOMString name, (DOMString or sequence<DOMString>) keyPath, optional IDBIndexParameters optionalParameters);
|
||||
|
||||
[Throws]
|
||||
IDBIndex createIndex (DOMString name, DOMString keyPath, optional IDBIndexParameters optionalParameters);
|
||||
|
||||
[Throws]
|
||||
IDBIndex createIndex (DOMString name, sequence<DOMString> keyPath, optional IDBIndexParameters optionalParameters);
|
||||
IDBIndex createIndex (DOMString name, (DOMString or sequence<DOMString>) keyPath, optional IDBIndexParameters optionalParameters);
|
||||
|
||||
[Throws]
|
||||
IDBIndex index (DOMString name);
|
||||
|
|
Загрузка…
Ссылка в новой задаче