[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

andersca at apple.com andersca at apple.com
Wed Dec 22 11:32:44 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit e650933e3aeffdfb5639919576f998e348c7300d
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jul 28 23:03:25 2010 +0000

    Implement NPN_HasMethod
    https://bugs.webkit.org/show_bug.cgi?id=43155
    
    Reviewed by Sam Weinig.
    
    WebKit2:
    
    * WebProcess/Plugins/NPJSObject.cpp:
    (WebKit::NPJSObject::hasMethod):
    Check if the JSObject has a property with the given name. If it does, check that the value is a function.
    
    (WebKit::NPJSObject::hasProperty):
    Add a JSLock.
    
    (WebKit::NPJSObject::npClass):
    Add some stubbed out functions.
    
    (WebKit::NPJSObject::NP_HasMethod):
    Call NPJSObject::hasMethod.
    
    (WebKit::NPJSObject::NP_Invoke):
    (WebKit::NPJSObject::NP_InvokeDefault):
    (WebKit::NPJSObject::NP_SetProperty):
    Stub out functions.
    
    * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
    (WebKit::NPN_HasMethod):
    Call the NPClass::hasMethod function.
    
    LayoutTests:
    
    * platform/mac-wk2/Skipped:
    Remove plugins/npruntime/invoke-browserfuncs.html.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64240 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 91588cb..0ae42b9 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-07-28  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Implement NPN_HasMethod
+        https://bugs.webkit.org/show_bug.cgi?id=43155
+
+        * platform/mac-wk2/Skipped:
+        Remove plugins/npruntime/invoke-browserfuncs.html.
+        
 2010-07-28  Adam Barth  <abarth at webkit.org>
 
         Reviewed by Eric Seidel.
diff --git a/LayoutTests/platform/mac-wk2/Skipped b/LayoutTests/platform/mac-wk2/Skipped
index b472955..1ba5abc 100644
--- a/LayoutTests/platform/mac-wk2/Skipped
+++ b/LayoutTests/platform/mac-wk2/Skipped
@@ -1414,7 +1414,6 @@ plugins/netscape-plugin-setwindow-size.html
 plugins/npruntime/bindings-test.html
 plugins/npruntime/enumerate.html
 plugins/npruntime/get-property-return-value.html
-plugins/npruntime/invoke-browserfuncs.html
 plugins/npruntime/invoke-default.html
 plugins/npruntime/invoke.html
 plugins/npruntime/npruntime.html
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index d2dff1b..f3705fc 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,32 @@
+2010-07-28  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Implement NPN_HasMethod
+        https://bugs.webkit.org/show_bug.cgi?id=43155
+
+        * WebProcess/Plugins/NPJSObject.cpp:
+        (WebKit::NPJSObject::hasMethod):
+        Check if the JSObject has a property with the given name. If it does, check that the value is a function.
+    
+        (WebKit::NPJSObject::hasProperty):
+        Add a JSLock.
+
+        (WebKit::NPJSObject::npClass):
+        Add some stubbed out functions.
+
+        (WebKit::NPJSObject::NP_HasMethod):
+        Call NPJSObject::hasMethod.
+
+        (WebKit::NPJSObject::NP_Invoke):
+        (WebKit::NPJSObject::NP_InvokeDefault):
+        (WebKit::NPJSObject::NP_SetProperty):
+        Stub out functions.
+
+        * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
+        (WebKit::NPN_HasMethod):
+        Call the NPClass::hasMethod function.
+
 2010-07-28  Brady Eidson  <beidson at apple.com>
 
         Rubberstamped by Sam Weinig.
diff --git a/WebKit2/WebProcess/Plugins/NPJSObject.cpp b/WebKit2/WebProcess/Plugins/NPJSObject.cpp
index c40bf6e..13ffe64 100644
--- a/WebKit2/WebProcess/Plugins/NPJSObject.cpp
+++ b/WebKit2/WebProcess/Plugins/NPJSObject.cpp
@@ -82,6 +82,28 @@ static Identifier identifierFromIdentifierRep(ExecState* exec, IdentifierRep* id
     return Identifier(exec, String::fromUTF8WithLatin1Fallback(string, length).impl());
 }
 
+bool NPJSObject::hasMethod(NPIdentifier methodName)
+{
+    IdentifierRep* identifierRep = static_cast<IdentifierRep*>(methodName);
+
+    if (!identifierRep->isString())
+        return false;
+
+    ExecState* exec = m_objectMap->globalExec();
+    if (!exec)
+        return false;
+
+    JSLock lock(SilenceAssertionsOnly);
+
+    JSValue value = m_jsObject->get(exec, identifierFromIdentifierRep(exec, identifierRep));    
+    exec->clearException();
+    if (!value.isObject())
+        return false;
+
+    CallData callData;
+    return value.toObject(exec)->getCallData(callData) != CallTypeNone;
+}
+
 bool NPJSObject::hasProperty(NPIdentifier identifier)
 {
     IdentifierRep* identifierRep = static_cast<IdentifierRep*>(identifier);
@@ -90,6 +112,8 @@ bool NPJSObject::hasProperty(NPIdentifier identifier)
     if (!exec)
         return false;
     
+    JSLock lock(SilenceAssertionsOnly);
+
     bool result;
     if (identifierRep->isString())
         result = m_jsObject->hasProperty(exec, identifierFromIdentifierRep(exec, identifierRep));
@@ -126,13 +150,13 @@ NPClass* NPJSObject::npClass()
         NP_CLASS_STRUCT_VERSION,
         NP_Allocate,
         NP_Deallocate,
-        0, 
-        0,
-        0,
         0,
+        NP_HasMethod,
+        NP_Invoke,
+        NP_InvokeDefault,
         NP_HasProperty,
         NP_GetProperty,
-        0,
+        NP_SetProperty,
         0,
         0,
         0
@@ -154,14 +178,37 @@ void NPJSObject::NP_Deallocate(NPObject* npObject)
     delete npJSObject;
 }
 
+bool NPJSObject::NP_HasMethod(NPObject* npObject, NPIdentifier methodName)
+{
+    return toNPJSObject(npObject)->hasMethod(methodName);
+}
+    
+bool NPJSObject::NP_Invoke(NPObject*, NPIdentifier methodName, const NPVariant *arguments, uint32_t argumentCount, NPVariant *result)
+{
+    notImplemented();
+    return false;
+}
+    
+bool NPJSObject::NP_InvokeDefault(NPObject*, const NPVariant *arguments, uint32_t argumentCount, NPVariant *result)
+{
+    notImplemented();
+    return false;
+}
+    
 bool NPJSObject::NP_HasProperty(NPObject* npObject, NPIdentifier propertyName)
 {
     return toNPJSObject(npObject)->hasProperty(propertyName);
 }
-    
+
 bool NPJSObject::NP_GetProperty(NPObject* npObject, NPIdentifier propertyName, NPVariant* result)
 {
     return toNPJSObject(npObject)->getProperty(propertyName, result);
 }
 
+bool NPJSObject::NP_SetProperty(NPObject*, NPIdentifier propertyName, const NPVariant* value)
+{
+    notImplemented();
+    return false;
+}
+
 } // namespace WebKit
