зеркало из https://github.com/mozilla/pjs.git
Bug 633414: Update cursor properties to latest spec. r=bent a=jst
This commit is contained in:
Родитель
0cce093a95
Коммит
3ed21b4f5f
|
@ -1466,6 +1466,8 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(IDBCursor, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(IDBCursorWithValue, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(IDBKeyRange, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(IDBIndex, nsDOMGenericSH,
|
||||
|
@ -4125,6 +4127,11 @@ nsDOMClassInfo::Init()
|
|||
DOM_CLASSINFO_MAP_ENTRY(nsIIDBCursor)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(IDBCursorWithValue, nsIIDBCursorWithValue)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIIDBCursor)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIIDBCursorWithValue)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(IDBKeyRange, nsIIDBKeyRange)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIIDBKeyRange)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
|
|
@ -499,6 +499,7 @@ DOMCI_CLASS(IDBDatabase)
|
|||
DOMCI_CLASS(IDBObjectStore)
|
||||
DOMCI_CLASS(IDBTransaction)
|
||||
DOMCI_CLASS(IDBCursor)
|
||||
DOMCI_CLASS(IDBCursorWithValue)
|
||||
DOMCI_CLASS(IDBKeyRange)
|
||||
DOMCI_CLASS(IDBIndex)
|
||||
DOMCI_CLASS(IDBVersionChangeEvent)
|
||||
|
|
|
@ -275,9 +275,11 @@ IDBCursor::CreateCommon(IDBRequest* aRequest,
|
|||
IDBCursor::IDBCursor()
|
||||
: mType(OBJECTSTORE),
|
||||
mDirection(nsIIDBCursor::NEXT),
|
||||
mCachedPrimaryKey(JSVAL_VOID),
|
||||
mCachedValue(JSVAL_VOID),
|
||||
mHaveCachedPrimaryKey(false),
|
||||
mHaveCachedValue(false),
|
||||
mValueRooted(false),
|
||||
mRooted(false),
|
||||
mContinueCalled(false),
|
||||
mHaveValue(true)
|
||||
{
|
||||
|
@ -288,7 +290,7 @@ IDBCursor::~IDBCursor()
|
|||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
if (mValueRooted) {
|
||||
if (mRooted) {
|
||||
NS_DROP_JS_OBJECTS(this, IDBCursor);
|
||||
}
|
||||
IDBObjectStore::ClearStructuredCloneBuffer(mCloneBuffer);
|
||||
|
@ -309,20 +311,31 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(IDBCursor)
|
|||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_ROOT_BEGIN(IDBCursor)
|
||||
if (tmp->mValueRooted) {
|
||||
if (tmp->mRooted) {
|
||||
NS_DROP_JS_OBJECTS(tmp, IDBCursor);
|
||||
tmp->mCachedPrimaryKey = JSVAL_VOID;
|
||||
tmp->mCachedValue = JSVAL_VOID;
|
||||
tmp->mHaveCachedPrimaryKey = false;
|
||||
tmp->mHaveCachedValue = false;
|
||||
tmp->mValueRooted = false;
|
||||
tmp->mRooted = false;
|
||||
tmp->mHaveValue = false;
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_ROOT_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(IDBCursor)
|
||||
NS_ASSERTION(tmp->mHaveCachedPrimaryKey ||
|
||||
JSVAL_IS_VOID(tmp->mCachedPrimaryKey),
|
||||
"Should have a cached primary key");
|
||||
NS_ASSERTION(tmp->mHaveCachedValue || JSVAL_IS_VOID(tmp->mCachedValue),
|
||||
"Should have a cached value");
|
||||
if (JSVAL_IS_GCTHING(tmp->mCachedValue)) {
|
||||
void *gcThing = JSVAL_TO_GCTHING(tmp->mCachedValue);
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_CALLBACK(gcThing)
|
||||
}
|
||||
if (JSVAL_IS_GCTHING(tmp->mCachedPrimaryKey)) {
|
||||
void *gcThing = JSVAL_TO_GCTHING(tmp->mCachedPrimaryKey);
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_CALLBACK(gcThing)
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(IDBCursor)
|
||||
|
@ -334,7 +347,11 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
|||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(IDBCursor)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIIDBCursor)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(IDBCursor)
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIIDBCursorWithValue, mType != INDEXKEY)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO_CONDITIONAL(IDBCursorWithValue,
|
||||
mType != INDEXKEY)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO_CONDITIONAL(IDBCursor,
|
||||
mType == INDEXKEY)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
|
@ -342,6 +359,7 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(IDBCursor)
|
|||
NS_IMPL_CYCLE_COLLECTING_RELEASE(IDBCursor)
|
||||
|
||||
DOMCI_DATA(IDBCursor, IDBCursor)
|
||||
DOMCI_DATA(IDBCursorWithValue, IDBCursor)
|
||||
|
||||
NS_IMETHODIMP
|
||||
IDBCursor::GetDirection(PRUint16* aDirection)
|
||||
|
@ -404,7 +422,7 @@ IDBCursor::GetKey(nsIVariant** aKey)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
IDBCursor::GetValue(JSContext* aCx,
|
||||
IDBCursor::GetPrimaryKey(JSContext* aCx,
|
||||
jsval* aValue)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
@ -414,21 +432,45 @@ IDBCursor::GetValue(JSContext* aCx,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
if (!mHaveCachedPrimaryKey) {
|
||||
if (!mRooted) {
|
||||
NS_HOLD_JS_OBJECTS(this, IDBCursor);
|
||||
mRooted = true;
|
||||
}
|
||||
|
||||
if (mType == INDEXKEY) {
|
||||
NS_ASSERTION(!mObjectKey.IsUnset(), "Bad key!");
|
||||
JSAutoRequest ar(aCx);
|
||||
|
||||
rv = IDBObjectStore::GetJSValFromKey(mObjectKey, aCx, aValue);
|
||||
NS_ASSERTION(mType == OBJECTSTORE ? !mKey.IsUnset() :
|
||||
!mObjectKey.IsUnset(), "Bad key!");
|
||||
|
||||
nsresult rv =
|
||||
IDBObjectStore::GetJSValFromKey(mType == OBJECTSTORE ? mKey : mObjectKey,
|
||||
aCx, &mCachedPrimaryKey);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mHaveCachedPrimaryKey = true;
|
||||
}
|
||||
|
||||
*aValue = mCachedPrimaryKey;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
IDBCursor::GetValue(JSContext* aCx,
|
||||
jsval* aValue)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
NS_ASSERTION(mType != INDEXKEY, "GetValue shouldn't exist on index keys");
|
||||
|
||||
if (!mHaveValue) {
|
||||
*aValue = JSVAL_VOID;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!mHaveCachedValue) {
|
||||
if (!mValueRooted) {
|
||||
if (!mRooted) {
|
||||
NS_HOLD_JS_OBJECTS(this, IDBCursor);
|
||||
mValueRooted = true;
|
||||
mRooted = true;
|
||||
}
|
||||
|
||||
JSAutoRequest ar(aCx);
|
||||
|
@ -663,9 +705,10 @@ ContinueHelper::GetSuccessResult(JSContext* aCx,
|
|||
{
|
||||
// Remove cached stuff from last time.
|
||||
mCursor->mCachedKey = nsnull;
|
||||
mCursor->mCachedObjectKey = nsnull;
|
||||
mCursor->mCachedValue = JSVAL_VOID;
|
||||
mCursor->mCachedPrimaryKey = JSVAL_VOID;
|
||||
mCursor->mHaveCachedValue = false;
|
||||
mCursor->mHaveCachedPrimaryKey = false;
|
||||
mCursor->mContinueCalled = false;
|
||||
|
||||
if (mKey.IsUnset()) {
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "mozilla/dom/indexedDB/IndexedDatabase.h"
|
||||
#include "mozilla/dom/indexedDB/IDBObjectStore.h"
|
||||
|
||||
#include "nsIIDBCursor.h"
|
||||
#include "nsIIDBCursorWithValue.h"
|
||||
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
|
@ -62,7 +62,7 @@ class ContinueObjectStoreHelper;
|
|||
class ContinueIndexHelper;
|
||||
class ContinueIndexObjectHelper;
|
||||
|
||||
class IDBCursor : public nsIIDBCursor
|
||||
class IDBCursor : public nsIIDBCursorWithValue
|
||||
{
|
||||
friend class ContinueHelper;
|
||||
friend class ContinueObjectStoreHelper;
|
||||
|
@ -72,6 +72,7 @@ class IDBCursor : public nsIIDBCursor
|
|||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_NSIIDBCURSOR
|
||||
NS_DECL_NSIIDBCURSORWITHVALUE
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(IDBCursor)
|
||||
|
||||
|
@ -88,7 +89,7 @@ public:
|
|||
const Key& aKey,
|
||||
JSAutoStructuredCloneBuffer& aCloneBuffer);
|
||||
|
||||
// For INDEX cursors.
|
||||
// For INDEXKEY cursors.
|
||||
static
|
||||
already_AddRefed<IDBCursor>
|
||||
Create(IDBRequest* aRequest,
|
||||
|
@ -149,16 +150,16 @@ protected:
|
|||
nsCOMPtr<nsIScriptContext> mScriptContext;
|
||||
nsCOMPtr<nsPIDOMWindow> mOwner;
|
||||
|
||||
// Not cycle-collected, these are guaranteed to be primitives!
|
||||
// Not cycle-collected, this is guaranteed to be primitive!
|
||||
nsCOMPtr<nsIVariant> mCachedKey;
|
||||
nsCOMPtr<nsIVariant> mCachedObjectKey;
|
||||
|
||||
Type mType;
|
||||
PRUint16 mDirection;
|
||||
nsCString mContinueQuery;
|
||||
nsCString mContinueToQuery;
|
||||
|
||||
// This one is cycle-collected!
|
||||
// These are cycle-collected!
|
||||
jsval mCachedPrimaryKey;
|
||||
jsval mCachedValue;
|
||||
|
||||
Key mRangeKey;
|
||||
|
@ -168,8 +169,9 @@ protected:
|
|||
JSAutoStructuredCloneBuffer mCloneBuffer;
|
||||
Key mContinueToKey;
|
||||
|
||||
bool mHaveCachedPrimaryKey;
|
||||
bool mHaveCachedValue;
|
||||
bool mValueRooted;
|
||||
bool mRooted;
|
||||
bool mContinueCalled;
|
||||
bool mHaveValue;
|
||||
};
|
||||
|
|
|
@ -100,6 +100,7 @@ DEFINES += -D_IMPL_NS_LAYOUT
|
|||
# js/src/xpconnect/src/dom_quickstubs.qsconf.
|
||||
XPIDLSRCS = \
|
||||
nsIIDBCursor.idl \
|
||||
nsIIDBCursorWithValue.idl \
|
||||
nsIIDBDatabase.idl \
|
||||
nsIIDBDatabaseException.idl \
|
||||
nsIIDBFactory.idl \
|
||||
|
|
|
@ -51,7 +51,7 @@ interface nsIVariant;
|
|||
* http://dev.w3.org/2006/webapi/WebSimpleDB/#idl-def-IDBCursor for more
|
||||
* information.
|
||||
*/
|
||||
[scriptable, uuid(585d4d50-11a8-4d65-951e-805787f59d89)]
|
||||
[scriptable, uuid(adee4085-68cd-4568-9d74-e3d32b6dc5c5)]
|
||||
interface nsIIDBCursor : nsISupports
|
||||
{
|
||||
const unsigned short NEXT = 0;
|
||||
|
@ -65,7 +65,7 @@ interface nsIIDBCursor : nsISupports
|
|||
readonly attribute nsIVariant key;
|
||||
|
||||
[implicit_jscontext]
|
||||
readonly attribute jsval value;
|
||||
readonly attribute jsval primaryKey;
|
||||
|
||||
// Calling continue means that the same onsuccess function will be called
|
||||
// again with the new key/value (or null if no more matches).
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Indexed Database.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jonas Sicking <jonas@sicking.cc>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIIDBCursor.idl"
|
||||
|
||||
%{C++
|
||||
#include "jsapi.h"
|
||||
%}
|
||||
|
||||
/**
|
||||
* IDBCursor interface. See
|
||||
* http://dev.w3.org/2006/webapi/WebSimpleDB/#idl-def-IDBCursor for more
|
||||
* information.
|
||||
*/
|
||||
[scriptable, uuid(b6b7e08a-4379-4441-a176-447c5c96df69)]
|
||||
interface nsIIDBCursorWithValue : nsIIDBCursor
|
||||
{
|
||||
[implicit_jscontext]
|
||||
readonly attribute jsval value;
|
||||
};
|
|
@ -52,7 +52,7 @@
|
|||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, data.num, "Good key");
|
||||
is(cursor.value, data.id, "Good value");
|
||||
is(cursor.primaryKey, data.id, "Good value");
|
||||
seenCount++;
|
||||
cursor.continue();
|
||||
}
|
||||
|
|
|
@ -96,6 +96,7 @@
|
|||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, sortedKeys[keyIndex], "Correct key");
|
||||
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
|
||||
is(cursor.value, "foo", "Correct value");
|
||||
|
||||
cursor.continue();
|
||||
|
@ -110,6 +111,7 @@
|
|||
}
|
||||
|
||||
is(cursor.key, sortedKeys[keyIndex], "Correct key");
|
||||
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
|
||||
is(cursor.value, "foo", "Correct value");
|
||||
|
||||
keyIndex++;
|
||||
|
@ -131,11 +133,13 @@
|
|||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, sortedKeys[keyIndex], "Correct key");
|
||||
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
|
||||
is(cursor.value, "foo", "Correct value");
|
||||
|
||||
cursor.continue();
|
||||
|
||||
is(cursor.key, sortedKeys[keyIndex], "Correct key");
|
||||
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
|
||||
is(cursor.value, "foo", "Correct value");
|
||||
|
||||
keyIndex++;
|
||||
|
@ -156,6 +160,7 @@
|
|||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, sortedKeys[keyIndex], "Correct key");
|
||||
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
|
||||
is(cursor.value, "foo", "Correct value");
|
||||
|
||||
if (keyIndex) {
|
||||
|
@ -166,6 +171,7 @@
|
|||
}
|
||||
|
||||
is(cursor.key, sortedKeys[keyIndex], "Correct key");
|
||||
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
|
||||
is(cursor.value, "foo", "Correct value");
|
||||
|
||||
keyIndex += keyIndex ? 1: 6;
|
||||
|
@ -186,6 +192,7 @@
|
|||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, sortedKeys[keyIndex], "Correct key");
|
||||
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
|
||||
is(cursor.value, "foo", "Correct value");
|
||||
|
||||
if (keyIndex) {
|
||||
|
@ -196,6 +203,7 @@
|
|||
}
|
||||
|
||||
is(cursor.key, sortedKeys[keyIndex], "Correct key");
|
||||
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
|
||||
is(cursor.value, "foo", "Correct value");
|
||||
|
||||
keyIndex += keyIndex ? 1: 3;
|
||||
|
@ -216,6 +224,7 @@
|
|||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, sortedKeys[keyIndex], "Correct key");
|
||||
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
|
||||
is(cursor.value, "foo", "Correct value");
|
||||
|
||||
if (keyIndex) {
|
||||
|
@ -226,6 +235,7 @@
|
|||
}
|
||||
|
||||
is(cursor.key, sortedKeys[keyIndex], "Correct key");
|
||||
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
|
||||
is(cursor.value, "foo", "Correct value");
|
||||
|
||||
keyIndex += keyIndex ? 1 : 7;
|
||||
|
@ -246,6 +256,7 @@
|
|||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, sortedKeys[keyIndex], "Correct key");
|
||||
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
|
||||
is(cursor.value, "foo", "Correct value");
|
||||
|
||||
if (keyIndex == 4) {
|
||||
|
@ -292,6 +303,7 @@
|
|||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, sortedKeys[keyIndex], "Correct key");
|
||||
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
|
||||
is(cursor.value, "foo", "Correct value");
|
||||
|
||||
if (keyIndex == 4) {
|
||||
|
@ -336,11 +348,13 @@
|
|||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, sortedKeys[keyIndex], "Correct key");
|
||||
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
|
||||
is(cursor.value, "foo", "Correct value");
|
||||
|
||||
cursor.continue();
|
||||
|
||||
is(cursor.key, sortedKeys[keyIndex], "Correct key");
|
||||
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
|
||||
is(cursor.value, "foo", "Correct value");
|
||||
|
||||
keyIndex--;
|
||||
|
|
|
@ -155,15 +155,17 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.value, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct value");
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct primary key");
|
||||
ok(!("value" in cursor), "No value");
|
||||
|
||||
cursor.continue();
|
||||
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.value, objectStoreDataNameSort[keyIndex].key,
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct value");
|
||||
ok(!("value" in cursor), "No value");
|
||||
|
||||
keyIndex++;
|
||||
}
|
||||
|
@ -186,14 +188,14 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataWeightSort[keyIndex].value.weight,
|
||||
"Correct key");
|
||||
is(cursor.value, objectStoreDataWeightSort[keyIndex].key,
|
||||
is(cursor.primaryKey, objectStoreDataWeightSort[keyIndex].key,
|
||||
"Correct value");
|
||||
|
||||
cursor.continue();
|
||||
|
||||
is(cursor.key, objectStoreDataWeightSort[keyIndex].value.weight,
|
||||
"Correct key");
|
||||
is(cursor.value, objectStoreDataWeightSort[keyIndex].key,
|
||||
is(cursor.primaryKey, objectStoreDataWeightSort[keyIndex].key,
|
||||
"Correct value");
|
||||
|
||||
keyIndex++;
|
||||
|
@ -226,14 +228,14 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.value, objectStoreDataNameSort[keyIndex].key,
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct value");
|
||||
|
||||
cursor.continue();
|
||||
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.value, objectStoreDataNameSort[keyIndex].key,
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct value");
|
||||
|
||||
keyIndex--;
|
||||
|
@ -258,7 +260,7 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.value, objectStoreDataNameSort[keyIndex].key,
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct value");
|
||||
|
||||
cursor.continue();
|
||||
|
@ -284,7 +286,7 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.value, objectStoreDataNameSort[keyIndex].key,
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct value");
|
||||
|
||||
cursor.continue();
|
||||
|
@ -310,7 +312,7 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.value, objectStoreDataNameSort[keyIndex].key,
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct value");
|
||||
|
||||
cursor.continue();
|
||||
|
@ -336,7 +338,7 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.value, objectStoreDataNameSort[keyIndex].key,
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct value");
|
||||
|
||||
cursor.continue();
|
||||
|
@ -362,7 +364,7 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.value, objectStoreDataNameSort[keyIndex].key,
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct value");
|
||||
|
||||
cursor.continue();
|
||||
|
@ -388,7 +390,7 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.value, objectStoreDataNameSort[keyIndex].key,
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct value");
|
||||
|
||||
cursor.continue();
|
||||
|
@ -414,7 +416,7 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.value, objectStoreDataNameSort[keyIndex].key,
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct value");
|
||||
|
||||
cursor.continue();
|
||||
|
@ -440,7 +442,7 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.value, objectStoreDataNameSort[keyIndex].key,
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct value");
|
||||
|
||||
cursor.continue();
|
||||
|
@ -466,7 +468,7 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.value, objectStoreDataNameSort[keyIndex].key,
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct value");
|
||||
|
||||
cursor.continue();
|
||||
|
@ -491,6 +493,8 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct primary key");
|
||||
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct name");
|
||||
is(cursor.value.height,
|
||||
|
@ -506,6 +510,8 @@
|
|||
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct primary key");
|
||||
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct name");
|
||||
is(cursor.value.height,
|
||||
|
@ -538,6 +544,8 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct primary key");
|
||||
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct name");
|
||||
is(cursor.value.height,
|
||||
|
@ -553,6 +561,8 @@
|
|||
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct primary key");
|
||||
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct name");
|
||||
is(cursor.value.height,
|
||||
|
@ -586,6 +596,8 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct primary key");
|
||||
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct name");
|
||||
is(cursor.value.height,
|
||||
|
@ -601,6 +613,8 @@
|
|||
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct primary key");
|
||||
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct name");
|
||||
is(cursor.value.height,
|
||||
|
@ -634,6 +648,8 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct primary key");
|
||||
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct name");
|
||||
is(cursor.value.height,
|
||||
|
@ -649,6 +665,8 @@
|
|||
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct primary key");
|
||||
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct name");
|
||||
is(cursor.value.height,
|
||||
|
@ -682,6 +700,8 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct primary key");
|
||||
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct name");
|
||||
is(cursor.value.height,
|
||||
|
@ -697,6 +717,8 @@
|
|||
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct primary key");
|
||||
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct name");
|
||||
is(cursor.value.height,
|
||||
|
@ -730,6 +752,8 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct primary key");
|
||||
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct name");
|
||||
is(cursor.value.height,
|
||||
|
@ -745,6 +769,8 @@
|
|||
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct primary key");
|
||||
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct name");
|
||||
is(cursor.value.height,
|
||||
|
@ -778,6 +804,8 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct primary key");
|
||||
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct name");
|
||||
is(cursor.value.height,
|
||||
|
@ -793,6 +821,8 @@
|
|||
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct primary key");
|
||||
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct name");
|
||||
is(cursor.value.height,
|
||||
|
@ -827,7 +857,7 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
|
||||
"Correct key");
|
||||
is(cursor.value, objectStoreDataHeightSort[keyIndex].key,
|
||||
is(cursor.primaryKey, objectStoreDataHeightSort[keyIndex].key,
|
||||
"Correct value");
|
||||
|
||||
cursor.continue();
|
||||
|
@ -854,7 +884,7 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
|
||||
"Correct key");
|
||||
is(cursor.value, objectStoreDataHeightSort[keyIndex].key,
|
||||
is(cursor.primaryKey, objectStoreDataHeightSort[keyIndex].key,
|
||||
"Correct value");
|
||||
|
||||
cursor.continue();
|
||||
|
@ -880,7 +910,7 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
|
||||
"Correct key");
|
||||
is(cursor.value, objectStoreDataHeightSort[keyIndex].key,
|
||||
is(cursor.primaryKey, objectStoreDataHeightSort[keyIndex].key,
|
||||
"Correct value");
|
||||
|
||||
cursor.continue();
|
||||
|
@ -909,6 +939,8 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
|
||||
"Correct key");
|
||||
is(cursor.primaryKey, objectStoreDataHeightSort[keyIndex].key,
|
||||
"Correct primary key");
|
||||
is(cursor.value.name, objectStoreDataHeightSort[keyIndex].value.name,
|
||||
"Correct name");
|
||||
is(cursor.value.height,
|
||||
|
@ -944,6 +976,8 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
|
||||
"Correct key");
|
||||
is(cursor.primaryKey, objectStoreDataHeightSort[keyIndex].key,
|
||||
"Correct primary key");
|
||||
is(cursor.value.name, objectStoreDataHeightSort[keyIndex].value.name,
|
||||
"Correct name");
|
||||
is(cursor.value.height,
|
||||
|
@ -978,6 +1012,8 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
|
||||
"Correct key");
|
||||
is(cursor.primaryKey, objectStoreDataHeightSort[keyIndex].key,
|
||||
"Correct primary key");
|
||||
is(cursor.value.name, objectStoreDataHeightSort[keyIndex].value.name,
|
||||
"Correct name");
|
||||
is(cursor.value.height,
|
||||
|
@ -1014,7 +1050,7 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.value, objectStoreDataNameSort[keyIndex].key,
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct value");
|
||||
|
||||
let nextKey = !keyIndex ? "Pat" : undefined;
|
||||
|
@ -1023,7 +1059,7 @@
|
|||
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.value, objectStoreDataNameSort[keyIndex].key,
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct value");
|
||||
|
||||
if (!keyIndex) {
|
||||
|
@ -1052,7 +1088,7 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.value, objectStoreDataNameSort[keyIndex].key,
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct value");
|
||||
|
||||
let nextKey = !keyIndex ? "Flo" : undefined;
|
||||
|
@ -1061,7 +1097,7 @@
|
|||
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.value, objectStoreDataNameSort[keyIndex].key,
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct value");
|
||||
|
||||
keyIndex += keyIndex ? 1 : 2;
|
||||
|
@ -1085,6 +1121,8 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct primary key");
|
||||
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct name");
|
||||
is(cursor.value.height,
|
||||
|
@ -1102,6 +1140,8 @@
|
|||
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct primary key");
|
||||
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct name");
|
||||
is(cursor.value.height,
|
||||
|
@ -1139,6 +1179,8 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct primary key");
|
||||
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct name");
|
||||
is(cursor.value.height,
|
||||
|
@ -1156,6 +1198,8 @@
|
|||
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct key");
|
||||
is(cursor.primaryKey, objectStoreDataNameSort[keyIndex].key,
|
||||
"Correct primary key");
|
||||
is(cursor.value.name, objectStoreDataNameSort[keyIndex].value.name,
|
||||
"Correct name");
|
||||
is(cursor.value.height,
|
||||
|
|
|
@ -106,7 +106,7 @@
|
|||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataWeightSort[keyIndex].value.weight,
|
||||
"Correct key");
|
||||
is(cursor.value, objectStoreDataWeightSort[keyIndex].key,
|
||||
is(cursor.primaryKey, objectStoreDataWeightSort[keyIndex].key,
|
||||
"Correct value");
|
||||
keyIndex++;
|
||||
|
||||
|
|
|
@ -466,6 +466,7 @@ members = [
|
|||
|
||||
# dom/indexedDB
|
||||
'nsIIDBCursor.*',
|
||||
'nsIIDBCursorWithValue.*',
|
||||
'nsIIDBDatabase.*',
|
||||
'nsIIDBDatabaseException.*',
|
||||
'nsIIDBIndex.*',
|
||||
|
|
Загрузка…
Ссылка в новой задаче