summaryrefslogtreecommitdiff
path: root/Tools/DumpRenderTree/TestNetscapePlugIn
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/DumpRenderTree/TestNetscapePlugIn')
-rw-r--r--Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt61
-rw-r--r--Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp44
-rw-r--r--Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp19
-rw-r--r--Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h7
-rw-r--r--Tools/DumpRenderTree/TestNetscapePlugIn/Tests/EvaluateJSWithinNPP_New.cpp56
-rw-r--r--Tools/DumpRenderTree/TestNetscapePlugIn/Tests/InvokeDestroysPluginWithinNPP_New.cpp67
-rw-r--r--Tools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableObjectOverridesAllProperties.cpp82
-rw-r--r--Tools/DumpRenderTree/TestNetscapePlugIn/Tests/SlowNPPNew.cpp87
-rw-r--r--Tools/DumpRenderTree/TestNetscapePlugIn/Tests/URLRedirect.cpp167
-rw-r--r--Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp53
-rw-r--r--Tools/DumpRenderTree/TestNetscapePlugIn/unix/ForwardingHeaders/WebKit/npapi.h (renamed from Tools/DumpRenderTree/TestNetscapePlugIn/ForwardingHeaders/WebKit/npapi.h)0
-rw-r--r--Tools/DumpRenderTree/TestNetscapePlugIn/unix/ForwardingHeaders/WebKit/npfunctions.h (renamed from Tools/DumpRenderTree/TestNetscapePlugIn/ForwardingHeaders/WebKit/npfunctions.h)0
-rw-r--r--Tools/DumpRenderTree/TestNetscapePlugIn/unix/ForwardingHeaders/WebKit/npruntime.h (renamed from Tools/DumpRenderTree/TestNetscapePlugIn/ForwardingHeaders/WebKit/npruntime.h)0
13 files changed, 38 insertions, 605 deletions
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt b/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt
deleted file mode 100644
index c431667b2..000000000
--- a/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt
+++ /dev/null
@@ -1,61 +0,0 @@
-set(WEBKIT_TESTNETSCAPEPLUGIN_DIR "${TOOLS_DIR}/DumpRenderTree/TestNetscapePlugIn")
-
-set(WebKitTestNetscapePlugin_SOURCES
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/PluginObject.cpp
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/PluginTest.cpp
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/TestObject.cpp
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/main.cpp
-
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/DocumentOpenInDestroyStream.cpp
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/EvaluateJSAfterRemovingPluginElement.cpp
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/FormValue.cpp
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/GetURLNotifyWithURLThatFailsToLoad.cpp
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/GetURLWithJavaScriptURL.cpp
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/GetUserAgentWithNullNPPFromNPPNew.cpp
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/LogNPPSetWindow.cpp
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/NPDeallocateCalledBeforeNPShutdown.cpp
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/NPPNewFails.cpp
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/NPPSetWindowCalledDuringDestruction.cpp
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/NPRuntimeCallsWithNullNPP.cpp
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/NPRuntimeRemoveProperty.cpp
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/NullNPPGetValuePointer.cpp
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/PassDifferentNPPStruct.cpp
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/PluginScriptableNPObjectInvokeDefault.cpp
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/PluginScriptableObjectOverridesAllProperties.cpp
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/PrivateBrowsing.cpp
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/ToStringAndValueOfObject.cpp
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/URLRedirect.cpp
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/x11/CallInvalidateRectWithNullNPPArgument.cpp
-)
-
-set(WebKitTestNetscapePlugin_INCLUDE_DIRECTORIES
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}
- ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/ForwardingHeaders
- ${WEBCORE_DIR}
- ${WTF_DIR}
-)
-
-set(WebKitTestNetscapePlugin_SYSTEM_INCLUDE_DIRECTORIES
- ${X11_INCLUDE_DIR}
-)
-
-include_directories(${WebKitTestNetscapePlugin_INCLUDE_DIRECTORIES})
-include_directories(SYSTEM ${WebKitTestNetscapePlugin_SYSTEM_INCLUDE_DIRECTORIES})
-
-set(WebKitTestNetscapePlugin_LIBRARIES
- ${X11_LIBRARIES}
-)
-
-if (WTF_OS_UNIX)
- add_definitions(-DXP_UNIX)
-endif ()
-
-add_library(TestNetscapePlugin SHARED ${WebKitTestNetscapePlugin_SOURCES})
-target_link_libraries(TestNetscapePlugin ${WebKitTestNetscapePlugin_LIBRARIES})
-set_target_properties(TestNetscapePlugin PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/plugins)
-WEBKIT_SET_EXTRA_COMPILER_FLAGS(TestNetscapePlugin)
-
-# Suppress unused parameter warnings for sources in WebKit2.
-ADD_TARGET_PROPERTIES(TestNetscapePlugin COMPILE_FLAGS "-Wno-unused-parameter")
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
index 982452b68..75631842f 100644
--- a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
+++ b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
@@ -30,14 +30,10 @@
#include "PluginTest.h"
#include "TestObject.h"
#include <assert.h>
-#include <memory>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <wtf/Platform.h>
-#include <wtf/ExportMacros.h>
-#include <wtf/Assertions.h>
// Helper function which takes in the plugin window object for logging to the console object.
static void pluginLogWithWindowObject(NPObject* windowObject, NPP instance, const char* message)
@@ -64,7 +60,6 @@ static void pluginLogWithWindowObject(NPObject* windowObject, NPP instance, cons
browser->releaseobject(consoleObject);
}
-WTF_ATTRIBUTE_PRINTF(2, 0)
void pluginLogWithArguments(NPP instance, const char* format, va_list args)
{
const size_t messageBufferSize = 2048;
@@ -85,7 +80,6 @@ void pluginLogWithArguments(NPP instance, const char* format, va_list args)
}
// Helper function to log to the console object.
-WTF_ATTRIBUTE_PRINTF(2, 3)
void pluginLog(NPP instance, const char* format, ...)
{
va_list args;
@@ -776,15 +770,11 @@ static bool testGetPropertyReturnValue(PluginObject* obj, const NPVariant* args,
return true;
}
-static std::unique_ptr<char[]> toCString(const NPString& string)
+static char* toCString(const NPString& string)
{
- size_t length = string.UTF8Length;
- std::unique_ptr<char[]> result(new char[length + 1]);
- if (!result)
- return result;
-
- memcpy(result.get(), string.UTF8Characters, length);
- result[length] = '\0';
+ char* result = static_cast<char*>(malloc(string.UTF8Length + 1));
+ memcpy(result, string.UTF8Characters, string.UTF8Length);
+ result[string.UTF8Length] = '\0';
return result;
}
@@ -795,27 +785,30 @@ static bool testPostURLFile(PluginObject* obj, const NPVariant* args, uint32_t a
return false;
NPString urlString = NPVARIANT_TO_STRING(args[0]);
- auto url = toCString(urlString);
+ char* url = toCString(urlString);
NPString targetString = NPVARIANT_TO_STRING(args[1]);
- auto target = toCString(targetString);
+ char* target = toCString(targetString);
NPString pathString = NPVARIANT_TO_STRING(args[2]);
- auto path = toCString(pathString);
+ char* path = toCString(pathString);
NPString contentsString = NPVARIANT_TO_STRING(args[3]);
- FILE* tempFile = fopen(path.get(), "w");
+ FILE* tempFile = fopen(path, "w");
if (!tempFile)
return false;
- size_t count = fwrite(contentsString.UTF8Characters, contentsString.UTF8Length, 1, tempFile);
+ if (!fwrite(contentsString.UTF8Characters, contentsString.UTF8Length, 1, tempFile))
+ return false;
+
fclose(tempFile);
- if (!count)
- return false;
+ NPError error = browser->posturl(obj->npp, url, target, pathString.UTF8Length, path, TRUE);
- NPError error = browser->posturl(obj->npp, url.get(), target.get(), pathString.UTF8Length, path.get(), TRUE);
+ free(path);
+ free(target);
+ free(url);
BOOLEAN_TO_NPVARIANT(error == NPERR_NO_ERROR, *result);
return true;
@@ -974,14 +967,15 @@ bool testWindowOpen(NPP npp)
static bool testSetStatus(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
{
- std::unique_ptr<char[]> message;
+ char* message = 0;
if (argCount && NPVARIANT_IS_STRING(args[0])) {
NPString statusString = NPVARIANT_TO_STRING(args[0]);
message = toCString(statusString);
}
+
+ browser->status(obj->npp, message);
- browser->status(obj->npp, message.get());
-
+ free(message);
return true;
}
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp
index da78148d4..c2195c5b1 100644
--- a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp
+++ b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp
@@ -28,9 +28,6 @@
#include "PluginObject.h"
#include <assert.h>
#include <string.h>
-#include <wtf/Platform.h>
-#include <wtf/ExportMacros.h>
-#include <wtf/Assertions.h>
#if defined(XP_UNIX) || defined(ANDROID)
#include <unistd.h>
@@ -136,11 +133,6 @@ bool PluginTest::NPP_URLNotify(const char* url, NPReason, void* notifyData)
return false;
}
-void PluginTest::NPP_URLRedirectNotify(const char*, int32_t, void* notifyData)
-{
- NPN_URLRedirectResponse(notifyData, true);
-}
-
NPError PluginTest::NPP_GetValue(NPPVariable variable, void *value)
{
// We don't know anything about plug-in values so just return NPERR_GENERIC_ERROR.
@@ -164,11 +156,6 @@ NPError PluginTest::NPN_GetURLNotify(const char *url, const char *target, void *
return browser->geturlnotify(m_npp, url, target, notifyData);
}
-NPError PluginTest::NPN_PostURLNotify(const char *url, const char *target, uint32_t len, const char* buf, NPBool file, void *notifyData)
-{
- return browser->posturlnotify(m_npp, url, target, len, buf, file, notifyData);
-}
-
NPError PluginTest::NPN_GetValue(NPNVariable variable, void* value)
{
return browser->getvalue(m_npp, variable, value);
@@ -241,11 +228,6 @@ void PluginTest::NPN_ReleaseVariantValue(NPVariant* variant)
browser->releasevariantvalue(variant);
}
-void PluginTest::NPN_URLRedirectResponse(void* notifyData, NPBool allow)
-{
- browser->urlredirectresponse(m_npp, notifyData, allow);
-}
-
#ifdef XP_MACOSX
bool PluginTest::NPN_ConvertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace)
{
@@ -272,7 +254,6 @@ void PluginTest::executeScript(const char* script)
browser->releasevariantvalue(&browserResult);
}
-WTF_ATTRIBUTE_PRINTF(2, 3)
void PluginTest::log(const char* format, ...)
{
va_list args;
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h
index d7a5163ff..f8a9aaee3 100644
--- a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h
+++ b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h
@@ -31,10 +31,6 @@
#include <map>
#include <string>
-#if defined(_MSC_VER) && _MSC_VER < 1900
-#define snprintf _snprintf
-#endif
-
// Helper classes for implementing has_member
typedef char (&no_tag)[1];
typedef char (&yes_tag)[2];
@@ -72,14 +68,12 @@ public:
virtual int16_t NPP_HandleEvent(void* event);
virtual bool NPP_URLNotify(const char* url, NPReason, void* notifyData);
- virtual void NPP_URLRedirectNotify(const char* url, int32_t status, void* notifyData);
virtual NPError NPP_GetValue(NPPVariable, void* value);
virtual NPError NPP_SetValue(NPNVariable, void *value);
// NPN functions.
NPError NPN_GetURL(const char* url, const char* target);
NPError NPN_GetURLNotify(const char* url, const char* target, void* notifyData);
- NPError NPN_PostURLNotify(const char *url, const char *target, uint32_t len, const char* buf, NPBool file, void *notifyData);
NPError NPN_GetValue(NPNVariable, void* value);
void NPN_InvalidateRect(NPRect* invalidRect);
bool NPN_Invoke(NPObject *, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result);
@@ -97,7 +91,6 @@ public:
void NPN_ReleaseObject(NPObject*);
bool NPN_RemoveProperty(NPObject*, NPIdentifier propertyName);
void NPN_ReleaseVariantValue(NPVariant*);
- void NPN_URLRedirectResponse(void* notifyData, NPBool allow);
#ifdef XP_MACOSX
bool NPN_ConvertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/EvaluateJSWithinNPP_New.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/EvaluateJSWithinNPP_New.cpp
deleted file mode 100644
index c066db59f..000000000
--- a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/EvaluateJSWithinNPP_New.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2012 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"
-
-#include "PluginObject.h"
-
-using namespace std;
-
-// Executing JS within NPP_New when initializing asynchronously should not be able to deadlock with the WebProcess
-
-class EvaluteJSWithinNPP_New : public PluginTest {
-public:
- EvaluteJSWithinNPP_New(NPP, const string& identifier);
-
-private:
- virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData *);
-
-};
-
-EvaluteJSWithinNPP_New::EvaluteJSWithinNPP_New(NPP npp, const string& identifier)
- : PluginTest(npp, identifier)
-{
-}
-
-NPError EvaluteJSWithinNPP_New::NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData *saved)
-{
- // Give the WebProcess enough time to be deadlocked waiting for the PluginProcess.
- usleep(15000);
- executeScript("var theLocation = window.location;");
- return NPERR_NO_ERROR;
-}
-
-static PluginTest::Register<EvaluteJSWithinNPP_New> registrar("evalute-js-within-npp-new");
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/InvokeDestroysPluginWithinNPP_New.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/InvokeDestroysPluginWithinNPP_New.cpp
deleted file mode 100644
index 0e2dbdce7..000000000
--- a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/InvokeDestroysPluginWithinNPP_New.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2012 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"
-
-#include "PluginObject.h"
-
-using namespace std;
-
-// Executing JS within NPP_New when initializing asynchronously should not be able to deadlock with the WebProcess
-
-class InvokeDestroysPluginWithinNPP_New : public PluginTest {
-public:
- InvokeDestroysPluginWithinNPP_New(NPP, const string& identifier);
-
-private:
- virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData *);
-
-};
-
-InvokeDestroysPluginWithinNPP_New::InvokeDestroysPluginWithinNPP_New(NPP npp, const string& identifier)
- : PluginTest(npp, identifier)
-{
-}
-
-NPError InvokeDestroysPluginWithinNPP_New::NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData *saved)
-{
- // Give the WebProcess enough time to be deadlocked waiting for the PluginProcess if things aren't working correctly.
- usleep(15000);
-
- NPObject* windowObject = 0;
- if (NPN_GetValue(NPNVWindowNPObject, &windowObject) != NPERR_NO_ERROR)
- return NPERR_GENERIC_ERROR;
-
- if (!windowObject)
- return NPERR_GENERIC_ERROR;
-
- NPVariant result;
- if (!NPN_Invoke(windowObject, NPN_GetStringIdentifier("removePluginElement"), 0, 0, &result))
- return NPERR_GENERIC_ERROR;
-
- return NPERR_NO_ERROR;
-}
-
-static PluginTest::Register<InvokeDestroysPluginWithinNPP_New> registrar("invoke-destroys-plugin-within-npp-new");
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableObjectOverridesAllProperties.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableObjectOverridesAllProperties.cpp
deleted file mode 100644
index ca399a816..000000000
--- a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableObjectOverridesAllProperties.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2012 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"
-
-#include <string.h>
-
-using namespace std;
-
-class PluginScriptableObjectOverridesAllProperties : public PluginTest {
-public:
- PluginScriptableObjectOverridesAllProperties(NPP npp, const string& identifier)
- : PluginTest(npp, identifier)
- {
- }
-
-private:
- class PluginObject : public Object<PluginObject> {
- public:
- PluginObject()
- {
- }
-
- ~PluginObject()
- {
- }
-
- bool hasProperty(NPIdentifier propertyName)
- {
- return true;
- }
-
- bool getProperty(NPIdentifier propertyName, NPVariant* result)
- {
- static const char* message = "My name is ";
- char* propertyString = pluginTest()->NPN_UTF8FromIdentifier(propertyName);
-
- int bufferLength = strlen(propertyString) + strlen(message) + 1;
- char* resultBuffer = static_cast<char*>(pluginTest()->NPN_MemAlloc(bufferLength));
- snprintf(resultBuffer, bufferLength, "%s%s", message, propertyString);
-
- STRINGZ_TO_NPVARIANT(resultBuffer, *result);
-
- return true;
- }
- };
-
- virtual NPError NPP_GetValue(NPPVariable variable, void *value)
- {
- if (variable != NPPVpluginScriptableNPObject)
- return NPERR_GENERIC_ERROR;
-
- *(NPObject**)value = PluginObject::create(this);
-
- return NPERR_NO_ERROR;
- }
-
-};
-
-static PluginTest::Register<PluginScriptableObjectOverridesAllProperties> pluginScriptableObjectOverridesAllProperties("plugin-scriptable-object-overrides-all-properties");
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/SlowNPPNew.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/SlowNPPNew.cpp
deleted file mode 100644
index 8c80d55a5..000000000
--- a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/SlowNPPNew.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2012 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"
-
-#include <string.h>
-
-using namespace std;
-
-class SlowNPPNew : public PluginTest {
-public:
- SlowNPPNew(NPP npp, const string& identifier)
- : PluginTest(npp, identifier)
- {
- }
-
-private:
- class PluginObject : public Object<PluginObject> {
- public:
- PluginObject()
- {
- }
-
- ~PluginObject()
- {
- }
-
- bool hasProperty(NPIdentifier propertyName)
- {
- return true;
- }
-
- bool getProperty(NPIdentifier propertyName, NPVariant* result)
- {
- static const char* message = "My name is ";
- char* propertyString = pluginTest()->NPN_UTF8FromIdentifier(propertyName);
-
- int bufferLength = strlen(propertyString) + strlen(message) + 1;
- char* resultBuffer = static_cast<char*>(pluginTest()->NPN_MemAlloc(bufferLength));
- snprintf(resultBuffer, bufferLength, "%s%s", message, propertyString);
-
- STRINGZ_TO_NPVARIANT(resultBuffer, *result);
-
- return true;
- }
- };
-
- virtual NPError NPP_GetValue(NPPVariable variable, void *value)
- {
- if (variable != NPPVpluginScriptableNPObject)
- return NPERR_GENERIC_ERROR;
-
- *(NPObject**)value = PluginObject::create(this);
-
- return NPERR_NO_ERROR;
- }
-
- virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData *saved)
- {
- usleep(550000);
- return NPERR_NO_ERROR;
- }
-};
-
-static PluginTest::Register<SlowNPPNew> slowNPPNew("slow-npp-new");
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/URLRedirect.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/URLRedirect.cpp
deleted file mode 100644
index b834703da..000000000
--- a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/URLRedirect.cpp
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (C) 2014 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"
-
-#include <string.h>
-
-using namespace std;
-
-class URLRedirect : public PluginTest {
-public:
- URLRedirect(NPP npp, const string& identifier)
- : PluginTest(npp, identifier)
- {
- }
-
- struct Redirect {
- int redirectsRemaining;
- bool async;
- bool hasFired;
- };
-
- std::map<void*, Redirect> redirects;
-
-private:
- // This is the test object.
- class TestObject : public Object<TestObject> { };
-
- // This is the scriptable object. It has a single "testObject" property and an "evaluate" function.
- class ScriptableObject : public Object<ScriptableObject> {
- public:
- bool hasMethod(NPIdentifier methodName)
- {
- return identifierIs(methodName, "get") || identifierIs(methodName, "getAsync") || identifierIs(methodName, "serviceAsync");
- }
-
- bool get(const NPVariant* args, uint32_t argCount, NPVariant* result, bool async)
- {
- if (argCount != 3 || !NPVARIANT_IS_STRING(args[0]) || !(NPVARIANT_IS_BOOLEAN(args[1]) || NPVARIANT_IS_DOUBLE(args[1]) || NPVARIANT_IS_INT32(args[1])) || !NPVARIANT_IS_STRING(args[2]))
- return false;
-
- const NPString* notifyString = &NPVARIANT_TO_STRING(args[2]);
- basic_string<NPUTF8> notify(notifyString->UTF8Characters, notifyString->UTF8Length);
- NPIdentifier notifyMethod = pluginTest()->NPN_GetStringIdentifier(notify.c_str());
-
- Redirect& redirect = static_cast<URLRedirect*>(pluginTest())->redirects[reinterpret_cast<void*>(notifyMethod)];
- if (NPVARIANT_IS_DOUBLE(args[1]))
- redirect.redirectsRemaining = NPVARIANT_TO_DOUBLE(args[1]);
- else if (NPVARIANT_IS_INT32(args[1]))
- redirect.redirectsRemaining = NPVARIANT_TO_INT32(args[1]);
- else if (NPVARIANT_IS_BOOLEAN(args[1]))
- redirect.redirectsRemaining = NPVARIANT_TO_BOOLEAN(args[1]);
- redirect.async = async;
- redirect.hasFired = true;
-
- const NPString* urlString = &NPVARIANT_TO_STRING(args[0]);
- basic_string<NPUTF8> url(urlString->UTF8Characters, urlString->UTF8Length);
-
- pluginTest()->NPN_GetURLNotify(url.c_str(), 0, reinterpret_cast<void*>(notifyMethod));
-
- VOID_TO_NPVARIANT(*result);
- return true;
- }
-
- bool serviceAsync(const NPVariant* args, uint32_t argCount, NPVariant* result)
- {
- if (argCount)
- return false;
-
- NPBool seen = 0;
- URLRedirect* plugin = static_cast<URLRedirect*>(pluginTest());
- for (auto& redirect : plugin->redirects) {
- if (redirect.second.hasFired)
- continue;
- redirect.second.hasFired = true;
- plugin->NPN_URLRedirectResponse(redirect.first, redirect.second.redirectsRemaining);
- if (redirect.second.redirectsRemaining)
- --redirect.second.redirectsRemaining;
- seen = 1;
- }
-
- BOOLEAN_TO_NPVARIANT(seen, *result);
- return true;
- }
-
- bool invoke(NPIdentifier methodName, const NPVariant* args, uint32_t argCount, NPVariant* result)
- {
- if (identifierIs(methodName, "get"))
- return get(args, argCount, result, false);
-
- if (identifierIs(methodName, "getAsync"))
- return get(args, argCount, result, true);
-
- if (identifierIs(methodName, "serviceAsync"))
- return serviceAsync(args, argCount, result);
-
- return false;
- }
- };
-
- virtual NPError NPP_GetValue(NPPVariable variable, void *value)
- {
- if (variable != NPPVpluginScriptableNPObject)
- return NPERR_GENERIC_ERROR;
-
- *(NPObject**)value = ScriptableObject::create(this);
-
- return NPERR_NO_ERROR;
- }
-
- virtual bool NPP_URLNotify(const char* url, NPReason reason, void* notifyData)
- {
- NPVariant args[2];
-
- NPObject* windowScriptObject;
- NPN_GetValue(NPNVWindowNPObject, &windowScriptObject);
-
- NPIdentifier callbackIdentifier = notifyData;
-
- INT32_TO_NPVARIANT(reason, args[0]);
- STRINGZ_TO_NPVARIANT(url, args[1]);
-
- NPVariant browserResult;
- if (NPN_Invoke(windowScriptObject, callbackIdentifier, args, 2, &browserResult))
- NPN_ReleaseVariantValue(&browserResult);
-
- return true;
- }
-
- virtual void NPP_URLRedirectNotify(const char*, int32_t, void* notifyData)
- {
- Redirect& redirect = redirects[notifyData];
- if (redirect.async) {
- redirect.hasFired = false;
- return;
- }
-
- NPN_URLRedirectResponse(notifyData, redirect.redirectsRemaining);
- if (redirect.redirectsRemaining)
- --redirect.redirectsRemaining;
- }
-};
-
-static PluginTest::Register<URLRedirect> urlRedirect("url-redirect");
-
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp
index 6a7303f13..85cd41d2c 100644
--- a/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp
+++ b/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp
@@ -41,17 +41,10 @@ extern "C" void GlobalToLocal(Point*);
using namespace std;
-#if defined(__GNUC__)
-#define CRASH() do { \
- *(int *)(uintptr_t)0xbbadbeef = 0; \
- __builtin_trap(); /* More reliable, but doesn't say BBADBEEF. */ \
-} while (false)
-#else
#define CRASH() do { \
*(int *)(uintptr_t)0xbbadbeef = 0; \
((void(*)())0)(); /* More reliable, but doesn't say BBADBEEF */ \
-} while (false)
-#endif
+} while(false)
static bool getEntryPointsWasCalled;
static bool initializeWasCalled;
@@ -123,7 +116,6 @@ NPError STDCALL NP_GetEntryPoints(NPPluginFuncs *pluginFuncs)
pluginFuncs->print = NPP_Print;
pluginFuncs->event = NPP_HandleEvent;
pluginFuncs->urlnotify = NPP_URLNotify;
- pluginFuncs->urlredirectnotify = NPP_URLRedirectNotify;
pluginFuncs->getvalue = NPP_GetValue;
pluginFuncs->setvalue = NPP_SetValue;
@@ -356,30 +348,29 @@ NPError NPP_SetWindow(NPP instance, NPWindow *window)
{
PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
- if (!obj)
- return NPERR_GENERIC_ERROR;
-
- obj->lastWindow = *window;
+ if (obj) {
+ obj->lastWindow = *window;
- if (obj->logSetWindow) {
- pluginLog(instance, "NPP_SetWindow: %d %d", (int)window->width, (int)window->height);
- obj->logSetWindow = FALSE;
- executeScript(obj, "testRunner.notifyDone();");
- }
+ if (obj->logSetWindow) {
+ pluginLog(instance, "NPP_SetWindow: %d %d", (int)window->width, (int)window->height);
+ obj->logSetWindow = FALSE;
+ executeScript(obj, "testRunner.notifyDone();");
+ }
- if (obj->onSetWindow)
- executeScript(obj, obj->onSetWindow);
+ if (obj->onSetWindow)
+ executeScript(obj, obj->onSetWindow);
- if (obj->testWindowOpen) {
- testWindowOpen(instance);
- obj->testWindowOpen = FALSE;
- }
+ if (obj->testWindowOpen) {
+ testWindowOpen(instance);
+ obj->testWindowOpen = FALSE;
+ }
- if (obj->testKeyboardFocusForPlugins) {
- obj->eventLogging = true;
- executeScript(obj, "eventSender.keyDown('A');");
+ if (obj->testKeyboardFocusForPlugins) {
+ obj->eventLogging = true;
+ executeScript(obj, "eventSender.keyDown('A');");
+ }
}
-
+
return obj->pluginTest->NPP_SetWindow(window);
}
@@ -808,12 +799,6 @@ void NPP_URLNotify(NPP instance, const char *url, NPReason reason, void *notifyD
handleCallback(obj, url, reason, notifyData);
}
-void NPP_URLRedirectNotify(NPP instance, const char *url, int32_t status, void *notifyData)
-{
- PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
- obj->pluginTest->NPP_URLRedirectNotify(url, status, notifyData);
-}
-
NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
{
#ifdef XP_UNIX
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/ForwardingHeaders/WebKit/npapi.h b/Tools/DumpRenderTree/TestNetscapePlugIn/unix/ForwardingHeaders/WebKit/npapi.h
index 627bc97a9..627bc97a9 100644
--- a/Tools/DumpRenderTree/TestNetscapePlugIn/ForwardingHeaders/WebKit/npapi.h
+++ b/Tools/DumpRenderTree/TestNetscapePlugIn/unix/ForwardingHeaders/WebKit/npapi.h
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/ForwardingHeaders/WebKit/npfunctions.h b/Tools/DumpRenderTree/TestNetscapePlugIn/unix/ForwardingHeaders/WebKit/npfunctions.h
index 54a603dbb..54a603dbb 100644
--- a/Tools/DumpRenderTree/TestNetscapePlugIn/ForwardingHeaders/WebKit/npfunctions.h
+++ b/Tools/DumpRenderTree/TestNetscapePlugIn/unix/ForwardingHeaders/WebKit/npfunctions.h
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/ForwardingHeaders/WebKit/npruntime.h b/Tools/DumpRenderTree/TestNetscapePlugIn/unix/ForwardingHeaders/WebKit/npruntime.h
index e435ae2ab..e435ae2ab 100644
--- a/Tools/DumpRenderTree/TestNetscapePlugIn/ForwardingHeaders/WebKit/npruntime.h
+++ b/Tools/DumpRenderTree/TestNetscapePlugIn/unix/ForwardingHeaders/WebKit/npruntime.h