Changeset 15698 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Jul 29, 2006, 5:04:22 PM (19 years ago)
Author:
darin
Message:

JavaScriptCore:

  • Removed tabs from these source files that still had them. We don't use them; that way source files look fine in editors that have tabs set to 8 spaces or to 4 spaces.
  • Removed allow-tabs Subversion property from the files too.
  • bindings/NP_jsobject.cpp:
  • bindings/c/c_utility.cpp:
  • bindings/jni/jni_runtime.cpp:
  • bindings/jni/jni_utility.cpp:
  • bindings/objc/objc_utility.mm:
  • bindings/runtime.cpp:
  • bindings/runtime_method.cpp:
  • bindings/testbindings.cpp:
  • bindings/testbindings.mm:
  • kjs/date_object.cpp:
  • kjs/function.cpp:
  • kjs/list.cpp:
  • kjs/nodes.cpp:
  • kjs/nodes.h:
  • kjs/string_object.cpp:
  • kjs/ustring.cpp:

WebCore:

  • Removed tabs from these source files that still had them. We don't use them; that way source files look fine in editors that have tabs set to 8 spaces or to 4 spaces.
  • Removed allow-tabs Subversion property from the files too.
  • bindings/objc/WebScriptObject.h:
  • bindings/objc/WebScriptObject.mm:
  • platform/FontData.cpp:

WebKit:

  • Removed tabs from these source files that still had them. We don't use them; that way source files look fine in editors that have tabs set to 8 spaces or to 4 spaces.
  • Removed allow-tabs Subversion property from the files too.
  • DefaultDelegates/WebDefaultPolicyDelegate.m:
  • History/WebHistory.m:
  • Misc/WebDownload.m:
  • Misc/WebIconDatabase.m:
  • Misc/WebKitErrors.m:
  • Misc/WebKitLogging.m:
  • Misc/WebNSDataExtras.m:
  • Misc/WebNSFileManagerExtras.m:
  • Panels/WebPanelAuthenticationHandler.m:
  • Plugins/WebBaseNetscapePluginView.m:
  • Plugins/npfunctions.h:
  • WebCoreSupport/WebSubresourceLoader.m:
  • WebView/WebMainResourceLoader.m:
  • WebView/WebView.h:
  • WebView/WebView.m:
