Changeset 106827 in webkit
- Timestamp:
- Feb 6, 2012 11:50:11 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r106825 r106827 1 2012-02-06 Eugene Girard <girard@chromium.org> 2 3 IndexedDB createObjectStore should throw if options arg is invalid (not an object). 4 Added unit tests to test invalid arguments. 5 storage/indexddb/transaction-basics was modified only to correct calls that would 6 now throw. 7 https://bugs.webkit.org/show_bug.cgi?id=58471 8 9 Reviewed by Adam Barth. 10 11 * storage/indexeddb/create-object-store-options-expected.txt: 12 * storage/indexeddb/create-object-store-options.html: 13 * storage/indexeddb/index-basics-expected.txt: 14 * storage/indexeddb/index-basics.html: 15 * storage/indexeddb/resources/shared.js: 16 (evalAndExpectExceptionClass): 17 * storage/indexeddb/transaction-basics-expected.txt: 18 * storage/indexeddb/transaction-basics.html: 19 * storage/indexeddb/tutorial.html: 20 1 21 2012-02-06 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> 2 22 -
trunk/LayoutTests/storage/indexeddb/create-object-store-options-expected.txt
r98563 r106827 16 16 PASS trans.mode is webkitIDBTransaction.READ_WRITE 17 17 trans.objectStore('a').put({'a': 0}) 18 Expecting TypeError exception from db.createObjectStore('d', 'bar'); 19 PASS Exception was thrown. 20 PASS db.createObjectStore('d', 'bar'); threw TypeError: Not an object. 21 Expecting TypeError exception from db.createObjectStore('e', false); 22 PASS Exception was thrown. 23 PASS db.createObjectStore('e', false); threw TypeError: Not an object. 18 24 trans.objectStore('b').put({'a': 0}, 0) 19 25 trans.objectStore('a').get(0) -
trunk/LayoutTests/storage/indexeddb/create-object-store-options.html
r99258 r106827 48 48 req.onsuccess = putB; 49 49 req.onerror = unexpectedErrorCallback; 50 51 evalAndExpectExceptionClass("db.createObjectStore('d', 'bar');", "TypeError"); 52 evalAndExpectExceptionClass("db.createObjectStore('e', false);", "TypeError"); 50 53 } 51 54 -
trunk/LayoutTests/storage/indexeddb/index-basics-expected.txt
r105137 r106827 13 13 db.createObjectStore('storeName', null) 14 14 store.createIndex('indexName', 'x') 15 store.createIndex('indexName2', 'y', false)16 store.createIndex('zIndex', 'z', true)15 store.createIndex('indexName2', 'y', {unique: false}) 16 store.createIndex('zIndex', 'z', {unique: true}) 17 17 PASS 'name' in indexObject is true 18 18 PASS indexObject.name is "indexName" -
trunk/LayoutTests/storage/indexeddb/index-basics.html
r105137 r106827 40 40 window.store = evalAndLog("db.createObjectStore('storeName', null)"); 41 41 window.indexObject = evalAndLog("store.createIndex('indexName', 'x')"); 42 window.indexObject2 = evalAndLog("store.createIndex('indexName2', 'y', false)");43 window.indexObject3 = evalAndLog("store.createIndex('zIndex', 'z', true)");42 window.indexObject2 = evalAndLog("store.createIndex('indexName2', 'y', {unique: false})"); 43 window.indexObject3 = evalAndLog("store.createIndex('zIndex', 'z', {unique: true})"); 44 44 addData(); 45 45 } -
trunk/LayoutTests/storage/indexeddb/resources/shared.js
r106392 r106827 51 51 } 52 52 53 function evalAndExpectExceptionClass(cmd, expected) 54 { 55 debug("Expecting " + expected + " exception from " + cmd); 56 try { 57 eval(cmd); 58 testFailed("No exception thrown!" ); 59 } catch (e) { 60 testPassed("Exception was thrown."); 61 if (eval("e instanceof " + expected)) 62 testPassed(cmd + " threw " + e); 63 else 64 testFailed("Expected " + expected + " but saw " + e); 65 } 66 } 67 53 68 function deleteAllObjectStores(db) 54 69 { -
trunk/LayoutTests/storage/indexeddb/transaction-basics-expected.txt
r104840 r106827 24 24 PASS trans !== null is true 25 25 store = db.createObjectStore('storeFail', null) 26 index = store.createIndex('indexFail', 'x' , false)26 index = store.createIndex('indexFail', 'x') 27 27 db.deleteObjectStore('storeFail') 28 28 store.deleteIndex('indexFail') … … 37 37 PASS trans !== null is true 38 38 store = db.createObjectStore('storeFail', null) 39 index = store.createIndex('indexFail', 'x' , false)39 index = store.createIndex('indexFail', 'x') 40 40 db.deleteObjectStore('storeFail') 41 41 store.deleteIndex('indexFail') 42 42 store = db.createObjectStore('storeFail', null) 43 index = store.createIndex('indexFail', 'x' , false)43 index = store.createIndex('indexFail', 'x') 44 44 45 45 testSetVersionAbort3(): … … 54 54 PASS trans !== null is true 55 55 store = db.createObjectStore('storeFail', null) 56 index = store.createIndex('indexFail', 'x' , false)56 index = store.createIndex('indexFail', 'x') 57 57 58 58 testInactiveAbortedTransaction(): … … 100 100 PASS trans !== null is true 101 101 store = db.createObjectStore('storeFail', null) 102 index = store.createIndex('indexFail', 'x' , false)102 index = store.createIndex('indexFail', 'x') 103 103 104 104 testInactiveCompletedTransaction(): -
trunk/LayoutTests/storage/indexeddb/transaction-basics.html
r104840 r106827 57 57 58 58 var store = evalAndLog("store = db.createObjectStore('storeFail', null)"); 59 var index = evalAndLog("index = store.createIndex('indexFail', 'x' , false)");59 var index = evalAndLog("index = store.createIndex('indexFail', 'x')"); 60 60 61 61 evalAndLog("db.deleteObjectStore('storeFail')"); … … 83 83 84 84 var store = evalAndLog("store = db.createObjectStore('storeFail', null)"); 85 var index = evalAndLog("index = store.createIndex('indexFail', 'x' , false)");85 var index = evalAndLog("index = store.createIndex('indexFail', 'x')"); 86 86 87 87 evalAndLog("db.deleteObjectStore('storeFail')"); … … 89 89 90 90 var store = evalAndLog("store = db.createObjectStore('storeFail', null)"); 91 var index = evalAndLog("index = store.createIndex('indexFail', 'x' , false)");91 var index = evalAndLog("index = store.createIndex('indexFail', 'x')"); 92 92 93 93 trans.abort(); … … 114 114 115 115 store = evalAndLog("store = db.createObjectStore('storeFail', null)"); 116 index = evalAndLog("index = store.createIndex('indexFail', 'x' , false)");116 index = evalAndLog("index = store.createIndex('indexFail', 'x')"); 117 117 118 118 trans.abort(); … … 156 156 157 157 store = evalAndLog("store = db.createObjectStore('storeFail', null)"); 158 index = evalAndLog("index = store.createIndex('indexFail', 'x' , false)");158 index = evalAndLog("index = store.createIndex('indexFail', 'x')"); 159 159 160 160 trans.oncomplete = testInactiveCompletedTransaction; -
trunk/LayoutTests/storage/indexeddb/tutorial.html
r103283 r106827 181 181 // unique, which is good in the case of names. The first parameter is the name of the index. 182 182 // Second is the key path. The third specifies uniqueness. 183 var fname = objectStore.createIndex("fname", "fname", false);184 var lname = objectStore.createIndex("lname", "lname", false);183 var fname = objectStore.createIndex("fname", "fname", { unique: false}); 184 var lname = objectStore.createIndex("lname", "lname", { unique: false}); 185 185 186 186 // Note that if you wanted to delete these indexes, you can either call objectStore.deleteIndex -
trunk/Source/WebCore/ChangeLog
r106823 r106827 1 2012-02-06 Eugene Girard <girard@chromium.org> 2 3 IndexedDB createObjectStore should throw if options arg is invalid 4 Added logic to OptionsObject to determine if an invalid object was created. 5 Javascript bindings now detect invalid OptionsObject's and throw TypeError when found. 6 https://bugs.webkit.org/show_bug.cgi?id=58471 7 8 Reviewed by Adam Barth. 9 10 Test: storage/indexeddb/createObjectStore-bad-options.html 11 12 * bindings/scripts/CodeGeneratorV8.pm: 13 (GenerateParametersCheck): 14 * bindings/v8/OptionsObject.cpp: 15 (WebCore::OptionsObject::isObject): 16 * bindings/v8/OptionsObject.h: 17 1 18 2012-02-06 Sheriff Bot <webkit.review.bot@gmail.com> 2 19 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
r106798 r106827 1596 1596 $parameterCheckString .= " EXCEPTION_BLOCK($nativeType, $parameterName, " . 1597 1597 JSValueToNative($parameter, "MAYBE_MISSING_PARAMETER(args, $paramIndex, $parameterMissingPolicy)") . ");\n"; 1598 if ($nativeType eq 'OptionsObject') { 1599 $parameterCheckString .= " if (args.Length() > $paramIndex && !$parameterName.isUndefinedOrNull() && !$parameterName.isObject()) {\n"; 1600 $parameterCheckString .= " ec = TYPE_MISMATCH_ERR;\n"; 1601 $parameterCheckString .= " V8Proxy::setDOMException(ec);\n"; 1602 $parameterCheckString .= " return throwError(\"Not an object.\", V8Proxy::TypeError);\n"; 1603 $parameterCheckString .= " }\n"; 1604 } 1598 1605 } 1599 1606 -
trunk/Source/WebCore/bindings/v8/OptionsObject.cpp
r101591 r106827 65 65 } 66 66 67 bool OptionsObject::isObject() const 68 { 69 return !isUndefinedOrNull() && m_options->IsObject(); 70 } 71 67 72 bool OptionsObject::isUndefinedOrNull() const 68 73 { -
trunk/Source/WebCore/bindings/v8/OptionsObject.h
r101591 r106827 50 50 OptionsObject& operator=(const OptionsObject&); 51 51 52 bool isObject() const; 52 53 bool isUndefinedOrNull() const; 53 54
Note: See TracChangeset
for help on using the changeset viewer.