Changeset 28781 in webkit


Ignore:
Timestamp:
Dec 16, 2007 4:24:48 PM (16 years ago)
Author:
Darin Adler
Message:

WebCore:

Reviewed by Darin.

More of http://bugs.webkit.org/show_bug.cgi?id=16385
Cleanup kjs_window

  • Move PausedTimeouts into its own file and put it in the WebCore namespace.
  • WebCore.pro:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • WebCoreSources.bkl:
  • bindings/js/PausedTimeouts.cpp: Copied from bindings/js/kjs_window.cpp.
  • bindings/js/PausedTimeouts.h: Copied from bindings/js/kjs_window.h.
  • bindings/js/kjs_window.cpp: (KJS::Window::pauseTimeouts):
  • bindings/js/kjs_window.h:
  • history/CachedPage.cpp:
  • history/CachedPage.h:
  • page/Chrome.cpp:

LayoutTests:

Reviewed by Maciej.

  • tests for the argument handling of the executeSql function
  • storage/execute-sql-args-expected.txt: Added.
  • storage/execute-sql-args.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r28780 r28781  
     12007-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
    1102007-12-16  Darin Adler  <darin@apple.com>
    211
  • trunk/WebCore/ChangeLog

    r28779 r28781  
    3131        * rendering/RenderObject.cpp:
    3232        (WebCore::RenderObject::paintBorderImage):
     33
     342007-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.
    3352
    34532007-12-16  Darin Adler  <darin@apple.com>
  • trunk/WebCore/bindings/js/JSSQLTransactionCustom.cpp

    r27774 r28781  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
     28
    2829#include "config.h"
    2930#include "JSSQLTransaction.h"
     
    3334#include "JSCustomSQLStatementCallback.h"
    3435#include "JSCustomSQLStatementErrorCallback.h"
     36#include "SQLTransaction.h"
    3537#include "kjs_window.h"
    36 #include "PlatformString.h"
    37 #include "SQLTransaction.h"
    38 #include "SQLValue.h"
    39 #include <kjs/array_instance.h>
    4038
    4139using namespace KJS;
     
    4644{
    4745    String sqlStatement = args[0]->toString(exec);
    48    
     46    if (exec->hadException())
     47        return jsUndefined();
     48
    4949    // Now assemble the list of SQL arguments
    5050    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();
    6264       
    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            }
    7080        }
    7181    }
    7282
    7383    RefPtr<SQLStatementCallback> callback;
    74     if (args.size() > 2 && !args[2]->isNull()) {
     84    if (!args[2]->isUndefinedOrNull()) {
    7585        JSObject* object = args[2]->getObject();
    7686        if (!object) {
     
    8494   
    8595    RefPtr<SQLStatementErrorCallback> errorCallback;
    86     if (args.size() > 3 && !args[3]->isNull()) {
     96    if (!args[3]->isUndefinedOrNull()) {
    8797        JSObject* object = args[3]->getObject();
    8898        if (!object) {
Note: See TracChangeset for help on using the changeset viewer.