Changeset 123112 in webkit
- Timestamp:
- Jul 19, 2012 9:37:18 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r123111 r123112 1 2012-07-19 Joshua Bell <jsbell@chromium.org> 2 3 IndexedDB: Throw native TypeErrors per spec 4 https://bugs.webkit.org/show_bug.cgi?id=91679 5 6 Reviewed by Kentaro Hara. 7 8 * storage/indexeddb/cursor-advance-expected.txt: 9 * storage/indexeddb/index-basics-expected.txt: 10 * storage/indexeddb/index-basics-workers-expected.txt: 11 * storage/indexeddb/objectstore-cursor-expected.txt: 12 * storage/indexeddb/resources/cursor-advance.js: 13 (testBadAdvance.advanceBadly): 14 (testBadAdvance): 15 * storage/indexeddb/resources/index-basics.js: 16 (openKeyCursor): 17 (openObjectCursor): 18 * storage/indexeddb/resources/objectstore-cursor.js: 19 (deleteExisting): 20 * storage/indexeddb/resources/transaction-basics.js: 21 (testInvalidMode): 22 * storage/indexeddb/transaction-basics-expected.txt: 23 1 24 2012-07-19 Tony Chang <tony@chromium.org> 2 25 -
trunk/LayoutTests/storage/indexeddb/cursor-advance-expected.txt
r120114 r123112 134 134 objectStore = trans.objectStore(objectStoreName) 135 135 request = objectStore.openCursor() 136 Expecting exception from cursor.advance(0)136 Expecting TypeError exception from cursor.advance(0) 137 137 PASS Exception was thrown. 138 PASS c ode is IDBDatabaseException.TYPE_ERR138 PASS cursor.advance(0) threw TypeError: Type error 139 139 testDelete() 140 140 trans = db.transaction(objectStoreName, 'readwrite') -
trunk/LayoutTests/storage/indexeddb/index-basics-expected.txt
r119161 r123112 68 68 indexObject4.getKey('value2') 69 69 PASS event.target.result is "key2" 70 71 Verify that specifying an invalid direction raises an exception: 72 Expecting TypeError exception from indexObject.openKeyCursor(0, 'invalid-direction') 73 PASS Exception was thrown. 74 PASS indexObject.openKeyCursor(0, 'invalid-direction') threw TypeError: Type error 75 70 76 indexObject.openKeyCursor() 71 77 PASS event.target.source is indexObject … … 87 93 event.target.result.continue() 88 94 PASS event.target.result is null 95 96 Verify that specifying an invalid direction raises an exception: 97 Expecting TypeError exception from indexObject.openCursor(0, 'invalid-direction') 98 PASS Exception was thrown. 99 PASS indexObject.openCursor(0, 'invalid-direction') threw TypeError: Type error 100 89 101 indexObject.openCursor() 90 102 PASS event.target.source is indexObject -
trunk/LayoutTests/storage/indexeddb/index-basics-workers-expected.txt
r119161 r123112 69 69 [Worker] indexObject4.getKey('value2') 70 70 PASS [Worker] event.target.result is "key2" 71 [Worker] 72 [Worker] Verify that specifying an invalid direction raises an exception: 73 [Worker] Expecting TypeError exception from indexObject.openKeyCursor(0, 'invalid-direction') 74 PASS [Worker] Exception was thrown. 75 PASS [Worker] indexObject.openKeyCursor(0, 'invalid-direction') threw TypeError: Type error 76 [Worker] 71 77 [Worker] indexObject.openKeyCursor() 72 78 PASS [Worker] event.target.source is indexObject … … 88 94 [Worker] event.target.result.continue() 89 95 PASS [Worker] event.target.result is null 96 [Worker] 97 [Worker] Verify that specifying an invalid direction raises an exception: 98 [Worker] Expecting TypeError exception from indexObject.openCursor(0, 'invalid-direction') 99 PASS [Worker] Exception was thrown. 100 PASS [Worker] indexObject.openCursor(0, 'invalid-direction') threw TypeError: Type error 101 [Worker] 90 102 [Worker] indexObject.openCursor() 91 103 PASS [Worker] event.target.source is indexObject -
trunk/LayoutTests/storage/indexeddb/objectstore-cursor-expected.txt
r117702 r123112 12 12 PASS trans is non-null. 13 13 Deleted all object stores. 14 db.createObjectStore('someObjectStore') 14 objectStore = db.createObjectStore('someObjectStore') 15 16 Verify that specifying an invalid direction raises an exception: 17 Expecting TypeError exception from objectStore.openCursor(0, 'invalid-direction') 18 PASS Exception was thrown. 19 PASS objectStore.openCursor(0, 'invalid-direction') threw TypeError: Type error 20 15 21 objectStore.add('', testData[nextToAdd]) 16 22 objectStore.add('', testData[nextToAdd]) -
trunk/LayoutTests/storage/indexeddb/resources/cursor-advance.js
r120114 r123112 330 330 cursor = event.target.result; 331 331 332 evalAndExpectException ("cursor.advance(0)", "IDBDatabaseException.TYPE_ERR");332 evalAndExpectExceptionClass("cursor.advance(0)", "TypeError"); 333 333 testDelete(); 334 334 } -
trunk/LayoutTests/storage/indexeddb/resources/index-basics.js
r119161 r123112 175 175 shouldBeEqualToString("event.target.result", "key2"); 176 176 177 debug(""); 178 debug("Verify that specifying an invalid direction raises an exception:"); 179 evalAndExpectExceptionClass("indexObject.openKeyCursor(0, 'invalid-direction')", "TypeError"); 180 debug(""); 181 177 182 self.request = evalAndLog("indexObject.openKeyCursor()"); 178 183 request.onsuccess = cursor1Continue; … … 233 238 event = evt; 234 239 shouldBeNull("event.target.result"); 240 241 debug(""); 242 debug("Verify that specifying an invalid direction raises an exception:"); 243 evalAndExpectExceptionClass("indexObject.openCursor(0, 'invalid-direction')", "TypeError"); 244 debug(""); 235 245 236 246 self.request = evalAndLog("indexObject.openCursor()"); -
trunk/LayoutTests/storage/indexeddb/resources/objectstore-cursor.js
r117702 r123112 42 42 deleteAllObjectStores(db); 43 43 44 self.objectStore = evalAndLog("db.createObjectStore('someObjectStore')"); 44 evalAndLog("objectStore = db.createObjectStore('someObjectStore')"); 45 46 debug(""); 47 debug("Verify that specifying an invalid direction raises an exception:"); 48 evalAndExpectExceptionClass("objectStore.openCursor(0, 'invalid-direction')", "TypeError"); 49 debug(""); 50 45 51 self.nextToAdd = 0; 46 52 addData(); -
trunk/LayoutTests/storage/indexeddb/resources/transaction-basics.js
r122173 r123112 280 280 debug(""); 281 281 debug("Verify that specifying an invalid mode raises an exception"); 282 evalAndExpectException ("db.transaction(['storeName'], 'lsakjdf')", "IDBDatabaseException.TYPE_ERR", "'TypeError'");282 evalAndExpectExceptionClass("db.transaction(['storeName'], 'lsakjdf')", "TypeError"); 283 283 testDegenerateNames(); 284 284 } -
trunk/LayoutTests/storage/indexeddb/transaction-basics-expected.txt
r122173 r123112 199 199 200 200 Verify that specifying an invalid mode raises an exception 201 Expecting exception from db.transaction(['storeName'], 'lsakjdf') 202 PASS Exception was thrown. 203 PASS code is IDBDatabaseException.TYPE_ERR 204 PASS ename is 'TypeError' 201 Expecting TypeError exception from db.transaction(['storeName'], 'lsakjdf') 202 PASS Exception was thrown. 203 PASS db.transaction(['storeName'], 'lsakjdf') threw TypeError: Type error 205 204 206 205 Test that null and undefined are treated as strings -
trunk/Source/WebCore/ChangeLog
r123110 r123112 1 2012-07-19 Joshua Bell <jsbell@chromium.org> 2 3 IndexedDB: Throw native TypeErrors per spec 4 https://bugs.webkit.org/show_bug.cgi?id=91679 5 6 Reviewed by Kentaro Hara. 7 8 Per the IDB spec, the advance(), openCursor(), openKeyCursor() and transaction() 9 methods supposed to throw true native JavaScript TypeError objects as exceptions 10 rather than DOMException objects. Implement this by adding a special DOMException 11 code that is tested for in the binding layer. 12 13 Tests: storage/indexeddb/cursor-advance.html 14 storage/indexeddb/index-basics.html 15 storage/indexeddb/index-basics-workers.html 16 storage/indexeddb/objectstore-cursor.html 17 storage/indexeddb/transaction-basics.html 18 19 * Modules/indexeddb/IDBCursor.cpp: Use the new DOMException code. 20 (WebCore::IDBCursor::advance): 21 (WebCore::IDBCursor::stringToDirection): 22 (WebCore::IDBCursor::directionToString): 23 * Modules/indexeddb/IDBDatabase.cpp: Ditto. 24 (WebCore::IDBDatabase::setVersion): 25 * Modules/indexeddb/IDBDatabaseException.cpp: Remove temporary cruft/mark as legacy. 26 (WebCore): 27 * Modules/indexeddb/IDBDatabaseException.h: Ditto. 28 * Modules/indexeddb/IDBDatabaseException.idl: Ditto. 29 * Modules/indexeddb/IDBFactory.cpp: Use the new DOMException code. 30 (WebCore::IDBFactory::open): 31 (WebCore::IDBFactory::deleteDatabase): 32 * Modules/indexeddb/IDBObjectStore.cpp: 33 (WebCore::IDBObjectStore::createIndex): Use the new DOMException code. 34 * Modules/indexeddb/IDBTransaction.cpp: Use the new DOMException code. 35 (WebCore::IDBTransaction::stringToMode): 36 (WebCore::IDBTransaction::modeToString): 37 * bindings/js/JSDOMBinding.cpp: 38 (WebCore::setDOMException): Intercept new DOMException code, throw native TypeError. 39 * bindings/v8/V8Proxy.cpp: 40 (WebCore::V8Proxy::setDOMException): Ditto. 41 * dom/ExceptionCode.h: Add new DOMException code. 42 1 43 2012-07-19 Joshua Bell <jsbell@chromium.org> 2 44 -
trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp
r122779 r123112 183 183 184 184 if (!count) { 185 ec = IDBDatabaseException::IDB_TYPE_ERR;185 ec = NATIVE_TYPE_ERR; 186 186 return; 187 187 } … … 307 307 return IDBCursor::PREV_NO_DUPLICATE; 308 308 309 ec = IDBDatabaseException::IDB_TYPE_ERR;309 ec = NATIVE_TYPE_ERR; 310 310 return IDBCursor::NEXT; 311 311 } … … 327 327 328 328 default: 329 ec = IDBDatabaseException::IDB_TYPE_ERR;329 ec = NATIVE_TYPE_ERR; 330 330 return IDBCursor::directionNext(); 331 331 } -
trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp
r122173 r123112 191 191 { 192 192 if (version.isNull()) { 193 ec = IDBDatabaseException::IDB_TYPE_ERR;193 ec = NATIVE_TYPE_ERR; 194 194 return 0; 195 195 } -
trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseException.cpp
r122905 r123112 63 63 { "SyntaxError", "The keypath argument contains an invalid key path.", SYNTAX_ERR }, 64 64 { "DataCloneError", "The data being stored could not be cloned by the internal structured cloning algorithm.", DATA_CLONE_ERR }, 65 // FIXME: should be a JavaScript TypeError. See https://bugs.webkit.org/show_bug.cgi?id=85513 66 { "TypeError", "This should be a TypeError", 0 }, 65 { 0, 0, 0 }, // FIXME: Previous/legacy value was IDB_TYPE_ERR. 67 66 { 0, 0, 0 }, // FIXME: Previous/legacy value was IDB_NOT_SUPPORTED_ERR. 68 67 }; -
trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseException.h
r122905 r123112 66 66 IDB_SYNTAX_ERR, 67 67 IDB_DATA_CLONE_ERR, 68 IDB_TYPE_ERR, // FIXME: Placeholder until bindings have been updated to throw a JS TypeError. See https://bugs.webkit.org/show_bug.cgi?id=8551368 LEGACY_IDB_TYPE_ERR, // FIXME: Placeholder. 69 69 LEGACY_IDB_NOT_SUPPORTED_ERR, // FIXME: Placeholder. 70 70 }; -
trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseException.idl
r119751 r123112 50 50 const unsigned short VER_ERR = 12; 51 51 52 // FIXME: Placeholder until bindings have been updated to throw a JS TypeError.53 // See https://bugs.webkit.org/show_bug.cgi?id=8551354 const unsigned short TYPE_ERR = 21;55 56 52 const unsigned short NOT_FOUND_ERR = 8; 57 53 const unsigned short ABORT_ERR = 20; -
trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp
r122515 r123112 109 109 { 110 110 if (name.isNull()) { 111 ec = IDBDatabaseException::IDB_TYPE_ERR;111 ec = NATIVE_TYPE_ERR; 112 112 return 0; 113 113 } … … 123 123 { 124 124 if (name.isNull()) { 125 ec = IDBDatabaseException::IDB_TYPE_ERR;125 ec = NATIVE_TYPE_ERR; 126 126 return 0; 127 127 } -
trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp
r123048 r123112 273 273 } 274 274 if (name.isNull()) { 275 ec = IDBDatabaseException::IDB_TYPE_ERR;275 ec = NATIVE_TYPE_ERR; 276 276 return 0; 277 277 } -
trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp
r122782 r123112 319 319 if (modeString == IDBTransaction::modeReadWrite()) 320 320 return IDBTransaction::READ_WRITE; 321 ec = IDBDatabaseException::IDB_TYPE_ERR;321 ec = NATIVE_TYPE_ERR; 322 322 return IDBTransaction::READ_ONLY; 323 323 } … … 339 339 340 340 default: 341 ec = IDBDatabaseException::IDB_TYPE_ERR;341 ec = NATIVE_TYPE_ERR; 342 342 return IDBTransaction::modeReadOnly(); 343 343 } -
trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp
r120389 r123112 199 199 return; 200 200 201 if (ec == NATIVE_TYPE_ERR) { 202 throwTypeError(exec); 203 return; 204 } 205 201 206 // FIXME: All callers to setDOMException need to pass in the right global object 202 207 // for now, we're going to assume the lexicalGlobalObject. Which is wrong in cases like this: -
trunk/Source/WebCore/bindings/v8/V8Proxy.cpp
r121538 r123112 594 594 return v8::Handle<v8::Value>(); 595 595 596 if (ec == NATIVE_TYPE_ERR) { 597 const char* message = 0; 598 return throwTypeError(message, isolate); 599 } 600 596 601 ExceptionCodeDescription description(ec); 597 602 -
trunk/Source/WebCore/dom/ExceptionCode.h
r98715 r123112 64 64 TIMEOUT_ERR = 23, 65 65 INVALID_NODE_TYPE_ERR = 24, 66 DATA_CLONE_ERR = 25 66 DATA_CLONE_ERR = 25, 67 68 // Converted to a native TypeError by the script binding layer: 69 NATIVE_TYPE_ERR = 99 67 70 }; 68 71
Note: See TracChangeset
for help on using the changeset viewer.