--- /dev/null
+Test IndexedDB's IDBCursor.continue() behavior when called beyond normal scope.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.open('cursor-continue')
+db = event.target.result
+db.setVersion('new version')
+trans = event.target.result
+PASS trans !== null is true
+Deleted all object stores.
+db.createObjectStore('someObjectStore')
+objectStore.createIndex('someIndex', 'x')
+objectStore.add({'x': 0 }, 0)
+objectStore.add({'x': 1 }, 1)
+objectStore.add({'x': 2 }, 2)
+objectStore.add({'x': 3 }, 3)
+objectStore.add({'x': 4 }, 4)
+objectStore.add({'x': 5 }, 5)
+objectStore.add({'x': 6 }, 6)
+objectStore.add({'x': 7 }, 7)
+objectStore.add({'x': 8 }, 8)
+objectStore.add({'x': 9 }, 9)
+objectStore.add({'x': 10 }, 10)
+objectStore.add({'x': 11 }, 11)
+objectStore.add({'x': 12 }, 12)
+objectStore.add({'x': 13 }, 13)
+objectStore.add({'x': 14 }, 14)
+objectStore.add({'x': 15 }, 15)
+objectStore.add({'x': 16 }, 16)
+objectStore.add({'x': 17 }, 17)
+objectStore.add({'x': 18 }, 18)
+objectStore.add({'x': 19 }, 19)
+objectStore.add({'x': 20 }, 20)
+objectStore.add({'x': 21 }, 21)
+objectStore.add({'x': 22 }, 22)
+objectStore.add({'x': 23 }, 23)
+objectStore.add({'x': 24 }, 24)
+continueTest()
+
+Checking objectStore
+====================
+indexObject.openCursor(null, IDBCursor.NEXT)
+self.continueValue = 0
+doubleContinueCallback()
+cursor = event.target.result
+Checking value at 0
+PASS cursor.key is 0
+PASS cursor.value.x is 0
+cursor.continue()
+PASS cursor.key is 0
+PASS cursor.value.x is 0
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 0
+PASS cursor.value.x is 0
+self.continueValue++;
+doubleContinueCallback()
+cursor = event.target.result
+Checking value at 1
+PASS cursor.key is 1
+PASS cursor.value.x is 1
+cursor.continue()
+PASS cursor.key is 1
+PASS cursor.value.x is 1
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 1
+PASS cursor.value.x is 1
+self.continueValue++;
+doubleContinueCallback()
+cursor = event.target.result
+Checking value at 2
+PASS cursor.key is 2
+PASS cursor.value.x is 2
+cursor.continue()
+PASS cursor.key is 2
+PASS cursor.value.x is 2
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 2
+PASS cursor.value.x is 2
+self.continueValue++;
+doubleContinueCallback()
+cursor = event.target.result
+Checking value at 3
+PASS cursor.key is 3
+PASS cursor.value.x is 3
+cursor.continue()
+PASS cursor.key is 3
+PASS cursor.value.x is 3
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 3
+PASS cursor.value.x is 3
+self.continueValue++;
+doubleContinueCallback()
+cursor = event.target.result
+Checking value at 4
+PASS cursor.key is 4
+PASS cursor.value.x is 4
+cursor.continue()
+PASS cursor.key is 4
+PASS cursor.value.x is 4
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 4
+PASS cursor.value.x is 4
+self.continueValue++;
+doubleContinueCallback()
+cursor = event.target.result
+Checking value at 5
+PASS cursor.key is 5
+PASS cursor.value.x is 5
+cursor.continue()
+PASS cursor.key is 5
+PASS cursor.value.x is 5
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 5
+PASS cursor.value.x is 5
+self.continueValue++;
+doubleContinueCallback()
+cursor = event.target.result
+Checking value at 6
+PASS cursor.key is 6
+PASS cursor.value.x is 6
+cursor.continue()
+PASS cursor.key is 6
+PASS cursor.value.x is 6
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 6
+PASS cursor.value.x is 6
+self.continueValue++;
+doubleContinueCallback()
+cursor = event.target.result
+Checking value at 7
+PASS cursor.key is 7
+PASS cursor.value.x is 7
+cursor.continue()
+PASS cursor.key is 7
+PASS cursor.value.x is 7
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 7
+PASS cursor.value.x is 7
+self.continueValue++;
+doubleContinueCallback()
+cursor = event.target.result
+Checking value at 8
+PASS cursor.key is 8
+PASS cursor.value.x is 8
+cursor.continue()
+PASS cursor.key is 8
+PASS cursor.value.x is 8
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 8
+PASS cursor.value.x is 8
+self.continueValue++;
+doubleContinueCallback()
+cursor = event.target.result
+Checking value at 9
+PASS cursor.key is 9
+PASS cursor.value.x is 9
+cursor.continue()
+PASS cursor.key is 9
+PASS cursor.value.x is 9
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 9
+PASS cursor.value.x is 9
+self.continueValue++;
+doubleContinueCallback()
+cursor = event.target.result
+Checking value at 10
+PASS cursor.key is 10
+PASS cursor.value.x is 10
+cursor.continue()
+PASS cursor.key is 10
+PASS cursor.value.x is 10
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 10
+PASS cursor.value.x is 10
+self.continueValue++;
+doubleContinueCallback()
+cursor = event.target.result
+Checking value at 11
+PASS cursor.key is 11
+PASS cursor.value.x is 11
+cursor.continue()
+PASS cursor.key is 11
+PASS cursor.value.x is 11
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 11
+PASS cursor.value.x is 11
+self.continueValue++;
+doubleContinueCallback()
+cursor = event.target.result
+Checking value at 12
+PASS cursor.key is 12
+PASS cursor.value.x is 12
+cursor.continue()
+PASS cursor.key is 12
+PASS cursor.value.x is 12
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 12
+PASS cursor.value.x is 12
+self.continueValue++;
+doubleContinueCallback()
+cursor = event.target.result
+Checking value at 13
+PASS cursor.key is 13
+PASS cursor.value.x is 13
+cursor.continue()
+PASS cursor.key is 13
+PASS cursor.value.x is 13
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 13
+PASS cursor.value.x is 13
+self.continueValue++;
+doubleContinueCallback()
+cursor = event.target.result
+Checking value at 14
+PASS cursor.key is 14
+PASS cursor.value.x is 14
+cursor.continue()
+PASS cursor.key is 14
+PASS cursor.value.x is 14
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 14
+PASS cursor.value.x is 14
+self.continueValue++;
+doubleContinueCallback()
+cursor = event.target.result
+Checking value at 15
+PASS cursor.key is 15
+PASS cursor.value.x is 15
+cursor.continue()
+PASS cursor.key is 15
+PASS cursor.value.x is 15
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 15
+PASS cursor.value.x is 15
+self.continueValue++;
+doubleContinueCallback()
+cursor = event.target.result
+Checking value at 16
+PASS cursor.key is 16
+PASS cursor.value.x is 16
+cursor.continue()
+PASS cursor.key is 16
+PASS cursor.value.x is 16
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 16
+PASS cursor.value.x is 16
+self.continueValue++;
+doubleContinueCallback()
+cursor = event.target.result
+Checking value at 17
+PASS cursor.key is 17
+PASS cursor.value.x is 17
+cursor.continue()
+PASS cursor.key is 17
+PASS cursor.value.x is 17
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 17
+PASS cursor.value.x is 17
+self.continueValue++;
+doubleContinueCallback()
+cursor = event.target.result
+Checking value at 18
+PASS cursor.key is 18
+PASS cursor.value.x is 18
+cursor.continue()
+PASS cursor.key is 18
+PASS cursor.value.x is 18
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 18
+PASS cursor.value.x is 18
+self.continueValue++;
+doubleContinueCallback()
+cursor = event.target.result
+Checking value at 19
+PASS cursor.key is 19
+PASS cursor.value.x is 19
+cursor.continue()
+PASS cursor.key is 19
+PASS cursor.value.x is 19
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 19
+PASS cursor.value.x is 19
+self.continueValue++;
+doubleContinueCallback()
+cursor = event.target.result
+Checking value at 20
+PASS cursor.key is 20
+PASS cursor.value.x is 20
+cursor.continue()
+PASS cursor.key is 20
+PASS cursor.value.x is 20
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 20
+PASS cursor.value.x is 20
+self.continueValue++;
+doubleContinueCallback()
+cursor = event.target.result
+Checking value at 21
+PASS cursor.key is 21
+PASS cursor.value.x is 21
+cursor.continue()
+PASS cursor.key is 21
+PASS cursor.value.x is 21
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 21
+PASS cursor.value.x is 21
+self.continueValue++;
+doubleContinueCallback()
+cursor = event.target.result
+Checking value at 22
+PASS cursor.key is 22
+PASS cursor.value.x is 22
+cursor.continue()
+PASS cursor.key is 22
+PASS cursor.value.x is 22
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 22
+PASS cursor.value.x is 22
+self.continueValue++;
+doubleContinueCallback()
+cursor = event.target.result
+Checking value at 23
+PASS cursor.key is 23
+PASS cursor.value.x is 23
+cursor.continue()
+PASS cursor.key is 23
+PASS cursor.value.x is 23
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 23
+PASS cursor.value.x is 23
+self.continueValue++;
+doubleContinueCallback()
+cursor = event.target.result
+Checking value at 24
+PASS cursor.key is 24
+PASS cursor.value.x is 24
+cursor.continue()
+PASS cursor.key is 24
+PASS cursor.value.x is 24
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 24
+PASS cursor.value.x is 24
+self.continueValue++;
+doubleContinueCallback()
+cursor = event.target.result
+continueIndexTest()
+
+Checking index
+==============
+indexObject.openCursor(null, IDBCursor.NEXT)
+self.continueValue = 0
+cursor = event.target.result
+Checking value at 0
+PASS cursor.key is 0
+PASS cursor.value.x is 0
+cursor.continue()
+PASS cursor.key is 0
+PASS cursor.value.x is 0
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 0
+PASS cursor.value.x is 0
+self.continueValue++;
+cursor = event.target.result
+Checking value at 1
+PASS cursor.key is 1
+PASS cursor.value.x is 1
+cursor.continue()
+PASS cursor.key is 1
+PASS cursor.value.x is 1
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 1
+PASS cursor.value.x is 1
+self.continueValue++;
+cursor = event.target.result
+Checking value at 2
+PASS cursor.key is 2
+PASS cursor.value.x is 2
+cursor.continue()
+PASS cursor.key is 2
+PASS cursor.value.x is 2
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 2
+PASS cursor.value.x is 2
+self.continueValue++;
+cursor = event.target.result
+Checking value at 3
+PASS cursor.key is 3
+PASS cursor.value.x is 3
+cursor.continue()
+PASS cursor.key is 3
+PASS cursor.value.x is 3
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 3
+PASS cursor.value.x is 3
+self.continueValue++;
+cursor = event.target.result
+Checking value at 4
+PASS cursor.key is 4
+PASS cursor.value.x is 4
+cursor.continue()
+PASS cursor.key is 4
+PASS cursor.value.x is 4
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 4
+PASS cursor.value.x is 4
+self.continueValue++;
+cursor = event.target.result
+Checking value at 5
+PASS cursor.key is 5
+PASS cursor.value.x is 5
+cursor.continue()
+PASS cursor.key is 5
+PASS cursor.value.x is 5
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 5
+PASS cursor.value.x is 5
+self.continueValue++;
+cursor = event.target.result
+Checking value at 6
+PASS cursor.key is 6
+PASS cursor.value.x is 6
+cursor.continue()
+PASS cursor.key is 6
+PASS cursor.value.x is 6
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 6
+PASS cursor.value.x is 6
+self.continueValue++;
+cursor = event.target.result
+Checking value at 7
+PASS cursor.key is 7
+PASS cursor.value.x is 7
+cursor.continue()
+PASS cursor.key is 7
+PASS cursor.value.x is 7
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 7
+PASS cursor.value.x is 7
+self.continueValue++;
+cursor = event.target.result
+Checking value at 8
+PASS cursor.key is 8
+PASS cursor.value.x is 8
+cursor.continue()
+PASS cursor.key is 8
+PASS cursor.value.x is 8
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 8
+PASS cursor.value.x is 8
+self.continueValue++;
+cursor = event.target.result
+Checking value at 9
+PASS cursor.key is 9
+PASS cursor.value.x is 9
+cursor.continue()
+PASS cursor.key is 9
+PASS cursor.value.x is 9
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 9
+PASS cursor.value.x is 9
+self.continueValue++;
+cursor = event.target.result
+Checking value at 10
+PASS cursor.key is 10
+PASS cursor.value.x is 10
+cursor.continue()
+PASS cursor.key is 10
+PASS cursor.value.x is 10
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 10
+PASS cursor.value.x is 10
+self.continueValue++;
+cursor = event.target.result
+Checking value at 11
+PASS cursor.key is 11
+PASS cursor.value.x is 11
+cursor.continue()
+PASS cursor.key is 11
+PASS cursor.value.x is 11
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 11
+PASS cursor.value.x is 11
+self.continueValue++;
+cursor = event.target.result
+Checking value at 12
+PASS cursor.key is 12
+PASS cursor.value.x is 12
+cursor.continue()
+PASS cursor.key is 12
+PASS cursor.value.x is 12
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 12
+PASS cursor.value.x is 12
+self.continueValue++;
+cursor = event.target.result
+Checking value at 13
+PASS cursor.key is 13
+PASS cursor.value.x is 13
+cursor.continue()
+PASS cursor.key is 13
+PASS cursor.value.x is 13
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 13
+PASS cursor.value.x is 13
+self.continueValue++;
+cursor = event.target.result
+Checking value at 14
+PASS cursor.key is 14
+PASS cursor.value.x is 14
+cursor.continue()
+PASS cursor.key is 14
+PASS cursor.value.x is 14
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 14
+PASS cursor.value.x is 14
+self.continueValue++;
+cursor = event.target.result
+Checking value at 15
+PASS cursor.key is 15
+PASS cursor.value.x is 15
+cursor.continue()
+PASS cursor.key is 15
+PASS cursor.value.x is 15
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 15
+PASS cursor.value.x is 15
+self.continueValue++;
+cursor = event.target.result
+Checking value at 16
+PASS cursor.key is 16
+PASS cursor.value.x is 16
+cursor.continue()
+PASS cursor.key is 16
+PASS cursor.value.x is 16
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 16
+PASS cursor.value.x is 16
+self.continueValue++;
+cursor = event.target.result
+Checking value at 17
+PASS cursor.key is 17
+PASS cursor.value.x is 17
+cursor.continue()
+PASS cursor.key is 17
+PASS cursor.value.x is 17
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 17
+PASS cursor.value.x is 17
+self.continueValue++;
+cursor = event.target.result
+Checking value at 18
+PASS cursor.key is 18
+PASS cursor.value.x is 18
+cursor.continue()
+PASS cursor.key is 18
+PASS cursor.value.x is 18
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 18
+PASS cursor.value.x is 18
+self.continueValue++;
+cursor = event.target.result
+Checking value at 19
+PASS cursor.key is 19
+PASS cursor.value.x is 19
+cursor.continue()
+PASS cursor.key is 19
+PASS cursor.value.x is 19
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 19
+PASS cursor.value.x is 19
+self.continueValue++;
+cursor = event.target.result
+Checking value at 20
+PASS cursor.key is 20
+PASS cursor.value.x is 20
+cursor.continue()
+PASS cursor.key is 20
+PASS cursor.value.x is 20
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 20
+PASS cursor.value.x is 20
+self.continueValue++;
+cursor = event.target.result
+Checking value at 21
+PASS cursor.key is 21
+PASS cursor.value.x is 21
+cursor.continue()
+PASS cursor.key is 21
+PASS cursor.value.x is 21
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 21
+PASS cursor.value.x is 21
+self.continueValue++;
+cursor = event.target.result
+Checking value at 22
+PASS cursor.key is 22
+PASS cursor.value.x is 22
+cursor.continue()
+PASS cursor.key is 22
+PASS cursor.value.x is 22
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 22
+PASS cursor.value.x is 22
+self.continueValue++;
+cursor = event.target.result
+Checking value at 23
+PASS cursor.key is 23
+PASS cursor.value.x is 23
+cursor.continue()
+PASS cursor.key is 23
+PASS cursor.value.x is 23
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 23
+PASS cursor.value.x is 23
+self.continueValue++;
+cursor = event.target.result
+Checking value at 24
+PASS cursor.key is 24
+PASS cursor.value.x is 24
+cursor.continue()
+PASS cursor.key is 24
+PASS cursor.value.x is 24
+Expecting exception from cursor.continue()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS cursor.key is 24
+PASS cursor.value.x is 24
+self.continueValue++;
+cursor = event.target.result
+testModifyContinueOrder()
+
+Checking modification
+=====================
+indexObject.openCursor(null, IDBCursor.NEXT)
+self.continueValue = 0
+cursor = event.target.result
+cursor.continue()
+cursor = event.target.result
+cursor.update({ x: 100 + self.continueValue })
+cursor.continue()
+cursor = event.target.result
+cursor.delete()
+cursor.continue()
+cursor = event.target.result
+cursor.update({ x: 100 + self.continueValue })
+cursor.continue()
+cursor = event.target.result
+cursor.continue()
+Expecting exception from cursor.update({ x: 100 + self.continueValue})
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+cursor = event.target.result
+cursor.update({ x: 100 + self.continueValue })
+cursor.continue()
+cursor = event.target.result
+cursor.continue()
+Expecting exception from cursor.delete()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+cursor = event.target.result
+cursor.update({ x: 100 + self.continueValue })
+cursor.continue()
+cursor = event.target.result
+cursor.delete()
+cursor.continue()
+cursor = event.target.result
+cursor.update({ x: 100 + self.continueValue })
+cursor.continue()
+cursor = event.target.result
+cursor.continue()
+cursor = event.target.result
+cursor.update({ x: 100 + self.continueValue })
+cursor.continue()
+cursor = event.target.result
+cursor.continue()
+cursor = event.target.result
+cursor.update({ x: 100 + self.continueValue })
+cursor.continue()
+cursor = event.target.result
+cursor.delete()
+cursor.continue()
+cursor = event.target.result
+cursor.update({ x: 100 + self.continueValue })
+cursor.continue()
+cursor = event.target.result
+cursor.continue()
+cursor = event.target.result
+cursor.update({ x: 100 + self.continueValue })
+cursor.continue()
+cursor = event.target.result
+cursor.continue()
+cursor = event.target.result
+cursor.update({ x: 100 + self.continueValue })
+cursor.continue()
+cursor = event.target.result
+cursor.delete()
+cursor.continue()
+cursor = event.target.result
+cursor.update({ x: 100 + self.continueValue })
+cursor.continue()
+cursor = event.target.result
+cursor.continue()
+cursor = event.target.result
+cursor.update({ x: 100 + self.continueValue })
+cursor.continue()
+cursor = event.target.result
+cursor.continue()
+Expecting exception from cursor.update({ x: 100 + self.continueValue})
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+cursor = event.target.result
+cursor.update({ x: 100 + self.continueValue })
+cursor.continue()
+cursor = event.target.result
+cursor.delete()
+cursor.continue()
+cursor = event.target.result
+cursor.update({ x: 100 + self.continueValue })
+cursor.continue()
+cursor = event.target.result
+cursor.continue()
+cursor = event.target.result
+cursor.update({ x: 100 + self.continueValue })
+cursor.continue()
+cursor = event.target.result
+cursor.continue()
+cursor = event.target.result
+cursor.update({ x: 100 + self.continueValue })
+cursor.continue()
+cursor = event.target.result
+cursor.delete()
+cursor.continue()
+cursor = event.target.result
+cursor.update({ x: 100 + self.continueValue })
+cursor.continue()
+cursor = event.target.result
+cursor.continue()
+Expecting exception from cursor.update({ x: 100 + self.continueValue})
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+cursor = event.target.result
+cursor.update({ x: 100 + self.continueValue })
+cursor.continue()
+cursor = event.target.result
+cursor.continue()
+cursor = event.target.result
+cursor.update({ x: 100 + self.continueValue })
+cursor.continue()
+cursor = event.target.result
+cursor.delete()
+cursor.continue()
+cursor = event.target.result
+cursor.update({ x: 100 + self.continueValue })
+cursor.continue()
+cursor = event.target.result
+cursor.continue()
+cursor = event.target.result
+cursor.update({ x: 100 + self.continueValue })
+cursor.continue()
+cursor = event.target.result
+cursor.continue()
+cursor = event.target.result
+cursor.update({ x: 100 + self.continueValue })
+cursor.continue()
+cursor = event.target.result
+cursor.delete()
+cursor.continue()
+cursor = event.target.result
+cursor.update({ x: 100 + self.continueValue })
+cursor.continue()
+cursor = event.target.result
+cursor.continue()
+cursor = event.target.result
+cursor.update({ x: 100 + self.continueValue })
+cursor.continue()
+cursor = event.target.result
+cursor.continue()
+Expecting exception from cursor.delete()
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+cursor = event.target.result
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
--- /dev/null
+if (this.importScripts) {
+ importScripts('../../../fast/js/resources/js-test-pre.js');
+ importScripts('shared.js');
+}
+
+description("Test IndexedDB's IDBCursor.continue() behavior when called beyond normal scope.");
+
+var date = new Date();
+
+// we set this pretty high because we get different behavior depending
+// if we're in a pre-fetched state or not
+self.testLength = 25;
+
+function test()
+{
+ removeVendorPrefixes();
+ openDatabase();
+}
+
+function openDatabase()
+{
+ result = evalAndLog("indexedDB.open('cursor-continue')");
+ result.onsuccess = setVersion;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function setVersion()
+{
+ self.db = evalAndLog("db = event.target.result");
+
+ result = evalAndLog("db.setVersion('new version')");
+ result.onsuccess = deleteExisting;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function deleteExisting()
+{
+ self.trans = evalAndLog("trans = event.target.result");
+ shouldBeTrue("trans !== null");
+ trans.onabort = unexpectedAbortCallback;
+
+ deleteAllObjectStores(db);
+
+ self.objectStore = evalAndLog("db.createObjectStore('someObjectStore')");
+ self.indexObject = evalAndLog("objectStore.createIndex('someIndex', 'x')");
+ self.nextToAdd = 0;
+ addData();
+}
+
+function addData()
+{
+ for (var i=0; i<self.testLength; i++) {
+ evalAndLog("objectStore.add({'x': " + i + " }, " + i + ")");
+ }
+ evalAndLog("continueTest()");
+}
+
+function continueTest()
+{
+ debug("");
+ debug("Checking objectStore");
+ debug("====================");
+ var request = evalAndLog("indexObject.openCursor(null, IDBCursor.NEXT)");
+ evalAndLog("self.continueValue = 0");
+ request.onsuccess = evalAndLogCallback("doubleContinueCallback()");
+ request.onerror = unexpectedErrorCallback;
+ self.stage = 0;
+}
+
+function doubleContinueCallback()
+{
+ evalAndLog("cursor = event.target.result");
+ if (cursor) {
+ debug("Checking value at " + self.continueValue);
+ // data should be valid before calling continue()
+ shouldBe("cursor.key", "" + self.continueValue);
+ shouldBe("cursor.value.x", "" + self.continueValue);
+
+ // Data should not change during iteration, even if continue() is called and extra time.
+ evalAndLog("cursor.continue()");
+ shouldBe("cursor.key", "" + self.continueValue);
+ shouldBe("cursor.value.x", "" + self.continueValue);
+
+ // Even if continue is called more than once, the value still shouldn't change.
+ evalAndExpectException("cursor.continue()", "DOMException.INVALID_STATE_ERR");
+ shouldBe("cursor.key", "" + self.continueValue);
+ shouldBe("cursor.value.x", "" + self.continueValue);
+ evalAndLog("self.continueValue++;");
+ } else {
+ evalAndLog("continueIndexTest()");
+ }
+}
+
+function continueIndexTest()
+{
+ debug("");
+ debug("Checking index");
+ debug("==============");
+ var request = evalAndLog("indexObject.openCursor(null, IDBCursor.NEXT)");
+ evalAndLog("self.continueValue = 0");
+ request.onsuccess = doubleContinueIndexCallback;
+ request.onerror = unexpectedErrorCallback;
+ self.stage = 0;
+}
+
+function doubleContinueIndexCallback()
+{
+ evalAndLog("cursor = event.target.result");
+ if (cursor) {
+ debug("Checking value at " + self.continueValue);
+ // data should be valid before calling continue()
+ shouldBe("cursor.key", "" + self.continueValue);
+ shouldBe("cursor.value.x", "" + self.continueValue);
+
+ // Data should not change during iteration, even if continue() is called and extra time.
+ evalAndLog("cursor.continue()");
+ shouldBe("cursor.key", "" + self.continueValue);
+ shouldBe("cursor.value.x", "" + self.continueValue);
+
+ // Even if continue is called more than once, the value still shouldn't change.
+ evalAndExpectException("cursor.continue()", "DOMException.INVALID_STATE_ERR");
+ shouldBe("cursor.key", "" + self.continueValue);
+ shouldBe("cursor.value.x", "" + self.continueValue);
+ evalAndLog("self.continueValue++;");
+ } else {
+ evalAndLog("testModifyContinueOrder()");
+ }
+
+}
+
+// Note: This mutates the data
+function testModifyContinueOrder()
+{
+ debug("");
+ debug("Checking modification");
+ debug("=====================");
+ var request = evalAndLog("indexObject.openCursor(null, IDBCursor.NEXT)");
+ evalAndLog("self.continueValue = 0");
+ request.onsuccess = modifyContinueOrderCallback;
+ request.onerror = unexpectedErrorCallback;
+ self.stage = 0;
+}
+
+function modifyContinueOrderCallback()
+{
+ cursor = evalAndLog("cursor = event.target.result");
+
+ self.continueValue++;
+ if (cursor) {
+ // we sprinkle these checks across the dataset, to sample
+ // behavior against pre-fetching. Make sure to use prime
+ // numbers for these checks to avoid overlap.
+ if (self.continueValue % 2 == 0) {
+ // it's ok to call update() and then continue..
+ evalAndLog("cursor.update({ x: 100 + self.continueValue })");
+ evalAndLog("cursor.continue()");
+ } else if (self.continueValue % 3 == 0) {
+ // it's ok to call delete() and then continue
+ evalAndLog("cursor.delete()");
+ evalAndLog("cursor.continue()");
+ } else if (self.continueValue % 5 == 0) {
+ // it's NOT ok to call continue and then update
+ evalAndLog("cursor.continue()");
+ evalAndExpectException("cursor.update({ x: 100 + self.continueValue})",
+ "DOMException.INVALID_STATE_ERR");
+ } else if (self.continueValue % 7 == 0) {
+ // it's NOT ok to call continue and then delete
+ evalAndLog("cursor.continue()");
+ evalAndExpectException("cursor.delete()",
+ "DOMException.INVALID_STATE_ERR");
+ } else {
+ evalAndLog("cursor.continue()");
+ }
+
+ } else {
+ finishJSTest();
+ }
+}
+
+test();