Changeset 64174 in webkit


Ignore:
Timestamp:
Jul 27, 2010 4:15:41 PM (14 years ago)
Author:
andersca@apple.com
Message:

Implement JSNPObject::propertyGetter
https://bugs.webkit.org/show_bug.cgi?id=43091

Reviewed by Sam Weinig.

WebKit2:

  • WebProcess/Plugins/JSNPObject.cpp:

(WebKit::JSNPObject::propertyGetter):
Ask the NPObject for its property.

  • WebProcess/Plugins/NPRuntimeObjectMap.cpp:

(WebKit::NPRuntimeObjectMap::jsNPObjectDestroyed):
Add a stub.

(WebKit::NPRuntimeObjectMap::convertNPVariantToValue):
Implement this for everything except objects.

LayoutTests:

  • platform/mac-wk2/Skipped:

Add a test I forgot to add, and remove plugins/npruntime/embed-property.html because it passes now.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r64171 r64174  
     12010-07-27  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Implement JSNPObject::propertyGetter
     6        https://bugs.webkit.org/show_bug.cgi?id=43091
     7
     8        * platform/mac-wk2/Skipped:
     9        Add a test I forgot to add, and remove plugins/npruntime/embed-property.html because it passes now.
     10
    1112010-07-27  Martin Robinson  <mrobinson@igalia.com>
    212
  • trunk/LayoutTests/platform/mac-wk2/Skipped

    r64169 r64174  
    13891389java
    13901390platform/mac/plugins
     1391plugins/attach-during-destroy.html
    13911392plugins/clicking-missing-plugin-fires-delegate.html
    13921393plugins/destroy-during-npp-new.html
     
    14121413plugins/netscape-plugin-setwindow-size.html
    14131414plugins/npruntime/bindings-test.html
    1414 plugins/npruntime/embed-property.html
    14151415plugins/npruntime/enumerate.html
    14161416plugins/npruntime/get-int-identifier-special-values.html
  • trunk/WebKit2/ChangeLog

    r64172 r64174  
     12010-07-27  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Implement JSNPObject::propertyGetter
     6        https://bugs.webkit.org/show_bug.cgi?id=43091
     7
     8        * WebProcess/Plugins/JSNPObject.cpp:
     9        (WebKit::JSNPObject::propertyGetter):
     10        Ask the NPObject for its property.
     11
     12        * WebProcess/Plugins/NPRuntimeObjectMap.cpp:
     13        (WebKit::NPRuntimeObjectMap::jsNPObjectDestroyed):
     14        Add a stub.
     15
     16        (WebKit::NPRuntimeObjectMap::convertNPVariantToValue):
     17        Implement this for everything except objects.
     18
    1192010-07-27  Sam Weinig  <sam@webkit.org>
    220
  • trunk/WebKit2/WebProcess/Plugins/JSNPObject.cpp

    r64167 r64174  
    2626#include "JSNPObject.h"
    2727
     28#include "NPRuntimeObjectMap.h"
    2829#include "NPRuntimeUtilities.h"
    2930#include <JavaScriptCore/Error.h>
    3031#include <JavaScriptCore/JSGlobalObject.h>
     32#include <JavaScriptCore/JSLock.h>
    3133#include <JavaScriptCore/ObjectPrototype.h>
    3234#include <WebCore/IdentifierRep.h>
     
    7274}
    7375
    74 JSValue JSNPObject::propertyGetter(ExecState*, JSValue, const Identifier&)
     76JSValue JSNPObject::propertyGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
    7577{
     78    JSNPObject* thisObj = static_cast<JSNPObject*>(asObject(slotBase));
     79
     80    if (!thisObj->m_npObject)
     81        return throwInvalidAccessError(exec);
     82
     83    if (!thisObj->m_npObject->_class->getProperty)
     84        return jsUndefined();
     85
     86    NPVariant property;
     87    VOID_TO_NPVARIANT(property);
     88
     89    bool result;
     90    {
     91        JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly);
     92        NPIdentifier npIdentifier = npIdentifierFromIdentifier(propertyName);
     93        result = thisObj->m_npObject->_class->getProperty(thisObj->m_npObject, npIdentifier, &property);
     94       
     95        // FIXME: Handle getProperty setting an exception.
     96        // FIXME: Find out what happens if calling getProperty causes the plug-in to go away.
     97    }
     98
     99    if (!result)
     100        return jsUndefined();
     101
     102    return thisObj->m_objectMap->convertNPVariantToValue(exec, property);
    76103    // FIXME: Implement.
    77104    return jsUndefined();
  • trunk/WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.cpp

    r64167 r64174  
    2929#include "NPJSObject.h"
    3030#include "NPRuntimeUtilities.h"
     31#include "NotImplemented.h"
    3132#include "PluginView.h"
    3233#include <WebCore/Frame.h>
     
    7071}
    7172
     73void NPRuntimeObjectMap::jsNPObjectDestroyed(JSNPObject* jsNPObject)
     74{
     75    // FIXME: Implement.
     76}
     77
     78JSValue NPRuntimeObjectMap::convertNPVariantToValue(JSC::ExecState* exec, const NPVariant& variant)
     79{
     80    switch (variant.type) {
     81    case NPVariantType_Void:
     82        return jsUndefined();
     83
     84    case NPVariantType_Null:
     85        return jsNull();
     86
     87    case NPVariantType_Bool:
     88        return jsBoolean(variant.value.boolValue);
     89
     90    case NPVariantType_Int32:
     91        return jsNumber(exec, variant.value.intValue);
     92
     93    case NPVariantType_Double:
     94        return jsNumber(exec, variant.value.doubleValue);
     95
     96    case NPVariantType_String:
     97        return jsString(exec, String::fromUTF8WithLatin1Fallback(variant.value.stringValue.UTF8Characters,
     98                                                                 variant.value.stringValue.UTF8Length));
     99    case NPVariantType_Object:
     100    default:
     101        notImplemented();
     102        break;
     103    }
     104   
     105    return jsUndefined();
     106}
     107
    72108void NPRuntimeObjectMap::invalidate()
    73109{
  • trunk/WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.h

    r64167 r64174  
    3030
    3131struct NPObject;
     32typedef struct _NPVariant NPVariant;
    3233
    3334namespace JSC {
     
    3536    class JSGlobalObject;
    3637    class JSObject;
     38    class JSValue;
    3739}
    3840
    3941namespace WebKit {
    4042
     43class JSNPObject;
    4144class NPJSObject;
    4245class PluginView;
     
    5659    JSC::JSObject* getOrCreateJSObject(JSC::ExecState*, JSC::JSGlobalObject*, NPObject*);
    5760
     61    void jsNPObjectDestroyed(JSNPObject*);
     62
     63    JSC::JSValue convertNPVariantToValue(JSC::ExecState*, const NPVariant&);
    5864
    5965    // Called when the plug-in is destroyed. Will invalidate all the NPObjects.
Note: See TracChangeset for help on using the changeset viewer.