Changeset 64244 in webkit


Ignore:
Timestamp:
Jul 28, 2010 4:38:24 PM (14 years ago)
Author:
andersca@apple.com
Message:

Implement NPN_Invoke
https://bugs.webkit.org/show_bug.cgi?id=43158

Reviewed by Sam Weinig.

WebKit2:

  • WebProcess/Plugins/NPJSObject.cpp:

(WebKit::NPJSObject::hasMethod):
Use the free getCallData function.

(WebKit::NPJSObject::invoke):
Get the JavaScript function and call it.

(WebKit::NPJSObject::NP_Invoke):
Call NPJSObject::invoke.

  • WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:

(WebKit::NPN_Invoke):
Call the NPClass::invoke function.

LayoutTests:

  • platform/mac-wk2/Skipped:

Remove plugins/npruntime/invoke.html.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r64242 r64244  
    2929        * platform/chromium-linux/svg/custom/mask-colorspace-expected.png: Added.
    3030        * platform/chromium/test_expectations.txt:
     31
     322010-07-28  Anders Carlsson  <andersca@apple.com>
     33
     34        Reviewed by Sam Weinig.
     35
     36        Implement NPN_Invoke
     37        https://bugs.webkit.org/show_bug.cgi?id=43158
     38
     39        * platform/mac-wk2/Skipped:
     40        Remove plugins/npruntime/invoke.html.
    3141
    32422010-07-28  Anders Carlsson  <andersca@apple.com>
  • trunk/LayoutTests/platform/mac-wk2/Skipped

    r64240 r64244  
    14161416plugins/npruntime/get-property-return-value.html
    14171417plugins/npruntime/invoke-default.html
    1418 plugins/npruntime/invoke.html
    14191418plugins/npruntime/npruntime.html
    14201419plugins/npruntime/round-trip-npobject.html
  • trunk/WebKit2/ChangeLog

    r64240 r64244  
     12010-07-28  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Implement NPN_Invoke
     6        https://bugs.webkit.org/show_bug.cgi?id=43158
     7
     8        * WebProcess/Plugins/NPJSObject.cpp:
     9        (WebKit::NPJSObject::hasMethod):
     10        Use the free getCallData function.
     11
     12        (WebKit::NPJSObject::invoke):
     13        Get the JavaScript function and call it.
     14
     15        (WebKit::NPJSObject::NP_Invoke):
     16        Call NPJSObject::invoke.
     17
     18        * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
     19        (WebKit::NPN_Invoke):
     20        Call the NPClass::invoke function.
     21
    1222010-07-28  Anders Carlsson  <andersca@apple.com>
    223
  • trunk/WebKit2/WebProcess/Plugins/NPJSObject.cpp

    r64240 r64244  
    9898    JSValue value = m_jsObject->get(exec, identifierFromIdentifierRep(exec, identifierRep));   
    9999    exec->clearException();
    100     if (!value.isObject())
    101         return false;
    102100
    103101    CallData callData;
    104     return value.toObject(exec)->getCallData(callData) != CallTypeNone;
     102    return getCallData(value, callData) != CallTypeNone;
     103}
     104
     105bool NPJSObject::invoke(NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
     106{
     107    IdentifierRep* identifierRep = static_cast<IdentifierRep*>(methodName);
     108   
     109    if (!identifierRep->isString())
     110        return false;
     111   
     112    ExecState* exec = m_objectMap->globalExec();
     113    if (!exec)
     114        return false;
     115   
     116    JSLock lock(SilenceAssertionsOnly);
     117
     118    JSValue function = m_jsObject->get(exec, identifierFromIdentifierRep(exec, identifierRep));
     119    CallData callData;
     120    CallType callType = getCallData(function, callData);
     121    if (callType == CallTypeNone)
     122        return false;
     123
     124    // Convert the passed in arguments.
     125    MarkedArgumentBuffer argumentList;
     126    for (uint32_t i = 0; i < argumentCount; ++i)
     127        argumentList.append(m_objectMap->convertNPVariantToJSValue(exec, arguments[i]));
     128
     129    exec->globalData().timeoutChecker.start();
     130    JSValue value = JSC::call(exec, function, callType, callData, m_jsObject, argumentList);
     131    exec->globalData().timeoutChecker.stop();
     132
     133    // Convert and return the result of the function call.
     134    m_objectMap->convertJSValueToNPVariant(exec, value, *result);
     135    exec->clearException();
     136   
     137    return true;
    105138}
    106139
     
    184217}
    185218   
    186 bool NPJSObject::NP_Invoke(NPObject*, NPIdentifier methodName, const NPVariant *arguments, uint32_t argumentCount, NPVariant *result)
     219bool NPJSObject::NP_Invoke(NPObject* npObject, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
     220{
     221    return toNPJSObject(npObject)->invoke(methodName, arguments, argumentCount, result);
     222}
     223   
     224bool NPJSObject::NP_InvokeDefault(NPObject*, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
    187225{
    188226    notImplemented();
     
    190228}
    191229   
    192 bool NPJSObject::NP_InvokeDefault(NPObject*, const NPVariant *arguments, uint32_t argumentCount, NPVariant *result)
     230bool NPJSObject::NP_HasProperty(NPObject* npObject, NPIdentifier propertyName)
     231{
     232    return toNPJSObject(npObject)->hasProperty(propertyName);
     233}
     234
     235bool NPJSObject::NP_GetProperty(NPObject* npObject, NPIdentifier propertyName, NPVariant* result)
     236{
     237    return toNPJSObject(npObject)->getProperty(propertyName, result);
     238}
     239
     240bool NPJSObject::NP_SetProperty(NPObject*, NPIdentifier propertyName, const NPVariant* value)
    193241{
    194242    notImplemented();
    195243    return false;
    196244}
    197    
    198 bool NPJSObject::NP_HasProperty(NPObject* npObject, NPIdentifier propertyName)
    199 {
    200     return toNPJSObject(npObject)->hasProperty(propertyName);
    201 }
    202 
    203 bool NPJSObject::NP_GetProperty(NPObject* npObject, NPIdentifier propertyName, NPVariant* result)
    204 {
    205     return toNPJSObject(npObject)->getProperty(propertyName, result);
    206 }
    207 
    208 bool NPJSObject::NP_SetProperty(NPObject*, NPIdentifier propertyName, const NPVariant* value)
    209 {
    210     notImplemented();
    211     return false;
    212 }
    213245
    214246} // namespace WebKit
  • trunk/WebKit2/WebProcess/Plugins/NPJSObject.h

    r64240 r64244  
    6161
    6262    bool hasMethod(NPIdentifier methodName);
     63    bool invoke(NPIdentifier methodName, const NPVariant *arguments, uint32_t argumentCount, NPVariant *result);
    6364    bool hasProperty(NPIdentifier propertyName);
    6465    bool getProperty(NPIdentifier propertyName, NPVariant* result);
  • trunk/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp

    r64240 r64244  
    531531}
    532532
    533 static bool NPN_Invoke(NPP npp, NPObject *npobj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result)
    534 {
    535     notImplemented();
     533static bool NPN_Invoke(NPP, NPObject *npObject, NPIdentifier methodName, const NPVariant *arguments, uint32_t argumentCount, NPVariant *result)
     534{
     535    if (npObject->_class->invoke)
     536        return npObject->_class->invoke(npObject, methodName, arguments, argumentCount, result);
     537
    536538    return false;
    537539}
     
    549551}
    550552
    551 static bool NPN_GetProperty(NPP npp, NPObject *npObject, NPIdentifier propertyName, NPVariant *result)
     553static bool NPN_GetProperty(NPP npp, NPObject* npObject, NPIdentifier propertyName, NPVariant* result)
    552554{
    553555    if (npObject->_class->hasProperty && npObject->_class->getProperty) {
     
    560562}
    561563
    562 static bool NPN_SetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName, const NPVariant *value)
    563 {
    564     notImplemented();
    565     return false;
    566 }
    567 
    568 static bool NPN_RemoveProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName)
    569 {
    570     notImplemented();
    571     return false;
    572 }
    573 
    574 static bool NPN_HasProperty(NPP, NPObject *npObject, NPIdentifier propertyName)
     564static bool NPN_SetProperty(NPP npp, NPObject* npobj, NPIdentifier propertyName, const NPVariant* value)
     565{
     566    notImplemented();
     567    return false;
     568}
     569
     570static bool NPN_RemoveProperty(NPP npp, NPObject* npobj, NPIdentifier propertyName)
     571{
     572    notImplemented();
     573    return false;
     574}
     575
     576static bool NPN_HasProperty(NPP, NPObject* npObject, NPIdentifier propertyName)
    575577{
    576578    if (npObject->_class->hasProperty)
     
    580582}
    581583
    582 static bool NPN_HasMethod(NPP, NPObject *npObject, NPIdentifier methodName)
     584static bool NPN_HasMethod(NPP, NPObject* npObject, NPIdentifier methodName)
    583585{
    584586    if (npObject->_class->hasMethod)
     
    588590}
    589591
    590 static void NPN_ReleaseVariantValue(NPVariant *variant)
     592static void NPN_ReleaseVariantValue(NPVariant* variant)
    591593{
    592594    releaseNPVariantValue(variant);
    593595}
    594596
    595 static void NPN_SetException(NPObject *npobj, const NPUTF8 *message)
     597static void NPN_SetException(NPObject* npobj, const NPUTF8* message)
    596598{
    597599    notImplemented();
     
    608610}
    609611   
    610 static bool NPN_Enumerate(NPP npp, NPObject *npobj, NPIdentifier **identifier, uint32_t *count)
    611 {
    612     notImplemented();
    613     return false;
    614 }
    615 
    616 static void NPN_PluginThreadAsyncCall(NPP instance, void (*func) (void *), void *userData)
    617 {
    618     notImplemented();
    619 }
    620 
    621 static bool NPN_Construct(NPP npp, NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result)
    622 {
    623     notImplemented();
    624     return false;
    625 }
    626 
    627 static NPError NPN_GetValueForURL(NPP instance, NPNURLVariable variable, const char *url, char **value, uint32_t *len)
     612static bool NPN_Enumerate(NPP npp, NPObject* npobj, NPIdentifier** identifier, uint32_t* count)
     613{
     614    notImplemented();
     615    return false;
     616}
     617
     618static void NPN_PluginThreadAsyncCall(NPP instance, void (*func) (void*), void* userData)
     619{
     620    notImplemented();
     621}
     622
     623static bool NPN_Construct(NPP npp, NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
     624{
     625    notImplemented();
     626    return false;
     627}
     628
     629static NPError NPN_GetValueForURL(NPP instance, NPNURLVariable variable, const char* url, char** value, uint32_t* len)
    628630{
    629631    notImplemented();
     
    631633}
    632634
    633 static NPError NPN_SetValueForURL(NPP instance, NPNURLVariable variable, const char *url, const char *value, uint32_t len)
     635static NPError NPN_SetValueForURL(NPP instance, NPNURLVariable variable, const char* url, const char* value, uint32_t len)
    634636{
    635637    notImplemented();
     
    637639}
    638640
    639 static NPError NPN_GetAuthenticationInfo(NPP instance, const char *protocol, const char *host, int32_t port, const char *scheme,
    640                                          const char *realm, char **username, uint32_t *ulen, char **password, uint32_t *plen)
     641static NPError NPN_GetAuthenticationInfo(NPP instance, const char* protocol, const char* host, int32_t port, const char* scheme,
     642                                         const char* realm, char** username, uint32_t* ulen, char** password, uint32_t* plen)
    641643{
    642644    notImplemented();
     
    661663}
    662664
    663 static NPBool NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace)
     665static NPBool NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double* destX, double* destY, NPCoordinateSpace destSpace)
    664666{
    665667    notImplemented();
Note: See TracChangeset for help on using the changeset viewer.