[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:36:17 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 699493ad3398aad6c5a0f99cde143b606f1af484
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Jul 30 17:30:56 2010 +0000
Replace plugins/npruntime/bindings-test.html with a more sophisticated test
https://bugs.webkit.org/show_bug.cgi?id=43232
Reviewed by Adam Roben.
WebKitTools:
* DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
Add PluginScriptableNPObjectInvokeDefault.cpp.
* DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp:
Remove invokeDefault callback function.
* DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp:
(PluginTest::create):
Move this to the top of the file.
(PluginTest::NPP_GetValue):
Add default implementation.
(PluginTest::NPN_CreateObject):
Add NPN_ wrapper.
* DumpRenderTree/TestNetscapePlugIn/PluginTest.h:
(PluginTest::identifier):
Add identifier getter.
* DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp:
(DocumentOpenInDestroyStream::DocumentOpenInDestroyStream):
Add "using namespace std".
* DumpRenderTree/TestNetscapePlugIn/main.cpp:
(NPP_GetValue):
Give PluginTest a chance to return a value.
* DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:
* DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro:
* GNUmakefile.am:
Add PluginScriptableNPObjectInvokeDefault.cpp.
* DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp:
(webkit_test_plugin_get_value):
Give PluginTest a chance to return a value.
LayoutTests:
* plugins/npruntime/bindings-test-expected.txt: Removed.
* plugins/npruntime/bindings-test.html: Removed.
* plugins/npruntime/plugin-scriptable-object-invoke-default-expected.txt: Added.
* plugins/npruntime/plugin-scriptable-object-invoke-default.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64359 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 6641eae..18be6f0 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-07-29 Anders Carlsson <andersca at apple.com>
+
+ Reviewed by Adam Roben.
+
+ Replace plugins/npruntime/bindings-test.html with a more sophisticated test
+ https://bugs.webkit.org/show_bug.cgi?id=43232
+
+ * plugins/npruntime/bindings-test-expected.txt: Removed.
+ * plugins/npruntime/bindings-test.html: Removed.
+ * plugins/npruntime/plugin-scriptable-object-invoke-default-expected.txt: Added.
+ * plugins/npruntime/plugin-scriptable-object-invoke-default.html: Added.
+
2010-07-30 Steve Block <steveblock at google.com>
Reviewed by Steve Block.
diff --git a/LayoutTests/plugins/npruntime/bindings-test-expected.txt b/LayoutTests/plugins/npruntime/bindings-test-expected.txt
deleted file mode 100644
index 624edc7..0000000
--- a/LayoutTests/plugins/npruntime/bindings-test-expected.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-ALERT: typeof(cPlugin)=function
-ALERT: cPlugin()=1
-ALERT: typeof(cPlugin)=object
-ALERT: cPlugin()=TypeError
-This page tests invoking as functions JavaScript objects that are provided by plugins.
-
-
diff --git a/LayoutTests/plugins/npruntime/bindings-test.html b/LayoutTests/plugins/npruntime/bindings-test.html
deleted file mode 100644
index 545c5de..0000000
--- a/LayoutTests/plugins/npruntime/bindings-test.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<html>
-<head>
-<script>
-function doTest()
-{
- if (window.layoutTestController)
- layoutTestController.dumpAsText();
-
- // Test the C plugin
- var cPlugin = document.getElementById("testCPlugin");
- if (cPlugin) {
- // Type should be "function"
- alert("typeof(cPlugin)=" + typeof(cPlugin));
-
- // Calling cPlugin() should return 1
- var result;
- try {
- result = cPlugin();
- } catch (e) {
- result = e.name;
- }
- alert("cPlugin()=" + result);
-
- // Special function that removes cPlugin's default method implementation. The runtime should consider
- // cPlugin an "object" if it has no default method.
- cPlugin.removeDefaultMethod();
-
- // Type should be "object"
- alert("typeof(cPlugin)=" + typeof(cPlugin));
-
- // Calling cPlugin() now should raise an exception
- var result;
- try {
- result = cPlugin();
- } catch (e) {
- result = e.name;
- }
- alert("cPlugin()=" + result);
- }
-}
-</script>
-</head>
-<body onload="doTest();">
-<p>This page tests invoking as functions JavaScript objects that are provided by plugins.</p>
-<embed id="testCPlugin" type="application/x-webkit-test-netscape"></embed>
-</body>
-</html>
diff --git a/LayoutTests/plugins/npruntime/plugin-scriptable-object-invoke-default-expected.txt b/LayoutTests/plugins/npruntime/plugin-scriptable-object-invoke-default-expected.txt
new file mode 100644
index 0000000..97a943b
--- /dev/null
+++ b/LayoutTests/plugins/npruntime/plugin-scriptable-object-invoke-default-expected.txt
@@ -0,0 +1,11 @@
+
+This page tests invoking as functions JavaScript objects that are provided by plugins.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS typeof(pluginWithInvokeDefault) is 'function'
+PASS pluginWithInvokeDefault() is 1
+PASS typeof(pluginWithoutInvokeDefault) is 'object'
+PASS pluginWithoutInvokeDefault() threw exception TypeError: Result of expression 'pluginWithoutInvokeDefault' [[object HTMLEmbedElement]] is not a function..
+
diff --git a/LayoutTests/plugins/npruntime/plugin-scriptable-object-invoke-default.html b/LayoutTests/plugins/npruntime/plugin-scriptable-object-invoke-default.html
new file mode 100644
index 0000000..597f56a
--- /dev/null
+++ b/LayoutTests/plugins/npruntime/plugin-scriptable-object-invoke-default.html
@@ -0,0 +1,33 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+function doTest()
+{
+ description('This page tests invoking as functions JavaScript objects that are provided by plugins.')
+
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ pluginWithInvokeDefault = document.getElementById('plugin-with-invoke-default');
+
+ shouldBe("typeof(pluginWithInvokeDefault)", "'function'");
+ shouldBe("pluginWithInvokeDefault()", "1")
+
+ pluginWithoutInvokeDefault = document.getElementById('plugin-without-invoke-default');
+ shouldBe("typeof(pluginWithoutInvokeDefault)", "'object'");
+ shouldThrow("pluginWithoutInvokeDefault()");
+}
+</script>
+</head>
+<body onload="doTest();">
+<embed id="plugin-with-invoke-default" type="application/x-webkit-test-netscape" test="plugin-scriptable-npobject-invoke-default"></embed>
+<embed id="plugin-without-invoke-default" type="application/x-webkit-test-netscape" test="plugin-scriptable-npobject-no-invoke-default"></embed>
+<p id="description"></p>
+<div id="console"></div>
+
+</body>
+</html>
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 0a78774..fb40886 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,47 @@
+2010-07-29 Anders Carlsson <andersca at apple.com>
+
+ Reviewed by Adam Roben.
+
+ Replace plugins/npruntime/bindings-test.html with a more sophisticated test
+ https://bugs.webkit.org/show_bug.cgi?id=43232
+
+ * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
+ Add PluginScriptableNPObjectInvokeDefault.cpp.
+
+ * DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp:
+ Remove invokeDefault callback function.
+
+ * DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp:
+ (PluginTest::create):
+ Move this to the top of the file.
+
+ (PluginTest::NPP_GetValue):
+ Add default implementation.
+
+ (PluginTest::NPN_CreateObject):
+ Add NPN_ wrapper.
+
+ * DumpRenderTree/TestNetscapePlugIn/PluginTest.h:
+ (PluginTest::identifier):
+ Add identifier getter.
+
+ * DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp:
+ (DocumentOpenInDestroyStream::DocumentOpenInDestroyStream):
+ Add "using namespace std".
+
+ * DumpRenderTree/TestNetscapePlugIn/main.cpp:
+ (NPP_GetValue):
+ Give PluginTest a chance to return a value.
+
+ * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:
+ * DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro:
+ * GNUmakefile.am:
+ Add PluginScriptableNPObjectInvokeDefault.cpp.
+
+ * DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp:
+ (webkit_test_plugin_get_value):
+ Give PluginTest a chance to return a value.
+
2010-07-30 Steve Block <steveblock at google.com>
Reviewed by Steve Block.
diff --git a/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj b/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
index 283d7d8..ba4ddc3 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 */; };
+ 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 */; };
3713EDE3115BE19300705720 /* ColorBits.ttf in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 3713EDE0115BE16F00705720 /* ColorBits.ttf */; };
@@ -195,6 +196,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>"; };
+ 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>"; };
3713EDDF115BE16F00705720 /* ColorBits-A.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "ColorBits-A.png"; path = "fonts/ColorBits-A.png"; sourceTree = "<group>"; };
@@ -434,6 +436,7 @@
isa = PBXGroup;
children = (
1A215A7511F26072008AD0F5 /* DocumentOpenInDestroyStream.cpp */,
+ 1AD9D2FD12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp */,
);
path = Tests;
sourceTree = "<group>";
@@ -704,6 +707,7 @@
0F37A4A711E6628700275F54 /* PluginObjectMac.mm in Sources */,
1A215A8111F2609C008AD0F5 /* PluginTest.cpp in Sources */,
1A215BE711F27658008AD0F5 /* DocumentOpenInDestroyStream.cpp in Sources */,
+ 1AD9D2FE12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
index 72475e0..0d556b1 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
@@ -99,7 +99,6 @@ static bool pluginHasMethod(NPObject*, NPIdentifier name);
static bool pluginGetProperty(NPObject*, NPIdentifier name, NPVariant*);
static bool pluginSetProperty(NPObject*, NPIdentifier name, const NPVariant*);
static bool pluginInvoke(NPObject*, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result);
-static bool pluginInvokeDefault(NPObject*, const NPVariant* args, uint32_t argCount, NPVariant* result);
static NPObject* pluginAllocate(NPP npp, NPClass*);
static void pluginDeallocate(NPObject*);
@@ -112,7 +111,7 @@ static NPClass pluginClass = {
pluginInvalidate,
pluginHasMethod,
pluginInvoke,
- pluginInvokeDefault,
+ 0, // NPClass::invokeDefault,
pluginHasProperty,
pluginGetProperty,
pluginSetProperty,
@@ -161,7 +160,6 @@ static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = {
enum {
ID_TEST_CALLBACK_METHOD = 0,
ID_TEST_GETURL,
- ID_REMOVE_DEFAULT_METHOD,
ID_TEST_DOM_ACCESS,
ID_TEST_GET_URL_NOTIFY,
ID_TEST_INVOKE_DEFAULT,
@@ -198,7 +196,6 @@ static NPIdentifier pluginMethodIdentifiers[NUM_METHOD_IDENTIFIERS];
static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
"testCallback",
"getURL",
- "removeDefaultMethod",
"testDOMAccess",
"getURLNotify",
"testInvokeDefault",
@@ -465,13 +462,6 @@ static bool getURL(PluginObject* obj, const NPVariant* args, uint32_t argCount,
return false;
}
-static bool removeDefaultMethod(PluginObject*, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- pluginClass.invokeDefault = 0;
- VOID_TO_NPVARIANT(*result);
- return true;
-}
-
static bool getURLNotify(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
{
if (argCount != 3 || !NPVARIANT_IS_STRING(args[0])
@@ -860,8 +850,6 @@ static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* a
return testCallback(plugin, args, argCount, result);
else if (name == pluginMethodIdentifiers[ID_TEST_GETURL])
return getURL(plugin, args, argCount, result);
- else if (name == pluginMethodIdentifiers[ID_REMOVE_DEFAULT_METHOD])
- return removeDefaultMethod(plugin, args, argCount, result);
else if (name == pluginMethodIdentifiers[ID_TEST_DOM_ACCESS])
return testDOMAccess(plugin, args, argCount, result);
else if (name == pluginMethodIdentifiers[ID_TEST_GET_URL_NOTIFY])
@@ -944,12 +932,6 @@ static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* a
return false;
}
-static bool pluginInvokeDefault(NPObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- INT32_TO_NPVARIANT(1, *result);
- return true;
-}
-
static void pluginInvalidate(NPObject* header)
{
PluginObject* plugin = reinterpret_cast<PluginObject*>(header);
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp
index ec3a2d7..c142ac0 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp
@@ -30,6 +30,15 @@
using namespace std;
extern NPNetscapeFuncs *browser;
+PluginTest* PluginTest::create(NPP npp, const string& identifier)
+{
+ CreateTestFunction createTestFunction = createTestFunctions()[identifier];
+ if (createTestFunction)
+ return createTestFunction(npp, identifier);
+
+ return new PluginTest(npp, identifier);
+}
+
PluginTest::PluginTest(NPP npp, const string& identifier)
: m_npp(npp)
, m_identifier(identifier)
@@ -45,13 +54,17 @@ NPError PluginTest::NPP_DestroyStream(NPStream *stream, NPReason reason)
return NPERR_NO_ERROR;
}
-std::map<std::string, PluginTest::CreateTestFunction>& PluginTest::createTestFunctions()
+NPError PluginTest::NPP_GetValue(NPPVariable variable, void *value)
{
- static std::map<std::string, CreateTestFunction> testFunctions;
-
- return testFunctions;
+ // We don't know anything about plug-in values so just return NPERR_GENERIC_ERROR.
+ return NPERR_GENERIC_ERROR;
}
+NPObject* PluginTest::NPN_CreateObject(NPClass* npClass)
+{
+ return browser->createobject(m_npp, npClass);
+}
+
void PluginTest::registerCreateTestFunction(const string& identifier, CreateTestFunction createTestFunction)
{
assert(!createTestFunctions().count(identifier));
@@ -59,11 +72,9 @@ void PluginTest::registerCreateTestFunction(const string& identifier, CreateTest
createTestFunctions()[identifier] = createTestFunction;
}
-PluginTest* PluginTest::create(NPP npp, const string& identifier)
+std::map<std::string, PluginTest::CreateTestFunction>& PluginTest::createTestFunctions()
{
- CreateTestFunction createTestFunction = createTestFunctions()[identifier];
- if (createTestFunction)
- return createTestFunction(npp, identifier);
-
- return new PluginTest(npp, identifier);
+ static std::map<std::string, CreateTestFunction> testFunctions;
+
+ return testFunctions;
}
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h
index 49159ce..234937b 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h
@@ -37,6 +37,7 @@ public:
// Add more NPP functions here if needed.
virtual NPError NPP_DestroyStream(NPStream *stream, NPReason reason);
+ virtual NPError NPP_GetValue(NPPVariable, void *value);
template<typename TestClassTy> class Register {
public:
@@ -56,10 +57,13 @@ 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;
+ const std::string& identifier() const { return m_identifier; }
+
private:
typedef PluginTest* (*CreateTestFunction)(NPP, const std::string&);
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp
index e00a810..10ff263 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp
@@ -25,11 +25,15 @@
#include "PluginTest.h"
+using namespace std;
+
extern bool testDocumentOpen(NPP npp);
+// Call document.open from NPP_DestroyStream.
+
class DocumentOpenInDestroyStream : public PluginTest {
public:
- DocumentOpenInDestroyStream(NPP npp, const std::string& identifier)
+ DocumentOpenInDestroyStream(NPP npp, const string& identifier)
: PluginTest(npp, identifier)
, m_shouldOpen(true)
{
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp
new file mode 100644
index 0000000..30c463b
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp
@@ -0,0 +1,97 @@
+/*
+ * 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;
+
+static bool invokeDefault(NPObject*, const NPVariant*, uint32_t, NPVariant* result)
+{
+ INT32_TO_NPVARIANT(1, *result);
+ return true;
+}
+
+static NPClass npClassWithInvokeDefault = {
+ NP_CLASS_STRUCT_VERSION,
+ 0, // NPClass::allocate
+ 0, // NPClass::deallocate
+ 0, // NPClass::invalidate
+ 0, // NPClass::hasMethod
+ 0, // NPClass::invoke
+ invokeDefault,
+ 0, // NPClass::hasProperty
+ 0, // NPClass::getProperty
+ 0, // NPClass::setProperty
+ 0, // NPClass::removeProperty
+ 0, // NPClass::enumerate
+ 0 // NPClass::construct
+};
+
+static NPClass npClassWithoutInvokeDefault = {
+ NP_CLASS_STRUCT_VERSION,
+ 0, // NPClass::allocate
+ 0, // NPClass::deallocate
+ 0, // NPClass::invalidate
+ 0, // NPClass::hasMethod
+ 0, // NPClass::invoke
+ 0, // NPClass::invokeDefault,
+ 0, // NPClass::hasProperty
+ 0, // NPClass::getProperty
+ 0, // NPClass::setProperty
+ 0, // NPClass::removeProperty
+ 0, // NPClass::enumerate
+ 0 // NPClass::construct
+};
+
+// A test where the plug-ins scriptable object either has or doesn't have an invokeDefault function.
+class PluginScriptableNPObjectInvokeDefault : public PluginTest {
+public:
+ PluginScriptableNPObjectInvokeDefault(NPP npp, const string& identifier)
+ : PluginTest(npp, identifier)
+ {
+ }
+
+private:
+ virtual NPError NPP_GetValue(NPPVariable variable, void *value)
+ {
+ if (variable != NPPVpluginScriptableNPObject)
+ return NPERR_GENERIC_ERROR;
+
+ NPClass* npClass;
+ if (identifier() == "plugin-scriptable-npobject-invoke-default")
+ npClass = &npClassWithInvokeDefault;
+ else
+ npClass = &npClassWithoutInvokeDefault;
+
+ *(NPObject**)value = NPN_CreateObject(npClass);
+
+ return NPERR_NO_ERROR;
+ }
+
+ NPObject* m_scriptableObject;
+};
+
+static PluginTest::Register<PluginScriptableNPObjectInvokeDefault> pluginScriptableNPObjectInvokeDefault("plugin-scriptable-npobject-invoke-default");
+static PluginTest::Register<PluginScriptableNPObjectInvokeDefault> pluginScriptableNPObjectNoInvokeDefault("plugin-scriptable-npobject-no-invoke-default");
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp
index ab1cc3f..fcda50b 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp
@@ -529,6 +529,10 @@ NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
{
PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
+ // First, check if the PluginTest object supports getting this value.
+ if (obj->pluginTest->NPP_GetValue(variable, value) == NPERR_NO_ERROR)
+ return NPERR_NO_ERROR;
+
if (variable == NPPVpluginScriptableNPObject) {
void **v = (void **)value;
// Return value is expected to be retained
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
index 87df602..500dae7 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
@@ -463,6 +463,10 @@
RelativePath="..\Tests\DocumentOpenInDestroyStream.cpp"
>
</File>
+ <File
+ RelativePath="..\Tests\PluginScriptableNPObjectInvokeDefault.cpp"
+ >
+ </File>
</Filter>
</Files>
<Globals>
diff --git a/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro b/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro
index d803bdb..f2926ab 100644
--- a/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro
+++ b/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro
@@ -28,7 +28,8 @@ INCLUDEPATH += ../../../../JavaScriptCore \
SOURCES = PluginObject.cpp \
PluginTest.cpp \
TestObject.cpp \
- Tests/DocumentOpenInDestroyStream.cpp
+ Tests/DocumentOpenInDestroyStream.cpp \
+ Tests/PluginScriptableNPObjectInvokeDefault.cpp
mac {
SOURCES += ../../TestNetscapePlugIn/main.cpp
diff --git a/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp b/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp
index 2993028..d56c9a3 100644
--- a/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp
+++ b/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp
@@ -286,6 +286,12 @@ webkit_test_plugin_url_notify(NPP instance, const char* url, NPReason reason, vo
static NPError
webkit_test_plugin_get_value(NPP instance, NPPVariable variable, void *value)
{
+ PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
+
+ // First, check if the PluginTest object supports getting this value.
+ if (obj->pluginTest->NPP_GetValue(variable, value) == NPERR_NO_ERROR)
+ return NPERR_NO_ERROR;
+
NPError err = NPERR_NO_ERROR;
switch (variable) {
@@ -311,7 +317,6 @@ webkit_test_plugin_get_value(NPP instance, NPPVariable variable, void *value)
if (variable == NPPVpluginScriptableNPObject) {
void **v = (void **)value;
- PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
browser->retainobject((NPObject *)obj);
*v = obj;
err = NPERR_NO_ERROR;
diff --git a/WebKitTools/GNUmakefile.am b/WebKitTools/GNUmakefile.am
index 0eff139..32ce309 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/PluginScriptableNPObjectInvokeDefault.cpp \
WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp \
WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h \
WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp \
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list