Changeset 64316 in webkit


Ignore:
Timestamp:
Jul 29, 2010 3:42:17 PM (14 years ago)
Author:
andersca@apple.com
Message:

Implement NPN_SetProperty
https://bugs.webkit.org/show_bug.cgi?id=43217

Reviewed by Sam Weinig.

  • WebProcess/Plugins/NPJSObject.cpp:

(WebKit::NPJSObject::setProperty):
Convert the NPVariant to a JSValue and set it on the underlying JSObject.

(WebKit::NPJSObject::NP_SetProperty):
Call NPJSObject::setProperty.

  • WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:

(WebKit::NPN_GetProperty):
Remove unused parameter name.

(WebKit::NPN_SetProperty):
Call the NPClass::setProperty function.

Location:
trunk/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r64312 r64316  
     12010-07-29  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Implement NPN_SetProperty
     6        https://bugs.webkit.org/show_bug.cgi?id=43217
     7
     8        * WebProcess/Plugins/NPJSObject.cpp:
     9        (WebKit::NPJSObject::setProperty):
     10        Convert the NPVariant to a JSValue and set it on the underlying JSObject.
     11
     12        (WebKit::NPJSObject::NP_SetProperty):
     13        Call NPJSObject::setProperty.
     14
     15        * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
     16        (WebKit::NPN_GetProperty):
     17        Remove unused parameter name.
     18
     19        (WebKit::NPN_SetProperty):
     20        Call the NPClass::setProperty function.
     21
    1222010-07-29  Anders Carlsson  <andersca@apple.com>
    223
  • trunk/WebKit2/WebProcess/Plugins/NPJSObject.cpp

    r64312 r64316  
    172172}
    173173
     174bool NPJSObject::setProperty(NPIdentifier propertyName, const NPVariant* value)
     175{
     176    IdentifierRep* identifierRep = static_cast<IdentifierRep*>(propertyName);
     177   
     178    ExecState* exec = m_objectMap->globalExec();
     179    if (!exec)
     180        return false;
     181   
     182    JSLock lock(SilenceAssertionsOnly);
     183
     184    JSValue jsValue = m_objectMap->convertNPVariantToJSValue(exec, m_objectMap->globalObject(), *value);
     185    if (identifierRep->isString()) {
     186        PutPropertySlot slot;
     187        m_jsObject->put(exec, identifierFromIdentifierRep(exec, identifierRep), jsValue, slot);
     188    } else
     189        m_jsObject->put(exec, identifierRep->number(), jsValue);
     190    exec->clearException();
     191   
     192    return true;
     193}
     194
    174195bool NPJSObject::enumerate(NPIdentifier** identifiers, uint32_t* identifierCount)
    175196{
     
    306327}
    307328
    308 bool NPJSObject::NP_SetProperty(NPObject*, NPIdentifier propertyName, const NPVariant* value)
    309 {
    310     notImplemented();
    311     return false;
     329bool NPJSObject::NP_SetProperty(NPObject* npObject, NPIdentifier propertyName, const NPVariant* value)
     330{
     331    return toNPJSObject(npObject)->setProperty(propertyName, value);
    312332}
    313333
  • trunk/WebKit2/WebProcess/Plugins/NPJSObject.h

    r64312 r64316  
    6666    bool hasProperty(NPIdentifier propertyName);
    6767    bool getProperty(NPIdentifier propertyName, NPVariant* result);
     68    bool setProperty(NPIdentifier propertyName, const NPVariant* value);
    6869    bool enumerate(NPIdentifier** identifiers, uint32_t* identifierCount);
    6970    bool construct(const NPVariant* arguments, uint32_t argumentCount, NPVariant* result);
  • trunk/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp

    r64312 r64316  
    573573}
    574574
    575 static bool NPN_GetProperty(NPP npp, NPObject* npObject, NPIdentifier propertyName, NPVariant* result)
     575static bool NPN_GetProperty(NPP, NPObject* npObject, NPIdentifier propertyName, NPVariant* result)
    576576{
    577577    if (npObject->_class->hasProperty && npObject->_class->getProperty) {
     
    584584}
    585585
    586 static bool NPN_SetProperty(NPP npp, NPObject* npobj, NPIdentifier propertyName, const NPVariant* value)
    587 {
    588     notImplemented();
     586static bool NPN_SetProperty(NPP, NPObject* npObject, NPIdentifier propertyName, const NPVariant* value)
     587{
     588    if (npObject->_class->setProperty)
     589        return npObject->_class->setProperty(npObject, propertyName, value);
     590
    589591    return false;
    590592}
Note: See TracChangeset for help on using the changeset viewer.