Location:
trunk/JavaScriptCore
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r15697 r15698  
     12006-07-29  Darin Adler  <[email protected]>
     2
     3        - Removed tabs from these source files that still had them.
     4          We don't use them; that way source files look fine in editors
     5          that have tabs set to 8 spaces or to 4 spaces.
     6        - Removed allow-tabs Subversion property from the files too.
     7
     8        * bindings/NP_jsobject.cpp:
     9        * bindings/c/c_utility.cpp:
     10        * bindings/jni/jni_runtime.cpp:
     11        * bindings/jni/jni_utility.cpp:
     12        * bindings/objc/objc_utility.mm:
     13        * bindings/runtime.cpp:
     14        * bindings/runtime_method.cpp:
     15        * bindings/testbindings.cpp:
     16        * bindings/testbindings.mm:
     17        * kjs/date_object.cpp:
     18        * kjs/function.cpp:
     19        * kjs/list.cpp:
     20        * kjs/nodes.cpp:
     21        * kjs/nodes.h:
     22        * kjs/string_object.cpp:
     23        * kjs/ustring.cpp:
     24
    1252006-07-29  Darin Adler  <[email protected]>
    226
  • trunk/JavaScriptCore/bindings/NP_jsobject.cpp

    • Property allow-tabs deleted
    r14834 r15698  
    7373{
    7474    if (obj->originExecutionContext) {
    75         Interpreter* originInterpreter = obj->originExecutionContext->interpreter();
    76         if (originInterpreter)
    77             return originInterpreter->isSafeScript(obj->executionContext->interpreter());
     75        Interpreter* originInterpreter = obj->originExecutionContext->interpreter();
     76        if (originInterpreter)
     77            return originInterpreter->isSafeScript(obj->executionContext->interpreter());
    7878    }
    7979    return true;
     
    113113    if (o->_class == NPScriptObjectClass) {
    114114        JavaScriptObject* obj = (JavaScriptObject*)o;
    115         if (!_isSafeScript(obj))
    116             return false;
     115        if (!_isSafeScript(obj))
     116            return false;
    117117
    118118        PrivateIdentifier* i = (PrivateIdentifier*)methodName;
     
    120120            return false;
    121121
    122         // Special case the "eval" method.
    123         if (methodName == _NPN_GetStringIdentifier("eval")) {
    124             if (argCount != 1)
    125                 return false;
    126             if (args[0].type != NPVariantType_String)
    127                 return false;
    128             return _NPN_Evaluate(npp, o, (NPString *)&args[0].value.stringValue, result);
    129         }
     122        // Special case the "eval" method.
     123        if (methodName == _NPN_GetStringIdentifier("eval")) {
     124            if (argCount != 1)
     125                return false;
     126            if (args[0].type != NPVariantType_String)
     127                return false;
     128            return _NPN_Evaluate(npp, o, (NPString *)&args[0].value.stringValue, result);
     129        }
    130130
    131131        // Lookup the function object.
     
    164164        JavaScriptObject* obj = (JavaScriptObject*)o;
    165165
    166         if (!_isSafeScript(obj))
    167             return false;
     166        if (!_isSafeScript(obj))
     167            return false;
    168168
    169169        ExecState* exec = obj->executionContext->interpreter()->globalExec();
     
    199199    if (o->_class == NPScriptObjectClass) {
    200200        JavaScriptObject* obj = (JavaScriptObject*)o;
    201         if (!_isSafeScript(obj))
    202             return false;
     201        if (!_isSafeScript(obj))
     202            return false;
    203203
    204204        ExecState* exec = obj->executionContext->interpreter()->globalExec();
     
    238238    if (o->_class == NPScriptObjectClass) {
    239239        JavaScriptObject* obj = (JavaScriptObject*)o;
    240         if (!_isSafeScript(obj))
    241             return false;
     240        if (!_isSafeScript(obj))
     241            return false;
    242242
    243243        ExecState* exec = obj->executionContext->interpreter()->globalExec();
     
    261261    if (o->_class == NPScriptObjectClass) {
    262262        JavaScriptObject* obj = (JavaScriptObject*)o;
    263         if (!_isSafeScript(obj))
    264             return false;
     263        if (!_isSafeScript(obj))
     264            return false;
    265265
    266266        ExecState* exec = obj->executionContext->interpreter()->globalExec();
     
    289289    if (o->_class == NPScriptObjectClass) {
    290290        JavaScriptObject* obj = (JavaScriptObject*)o;
    291         if (!_isSafeScript(obj))
    292             return false;
     291        if (!_isSafeScript(obj))
     292            return false;
    293293
    294294        ExecState* exec = obj->executionContext->interpreter()->globalExec();
     
    310310    if (o->_class == NPScriptObjectClass) {
    311311        JavaScriptObject* obj = (JavaScriptObject*)o;
    312         if (!_isSafeScript(obj))
    313             return false;
     312        if (!_isSafeScript(obj))
     313            return false;
    314314
    315315        PrivateIdentifier* i = (PrivateIdentifier*)methodName;
  • trunk/JavaScriptCore/bindings/c/c_utility.cpp

    • Property allow-tabs deleted
    r13603 r15698  
    117117            NPObject* obj = instance->getObject();
    118118            _NPN_RetainObject(obj);
    119             OBJECT_TO_NPVARIANT(obj, *result);
     119            OBJECT_TO_NPVARIANT(obj, *result);
    120120        } else {
    121             Interpreter *originInterpreter = exec->dynamicInterpreter();
     121            Interpreter *originInterpreter = exec->dynamicInterpreter();
    122122            const Bindings::RootObject *originExecutionContext = rootForInterpreter(originInterpreter);
    123123
    124             Interpreter *interpreter = 0;
    125             if (originInterpreter->isGlobalObject(value)) {
    126                 interpreter = originInterpreter->interpreterForGlobalObject(value);
    127             }
     124            Interpreter *interpreter = 0;
     125            if (originInterpreter->isGlobalObject(value)) {
     126                interpreter = originInterpreter->interpreterForGlobalObject(value);
     127            }
    128128
    129             if (!interpreter)
    130                 interpreter = originInterpreter;
    131                
     129            if (!interpreter)
     130                interpreter = originInterpreter;
     131               
    132132            const Bindings::RootObject *executionContext = rootForInterpreter(interpreter);
    133133            if (!executionContext) {
     
    137137            }
    138138   
    139             NPObject* obj = (NPObject *)exec->dynamicInterpreter()->createLanguageInstanceForValue(exec, Instance::CLanguage, value->toObject(exec), originExecutionContext, executionContext);
    140             OBJECT_TO_NPVARIANT(obj, *result);
    141         }
     139            NPObject* obj = (NPObject *)exec->dynamicInterpreter()->createLanguageInstanceForValue(exec, Instance::CLanguage, value->toObject(exec), originExecutionContext, executionContext);
     140            OBJECT_TO_NPVARIANT(obj, *result);
     141        }
    142142    }
    143143    else
  • trunk/JavaScriptCore/bindings/jni/jni_runtime.cpp

    • Property allow-tabs deleted
    r15696 r15698  
    8787    jclass cls = env->GetObjectClass(fieldJInstance);
    8888    if ( cls != NULL ) {
    89         jmethodID mid = env->GetMethodID(cls, name, sig);
    90         if ( mid != NULL )
    91         {
    92             const RootObject *execContext = instance->executionContext();
    93             if (execContext && execContext->nativeHandle()) {
    94                 JSValue *exceptionDescription = NULL;
    95                 jvalue args[1];
    96                
    97                 args[0].l = jinstance;
    98                 dispatchJNICall (execContext->nativeHandle(), fieldJInstance, false, returnType, mid, args, result, 0, exceptionDescription);
    99                 if (exceptionDescription)
    100                     throwError(exec, GeneralError, exceptionDescription->toString(exec));
    101             }
    102         }
     89        jmethodID mid = env->GetMethodID(cls, name, sig);
     90        if ( mid != NULL )
     91        {
     92            const RootObject *execContext = instance->executionContext();
     93            if (execContext && execContext->nativeHandle()) {
     94                JSValue *exceptionDescription = NULL;
     95                jvalue args[1];
     96               
     97                args[0].l = jinstance;
     98                dispatchJNICall (execContext->nativeHandle(), fieldJInstance, false, returnType, mid, args, result, 0, exceptionDescription);
     99                if (exceptionDescription)
     100                    throwError(exec, GeneralError, exceptionDescription->toString(exec));
     101            }
     102        }
    103103    }
    104104    return result;
     
    113113    switch (_JNIType) {
    114114        case object_type: {
    115             jvalue result = dispatchValueFromInstance (exec, instance, "get", "(Ljava/lang/Object;)Ljava/lang/Object;", object_type);
    116             jobject anObject = result.l;
     115            jvalue result = dispatchValueFromInstance (exec, instance, "get", "(Ljava/lang/Object;)Ljava/lang/Object;", object_type);
     116            jobject anObject = result.l;
    117117
    118118            const char *arrayType = type();
     
    121121            }
    122122            else if (anObject != 0){
    123                 jsresult = Instance::createRuntimeObject(Instance::JavaLanguage, anObject, instance->executionContext());
     123                jsresult = Instance::createRuntimeObject(Instance::JavaLanguage, anObject, instance->executionContext());
    124124            }
    125125        }
     
    136136        case int_type: {
    137137            jint value;
    138             jvalue result = dispatchValueFromInstance (exec, instance, "getInt", "(Ljava/lang/Object;)I", int_type);
    139             value = result.i;
     138            jvalue result = dispatchValueFromInstance (exec, instance, "getInt", "(Ljava/lang/Object;)I", int_type);
     139            value = result.i;
    140140            jsresult = jsNumber((int)value);
    141         }
    142         break;
     141        }
     142        break;
    143143
    144144        case long_type:
     
    146146        case double_type: {
    147147            jdouble value;
    148             jvalue result = dispatchValueFromInstance (exec, instance, "getDouble", "(Ljava/lang/Object;)D", double_type);
    149             value = result.i;
     148            jvalue result = dispatchValueFromInstance (exec, instance, "getDouble", "(Ljava/lang/Object;)D", double_type);
     149            value = result.i;
    150150            jsresult = jsNumber((double)value);
    151151        }
     
    168168    jclass cls = env->GetObjectClass(fieldJInstance);
    169169    if ( cls != NULL ) {
    170         jmethodID mid = env->GetMethodID(cls, name, sig);
    171         if ( mid != NULL )
    172         {
    173             const RootObject *execContext = instance->executionContext();
    174             if (execContext && execContext->nativeHandle()) {
    175                 JSValue *exceptionDescription = NULL;
    176                 jvalue args[2];
    177                 jvalue result;
    178                
    179                 args[0].l = jinstance;
    180                 args[1] = javaValue;
    181                 dispatchJNICall (execContext->nativeHandle(), fieldJInstance, false, void_type, mid, args, result, 0, exceptionDescription);
    182                 if (exceptionDescription)
    183                     throwError(exec, GeneralError, exceptionDescription->toString(exec));
    184             }
    185         }
     170        jmethodID mid = env->GetMethodID(cls, name, sig);
     171        if ( mid != NULL )
     172        {
     173            const RootObject *execContext = instance->executionContext();
     174            if (execContext && execContext->nativeHandle()) {
     175                JSValue *exceptionDescription = NULL;
     176                jvalue args[2];
     177                jvalue result;
     178               
     179                args[0].l = jinstance;
     180                args[1] = javaValue;
     181                dispatchJNICall (execContext->nativeHandle(), fieldJInstance, false, void_type, mid, args, result, 0, exceptionDescription);
     182                if (exceptionDescription)
     183                    throwError(exec, GeneralError, exceptionDescription->toString(exec));
     184            }
     185        }
    186186    }
    187187}
     
    196196    switch (_JNIType) {
    197197        case object_type: {
    198             dispatchSetValueToInstance (exec, instance, javaValue, "set", "(Ljava/lang/Object;Ljava/lang/Object;)V");
     198            dispatchSetValueToInstance (exec, instance, javaValue, "set", "(Ljava/lang/Object;Ljava/lang/Object;)V");
    199199        }
    200200        break;
    201201           
    202202        case boolean_type: {
    203             dispatchSetValueToInstance (exec, instance, javaValue, "setBoolean", "(Ljava/lang/Object;Z)V");
     203            dispatchSetValueToInstance (exec, instance, javaValue, "setBoolean", "(Ljava/lang/Object;Z)V");
    204204        }
    205205        break;
    206206           
    207207        case byte_type: {
    208             dispatchSetValueToInstance (exec, instance, javaValue, "setByte", "(Ljava/lang/Object;B)V");
     208            dispatchSetValueToInstance (exec, instance, javaValue, "setByte", "(Ljava/lang/Object;B)V");
    209209        }
    210210        break;
    211211
    212212        case char_type: {
    213             dispatchSetValueToInstance (exec, instance, javaValue, "setChar", "(Ljava/lang/Object;C)V");
     213            dispatchSetValueToInstance (exec, instance, javaValue, "setChar", "(Ljava/lang/Object;C)V");
    214214        }
    215215        break;
    216216
    217217        case short_type: {
    218             dispatchSetValueToInstance (exec, instance, javaValue, "setShort", "(Ljava/lang/Object;S)V");
     218            dispatchSetValueToInstance (exec, instance, javaValue, "setShort", "(Ljava/lang/Object;S)V");
    219219        }
    220220        break;
    221221
    222222        case int_type: {
    223             dispatchSetValueToInstance (exec, instance, javaValue, "setInt", "(Ljava/lang/Object;I)V");
     223            dispatchSetValueToInstance (exec, instance, javaValue, "setInt", "(Ljava/lang/Object;I)V");
    224224        }
    225225        break;
    226226
    227227        case long_type: {
    228             dispatchSetValueToInstance (exec, instance, javaValue, "setLong", "(Ljava/lang/Object;J)V");
     228            dispatchSetValueToInstance (exec, instance, javaValue, "setLong", "(Ljava/lang/Object;J)V");
    229229        }
    230230        break;
    231231
    232232        case float_type: {
    233             dispatchSetValueToInstance (exec, instance, javaValue, "setFloat", "(Ljava/lang/Object;F)V");
     233            dispatchSetValueToInstance (exec, instance, javaValue, "setFloat", "(Ljava/lang/Object;F)V");
    234234        }
    235235        break;
    236236
    237237        case double_type: {
    238             dispatchSetValueToInstance (exec, instance, javaValue, "setDouble", "(Ljava/lang/Object;D)V");
     238            dispatchSetValueToInstance (exec, instance, javaValue, "setDouble", "(Ljava/lang/Object;D)V");
    239239        }
    240240        break;
  • trunk/JavaScriptCore/bindings/jni/jni_utility.cpp

    • Property allow-tabs deleted
    r15241 r15698  
    296296    JNIEnv *env = getJNIEnv();
    297297    jmethodID mid = 0;
    298        
     298       
    299299    if ( env != NULL) {
    300300    jclass cls = env->GetObjectClass(obj);
    301301    if ( cls != NULL ) {
    302302            mid = env->GetMethodID(cls, name, sig);
    303             if (!mid) {
     303            if (!mid) {
    304304                env->ExceptionClear();
    305                 mid = env->GetStaticMethodID(cls, name, sig);
    306                 if (!mid) {
    307                     env->ExceptionClear();
    308                 }
    309             }
     305                mid = env->GetStaticMethodID(cls, name, sig);
     306                if (!mid) {
     307                    env->ExceptionClear();
     308                }
     309            }
    310310        }
    311311        env->DeleteLocalRef(cls);
     
    531531        env->ExceptionDescribe();
    532532        env->ExceptionClear();
    533                 fprintf (stderr, "\n");
     533                fprintf (stderr, "\n");
    534534    }
    535535    return s;
     
    548548        env->ExceptionDescribe();
    549549        env->ExceptionClear();
    550                 fprintf (stderr, "\n");
     550                fprintf (stderr, "\n");
    551551    }
    552552    return s;
     
    739739            if (value->isObject()){
    740740                JSObject *objectImp = static_cast<JSObject*>(value);
    741                 if (objectImp->classInfo() == &RuntimeObjectImp::info) {
    742                     RuntimeObjectImp *imp = static_cast<RuntimeObjectImp *>(value);
    743                     JavaInstance *instance = static_cast<JavaInstance*>(imp->getInternalInstance());
    744                     result.l = instance->javaInstance();
    745                 }
    746                 else if (objectImp->classInfo() == &RuntimeArray::info) {
    747                     RuntimeArray *imp = static_cast<RuntimeArray *>(value);
    748                     JavaArray *array = static_cast<JavaArray*>(imp->getConcreteArray());
    749                     result.l = array->javaArray();
    750                 }
     741                if (objectImp->classInfo() == &RuntimeObjectImp::info) {
     742                    RuntimeObjectImp *imp = static_cast<RuntimeObjectImp *>(value);
     743                    JavaInstance *instance = static_cast<JavaInstance*>(imp->getInternalInstance());
     744                    result.l = instance->javaInstance();
     745                }
     746                else if (objectImp->classInfo() == &RuntimeArray::info) {
     747                    RuntimeArray *imp = static_cast<RuntimeArray *>(value);
     748                    JavaArray *array = static_cast<JavaArray*>(imp->getConcreteArray());
     749                    result.l = array->javaArray();
     750                }
    751751            }
    752752           
     
    755755            if (result.l == 0 && strcmp(javaClassName, "java.lang.String") == 0) {
    756756#ifdef CONVERT_NULL_TO_EMPTY_STRING
    757                 if (value->isNull()) {
    758                     JNIEnv *env = getJNIEnv();
    759                     jchar buf[2];
    760                     jobject javaString = env->functions->NewString (env, buf, 0);
    761                     result.l = javaString;
    762                 }
    763                 else
     757                if (value->isNull()) {
     758                    JNIEnv *env = getJNIEnv();
     759                    jchar buf[2];
     760                    jobject javaString = env->functions->NewString (env, buf, 0);
     761                    result.l = javaString;
     762                }
     763                else
    764764#else
    765                 if (!value->isNull())
     765                if (!value->isNull())
    766766#endif
    767                 {
    768                     UString stringValue = value->toString(exec);
    769                     JNIEnv *env = getJNIEnv();
    770                     jobject javaString = env->functions->NewString (env, (const jchar *)stringValue.data(), stringValue.size());
    771                     result.l = javaString;
    772                 }
     767                {
     768                    UString stringValue = value->toString(exec);
     769                    JNIEnv *env = getJNIEnv();
     770                    jobject javaString = env->functions->NewString (env, (const jchar *)stringValue.data(), stringValue.size());
     771                    result.l = javaString;
     772                }
    773773            }
    774774        }
  • trunk/JavaScriptCore/bindings/objc/objc_utility.mm

    • Property allow-tabs deleted
    r15618 r15698  
    6868        } else if (*sp == '_')
    6969            *dp = ':';
    70         else
     70        else
    7171            *dp = *sp;
    7272
     
    104104
    105105    if (value->isNumber() || value->isString() || value->isBoolean())
    106         d = value->toNumber(exec);
    107        
     106        d = value->toNumber(exec);
     107       
    108108    switch (type){
    109109        case ObjcObjectType: {
    110             Interpreter *originInterpreter = exec->dynamicInterpreter();
     110            Interpreter *originInterpreter = exec->dynamicInterpreter();
    111111            const RootObject *originExecutionContext = rootForInterpreter(originInterpreter);
    112112
    113             Interpreter *interpreter = 0;
    114             if (originInterpreter->isGlobalObject(value)) {
    115                 interpreter = originInterpreter->interpreterForGlobalObject (value);
    116             }
    117 
    118             if (!interpreter)
    119                 interpreter = originInterpreter;
    120                
     113            Interpreter *interpreter = 0;
     114            if (originInterpreter->isGlobalObject(value)) {
     115                interpreter = originInterpreter->interpreterForGlobalObject (value);
     116            }
     117
     118            if (!interpreter)
     119                interpreter = originInterpreter;
     120               
    121121            const RootObject *executionContext = rootForInterpreter(interpreter);
    122122            if (!executionContext) {
     
    309309{
    310310    if (!value->isObject())
    311         return 0;
     311        return 0;
    312312    if (!webScriptObjectClass)
    313313        webScriptObjectClass = NSClassFromString(@"WebScriptObject");
  • trunk/JavaScriptCore/bindings/runtime.cpp

    • Property allow-tabs deleted
    r13015 r15698  
    11/*
    2  * Copyright (C) 2003 Apple Computer, Inc.  All rights reserved.
     2 * Copyright (C) 2003, 2006 Apple Computer, Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3838void deleteMethodList(CFAllocatorRef, const void* value)
    3939{
    40         const MethodList* methodList = static_cast<const MethodList*>(value);
    41         int end = methodList->length();
    42         for (int i = 0; i < end; i++) {
    43             delete methodList->methodAt(i);
    44         }
    45        
    46         delete methodList;
     40    const MethodList* methodList = static_cast<const MethodList*>(value);
     41    int end = methodList->length();
     42    for (int i = 0; i < end; i++)
     43        delete methodList->methodAt(i);   
     44    delete methodList;
    4745}
    4846
     
    134132   
    135133    switch (language) {
    136         case Instance::JavaLanguage: {
    137             newInstance = new Bindings::JavaInstance((jobject)nativeInstance, executionContext);
    138             break;
    139         }
    140         case Instance::ObjectiveCLanguage: {
    141             newInstance = new Bindings::ObjcInstance((ObjectStructPtr)nativeInstance);
    142             break;
    143         }
    144         case Instance::CLanguage: {
    145             newInstance = new Bindings::CInstance((NPObject *)nativeInstance);
    146             break;
    147         }
    148         default:
    149             break;
     134        case Instance::JavaLanguage: {
     135            newInstance = new Bindings::JavaInstance((jobject)nativeInstance, executionContext);
     136            break;
     137        }
     138        case Instance::ObjectiveCLanguage: {
     139            newInstance = new Bindings::ObjcInstance((ObjectStructPtr)nativeInstance);
     140            break;
     141        }
     142        case Instance::CLanguage: {
     143            newInstance = new Bindings::CInstance((NPObject *)nativeInstance);
     144            break;
     145        }
     146        default:
     147            break;
    150148    }
    151149
    152150    if (newInstance)
    153         newInstance->setExecutionContext(executionContext);
    154        
     151        newInstance->setExecutionContext(executionContext);
     152       
    155153    return newInstance;
    156154}
     
    169167   
    170168    if (!value->isObject())
    171         return 0;
     169        return 0;
    172170
    173171    JSObject *imp = static_cast<JSObject*>(value);
    174172   
    175173    switch (language) {
    176         case Instance::ObjectiveCLanguage: {
    177             result = createObjcInstanceForValue(value, origin, current);
    178             break;
    179         }
    180         case Instance::CLanguage: {
    181             result = _NPN_CreateScriptObject(0, imp, origin, current);
    182             break;
    183         }
    184         case Instance::JavaLanguage: {
    185             // FIXME:  factor creation of jni_jsobjects, also remove unnecessary thread
    186             // invocation code.
    187             break;
    188         }
    189         default:
    190             break;
     174        case Instance::ObjectiveCLanguage: {
     175            result = createObjcInstanceForValue(value, origin, current);
     176            break;
     177        }
     178        case Instance::CLanguage: {
     179            result = _NPN_CreateScriptObject(0, imp, origin, current);
     180            break;
     181        }
     182        case Instance::JavaLanguage: {
     183            // FIXME:  factor creation of jni_jsobjects, also remove unnecessary thread
     184            // invocation code.
     185            break;
     186        }
     187        default:
     188            break;
    191189    }
    192190   
  • trunk/JavaScriptCore/bindings/runtime_method.cpp

    • Property allow-tabs deleted
    r13821 r15698  
    7070{
    7171    if (_methodList.length() > 0) {
    72         RuntimeObjectImp *imp;
    73        
    74         // If thisObj is the DOM object for a plugin, get the corresponding
    75         // runtime object from the DOM object.
    76         if (thisObj->classInfo() != &KJS::RuntimeObjectImp::info) {
    77             JSValue *runtimeObject = thisObj->get(exec, "__apple_runtime_object");
    78             imp = static_cast<RuntimeObjectImp*>(runtimeObject);
    79         }
    80         else {
    81             imp = static_cast<RuntimeObjectImp*>(thisObj);
    82         }
     72        RuntimeObjectImp *imp;
     73       
     74        // If thisObj is the DOM object for a plugin, get the corresponding
     75        // runtime object from the DOM object.
     76        if (thisObj->classInfo() != &KJS::RuntimeObjectImp::info) {
     77            JSValue *runtimeObject = thisObj->get(exec, "__apple_runtime_object");
     78            imp = static_cast<RuntimeObjectImp*>(runtimeObject);
     79        }
     80        else {
     81            imp = static_cast<RuntimeObjectImp*>(thisObj);
     82        }
    8383        if (imp) {
    8484            Instance *instance = imp->getInternalInstance();
     
    107107    return Completion(Normal, jsUndefined());
    108108}
    109 
  • trunk/JavaScriptCore/bindings/testbindings.cpp

    • Property allow-tabs deleted
    r12069 r15698  
    4545typedef struct
    4646{
    47         NPObject object;
    48         double doubleValue;
    49         int intValue;
    50         NPVariant stringValue;
    51         bool boolValue;
     47    NPObject object;
     48    double doubleValue;
     49    int intValue;
     50    NPVariant stringValue;
     51    bool boolValue;
    5252} MyObject;
    5353
     
    5555static bool identifiersInitialized = false;
    5656
    57 #define ID_DOUBLE_VALUE                         0
    58 #define ID_INT_VALUE                            1
    59 #define ID_STRING_VALUE                         2
    60 #define ID_BOOLEAN_VALUE                        3
    61 #define ID_NULL_VALUE                           4
    62 #define ID_UNDEFINED_VALUE                      5
    63 #define NUM_PROPERTY_IDENTIFIERS        6
     57#define ID_DOUBLE_VALUE                         0
     58#define ID_INT_VALUE                            1
     59#define ID_STRING_VALUE                         2
     60#define ID_BOOLEAN_VALUE                        3
     61#define ID_NULL_VALUE                           4
     62#define ID_UNDEFINED_VALUE                      5
     63#define NUM_PROPERTY_IDENTIFIERS                6
    6464
    6565static NPIdentifier myPropertyIdentifiers[NUM_PROPERTY_IDENTIFIERS];
    6666static const NPUTF8 *myPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = {
    67         "doubleValue",
    68         "intValue",
    69         "stringValue",
    70         "booleanValue",
    71         "nullValue",
    72         "undefinedValue"
     67    "doubleValue",
     68    "intValue",
     69    "stringValue",
     70    "booleanValue",
     71    "nullValue",
     72    "undefinedValue"
    7373};
    7474
    75 #define ID_LOG_MESSAGE                          0
    76 #define ID_SET_DOUBLE_VALUE                     1
    77 #define ID_SET_INT_VALUE                        2
    78 #define ID_SET_STRING_VALUE                     3
    79 #define ID_SET_BOOLEAN_VALUE            4
    80 #define ID_GET_DOUBLE_VALUE                     5
    81 #define ID_GET_INT_VALUE                        6
    82 #define ID_GET_STRING_VALUE                     7
    83 #define ID_GET_BOOLEAN_VALUE            8
    84 #define NUM_METHOD_IDENTIFIERS          9
     75#define ID_LOG_MESSAGE                          0
     76#define ID_SET_DOUBLE_VALUE                     1
     77#define ID_SET_INT_VALUE                        2
     78#define ID_SET_STRING_VALUE                     3
     79#define ID_SET_BOOLEAN_VALUE                    4
     80#define ID_GET_DOUBLE_VALUE                     5
     81#define ID_GET_INT_VALUE                        6
     82#define ID_GET_STRING_VALUE                     7
     83#define ID_GET_BOOLEAN_VALUE                    8
     84#define NUM_METHOD_IDENTIFIERS                  9
    8585
    8686static NPIdentifier myMethodIdentifiers[NUM_METHOD_IDENTIFIERS];
    8787static const NPUTF8 *myMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
    88         "logMessage",
    89         "setDoubleValue",
    90         "setIntValue",
    91         "setStringValue",
    92         "setBooleanValue",
    93         "getDoubleValue",
    94         "getIntValue",
    95         "getStringValue",
    96         "getBooleanValue"
     88    "logMessage",
     89    "setDoubleValue",
     90    "setIntValue",
     91    "setStringValue",
     92    "setBooleanValue",
     93    "getDoubleValue",
     94    "getIntValue",
     95    "getStringValue",
     96    "getBooleanValue"
    9797};
    9898
    9999static void initializeIdentifiers()
    100100{
    101         NPN_GetStringIdentifiers (myPropertyIdentifierNames, NUM_PROPERTY_IDENTIFIERS, myPropertyIdentifiers);
    102         NPN_GetStringIdentifiers (myMethodIdentifierNames, NUM_METHOD_IDENTIFIERS, myMethodIdentifiers);
     101    NPN_GetStringIdentifiers (myPropertyIdentifierNames, NUM_PROPERTY_IDENTIFIERS, myPropertyIdentifiers);
     102    NPN_GetStringIdentifiers (myMethodIdentifierNames, NUM_METHOD_IDENTIFIERS, myMethodIdentifiers);
    103103};
    104104
    105105bool myHasProperty (NPClass *theClass, NPIdentifier name)
    106 {       
    107         int i;
    108         for (i = 0; i < NUM_PROPERTY_IDENTIFIERS; i++) {
    109                 if (name == myPropertyIdentifiers[i]){
    110                         return true;
    111                 }
    112         }
    113         return false;
     106{
     107    int i;
     108    for (i = 0; i < NUM_PROPERTY_IDENTIFIERS; i++) {
     109        if (name == myPropertyIdentifiers[i]){
     110            return true;
     111        }
     112    }
     113    return false;
    114114}
    115115
    116116bool myHasMethod (NPClass *theClass, NPIdentifier name)
    117117{
    118         int i;
    119         for (i = 0; i < NUM_METHOD_IDENTIFIERS; i++) {
    120                 if (name == myMethodIdentifiers[i]){
    121                         return true;
    122                 }
    123         }
    124         return false;
     118    int i;
     119    for (i = 0; i < NUM_METHOD_IDENTIFIERS; i++) {
     120        if (name == myMethodIdentifiers[i]){
     121            return true;
     122        }
     123    }
     124    return false;
    125125}
    126126
     
    129129{
    130130    if (message->type == NPVariantStringType) {
    131         char msgBuf[1024];
    132         strncpy (msgBuf, message->value.stringValue.UTF8Characters, message->value.stringValue.UTF8Length);
    133         msgBuf[message->value.stringValue.UTF8Length] = 0;
     131        char msgBuf[1024];
     132        strncpy (msgBuf, message->value.stringValue.UTF8Characters, message->value.stringValue.UTF8Length);
     133        msgBuf[message->value.stringValue.UTF8Length] = 0;
    134134        printf ("%s\n", msgBuf);
    135135    }
     
    144144void setDoubleValue (MyObject *obj, const NPVariant *variant)
    145145{
    146         if (!NPN_VariantToDouble (variant, &obj->doubleValue)) {
    147                 NPUTF8 *msg = "Attempt to set double value with invalid type.";
    148                 NPString aString;
    149                 aString.UTF8Characters = msg;
    150                 aString.UTF8Length = strlen (msg);
    151                 NPN_SetException ((NPObject *)obj, &aString);
    152         }
     146    if (!NPN_VariantToDouble (variant, &obj->doubleValue)) {
     147        NPUTF8 *msg = "Attempt to set double value with invalid type.";
     148        NPString aString;
     149        aString.UTF8Characters = msg;
     150        aString.UTF8Length = strlen (msg);
     151        NPN_SetException ((NPObject *)obj, &aString);
     152    }
    153153}
    154154
    155155void setIntValue (MyObject *obj, const NPVariant *variant)
    156156{
    157         if (!NPN_VariantToInt32 (variant, &obj->intValue)) {
    158                 NPUTF8 *msg = "Attempt to set int value with invalid type.";
    159                 NPString aString;
    160                 aString.UTF8Characters = msg;
    161                 aString.UTF8Length = strlen (msg);
    162                 NPN_SetException ((NPObject *)obj, &aString);
    163         }
     157    if (!NPN_VariantToInt32 (variant, &obj->intValue)) {
     158        NPUTF8 *msg = "Attempt to set int value with invalid type.";
     159        NPString aString;
     160        aString.UTF8Characters = msg;
     161        aString.UTF8Length = strlen (msg);
     162        NPN_SetException ((NPObject *)obj, &aString);
     163    }
    164164}
    165165
    166166void setStringValue (MyObject *obj, const NPVariant *variant)
    167167{
    168         NPN_ReleaseVariantValue (&obj->stringValue);
    169         NPN_InitializeVariantWithVariant (&obj->stringValue, variant);
     168    NPN_ReleaseVariantValue (&obj->stringValue);
     169    NPN_InitializeVariantWithVariant (&obj->stringValue, variant);
    170170}
    171171
    172172void setBooleanValue (MyObject *obj, const NPVariant *variant)
    173173{
    174         if (!NPN_VariantToBool (variant, (NPBool *)&obj->boolValue)) {
    175                 NPUTF8 *msg = "Attempt to set bool value with invalid type.";
    176                 NPString aString;
    177                 aString.UTF8Characters = msg;
    178                 aString.UTF8Length = strlen (msg);
    179                 NPN_SetException ((NPObject *)obj, &aString);
    180         }
     174    if (!NPN_VariantToBool (variant, (NPBool *)&obj->boolValue)) {
     175        NPUTF8 *msg = "Attempt to set bool value with invalid type.";
     176        NPString aString;
     177        aString.UTF8Characters = msg;
     178        aString.UTF8Length = strlen (msg);
     179        NPN_SetException ((NPObject *)obj, &aString);
     180    }
    181181}
    182182
    183183void getDoubleValue (MyObject *obj, NPVariant *variant)
    184184{
    185         NPN_InitializeVariantWithDouble (variant, obj->doubleValue);
     185    NPN_InitializeVariantWithDouble (variant, obj->doubleValue);
    186186}
    187187
    188188void getIntValue (MyObject *obj, NPVariant *variant)
    189189{
    190         NPN_InitializeVariantWithInt32 (variant, obj->intValue);
     190    NPN_InitializeVariantWithInt32 (variant, obj->intValue);
    191191}
    192192
    193193void getStringValue (MyObject *obj, NPVariant *variant)
    194194{
    195         NPN_InitializeVariantWithVariant (variant, &obj->stringValue);
     195    NPN_InitializeVariantWithVariant (variant, &obj->stringValue);
    196196}
    197197
    198198void getBooleanValue (MyObject *obj, NPVariant *variant)
    199199{
    200         NPN_InitializeVariantWithBool (variant, obj->boolValue);
     200    NPN_InitializeVariantWithBool (variant, obj->boolValue);
    201201}
    202202
    203203void myGetProperty (MyObject *obj, NPIdentifier name, NPVariant *variant)
    204204{
    205         if (name == myPropertyIdentifiers[ID_DOUBLE_VALUE]){
    206                 getDoubleValue (obj, variant);
    207         }
    208         else if (name == myPropertyIdentifiers[ID_INT_VALUE]){
    209                 getIntValue (obj, variant);
    210         }
    211         else if (name == myPropertyIdentifiers[ID_STRING_VALUE]){
    212                 getStringValue (obj, variant);
    213         }
    214         else if (name == myPropertyIdentifiers[ID_BOOLEAN_VALUE]){
    215                 getBooleanValue (obj, variant);
    216         }
    217         else if (name == myPropertyIdentifiers[ID_NULL_VALUE]){
    218                 return NPN_InitializeVariantAsNull (variant);
    219         }
    220         else if (name == myPropertyIdentifiers[ID_UNDEFINED_VALUE]){
    221                 return NPN_InitializeVariantAsUndefined (variant);
    222         }
    223         else
    224                 NPN_InitializeVariantAsUndefined(variant);
     205    if (name == myPropertyIdentifiers[ID_DOUBLE_VALUE]){
     206        getDoubleValue (obj, variant);
     207    }
     208    else if (name == myPropertyIdentifiers[ID_INT_VALUE]){
     209        getIntValue (obj, variant);
     210    }
     211    else if (name == myPropertyIdentifiers[ID_STRING_VALUE]){
     212        getStringValue (obj, variant);
     213    }
     214    else if (name == myPropertyIdentifiers[ID_BOOLEAN_VALUE]){
     215        getBooleanValue (obj, variant);
     216    }
     217    else if (name == myPropertyIdentifiers[ID_NULL_VALUE]){
     218        return NPN_InitializeVariantAsNull (variant);
     219    }
     220    else if (name == myPropertyIdentifiers[ID_UNDEFINED_VALUE]){
     221        return NPN_InitializeVariantAsUndefined (variant);
     222    }
     223    else
     224        NPN_InitializeVariantAsUndefined(variant);
    225225}
    226226
    227227void mySetProperty (MyObject *obj, NPIdentifier name, const NPVariant *variant)
    228228{
    229         if (name == myPropertyIdentifiers[ID_DOUBLE_VALUE]) {
    230                 setDoubleValue (obj, variant);
    231         }
    232         else if (name == myPropertyIdentifiers[ID_INT_VALUE]) {
    233                 setIntValue (obj, variant);
    234         }
    235         else if (name == myPropertyIdentifiers[ID_STRING_VALUE]) {
    236                 setStringValue (obj, variant);
    237         }
    238         else if (name == myPropertyIdentifiers[ID_BOOLEAN_VALUE]) {
    239                 setBooleanValue (obj, variant);
    240         }
    241         else if (name == myPropertyIdentifiers[ID_NULL_VALUE]) {
    242                 // Do nothing!
    243         }
    244         else if (name == myPropertyIdentifiers[ID_UNDEFINED_VALUE]) {
    245                 // Do nothing!
    246         }
     229    if (name == myPropertyIdentifiers[ID_DOUBLE_VALUE]) {
     230        setDoubleValue (obj, variant);
     231    }
     232    else if (name == myPropertyIdentifiers[ID_INT_VALUE]) {
     233        setIntValue (obj, variant);
     234    }
     235    else if (name == myPropertyIdentifiers[ID_STRING_VALUE]) {
     236        setStringValue (obj, variant);
     237    }
     238    else if (name == myPropertyIdentifiers[ID_BOOLEAN_VALUE]) {
     239        setBooleanValue (obj, variant);
     240    }
     241    else if (name == myPropertyIdentifiers[ID_NULL_VALUE]) {
     242        // Do nothing!
     243    }
     244    else if (name == myPropertyIdentifiers[ID_UNDEFINED_VALUE]) {
     245        // Do nothing!
     246    }
    247247}
    248248
    249249void myInvoke (MyObject *obj, NPIdentifier name, NPVariant *args, unsigned argCount, NPVariant *result)
    250250{
    251         if (name == myMethodIdentifiers[ID_LOG_MESSAGE]) {
    252                 if (argCount == 1 && NPN_VariantIsString(&args[0]))
    253                         logMessage (&args[0]);
    254                 NPN_InitializeVariantAsVoid (result);
    255         }
    256         else if (name == myMethodIdentifiers[ID_SET_DOUBLE_VALUE]) {
    257                 if (argCount == 1 && NPN_VariantIsDouble (&args[0]))
    258                         setDoubleValue (obj, &args[0]);
    259                 NPN_InitializeVariantAsVoid (result);
    260         }
    261         else if (name == myMethodIdentifiers[ID_SET_INT_VALUE]) {
    262                 if (argCount == 1 && (NPN_VariantIsDouble (&args[0]) || NPN_VariantIsInt32 (&args[0])))
    263                         setIntValue (obj, &args[0]);
    264                 NPN_InitializeVariantAsVoid (result);
    265         }
    266         else if (name == myMethodIdentifiers[ID_SET_STRING_VALUE]) {
    267                 if (argCount == 1 && NPN_VariantIsString (&args[0]))
    268                         setStringValue (obj, &args[0]);
    269                 NPN_InitializeVariantAsVoid (result);
    270         }
    271         else if (name == myMethodIdentifiers[ID_SET_BOOLEAN_VALUE]) {
    272                 if (argCount == 1 && NPN_VariantIsBool (&args[0]))
    273                         setBooleanValue (obj, &args[0]);
    274                 NPN_InitializeVariantAsVoid (result);
    275         }
    276         else if (name == myMethodIdentifiers[ID_GET_DOUBLE_VALUE]) {
    277                 getDoubleValue (obj, result);
    278         }
    279         else if (name == myMethodIdentifiers[ID_GET_INT_VALUE]) {
    280                 getIntValue (obj, result);
    281         }
    282         else if (name == myMethodIdentifiers[ID_GET_STRING_VALUE]) {
    283                 getStringValue (obj, result);
    284         }
    285         else if (name == myMethodIdentifiers[ID_GET_BOOLEAN_VALUE]) {
    286                 getBooleanValue (obj, result);
    287         }
    288         else
    289                 NPN_InitializeVariantAsUndefined (result);
     251    if (name == myMethodIdentifiers[ID_LOG_MESSAGE]) {
     252        if (argCount == 1 && NPN_VariantIsString(&args[0]))
     253            logMessage (&args[0]);
     254        NPN_InitializeVariantAsVoid (result);
     255    }
     256    else if (name == myMethodIdentifiers[ID_SET_DOUBLE_VALUE]) {
     257        if (argCount == 1 && NPN_VariantIsDouble (&args[0]))
     258            setDoubleValue (obj, &args[0]);
     259        NPN_InitializeVariantAsVoid (result);
     260    }
     261    else if (name == myMethodIdentifiers[ID_SET_INT_VALUE]) {
     262        if (argCount == 1 && (NPN_VariantIsDouble (&args[0]) || NPN_VariantIsInt32 (&args[0])))
     263            setIntValue (obj, &args[0]);
     264        NPN_InitializeVariantAsVoid (result);
     265    }
     266    else if (name == myMethodIdentifiers[ID_SET_STRING_VALUE]) {
     267        if (argCount == 1 && NPN_VariantIsString (&args[0]))
     268            setStringValue (obj, &args[0]);
     269        NPN_InitializeVariantAsVoid (result);
     270    }
     271    else if (name == myMethodIdentifiers[ID_SET_BOOLEAN_VALUE]) {
     272        if (argCount == 1 && NPN_VariantIsBool (&args[0]))
     273            setBooleanValue (obj, &args[0]);
     274        NPN_InitializeVariantAsVoid (result);
     275    }
     276    else if (name == myMethodIdentifiers[ID_GET_DOUBLE_VALUE]) {
     277        getDoubleValue (obj, result);
     278    }
     279    else if (name == myMethodIdentifiers[ID_GET_INT_VALUE]) {
     280        getIntValue (obj, result);
     281    }
     282    else if (name == myMethodIdentifiers[ID_GET_STRING_VALUE]) {
     283        getStringValue (obj, result);
     284    }
     285    else if (name == myMethodIdentifiers[ID_GET_BOOLEAN_VALUE]) {
     286        getBooleanValue (obj, result);
     287    }
     288    else
     289        NPN_InitializeVariantAsUndefined (result);
    290290}
    291291
    292292NPObject *myAllocate ()
    293293{
    294         MyObject *newInstance = (MyObject *)malloc (sizeof(MyObject));
    295        
    296         if (!identifiersInitialized) {
    297                 identifiersInitialized = true;
    298                 initializeIdentifiers();
    299         }
    300        
    301        
    302         newInstance->doubleValue = 666.666;
    303         newInstance->intValue = 1234;
    304         newInstance->boolValue = true;
    305         newInstance->stringValue.value.stringValue.UTF8Length = strlen ("Hello world");
    306         newInstance->stringValue.value.stringValue.UTF8Characters = strdup ("Hello world");
    307        
    308         return (NPObject *)newInstance;
     294    MyObject *newInstance = (MyObject *)malloc (sizeof(MyObject));
     295   
     296    if (!identifiersInitialized) {
     297        identifiersInitialized = true;
     298        initializeIdentifiers();
     299    }
     300   
     301   
     302    newInstance->doubleValue = 666.666;
     303    newInstance->intValue = 1234;
     304    newInstance->boolValue = true;
     305    newInstance->stringValue.value.stringValue.UTF8Length = strlen ("Hello world");
     306    newInstance->stringValue.value.stringValue.UTF8Characters = strdup ("Hello world");
     307   
     308    return (NPObject *)newInstance;
    309309}
    310310
    311311void myInvalidate ()
    312312{
    313         // Make sure we've released any remainging references to JavaScript
    314         // objects.
     313    // Make sure we've released any remaining references to JavaScript objects.
    315314}
    316315
    317316void myDeallocate (MyObject *obj)
    318317{
    319         free ((void *)obj);
     318    free ((void *)obj);
    320319}
    321320
    322321static NPClass _myFunctionPtrs = {
    323         kNPClassStructVersionCurrent,
    324         (NPAllocateFunctionPtr) myAllocate,
    325         (NPDeallocateFunctionPtr) myDeallocate,
    326         (NPInvalidateFunctionPtr) myInvalidate,
    327         (NPHasMethodFunctionPtr) myHasMethod,
    328         (NPInvokeFunctionPtr) myInvoke,
    329         (NPHasPropertyFunctionPtr) myHasProperty,
    330         (NPGetPropertyFunctionPtr) myGetProperty,
    331         (NPSetPropertyFunctionPtr) mySetProperty,
     322    kNPClassStructVersionCurrent,
     323    (NPAllocateFunctionPtr) myAllocate,
     324    (NPDeallocateFunctionPtr) myDeallocate,
     325    (NPInvalidateFunctionPtr) myInvalidate,
     326    (NPHasMethodFunctionPtr) myHasMethod,
     327    (NPInvokeFunctionPtr) myInvoke,
     328    (NPHasPropertyFunctionPtr) myHasProperty,
     329    (NPGetPropertyFunctionPtr) myGetProperty,
     330    (NPSetPropertyFunctionPtr) mySetProperty,
    332331};
    333332static NPClass *myFunctionPtrs = &_myFunctionPtrs;
  • trunk/JavaScriptCore/bindings/testbindings.mm

    • Property allow-tabs deleted
    r13089 r15698  
    6767@interface MyFirstInterface : NSObject
    6868{
    69         int myInt;
    70         MySecondInterface *mySecondInterface;
    71         id jsobject;
    72         NSString *string;
     69    int myInt;
     70    MySecondInterface *mySecondInterface;
     71    id jsobject;
     72    NSString *string;
    7373}
    7474
     
    106106- (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args;
    107107{
    108         NSLog (@"Call to undefined method %@", name);
    109         NSLog (@"%d args\n", [args count]);
    110         int i;
    111         for (i = 0; i < [args count]; i++) {
    112                 NSLog (@"%d: %@\n", i, [args objectAtIndex:i]);
    113         }
    114         return @"success";
     108    NSLog (@"Call to undefined method %@", name);
     109    NSLog (@"%d args\n", [args count]);
     110    int i;
     111    for (i = 0; i < [args count]; i++) {
     112            NSLog (@"%d: %@\n", i, [args objectAtIndex:i]);
     113    }
     114    return @"success";
    115115}
    116116*/
     
    119119- (id)valueForUndefinedKey:(NSString *)key
    120120{
    121         NSLog (@"%s:  key = %@", __PRETTY_FUNCTION__, key);
    122         return @"aValue";
     121    NSLog (@"%s:  key = %@", __PRETTY_FUNCTION__, key);
     122    return @"aValue";
    123123}
    124124*/
     
    126126- (void)setValue:(id)value forUndefinedKey:(NSString *)key
    127127{
    128         NSLog (@"%s:  key = %@", __PRETTY_FUNCTION__, key);
     128    NSLog (@"%s:  key = %@", __PRETTY_FUNCTION__, key);
    129129}
    130130
     
    157157- (NSString *)getString
    158158{
    159         return string;
     159    return string;
    160160}
    161161
  • trunk/JavaScriptCore/kjs/date_object.cpp

    • Property allow-tabs deleted
    r15595 r15698  
    117117{
    118118    if (string == "short")
    119         return kCFDateFormatterShortStyle;
     119        return kCFDateFormatterShortStyle;
    120120    if (string == "medium")
    121         return kCFDateFormatterMediumStyle;
     121        return kCFDateFormatterMediumStyle;
    122122    if (string == "long")
    123         return kCFDateFormatterLongStyle;
     123        return kCFDateFormatterLongStyle;
    124124    if (string == "full")
    125         return kCFDateFormatterFullStyle;
     125        return kCFDateFormatterFullStyle;
    126126    return defaultStyle;
    127127}
     
    137137    UString arg0String = args[0]->toString(exec);
    138138    if (arg0String == "custom" && !args[1]->isUndefined()) {
    139         useCustomFormat = true;
    140         customFormatString = args[1]->toString(exec);
     139        useCustomFormat = true;
     140        customFormatString = args[1]->toString(exec);
    141141    } else if (includeDate && includeTime && !args[1]->isUndefined()) {
    142         dateStyle = styleFromArgString(arg0String, dateStyle);
    143         timeStyle = styleFromArgString(args[1]->toString(exec), timeStyle);
     142        dateStyle = styleFromArgString(arg0String, dateStyle);
     143        timeStyle = styleFromArgString(args[1]->toString(exec), timeStyle);
    144144    } else if (includeDate && !args[0]->isUndefined()) {
    145         dateStyle = styleFromArgString(arg0String, dateStyle);
     145        dateStyle = styleFromArgString(arg0String, dateStyle);
    146146    } else if (includeTime && !args[0]->isUndefined()) {
    147         timeStyle = styleFromArgString(arg0String, timeStyle);
     147        timeStyle = styleFromArgString(arg0String, timeStyle);
    148148    }
    149149
     
    153153
    154154    if (useCustomFormat) {
    155         CFStringRef customFormatCFString = CFStringCreateWithCharacters(0, (UniChar *)customFormatString.data(), customFormatString.size());
    156         CFDateFormatterSetFormat(formatter, customFormatCFString);
    157         CFRelease(customFormatCFString);
     155        CFStringRef customFormatCFString = CFStringCreateWithCharacters(0, (UniChar *)customFormatString.data(), customFormatString.size());
     156        CFDateFormatterSetFormat(formatter, customFormatCFString);
     157        CFRelease(customFormatCFString);
    158158    }
    159159
     
    453453   We use a negative ID to denote the "UTC" variant.
    454454@begin dateTable 61
    455   toString              DateProtoFunc::ToString         DontEnum|Function       0
    456   toUTCString           -DateProtoFunc::ToUTCString             DontEnum|Function       0
    457   toDateString          DateProtoFunc::ToDateString             DontEnum|Function       0
    458   toTimeString          DateProtoFunc::ToTimeString             DontEnum|Function       0
    459   toLocaleString        DateProtoFunc::ToLocaleString   DontEnum|Function       0
    460   toLocaleDateString    DateProtoFunc::ToLocaleDateString       DontEnum|Function       0
    461   toLocaleTimeString    DateProtoFunc::ToLocaleTimeString       DontEnum|Function       0
    462   valueOf               DateProtoFunc::ValueOf          DontEnum|Function       0
    463   getTime               DateProtoFunc::GetTime          DontEnum|Function       0
    464   getFullYear           DateProtoFunc::GetFullYear              DontEnum|Function       0
    465   getUTCFullYear        -DateProtoFunc::GetFullYear             DontEnum|Function       0
    466   toGMTString           -DateProtoFunc::ToGMTString             DontEnum|Function       0
    467   getMonth              DateProtoFunc::GetMonth         DontEnum|Function       0
    468   getUTCMonth           -DateProtoFunc::GetMonth                DontEnum|Function       0
    469   getDate               DateProtoFunc::GetDate          DontEnum|Function       0
    470   getUTCDate            -DateProtoFunc::GetDate         DontEnum|Function       0
    471   getDay                DateProtoFunc::GetDay           DontEnum|Function       0
    472   getUTCDay             -DateProtoFunc::GetDay          DontEnum|Function       0
    473   getHours              DateProtoFunc::GetHours         DontEnum|Function       0
    474   getUTCHours           -DateProtoFunc::GetHours                DontEnum|Function       0
    475   getMinutes            DateProtoFunc::GetMinutes               DontEnum|Function       0
    476   getUTCMinutes         -DateProtoFunc::GetMinutes              DontEnum|Function       0
    477   getSeconds            DateProtoFunc::GetSeconds               DontEnum|Function       0
    478   getUTCSeconds         -DateProtoFunc::GetSeconds              DontEnum|Function       0
    479   getMilliseconds       DateProtoFunc::GetMilliSeconds  DontEnum|Function       0
    480   getUTCMilliseconds    -DateProtoFunc::GetMilliSeconds DontEnum|Function       0
    481   getTimezoneOffset     DateProtoFunc::GetTimezoneOffset        DontEnum|Function       0
    482   setTime               DateProtoFunc::SetTime          DontEnum|Function       1
    483   setMilliseconds       DateProtoFunc::SetMilliSeconds  DontEnum|Function       1
    484   setUTCMilliseconds    -DateProtoFunc::SetMilliSeconds DontEnum|Function       1
    485   setSeconds            DateProtoFunc::SetSeconds               DontEnum|Function       2
    486   setUTCSeconds         -DateProtoFunc::SetSeconds              DontEnum|Function       2
    487   setMinutes            DateProtoFunc::SetMinutes               DontEnum|Function       3
    488   setUTCMinutes         -DateProtoFunc::SetMinutes              DontEnum|Function       3
    489   setHours              DateProtoFunc::SetHours         DontEnum|Function       4
    490   setUTCHours           -DateProtoFunc::SetHours                DontEnum|Function       4
    491   setDate               DateProtoFunc::SetDate          DontEnum|Function       1
    492   setUTCDate            -DateProtoFunc::SetDate         DontEnum|Function       1
    493   setMonth              DateProtoFunc::SetMonth         DontEnum|Function       2
    494   setUTCMonth           -DateProtoFunc::SetMonth                DontEnum|Function       2
    495   setFullYear           DateProtoFunc::SetFullYear              DontEnum|Function       3
    496   setUTCFullYear        -DateProtoFunc::SetFullYear             DontEnum|Function       3
    497   setYear               DateProtoFunc::SetYear          DontEnum|Function       1
    498   getYear               DateProtoFunc::GetYear          DontEnum|Function       0
     455  toString              DateProtoFunc::ToString                 DontEnum|Function       0
     456  toUTCString           -DateProtoFunc::ToUTCString             DontEnum|Function       0
     457  toDateString          DateProtoFunc::ToDateString             DontEnum|Function       0
     458  toTimeString          DateProtoFunc::ToTimeString             DontEnum|Function       0
     459  toLocaleString        DateProtoFunc::ToLocaleString           DontEnum|Function       0
     460  toLocaleDateString    DateProtoFunc::ToLocaleDateString       DontEnum|Function       0
     461  toLocaleTimeString    DateProtoFunc::ToLocaleTimeString       DontEnum|Function       0
     462  valueOf               DateProtoFunc::ValueOf                  DontEnum|Function       0
     463  getTime               DateProtoFunc::GetTime                  DontEnum|Function       0
     464  getFullYear           DateProtoFunc::GetFullYear              DontEnum|Function       0
     465  getUTCFullYear        -DateProtoFunc::GetFullYear             DontEnum|Function       0
     466  toGMTString           -DateProtoFunc::ToGMTString             DontEnum|Function       0
     467  getMonth              DateProtoFunc::GetMonth                 DontEnum|Function       0
     468  getUTCMonth           -DateProtoFunc::GetMonth                DontEnum|Function       0
     469  getDate               DateProtoFunc::GetDate                  DontEnum|Function       0
     470  getUTCDate            -DateProtoFunc::GetDate                 DontEnum|Function       0
     471  getDay                DateProtoFunc::GetDay                   DontEnum|Function       0
     472  getUTCDay             -DateProtoFunc::GetDay                  DontEnum|Function       0
     473  getHours              DateProtoFunc::GetHours                 DontEnum|Function       0
     474  getUTCHours           -DateProtoFunc::GetHours                DontEnum|Function       0
     475  getMinutes            DateProtoFunc::GetMinutes               DontEnum|Function       0
     476  getUTCMinutes         -DateProtoFunc::GetMinutes              DontEnum|Function       0
     477  getSeconds            DateProtoFunc::GetSeconds               DontEnum|Function       0
     478  getUTCSeconds         -DateProtoFunc::GetSeconds              DontEnum|Function       0
     479  getMilliseconds       DateProtoFunc::GetMilliSeconds          DontEnum|Function       0
     480  getUTCMilliseconds    -DateProtoFunc::GetMilliSeconds         DontEnum|Function       0
     481  getTimezoneOffset     DateProtoFunc::GetTimezoneOffset        DontEnum|Function       0
     482  setTime               DateProtoFunc::SetTime                  DontEnum|Function       1
     483  setMilliseconds       DateProtoFunc::SetMilliSeconds          DontEnum|Function       1
     484  setUTCMilliseconds    -DateProtoFunc::SetMilliSeconds         DontEnum|Function       1
     485  setSeconds            DateProtoFunc::SetSeconds               DontEnum|Function       2
     486  setUTCSeconds         -DateProtoFunc::SetSeconds              DontEnum|Function       2
     487  setMinutes            DateProtoFunc::SetMinutes               DontEnum|Function       3
     488  setUTCMinutes         -DateProtoFunc::SetMinutes              DontEnum|Function       3
     489  setHours              DateProtoFunc::SetHours                 DontEnum|Function       4
     490  setUTCHours           -DateProtoFunc::SetHours                DontEnum|Function       4
     491  setDate               DateProtoFunc::SetDate                  DontEnum|Function       1
     492  setUTCDate            -DateProtoFunc::SetDate                 DontEnum|Function       1
     493  setMonth              DateProtoFunc::SetMonth                 DontEnum|Function       2
     494  setUTCMonth           -DateProtoFunc::SetMonth                DontEnum|Function       2
     495  setFullYear           DateProtoFunc::SetFullYear              DontEnum|Function       3
     496  setUTCFullYear        -DateProtoFunc::SetFullYear             DontEnum|Function       3
     497  setYear               DateProtoFunc::SetYear                  DontEnum|Function       1
     498  getYear               DateProtoFunc::GetYear                  DontEnum|Function       0
    499499@end
    500500*/
     
    10181018        dateString = newPosStr;
    10191019    } else if (*dateString == '/' && month == -1) {
    1020         dateString++;
     1020        dateString++;
    10211021        // This looks like a MM/DD/YYYY date, not an RFC date.
    10221022        month = day - 1; // 0-based
  • trunk/JavaScriptCore/kjs/function.cpp

    • Property allow-tabs deleted
    r15546 r15698  
    174174#ifdef KJS_VERBOSE
    175175  fprintf(stderr, "---------------------------------------------------\n"
    176           "processing parameters for %s call\n",
    177           name().isEmpty() ? "(internal)" : name().ascii());
     176          "processing parameters for %s call\n",
     177          name().isEmpty() ? "(internal)" : name().ascii());
    178178#endif
    179179
     
    185185      if (it != args.end()) {
    186186#ifdef KJS_VERBOSE
    187         fprintf(stderr, "setting parameter %s ", p->name.ascii());
    188         printInfo(exec,"to", *it);
     187        fprintf(stderr, "setting parameter %s ", p->name.ascii());
     188        printInfo(exec,"to", *it);
    189189#endif
    190         variable->put(exec, p->name, v);
    191         v = ++it;
     190        variable->put(exec, p->name, v);
     191        v = ++it;
    192192      } else
    193         variable->put(exec, p->name, jsUndefined());
     193        variable->put(exec, p->name, jsUndefined());
    194194      p = p->next.get();
    195195    }
     
    301301
    302302DeclaredFunctionImp::DeclaredFunctionImp(ExecState *exec, const Identifier &n,
    303                                         FunctionBodyNode *b, const ScopeChain &sc)
     303                                        FunctionBodyNode *b, const ScopeChain &sc)
    304304  : FunctionImp(exec, n, b)
    305305{
     
    639639            && isxdigit(p[2].uc) && isxdigit(p[3].uc)
    640640            && isxdigit(p[4].uc) && isxdigit(p[5].uc)) {
    641           charLen = 6;
    642           u = Lexer::convertUnicode(p[2].uc, p[3].uc, p[4].uc, p[5].uc);
     641          charLen = 6;
     642          u = Lexer::convertUnicode(p[2].uc, p[3].uc, p[4].uc, p[5].uc);
    643643        }
    644644      }
     
    892892          if (Lexer::isHexDigit((c+2)->uc) && Lexer::isHexDigit((c+3)->uc) &&
    893893              Lexer::isHexDigit((c+4)->uc) && Lexer::isHexDigit((c+5)->uc)) {
    894           u = Lexer::convertUnicode((c+2)->uc, (c+3)->uc,
    895                                     (c+4)->uc, (c+5)->uc);
    896           c = &u;
    897           k += 5;
     894          u = Lexer::convertUnicode((c+2)->uc, (c+3)->uc,
     895                                    (c+4)->uc, (c+5)->uc);
     896          c = &u;
     897          k += 5;
    898898          }
    899899        } else if (*c == UChar('%') && k <= len - 3 &&
     
    961961}
    962962
    963 
    964963} // namespace
  • trunk/JavaScriptCore/kjs/list.cpp

    • Property allow-tabs deleted
    r13541 r15698  
    105105    int inlineSize = min(size, inlineValuesSize);
    106106    for (int i = 0; i != inlineSize; ++i) {
    107         if (!values[i]->marked()) {
    108             values[i]->mark();
    109         }
     107        if (!values[i]->marked()) {
     108            values[i]->mark();
     109        }
    110110    }
    111111
    112112    int overflowSize = size - inlineSize;
    113113    for (int i = 0; i != overflowSize; ++i) {
    114         if (!overflow[i]->marked()) {
    115             overflow[i]->mark();
    116         }
     114        if (!overflow[i]->marked()) {
     115            overflow[i]->mark();
     116        }
    117117    }
    118118}
     
    144144    // Find a free one in the pool.
    145145    if (poolUsed < poolSize) {
    146         ListImp *imp = poolFreeList ? poolFreeList : &pool[0];
    147         poolFreeList = imp->nextInFreeList ? imp->nextInFreeList : imp + 1;
    148         imp->state = usedInPool;
    149         poolUsed++;
    150         return imp;
     146        ListImp *imp = poolFreeList ? poolFreeList : &pool[0];
     147        poolFreeList = imp->nextInFreeList ? imp->nextInFreeList : imp + 1;
     148        imp->state = usedInPool;
     149        poolUsed++;
     150        return imp;
    151151    }
    152152   
     
    218218    if (imp->state == usedInPool) {
    219219        imp->state = unusedInPool;
    220         imp->nextInFreeList = poolFreeList;
    221         poolFreeList = imp;
    222         poolUsed--;
     220        imp->nextInFreeList = poolFreeList;
     221        poolFreeList = imp;
     222        poolUsed--;
    223223    } else {
    224224        assert(imp->state == usedOnHeap);
  • trunk/JavaScriptCore/kjs/nodes.cpp

    • Property allow-tabs deleted
    r15593 r15698  
    12331233
    12341234    JSObject *o2(static_cast<JSObject*>(v2));
    1235     if (!o2->implementsHasInstance()) {
     1235    if (!o2->implementsHasInstance())
    12361236      // According to the spec, only some types of objects "implement" the [[HasInstance]] property.
    12371237      // But we are supposed to throw an exception where the object does not "have" the [[HasInstance]]
     
    12391239      // case we return false (consistent with mozilla)
    12401240      return jsBoolean(false);
    1241       //      return throwError(exec, TypeError,
    1242       //                        "Object does not implement the [[HasInstance]] method." );
    1243     }
    12441241    return jsBoolean(o2->hasInstance(exec, v1));
    12451242  }
     
    18141811      KJS_CHECKEXCEPTION
    18151812      if (!v->toBoolean(exec))
    1816         return Completion(Normal, cval);
     1813        return Completion(Normal, cval);
    18171814    }
    18181815    // bail out on error
     
    21562153      KJS_CHECKEXCEPTION
    21572154      if (strictEqual(exec, input, v)) {
    2158         res = clause->evalStatements(exec);
    2159         if (res.complType() != Normal)
    2160           return res;
    2161         while (a) {
    2162           res = a->getClause()->evalStatements(exec);
    2163           if (res.complType() != Normal)
    2164             return res;
    2165           a = a->getNext();
    2166         }
    2167         break;
     2155        res = clause->evalStatements(exec);
     2156        if (res.complType() != Normal)
     2157          return res;
     2158        while (a) {
     2159          res = a->getClause()->evalStatements(exec);
     2160          if (res.complType() != Normal)
     2161            return res;
     2162          a = a->getNext();
     2163        }
     2164        break;
    21682165      }
    21692166    }
     
    21772174      res = clause->evalStatements(exec);
    21782175      if (res.complType() != Normal)
    2179         return res;
     2176        return res;
    21802177      goto step18;
    21812178    }
  • trunk/JavaScriptCore/kjs/nodes.h

    • Property allow-tabs deleted
    r15593 r15698  
    4040
    4141  enum Operator { OpEqual,
    42                   OpEqEq,
    43                   OpNotEq,
    44                   OpStrEq,
    45                   OpStrNEq,
    46                   OpPlusEq,
    47                   OpMinusEq,
    48                   OpMultEq,
    49                   OpDivEq,
     42                  OpEqEq,
     43                  OpNotEq,
     44                  OpStrEq,
     45                  OpStrNEq,
     46                  OpPlusEq,
     47                  OpMinusEq,
     48                  OpMultEq,
     49                  OpDivEq,
    5050                  OpPlusPlus,
    51                   OpMinusMinus,
    52                   OpLess,
    53                   OpLessEq,
    54                   OpGreater,
    55                   OpGreaterEq,
    56                   OpAndEq,
    57                   OpXOrEq,
    58                   OpOrEq,
    59                   OpModEq,
     51                  OpMinusMinus,
     52                  OpLess,
     53                  OpLessEq,
     54                  OpGreater,
     55                  OpGreaterEq,
     56                  OpAndEq,
     57                  OpXOrEq,
     58                  OpOrEq,
     59                  OpModEq,
    6060                  OpAnd,
    6161                  OpOr,
    62                   OpBitAnd,
    63                   OpBitXOr,
    64                   OpBitOr,
    65                   OpLShift,
    66                   OpRShift,
    67                   OpURShift,
    68                   OpIn,
    69                   OpInstanceOf
     62                  OpBitAnd,
     63                  OpBitXOr,
     64                  OpBitOr,
     65                  OpLShift,
     66                  OpRShift,
     67                  OpURShift,
     68                  OpIn,
     69                  OpInstanceOf
    7070  };
    7171
  • trunk/JavaScriptCore/kjs/string_object.cpp

    • Property allow-tabs deleted
    r15468 r15698  
    107107/* Source for string_object.lut.h
    108108@begin stringTable 26
    109   toString              StringProtoFunc::ToString       DontEnum|Function       0
    110   valueOf               StringProtoFunc::ValueOf        DontEnum|Function       0
    111   charAt                StringProtoFunc::CharAt DontEnum|Function       1
    112   charCodeAt            StringProtoFunc::CharCodeAt     DontEnum|Function       1
    113   concat                StringProtoFunc::Concat DontEnum|Function       1
    114   indexOf               StringProtoFunc::IndexOf        DontEnum|Function       1
    115   lastIndexOf           StringProtoFunc::LastIndexOf    DontEnum|Function       1
    116   match                 StringProtoFunc::Match  DontEnum|Function       1
    117   replace               StringProtoFunc::Replace        DontEnum|Function       2
    118   search                StringProtoFunc::Search DontEnum|Function       1
    119   slice                 StringProtoFunc::Slice  DontEnum|Function       2
    120   split                 StringProtoFunc::Split  DontEnum|Function       2
    121   substr                StringProtoFunc::Substr DontEnum|Function       2
    122   substring             StringProtoFunc::Substring      DontEnum|Function       2
    123   toLowerCase           StringProtoFunc::ToLowerCase    DontEnum|Function       0
    124   toUpperCase           StringProtoFunc::ToUpperCase    DontEnum|Function       0
    125   toLocaleLowerCase     StringProtoFunc::ToLocaleLowerCase DontEnum|Function    0
    126   toLocaleUpperCase     StringProtoFunc::ToLocaleUpperCase DontEnum|Function    0
     109  toString              StringProtoFunc::ToString       DontEnum|Function       0
     110  valueOf               StringProtoFunc::ValueOf        DontEnum|Function       0
     111  charAt                StringProtoFunc::CharAt         DontEnum|Function       1
     112  charCodeAt            StringProtoFunc::CharCodeAt     DontEnum|Function       1
     113  concat                StringProtoFunc::Concat         DontEnum|Function       1
     114  indexOf               StringProtoFunc::IndexOf        DontEnum|Function       1
     115  lastIndexOf           StringProtoFunc::LastIndexOf    DontEnum|Function       1
     116  match                 StringProtoFunc::Match          DontEnum|Function       1
     117  replace               StringProtoFunc::Replace        DontEnum|Function       2
     118  search                StringProtoFunc::Search         DontEnum|Function       1
     119  slice                 StringProtoFunc::Slice          DontEnum|Function       2
     120  split                 StringProtoFunc::Split          DontEnum|Function       2
     121  substr                StringProtoFunc::Substr         DontEnum|Function       2
     122  substring             StringProtoFunc::Substring      DontEnum|Function       2
     123  toLowerCase           StringProtoFunc::ToLowerCase    DontEnum|Function       0
     124  toUpperCase           StringProtoFunc::ToUpperCase    DontEnum|Function       0
     125  toLocaleLowerCase     StringProtoFunc::ToLocaleLowerCase DontEnum|Function    0
     126  toLocaleUpperCase     StringProtoFunc::ToLocaleUpperCase DontEnum|Function    0
    127127#
    128128# Under here: html extension, should only exist if KJS_PURE_ECMA is not defined
    129129# I guess we need to generate two hashtables in the .lut.h file, and use #ifdef
    130130# to select the right one... TODO. #####
    131   big                   StringProtoFunc::Big            DontEnum|Function       0
    132   small                 StringProtoFunc::Small  DontEnum|Function       0
    133   blink                 StringProtoFunc::Blink  DontEnum|Function       0
    134   bold                  StringProtoFunc::Bold   DontEnum|Function       0
    135   fixed                 StringProtoFunc::Fixed  DontEnum|Function       0
    136   italics               StringProtoFunc::Italics        DontEnum|Function       0
    137   strike                StringProtoFunc::Strike DontEnum|Function       0
    138   sub                   StringProtoFunc::Sub            DontEnum|Function       0
    139   sup                   StringProtoFunc::Sup            DontEnum|Function       0
    140   fontcolor             StringProtoFunc::Fontcolor      DontEnum|Function       1
    141   fontsize              StringProtoFunc::Fontsize       DontEnum|Function       1
    142   anchor                StringProtoFunc::Anchor DontEnum|Function       1
    143   link                  StringProtoFunc::Link   DontEnum|Function       1
     131  big                   StringProtoFunc::Big            DontEnum|Function       0
     132  small                 StringProtoFunc::Small          DontEnum|Function       0
     133  blink                 StringProtoFunc::Blink          DontEnum|Function       0
     134  bold                  StringProtoFunc::Bold           DontEnum|Function       0
     135  fixed                 StringProtoFunc::Fixed          DontEnum|Function       0
     136  italics               StringProtoFunc::Italics        DontEnum|Function       0
     137  strike                StringProtoFunc::Strike         DontEnum|Function       0
     138  sub                   StringProtoFunc::Sub            DontEnum|Function       0
     139  sup                   StringProtoFunc::Sup            DontEnum|Function       0
     140  fontcolor             StringProtoFunc::Fontcolor      DontEnum|Function       1
     141  fontsize              StringProtoFunc::Fontsize       DontEnum|Function       1
     142  anchor                StringProtoFunc::Anchor         DontEnum|Function       1
     143  link                  StringProtoFunc::Link           DontEnum|Function       1
    144144@end
    145145*/
     
    488488      // Exec
    489489      if ((reg->flags() & RegExp::Global) == 0) {
    490         // case without 'g' flag is handled like RegExp.prototype.exec
    491         if (mstr.isNull()) {
    492           result = jsNull();
    493         } else {
    494           result = regExpObj->arrayOfMatches(exec,mstr);
    495         }
     490        // case without 'g' flag is handled like RegExp.prototype.exec
     491        if (mstr.isNull()) {
     492          result = jsNull();
     493        } else {
     494          result = regExpObj->arrayOfMatches(exec,mstr);
     495        }
    496496      } else {
    497         // return array of matches
    498         List list;
    499         int lastIndex = 0;
    500         while (pos >= 0) {
     497        // return array of matches
     498        List list;
     499        int lastIndex = 0;
     500        while (pos >= 0) {
    501501          if (mstr.isNull())
    502502            list.append(jsUndefined());
    503503          else
    504             list.append(jsString(mstr));
    505           lastIndex = pos;
    506           pos += mstr.isEmpty() ? 1 : mstr.size();
    507           mstr = regExpObj->performMatch(reg, u, pos, &pos);
    508         }
    509         if (imp)
    510           imp->put(exec, "lastIndex", jsNumber(lastIndex), DontDelete|DontEnum);
    511         if (list.isEmpty()) {
    512           // if there are no matches at all, it's important to return
    513           // Null instead of an empty array, because this matches
    514           // other browsers and because Null is a false value.
    515           result = jsNull();
    516         } else {
    517           result = exec->lexicalInterpreter()->builtinArray()->construct(exec, list);
    518         }
     504            list.append(jsString(mstr));
     505          lastIndex = pos;
     506          pos += mstr.isEmpty() ? 1 : mstr.size();
     507          mstr = regExpObj->performMatch(reg, u, pos, &pos);
     508        }
     509        if (imp)
     510          imp->put(exec, "lastIndex", jsNumber(lastIndex), DontDelete|DontEnum);
     511        if (list.isEmpty()) {
     512          // if there are no matches at all, it's important to return
     513          // Null instead of an empty array, because this matches
     514          // other browsers and because Null is a false value.
     515          result = jsNull();
     516        } else {
     517          result = exec->lexicalInterpreter()->builtinArray()->construct(exec, list);
     518        }
    519519      }
    520520    }
     
    553553      RegExp *reg = static_cast<RegExpImp *>(a0)->regExp();
    554554      if (u.isEmpty() && !reg->match(u, 0).isNull()) {
    555         // empty string matched by regexp -> empty array
    556         res->put(exec,lengthPropertyName, jsNumber(0));
    557         break;
     555        // empty string matched by regexp -> empty array
     556        res->put(exec,lengthPropertyName, jsNumber(0));
     557        break;
    558558      }
    559559      pos = 0;
    560560      while (static_cast<uint32_t>(i) != limit && pos < u.size()) {
    561         // TODO: back references
     561        // TODO: back references
    562562        int mpos;
    563563        int *ovector = 0L;
    564         UString mstr = reg->match(u, pos, &mpos, &ovector);
     564        UString mstr = reg->match(u, pos, &mpos, &ovector);
    565565        delete [] ovector; ovector = 0L;
    566         if (mpos < 0)
    567           break;
    568         pos = mpos + (mstr.isEmpty() ? 1 : mstr.size());
    569         if (mpos != p0 || !mstr.isEmpty()) {
    570           res->put(exec,i, jsString(u.substr(p0, mpos-p0)));
    571           p0 = mpos + mstr.size();
    572           i++;
    573         }
     566        if (mpos < 0)
     567          break;
     568        pos = mpos + (mstr.isEmpty() ? 1 : mstr.size());
     569        if (mpos != p0 || !mstr.isEmpty()) {
     570          res->put(exec,i, jsString(u.substr(p0, mpos-p0)));
     571          p0 = mpos + mstr.size();
     572          i++;
     573        }
    574574      }
    575575    } else {
    576576      u2 = a0->toString(exec);
    577577      if (u2.isEmpty()) {
    578         if (u.isEmpty()) {
    579           // empty separator matches empty string -> empty array
    580           put(exec,lengthPropertyName, jsNumber(0));
    581           break;
    582         } else {
    583           while (static_cast<uint32_t>(i) != limit && i < u.size()-1)
    584             res->put(exec, i++, jsString(u.substr(p0++, 1)));
    585         }
     578        if (u.isEmpty()) {
     579          // empty separator matches empty string -> empty array
     580          put(exec,lengthPropertyName, jsNumber(0));
     581          break;
     582        } else {
     583          while (static_cast<uint32_t>(i) != limit && i < u.size()-1)
     584            res->put(exec, i++, jsString(u.substr(p0++, 1)));
     585        }
    586586      } else {
    587         while (static_cast<uint32_t>(i) != limit && (pos = u.find(u2, p0)) >= 0) {
    588           res->put(exec, i, jsString(u.substr(p0, pos-p0)));
    589           p0 = pos + u2.size();
    590           i++;
    591         }
     587        while (static_cast<uint32_t>(i) != limit && (pos = u.find(u2, p0)) >= 0) {
     588          res->put(exec, i, jsString(u.substr(p0, pos-p0)));
     589          p0 = pos + u2.size();
     590          i++;
     591        }
    592592      }
    593593    }
  • trunk/JavaScriptCore/kjs/ustring.cpp

    • Property allow-tabs deleted
    r15696 r15698  
    435435    m_rep = a.m_rep;
    436436  } else if (aOffset + aSize == a.usedCapacity() && 4 * aSize >= bSize &&
    437              (-bOffset != b.usedPreCapacity() || aSize >= bSize)) {
     437             (-bOffset != b.usedPreCapacity() || aSize >= bSize)) {
    438438    // - a reaches the end of its buffer so it qualifies for shared append
    439439    // - also, it's at least a quarter the length of b - appending to a much shorter
     
    577577      i += length;
    578578      for (int j = 0; j < decimalPoint - length; j++) {
    579         buf[i++] = '0';
     579        buf[i++] = '0';
    580580      }
    581581      buf[i] = '\0';
     
    878878    while (*(++c)) {
    879879      if (*c >= '0' && *c <= '9')
    880         d = d * 16.0 + *c - '0';
     880        d = d * 16.0 + *c - '0';
    881881      else if ((*c >= 'A' && *c <= 'F') || (*c >= 'a' && *c <= 'f'))
    882         d = d * 16.0 + (*c & 0xdf) - 'A' + 10.0;
     882        d = d * 16.0 + (*c & 0xdf) - 'A' + 10.0;
    883883      else
    884         break;
     884        break;
    885885    }
    886886  } else {
     
    894894      d = 1.0;
    895895      if (*c == '+')
    896         c++;
     896        c++;
    897897      else if (*c == '-') {
    898         d = -1.0;
    899         c++;
     898        d = -1.0;
     899        c++;
    900900      }
    901901      if (strncmp(c, "Infinity", 8) != 0)
    902         return NaN;
     902        return NaN;
    903903      d = d * Inf;
    904904      c += 8;
     
    11131113
    11141114  return (memcmp(s1.m_rep->data(), s2.m_rep->data(),
    1115                 s1.m_rep->len * sizeof(UChar)) == 0);
     1115                s1.m_rep->len * sizeof(UChar)) == 0);
    11161116}
    11171117
Note: See TracChangeset for help on using the changeset viewer.