Commit 46e6d372 authored by andersca@apple.com's avatar andersca@apple.com
Browse files

Implement NP_RemoveProperty and NP_Enumerate

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

Reviewed by Oliver Hunt.

WebKit2:

* Shared/Plugins/NPObjectMessageReceiver.cpp:
(WebKit::NPObjectMessageReceiver::removeProperty):
Call the removeProperty NPClass function.

(WebKit::NPObjectMessageReceiver::enumerate):
Call the enumerate NPClass function.

* Shared/Plugins/NPObjectMessageReceiver.messages.in:
Add RemoveProperty and Enumerate messages.

* Shared/Plugins/NPObjectProxy.cpp:
(WebKit::NPObjectProxy::removeProperty):
Send the RemoveProperty message.

(WebKit::NPObjectProxy::enumerate):
Send the Enumerate message.

(WebKit::NPObjectProxy::NP_RemoveProperty):
Call removeProperty.

(WebKit::NPObjectProxy::NP_Enumerate):
Call enumerate.

LayoutTests:

Remove now passing tests.

* platform/mac-wk2/Skipped:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71430 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent aa951c07
2010-11-04 Anders Carlsson <andersca@apple.com>
Reviewed by Oliver Hunt.
Implement NP_RemoveProperty and NP_Enumerate
https://bugs.webkit.org/show_bug.cgi?id=49046
Remove now passing tests.
* platform/mac-wk2/Skipped:
2010-11-05 Zhenyao Mo <zmo@google.com>
 
Unreviewed, update webgl test expectations.
......@@ -1735,15 +1735,11 @@ plugins/return-negative-one-from-write.html
plugins/set-status.html
plugins/update-widgets-crash.html
plugins/window-open.html
plugins/npruntime/enumerate.html
plugins/npruntime/evaluate.html
plugins/npruntime/get-int-identifier-special-values.html
plugins/npruntime/get-property-return-value.html
plugins/npruntime/identifier-conversion.html
plugins/npruntime/invoke-browserfuncs.html
plugins/npruntime/invoke-default.html
plugins/npruntime/npruntime.html
plugins/npruntime/object-from-destroyed-plugin.html
plugins/npruntime/plugin-scriptable-object-invoke-default.html
plugins/npruntime/round-trip-npobject.html
......
2010-11-04 Anders Carlsson <andersca@apple.com>
Reviewed by Oliver Hunt.
Implement NP_RemoveProperty and NP_Enumerate
https://bugs.webkit.org/show_bug.cgi?id=49046
* Shared/Plugins/NPObjectMessageReceiver.cpp:
(WebKit::NPObjectMessageReceiver::removeProperty):
Call the removeProperty NPClass function.
(WebKit::NPObjectMessageReceiver::enumerate):
Call the enumerate NPClass function.
* Shared/Plugins/NPObjectMessageReceiver.messages.in:
Add RemoveProperty and Enumerate messages.
* Shared/Plugins/NPObjectProxy.cpp:
(WebKit::NPObjectProxy::removeProperty):
Send the RemoveProperty message.
(WebKit::NPObjectProxy::enumerate):
Send the Enumerate message.
(WebKit::NPObjectProxy::NP_RemoveProperty):
Call removeProperty.
(WebKit::NPObjectProxy::NP_Enumerate):
Call enumerate.
2010-11-05 Sam Weinig <sam@webkit.org>
 
Fix failing python tests.
......
......@@ -142,6 +142,36 @@ void NPObjectMessageReceiver::setProperty(const NPIdentifierData& propertyNameDa
releaseNPVariantValue(&propertyValue);
}
void NPObjectMessageReceiver::removeProperty(const NPIdentifierData& propertyNameData, bool& returnValue)
{
if (!m_npObject->_class->removeProperty) {
returnValue = false;
return;
}
returnValue = m_npObject->_class->removeProperty(m_npObject, propertyNameData.createNPIdentifier());
}
void NPObjectMessageReceiver::enumerate(bool& returnValue, Vector<NPIdentifierData>& identifiersData)
{
if (!NP_CLASS_STRUCT_VERSION_HAS_ENUM(m_npObject->_class) || !m_npObject->_class->enumerate) {
returnValue = false;
return;
}
NPIdentifier* identifiers = 0;
uint32_t identifierCount = 0;
returnValue = m_npObject->_class->enumerate(m_npObject, &identifiers, &identifierCount);
if (!returnValue)
return;
for (uint32_t i = 0; i < identifierCount; ++i)
identifiersData.append(NPIdentifierData::fromNPIdentifier(identifiers[i]));
npnMemFree(identifiers);
}
} // namespace WebKit
#endif // ENABLE(PLUGIN_PROCESS)
......
......@@ -58,6 +58,8 @@ private:
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);
NPRemoteObjectMap* m_npRemoteObjectMap;
uint64_t m_npObjectID;
......
......@@ -29,6 +29,8 @@ messages -> NPObjectMessageReceiver {
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)
}
#endif
......@@ -174,6 +174,45 @@ bool NPObjectProxy::setProperty(NPIdentifier propertyName, const NPVariant* valu
return returnValue;
}
bool NPObjectProxy::removeProperty(NPIdentifier propertyName)
{
if (!m_npRemoteObjectMap)
return false;
NPIdentifierData propertyNameData = NPIdentifierData::fromNPIdentifier(propertyName);
bool returnValue = false;
if (!m_npRemoteObjectMap->connection()->sendSync(Messages::NPObjectMessageReceiver::RemoveProperty(propertyNameData), Messages::NPObjectMessageReceiver::RemoveProperty::Reply(returnValue), m_npObjectID))
return false;
return returnValue;
}
bool NPObjectProxy::enumerate(NPIdentifier** identifiers, uint32_t* identifierCount)
{
if (!m_npRemoteObjectMap)
return false;
bool returnValue;
Vector<NPIdentifierData> identifiersData;
if (!m_npRemoteObjectMap->connection()->sendSync(Messages::NPObjectMessageReceiver::Enumerate(), Messages::NPObjectMessageReceiver::Enumerate::Reply(returnValue, identifiersData), m_npObjectID))
return false;
if (!returnValue)
return false;
NPIdentifier* nameIdentifiers = npnMemNewArray<NPIdentifier>(identifiersData.size());
for (size_t i = 0; i < identifiersData.size(); ++i)
nameIdentifiers[i] = identifiersData[i].createNPIdentifier();
*identifiers = nameIdentifiers;
*identifierCount = identifiersData.size();
return true;
}
NPClass* NPObjectProxy::npClass()
{
static NPClass npClass = {
......@@ -239,16 +278,14 @@ bool NPObjectProxy::NP_SetProperty(NPObject* npObject, NPIdentifier propertyName
return toNPObjectProxy(npObject)->setProperty(propertyName, value);
}
bool NPObjectProxy::NP_RemoveProperty(NPObject*, NPIdentifier propertyName)
bool NPObjectProxy::NP_RemoveProperty(NPObject* npObject, NPIdentifier propertyName)
{
notImplemented();
return false;
return toNPObjectProxy(npObject)->removeProperty(propertyName);
}
bool NPObjectProxy::NP_Enumerate(NPObject*, NPIdentifier** identifiers, uint32_t* identifierCount)
bool NPObjectProxy::NP_Enumerate(NPObject* npObject, NPIdentifier** identifiers, uint32_t* identifierCount)
{
notImplemented();
return false;
return toNPObjectProxy(npObject)->enumerate(identifiers, identifierCount);
}
bool NPObjectProxy::NP_Construct(NPObject*, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
......
......@@ -62,6 +62,8 @@ private:
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);
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