Changeset 33979 in webkit for trunk/JavaScriptCore/API


Ignore:
Timestamp:
May 21, 2008, 6:20:45 PM (17 years ago)
Author:
[email protected]
Message:

Merge squirrelfish branch into trunk.

Location:
trunk/JavaScriptCore/API
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/APICast.h

    r29663 r33979  
    109109inline JSGlobalContextRef toGlobalRef(KJS::ExecState* e)
    110110{
    111     ASSERT(!e->callingExecState());
    112111    return reinterpret_cast<JSGlobalContextRef>(e);
    113112}
  • trunk/JavaScriptCore/API/JSBase.cpp

    r33038 r33979  
    4545    UString::Rep* scriptRep = toJS(script);
    4646    UString::Rep* sourceURLRep = sourceURL ? toJS(sourceURL) : &UString::Rep::null;
     47
    4748    // Interpreter::evaluate sets "this" to the global object if it is NULL
    48     Completion completion = Interpreter::evaluate(exec->dynamicGlobalObject()->globalExec(), UString(sourceURLRep), startingLineNumber, UString(scriptRep), jsThisObject);
     49    JSGlobalObject* globalObject = exec->dynamicGlobalObject();
     50    Completion completion = Interpreter::evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), UString(sourceURLRep), startingLineNumber, UString(scriptRep), jsThisObject);
    4951
    5052    if (completion.complType() == Throw) {
  • trunk/JavaScriptCore/API/JSCallbackConstructor.cpp

    r32652 r33979  
    5757}
    5858
    59 bool JSCallbackConstructor::implementsConstruct() const
     59ConstructType JSCallbackConstructor::getConstructData(ConstructData&)
    6060{
    61     return true;
     61    return ConstructTypeNative;
    6262}
    6363
  • trunk/JavaScriptCore/API/JSCallbackConstructor.h

    r29663 r33979  
    3333namespace KJS {
    3434
    35 class JSCallbackConstructor : public JSObject
    36 {
     35class JSCallbackConstructor : public JSObject {
    3736public:
    3837    JSCallbackConstructor(ExecState* exec, JSClassRef jsClass, JSObjectCallAsConstructorCallback callback);
     
    4140    virtual bool implementsHasInstance() const;
    4241   
    43     virtual bool implementsConstruct() const;
    44     virtual JSObject* construct(ExecState*, const List &args);
     42    virtual ConstructType getConstructData(ConstructData&);
     43    virtual JSObject* construct(ExecState*, const List& args);
    4544   
    4645    virtual const ClassInfo *classInfo() const { return &info; }
  • trunk/JavaScriptCore/API/JSCallbackObject.h

    r30534 r33979  
    5454    virtual bool deleteProperty(ExecState*, unsigned);
    5555
    56     virtual bool implementsConstruct() const;
     56    virtual ConstructType getConstructData(ConstructData&);
    5757    virtual JSObject* construct(ExecState*, const List& args);
    5858
     
    6060    virtual bool hasInstance(ExecState *exec, JSValue *value);
    6161
    62     virtual bool implementsCall() const;
     62    virtual CallType getCallData(CallData&);
    6363    virtual JSValue* callAsFunction(ExecState*, JSObject* thisObj, const List &args);
    6464
  • trunk/JavaScriptCore/API/JSCallbackObjectFunctions.h

    r33038 r33979  
    238238
    239239template <class Base>
    240 bool JSCallbackObject<Base>::implementsConstruct() const
     240ConstructType JSCallbackObject<Base>::getConstructData(ConstructData&)
    241241{
    242242    for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parentClass)
    243243        if (jsClass->callAsConstructor)
    244             return true;
    245    
    246     return false;
     244            return ConstructTypeNative;
     245   
     246    return ConstructTypeNone;
    247247}
    248248
     
    264264    }
    265265   
    266     ASSERT(0); // implementsConstruct should prevent us from reaching here
     266    ASSERT(0); // getConstructData should prevent us from reaching here
    267267    return 0;
    268268}
     
    294294}
    295295
    296 
    297 template <class Base>
    298 bool JSCallbackObject<Base>::implementsCall() const
     296template <class Base>
     297CallType JSCallbackObject<Base>::getCallData(CallData&)
    299298{
    300299    for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parentClass)
    301300        if (jsClass->callAsFunction)
    302             return true;
    303    
    304     return false;
     301            return CallTypeNative;
     302   
     303    return CallTypeNone;
    305304}
    306305
     
    323322    }
    324323   
    325     ASSERT_NOT_REACHED(); // implementsCall should prevent us from reaching here
     324    ASSERT_NOT_REACHED(); // getCallData should prevent us from reaching here
    326325    return 0;
    327326}
     
    368367double JSCallbackObject<Base>::toNumber(ExecState* exec) const
    369368{
     369    // We need this check to guard against the case where this object is rhs of
     370    // a binary expression where lhs threw an exception in its conversion to
     371    // primitive
     372    if (exec->hadException())
     373        return NaN;
    370374    JSContextRef ctx = toRef(exec);
    371375    JSObjectRef thisRef = toRef(this);
  • trunk/JavaScriptCore/API/JSObjectRef.cpp

    r33038 r33979  
    299299{
    300300    JSObject* jsObject = toJS(object);
    301     return jsObject->implementsConstruct();
     301    ConstructData constructData;
     302    return jsObject->getConstructData(constructData) != ConstructTypeNone;
    302303}
    303304
  • trunk/JavaScriptCore/API/JSValueRef.cpp

    r33038 r33979  
    135135bool JSValueIsStrictEqual(JSContextRef ctx, JSValueRef a, JSValueRef b)
    136136{
    137     JSLock lock;
    138     ExecState* exec = toJS(ctx);
     137    UNUSED_PARAM(ctx);
     138
     139    JSLock lock;
    139140    JSValue* jsA = toJS(a);
    140141    JSValue* jsB = toJS(b);
    141142   
    142     bool result = strictEqual(exec, jsA, jsB); // can't throw because it doesn't perform value conversion
    143     ASSERT(!exec->hadException());
     143    bool result = strictEqual(jsA, jsB);
    144144    return result;
    145145}
Note: See TracChangeset for help on using the changeset viewer.