summaryrefslogtreecommitdiffstats
path: root/WebKitTools/DumpRenderTree/TestNetscapePlugIn
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-05 14:36:32 +0100
committerBen Murdoch <benm@google.com>2011-05-10 15:38:30 +0100
commitf05b935882198ccf7d81675736e3aeb089c5113a (patch)
tree4ea0ca838d9ef1b15cf17ddb3928efb427c7e5a1 /WebKitTools/DumpRenderTree/TestNetscapePlugIn
parent60fbdcc62bced8db2cb1fd233cc4d1e4ea17db1b (diff)
downloadexternal_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.zip
external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.gz
external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.bz2
Merge WebKit at r74534: Initial merge by git.
Change-Id: I6ccd1154fa1b19c2ec2a66878eb675738735f1eb
Diffstat (limited to 'WebKitTools/DumpRenderTree/TestNetscapePlugIn')
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp1244
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h96
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObjectMac.mm102
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp140
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h221
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/TestObject.cpp209
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/TestObject.h30
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp56
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/EvaluateJSAfterRemovingPluginElement.cpp64
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp72
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp89
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NullNPPGetValuePointer.cpp70
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PassDifferentNPPStruct.cpp70
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp68
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/DrawsGradient.cpp118
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/GetValueNetscapeWindow.cpp73
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp188
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowGeometryInitializedBeforeSetWindow.cpp90
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowRegionIsSetToClipRect.cpp114
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/mac/Info.plist60
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp718
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.def6
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.rc101
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj505
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginCommon.vsprops27
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin_debug.def6
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.cpp71
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.h50
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/resource.h14
29 files changed, 0 insertions, 4672 deletions
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
deleted file mode 100644
index 198d3c5..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
+++ /dev/null
@@ -1,1244 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2009 Holger Hans Peter Freyther
- * Copyright (C) 2010 Collabora Ltd.
- *
- * 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. ``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
- * 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 "PluginObject.h"
-
-#include "PluginTest.h"
-#include "TestObject.h"
-#include <assert.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.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)
-{
- NPVariant consoleVariant;
- if (!browser->getproperty(instance, windowObject, browser->getstringidentifier("console"), &consoleVariant)) {
- fprintf(stderr, "Failed to retrieve console object while logging: %s\n", message);
- return;
- }
-
- NPObject* consoleObject = NPVARIANT_TO_OBJECT(consoleVariant);
-
- NPVariant messageVariant;
- STRINGZ_TO_NPVARIANT(message, messageVariant);
-
- NPVariant result;
- if (!browser->invoke(instance, consoleObject, browser->getstringidentifier("log"), &messageVariant, 1, &result)) {
- fprintf(stderr, "Failed to invoke console.log while logging: %s\n", message);
- browser->releaseobject(consoleObject);
- return;
- }
-
- browser->releasevariantvalue(&result);
- browser->releaseobject(consoleObject);
-}
-
-// Helper function which takes in the plugin window object for logging to the console object. This function supports variable
-// arguments.
-static void pluginLogWithWindowObjectVariableArgs(NPObject* windowObject, NPP instance, const char* format, ...)
-{
- va_list args;
- va_start(args, format);
- char message[2048] = "PLUGIN: ";
- vsprintf(message + strlen(message), format, args);
- va_end(args);
-
- pluginLogWithWindowObject(windowObject, instance, message);
-}
-
-// Helper function to log to the console object.
-void pluginLog(NPP instance, const char* format, ...)
-{
- va_list args;
- va_start(args, format);
- char message[2048] = "PLUGIN: ";
- vsprintf(message + strlen(message), format, args);
- va_end(args);
-
- NPObject* windowObject = 0;
- NPError error = browser->getvalue(instance, NPNVWindowNPObject, &windowObject);
- if (error != NPERR_NO_ERROR) {
- fprintf(stderr, "Failed to retrieve window object while logging: %s\n", message);
- return;
- }
-
- pluginLogWithWindowObject(windowObject, instance, message);
- browser->releaseobject(windowObject);
-}
-
-static void pluginInvalidate(NPObject*);
-static bool pluginHasProperty(NPObject*, NPIdentifier name);
-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 NPObject* pluginAllocate(NPP npp, NPClass*);
-static void pluginDeallocate(NPObject*);
-
-NPNetscapeFuncs* browser;
-NPPluginFuncs* pluginFunctions;
-
-static NPClass pluginClass = {
- NP_CLASS_STRUCT_VERSION,
- pluginAllocate,
- pluginDeallocate,
- pluginInvalidate,
- pluginHasMethod,
- pluginInvoke,
- 0, // NPClass::invokeDefault,
- pluginHasProperty,
- pluginGetProperty,
- pluginSetProperty,
- 0, // NPClass::removeProperty
- 0, // NPClass::enumerate
- 0, // NPClass::construct
-};
-
-NPClass* getPluginClass(void)
-{
- return &pluginClass;
-}
-
-static bool identifiersInitialized = false;
-
-enum {
- ID_PROPERTY_PROPERTY = 0,
- ID_PROPERTY_EVENT_LOGGING,
- ID_PROPERTY_HAS_STREAM,
- ID_PROPERTY_TEST_OBJECT,
- ID_PROPERTY_LOG_DESTROY,
- ID_PROPERTY_RETURN_ERROR_FROM_NEWSTREAM,
- ID_PROPERTY_RETURN_NEGATIVE_ONE_FROM_WRITE,
- ID_PROPERTY_PRIVATE_BROWSING_ENABLED,
- ID_PROPERTY_CACHED_PRIVATE_BROWSING_ENABLED,
- ID_PROPERTY_THROW_EXCEPTION_PROPERTY,
- ID_LAST_SET_WINDOW_ARGUMENTS,
- ID_PROPERTY_WINDOWED_PLUGIN,
- ID_PROPERTY_TEST_OBJECT_COUNT,
- NUM_PROPERTY_IDENTIFIERS
-};
-
-static NPIdentifier pluginPropertyIdentifiers[NUM_PROPERTY_IDENTIFIERS];
-static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = {
- "property",
- "eventLoggingEnabled",
- "hasStream",
- "testObject",
- "logDestroy",
- "returnErrorFromNewStream",
- "returnNegativeOneFromWrite",
- "privateBrowsingEnabled",
- "cachedPrivateBrowsingEnabled",
- "testThrowExceptionProperty",
- "lastSetWindowArguments",
- "windowedPlugin",
- "testObjectCount",
-};
-
-enum {
- ID_TEST_CALLBACK_METHOD = 0,
- ID_TEST_CALLBACK_METHOD_RETURN,
- ID_TEST_GETURL,
- ID_TEST_DOM_ACCESS,
- ID_TEST_GET_URL_NOTIFY,
- ID_TEST_INVOKE_DEFAULT,
- ID_DESTROY_STREAM,
- ID_TEST_ENUMERATE,
- ID_TEST_GETINTIDENTIFIER,
- ID_TEST_GET_PROPERTY,
- ID_TEST_HAS_PROPERTY,
- ID_TEST_HAS_METHOD,
- ID_TEST_EVALUATE,
- ID_TEST_GET_PROPERTY_RETURN_VALUE,
- ID_TEST_IDENTIFIER_TO_STRING,
- ID_TEST_IDENTIFIER_TO_INT,
- ID_TEST_PASS_TEST_OBJECT,
- ID_TEST_POSTURL_FILE,
- ID_TEST_CONSTRUCT,
- ID_TEST_THROW_EXCEPTION_METHOD,
- ID_TEST_FAIL_METHOD,
- ID_TEST_CLONE_OBJECT,
- ID_TEST_SCRIPT_OBJECT_INVOKE,
- ID_TEST_CREATE_TEST_OBJECT,
- ID_DESTROY_NULL_STREAM,
- ID_TEST_RELOAD_PLUGINS_NO_PAGES,
- ID_TEST_RELOAD_PLUGINS_AND_PAGES,
- ID_TEST_GET_BROWSER_PROPERTY,
- ID_TEST_SET_BROWSER_PROPERTY,
- ID_REMEMBER,
- ID_GET_REMEMBERED_OBJECT,
- ID_GET_AND_FORGET_REMEMBERED_OBJECT,
- ID_REF_COUNT,
- ID_SET_STATUS,
- ID_RESIZE_TO,
- ID_NORMALIZE,
- NUM_METHOD_IDENTIFIERS
-};
-
-static NPIdentifier pluginMethodIdentifiers[NUM_METHOD_IDENTIFIERS];
-static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
- "testCallback",
- "testCallbackReturn",
- "getURL",
- "testDOMAccess",
- "getURLNotify",
- "testInvokeDefault",
- "destroyStream",
- "testEnumerate",
- "testGetIntIdentifier",
- "testGetProperty",
- "testHasProperty",
- "testHasMethod",
- "testEvaluate",
- "testGetPropertyReturnValue",
- "testIdentifierToString",
- "testIdentifierToInt",
- "testPassTestObject",
- "testPostURLFile",
- "testConstruct",
- "testThrowException",
- "testFail",
- "testCloneObject",
- "testScriptObjectInvoke",
- "testCreateTestObject",
- "destroyNullStream",
- "reloadPluginsNoPages",
- "reloadPluginsAndPages",
- "testGetBrowserProperty",
- "testSetBrowserProperty",
- "remember",
- "getRememberedObject",
- "getAndForgetRememberedObject",
- "refCount",
- "setStatus",
- "resizeTo",
- "normalize"
-};
-
-static NPUTF8* createCStringFromNPVariant(const NPVariant* variant)
-{
- size_t length = NPVARIANT_TO_STRING(*variant).UTF8Length;
- NPUTF8* result = (NPUTF8*)malloc(length + 1);
- memcpy(result, NPVARIANT_TO_STRING(*variant).UTF8Characters, length);
- result[length] = '\0';
- return result;
-}
-
-static void initializeIdentifiers(void)
-{
- browser->getstringidentifiers(pluginPropertyIdentifierNames, NUM_PROPERTY_IDENTIFIERS, pluginPropertyIdentifiers);
- browser->getstringidentifiers(pluginMethodIdentifierNames, NUM_METHOD_IDENTIFIERS, pluginMethodIdentifiers);
-}
-
-static bool pluginHasProperty(NPObject *obj, NPIdentifier name)
-{
- for (int i = 0; i < NUM_PROPERTY_IDENTIFIERS; i++)
- if (name == pluginPropertyIdentifiers[i])
- return true;
- return false;
-}
-
-static bool pluginHasMethod(NPObject *obj, NPIdentifier name)
-{
- for (int i = 0; i < NUM_METHOD_IDENTIFIERS; i++)
- if (name == pluginMethodIdentifiers[i])
- return true;
- return false;
-}
-
-static bool pluginGetProperty(NPObject* obj, NPIdentifier name, NPVariant* result)
-{
- PluginObject* plugin = reinterpret_cast<PluginObject*>(obj);
- if (name == pluginPropertyIdentifiers[ID_PROPERTY_PROPERTY]) {
- static const char* originalString = "property";
- char* buf = static_cast<char*>(browser->memalloc(strlen(originalString) + 1));
- strcpy(buf, originalString);
- STRINGZ_TO_NPVARIANT(buf, *result);
- return true;
- }
- if (name == pluginPropertyIdentifiers[ID_PROPERTY_EVENT_LOGGING]) {
- BOOLEAN_TO_NPVARIANT(plugin->eventLogging, *result);
- return true;
- }
- if (name == pluginPropertyIdentifiers[ID_PROPERTY_LOG_DESTROY]) {
- BOOLEAN_TO_NPVARIANT(plugin->logDestroy, *result);
- return true;
- }
- if (name == pluginPropertyIdentifiers[ID_PROPERTY_HAS_STREAM]) {
- BOOLEAN_TO_NPVARIANT(plugin->stream, *result);
- return true;
- }
- if (name == pluginPropertyIdentifiers[ID_PROPERTY_TEST_OBJECT]) {
- NPObject* testObject = plugin->testObject;
- browser->retainobject(testObject);
- OBJECT_TO_NPVARIANT(testObject, *result);
- return true;
- }
- if (name == pluginPropertyIdentifiers[ID_PROPERTY_RETURN_ERROR_FROM_NEWSTREAM]) {
- BOOLEAN_TO_NPVARIANT(plugin->returnErrorFromNewStream, *result);
- return true;
- }
- if (name == pluginPropertyIdentifiers[ID_PROPERTY_RETURN_NEGATIVE_ONE_FROM_WRITE]) {
- BOOLEAN_TO_NPVARIANT(plugin->returnNegativeOneFromWrite, *result);
- return true;
- }
- if (name == pluginPropertyIdentifiers[ID_PROPERTY_PRIVATE_BROWSING_ENABLED]) {
- NPBool privateBrowsingEnabled = FALSE;
- browser->getvalue(plugin->npp, NPNVprivateModeBool, &privateBrowsingEnabled);
- BOOLEAN_TO_NPVARIANT(privateBrowsingEnabled, *result);
- return true;
- }
- if (name == pluginPropertyIdentifiers[ID_PROPERTY_CACHED_PRIVATE_BROWSING_ENABLED]) {
- BOOLEAN_TO_NPVARIANT(plugin->cachedPrivateBrowsingMode, *result);
- return true;
- }
- if (name == pluginPropertyIdentifiers[ID_PROPERTY_THROW_EXCEPTION_PROPERTY]) {
- browser->setexception(obj, "plugin object testThrowExceptionProperty SUCCESS");
- return true;
- }
- if (name == pluginPropertyIdentifiers[ID_LAST_SET_WINDOW_ARGUMENTS]) {
- char* buf = static_cast<char*>(browser->memalloc(256));
- snprintf(buf, 256, "x: %d, y: %d, width: %u, height: %u, clipRect: (%u, %u, %u, %u)", (int)plugin->lastWindow.x, (int)plugin->lastWindow.y, (unsigned)plugin->lastWindow.width, (unsigned)plugin->lastWindow.height,
- plugin->lastWindow.clipRect.left, plugin->lastWindow.clipRect.top, plugin->lastWindow.clipRect.right - plugin->lastWindow.clipRect.left, plugin->lastWindow.clipRect.bottom - plugin->lastWindow.clipRect.top);
-
- STRINGZ_TO_NPVARIANT(buf, *result);
- return true;
- }
- if (name == pluginPropertyIdentifiers[ID_PROPERTY_TEST_OBJECT_COUNT]) {
- INT32_TO_NPVARIANT(getTestObjectCount(), *result);
- return true;
- }
-
- return false;
-}
-
-static bool pluginSetProperty(NPObject* obj, NPIdentifier name, const NPVariant* variant)
-{
- PluginObject* plugin = reinterpret_cast<PluginObject*>(obj);
- if (name == pluginPropertyIdentifiers[ID_PROPERTY_EVENT_LOGGING]) {
- plugin->eventLogging = NPVARIANT_TO_BOOLEAN(*variant);
- return true;
- }
- if (name == pluginPropertyIdentifiers[ID_PROPERTY_LOG_DESTROY]) {
- plugin->logDestroy = NPVARIANT_TO_BOOLEAN(*variant);
- return true;
- }
- if (name == pluginPropertyIdentifiers[ID_PROPERTY_RETURN_ERROR_FROM_NEWSTREAM]) {
- plugin->returnErrorFromNewStream = NPVARIANT_TO_BOOLEAN(*variant);
- return true;
- }
- if (name == pluginPropertyIdentifiers[ID_PROPERTY_RETURN_NEGATIVE_ONE_FROM_WRITE]) {
- plugin->returnNegativeOneFromWrite = NPVARIANT_TO_BOOLEAN(*variant);
- return true;
- }
- if (name == pluginPropertyIdentifiers[ID_PROPERTY_THROW_EXCEPTION_PROPERTY]) {
- browser->setexception(obj, "plugin object testThrowExceptionProperty SUCCESS");
- return true;
- }
- if (name == pluginPropertyIdentifiers[ID_PROPERTY_WINDOWED_PLUGIN]) {
- browser->setvalue(plugin->npp, NPPVpluginWindowBool, (void *)NPVARIANT_TO_BOOLEAN(*variant));
- return true;
- }
-
- return false;
-}
-
-static bool testDOMAccess(PluginObject* obj, const NPVariant*, uint32_t, NPVariant* result)
-{
- // Get plug-in's DOM element
- NPObject* elementObject;
- if (browser->getvalue(obj->npp, NPNVPluginElementNPObject, &elementObject) == NPERR_NO_ERROR) {
- // Get style
- NPVariant styleVariant;
- NPIdentifier styleIdentifier = browser->getstringidentifier("style");
- if (browser->getproperty(obj->npp, elementObject, styleIdentifier, &styleVariant) && NPVARIANT_IS_OBJECT(styleVariant)) {
- // Set style.border
- NPIdentifier borderIdentifier = browser->getstringidentifier("border");
- NPVariant borderVariant;
- STRINGZ_TO_NPVARIANT("3px solid red", borderVariant);
- browser->setproperty(obj->npp, NPVARIANT_TO_OBJECT(styleVariant), borderIdentifier, &borderVariant);
- browser->releasevariantvalue(&styleVariant);
- }
-
- browser->releaseobject(elementObject);
- }
- VOID_TO_NPVARIANT(*result);
- return true;
-}
-
-static NPIdentifier stringVariantToIdentifier(NPVariant variant)
-{
- assert(NPVARIANT_IS_STRING(variant));
- NPUTF8* utf8String = createCStringFromNPVariant(&variant);
- NPIdentifier identifier = browser->getstringidentifier(utf8String);
- free(utf8String);
- return identifier;
-}
-
-static NPIdentifier int32VariantToIdentifier(NPVariant variant)
-{
- assert(NPVARIANT_IS_INT32(variant));
- int32_t integer = NPVARIANT_TO_INT32(variant);
- return browser->getintidentifier(integer);
-}
-
-static NPIdentifier doubleVariantToIdentifier(NPVariant variant)
-{
- assert(NPVARIANT_IS_DOUBLE(variant));
- double value = NPVARIANT_TO_DOUBLE(variant);
- // Sadly there is no "getdoubleidentifier"
- int32_t integer = static_cast<int32_t>(value);
- return browser->getintidentifier(integer);
-}
-
-static NPIdentifier variantToIdentifier(NPVariant variant)
-{
- if (NPVARIANT_IS_STRING(variant))
- return stringVariantToIdentifier(variant);
- if (NPVARIANT_IS_INT32(variant))
- return int32VariantToIdentifier(variant);
- if (NPVARIANT_IS_DOUBLE(variant))
- return doubleVariantToIdentifier(variant);
- return 0;
-}
-
-static bool testIdentifierToString(PluginObject*, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- if (argCount != 1)
- return true;
- NPIdentifier identifier = variantToIdentifier(args[0]);
- if (!identifier)
- return true;
- NPUTF8* utf8String = browser->utf8fromidentifier(identifier);
- if (!utf8String)
- return true;
- STRINGZ_TO_NPVARIANT(utf8String, *result);
- return true;
-}
-
-static bool testIdentifierToInt(PluginObject*, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- if (argCount != 1)
- return false;
- NPIdentifier identifier = variantToIdentifier(args[0]);
- if (!identifier)
- return false;
- int32_t integer = browser->intfromidentifier(identifier);
- INT32_TO_NPVARIANT(integer, *result);
- return true;
-}
-
-static bool testPassTestObject(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- if (argCount != 2 || !NPVARIANT_IS_STRING(args[0]))
- return false;
-
- NPObject* windowScriptObject;
- browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject);
-
- NPUTF8* callbackString = createCStringFromNPVariant(&args[0]);
- NPIdentifier callbackIdentifier = browser->getstringidentifier(callbackString);
- free(callbackString);
-
- NPVariant browserResult;
- browser->invoke(obj->npp, windowScriptObject, callbackIdentifier, &args[1], 1, &browserResult);
- browser->releasevariantvalue(&browserResult);
-
- VOID_TO_NPVARIANT(*result);
- return true;
-}
-
-static bool testCallback(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- if (!argCount || !NPVARIANT_IS_STRING(args[0]))
- return false;
-
- NPObject* windowScriptObject;
- browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject);
-
- NPUTF8* callbackString = createCStringFromNPVariant(&args[0]);
- NPIdentifier callbackIdentifier = browser->getstringidentifier(callbackString);
- free(callbackString);
-
- NPVariant browserResult;
- if (browser->invoke(obj->npp, windowScriptObject, callbackIdentifier, 0, 0, &browserResult))
- browser->releasevariantvalue(&browserResult);
-
- browser->releaseobject(windowScriptObject);
-
- VOID_TO_NPVARIANT(*result);
- return true;
-}
-
-static bool testCallbackReturn(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- if (argCount != 1 || !NPVARIANT_IS_STRING(args[0]))
- return false;
-
- NPObject* windowScriptObject;
- browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject);
-
- NPUTF8* callbackString = createCStringFromNPVariant(&args[0]);
- NPIdentifier callbackIdentifier = browser->getstringidentifier(callbackString);
- free(callbackString);
-
- NPVariant callbackArgs[1];
- OBJECT_TO_NPVARIANT(windowScriptObject, callbackArgs[0]);
-
- NPVariant browserResult;
- browser->invoke(obj->npp, windowScriptObject, callbackIdentifier,
- callbackArgs, 1, &browserResult);
-
- if (NPVARIANT_IS_OBJECT(browserResult))
- OBJECT_TO_NPVARIANT(NPVARIANT_TO_OBJECT(browserResult), *result);
- else {
- browser->releasevariantvalue(&browserResult);
- VOID_TO_NPVARIANT(*result);
- }
-
- return true;
-}
-
-static bool getURL(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- if (argCount == 2 && NPVARIANT_IS_STRING(args[0]) && NPVARIANT_IS_STRING(args[1])) {
- NPUTF8* urlString = createCStringFromNPVariant(&args[0]);
- NPUTF8* targetString = createCStringFromNPVariant(&args[1]);
- NPError npErr = browser->geturl(obj->npp, urlString, targetString);
- free(urlString);
- free(targetString);
-
- INT32_TO_NPVARIANT(npErr, *result);
- return true;
- }
- if (argCount == 1 && NPVARIANT_IS_STRING(args[0])) {
- NPUTF8* urlString = createCStringFromNPVariant(&args[0]);
- NPError npErr = browser->geturl(obj->npp, urlString, 0);
- free(urlString);
-
- INT32_TO_NPVARIANT(npErr, *result);
- return true;
- }
- return false;
-}
-
-static bool getURLNotify(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- if (argCount != 3 || !NPVARIANT_IS_STRING(args[0])
- || (!NPVARIANT_IS_STRING(args[1]) && !NPVARIANT_IS_NULL(args[1]))
- || !NPVARIANT_IS_STRING(args[2]))
- return false;
-
- NPUTF8* urlString = createCStringFromNPVariant(&args[0]);
- NPUTF8* targetString = (NPVARIANT_IS_STRING(args[1]) ? createCStringFromNPVariant(&args[1]) : 0);
- NPUTF8* callbackString = createCStringFromNPVariant(&args[2]);
-
- NPIdentifier callbackIdentifier = browser->getstringidentifier(callbackString);
- browser->geturlnotify(obj->npp, urlString, targetString, callbackIdentifier);
-
- free(urlString);
- free(targetString);
- free(callbackString);
-
- VOID_TO_NPVARIANT(*result);
- return true;
-}
-
-static bool testInvokeDefault(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- if (!NPVARIANT_IS_OBJECT(args[0]))
- return false;
-
- NPObject* callback = NPVARIANT_TO_OBJECT(args[0]);
-
- NPVariant invokeArgs[1];
- NPVariant browserResult;
-
- STRINGZ_TO_NPVARIANT("test", invokeArgs[0]);
- bool retval = browser->invokeDefault(obj->npp, callback, invokeArgs, 1, &browserResult);
-
- if (retval)
- browser->releasevariantvalue(&browserResult);
-
- BOOLEAN_TO_NPVARIANT(retval, *result);
- return true;
-}
-
-static bool destroyStream(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- NPError npError = browser->destroystream(obj->npp, obj->stream, NPRES_USER_BREAK);
- INT32_TO_NPVARIANT(npError, *result);
- return true;
-}
-
-static bool destroyNullStream(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- NPError npError = browser->destroystream(obj->npp, 0, NPRES_USER_BREAK);
- INT32_TO_NPVARIANT(npError, *result);
- return true;
-}
-
-static bool testEnumerate(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- if (argCount != 2 || !NPVARIANT_IS_OBJECT(args[0]) || !NPVARIANT_IS_OBJECT(args[1]))
- return false;
-
- uint32_t count;
- NPIdentifier* identifiers;
- if (browser->enumerate(obj->npp, NPVARIANT_TO_OBJECT(args[0]), &identifiers, &count)) {
- NPObject* outArray = NPVARIANT_TO_OBJECT(args[1]);
- NPIdentifier pushIdentifier = browser->getstringidentifier("push");
-
- for (uint32_t i = 0; i < count; i++) {
- NPUTF8* string = browser->utf8fromidentifier(identifiers[i]);
-
- if (!string)
- continue;
-
- NPVariant args[1];
- STRINGZ_TO_NPVARIANT(string, args[0]);
- NPVariant browserResult;
- if (browser->invoke(obj->npp, outArray, pushIdentifier, args, 1, &browserResult))
- browser->releasevariantvalue(&browserResult);
- browser->memfree(string);
- }
-
- browser->memfree(identifiers);
- }
-
- VOID_TO_NPVARIANT(*result);
- return true;
-}
-
-static bool testGetIntIdentifier(PluginObject*, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- if (argCount != 1 || !NPVARIANT_IS_DOUBLE(args[0]))
- return false;
-
- NPIdentifier identifier = browser->getintidentifier((int)NPVARIANT_TO_DOUBLE(args[0]));
- INT32_TO_NPVARIANT((int32_t)(long long)identifier, *result);
- return true;
-}
-
-static bool testGetProperty(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- if (!argCount)
- return false;
-
- NPObject* object;
- browser->getvalue(obj->npp, NPNVWindowNPObject, &object);
-
- for (uint32_t i = 0; i < argCount; i++) {
- assert(NPVARIANT_IS_STRING(args[i]));
- NPUTF8* propertyString = createCStringFromNPVariant(&args[i]);
- NPIdentifier propertyIdentifier = browser->getstringidentifier(propertyString);
- free(propertyString);
-
- NPVariant variant;
- bool retval = browser->getproperty(obj->npp, object, propertyIdentifier, &variant);
- browser->releaseobject(object);
-
- if (!retval)
- break;
-
- if (i + 1 < argCount) {
- assert(NPVARIANT_IS_OBJECT(variant));
- object = NPVARIANT_TO_OBJECT(variant);
- } else {
- *result = variant;
- return true;
- }
- }
-
- VOID_TO_NPVARIANT(*result);
- return false;
-}
-
-static bool testHasProperty(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- if (argCount != 2 || !NPVARIANT_IS_OBJECT(args[0]) || !NPVARIANT_IS_STRING(args[1]))
- return false;
-
- NPUTF8* propertyString = createCStringFromNPVariant(&args[1]);
- NPIdentifier propertyIdentifier = browser->getstringidentifier(propertyString);
- free(propertyString);
-
- bool retval = browser->hasproperty(obj->npp, NPVARIANT_TO_OBJECT(args[0]), propertyIdentifier);
-
- BOOLEAN_TO_NPVARIANT(retval, *result);
- return true;
-}
-
-static bool testHasMethod(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- if (argCount != 2 || !NPVARIANT_IS_OBJECT(args[0]) || !NPVARIANT_IS_STRING(args[1]))
- return false;
-
- NPUTF8* propertyString = createCStringFromNPVariant(&args[1]);
- NPIdentifier propertyIdentifier = browser->getstringidentifier(propertyString);
- free(propertyString);
-
- bool retval = browser->hasmethod(obj->npp, NPVARIANT_TO_OBJECT(args[0]), propertyIdentifier);
-
- BOOLEAN_TO_NPVARIANT(retval, *result);
- return true;
-}
-
-static bool testEvaluate(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- if (argCount != 1 || !NPVARIANT_IS_STRING(args[0]))
- return false;
- NPObject* windowScriptObject;
- browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject);
-
- NPString s = NPVARIANT_TO_STRING(args[0]);
-
- bool retval = browser->evaluate(obj->npp, windowScriptObject, &s, result);
- browser->releaseobject(windowScriptObject);
- return retval;
-}
-
-static bool testGetPropertyReturnValue(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- if (argCount != 2 || !NPVARIANT_IS_OBJECT(args[0]) || !NPVARIANT_IS_STRING(args[1]))
- return false;
-
- NPUTF8* propertyString = createCStringFromNPVariant(&args[1]);
- NPIdentifier propertyIdentifier = browser->getstringidentifier(propertyString);
- free(propertyString);
-
- NPVariant variant;
- bool retval = browser->getproperty(obj->npp, NPVARIANT_TO_OBJECT(args[0]), propertyIdentifier, &variant);
- if (retval)
- browser->releasevariantvalue(&variant);
-
- BOOLEAN_TO_NPVARIANT(retval, *result);
- return true;
-}
-
-static char* toCString(const NPString& string)
-{
- char* result = static_cast<char*>(malloc(string.UTF8Length + 1));
- memcpy(result, string.UTF8Characters, string.UTF8Length);
- result[string.UTF8Length] = '\0';
-
- return result;
-}
-
-static bool testPostURLFile(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- if (argCount != 4 || !NPVARIANT_IS_STRING(args[0]) || !NPVARIANT_IS_STRING(args[1]) || !NPVARIANT_IS_STRING(args[2]) || !NPVARIANT_IS_STRING(args[3]))
- return false;
-
- NPString urlString = NPVARIANT_TO_STRING(args[0]);
- char* url = toCString(urlString);
-
- NPString targetString = NPVARIANT_TO_STRING(args[1]);
- char* target = toCString(targetString);
-
- NPString pathString = NPVARIANT_TO_STRING(args[2]);
- char* path = toCString(pathString);
-
- NPString contentsString = NPVARIANT_TO_STRING(args[3]);
-
- FILE* tempFile = fopen(path, "w");
- if (!tempFile)
- return false;
-
- if (!fwrite(contentsString.UTF8Characters, contentsString.UTF8Length, 1, tempFile))
- return false;
-
- fclose(tempFile);
-
- NPError error = browser->posturl(obj->npp, url, target, pathString.UTF8Length, path, TRUE);
-
- free(path);
- free(target);
- free(url);
-
- BOOLEAN_TO_NPVARIANT(error == NPERR_NO_ERROR, *result);
- return true;
-}
-
-static bool testConstruct(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- if (!argCount || !NPVARIANT_IS_OBJECT(args[0]))
- return false;
-
- return browser->construct(obj->npp, NPVARIANT_TO_OBJECT(args[0]), args + 1, argCount - 1, result);
-}
-
-// Invoke a script callback to get a script NPObject. Then call a method on the
-// script NPObject passing it a freshly created NPObject.
-static bool testScriptObjectInvoke(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- if (argCount != 2 || !NPVARIANT_IS_STRING(args[0]) || !NPVARIANT_IS_STRING(args[1]))
- return false;
- NPObject* windowScriptObject;
- browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject);
-
- // Arg1 is the name of the callback
- NPUTF8* callbackString = createCStringFromNPVariant(&args[0]);
- NPIdentifier callbackIdentifier = browser->getstringidentifier(callbackString);
- free(callbackString);
-
- // Invoke a callback that returns a script object
- NPVariant object_result;
- browser->invoke(obj->npp, windowScriptObject, callbackIdentifier, &args[1], 1, &object_result);
-
- // Script object returned
- NPObject* script_object = object_result.value.objectValue;
-
- // Arg2 is the name of the method to be called on the script object
- NPUTF8* object_mehod_string = createCStringFromNPVariant(&args[1]);
- NPIdentifier object_method = browser->getstringidentifier(object_mehod_string);
- free(object_mehod_string);
-
- // Create a fresh NPObject to be passed as an argument
- NPObject* object_arg = browser->createobject(obj->npp, &pluginClass);
- NPVariant invoke_args[1];
- OBJECT_TO_NPVARIANT(object_arg, invoke_args[0]);
-
- // Invoke the script method
- NPVariant object_method_result;
- browser->invoke(obj->npp, script_object, object_method, invoke_args, 1, &object_method_result);
-
- browser->releasevariantvalue(&object_result);
- VOID_TO_NPVARIANT(*result);
- if (NPVARIANT_IS_OBJECT(object_method_result)) {
- // Now return the callbacks return value back to our caller.
- // BUG 897451: This should be the same as the
- // windowScriptObject, but its not (in Chrome) - or at least, it
- // has a different refcount. This means Chrome will delete the
- // object before returning it and the calling JS gets a garbage
- // value. Firefox handles it fine.
- OBJECT_TO_NPVARIANT(NPVARIANT_TO_OBJECT(object_method_result), *result);
- } else {
- browser->releasevariantvalue(&object_method_result);
- VOID_TO_NPVARIANT(*result);
- }
-
- browser->releaseobject(object_arg);
-
- return true;
-}
-
-// Helper function to notify the layout test controller that the test completed.
-void notifyTestCompletion(NPP npp, NPObject* object)
-{
- NPVariant result;
- NPString script;
- script.UTF8Characters = "javascript:window.layoutTestController.notifyDone();";
- script.UTF8Length = strlen("javascript:window.layoutTestController.notifyDone();");
- browser->evaluate(npp, object, &script, &result);
- browser->releasevariantvalue(&result);
-}
-
-bool testDocumentOpen(NPP npp)
-{
- NPIdentifier documentId = browser->getstringidentifier("document");
- NPIdentifier openId = browser->getstringidentifier("open");
-
- NPObject* windowObject = 0;
- browser->getvalue(npp, NPNVWindowNPObject, &windowObject);
- if (!windowObject)
- return false;
-
- NPVariant docVariant;
- browser->getproperty(npp, windowObject, documentId, &docVariant);
- if (docVariant.type != NPVariantType_Object) {
- browser->releaseobject(windowObject);
- return false;
- }
-
- NPObject* documentObject = NPVARIANT_TO_OBJECT(docVariant);
-
- NPVariant openArgs[2];
- STRINGZ_TO_NPVARIANT("text/html", openArgs[0]);
- STRINGZ_TO_NPVARIANT("_blank", openArgs[1]);
-
- NPVariant result;
- if (!browser->invoke(npp, documentObject, openId, openArgs, 2, &result)) {
- browser->releaseobject(windowObject);
- browser->releaseobject(documentObject);
- return false;
- }
-
- browser->releaseobject(documentObject);
-
- if (result.type != NPVariantType_Object) {
- browser->releaseobject(windowObject);
- browser->releasevariantvalue(&result);
- return false;
- }
-
- pluginLogWithWindowObjectVariableArgs(windowObject, npp, "DOCUMENT OPEN SUCCESS");
- notifyTestCompletion(npp, result.value.objectValue);
- browser->releaseobject(result.value.objectValue);
- browser->releaseobject(windowObject);
- return true;
-}
-
-bool testWindowOpen(NPP npp)
-{
- NPIdentifier openId = browser->getstringidentifier("open");
-
- NPObject* windowObject = 0;
- browser->getvalue(npp, NPNVWindowNPObject, &windowObject);
- if (!windowObject)
- return false;
-
- NPVariant openArgs[2];
- STRINGZ_TO_NPVARIANT("about:blank", openArgs[0]);
- STRINGZ_TO_NPVARIANT("_blank", openArgs[1]);
-
- NPVariant result;
- if (!browser->invoke(npp, windowObject, openId, openArgs, 2, &result)) {
- browser->releaseobject(windowObject);
- return false;
- }
-
- if (result.type != NPVariantType_Object) {
- browser->releaseobject(windowObject);
- browser->releasevariantvalue(&result);
- return false;
- }
-
- pluginLogWithWindowObjectVariableArgs(windowObject, npp, "WINDOW OPEN SUCCESS");
- notifyTestCompletion(npp, result.value.objectValue);
- browser->releaseobject(result.value.objectValue);
- browser->releaseobject(windowObject);
- return true;
-}
-
-static bool testSetStatus(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- 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);
-
- free(message);
- return true;
-}
-
-static bool testResizeTo(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- VOID_TO_NPVARIANT(*result);
-
- NPObject* windowObject;
- if (NPERR_NO_ERROR != browser->getvalue(obj->npp, NPNVWindowNPObject, &windowObject))
- return false;
-
- NPVariant callResult;
- if (browser->invoke(obj->npp, windowObject, browser->getstringidentifier("resizePlugin"), args, argCount, &callResult))
- browser->releasevariantvalue(&callResult);
-
- // Force layout.
- if (browser->getproperty(obj->npp, windowObject, browser->getstringidentifier("pageYOffset"), &callResult))
- browser->releasevariantvalue(&callResult);
-
- return true;
-}
-
-static bool normalizeOverride(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- VOID_TO_NPVARIANT(*result);
-
- NPObject* windowObject;
- if (NPERR_NO_ERROR != browser->getvalue(obj->npp, NPNVWindowNPObject, &windowObject))
- return false;
-
- NPVariant callResult;
- if (browser->invoke(obj->npp, windowObject, browser->getstringidentifier("pluginCallback"), args, argCount, &callResult))
- browser->releasevariantvalue(&callResult);
-
- return true;
-}
-
-
-static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- PluginObject* plugin = reinterpret_cast<PluginObject*>(header);
- if (name == pluginMethodIdentifiers[ID_TEST_CALLBACK_METHOD])
- return testCallback(plugin, args, argCount, result);
- if (name == pluginMethodIdentifiers[ID_TEST_CALLBACK_METHOD_RETURN])
- return testCallbackReturn(plugin, args, argCount, result);
- if (name == pluginMethodIdentifiers[ID_TEST_GETURL])
- return getURL(plugin, args, argCount, result);
- if (name == pluginMethodIdentifiers[ID_TEST_DOM_ACCESS])
- return testDOMAccess(plugin, args, argCount, result);
- if (name == pluginMethodIdentifiers[ID_TEST_GET_URL_NOTIFY])
- return getURLNotify(plugin, args, argCount, result);
- if (name == pluginMethodIdentifiers[ID_TEST_INVOKE_DEFAULT])
- return testInvokeDefault(plugin, args, argCount, result);
- if (name == pluginMethodIdentifiers[ID_TEST_ENUMERATE])
- return testEnumerate(plugin, args, argCount, result);
- if (name == pluginMethodIdentifiers[ID_DESTROY_STREAM])
- return destroyStream(plugin, args, argCount, result);
- if (name == pluginMethodIdentifiers[ID_TEST_GETINTIDENTIFIER])
- return testGetIntIdentifier(plugin, args, argCount, result);
- if (name == pluginMethodIdentifiers[ID_TEST_EVALUATE])
- return testEvaluate(plugin, args, argCount, result);
- if (name == pluginMethodIdentifiers[ID_TEST_GET_PROPERTY])
- return testGetProperty(plugin, args, argCount, result);
- if (name == pluginMethodIdentifiers[ID_TEST_GET_PROPERTY_RETURN_VALUE])
- return testGetPropertyReturnValue(plugin, args, argCount, result);
- if (name == pluginMethodIdentifiers[ID_TEST_HAS_PROPERTY])
- return testHasProperty(plugin, args, argCount, result);
- if (name == pluginMethodIdentifiers[ID_TEST_HAS_METHOD])
- return testHasMethod(plugin, args, argCount, result);
- if (name == pluginMethodIdentifiers[ID_TEST_IDENTIFIER_TO_STRING])
- return testIdentifierToString(plugin, args, argCount, result);
- if (name == pluginMethodIdentifiers[ID_TEST_IDENTIFIER_TO_INT])
- return testIdentifierToInt(plugin, args, argCount, result);
- if (name == pluginMethodIdentifiers[ID_TEST_PASS_TEST_OBJECT])
- return testPassTestObject(plugin, args, argCount, result);
- if (name == pluginMethodIdentifiers[ID_TEST_POSTURL_FILE])
- return testPostURLFile(plugin, args, argCount, result);
- if (name == pluginMethodIdentifiers[ID_TEST_CONSTRUCT])
- return testConstruct(plugin, args, argCount, result);
- if (name == pluginMethodIdentifiers[ID_TEST_SCRIPT_OBJECT_INVOKE])
- return testScriptObjectInvoke(plugin, args, argCount, result);
- if (name == pluginMethodIdentifiers[ID_TEST_THROW_EXCEPTION_METHOD]) {
- browser->setexception(header, "plugin object testThrowException SUCCESS");
- return true;
- }
- if (name == pluginMethodIdentifiers[ID_TEST_FAIL_METHOD]) {
- NPObject* windowScriptObject;
- browser->getvalue(plugin->npp, NPNVWindowNPObject, &windowScriptObject);
- browser->invoke(plugin->npp, windowScriptObject, name, args, argCount, result);
- return false;
- }
- if (name == pluginMethodIdentifiers[ID_TEST_CLONE_OBJECT]) {
- NPObject* new_object = browser->createobject(plugin->npp, &pluginClass);
- assert(new_object->referenceCount == 1);
- OBJECT_TO_NPVARIANT(new_object, *result);
- return true;
- }
- if (name == pluginMethodIdentifiers[ID_TEST_CREATE_TEST_OBJECT]) {
- NPObject* testObject = browser->createobject(plugin->npp, getTestClass());
- assert(testObject->referenceCount == 1);
- OBJECT_TO_NPVARIANT(testObject, *result);
- return true;
- }
- if (name == pluginMethodIdentifiers[ID_DESTROY_NULL_STREAM])
- return destroyNullStream(plugin, args, argCount, result);
- if (name == pluginMethodIdentifiers[ID_TEST_RELOAD_PLUGINS_NO_PAGES]) {
- browser->reloadplugins(false);
- return true;
- }
- if (name == pluginMethodIdentifiers[ID_TEST_RELOAD_PLUGINS_AND_PAGES]) {
- browser->reloadplugins(true);
- return true;
- }
- if (name == pluginMethodIdentifiers[ID_TEST_GET_BROWSER_PROPERTY]) {
- browser->getproperty(plugin->npp, NPVARIANT_TO_OBJECT(args[0]), stringVariantToIdentifier(args[1]), result);
- return true;
- }
- if (name == pluginMethodIdentifiers[ID_TEST_SET_BROWSER_PROPERTY]) {
- browser->setproperty(plugin->npp, NPVARIANT_TO_OBJECT(args[0]), stringVariantToIdentifier(args[1]), &args[2]);
- return true;
- }
- if (name == pluginMethodIdentifiers[ID_REMEMBER]) {
- if (plugin->rememberedObject)
- browser->releaseobject(plugin->rememberedObject);
- plugin->rememberedObject = NPVARIANT_TO_OBJECT(args[0]);
- browser->retainobject(plugin->rememberedObject);
- VOID_TO_NPVARIANT(*result);
- return true;
- }
- if (name == pluginMethodIdentifiers[ID_GET_REMEMBERED_OBJECT]) {
- assert(plugin->rememberedObject);
- browser->retainobject(plugin->rememberedObject);
- OBJECT_TO_NPVARIANT(plugin->rememberedObject, *result);
- return true;
- }
- if (name == pluginMethodIdentifiers[ID_GET_AND_FORGET_REMEMBERED_OBJECT]) {
- assert(plugin->rememberedObject);
- OBJECT_TO_NPVARIANT(plugin->rememberedObject, *result);
- plugin->rememberedObject = 0;
- return true;
- }
- if (name == pluginMethodIdentifiers[ID_REF_COUNT]) {
- uint32_t refCount = NPVARIANT_TO_OBJECT(args[0])->referenceCount;
- INT32_TO_NPVARIANT(refCount, *result);
- return true;
- }
- if (name == pluginMethodIdentifiers[ID_SET_STATUS])
- return testSetStatus(plugin, args, argCount, result);
- if (name == pluginMethodIdentifiers[ID_RESIZE_TO])
- return testResizeTo(plugin, args, argCount, result);
- if (name == pluginMethodIdentifiers[ID_NORMALIZE])
- return normalizeOverride(plugin, args, argCount, result);
-
- return false;
-}
-
-static void pluginInvalidate(NPObject* header)
-{
- PluginObject* plugin = reinterpret_cast<PluginObject*>(header);
- plugin->testObject = 0;
- plugin->rememberedObject = 0;
-}
-
-static NPObject *pluginAllocate(NPP npp, NPClass *theClass)
-{
- PluginObject* newInstance = (PluginObject*)malloc(sizeof(PluginObject));
-
- if (!identifiersInitialized) {
- identifiersInitialized = true;
- initializeIdentifiers();
- }
-
- newInstance->pluginTest = 0;
- newInstance->npp = npp;
- newInstance->testObject = browser->createobject(npp, getTestClass());
- newInstance->rememberedObject = 0;
- newInstance->eventLogging = FALSE;
- newInstance->onStreamLoad = 0;
- newInstance->onStreamDestroy = 0;
- newInstance->onDestroy = 0;
- newInstance->onURLNotify = 0;
- newInstance->onSetWindow = 0;
- newInstance->logDestroy = FALSE;
- newInstance->logSetWindow = FALSE;
- newInstance->returnErrorFromNewStream = FALSE;
- newInstance->returnNegativeOneFromWrite = FALSE;
- newInstance->stream = 0;
-
- newInstance->firstUrl = 0;
- newInstance->firstHeaders = 0;
- newInstance->lastUrl = 0;
- newInstance->lastHeaders = 0;
-
- newInstance->testGetURLOnDestroy = FALSE;
- newInstance->testWindowOpen = FALSE;
- newInstance->testKeyboardFocusForPlugins = FALSE;
-
- newInstance->mouseDownForEvaluateScript = FALSE;
- newInstance->evaluateScriptOnMouseDownOrKeyDown = 0;
-
- return (NPObject*)newInstance;
-}
-
-static void pluginDeallocate(NPObject* header)
-{
- PluginObject* plugin = reinterpret_cast<PluginObject*>(header);
- delete plugin->pluginTest;
- if (plugin->testObject)
- browser->releaseobject(plugin->testObject);
- if (plugin->rememberedObject)
- browser->releaseobject(plugin->rememberedObject);
-
- free(plugin->firstUrl);
- free(plugin->firstHeaders);
- free(plugin->lastUrl);
- free(plugin->lastHeaders);
- free(plugin);
-}
-
-void handleCallback(PluginObject* object, const char *url, NPReason reason, void *notifyData)
-{
- assert(object);
-
- NPVariant args[2];
-
- NPObject* windowScriptObject;
- browser->getvalue(object->npp, NPNVWindowNPObject, &windowScriptObject);
-
- NPIdentifier callbackIdentifier = notifyData;
-
- INT32_TO_NPVARIANT(reason, args[0]);
-
- char* strHdr = 0;
- if (object->firstUrl && object->firstHeaders && object->lastUrl && object->lastHeaders) {
- // Format expected by JavaScript validator: four fields separated by \n\n:
- // First URL; first header block; last URL; last header block.
- // Note that header blocks already end with \n due to how NPStream::headers works.
- int len = strlen(object->firstUrl) + 2
- + strlen(object->firstHeaders) + 1
- + strlen(object->lastUrl) + 2
- + strlen(object->lastHeaders) + 1;
- strHdr = (char*)malloc(len + 1);
- snprintf(strHdr, len + 1, "%s\n\n%s\n%s\n\n%s\n",
- object->firstUrl, object->firstHeaders, object->lastUrl, object->lastHeaders);
- STRINGN_TO_NPVARIANT(strHdr, len, args[1]);
- } else
- NULL_TO_NPVARIANT(args[1]);
-
- NPVariant browserResult;
- if (browser->invoke(object->npp, windowScriptObject, callbackIdentifier, args, 2, &browserResult))
- browser->releasevariantvalue(&browserResult);
-
- free(strHdr);
-}
-
-void notifyStream(PluginObject* object, const char *url, const char *headers)
-{
- if (!object->firstUrl) {
- if (url)
- object->firstUrl = strdup(url);
- if (headers)
- object->firstHeaders = strdup(headers);
- } else {
- free(object->lastUrl);
- free(object->lastHeaders);
- object->lastUrl = (url ? strdup(url) : 0);
- object->lastHeaders = (headers ? strdup(headers) : 0);
- }
-}
-
-void testNPRuntime(NPP npp)
-{
- NPObject* windowScriptObject;
- browser->getvalue(npp, NPNVWindowNPObject, &windowScriptObject);
-
- // Invoke
- NPIdentifier testNPInvoke = browser->getstringidentifier("testNPInvoke");
- NPVariant args[7];
-
- VOID_TO_NPVARIANT(args[0]);
- NULL_TO_NPVARIANT(args[1]);
- BOOLEAN_TO_NPVARIANT(true, args[2]);
- INT32_TO_NPVARIANT(242, args[3]);
- DOUBLE_TO_NPVARIANT(242.242, args[4]);
- STRINGZ_TO_NPVARIANT("Hello, World", args[5]);
- OBJECT_TO_NPVARIANT(windowScriptObject, args[6]);
-
- NPVariant result;
- if (browser->invoke(npp, windowScriptObject, testNPInvoke, args, 7, &result))
- browser->releasevariantvalue(&result);
-
- browser->releaseobject(windowScriptObject);
-}
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h
deleted file mode 100644
index def8ad8..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 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. ``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
- * 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.
- */
-
-#ifndef PluginObject_h
-#define PluginObject_h
-
-#include <WebKit/npfunctions.h>
-
-#if defined(XP_MACOSX)
-#if !defined(MAC_OS_X_VERSION_10_5) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
-#define BUILDING_ON_TIGER 1
-#elif !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
-#define BUILDING_ON_LEOPARD 1
-#elif !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
-#define BUILDING_ON_SNOW_LEOPARD 1
-#endif
-#endif // XP_MACOSX
-
-class PluginTest;
-
-extern NPNetscapeFuncs *browser;
-extern NPPluginFuncs* pluginFunctions;
-
-typedef struct {
- NPObject header;
-
- PluginTest* pluginTest;
-
- NPP npp;
- NPBool eventLogging;
- NPBool logSetWindow;
- NPBool logDestroy;
- NPBool returnNegativeOneFromWrite;
- NPBool returnErrorFromNewStream;
- NPBool cachedPrivateBrowsingMode;
- NPObject* testObject;
- NPObject* rememberedObject;
- NPStream* stream;
- NPBool testGetURLOnDestroy;
- NPBool testWindowOpen;
- NPBool testKeyboardFocusForPlugins;
- NPBool mouseDownForEvaluateScript;
- char* onStreamLoad;
- char* onStreamDestroy;
- char* onDestroy;
- char* onURLNotify;
- char* onSetWindow;
- char* firstUrl;
- char* firstHeaders;
- char* lastUrl;
- char* lastHeaders;
- char* evaluateScriptOnMouseDownOrKeyDown;
-#ifdef XP_MACOSX
- NPEventModel eventModel;
-#endif
-#if defined(XP_MACOSX) && !defined(BUILDING_ON_TIGER)
- void* coreAnimationLayer;
-#endif
- NPWindow lastWindow;
-} PluginObject;
-
-extern NPClass *getPluginClass(void);
-extern void handleCallback(PluginObject* object, const char *url, NPReason reason, void *notifyData);
-extern void notifyStream(PluginObject* object, const char *url, const char *headers);
-extern void testNPRuntime(NPP npp);
-extern void pluginLog(NPP instance, const char* format, ...);
-extern bool testDocumentOpen(NPP npp);
-extern bool testWindowOpen(NPP npp);
-
-#if defined(XP_MACOSX) && !defined(BUILDING_ON_TIGER)
-extern void* createCoreAnimationLayer();
-#endif
-
-#endif // PluginObject_h
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObjectMac.mm b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObjectMac.mm
deleted file mode 100644
index 3aff46d..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObjectMac.mm
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * 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. ``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 COMPUTER, INC. OR
- * 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 "PluginObject.h"
-
-#if !defined(BUILDING_ON_TIGER)
-
-#include <QuartzCore/QuartzCore.h>
-
-@interface TestPluginLayer : CALayer
-@end
-
-@implementation TestPluginLayer
-
-- (void)drawInContext:(CGContextRef)context
-{
- CGRect bounds = [self bounds];
- const char* text = "Test Plug-in";
- CGContextSelectFont(context, "Helvetica", 24, kCGEncodingMacRoman);
- CGContextShowTextAtPoint(context, bounds.origin.x + 3.0f, bounds.origin.y + bounds.size.height - 30.0f, text, strlen(text));
-}
-
-@end
-
-void* createCoreAnimationLayer()
-{
- CALayer *caLayer = [[TestPluginLayer alloc] init];
-
- NSNull *nullValue = [NSNull null];
- NSDictionary *actions = [NSDictionary dictionaryWithObjectsAndKeys:
- nullValue, @"anchorPoint",
- nullValue, @"bounds",
- nullValue, @"contents",
- nullValue, @"contentsRect",
- nullValue, @"opacity",
- nullValue, @"position",
- nullValue, @"shadowColor",
- nullValue, @"sublayerTransform",
- nullValue, @"sublayers",
- nullValue, @"transform",
- nullValue, @"zPosition",
- nil];
- // Turn off default animations.
- [caLayer setStyle:[NSDictionary dictionaryWithObject:actions forKey:@"actions"]];
- [caLayer setNeedsDisplayOnBoundsChange:YES];
-
- [caLayer setBounds:CGRectMake(0, 0, 200, 100)];
- [caLayer setAnchorPoint:CGPointZero];
-
- CGColorRef color = CGColorCreateGenericRGB(0.5, 0.5, 1, 1);
- [caLayer setBackgroundColor:color];
- CGColorRelease(color);
-
- [caLayer setLayoutManager:[CAConstraintLayoutManager layoutManager]];
-
- CALayer *sublayer = [CALayer layer];
- // Turn off default animations.
- [sublayer setStyle:[NSDictionary dictionaryWithObject:actions forKey:@"actions"]];
-
- color = CGColorCreateGenericRGB(0, 0, 0, 0.75);
- [sublayer setBackgroundColor:color];
- CGColorRelease(color);
- [sublayer setBounds:CGRectMake(0, 0, 180, 20)];
-
- [sublayer addConstraint:[CAConstraint constraintWithAttribute:kCAConstraintMinY
- relativeTo:@"superlayer"
- attribute:kCAConstraintMinY]];
- [sublayer addConstraint:[CAConstraint constraintWithAttribute:kCAConstraintMinX
- relativeTo:@"superlayer"
- attribute:kCAConstraintMinX]];
- [sublayer addConstraint:[CAConstraint constraintWithAttribute:kCAConstraintMaxX
- relativeTo:@"superlayer"
- attribute:kCAConstraintMaxX]];
-
- [caLayer addSublayer:sublayer];
- return caLayer;
-}
-
-#endif // !defined(BUILDING_ON_TIGER)
-
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp
deleted file mode 100644
index 06c9953..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * 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"
-
-#include <assert.h>
-#include <string.h>
-
-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)
-{
-}
-
-PluginTest::~PluginTest()
-{
-}
-
-NPError PluginTest::NPP_Destroy(NPSavedData**)
-{
- return NPERR_NO_ERROR;
-}
-
-NPError PluginTest::NPP_DestroyStream(NPStream *stream, NPReason reason)
-{
- return NPERR_NO_ERROR;
-}
-
-NPError PluginTest::NPP_GetValue(NPPVariable variable, void *value)
-{
- // We don't know anything about plug-in values so just return NPERR_GENERIC_ERROR.
- return NPERR_GENERIC_ERROR;
-}
-
-NPError PluginTest::NPP_SetWindow(NPP, NPWindow*)
-{
- return NPERR_NO_ERROR;
-}
-
-void PluginTest::NPN_InvalidateRect(NPRect* invalidRect)
-{
- browser->invalidaterect(m_npp, invalidRect);
-}
-
-NPIdentifier PluginTest::NPN_GetStringIdentifier(const NPUTF8 *name)
-{
- return browser->getstringidentifier(name);
-}
-
-NPIdentifier PluginTest::NPN_GetIntIdentifier(int32_t intid)
-{
- return browser->getintidentifier(intid);
-}
-
-NPError PluginTest::NPN_GetValue(NPNVariable variable, void* value)
-{
- return browser->getvalue(m_npp, variable, value);
-}
-
-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::executeScript(const char* script)
-{
- NPObject* windowScriptObject;
- browser->getvalue(m_npp, NPNVWindowNPObject, &windowScriptObject);
-
- NPString npScript;
- npScript.UTF8Characters = script;
- npScript.UTF8Length = strlen(script);
-
- NPVariant browserResult;
- browser->evaluate(m_npp, windowScriptObject, &npScript, &browserResult);
- browser->releasevariantvalue(&browserResult);
-}
-
-void PluginTest::waitUntilDone()
-{
- executeScript("layoutTestController.waitUntilDone()");
-}
-
-void PluginTest::notifyDone()
-{
- executeScript("layoutTestController.notifyDone()");
-}
-
-void PluginTest::registerCreateTestFunction(const string& identifier, CreateTestFunction createTestFunction)
-{
- assert(!createTestFunctions().count(identifier));
-
- createTestFunctions()[identifier] = createTestFunction;
-}
-
-std::map<std::string, PluginTest::CreateTestFunction>& PluginTest::createTestFunctions()
-{
- static std::map<std::string, CreateTestFunction> testFunctions;
-
- return testFunctions;
-}
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h
deleted file mode 100644
index ae9bd82..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef PluginTest_h
-#define PluginTest_h
-
-#include <WebKit/npfunctions.h>
-#include <assert.h>
-#include <map>
-#include <string>
-
-// Helper classes for implementing has_member
-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_##member##_helper {}; \
-template<typename T> no_tag has_member_##member##_helper(...); \
-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(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));
-DEFINE_HAS_MEMBER_CHECK(getProperty, bool, (NPIdentifier propertyName, NPVariant* result));
-
-class PluginTest {
-public:
- static PluginTest* create(NPP, const std::string& identifier);
- virtual ~PluginTest();
-
- // NPP functions.
- virtual NPError NPP_Destroy(NPSavedData**);
- virtual NPError NPP_DestroyStream(NPStream* stream, NPReason reason);
- virtual NPError NPP_GetValue(NPPVariable, void* value);
- virtual NPError NPP_SetWindow(NPP, NPWindow*);
-
- // NPN functions.
- void NPN_InvalidateRect(NPRect* invalidRect);
- NPIdentifier NPN_GetStringIdentifier(const NPUTF8* name);
- NPIdentifier NPN_GetIntIdentifier(int32_t intid);
- NPError NPN_GetValue(NPNVariable, void* value);
- NPObject* NPN_CreateObject(NPClass*);
- bool NPN_RemoveProperty(NPObject*, NPIdentifier propertyName);
-
- void executeScript(const char*);
-
- template<typename TestClassTy> class Register {
- public:
- Register(const std::string& identifier)
- {
- registerCreateTestFunction(identifier, Register::create);
- }
-
- private:
- static PluginTest* create(NPP npp, const std::string& identifier)
- {
- return new TestClassTy(npp, identifier);
- }
- };
-
-protected:
- PluginTest(NPP npp, const std::string& identifier);
-
- // 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; }
-
- void waitUntilDone();
- void notifyDone();
-
- // NPObject helper template.
- template<typename T> struct Object : NPObject {
- public:
- static NPObject* create(PluginTest* pluginTest)
- {
- Object* object = static_cast<Object*>(pluginTest->NPN_CreateObject(npClass()));
-
- object->m_pluginTest = pluginTest;
- return object;
- }
-
- // 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;
- }
-
- bool getProperty(NPIdentifier propertyName, NPVariant* result)
- {
- assert(false);
- return false;
- }
-
- protected:
- Object()
- : m_pluginTest(0)
- {
- }
-
- virtual ~Object()
- {
- }
-
- PluginTest* pluginTest() const { return m_pluginTest; }
-
- private:
- static NPObject* NP_Allocate(NPP npp, NPClass* aClass)
- {
- return new T;
- }
-
- static void NP_Deallocate(NPObject* npObject)
- {
- 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 bool NP_GetProperty(NPObject* npObject, NPIdentifier propertyName, NPVariant* result)
- {
- return static_cast<T*>(npObject)->getProperty(propertyName, result);
- }
-
- static NPClass* npClass()
- {
- static NPClass npClass = {
- NP_CLASS_STRUCT_VERSION,
- NP_Allocate,
- NP_Deallocate,
- 0, // NPClass::invalidate
- has_member_hasMethod<T>::value ? NP_HasMethod : 0,
- has_member_invoke<T>::value ? NP_Invoke : 0,
- has_member_invokeDefault<T>::value ? NP_InvokeDefault : 0,
- has_member_hasProperty<T>::value ? NP_HasProperty : 0,
- has_member_getProperty<T>::value ? NP_GetProperty : 0,
- 0, // NPClass::setProperty
- 0, // NPClass::removeProperty
- 0, // NPClass::enumerate
- 0 // NPClass::construct
- };
-
- return &npClass;
- };
-
- PluginTest* m_pluginTest;
- };
-
-private:
- typedef PluginTest* (*CreateTestFunction)(NPP, const std::string&);
-
- static void registerCreateTestFunction(const std::string&, CreateTestFunction);
- static std::map<std::string, CreateTestFunction>& createTestFunctions();
-
- std::string m_identifier;
-};
-
-#endif // PluginTest_h
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/TestObject.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/TestObject.cpp
deleted file mode 100644
index 9e65f11..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/TestObject.cpp
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Copyright (C) 2007 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. ``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
- * 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 "TestObject.h"
-#include "PluginObject.h"
-
-#include <string.h>
-#include <stdlib.h>
-
-static bool testEnumerate(NPObject *npobj, NPIdentifier **value, uint32_t *count);
-static bool testHasMethod(NPObject*, NPIdentifier name);
-static bool testInvoke(NPObject*, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result);
-static bool testHasProperty(NPObject*, NPIdentifier name);
-static bool testGetProperty(NPObject*, NPIdentifier name, NPVariant*);
-static NPObject *testAllocate(NPP npp, NPClass *theClass);
-static void testDeallocate(NPObject *obj);
-static bool testConstruct(NPObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result);
-
-static NPClass testClass = {
- NP_CLASS_STRUCT_VERSION,
- testAllocate,
- testDeallocate,
- 0,
- testHasMethod,
- testInvoke,
- 0,
- testHasProperty,
- testGetProperty,
- 0,
- 0,
- testEnumerate,
- testConstruct
-};
-
-NPClass *getTestClass(void)
-{
- return &testClass;
-}
-
-static int testObjectCount = 0;
-
-int getTestObjectCount()
-{
- return testObjectCount;
-}
-
-typedef struct {
- NPObject header;
- NPObject* testObject;
-} TestObject;
-
-static bool identifiersInitialized = false;
-
-#define NUM_ENUMERATABLE_TEST_IDENTIFIERS 2
-
-enum {
- ID_PROPERTY_FOO = 0,
- ID_PROPERTY_BAR,
- ID_PROPERTY_OBJECT_POINTER,
- ID_PROPERTY_TEST_OBJECT,
- ID_PROPERTY_REF_COUNT,
- NUM_TEST_IDENTIFIERS,
-};
-
-static NPIdentifier testIdentifiers[NUM_TEST_IDENTIFIERS];
-static const NPUTF8 *testIdentifierNames[NUM_TEST_IDENTIFIERS] = {
- "foo",
- "bar",
- "objectPointer",
- "testObject",
- "refCount",
-};
-
-#define ID_THROW_EXCEPTION_METHOD 0
-#define NUM_METHOD_IDENTIFIERS 1
-
-static NPIdentifier testMethodIdentifiers[NUM_METHOD_IDENTIFIERS];
-static const NPUTF8 *testMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
- "throwException",
-};
-
-static void initializeIdentifiers(void)
-{
- browser->getstringidentifiers(testIdentifierNames, NUM_TEST_IDENTIFIERS, testIdentifiers);
- browser->getstringidentifiers(testMethodIdentifierNames, NUM_METHOD_IDENTIFIERS, testMethodIdentifiers);
-}
-
-static NPObject* testAllocate(NPP /*npp*/, NPClass* /*theClass*/)
-{
- TestObject* newInstance = static_cast<TestObject*>(malloc(sizeof(TestObject)));
- newInstance->testObject = 0;
- ++testObjectCount;
-
- if (!identifiersInitialized) {
- identifiersInitialized = true;
- initializeIdentifiers();
- }
-
- return reinterpret_cast<NPObject*>(newInstance);
-}
-
-static void testDeallocate(NPObject *obj)
-{
- TestObject* testObject = reinterpret_cast<TestObject*>(obj);
- if (testObject->testObject)
- browser->releaseobject(testObject->testObject);
-
- --testObjectCount;
- free(obj);
-}
-
-static bool testHasMethod(NPObject*, NPIdentifier name)
-{
- for (unsigned i = 0; i < NUM_METHOD_IDENTIFIERS; i++) {
- if (testMethodIdentifiers[i] == name)
- return true;
- }
- return false;
-}
-
-static bool testInvoke(NPObject* header, NPIdentifier name, const NPVariant* /*args*/, uint32_t /*argCount*/, NPVariant* /*result*/)
-{
- if (name == testMethodIdentifiers[ID_THROW_EXCEPTION_METHOD]) {
- browser->setexception(header, "test object throwException SUCCESS");
- return true;
- }
- return false;
-}
-
-static bool testHasProperty(NPObject*, NPIdentifier name)
-{
- for (unsigned i = 0; i < NUM_TEST_IDENTIFIERS; i++) {
- if (testIdentifiers[i] == name)
- return true;
- }
-
- return false;
-}
-
-static bool testGetProperty(NPObject* npobj, NPIdentifier name, NPVariant* result)
-{
- if (name == testIdentifiers[ID_PROPERTY_FOO]) {
- char* mem = static_cast<char*>(browser->memalloc(4));
- strcpy(mem, "foo");
- STRINGZ_TO_NPVARIANT(mem, *result);
- return true;
- }
- if (name == testIdentifiers[ID_PROPERTY_OBJECT_POINTER]) {
- int32_t objectPointer = static_cast<int32_t>(reinterpret_cast<long long>(npobj));
-
- INT32_TO_NPVARIANT(objectPointer, *result);
- return true;
- }
- if (name == testIdentifiers[ID_PROPERTY_TEST_OBJECT]) {
- TestObject* testObject = reinterpret_cast<TestObject*>(npobj);
- if (!testObject->testObject)
- testObject->testObject = browser->createobject(0, &testClass);
- browser->retainobject(testObject->testObject);
- OBJECT_TO_NPVARIANT(testObject->testObject, *result);
- return true;
- }
- if (name == testIdentifiers[ID_PROPERTY_REF_COUNT]) {
- INT32_TO_NPVARIANT(npobj->referenceCount, *result);
- return true;
- }
-
- return false;
-}
-
-static bool testEnumerate(NPObject* /*npobj*/, NPIdentifier **value, uint32_t *count)
-{
- *count = NUM_ENUMERATABLE_TEST_IDENTIFIERS;
-
- *value = (NPIdentifier*)browser->memalloc(NUM_ENUMERATABLE_TEST_IDENTIFIERS * sizeof(NPIdentifier));
- memcpy(*value, testIdentifiers, sizeof(NPIdentifier) * NUM_ENUMERATABLE_TEST_IDENTIFIERS);
-
- return true;
-}
-
-static bool testConstruct(NPObject* npobj, const NPVariant* /*args*/, uint32_t /*argCount*/, NPVariant* result)
-{
- browser->retainobject(npobj);
-
- // Just return the same object.
- OBJECT_TO_NPVARIANT(npobj, *result);
- return true;
-}
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/TestObject.h b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/TestObject.h
deleted file mode 100644
index 73748e0..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/TestObject.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2007 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. ``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
- * 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 <WebKit/npapi.h>
-#include <WebKit/npruntime.h>
-
-NPClass* getTestClass(void);
-int getTestObjectCount();
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp
deleted file mode 100644
index 69e706e..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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;
-
-extern bool testDocumentOpen(NPP npp);
-
-// Call document.open from NPP_DestroyStream.
-
-class DocumentOpenInDestroyStream : public PluginTest {
-public:
- DocumentOpenInDestroyStream(NPP npp, const string& identifier)
- : PluginTest(npp, identifier)
- , m_shouldOpen(true)
- {
- }
-
-private:
- virtual NPError NPP_DestroyStream(NPStream*, NPReason)
- {
- if (m_shouldOpen) {
- testDocumentOpen(m_npp);
- m_shouldOpen = false;
- }
-
- return NPERR_NO_ERROR;
- }
-
- bool m_shouldOpen;
-};
-
-static PluginTest::Register<DocumentOpenInDestroyStream> documentOpenInDestroyStream("document-open-in-destroy-stream");
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/EvaluateJSAfterRemovingPluginElement.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/EvaluateJSAfterRemovingPluginElement.cpp
deleted file mode 100644
index 4b5d3e0..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/EvaluateJSAfterRemovingPluginElement.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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"
-
-#include "PluginObject.h"
-
-using namespace std;
-
-// Executing JS after removing the plugin element from the document should not crash.
-
-class EvaluateJSAfterRemovingPluginElement : public PluginTest {
-public:
- EvaluateJSAfterRemovingPluginElement(NPP, const string& identifier);
-
-private:
- virtual NPError NPP_DestroyStream(NPStream*, NPReason);
-
- bool m_didExecuteScript;
-};
-
-static PluginTest::Register<EvaluateJSAfterRemovingPluginElement> registrar("evaluate-js-after-removing-plugin-element");
-
-EvaluateJSAfterRemovingPluginElement::EvaluateJSAfterRemovingPluginElement(NPP npp, const string& identifier)
- : PluginTest(npp, identifier)
- , m_didExecuteScript(false)
-{
- waitUntilDone();
-}
-
-NPError EvaluateJSAfterRemovingPluginElement::NPP_DestroyStream(NPStream*, NPReason)
-{
- if (m_didExecuteScript)
- return NPERR_NO_ERROR;
- m_didExecuteScript = true;
-
- executeScript("var plugin = document.getElementsByTagName('embed')[0]; plugin.parentElement.removeChild(plugin);");
- executeScript("document.body.appendChild(document.createTextNode('Executing script after removing the plugin element from the document succeeded.'));");
- notifyDone();
-
- return NPERR_NO_ERROR;
-}
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp
deleted file mode 100644
index 38236e3..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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 NPRuntimeObjectFromDestroyedPlugin : public PluginTest {
-public:
- NPRuntimeObjectFromDestroyedPlugin(NPP npp, const string& identifier)
- : PluginTest(npp, identifier)
- {
- }
-
-private:
- // This is the test object.
- class TestObject : public Object<TestObject> { };
-
- // This is the scriptable object. It has a single "testObject" property.
- class ScriptableObject : public Object<ScriptableObject> {
- public:
- bool hasProperty(NPIdentifier propertyName)
- {
- return propertyName == pluginTest()->NPN_GetStringIdentifier("testObject");
- }
-
- bool getProperty(NPIdentifier propertyName, NPVariant* result)
- {
- if (propertyName != pluginTest()->NPN_GetStringIdentifier("testObject"))
- return false;
-
- NPObject* testObject = TestObject::create(pluginTest());
- OBJECT_TO_NPVARIANT(testObject, *result);
- return true;
- }
- };
-
- virtual NPError NPP_GetValue(NPPVariable variable, void *value)
- {
- if (variable != NPPVpluginScriptableNPObject)
- return NPERR_GENERIC_ERROR;
-
- *(NPObject**)value = ScriptableObject::create(this);
-
- return NPERR_NO_ERROR;
- }
-};
-
-static PluginTest::Register<NPRuntimeObjectFromDestroyedPlugin> npRuntimeObjectFromDestroyedPlugin("npruntime-object-from-destroyed-plugin");
-
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp
deleted file mode 100644
index 4d417d1..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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/Tests/NullNPPGetValuePointer.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NullNPPGetValuePointer.cpp
deleted file mode 100644
index 9e4e976..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NullNPPGetValuePointer.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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"
-
-#include "PluginObject.h"
-
-using namespace std;
-
-// Passing null for our NPP_GetValue function pointer should not crash.
-
-class NullNPPGetValuePointer : public PluginTest {
-public:
- NullNPPGetValuePointer(NPP, const string& identifier);
-
-private:
- virtual NPError NPP_Destroy(NPSavedData**);
- virtual NPError NPP_GetValue(NPPVariable, void* value);
-
- NPP_GetValueProcPtr m_originalNPPGetValuePointer;
-};
-
-static PluginTest::Register<NullNPPGetValuePointer> registrar("null-npp-getvalue-pointer");
-
-NullNPPGetValuePointer::NullNPPGetValuePointer(NPP npp, const string& identifier)
- : PluginTest(npp, identifier)
- , m_originalNPPGetValuePointer(pluginFunctions->getvalue)
-{
- // Be sneaky and null out the getvalue pointer the browser is holding. This simulates a plugin
- // that doesn't implement NPP_GetValue (like Shockwave Director 10.3 on Windows). Note that if
- // WebKit copies the NPPluginFuncs struct this technique will have no effect and WebKit will
- // call into our NPP_GetValue implementation.
- pluginFunctions->getvalue = 0;
-}
-
-NPError NullNPPGetValuePointer::NPP_Destroy(NPSavedData**)
-{
- // Set the NPP_GetValue pointer back the way it was before we mucked with it so we don't mess
- // up future uses of the plugin module.
- pluginFunctions->getvalue = m_originalNPPGetValuePointer;
- return NPERR_NO_ERROR;
-}
-
-NPError NullNPPGetValuePointer::NPP_GetValue(NPPVariable, void*)
-{
- pluginLog(m_npp, "NPP_GetValue was called but should not have been. Maybe WebKit copied the NPPluginFuncs struct, which would invalidate this test.");
- return NPERR_GENERIC_ERROR;
-}
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PassDifferentNPPStruct.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PassDifferentNPPStruct.cpp
deleted file mode 100644
index e464996..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PassDifferentNPPStruct.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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"
-
-#include "PluginObject.h"
-
-using namespace std;
-
-// Passing a different NPP struct that has the same ndata value as the one passed to NPP_New should
-// not trigger an assertion failure.
-
-class PassDifferentNPPStruct : public PluginTest {
-public:
- PassDifferentNPPStruct(NPP npp, const string& identifier)
- : PluginTest(npp, identifier)
- , m_didReceiveInitialSetWindowCall(false)
- {
- }
-
-private:
- virtual NPError NPP_SetWindow(NPP instance, NPWindow* window)
- {
- if (m_didReceiveInitialSetWindowCall)
- return NPERR_NO_ERROR;
- m_didReceiveInitialSetWindowCall = true;
-
- NPP oldNPP = m_npp;
- NPP_t differentNPP = *m_npp;
- m_npp = &differentNPP;
-
- NPBool privateMode;
- NPError error = NPN_GetValue(NPNVprivateModeBool, &privateMode);
-
- m_npp = oldNPP;
-
- if (error != NPERR_NO_ERROR) {
- pluginLog(instance, "NPN_GetValue(NPNVprivateModeBool) with a different NPP struct failed with error %d", error);
- return NPERR_GENERIC_ERROR;
- }
- pluginLog(instance, "NPN_GetValue(NPNVprivateModeBool) with a different NPP struct succeeded");
- return NPERR_NO_ERROR;
- }
-
- bool m_didReceiveInitialSetWindowCall;
-};
-
-static PluginTest::Register<PassDifferentNPPStruct> getValueNetscapeWindow("pass-different-npp-struct");
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp
deleted file mode 100644
index 959e182..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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;
-
-// 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:
- struct NPObjectWithoutInvokeDefault : Object<NPObjectWithoutInvokeDefault> { };
-
- struct NPObjectWithInvokeDefault : Object<NPObjectWithInvokeDefault> {
- public:
- bool invokeDefault(const NPVariant*, uint32_t, NPVariant* result)
- {
- INT32_TO_NPVARIANT(1, *result);
- return true;
- }
- };
-
- virtual NPError NPP_GetValue(NPPVariable variable, void *value)
- {
- if (variable != NPPVpluginScriptableNPObject)
- return NPERR_GENERIC_ERROR;
-
- NPObject* object;
- if (identifier() == "plugin-scriptable-npobject-invoke-default")
- object = NPObjectWithInvokeDefault::create(this);
- else
- object = NPObjectWithoutInvokeDefault::create(this);
-
- *(NPObject**)value = object;
-
- return NPERR_NO_ERROR;
- }
-};
-
-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/Tests/win/DrawsGradient.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/DrawsGradient.cpp
deleted file mode 100644
index 2b06198..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/DrawsGradient.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/* 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 "WindowedPluginTest.h"
-
-#include "PluginObject.h"
-
-using namespace std;
-
-// Just fills its window with some gradients
-
-class DrawsGradient : public WindowedPluginTest {
-public:
- DrawsGradient(NPP, const string& identifier);
-
-private:
- void paint(HDC) const;
-
- LRESULT onPaint(WPARAM, LPARAM, bool& handled);
- LRESULT onPrintClient(WPARAM, LPARAM, bool& handled);
-
- virtual LRESULT wndProc(UINT message, WPARAM, LPARAM, bool& handled);
-};
-
-static PluginTest::Register<DrawsGradient> registrar("draws-gradient");
-
-DrawsGradient::DrawsGradient(NPP npp, const string& identifier)
- : WindowedPluginTest(npp, identifier)
-{
-}
-
-LRESULT DrawsGradient::wndProc(UINT message, WPARAM wParam, LPARAM lParam, bool& handled)
-{
- LRESULT result = 0;
-
- switch (message) {
- case WM_PAINT:
- result = onPaint(wParam, lParam, handled);
- break;
- case WM_PRINTCLIENT:
- result = onPrintClient(wParam, lParam, handled);
- break;
- default:
- handled = false;
- }
-
- return result;
-}
-
-LRESULT DrawsGradient::onPaint(WPARAM, LPARAM, bool& handled)
-{
- PAINTSTRUCT paintStruct;
- HDC dc = ::BeginPaint(window(), &paintStruct);
- if (!dc)
- return 0;
-
- paint(dc);
- ::EndPaint(window(), &paintStruct);
-
- handled = true;
- return 0;
-}
-
-LRESULT DrawsGradient::onPrintClient(WPARAM wParam, LPARAM, bool& handled)
-{
- paint(reinterpret_cast<HDC>(wParam));
-
- handled = true;
- return 0;
-}
-
-void DrawsGradient::paint(HDC dc) const
-{
- RECT clientRect;
- if (!::GetClientRect(window(), &clientRect))
- return;
-
- TRIVERTEX vertices[] = {
- // Upper-left: green
- { clientRect.left, clientRect.top, 0, 0xff00, 0, 0 },
- // Upper-right: blue
- { clientRect.right, clientRect.top, 0, 0, 0xff00, 0 },
- // Lower-left: yellow
- { clientRect.left, clientRect.bottom, 0xff00, 0xff00, 0, 0 },
- // Lower-right: red
- { clientRect.right, clientRect.bottom, 0xff00, 0, 0, 0 },
- };
-
- GRADIENT_TRIANGLE mesh[] = {
- // Upper-left triangle
- { 0, 1, 2 },
- // Lower-right triangle
- { 1, 2, 3 },
- };
-
- ::GradientFill(dc, vertices, _countof(vertices), mesh, _countof(mesh), GRADIENT_FILL_TRIANGLE);
-}
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/GetValueNetscapeWindow.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/GetValueNetscapeWindow.cpp
deleted file mode 100644
index 32fd99b..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/GetValueNetscapeWindow.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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"
-
-#include "PluginObject.h"
-
-using namespace std;
-
-// NPN_GetValue(NPNVnetscapeWindow) should return a valid HWND.
-
-class GetValueNetscapeWindow : public PluginTest {
-public:
- GetValueNetscapeWindow(NPP npp, const string& identifier)
- : PluginTest(npp, identifier)
- , m_didReceiveInitialSetWindowCall(false)
- {
- }
-
-private:
- virtual NPError NPP_SetWindow(NPP instance, NPWindow* window)
- {
- if (m_didReceiveInitialSetWindowCall)
- return NPERR_NO_ERROR;
- m_didReceiveInitialSetWindowCall = true;
-
- HWND hwnd;
- NPError error = NPN_GetValue(NPNVnetscapeWindow, &hwnd);
- if (error != NPERR_NO_ERROR) {
- pluginLog(instance, "NPN_GetValue(NPNVnetscapeWindow) failed with error %d", error);
- return NPERR_GENERIC_ERROR;
- }
-
- if (!::IsWindow(hwnd)) {
- pluginLog(instance, "::IsWindow returned FALSE");
- return NPERR_GENERIC_ERROR;
- }
-
- if (hwnd == window->window) {
- pluginLog(instance, "NPN_GetValue(NPNVnetscapeWindow) returned the same value as NPWindow::window");
- return NPERR_GENERIC_ERROR;
- }
-
- pluginLog(instance, "NPN_GetValue(NPNVnetscapeWindow) succeeded");
- return NPERR_NO_ERROR;
- }
-
- bool m_didReceiveInitialSetWindowCall;
-};
-
-static PluginTest::Register<GetValueNetscapeWindow> getValueNetscapeWindow("get-value-netscape-window");
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp
deleted file mode 100644
index e598c49..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * 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 "WindowedPluginTest.h"
-
-#include "PluginObject.h"
-
-using namespace std;
-
-// NPN_InvalidateRect should invalidate the plugin's HWND.
-
-static const wchar_t instancePointerProperty[] = L"org.webkit.TestNetscapePlugin.NPNInvalidateRectInvalidatesWindow.InstancePointer";
-
-class TemporaryWindowMover {
-public:
- TemporaryWindowMover(HWND);
- ~TemporaryWindowMover();
-
- bool moveSucceeded() const { return m_moveSucceeded; }
-
-private:
- static const UINT standardSetWindowPosFlags = SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER;
- bool m_moveSucceeded;
- HWND m_window;
- RECT m_savedWindowRect;
-};
-
-TemporaryWindowMover::TemporaryWindowMover(HWND window)
- : m_window(window)
-{
- m_moveSucceeded = false;
-
- if (!::GetWindowRect(m_window, &m_savedWindowRect))
- return;
-
- if (!::SetWindowPos(m_window, 0, 0, 0, 0, 0, SWP_SHOWWINDOW | standardSetWindowPosFlags))
- return;
-
- m_moveSucceeded = true;
-};
-
-TemporaryWindowMover::~TemporaryWindowMover()
-{
- if (!m_moveSucceeded)
- return;
-
- ::SetWindowPos(m_window, 0, m_savedWindowRect.left, m_savedWindowRect.top, 0, 0, SWP_HIDEWINDOW | standardSetWindowPosFlags);
-}
-
-class NPNInvalidateRectInvalidatesWindow : public WindowedPluginTest {
-public:
- NPNInvalidateRectInvalidatesWindow(NPP, const string& identifier);
- ~NPNInvalidateRectInvalidatesWindow();
-
-private:
- virtual LRESULT wndProc(UINT message, WPARAM, LPARAM, bool& handled);
-
- void onPaint();
- void testInvalidateRect();
-
- virtual NPError NPP_SetWindow(NPP, NPWindow*);
-
- TemporaryWindowMover* m_windowMover;
-};
-
-NPNInvalidateRectInvalidatesWindow::NPNInvalidateRectInvalidatesWindow(NPP npp, const string& identifier)
- : WindowedPluginTest(npp, identifier)
- , m_windowMover(0)
-{
-}
-
-NPNInvalidateRectInvalidatesWindow::~NPNInvalidateRectInvalidatesWindow()
-{
- delete m_windowMover;
-}
-
-NPError NPNInvalidateRectInvalidatesWindow::NPP_SetWindow(NPP instance, NPWindow* npWindow)
-{
- NPError error = WindowedPluginTest::NPP_SetWindow(instance, npWindow);
- if (error != NPERR_NO_ERROR)
- return error;
-
- if (!window())
- return NPERR_NO_ERROR;
-
- // The test harness's window (the one that contains the WebView) is off-screen and hidden.
- // We need to move it on-screen and make it visible in order for the plugin's window to
- // accumulate an update region when the DWM is disabled.
-
- HWND testHarnessWindow = ::GetAncestor(window(), GA_ROOT);
- if (!testHarnessWindow) {
- pluginLog(instance, "Failed to get test harness window");
- return NPERR_GENERIC_ERROR;
- }
-
- m_windowMover = new TemporaryWindowMover(testHarnessWindow);
- if (!m_windowMover->moveSucceeded()) {
- pluginLog(instance, "Failed to move test harness window on-screen");
- return NPERR_GENERIC_ERROR;
- }
-
- // Wait until we receive a WM_PAINT message to ensure that the window is on-screen before we do
- // the NPN_InvalidateRect test.
- waitUntilDone();
- return NPERR_NO_ERROR;
-}
-
-LRESULT NPNInvalidateRectInvalidatesWindow::wndProc(UINT message, WPARAM wParam, LPARAM lParam, bool& handled)
-{
- if (message == WM_PAINT)
- onPaint();
-
- handled = false;
- return 0;
-}
-
-void NPNInvalidateRectInvalidatesWindow::onPaint()
-{
- testInvalidateRect();
- notifyDone();
- delete m_windowMover;
- m_windowMover = 0;
-}
-
-void NPNInvalidateRectInvalidatesWindow::testInvalidateRect()
-{
- RECT clientRect;
- if (!::GetClientRect(window(), &clientRect)) {
- pluginLog(m_npp, "::GetClientRect failed");
- return;
- }
-
- if (::IsRectEmpty(&clientRect)) {
- pluginLog(m_npp, "Plugin's HWND has not been sized when NPP_SetWindow is called");
- return;
- }
-
- // Clear the invalid region.
- if (!::ValidateRect(window(), 0)) {
- pluginLog(m_npp, "::ValidateRect failed");
- return;
- }
-
- // Invalidate our lower-right quadrant.
- NPRect rectToInvalidate;
- rectToInvalidate.left = (clientRect.right - clientRect.left) / 2;
- rectToInvalidate.top = (clientRect.bottom - clientRect.top) / 2;
- rectToInvalidate.right = clientRect.right;
- rectToInvalidate.bottom = clientRect.bottom;
- NPN_InvalidateRect(&rectToInvalidate);
-
- RECT invalidRect;
- if (!::GetUpdateRect(window(), &invalidRect, FALSE)) {
- pluginLog(m_npp, "::GetUpdateRect failed");
- return;
- }
-
- if (invalidRect.left != rectToInvalidate.left || invalidRect.top != rectToInvalidate.top || invalidRect.right != rectToInvalidate.right || invalidRect.bottom != rectToInvalidate.bottom) {
- pluginLog(m_npp, "Expected invalid rect {left=%u, top=%u, right=%u, bottom=%u}, but got {left=%d, top=%d, right=%d, bottom=%d}", rectToInvalidate.left, rectToInvalidate.top, rectToInvalidate.right, rectToInvalidate.bottom, invalidRect.left, invalidRect.top, invalidRect.right, invalidRect.bottom);
- return;
- }
-
- pluginLog(m_npp, "Plugin's HWND has been invalidated as expected");
-}
-
-static PluginTest::Register<NPNInvalidateRectInvalidatesWindow> registrar("npn-invalidate-rect-invalidates-window");
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowGeometryInitializedBeforeSetWindow.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowGeometryInitializedBeforeSetWindow.cpp
deleted file mode 100644
index 8054497..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowGeometryInitializedBeforeSetWindow.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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"
-
-#include "PluginObject.h"
-
-using namespace std;
-
-// Plugin's HWND should be sized/positioned before NPP_SetWindow is called.
-
-class WindowGeometryInitializedBeforeSetWindow : public PluginTest {
-public:
- WindowGeometryInitializedBeforeSetWindow(NPP npp, const string& identifier)
- : PluginTest(npp, identifier)
- , m_didReceiveInitialSetWindowCall(false)
- {
- }
-
-private:
- virtual NPError NPP_SetWindow(NPP instance, NPWindow* window)
- {
- if (m_didReceiveInitialSetWindowCall)
- return NPERR_NO_ERROR;
- m_didReceiveInitialSetWindowCall = true;
-
- if (window->type != NPWindowTypeWindow) {
- pluginLog(instance, "window->type should be NPWindowTypeWindow but was %d", window->type);
- return NPERR_GENERIC_ERROR;
- }
-
- HWND hwnd = reinterpret_cast<HWND>(window->window);
- RECT rect;
- if (!::GetClientRect(hwnd, &rect)) {
- pluginLog(instance, "::GetClientRect failed");
- return NPERR_GENERIC_ERROR;
- }
-
- if (::IsRectEmpty(&rect)) {
- pluginLog(instance, "Plugin's HWND has not been sized when NPP_SetWindow is called");
- return NPERR_GENERIC_ERROR;
- }
-
- HWND parent = ::GetParent(hwnd);
- if (!parent) {
- pluginLog(instance, "::GetParent failed");
- return NPERR_GENERIC_ERROR;
- }
-
- // MSDN says that calling ::MapWindowPoints this way will tell it we're passing a RECT rather than two POINTs.
- if (!::MapWindowPoints(hwnd, parent, reinterpret_cast<POINT*>(&rect), 2)) {
- pluginLog(instance, "::MapWindowPoints failed");
- return NPERR_GENERIC_ERROR;
- }
-
- if (rect.left != window->x || rect.top != window->y || (rect.right - rect.left) != window->width || (rect.bottom - rect.top) != window->height) {
- pluginLog(instance, "HWND's rect and NPWindow's rect are not equal");
- return NPERR_GENERIC_ERROR;
- }
-
- pluginLog(instance, "Plugin's HWND has been sized and positioned before NPP_SetWindow was called");
- return NPERR_NO_ERROR;
- }
-
- bool m_didReceiveInitialSetWindowCall;
-};
-
-static PluginTest::Register<WindowGeometryInitializedBeforeSetWindow> windowGeometryInitializedBeforeSetWindow("window-geometry-initialized-before-set-window");
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowRegionIsSetToClipRect.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowRegionIsSetToClipRect.cpp
deleted file mode 100644
index 975a598..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowRegionIsSetToClipRect.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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"
-
-#include "PluginObject.h"
-
-using namespace std;
-
-// The plugin's window's window region should be set to the plugin's clip rect.
-
-class WindowRegionIsSetToClipRect : public PluginTest {
-public:
- WindowRegionIsSetToClipRect(NPP, const string& identifier);
-
-private:
- virtual NPError NPP_SetWindow(NPP, NPWindow*);
-
- bool m_didReceiveInitialSetWindowCall;
-};
-
-static PluginTest::Register<WindowRegionIsSetToClipRect> registrar("window-region-is-set-to-clip-rect");
-
-WindowRegionIsSetToClipRect::WindowRegionIsSetToClipRect(NPP npp, const string& identifier)
- : PluginTest(npp, identifier)
- , m_didReceiveInitialSetWindowCall(false)
-{
-}
-
-NPError WindowRegionIsSetToClipRect::NPP_SetWindow(NPP instance, NPWindow* window)
-{
- if (m_didReceiveInitialSetWindowCall)
- return NPERR_NO_ERROR;
- m_didReceiveInitialSetWindowCall = true;
-
- if (window->type != NPWindowTypeWindow) {
- pluginLog(instance, "window->type should be NPWindowTypeWindow but was %d", window->type);
- return NPERR_GENERIC_ERROR;
- }
-
- HWND hwnd = reinterpret_cast<HWND>(window->window);
-
- RECT regionRect;
- if (::GetWindowRgnBox(hwnd, &regionRect) == ERROR) {
- pluginLog(instance, "::GetWindowRgnBox failed with error %u", ::GetLastError());
- return NPERR_GENERIC_ERROR;
- }
-
- // This expected rect is based on the layout of window-region-is-set-to-clip-rect.html.
- RECT expectedRect = { 50, 50, 100, 100 };
- if (!::EqualRect(&regionRect, &expectedRect)) {
- pluginLog(instance, "Expected region rect {left=%u, top=%u, right=%u, bottom=%u}, but got {left=%d, top=%d, right=%d, bottom=%d}", expectedRect.left, expectedRect.top, expectedRect.right, expectedRect.bottom, regionRect.left, regionRect.top, regionRect.right, regionRect.bottom);
- return NPERR_GENERIC_ERROR;
- }
-
- pluginLog(instance, "PASS: Plugin's window's window region has been set as expected");
-
- // While we're here, check that our window class doesn't have the CS_PARENTDC style, which
- // defeats clipping by ignoring the window region and always clipping to the parent window.
- // FIXME: It would be nice to have a pixel test that shows that we're
- // getting clipped correctly, but unfortunately window regions are ignored
- // during WM_PRINT (see <http://webkit.org/b/49034>).
- wchar_t className[512];
- if (!::GetClassNameW(hwnd, className, _countof(className))) {
- pluginLog(instance, "::GetClassName failed with error %u", ::GetLastError());
- return NPERR_GENERIC_ERROR;
- }
-
-#ifdef DEBUG_ALL
- const wchar_t webKitDLLName[] = L"WebKit_debug.dll";
-#else
- const wchar_t webKitDLLName[] = L"WebKit.dll";
-#endif
- HMODULE webKitModule = ::GetModuleHandleW(webKitDLLName);
- if (!webKitModule) {
- pluginLog(instance, "::GetModuleHandleW failed with error %u", ::GetLastError());
- return NPERR_GENERIC_ERROR;
- }
-
- WNDCLASSW wndClass;
- if (!::GetClassInfoW(webKitModule, className, &wndClass)) {
- pluginLog(instance, "::GetClassInfoW failed with error %u", ::GetLastError());
- return NPERR_GENERIC_ERROR;
- }
-
- if (wndClass.style & CS_PARENTDC)
- pluginLog(instance, "FAIL: Plugin's window's class has the CS_PARENTDC style, which will defeat clipping");
- else
- pluginLog(instance, "PASS: Plugin's window's class does not have the CS_PARENTDC style");
-
- return NPERR_NO_ERROR;
-}
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/mac/Info.plist b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/mac/Info.plist
deleted file mode 100644
index 7444b84..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/mac/Info.plist
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleDevelopmentRegion</key>
- <string>English</string>
- <key>CFBundleExecutable</key>
- <string>TestNetscapePlugIn</string>
- <key>CFBundleGetInfoString</key>
- <string>420+, Copyright 2006-2009 Apple Inc.</string>
- <key>CFBundleIconFile</key>
- <string></string>
- <key>CFBundleIdentifier</key>
- <string>com.apple.testnetscapeplugin</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundlePackageType</key>
- <string>BRPL</string>
- <key>CFBundleShortVersionString</key>
- <string>1.0</string>
- <key>CFBundleSignature</key>
- <string>????</string>
- <key>CFBundleVersion</key>
- <string>1.0</string>
- <key>CFPlugInDynamicRegisterFunction</key>
- <string></string>
- <key>CFPlugInDynamicRegistration</key>
- <string>NO</string>
- <key>CFPlugInFactories</key>
- <dict>
- <key>00000000-0000-0000-0000-000000000000</key>
- <string>MyFactoryFunction</string>
- </dict>
- <key>CFPlugInTypes</key>
- <dict>
- <key>00000000-0000-0000-0000-000000000000</key>
- <array>
- <string>00000000-0000-0000-0000-000000000000</string>
- </array>
- </dict>
- <key>CFPlugInUnloadFunction</key>
- <string></string>
- <key>WebPluginDescription</key>
- <string>Simple Netscape plug-in that handles test content for WebKit</string>
- <key>WebPluginMIMETypes</key>
- <dict>
- <key>application/x-webkit-test-netscape</key>
- <dict>
- <key>WebPluginExtensions</key>
- <array>
- <string>testnetscape</string>
- </array>
- <key>WebPluginTypeDescription</key>
- <string>test netscape content</string>
- </dict>
- </dict>
- <key>WebPluginName</key>
- <string>WebKit Test PlugIn</string>
-</dict>
-</plist>
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp
deleted file mode 100644
index 2110a8a..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp
+++ /dev/null
@@ -1,718 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 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. ``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
- * 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 "PluginObject.h"
-
-#include "PluginTest.h"
-#include <cstdlib>
-#include <string>
-
-#ifdef XP_UNIX
-#include <X11/Xlib.h>
-#endif
-
-#if !defined(NP_NO_CARBON) && defined(QD_HEADERS_ARE_PRIVATE) && QD_HEADERS_ARE_PRIVATE
-extern "C" void GlobalToLocal(Point*);
-#endif
-
-using namespace std;
-
-#define CRASH() do { \
- *(int *)(uintptr_t)0xbbadbeef = 0; \
- ((void(*)())0)(); /* More reliable, but doesn't say BBADBEEF */ \
-} while(false)
-
-static bool getEntryPointsWasCalled;
-static bool initializeWasCalled;
-
-#if XP_WIN
-#define STDCALL __stdcall
-
-static inline int strcasecmp(const char* s1, const char* s2)
-{
- return _stricmp(s1, s2);
-}
-
-#else
-#define STDCALL
-#endif
-
-extern "C" {
-NPError STDCALL NP_GetEntryPoints(NPPluginFuncs *pluginFuncs);
-}
-
-// Entry points
-extern "C"
-NPError STDCALL NP_Initialize(NPNetscapeFuncs *browserFuncs
-#ifdef XP_UNIX
- , NPPluginFuncs *pluginFuncs
-#endif
- )
-{
- initializeWasCalled = true;
-
-#if XP_WIN
- // Simulate Flash and QuickTime's behavior of crashing when NP_Initialize is called before NP_GetEntryPoints.
- if (!getEntryPointsWasCalled)
- CRASH();
-#endif
-
- browser = browserFuncs;
-
-#ifdef XP_UNIX
- return NP_GetEntryPoints(pluginFuncs);
-#else
- return NPERR_NO_ERROR;
-#endif
-}
-
-extern "C"
-NPError STDCALL NP_GetEntryPoints(NPPluginFuncs *pluginFuncs)
-{
- getEntryPointsWasCalled = true;
-
-#ifdef XP_MACOSX
- // Simulate Silverlight's behavior of crashing when NP_GetEntryPoints is called before NP_Initialize.
- if (!initializeWasCalled)
- CRASH();
-#endif
-
- pluginFunctions = pluginFuncs;
-
- pluginFuncs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
- pluginFuncs->size = sizeof(pluginFuncs);
- pluginFuncs->newp = NPP_New;
- pluginFuncs->destroy = NPP_Destroy;
- pluginFuncs->setwindow = NPP_SetWindow;
- pluginFuncs->newstream = NPP_NewStream;
- pluginFuncs->destroystream = NPP_DestroyStream;
- pluginFuncs->asfile = NPP_StreamAsFile;
- pluginFuncs->writeready = NPP_WriteReady;
- pluginFuncs->write = (NPP_WriteProcPtr)NPP_Write;
- pluginFuncs->print = NPP_Print;
- pluginFuncs->event = NPP_HandleEvent;
- pluginFuncs->urlnotify = NPP_URLNotify;
- pluginFuncs->getvalue = NPP_GetValue;
- pluginFuncs->setvalue = NPP_SetValue;
-
- return NPERR_NO_ERROR;
-}
-
-extern "C"
-void STDCALL NP_Shutdown(void)
-{
-}
-
-static void executeScript(const PluginObject* obj, const char* script);
-
-NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char *argn[], char *argv[], NPSavedData *saved)
-{
- bool forceCarbon = false;
-
-#ifdef XP_MACOSX
- NPEventModel eventModel;
-
- // Always turn on the CG model
- NPBool supportsCoreGraphics;
- if (browser->getvalue(instance, NPNVsupportsCoreGraphicsBool, &supportsCoreGraphics) != NPERR_NO_ERROR)
- supportsCoreGraphics = false;
-
- if (!supportsCoreGraphics)
- return NPERR_INCOMPATIBLE_VERSION_ERROR;
-
- NPDrawingModel drawingModelToUse = NPDrawingModelCoreGraphics;
-
- NPBool supportsCoreAnimation;
- if (browser->getvalue(instance, NPNVsupportsCoreAnimationBool, &supportsCoreAnimation) != NPERR_NO_ERROR)
- supportsCoreAnimation = false;
-
-#ifndef NP_NO_CARBON
- NPBool supportsCarbon = false;
-#endif
- NPBool supportsCocoa = false;
-
-#ifndef NP_NO_CARBON
- // A browser that doesn't know about NPNVsupportsCarbonBool is one that only supports Carbon event model.
- if (browser->getvalue(instance, NPNVsupportsCarbonBool, &supportsCarbon) != NPERR_NO_ERROR)
- supportsCarbon = true;
-#endif
-
- if (browser->getvalue(instance, NPNVsupportsCocoaBool, &supportsCocoa) != NPERR_NO_ERROR)
- supportsCocoa = false;
-
- if (supportsCocoa && !forceCarbon) {
- eventModel = NPEventModelCocoa;
-#ifndef NP_NO_CARBON
- } else if (supportsCarbon) {
- eventModel = NPEventModelCarbon;
-#endif
- } else {
- return NPERR_INCOMPATIBLE_VERSION_ERROR;
- }
-
- browser->setvalue(instance, NPPVpluginEventModel, (void *)eventModel);
-#endif // XP_MACOSX
-
- PluginObject* obj = (PluginObject*)browser->createobject(instance, getPluginClass());
- instance->pdata = obj;
-
-#ifdef XP_MACOSX
- obj->eventModel = eventModel;
-#if !defined(BUILDING_ON_TIGER)
- obj->coreAnimationLayer = 0;
-#endif
-#endif // XP_MACOSX
-
- string testIdentifier;
-
- for (int i = 0; i < argc; i++) {
- if (strcasecmp(argn[i], "test") == 0)
- testIdentifier = argv[i];
- if (strcasecmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad)
- obj->onStreamLoad = strdup(argv[i]);
- else if (strcasecmp(argn[i], "onStreamDestroy") == 0 && !obj->onStreamDestroy)
- obj->onStreamDestroy = strdup(argv[i]);
- else if (strcasecmp(argn[i], "onURLNotify") == 0 && !obj->onURLNotify)
- obj->onURLNotify = strdup(argv[i]);
- else if (strcasecmp(argn[i], "src") == 0 &&
- strcasecmp(argv[i], "data:application/x-webkit-test-netscape,returnerrorfromnewstream") == 0)
- obj->returnErrorFromNewStream = TRUE;
- else if (strcasecmp(argn[i], "onSetWindow") == 0 && !obj->onSetWindow)
- obj->onSetWindow = strdup(argv[i]);
- else if (strcasecmp(argn[i], "logfirstsetwindow") == 0)
- obj->logSetWindow = TRUE;
- else if (strcasecmp(argn[i], "testnpruntime") == 0)
- testNPRuntime(instance);
- else if (strcasecmp(argn[i], "forcecarbon") == 0)
- forceCarbon = true;
- else if (strcasecmp(argn[i], "logSrc") == 0) {
- for (int i = 0; i < argc; i++)
- if (strcasecmp(argn[i], "src") == 0)
- pluginLog(instance, "src: %s", argv[i]);
- } else if (strcasecmp(argn[i], "cleardocumentduringnew") == 0)
- executeScript(obj, "document.body.innerHTML = ''");
- else if (!strcasecmp(argn[i], "ondestroy"))
- obj->onDestroy = strdup(argv[i]);
- else if (strcasecmp(argn[i], "testwindowopen") == 0)
- obj->testWindowOpen = TRUE;
- else if (strcasecmp(argn[i], "drawingmodel") == 0) {
-#if defined(XP_MACOSX) && !defined(BUILDING_ON_TIGER)
- const char* value = argv[i];
- if (strcasecmp(value, "coreanimation") == 0) {
- if (supportsCoreAnimation)
- drawingModelToUse = NPDrawingModelCoreAnimation;
- else
- return NPERR_INCOMPATIBLE_VERSION_ERROR;
- } else if (strcasecmp(value, "coregraphics") == 0) {
- if (supportsCoreGraphics)
- drawingModelToUse = NPDrawingModelCoreGraphics;
- else
- return NPERR_INCOMPATIBLE_VERSION_ERROR;
- } else
- return NPERR_INCOMPATIBLE_VERSION_ERROR;
-#endif
- } else if (strcasecmp(argn[i], "testGetURLOnDestroy") == 0) {
-#if XP_WIN
- // FIXME: When https://bugs.webkit.org/show_bug.cgi?id=41831 is fixed, this #ifdef can be removed.
- obj->testGetURLOnDestroy = TRUE;
-#endif
- } else if (!strcasecmp(argn[i], "src") && strstr(argv[i], "plugin-document-has-focus.pl"))
- obj->testKeyboardFocusForPlugins = TRUE;
- else if (!strcasecmp(argn[i], "evaluatescript")) {
- char* script = argv[i];
- if (script == strstr(script, "mouse::")) {
- obj->mouseDownForEvaluateScript = true;
- obj->evaluateScriptOnMouseDownOrKeyDown = strdup(script + sizeof("mouse::") - 1);
- } else if (script == strstr(script, "key::")) {
- obj->evaluateScriptOnMouseDownOrKeyDown = strdup(script + sizeof("key::") - 1);
- }
- // When testing evaluate script on mouse-down or key-down, allow event logging to handle events.
- if (obj->evaluateScriptOnMouseDownOrKeyDown)
- obj->eventLogging = true;
- }
- }
-
-#ifdef XP_MACOSX
- browser->setvalue(instance, NPPVpluginDrawingModel, (void *)drawingModelToUse);
-#if !defined(BUILDING_ON_TIGER)
- if (drawingModelToUse == NPDrawingModelCoreAnimation)
- obj->coreAnimationLayer = createCoreAnimationLayer();
-#endif
-#endif
-
- browser->getvalue(instance, NPNVprivateModeBool, (void *)&obj->cachedPrivateBrowsingMode);
-
- obj->pluginTest = PluginTest::create(instance, testIdentifier);
-
-#ifdef XP_UNIX
- // On Unix, plugins only get events if they are windowless.
- return browser->setvalue(instance, NPPVpluginWindowBool, 0);
-#else
- return NPERR_NO_ERROR;
-#endif
-}
-
-NPError NPP_Destroy(NPP instance, NPSavedData **save)
-{
- PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
- if (obj) {
- if (obj->testGetURLOnDestroy)
- browser->geturlnotify(obj->npp, "about:blank", "", 0);
-
- if (obj->onDestroy) {
- executeScript(obj, obj->onDestroy);
- free(obj->onDestroy);
- }
-
- if (obj->onStreamLoad)
- free(obj->onStreamLoad);
-
- if (obj->onStreamDestroy)
- free(obj->onStreamDestroy);
-
- if (obj->onURLNotify)
- free(obj->onURLNotify);
-
- if (obj->onSetWindow)
- free(obj->onSetWindow);
-
- if (obj->logDestroy)
- pluginLog(instance, "NPP_Destroy");
-
-#if defined(XP_MACOSX) && !defined(BUILDING_ON_TIGER)
- if (obj->coreAnimationLayer)
- CFRelease(obj->coreAnimationLayer);
-#endif
-
- obj->pluginTest->NPP_Destroy(save);
-
- browser->releaseobject(&obj->header);
- }
- return NPERR_NO_ERROR;
-}
-
-NPError NPP_SetWindow(NPP instance, NPWindow *window)
-{
- PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
-
- if (obj) {
- obj->lastWindow = *window;
-
- if (obj->logSetWindow) {
- pluginLog(instance, "NPP_SetWindow: %d %d", (int)window->width, (int)window->height);
- obj->logSetWindow = FALSE;
- }
-
- if (obj->onSetWindow)
- executeScript(obj, obj->onSetWindow);
-
- if (obj->testWindowOpen) {
- testWindowOpen(instance);
- obj->testWindowOpen = FALSE;
- }
-
- if (obj->testKeyboardFocusForPlugins) {
- obj->eventLogging = true;
- executeScript(obj, "eventSender.keyDown('A');");
- }
- }
-
- return obj->pluginTest->NPP_SetWindow(instance, window);
-}
-
-static void executeScript(const PluginObject* obj, const char* script)
-{
- NPObject *windowScriptObject;
- browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject);
-
- NPString npScript;
- npScript.UTF8Characters = script;
- npScript.UTF8Length = strlen(script);
-
- NPVariant browserResult;
- browser->evaluate(obj->npp, windowScriptObject, &npScript, &browserResult);
- browser->releasevariantvalue(&browserResult);
-}
-
-NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream, NPBool seekable, uint16_t *stype)
-{
- PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
- obj->stream = stream;
- *stype = NP_NORMAL;
-
- if (obj->returnErrorFromNewStream)
- return NPERR_GENERIC_ERROR;
-
- if (browser->version >= NPVERS_HAS_RESPONSE_HEADERS)
- notifyStream(obj, stream->url, stream->headers);
-
- if (obj->onStreamLoad)
- executeScript(obj, obj->onStreamLoad);
-
- return NPERR_NO_ERROR;
-}
-
-NPError NPP_DestroyStream(NPP instance, NPStream *stream, NPReason reason)
-{
- PluginObject* obj = (PluginObject*)instance->pdata;
-
- 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);
- }
- }
-
- return obj->pluginTest->NPP_DestroyStream(stream, reason);
-}
-
-int32_t NPP_WriteReady(NPP instance, NPStream *stream)
-{
- return 4096;
-}
-
-int32_t NPP_Write(NPP instance, NPStream *stream, int32_t offset, int32_t len, void *buffer)
-{
- PluginObject* obj = (PluginObject*)instance->pdata;
-
- if (obj->returnNegativeOneFromWrite)
- return -1;
-
- return len;
-}
-
-void NPP_StreamAsFile(NPP instance, NPStream *stream, const char *fname)
-{
-}
-
-void NPP_Print(NPP instance, NPPrint *platformPrint)
-{
-}
-
-#ifdef XP_MACOSX
-#ifndef NP_NO_CARBON
-static int16_t handleEventCarbon(NPP instance, PluginObject* obj, EventRecord* event)
-{
- Point pt = { event->where.v, event->where.h };
-
- switch (event->what) {
- case nullEvent:
- // these are delivered non-deterministically, don't log.
- break;
- case mouseDown:
- GlobalToLocal(&pt);
- pluginLog(instance, "mouseDown at (%d, %d)", pt.h, pt.v);
- if (obj->evaluateScriptOnMouseDownOrKeyDown && obj->mouseDownForEvaluateScript)
- executeScript(obj, obj->evaluateScriptOnMouseDownOrKeyDown);
- break;
- case mouseUp:
- GlobalToLocal(&pt);
- pluginLog(instance, "mouseUp at (%d, %d)", pt.h, pt.v);
- break;
- case keyDown:
- pluginLog(instance, "keyDown '%c'", (char)(event->message & 0xFF));
- if (obj->evaluateScriptOnMouseDownOrKeyDown && !obj->mouseDownForEvaluateScript)
- executeScript(obj, obj->evaluateScriptOnMouseDownOrKeyDown);
- break;
- case keyUp:
- pluginLog(instance, "keyUp '%c'", (char)(event->message & 0xFF));
- if (obj->testKeyboardFocusForPlugins) {
- obj->eventLogging = false;
- obj->testKeyboardFocusForPlugins = FALSE;
- executeScript(obj, "layoutTestController.notifyDone();");
- }
- break;
- case autoKey:
- pluginLog(instance, "autoKey '%c'", (char)(event->message & 0xFF));
- break;
- case updateEvt:
- pluginLog(instance, "updateEvt");
- break;
- case diskEvt:
- pluginLog(instance, "diskEvt");
- break;
- case activateEvt:
- pluginLog(instance, "activateEvt");
- break;
- case osEvt:
- printf("PLUGIN: osEvt - ");
- switch ((event->message & 0xFF000000) >> 24) {
- case suspendResumeMessage:
- printf("%s\n", (event->message & 0x1) ? "resume" : "suspend");
- break;
- case mouseMovedMessage:
- printf("mouseMoved\n");
- break;
- default:
- printf("%08lX\n", event->message);
- }
- break;
- case kHighLevelEvent:
- pluginLog(instance, "kHighLevelEvent");
- break;
- // NPAPI events
- case NPEventType_GetFocusEvent:
- pluginLog(instance, "getFocusEvent");
- break;
- case NPEventType_LoseFocusEvent:
- pluginLog(instance, "loseFocusEvent");
- break;
- case NPEventType_AdjustCursorEvent:
- pluginLog(instance, "adjustCursorEvent");
- break;
- default:
- pluginLog(instance, "event %d", event->what);
- }
-
- return 0;
-}
-#endif
-
-static int16_t handleEventCocoa(NPP instance, PluginObject* obj, NPCocoaEvent* event)
-{
- switch (event->type) {
- case NPCocoaEventWindowFocusChanged:
-
- case NPCocoaEventFocusChanged:
- if (event->data.focus.hasFocus)
- pluginLog(instance, "getFocusEvent");
- else
- pluginLog(instance, "loseFocusEvent");
- return 1;
-
- case NPCocoaEventDrawRect:
- return 1;
-
- case NPCocoaEventKeyDown:
- if (event->data.key.characters)
- pluginLog(instance, "keyDown '%c'", CFStringGetCharacterAtIndex(reinterpret_cast<CFStringRef>(event->data.key.characters), 0));
- if (obj->evaluateScriptOnMouseDownOrKeyDown && !obj->mouseDownForEvaluateScript)
- executeScript(obj, obj->evaluateScriptOnMouseDownOrKeyDown);
- return 1;
-
- case NPCocoaEventKeyUp:
- if (event->data.key.characters) {
- pluginLog(instance, "keyUp '%c'", CFStringGetCharacterAtIndex(reinterpret_cast<CFStringRef>(event->data.key.characters), 0));
- if (obj->testKeyboardFocusForPlugins) {
- obj->eventLogging = false;
- obj->testKeyboardFocusForPlugins = FALSE;
- executeScript(obj, "layoutTestController.notifyDone();");
- }
- }
- return 1;
-
- case NPCocoaEventFlagsChanged:
- return 1;
-
- case NPCocoaEventMouseDown:
- pluginLog(instance, "mouseDown at (%d, %d)",
- (int)event->data.mouse.pluginX,
- (int)event->data.mouse.pluginY);
- if (obj->evaluateScriptOnMouseDownOrKeyDown && obj->mouseDownForEvaluateScript)
- executeScript(obj, obj->evaluateScriptOnMouseDownOrKeyDown);
- return 1;
- case NPCocoaEventMouseUp:
- pluginLog(instance, "mouseUp at (%d, %d)",
- (int)event->data.mouse.pluginX,
- (int)event->data.mouse.pluginY);
- return 1;
-
- case NPCocoaEventMouseMoved:
- case NPCocoaEventMouseEntered:
- case NPCocoaEventMouseExited:
- case NPCocoaEventMouseDragged:
- case NPCocoaEventScrollWheel:
- case NPCocoaEventTextInput:
- return 1;
- }
-
- return 0;
-}
-
-#endif // XP_MACOSX
-
-#ifdef XP_UNIX
-static int16_t handleEventX11(NPP instance, PluginObject* obj, XEvent* event)
-{
- XButtonPressedEvent* buttonPressEvent = reinterpret_cast<XButtonPressedEvent*>(event);
- XButtonReleasedEvent* buttonReleaseEvent = reinterpret_cast<XButtonReleasedEvent*>(event);
- switch (event->type) {
- case ButtonPress:
- pluginLog(instance, "mouseDown at (%d, %d)", buttonPressEvent->x, buttonPressEvent->y);
- if (obj->evaluateScriptOnMouseDownOrKeyDown && obj->mouseDownForEvaluateScript)
- executeScript(obj, obj->evaluateScriptOnMouseDownOrKeyDown);
- break;
- case ButtonRelease:
- pluginLog(instance, "mouseUp at (%d, %d)", buttonReleaseEvent->x, buttonReleaseEvent->y);
- break;
- case KeyPress:
- // FIXME: extract key code
- pluginLog(instance, "NOTIMPLEMENTED: keyDown '%c'", ' ');
- if (obj->evaluateScriptOnMouseDownOrKeyDown && !obj->mouseDownForEvaluateScript)
- executeScript(obj, obj->evaluateScriptOnMouseDownOrKeyDown);
- break;
- case KeyRelease:
- // FIXME: extract key code
- pluginLog(instance, "NOTIMPLEMENTED: keyUp '%c'", ' ');
- break;
- case GraphicsExpose:
- pluginLog(instance, "updateEvt");
- break;
- // NPAPI events
- case FocusIn:
- pluginLog(instance, "getFocusEvent");
- break;
- case FocusOut:
- pluginLog(instance, "loseFocusEvent");
- break;
- case EnterNotify:
- case LeaveNotify:
- case MotionNotify:
- pluginLog(instance, "adjustCursorEvent");
- break;
- default:
- pluginLog(instance, "event %d", event->type);
- }
-
- fflush(stdout);
- return 0;
-}
-#endif // XP_UNIX
-
-int16_t NPP_HandleEvent(NPP instance, void *event)
-{
- PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
- if (!obj->eventLogging)
- return 0;
-
-#ifdef XP_MACOSX
-#ifndef NP_NO_CARBON
- if (obj->eventModel == NPEventModelCarbon)
- return handleEventCarbon(instance, obj, static_cast<EventRecord*>(event));
-#endif
-
- assert(obj->eventModel == NPEventModelCocoa);
- return handleEventCocoa(instance, obj, static_cast<NPCocoaEvent*>(event));
-#elif defined(XP_UNIX)
- return handleEventX11(instance, obj, static_cast<XEvent*>(event));
-#else
- // FIXME: Implement for other platforms.
- return 0;
-#endif // XP_MACOSX
-}
-
-void NPP_URLNotify(NPP instance, const char *url, NPReason reason, void *notifyData)
-{
- PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
-
- if (obj->onURLNotify)
- executeScript(obj, obj->onURLNotify);
-
- handleCallback(obj, url, reason, notifyData);
-}
-
-NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
-{
-#ifdef XP_UNIX
- if (variable == NPPVpluginNameString) {
- *((char **)value) = const_cast<char*>("WebKit Test PlugIn");
- return NPERR_NO_ERROR;
- }
- if (variable == NPPVpluginDescriptionString) {
- *((char **)value) = const_cast<char*>("Simple Netscape plug-in that handles test content for WebKit");
- return NPERR_NO_ERROR;
- }
-#endif
-
- 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
- browser->retainobject((NPObject *)obj);
- *v = obj;
- return NPERR_NO_ERROR;
- }
-
-#if defined(XP_MACOSX) && !defined(BUILDING_ON_TIGER)
- if (variable == NPPVpluginCoreAnimationLayer) {
- if (!obj->coreAnimationLayer)
- return NPERR_GENERIC_ERROR;
-
- void **v = (void **)value;
- *v = (void*)CFRetain(obj->coreAnimationLayer);
- return NPERR_NO_ERROR;
- }
-#endif
-
- return NPERR_GENERIC_ERROR;
-}
-
-NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value)
-{
- PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
-
- switch (variable) {
- case NPNVprivateModeBool:
- obj->cachedPrivateBrowsingMode = *(NPBool*)value;
- return NPERR_NO_ERROR;
- default:
- return NPERR_GENERIC_ERROR;
- }
-}
-
-#ifdef XP_UNIX
-extern "C"
-const char* NP_GetMIMEDescription(void)
-{
- return "application/x-webkit-test-netscape:testnetscape:test netscape content";
-}
-
-extern "C"
-NPError NP_GetValue(NPP instance, NPPVariable variable, void* value)
-{
- return NPP_GetValue(instance, variable, value);
-}
-#endif
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.def b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.def
deleted file mode 100644
index ac41e7e..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.def
+++ /dev/null
@@ -1,6 +0,0 @@
-LIBRARY "npTestNetscapePlugin"
-
-EXPORTS
- NP_GetEntryPoints @1
- NP_Initialize @2
- NP_Shutdown @3
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.rc b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.rc
deleted file mode 100644
index a8fbbcd..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.rc
+++ /dev/null
@@ -1,101 +0,0 @@
-// Microsoft Visual C++ generated resource script.
-//
-#include "resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "windows.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
- "#include ""windows.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,0,0,1
- PRODUCTVERSION 1,0,0,1
- FILEFLAGSMASK 0x17L
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904e4"
- BEGIN
- VALUE "CompanyName", "Apple Inc."
- VALUE "FileDescription", "TestNetscapePlugIn"
- VALUE "FileOpenName", "test netscape content"
- VALUE "LegalCopyright", "Copyright Apple Inc. 2007-2009"
- VALUE "MIMEType", "application/x-webkit-test-netscape"
- VALUE "OriginalFilename", "npTestNetscapePlugin.dll"
- VALUE "ProductName", "TestNetscapePlugIn"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1252
- END
-END
-
-#endif // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
deleted file mode 100644
index dc5b70f..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
+++ /dev/null
@@ -1,505 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="TestNetscapePlugin"
- ProjectGUID="{C0737398-3565-439E-A2B8-AB2BE4D5430C}"
- RootNamespace="TestNetscapePlugin"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="2"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\TestNetscapePluginCommon.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="2"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\TestNetscapePluginCommon.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug_Cairo_CFLite|Win32"
- ConfigurationType="2"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops;.\TestNetscapePluginCommon.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug_All|Win32"
- ConfigurationType="2"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops;.\TestNetscapePluginCommon.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release_LTCG|Win32"
- ConfigurationType="2"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\TestNetscapePluginCommon.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release_Cairo_CFLite|Win32"
- ConfigurationType="2"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops;.\TestNetscapePluginCommon.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Tests"
- >
- <File
- RelativePath="..\Tests\DocumentOpenInDestroyStream.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\EvaluateJSAfterRemovingPluginElement.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\NPRuntimeObjectFromDestroyedPlugin.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\NPRuntimeRemoveProperty.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\NullNPPGetValuePointer.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\PassDifferentNPPStruct.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\PluginScriptableNPObjectInvokeDefault.cpp"
- >
- </File>
- <Filter
- Name="win"
- >
- <File
- RelativePath="..\Tests\win\DrawsGradient.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\win\GetValueNetscapeWindow.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\win\NPNInvalidateRectInvalidatesWindow.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\win\WindowGeometryInitializedBeforeSetWindow.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\win\WindowRegionIsSetToClipRect.cpp"
- >
- </File>
- </Filter>
- </Filter>
- <Filter
- Name="win"
- >
- <File
- RelativePath=".\WindowedPluginTest.cpp"
- >
- </File>
- <File
- RelativePath=".\WindowedPluginTest.h"
- >
- </File>
- </Filter>
- <File
- RelativePath="..\main.cpp"
- >
- </File>
- <File
- RelativePath="..\PluginObject.cpp"
- >
- </File>
- <File
- RelativePath="..\PluginObject.h"
- >
- </File>
- <File
- RelativePath="..\PluginTest.cpp"
- >
- </File>
- <File
- RelativePath="..\PluginTest.h"
- >
- </File>
- <File
- RelativePath=".\resource.h"
- >
- </File>
- <File
- RelativePath=".\TestNetscapePlugin.def"
- >
- </File>
- <File
- RelativePath=".\TestNetscapePlugin.rc"
- >
- </File>
- <File
- RelativePath=".\TestNetscapePlugin_debug.def"
- >
- </File>
- <File
- RelativePath="..\TestObject.cpp"
- >
- </File>
- <File
- RelativePath="..\TestObject.h"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginCommon.vsprops b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginCommon.vsprops
deleted file mode 100644
index 88aa183..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginCommon.vsprops
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="TestNetscapePluginCommon"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)..&quot;;&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\include&quot;"
- PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
- DisableSpecificWarnings="4819"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="Msimg32.lib"
- OutputFile="$(OutDir)\$(ProjectName)$(WebKitConfigSuffix)\np$(ProjectName)$(WebKitConfigSuffix).dll"
- ModuleDefinitionFile="TestNetscapePlugin$(WebKitConfigSuffix).def"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;"
- />
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="%SystemDrive%\cygwin\bin\which.exe bash&#x0D;&#x0A;if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;cmd /c&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; grep XX$(ProjectName)XX &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;if errorlevel 1 exit 1&#x0D;&#x0A;echo XX$(ProjectName)XX &gt; &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;"
- />
-</VisualStudioPropertySheet>
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin_debug.def b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin_debug.def
deleted file mode 100644
index 158fb7c..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin_debug.def
+++ /dev/null
@@ -1,6 +0,0 @@
-LIBRARY "npTestNetscapePlugin_debug"
-
-EXPORTS
- NP_GetEntryPoints @1
- NP_Initialize @2
- NP_Shutdown @3
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.cpp
deleted file mode 100644
index 96b51f8..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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 "WindowedPluginTest.h"
-
-using namespace std;
-
-static const wchar_t instancePointerProperty[] = L"org.webkit.TestNetscapePlugin.WindowedPluginTest.InstancePointer";
-
-WindowedPluginTest::WindowedPluginTest(NPP npp, const string& identifier)
- : PluginTest(npp, identifier)
- , m_window(0)
- , m_originalWndProc(0)
-{
-}
-
-NPError WindowedPluginTest::NPP_SetWindow(NPP instance, NPWindow* window)
-{
- HWND newWindow = reinterpret_cast<HWND>(window->window);
- if (newWindow == m_window)
- return NPERR_NO_ERROR;
-
- if (m_window) {
- ::RemovePropW(m_window, instancePointerProperty);
- ::SetWindowLongPtr(m_window, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(m_originalWndProc));
- m_originalWndProc = 0;
- }
-
- m_window = newWindow;
- if (!m_window)
- return NPERR_NO_ERROR;
-
- m_originalWndProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtrW(m_window, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(staticWndProc)));
- ::SetPropW(m_window, instancePointerProperty, this);
-
- return NPERR_NO_ERROR;
-}
-
-LRESULT WindowedPluginTest::staticWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- WindowedPluginTest* instance = reinterpret_cast<WindowedPluginTest*>(::GetPropW(hwnd, instancePointerProperty));
-
- bool handled = false;
- LRESULT result = instance->wndProc(message, wParam, lParam, handled);
- if (handled)
- return result;
-
- return ::CallWindowProcW(instance->m_originalWndProc, hwnd, message, wParam, lParam);
-}
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.h b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.h
deleted file mode 100644
index 7abc734..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef WindowedPluginTest_h
-#define WindowedPluginTest_h
-
-#include "PluginTest.h"
-
-class WindowedPluginTest : public PluginTest {
-protected:
- WindowedPluginTest(NPP, const std::string& identifier);
-
- HWND window() const { return m_window; }
-
- // For derived classes to override
- virtual LRESULT wndProc(UINT message, WPARAM, LPARAM, bool& handled) = 0;
-
- // PluginTest
- virtual NPError NPP_SetWindow(NPP, NPWindow*);
-
-private:
- static LRESULT CALLBACK staticWndProc(HWND, UINT message, WPARAM, LPARAM);
-
- HWND m_window;
- WNDPROC m_originalWndProc;
-};
-
-#endif // WindowedPluginTest_h
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/resource.h b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/resource.h
deleted file mode 100644
index b0ce340..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/resource.h
+++ /dev/null
@@ -1,14 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by TestNetscapePlugin.rc
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 101
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1001
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif