src/script/bridge/qscriptglobalobject.cpp
changeset 30 5dc02b23752f
parent 18 2f34d5167611
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
    70     if (customGlobalObject)
    70     if (customGlobalObject)
    71         return customGlobalObject->getOwnPropertySlot(exec, propertyName, slot);
    71         return customGlobalObject->getOwnPropertySlot(exec, propertyName, slot);
    72     return JSC::JSGlobalObject::getOwnPropertySlot(exec, propertyName, slot);
    72     return JSC::JSGlobalObject::getOwnPropertySlot(exec, propertyName, slot);
    73 }
    73 }
    74 
    74 
       
    75 bool GlobalObject::getOwnPropertyDescriptor(JSC::ExecState* exec,
       
    76                                             const JSC::Identifier& propertyName,
       
    77                                             JSC::PropertyDescriptor& descriptor)
       
    78 {
       
    79     // Must match the logic of getOwnPropertySlot().
       
    80     QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
       
    81     if (propertyName == exec->propertyNames().arguments && engine->currentFrame->argumentCount() > 0) {
       
    82         // ### Can we get rid of this special handling of the arguments property?
       
    83         JSC::JSValue args = engine->scriptValueToJSCValue(engine->contextForFrame(engine->currentFrame)->argumentsObject());
       
    84         descriptor.setValue(args);
       
    85         return true;
       
    86     }
       
    87     if (customGlobalObject)
       
    88         return customGlobalObject->getOwnPropertyDescriptor(exec, propertyName, descriptor);
       
    89     return JSC::JSGlobalObject::getOwnPropertyDescriptor(exec, propertyName, descriptor);
       
    90 }
       
    91 
    75 void GlobalObject::put(JSC::ExecState* exec, const JSC::Identifier& propertyName,
    92 void GlobalObject::put(JSC::ExecState* exec, const JSC::Identifier& propertyName,
    76                        JSC::JSValue value, JSC::PutPropertySlot& slot)
    93                        JSC::JSValue value, JSC::PutPropertySlot& slot)
    77 {
    94 {
    78     if (customGlobalObject)
    95     if (customGlobalObject)
    79         customGlobalObject->put(exec, propertyName, value, slot);
    96         customGlobalObject->put(exec, propertyName, value, slot);
    88         customGlobalObject->putWithAttributes(exec, propertyName, value, attributes);
   105         customGlobalObject->putWithAttributes(exec, propertyName, value, attributes);
    89     else
   106     else
    90         JSC::JSGlobalObject::putWithAttributes(exec, propertyName, value, attributes);
   107         JSC::JSGlobalObject::putWithAttributes(exec, propertyName, value, attributes);
    91 }
   108 }
    92 
   109 
    93 bool GlobalObject::deleteProperty(JSC::ExecState* exec,
   110 bool GlobalObject::deleteProperty(JSC::ExecState* exec, const JSC::Identifier& propertyName)
    94                                   const JSC::Identifier& propertyName, bool checkDontDelete)
       
    95 {
   111 {
    96     if (customGlobalObject)
   112     if (customGlobalObject)
    97         return customGlobalObject->deleteProperty(exec, propertyName, checkDontDelete);
   113         return customGlobalObject->deleteProperty(exec, propertyName);
    98     return JSC::JSGlobalObject::deleteProperty(exec, propertyName, checkDontDelete);
   114     return JSC::JSGlobalObject::deleteProperty(exec, propertyName);
    99 }
       
   100 
       
   101 bool GlobalObject::getPropertyAttributes(JSC::ExecState* exec, const JSC::Identifier& propertyName,
       
   102                                          unsigned& attributes) const
       
   103 {
       
   104     if (customGlobalObject)
       
   105         return customGlobalObject->getPropertyAttributes(exec, propertyName, attributes);
       
   106     return JSC::JSGlobalObject::getPropertyAttributes(exec, propertyName, attributes);
       
   107 }
   115 }
   108 
   116 
   109 void GlobalObject::getOwnPropertyNames(JSC::ExecState* exec, JSC::PropertyNameArray& propertyNames,
   117 void GlobalObject::getOwnPropertyNames(JSC::ExecState* exec, JSC::PropertyNameArray& propertyNames,
   110                                        bool includeNonEnumerable)
   118                                        JSC::EnumerationMode mode)
   111 {
   119 {
   112     if (customGlobalObject)
   120     if (customGlobalObject)
   113         customGlobalObject->getOwnPropertyNames(exec, propertyNames, includeNonEnumerable);
   121         customGlobalObject->getOwnPropertyNames(exec, propertyNames, mode);
   114     else
   122     else
   115         JSC::JSGlobalObject::getOwnPropertyNames(exec, propertyNames, includeNonEnumerable);
   123         JSC::JSGlobalObject::getOwnPropertyNames(exec, propertyNames, mode);
   116 }
   124 }
   117 
   125 
   118 void GlobalObject::defineGetter(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes)
   126 void GlobalObject::defineGetter(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes)
   119 {
   127 {
   120     if (customGlobalObject)
   128     if (customGlobalObject)