Commit 07b53168 authored by andersca@apple.com's avatar andersca@apple.com
Browse files

NPClass::construct and NPClass::invokeDefault never called with out-of-process plug-ins in WebKit2

https://bugs.webkit.org/show_bug.cgi?id=49198

Reviewed by Adam Roben.

WebKit2:

* Shared/Plugins/NPObjectMessageReceiver.cpp:
(WebKit::NPObjectMessageReceiver::invokeDefault):
Call NPClass::invokeDefault.

(WebKit::NPObjectMessageReceiver::construct):
Call NPClass::construct

* Shared/Plugins/NPObjectMessageReceiver.messages.in:
Add InvokeDefault and Construct messages.

* Shared/Plugins/NPObjectProxy.cpp:
(WebKit::NPObjectProxy::invokeDefault):
Send the InvokeDefault message.

(WebKit::NPObjectProxy::construct):
Send the Construct message.

(WebKit::NPObjectProxy::NP_InvokeDefault):
Call NPObjectProxy::invokeDefault.

(WebKit::NPObjectProxy::NP_Construct):
Call NPObjectProxy::construct.

LayoutTests:

Remove now passing tests.

* platform/mac-snowleopard/Skipped:
* platform/mac-wk2/Skipped:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71559 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b9244626
2010-11-08 Anders Carlsson <andersca@apple.com>
Reviewed by Adam Roben.
NPClass::construct and NPClass::invokeDefault never called with out-of-process plug-ins in WebKit2
https://bugs.webkit.org/show_bug.cgi?id=49198
Remove now passing tests.
* platform/mac-snowleopard/Skipped:
* platform/mac-wk2/Skipped:
2010-11-08 Tony Chang <tony@chromium.org>
 
Unreviewed, updating plugin expectations.
......@@ -19,7 +19,6 @@ plugins/destroy-plugin-from-callback.html
# https://bugs.webkit.org/show_bug.cgi?id=36462
plugins/keyboard-events.html
plugins/mouse-events-fixedpos.html
plugins/npruntime/construct.html
# https://bugs.webkit.org/show_bug.cgi?id=30528 - test started failing
# immediately on Snow Leopard due to the expected exception not being
......
......@@ -1726,7 +1726,6 @@ plugins/set-status.html
plugins/update-widgets-crash.html
plugins/window-open.html
plugins/npruntime/identifier-conversion.html
plugins/npruntime/invoke-default.html
plugins/npruntime/plugin-scriptable-object-invoke-default.html
########################################
......
2010-11-08 Anders Carlsson <andersca@apple.com>
Reviewed by Adam Roben.
NPClass::construct and NPClass::invokeDefault never called with out-of-process plug-ins in WebKit2
https://bugs.webkit.org/show_bug.cgi?id=49198
* Shared/Plugins/NPObjectMessageReceiver.cpp:
(WebKit::NPObjectMessageReceiver::invokeDefault):
Call NPClass::invokeDefault.
(WebKit::NPObjectMessageReceiver::construct):
Call NPClass::construct
* Shared/Plugins/NPObjectMessageReceiver.messages.in:
Add InvokeDefault and Construct messages.
* Shared/Plugins/NPObjectProxy.cpp:
(WebKit::NPObjectProxy::invokeDefault):
Send the InvokeDefault message.
(WebKit::NPObjectProxy::construct):
Send the Construct message.
(WebKit::NPObjectProxy::NP_InvokeDefault):
Call NPObjectProxy::invokeDefault.
(WebKit::NPObjectProxy::NP_Construct):
Call NPObjectProxy::construct.
2010-11-08 Anders Carlsson <andersca@apple.com>
 