diff --git a/WebKit2/WebProcess/Plugins/NPJSObject.h b/WebKit2/WebProcess/Plugins/NPJSObject.h
index ccbd0bf..c2664e4 100644
--- a/WebKit2/WebProcess/Plugins/NPJSObject.h
+++ b/WebKit2/WebProcess/Plugins/NPJSObject.h
@@ -59,14 +59,19 @@ private:
 
     void initialize(NPRuntimeObjectMap*, JSC::JSObject* jsObject);
 
-    bool hasProperty(NPIdentifier);
-    bool getProperty(NPIdentifier, NPVariant* result);
+    bool hasMethod(NPIdentifier methodName);
+    bool hasProperty(NPIdentifier propertyName);
+    bool getProperty(NPIdentifier propertyName, NPVariant* result);
 
     static NPClass* npClass();
     static NPObject* NP_Allocate(NPP, NPClass*);
     static void NP_Deallocate(NPObject*);
-    static bool NP_HasProperty(NPObject* npobj, NPIdentifier name);
-    static bool NP_GetProperty(NPObject* npobj, NPIdentifier name, NPVariant* result);
+    static bool NP_HasMethod(NPObject*, NPIdentifier methodName);
+    static bool NP_Invoke(NPObject*, NPIdentifier methodName, const NPVariant *arguments, uint32_t argumentCount, NPVariant *result);
+    static bool NP_InvokeDefault(NPObject*, const NPVariant *arguments, uint32_t argumentCount, NPVariant *result);
+    static bool NP_HasProperty(NPObject*, NPIdentifier propertyName);
+    static bool NP_GetProperty(NPObject*, NPIdentifier propertyName, NPVariant* result);
+    static bool NP_SetProperty(NPObject*, NPIdentifier propertyName, const NPVariant* value);
     
     NPRuntimeObjectMap* m_objectMap;
     JSC::ProtectedPtr<JSC::JSObject> m_jsObject;
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp b/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
index df1bee7..c342108 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
@@ -571,7 +571,7 @@ static bool NPN_RemoveProperty(NPP npp, NPObject *npobj, NPIdentifier propertyNa
     return false;
 }
 
-static bool NPN_HasProperty(NPP npp, NPObject *npObject, NPIdentifier propertyName)
+static bool NPN_HasProperty(NPP, NPObject *npObject, NPIdentifier propertyName)
 {
     if (npObject->_class->hasProperty)
         return npObject->_class->hasProperty(npObject, propertyName);
@@ -579,9 +579,11 @@ static bool NPN_HasProperty(NPP npp, NPObject *npObject, NPIdentifier propertyNa
     return false;
 }
 
-static bool NPN_HasMethod(NPP npp, NPObject *npobj, NPIdentifier methodName)
+static bool NPN_HasMethod(NPP, NPObject *npObject, NPIdentifier methodName)
 {
-    notImplemented();
+    if (npObject->_class->hasMethod)
+        return npObject->_class->hasMethod(npObject, methodName);
+
     return false;
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list