[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:38:08 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 01dbfa097fd638d58d7a3f277e5389d5f9281300
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sun Aug 1 21:02:46 2010 +0000
Implement NPN_RemoveProperty
https://bugs.webkit.org/show_bug.cgi?id=43315
Reviewed by Sam Weinig.
WebKit2:
* WebProcess/Plugins/NPJSObject.cpp:
(WebKit::NPJSObject::removeProperty):
Try to remove the property.
(WebKit::NPJSObject::npClass):
Add NP_RemoveProperty.
(WebKit::NPJSObject::NP_RemoveProperty):
Call NPJSObject::removeProperty.
* WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
(WebKit::NPN_RemoveProperty):
Call the NPClass::removeProperty function.
WebKitTools:
* DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
Add NPRuntimeRemoveProperty.cpp
* DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp:
(PluginTest::NPN_GetStringIdentifier):
(PluginTest::NPN_GetIntIdentifier):
(PluginTest::NPN_RemoveProperty):
Add NPN_ helpers.
* DumpRenderTree/TestNetscapePlugIn/PluginTest.h:
Support more NPClass functions.
* DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp: Added.
(NPRuntimeRemoveProperty::NPRuntimeRemoveProperty):
Test for NPN_RemoveProperty.
(NPRuntimeRemoveProperty::TestObject::hasMethod):
(NPRuntimeRemoveProperty::TestObject::invoke):
Add a testRemoveProperty method.
(NPRuntimeRemoveProperty::NPP_GetValue):
Return the test object.
* DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:
* DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro:
* GNUmakefile.am:
Add NPRuntimeRemoveProperty.cpp
LayoutTests:
Add a test for NPN_RemoveProperty.
* plugins/npruntime/remove-property-expected.txt: Added.
* plugins/npruntime/remove-property.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64444 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 03f7be3..f791225 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-08-01 Anders Carlsson <andersca at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Implement NPN_RemoveProperty
+ https://bugs.webkit.org/show_bug.cgi?id=43315
+
+ Add a test for NPN_RemoveProperty.
+
+ * plugins/npruntime/remove-property-expected.txt: Added.
+ * plugins/npruntime/remove-property.html: Added.
+
2010-08-01 Kent Tamura <tkent at chromium.org>
Unreviewed, test expectation update.
diff --git a/LayoutTests/plugins/npruntime/remove-property-expected.txt b/LayoutTests/plugins/npruntime/remove-property-expected.txt
new file mode 100644
index 0000000..9f705c5
--- /dev/null
+++ b/LayoutTests/plugins/npruntime/remove-property-expected.txt
@@ -0,0 +1,11 @@
+
+Test NPN_RemoveProperty
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS 'property' in obj is true
+PASS 'property' in obj is false
+PASS array[1] is 2
+PASS array[1] is undefined
+
diff --git a/LayoutTests/plugins/npruntime/remove-property.html b/LayoutTests/plugins/npruntime/remove-property.html
new file mode 100644
index 0000000..6e10e34
--- /dev/null
+++ b/LayoutTests/plugins/npruntime/remove-property.html
@@ -0,0 +1,28 @@
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<script>
+function runTest() {
+ plugin = document.getElementById('plugin');
+
+ obj = { property : 'value' }
+ shouldBe("'property' in obj", "true");
+ plugin.testRemoveProperty(obj, 'property');
+ shouldBe("'property' in obj", "false");
+
+ array = [ 1, 2, 3, 4, 5];
+ shouldBe("array[1]", "2")
+ plugin.testRemoveProperty(array, 1);
+ shouldBe("array[1]", "undefined")
+}
+</script>
+<body onLoad="runTest()">
+<embed id="plugin" type="application/x-webkit-test-netscape" test="npruntime-remove-property"></embed>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test NPN_RemoveProperty");
+
+successfullyParsed = true;
+</script>
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 934d9af..0cb4919 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,24 @@
+2010-08-01 Anders Carlsson <andersca at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Implement NPN_RemoveProperty
+ https://bugs.webkit.org/show_bug.cgi?id=43315
+
+ * WebProcess/Plugins/NPJSObject.cpp:
+ (WebKit::NPJSObject::removeProperty):
+ Try to remove the property.
+
+ (WebKit::NPJSObject::npClass):
+ Add NP_RemoveProperty.
+
+ (WebKit::NPJSObject::NP_RemoveProperty):
+ Call NPJSObject::removeProperty.
+
+ * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
+ (WebKit::NPN_RemoveProperty):
+ Call the NPClass::removeProperty function.
+
2010-07-31 Sam Weinig <sam at webkit.org>
Reviewed by Darin Adler.
diff --git a/WebKit2/WebProcess/Plugins/NPJSObject.cpp b/WebKit2/WebProcess/Plugins/NPJSObject.cpp
index dda6af3..922ca63 100644
--- a/WebKit2/WebProcess/Plugins/NPJSObject.cpp
+++ b/WebKit2/WebProcess/Plugins/NPJSObject.cpp
@@ -192,6 +192,37 @@ bool NPJSObject::setProperty(NPIdentifier propertyName, const NPVariant* value)
return true;
}
+bool NPJSObject::removeProperty(NPIdentifier propertyName)
+{
+ IdentifierRep* identifierRep = static_cast<IdentifierRep*>(propertyName);
+
+ ExecState* exec = m_objectMap->globalExec();
+ if (!exec)
+ return false;
+
+ JSLock lock(SilenceAssertionsOnly);
+ if (identifierRep->isString()) {
+ Identifier identifier = identifierFromIdentifierRep(exec, identifierRep);
+
+ if (!m_jsObject->hasProperty(exec, identifier)) {
+ exec->clearException();
+ return false;
+ }
+
+ m_jsObject->deleteProperty(exec, identifier);
+ } else {
+ if (!m_jsObject->hasProperty(exec, identifierRep->number())) {
+ exec->clearException();
+ return false;
+ }
+
+ m_jsObject->deleteProperty(exec, identifierRep->number());
+ }
+
+ exec->clearException();
+ return true;
+}
+
bool NPJSObject::enumerate(NPIdentifier** identifiers, uint32_t* identifierCount)
{
ExecState* exec = m_objectMap->globalExec();
@@ -280,7 +311,7 @@ NPClass* NPJSObject::npClass()
NP_HasProperty,
NP_GetProperty,
NP_SetProperty,
- 0,
+ NP_RemoveProperty,
NP_Enumerate,
NP_Construct
};
@@ -331,6 +362,11 @@ bool NPJSObject::NP_SetProperty(NPObject* npObject, NPIdentifier propertyName, c
return toNPJSObject(npObject)->setProperty(propertyName, value);
}
+bool NPJSObject::NP_RemoveProperty(NPObject* npObject, NPIdentifier propertyName)
+{
+ return toNPJSObject(npObject)->removeProperty(propertyName);
+}
+
bool NPJSObject::NP_Enumerate(NPObject* npObject, NPIdentifier** identifiers, uint32_t* identifierCount)
{
return toNPJSObject(npObject)->enumerate(identifiers, identifierCount);
diff --git a/WebKit2/WebProcess/Plugins/NPJSObject.h b/WebKit2/WebProcess/Plugins/NPJSObject.h
index e1b1fe7..08ac9d4 100644
--- a/WebKit2/WebProcess/Plugins/NPJSObject.h
+++ b/WebKit2/WebProcess/Plugins/NPJSObject.h
@@ -66,6 +66,7 @@ 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);
bool construct(const NPVariant* arguments, uint32_t argumentCount, NPVariant* result);
@@ -80,6 +81,7 @@ private:
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);
+ static bool NP_RemoveProperty(NPObject*, NPIdentifier propertyName);
static bool NP_Enumerate(NPObject*, NPIdentifier** identifiers, uint32_t* identifierCount);
static bool NP_Construct(NPObject*, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result);
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp b/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
index 7319338..a60183f 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
@@ -593,9 +593,11 @@ static bool NPN_SetProperty(NPP, NPObject* npObject, NPIdentifier propertyName,
return false;
}
-static bool NPN_RemoveProperty(NPP npp, NPObject* npobj, NPIdentifier propertyName)
+static bool NPN_RemoveProperty(NPP, NPObject* npObject, NPIdentifier propertyName)
{
- notImplemented();
+ if (npObject->_class->removeProperty)
+ return npObject->_class->removeProperty(npObject, propertyName);
+
return false;
}
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 6ec6c17..878ab41 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,38 @@
+2010-08-01 Anders Carlsson <andersca at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Implement NPN_RemoveProperty
+ https://bugs.webkit.org/show_bug.cgi?id=43315
+
+ * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
+ Add NPRuntimeRemoveProperty.cpp
+
+ * DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp:
+ (PluginTest::NPN_GetStringIdentifier):
+ (PluginTest::NPN_GetIntIdentifier):
+ (PluginTest::NPN_RemoveProperty):
+ Add NPN_ helpers.
+
+ * DumpRenderTree/TestNetscapePlugIn/PluginTest.h:
+ Support more NPClass functions.
+
+ * DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp: Added.
+ (NPRuntimeRemoveProperty::NPRuntimeRemoveProperty):
+ Test for NPN_RemoveProperty.
+
+ (NPRuntimeRemoveProperty::TestObject::hasMethod):
+ (NPRuntimeRemoveProperty::TestObject::invoke):
+ Add a testRemoveProperty method.
+
+ (NPRuntimeRemoveProperty::NPP_GetValue):
+ Return the test object.
+
+ * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:
+ * DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro:
+ * GNUmakefile.am:
+ Add NPRuntimeRemoveProperty.cpp
+
2010-07-30 Anders Carlsson <andersca at apple.com>
Reviewed by Sam Weinig.
diff --git a/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj b/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
index ba4ddc3..9d8b27b 100644
--- a/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
+++ b/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
@@ -39,6 +39,7 @@
1AC6C8490D07638600CD3161 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC6C77F0D07589B00CD3161 /* main.cpp */; };
1AC6C84A0D07638600CD3161 /* PluginObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC6C7800D07589B00CD3161 /* PluginObject.cpp */; };
1AC6C84B0D07638600CD3161 /* TestObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC6C7810D07589B00CD3161 /* TestObject.cpp */; };
+ 1AC77DCF120605B6005C19EF /* NPRuntimeRemoveProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC77DCE120605B6005C19EF /* NPRuntimeRemoveProperty.cpp */; };
1AD9D2FE12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AD9D2FD12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp */; };
23BCB8900EA57623003C6289 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 23BCB88F0EA57623003C6289 /* OpenGL.framework */; };
3713EDE2115BE19300705720 /* ColorBits-A.png in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 3713EDDF115BE16F00705720 /* ColorBits-A.png */; };
@@ -196,6 +197,7 @@
1AC6C77F0D07589B00CD3161 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
1AC6C7800D07589B00CD3161 /* PluginObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginObject.cpp; sourceTree = "<group>"; };
1AC6C7810D07589B00CD3161 /* TestObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestObject.cpp; sourceTree = "<group>"; };
+ 1AC77DCE120605B6005C19EF /* NPRuntimeRemoveProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPRuntimeRemoveProperty.cpp; sourceTree = "<group>"; };
1AD9D2FD12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginScriptableNPObjectInvokeDefault.cpp; sourceTree = "<group>"; };
23BCB88F0EA57623003C6289 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; };
32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DumpRenderTreePrefix.h; sourceTree = "<group>"; };
@@ -436,6 +438,7 @@
isa = PBXGroup;
children = (
1A215A7511F26072008AD0F5 /* DocumentOpenInDestroyStream.cpp */,
+ 1AC77DCE120605B6005C19EF /* NPRuntimeRemoveProperty.cpp */,
1AD9D2FD12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp */,
);
path = Tests;
@@ -708,6 +711,7 @@
1A215A8111F2609C008AD0F5 /* PluginTest.cpp in Sources */,
1A215BE711F27658008AD0F5 /* DocumentOpenInDestroyStream.cpp in Sources */,
1AD9D2FE12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp in Sources */,
+ 1AC77DCF120605B6005C19EF /* NPRuntimeRemoveProperty.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp
index c142ac0..0ff7029 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp
@@ -60,11 +60,26 @@ NPError PluginTest::NPP_GetValue(NPPVariable variable, void *value)
return NPERR_GENERIC_ERROR;
}
+NPIdentifier PluginTest::NPN_GetStringIdentifier(const NPUTF8 *name)
+{
+ return browser->getstringidentifier(name);
+}
+
+NPIdentifier PluginTest::NPN_GetIntIdentifier(int32_t intid)
+{
+ return browser->getintidentifier(intid);
+}
+
NPObject* PluginTest::NPN_CreateObject(NPClass* npClass)
{
return browser->createobject(m_npp, npClass);
}
+bool PluginTest::NPN_RemoveProperty(NPObject* npObject, NPIdentifier propertyName)
+{
+ return browser->removeproperty(m_npp, npObject, propertyName);
+}
+
void PluginTest::registerCreateTestFunction(const string& identifier, CreateTestFunction createTestFunction)
{
assert(!createTestFunctions().count(identifier));
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h
index 77e0ee5..01d49a6 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h
@@ -36,24 +36,33 @@ typedef char (&no_tag)[1];
typedef char (&yes_tag)[2];
#define DEFINE_HAS_MEMBER_CHECK(member, returnType, argumentTypes) \
-template<typename T, returnType (T::*member) argumentTypes> struct pmf_helper {}; \
+template<typename T, returnType (T::*member) argumentTypes> struct pmf_##member##_helper {}; \
template<typename T> no_tag has_member_##member##_helper(...); \
-template<typename T> yes_tag has_member_##member##_helper(pmf_helper<T, &T::member > *); \
+template<typename T> yes_tag has_member_##member##_helper(pmf_##member##_helper<T, &T::member >*); \
template<typename T> struct has_member_##member { \
static const bool value = sizeof(has_member_##member##_helper<T>(0)) == sizeof(yes_tag); \
};
-DEFINE_HAS_MEMBER_CHECK(invokeDefault, bool, (const NPVariant*, uint32_t, NPVariant* result))
+DEFINE_HAS_MEMBER_CHECK(hasMethod, bool, (NPIdentifier methodName));
+DEFINE_HAS_MEMBER_CHECK(invoke, bool, (NPIdentifier methodName, const NPVariant*, uint32_t, NPVariant* result));
+DEFINE_HAS_MEMBER_CHECK(invokeDefault, bool, (const NPVariant*, uint32_t, NPVariant* result));
+DEFINE_HAS_MEMBER_CHECK(hasProperty, bool, (NPIdentifier propertyName));
class PluginTest {
public:
static PluginTest* create(NPP, const std::string& identifier);
virtual ~PluginTest();
- // Add more NPP functions here if needed.
- virtual NPError NPP_DestroyStream(NPStream *stream, NPReason reason);
- virtual NPError NPP_GetValue(NPPVariable, void *value);
+ // NPP functions.
+ virtual NPError NPP_DestroyStream(NPStream* stream, NPReason reason);
+ virtual NPError NPP_GetValue(NPPVariable, void* value);
+ // NPN functions.
+ NPIdentifier NPN_GetStringIdentifier(const NPUTF8* name);
+ NPIdentifier NPN_GetIntIdentifier(int32_t intid);
+ NPObject* NPN_CreateObject(NPClass*);
+ bool NPN_RemoveProperty(NPObject*, NPIdentifier propertyName);
+
template<typename TestClassTy> class Register {
public:
Register(const std::string& identifier)
@@ -71,9 +80,6 @@ public:
protected:
PluginTest(NPP npp, const std::string& identifier);
- // NPN functions.
- NPObject* NPN_CreateObject(NPClass*);
-
// FIXME: A plug-in test shouldn't need to know about it's NPP. Make this private.
NPP m_npp;
@@ -91,12 +97,30 @@ protected:
}
// These should never be called.
+ bool hasMethod(NPIdentifier methodName)
+ {
+ assert(false);
+ return false;
+ }
+
+ bool invoke(NPIdentifier methodName, const NPVariant*, uint32_t, NPVariant* result)
+ {
+ assert(false);
+ return false;
+ }
+
bool invokeDefault(const NPVariant*, uint32_t, NPVariant* result)
{
assert(false);
return false;
}
+ bool hasProperty(NPIdentifier propertyName)
+ {
+ assert(false);
+ return false;
+ }
+
protected:
Object()
: m_pluginTest(0)
@@ -107,6 +131,8 @@ protected:
{
}
+ PluginTest* pluginTest() const { return m_pluginTest; }
+
private:
static NPObject* NP_Allocate(NPP npp, NPClass* aClass)
{
@@ -118,11 +144,26 @@ protected:
delete static_cast<T*>(npObject);
}
+ static bool NP_HasMethod(NPObject* npObject, NPIdentifier methodName)
+ {
+ return static_cast<T*>(npObject)->hasMethod(methodName);
+ }
+
+ static bool NP_Invoke(NPObject* npObject, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
+ {
+ return static_cast<T*>(npObject)->invoke(methodName, arguments, argumentCount, result);
+ }
+
static bool NP_InvokeDefault(NPObject* npObject, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
{
return static_cast<T*>(npObject)->invokeDefault(arguments, argumentCount, result);
}
+ static bool NP_HasProperty(NPObject* npObject, NPIdentifier propertyName)
+ {
+ return static_cast<T*>(npObject)->hasProperty(propertyName);
+ }
+
static NPClass* npClass()
{
static NPClass npClass = {
@@ -130,10 +171,10 @@ protected:
NP_Allocate,
NP_Deallocate,
0, // NPClass::invalidate
- 0, // NPClass::hasMethod
- 0, // NPClass::invoke
+ has_member_hasMethod<T>::value ? NP_HasMethod : 0,
+ has_member_invoke<T>::value ? NP_Invoke : 0,
has_member_invokeDefault<T>::value ? NP_InvokeDefault : 0,
- 0, // NPClass::hasProperty
+ has_member_hasProperty<T>::value ? NP_HasProperty : 0,
0, // NPClass::getProperty
0, // NPClass::setProperty
0, // NPClass::removeProperty
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp
new file mode 100644
index 0000000..4d417d1
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "PluginTest.h"
+
+using namespace std;
+
+
+class NPRuntimeRemoveProperty : public PluginTest {
+public:
+ NPRuntimeRemoveProperty(NPP npp, const string& identifier)
+ : PluginTest(npp, identifier)
+ {
+ }
+
+private:
+ struct TestObject : Object<TestObject> {
+ public:
+ bool hasMethod(NPIdentifier methodName)
+ {
+ return methodName == pluginTest()->NPN_GetStringIdentifier("testRemoveProperty");
+ }
+
+ bool invoke(NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
+ {
+ assert(methodName == pluginTest()->NPN_GetStringIdentifier("testRemoveProperty"));
+
+ if (argumentCount != 2)
+ return false;
+
+ if (!NPVARIANT_IS_OBJECT(arguments[0]))
+ return false;
+
+ if (!NPVARIANT_IS_STRING(arguments[1]) && !NPVARIANT_IS_DOUBLE(arguments[1]))
+ return false;
+
+ NPIdentifier propertyName;
+ if (NPVARIANT_IS_STRING(arguments[1])) {
+ string propertyNameString(arguments[1].value.stringValue.UTF8Characters,
+ arguments[1].value.stringValue.UTF8Length);
+
+ propertyName = pluginTest()->NPN_GetStringIdentifier(propertyNameString.c_str());
+ } else {
+ int32_t number = arguments[1].value.doubleValue;
+ propertyName = pluginTest()->NPN_GetIntIdentifier(number);
+ }
+
+ pluginTest()->NPN_RemoveProperty(NPVARIANT_TO_OBJECT(arguments[0]), propertyName);
+
+ VOID_TO_NPVARIANT(*result);
+ return true;
+ }
+ };
+
+ virtual NPError NPP_GetValue(NPPVariable variable, void *value)
+ {
+ if (variable != NPPVpluginScriptableNPObject)
+ return NPERR_GENERIC_ERROR;
+
+ *(NPObject**)value = TestObject::create(this);
+
+ return NPERR_NO_ERROR;
+ }
+
+};
+
+static PluginTest::Register<NPRuntimeRemoveProperty> npRuntimeRemoveProperty("npruntime-remove-property");
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
index 500dae7..e83ab0b 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
@@ -464,6 +464,10 @@
>
</File>
<File
+ RelativePath="..\Tests\NPRuntimeRemoveProperty.cpp"
+ >
+ </File>
+ <File
RelativePath="..\Tests\PluginScriptableNPObjectInvokeDefault.cpp"
>
</File>
diff --git a/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro b/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro
index f2926ab..47721f9 100644
--- a/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro
+++ b/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro
@@ -29,6 +29,7 @@ SOURCES = PluginObject.cpp \
PluginTest.cpp \
TestObject.cpp \
Tests/DocumentOpenInDestroyStream.cpp \
+ Tests/NPRuntimeRemoveProperty.cpp \
Tests/PluginScriptableNPObjectInvokeDefault.cpp
mac {
diff --git a/WebKitTools/GNUmakefile.am b/WebKitTools/GNUmakefile.am
index 32ce309..2649407 100644
--- a/WebKitTools/GNUmakefile.am
+++ b/WebKitTools/GNUmakefile.am
@@ -159,6 +159,7 @@ TestNetscapePlugin_libtestnetscapeplugin_la_SOURCES = \
WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/ForwardingHeaders/WebKit/npruntime.h \
WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp \
WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp \
+ WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp \
WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp \
WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp \
WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h \
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list