summaryrefslogtreecommitdiffstats
path: root/WebKitTools/DumpRenderTree/unix
diff options
context:
space:
mode:
Diffstat (limited to 'WebKitTools/DumpRenderTree/unix')
-rw-r--r--WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp41
1 files changed, 33 insertions, 8 deletions
diff --git a/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp b/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp
index e960a06..ca868be 100644
--- a/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp
+++ b/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp
@@ -175,7 +175,7 @@ webkit_test_plugin_new_stream(NPP instance,
{
PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
obj->stream = stream;
- *stype = NP_ASFILEONLY;
+ *stype = NP_NORMAL;
if (obj->returnErrorFromNewStream)
return NPERR_GENERIC_ERROR;
@@ -190,12 +190,32 @@ webkit_test_plugin_new_stream(NPP instance,
}
static NPError
-webkit_test_plugin_destroy_stream(NPP instance, NPStream* /*stream*/, NPError /*reason*/)
+webkit_test_plugin_destroy_stream(NPP instance, NPStream* /*stream*/, NPError reason)
{
PluginObject* obj = (PluginObject*)instance->pdata;
- if (obj->onStreamDestroy)
- executeScript(obj, obj->onStreamDestroy);
+ if (obj->onStreamDestroy) {
+ NPObject* windowObject = 0;
+ NPError error = browser->getvalue(instance, NPNVWindowNPObject, &windowObject);
+
+ if (error == NPERR_NO_ERROR) {
+ NPVariant onStreamDestroyVariant;
+ if (browser->getproperty(instance, windowObject, browser->getstringidentifier(obj->onStreamDestroy), &onStreamDestroyVariant)) {
+ if (NPVARIANT_IS_OBJECT(onStreamDestroyVariant)) {
+ NPObject* onStreamDestroyFunction = NPVARIANT_TO_OBJECT(onStreamDestroyVariant);
+
+ NPVariant reasonVariant;
+ INT32_TO_NPVARIANT(reason, reasonVariant);
+
+ NPVariant result;
+ browser->invokeDefault(instance, onStreamDestroyFunction, &reasonVariant, 1, &result);
+ browser->releasevariantvalue(&result);
+ }
+ browser->releasevariantvalue(&onStreamDestroyVariant);
+ }
+ browser->releaseobject(windowObject);
+ }
+ }
if (obj->testDocumentOpenInDestroyStream) {
testDocumentOpen(instance);
@@ -213,17 +233,22 @@ webkit_test_plugin_stream_as_file(NPP /*instance*/, NPStream* /*stream*/, const
static int32_t
webkit_test_plugin_write_ready(NPP /*instance*/, NPStream* /*stream*/)
{
- return 0;
+ return 4096;
}
static int32_t
-webkit_test_plugin_write(NPP /*instance*/,
+webkit_test_plugin_write(NPP instance,
NPStream* /*stream*/,
int32_t /*offset*/,
- int32_t /*len*/,
+ int32_t len,
void* /*buffer*/)
{
- return 0;
+ PluginObject* obj = (PluginObject*)instance->pdata;
+
+ if (obj->returnNegativeOneFromWrite)
+ return -1;
+
+ return len;
}
static void