Changeset 28781 in webkit
- Timestamp:
- Dec 16, 2007 4:24:48 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r28780 r28781 1 2007-12-16 Darin Adler <darin@apple.com> 2 3 Reviewed by Maciej. 4 5 - tests for the argument handling of the executeSql function 6 7 * storage/execute-sql-args-expected.txt: Added. 8 * storage/execute-sql-args.html: Added. 9 1 10 2007-12-16 Darin Adler <darin@apple.com> 2 11 -
trunk/WebCore/ChangeLog
r28779 r28781 31 31 * rendering/RenderObject.cpp: 32 32 (WebCore::RenderObject::paintBorderImage): 33 34 2007-12-16 Darin Adler <darin@apple.com> 35 36 Reviewed by Maciej. 37 38 - fix <rdar://problem/5636065> First form of SQLTransaction.executeSql() fails with TYPE_ERROR dom exception 39 40 Test: storage/execute-sql-args.html 41 42 * bindings/js/JSSQLTransactionCustom.cpp: 43 (WebCore::JSSQLTransaction::executeSql): Added exception handling code so that once an 44 exception happens, we won't try to do any more argument processing. Changed processing 45 of the second argument so that we allow an undefined value or null, and simply omit the 46 array. Changed processing of the second argument so that we don't require an actual 47 JavaScript array. Instead, as with the JavaScript array operations themselves, we use 48 the length property and corresponding numeric properties of the object, allowing other 49 objects to act as arrays. Changed processing of the third and fourth arguments to 50 allow the undefined value as well as null; we check the value of the argument rather 51 than looking at the size of the passed-in arguments list. 33 52 34 53 2007-12-16 Darin Adler <darin@apple.com> -
trunk/WebCore/bindings/js/JSSQLTransactionCustom.cpp
r27774 r28781 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 28 29 #include "config.h" 29 30 #include "JSSQLTransaction.h" … … 33 34 #include "JSCustomSQLStatementCallback.h" 34 35 #include "JSCustomSQLStatementErrorCallback.h" 36 #include "SQLTransaction.h" 35 37 #include "kjs_window.h" 36 #include "PlatformString.h"37 #include "SQLTransaction.h"38 #include "SQLValue.h"39 #include <kjs/array_instance.h>40 38 41 39 using namespace KJS; … … 46 44 { 47 45 String sqlStatement = args[0]->toString(exec); 48 46 if (exec->hadException()) 47 return jsUndefined(); 48 49 49 // Now assemble the list of SQL arguments 50 50 Vector<SQLValue> sqlValues; 51 52 if (!args[1]->isObject() || 53 !static_cast<JSObject*>(args[1])->inherits(&ArrayInstance::info)) { 54 setDOMException(exec, TYPE_MISMATCH_ERR); 55 return jsUndefined(); 56 } 57 58 ArrayInstance* array = static_cast<ArrayInstance*>(args[1]); 59 60 for (unsigned i = 0 ; i < array->getLength(); i++) { 61 JSValue* value = array->getItem(i); 51 if (!args[1]->isUndefinedOrNull()) { 52 JSObject* object = args[1]->getObject(); 53 if (!object) { 54 setDOMException(exec, TYPE_MISMATCH_ERR); 55 return jsUndefined(); 56 } 57 58 JSValue* lengthValue = object->get(exec, exec->propertyNames().length); 59 if (exec->hadException()) 60 return jsUndefined(); 61 unsigned length = lengthValue->toUInt32(exec); 62 if (exec->hadException()) 63 return jsUndefined(); 62 64 63 if (value->isNull()) { 64 sqlValues.append(SQLValue()); 65 } else if (value->isNumber()) { 66 sqlValues.append(value->getNumber()); 67 } else { 68 // Convert the argument to a string and append it 69 sqlValues.append(value->toString(exec)); 65 for (unsigned i = 0 ; i < length; ++i) { 66 JSValue* value = object->get(exec, i); 67 if (exec->hadException()) 68 return jsUndefined(); 69 70 if (value->isNull()) 71 sqlValues.append(SQLValue()); 72 else if (value->isNumber()) 73 sqlValues.append(value->getNumber()); 74 else { 75 // Convert the argument to a string and append it 76 sqlValues.append(value->toString(exec)); 77 if (exec->hadException()) 78 return jsUndefined(); 79 } 70 80 } 71 81 } 72 82 73 83 RefPtr<SQLStatementCallback> callback; 74 if ( args.size() > 2 && !args[2]->isNull()) {84 if (!args[2]->isUndefinedOrNull()) { 75 85 JSObject* object = args[2]->getObject(); 76 86 if (!object) { … … 84 94 85 95 RefPtr<SQLStatementErrorCallback> errorCallback; 86 if ( args.size() > 3 && !args[3]->isNull()) {96 if (!args[3]->isUndefinedOrNull()) { 87 97 JSObject* object = args[3]->getObject(); 88 98 if (!object) {
Note: See TracChangeset
for help on using the changeset viewer.