IndexedDB: Passing empty array to IDBDatabase.transaction should raise exception
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Oct 2011 13:35:51 +0000 (13:35 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Oct 2011 13:35:51 +0000 (13:35 +0000)
commit7a38f2be69937d772e330dc0656166db6a543d49
tree0a1253d0b709a68da90fd18719be135c357dfd07
parent93b9fb64b154f9c359e95e163b8182f1249bc505
IndexedDB: Passing empty array to IDBDatabase.transaction should raise exception
https://bugs.webkit.org/show_bug.cgi?id=70251

Patch by Joshua Bell <jsbell@chromium.org> on 2011-10-27
Reviewed by Adam Barth.

Source/WebCore:

IDBDatabase.transaction() supported being called with an empty array to
lock all object stores. Support for this was rejected from inclusion in
the IDB spec due to performance concerns. This patch removes that
functionality.

A special case in the spec (passing a string instead of an array) worked
in WebKit accidentally, by resolving the string to an empty array. This
needed explicit support. Support for DOMString[] is added to the binding
code generators (reliant on DOMStringList) to ensure JS arrays are not
coerced to DOMStrings. This matches the proposed IDL.

* bindings/scripts/CodeGeneratorV8.pm:
(GenerateParametersCheckExpression):
(GetNativeType):
(JSValueToNative):
(IsArrayType):
* bindings/scripts/IDLStructure.pm:
* storage/IDBDatabase.cpp:
(WebCore::IDBDatabase::transaction):
* storage/IDBDatabase.h:
(WebCore::IDBDatabase::transaction):
* storage/IDBDatabase.idl:
* storage/IDBTransactionBackendImpl.cpp:
(WebCore::IDBTransactionBackendImpl::IDBTransactionBackendImpl):
(WebCore::IDBTransactionBackendImpl::objectStore):

LayoutTests:

Many tests relied on the non-specified behavior of passing an empty
array into IDBDatabase.transaction() to include all object stores in
scopes. Worse, non-arrays would be treated as empty arrays, and hence
"just worked".

* storage/indexeddb/create-and-remove-object-store-expected.txt:
* storage/indexeddb/create-and-remove-object-store.html:
* storage/indexeddb/create-object-store-options-expected.txt:
* storage/indexeddb/create-object-store-options.html:
* storage/indexeddb/cursor-inconsistency-expected.txt:
* storage/indexeddb/cursor-inconsistency.html:
* storage/indexeddb/cursor-skip-deleted-expected.txt:
* storage/indexeddb/cursor-skip-deleted.html:
* storage/indexeddb/cursor-update-expected.txt:
* storage/indexeddb/cursor-update.html:
* storage/indexeddb/data-corruption-expected.txt:
* storage/indexeddb/data-corruption.html:
* storage/indexeddb/database-quota.html:
* storage/indexeddb/error-causes-abort-by-default-expected.txt:
* storage/indexeddb/error-causes-abort-by-default.html:
* storage/indexeddb/exception-in-event-aborts-expected.txt:
* storage/indexeddb/exception-in-event-aborts.html:
* storage/indexeddb/index-unique-expected.txt:
* storage/indexeddb/index-unique.html:
* storage/indexeddb/mutating-cursor-expected.txt:
* storage/indexeddb/mutating-cursor.html:
* storage/indexeddb/objectstore-autoincrement-expected.txt:
* storage/indexeddb/objectstore-autoincrement.html:
* storage/indexeddb/objectstore-basics-expected.txt:
* storage/indexeddb/objectstore-basics.html:
* storage/indexeddb/objectstore-clear-expected.txt:
* storage/indexeddb/objectstore-clear.html:
* storage/indexeddb/objectstore-removeobjectstore-expected.txt:
* storage/indexeddb/objectstore-removeobjectstore.html:
* storage/indexeddb/request-event-propagation-expected.txt:
* storage/indexeddb/request-event-propagation.html:
* storage/indexeddb/transaction-abort-expected.txt:
* storage/indexeddb/transaction-abort-with-js-recursion-expected.txt:
* storage/indexeddb/transaction-abort-with-js-recursion.html:
* storage/indexeddb/transaction-abort.html:
* storage/indexeddb/transaction-after-close-expected.txt:
* storage/indexeddb/transaction-after-close.html:
* storage/indexeddb/transaction-and-objectstore-calls-expected.txt:
* storage/indexeddb/transaction-and-objectstore-calls.html:
* storage/indexeddb/transaction-basics-expected.txt:
* storage/indexeddb/transaction-basics.html:
* storage/indexeddb/transaction-crash-on-abort-expected.txt:
* storage/indexeddb/transaction-crash-on-abort.html:
* storage/indexeddb/transaction-event-propagation-expected.txt:
* storage/indexeddb/transaction-event-propagation.html:
* storage/indexeddb/transaction-read-only-expected.txt:
* storage/indexeddb/transaction-read-only.html:
* storage/indexeddb/transaction-storeNames-required-expected.txt:
* storage/indexeddb/tutorial.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@98563 268f45cc-cd09-0410-ab3c-d52691b4dbfc
59 files changed:
LayoutTests/ChangeLog
LayoutTests/storage/indexeddb/create-and-remove-object-store-expected.txt
LayoutTests/storage/indexeddb/create-and-remove-object-store.html
LayoutTests/storage/indexeddb/create-object-store-options-expected.txt
LayoutTests/storage/indexeddb/create-object-store-options.html
LayoutTests/storage/indexeddb/cursor-inconsistency-expected.txt
LayoutTests/storage/indexeddb/cursor-inconsistency.html
LayoutTests/storage/indexeddb/cursor-skip-deleted-expected.txt
LayoutTests/storage/indexeddb/cursor-skip-deleted.html
LayoutTests/storage/indexeddb/cursor-update-expected.txt
LayoutTests/storage/indexeddb/cursor-update.html
LayoutTests/storage/indexeddb/data-corruption-expected.txt
LayoutTests/storage/indexeddb/data-corruption.html
LayoutTests/storage/indexeddb/database-quota.html
LayoutTests/storage/indexeddb/error-causes-abort-by-default-expected.txt
LayoutTests/storage/indexeddb/error-causes-abort-by-default.html
LayoutTests/storage/indexeddb/exception-in-event-aborts-expected.txt
LayoutTests/storage/indexeddb/exception-in-event-aborts.html
LayoutTests/storage/indexeddb/index-unique-expected.txt
LayoutTests/storage/indexeddb/index-unique.html
LayoutTests/storage/indexeddb/mutating-cursor-expected.txt
LayoutTests/storage/indexeddb/mutating-cursor.html
LayoutTests/storage/indexeddb/objectstore-autoincrement-expected.txt
LayoutTests/storage/indexeddb/objectstore-autoincrement.html
LayoutTests/storage/indexeddb/objectstore-basics-expected.txt
LayoutTests/storage/indexeddb/objectstore-basics.html
LayoutTests/storage/indexeddb/objectstore-clear-expected.txt
LayoutTests/storage/indexeddb/objectstore-clear.html
LayoutTests/storage/indexeddb/objectstore-removeobjectstore-expected.txt
LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html
LayoutTests/storage/indexeddb/request-event-propagation-expected.txt
LayoutTests/storage/indexeddb/request-event-propagation.html
LayoutTests/storage/indexeddb/transaction-abort-expected.txt
LayoutTests/storage/indexeddb/transaction-abort-with-js-recursion-expected.txt
LayoutTests/storage/indexeddb/transaction-abort-with-js-recursion.html
LayoutTests/storage/indexeddb/transaction-abort.html
LayoutTests/storage/indexeddb/transaction-after-close-expected.txt
LayoutTests/storage/indexeddb/transaction-after-close.html
LayoutTests/storage/indexeddb/transaction-and-objectstore-calls-expected.txt
LayoutTests/storage/indexeddb/transaction-and-objectstore-calls.html
LayoutTests/storage/indexeddb/transaction-basics-expected.txt
LayoutTests/storage/indexeddb/transaction-basics.html
LayoutTests/storage/indexeddb/transaction-crash-on-abort-expected.txt
LayoutTests/storage/indexeddb/transaction-crash-on-abort.html
LayoutTests/storage/indexeddb/transaction-event-propagation-expected.txt
LayoutTests/storage/indexeddb/transaction-event-propagation.html
LayoutTests/storage/indexeddb/transaction-storeNames-required-expected.txt
LayoutTests/storage/indexeddb/tutorial.html
Source/WebCore/ChangeLog
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
Source/WebCore/bindings/scripts/IDLStructure.pm
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/bindings/scripts/test/TestObj.idl
Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
Source/WebCore/storage/IDBDatabase.cpp
Source/WebCore/storage/IDBDatabase.h
Source/WebCore/storage/IDBDatabase.idl
Source/WebCore/storage/IDBTransactionBackendImpl.cpp