Reviewed by Dan Bernstein.
......
......@@ -31,7 +31,6 @@
#include "NPRemoteObjectMap.h"
#include "NPRuntimeUtilities.h"
#include "NPVariantData.h"
#include "NotImplemented.h"
namespace WebKit {
......@@ -82,12 +81,41 @@ void NPObjectMessageReceiver::invoke(const NPIdentifierData& methodNameData, con
arguments.append(m_npRemoteObjectMap->npVariantDataToNPVariant(argumentsData[i]));
NPVariant result;
VOID_TO_NPVARIANT(result);
returnValue = m_npObject->_class->invoke(m_npObject, methodNameData.createNPIdentifier(), arguments.data(), arguments.size(), &result);
if (!returnValue)
return;
if (returnValue) {
// Convert the NPVariant to an NPVariantData.
resultData = m_npRemoteObjectMap->npVariantToNPVariantData(result);
}
// Release all arguments.
for (size_t i = 0; i < argumentsData.size(); ++i)
releaseNPVariantValue(&arguments[i]);
// Convert the NPVariant to an NPVariantData.
resultData = m_npRemoteObjectMap->npVariantToNPVariantData(result);
// And release the result.
releaseNPVariantValue(&result);
}
void NPObjectMessageReceiver::invokeDefault(const Vector<NPVariantData>& argumentsData, bool& returnValue, NPVariantData& resultData)
{
if (!m_npObject->_class->invokeDefault) {
returnValue = false;
return;
}
Vector<NPVariant> arguments;
for (size_t i = 0; i < argumentsData.size(); ++i)
arguments.append(m_npRemoteObjectMap->npVariantDataToNPVariant(argumentsData[i]));
NPVariant result;
VOID_TO_NPVARIANT(result);
returnValue = m_npObject->_class->invokeDefault(m_npObject, arguments.data(), arguments.size(), &result);
if (returnValue) {
// Convert the NPVariant to an NPVariantData.
resultData = m_npRemoteObjectMap->npVariantToNPVariantData(result);
}
// Release all arguments.
for (size_t i = 0; i < argumentsData.size(); ++i)
......@@ -172,6 +200,34 @@ void NPObjectMessageReceiver::enumerate(bool& returnValue, Vector<NPIdentifierDa
npnMemFree(identifiers);
}
void NPObjectMessageReceiver::construct(const Vector<NPVariantData>& argumentsData, bool& returnValue, NPVariantData& resultData)
{
if (!NP_CLASS_STRUCT_VERSION_HAS_CTOR(m_npObject->_class) || !m_npObject->_class->construct) {
returnValue = false;
return;
}
Vector<NPVariant> arguments;
for (size_t i = 0; i < argumentsData.size(); ++i)
arguments.append(m_npRemoteObjectMap->npVariantDataToNPVariant(argumentsData[i]));
NPVariant result;
VOID_TO_NPVARIANT(result);
returnValue = m_npObject->_class->construct(m_npObject, arguments.data(), arguments.size(), &result);
if (returnValue) {
// Convert the NPVariant to an NPVariantData.
resultData = m_npRemoteObjectMap->npVariantToNPVariantData(result);
}
// Release all arguments.
for (size_t i = 0; i < argumentsData.size(); ++i)
releaseNPVariantValue(&arguments[i]);
// And release the result.
releaseNPVariantValue(&result);
}
} // namespace WebKit
#endif // ENABLE(PLUGIN_PROCESS)
......
......@@ -57,11 +57,13 @@ private:
void deallocate();
void hasMethod(const NPIdentifierData&, bool& returnValue);
void invoke(const NPIdentifierData&, const Vector<NPVariantData>& argumentsData, bool& returnValue, NPVariantData& resultData);
void invokeDefault(const Vector<NPVariantData>& argumentsData, bool& returnValue, NPVariantData& resultData);
void hasProperty(const NPIdentifierData&, bool& returnValue);
void getProperty(const NPIdentifierData&, bool& returnValue, NPVariantData& resultData);
void setProperty(const NPIdentifierData&, const NPVariantData& propertyValueData, bool& returnValue);
void removeProperty(const NPIdentifierData&, bool& returnValue);
void enumerate(bool& returnValue, Vector<NPIdentifierData>& identifiersData);
void construct(const Vector<NPVariantData>& argumentsData, bool& returnValue, NPVariantData& resultData);
NPRemoteObjectMap* m_npRemoteObjectMap;
uint64_t m_npObjectID;
......
......@@ -26,11 +26,13 @@ messages -> NPObjectMessageReceiver {
Deallocate() -> ()
HasMethod(WebKit::NPIdentifierData methodName) -> (bool returnValue)
Invoke(WebKit::NPIdentifierData methodName, Vector<WebKit::NPVariantData> argumentsData) -> (bool returnValue, WebKit::NPVariantData resultData)
InvokeDefault(Vector<WebKit::NPVariantData> argumentsData) -> (bool returnValue, WebKit::NPVariantData resultData)
HasProperty(WebKit::NPIdentifierData propertyName) -> (bool returnValue)
GetProperty(WebKit::NPIdentifierData propertyName) -> (bool returnValue, WebKit::NPVariantData resultData)
SetProperty(WebKit::NPIdentifierData propertyName, WebKit::NPVariantData propertyValueData) -> (bool returnValue)
RemoveProperty(WebKit::NPIdentifierData propertyName) -> (bool returnValue)
Enumerate() -> (bool returnValue, Vector<WebKit::NPIdentifierData> identifiersData)
Construct(Vector<WebKit::NPVariantData> argumentsData) -> (bool returnValue, WebKit::NPVariantData resultData)
}
#endif
......@@ -34,7 +34,6 @@
#include "NPRemoteObjectMap.h"
#include "NPRuntimeUtilities.h"
#include "NPVariantData.h"
#include "NotImplemented.h"
namespace WebKit {
......@@ -123,6 +122,28 @@ bool NPObjectProxy::invoke(NPIdentifier methodName, const NPVariant* arguments,
return true;
}
bool NPObjectProxy::invokeDefault(const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
{
if (!m_npRemoteObjectMap)
return false;
Vector<NPVariantData> argumentsData;
for (uint32_t i = 0; i < argumentCount; ++i)
argumentsData.append(m_npRemoteObjectMap->npVariantToNPVariantData(arguments[i]));
bool returnValue = false;
NPVariantData resultData;
if (!m_npRemoteObjectMap->connection()->sendSync(Messages::NPObjectMessageReceiver::InvokeDefault(argumentsData), Messages::NPObjectMessageReceiver::InvokeDefault::Reply(returnValue, resultData), m_npObjectID))
return false;
if (!returnValue)
return false;
*result = m_npRemoteObjectMap->npVariantDataToNPVariant(resultData);
return true;
}
bool NPObjectProxy::hasProperty(NPIdentifier propertyName)
{
if (!m_npRemoteObjectMap)
......@@ -213,6 +234,28 @@ bool NPObjectProxy::enumerate(NPIdentifier** identifiers, uint32_t* identifierCo
return true;
}
bool NPObjectProxy::construct(const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
{
if (!m_npRemoteObjectMap)
return false;
Vector<NPVariantData> argumentsData;
for (uint32_t i = 0; i < argumentCount; ++i)
argumentsData.append(m_npRemoteObjectMap->npVariantToNPVariantData(arguments[i]));
bool returnValue = false;
NPVariantData resultData;
if (!m_npRemoteObjectMap->connection()->sendSync(Messages::NPObjectMessageReceiver::Construct(argumentsData), Messages::NPObjectMessageReceiver::Construct::Reply(returnValue, resultData), m_npObjectID))
return false;
if (!returnValue)
return false;
*result = m_npRemoteObjectMap->npVariantDataToNPVariant(resultData);
return true;
}
NPClass* NPObjectProxy::npClass()
{
static NPClass npClass = {
......@@ -257,10 +300,9 @@ bool NPObjectProxy::NP_Invoke(NPObject* npObject, NPIdentifier methodName, const
return toNPObjectProxy(npObject)->invoke(methodName, arguments, argumentCount, result);
}
bool NPObjectProxy::NP_InvokeDefault(NPObject*, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
bool NPObjectProxy::NP_InvokeDefault(NPObject* npObject, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
{
notImplemented();
return false;
return toNPObjectProxy(npObject)->invokeDefault(arguments, argumentCount, result);
}
bool NPObjectProxy::NP_HasProperty(NPObject* npObject, NPIdentifier propertyName)
......@@ -288,10 +330,9 @@ bool NPObjectProxy::NP_Enumerate(NPObject* npObject, NPIdentifier** identifiers,
return toNPObjectProxy(npObject)->enumerate(identifiers, identifierCount);
}
bool NPObjectProxy::NP_Construct(NPObject*, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
bool NPObjectProxy::NP_Construct(NPObject* npObject, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
{
notImplemented();
return false;
return toNPObjectProxy(npObject)->construct(arguments, argumentCount, result);
}
} // namespace WebKit
......
......@@ -61,11 +61,13 @@ private:
bool hasMethod(NPIdentifier methodName);
bool invoke(NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result);
bool invokeDefault(const NPVariant* arguments, uint32_t argumentCount, NPVariant* result);
bool hasProperty(NPIdentifier propertyName);
bool getProperty(NPIdentifier propertyName, NPVariant* result);
bool setProperty(NPIdentifier propertyName, const NPVariant* value);
bool removeProperty(NPIdentifier propertyName);
bool enumerate(NPIdentifier** identifiers, uint32_t* identifierCount);
bool construct(const NPVariant* arguments, uint32_t argumentCount, NPVariant* result);
static NPClass* npClass();
static NPObject* NP_Allocate(NPP, NPClass*);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment