From 8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2 Mon Sep 17 00:00:00 2001 From: The Android Open Source Project Date: Tue, 3 Mar 2009 19:30:52 -0800 Subject: auto import from //depot/cupcake/@135843 --- .../NPN_Invoke/English.lproj/Localized.r | 17 ++ WebCore/manual-tests/NPN_Invoke/Info.plist | 30 +++ .../NPN_Invoke.xcodeproj/project.pbxproj | 246 +++++++++++++++++++ WebCore/manual-tests/NPN_Invoke/main.c | 265 +++++++++++++++++++++ WebCore/manual-tests/NPN_Invoke/test.html | 29 +++ 5 files changed, 587 insertions(+) create mode 100644 WebCore/manual-tests/NPN_Invoke/English.lproj/Localized.r create mode 100644 WebCore/manual-tests/NPN_Invoke/Info.plist create mode 100644 WebCore/manual-tests/NPN_Invoke/NPN_Invoke.xcodeproj/project.pbxproj create mode 100644 WebCore/manual-tests/NPN_Invoke/main.c create mode 100644 WebCore/manual-tests/NPN_Invoke/test.html (limited to 'WebCore/manual-tests/NPN_Invoke') diff --git a/WebCore/manual-tests/NPN_Invoke/English.lproj/Localized.r b/WebCore/manual-tests/NPN_Invoke/English.lproj/Localized.r new file mode 100644 index 0000000..f5c8373 --- /dev/null +++ b/WebCore/manual-tests/NPN_Invoke/English.lproj/Localized.r @@ -0,0 +1,17 @@ +#include + +// Plugin info +resource 'STR#' (126) { { + "Tests NPN_Invoke()", + "NPN_Invoke Test Plug-In" +} }; + +// MIME Type descriptions +resource 'STR#' (127) { { + "NPN_Invoke test" +} }; + +// MIME Types +resource 'STR#' (128) { { + "test/npn-invoke" +} }; diff --git a/WebCore/manual-tests/NPN_Invoke/Info.plist b/WebCore/manual-tests/NPN_Invoke/Info.plist new file mode 100644 index 0000000..f7684e3 --- /dev/null +++ b/WebCore/manual-tests/NPN_Invoke/Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + NPN_Invoke + CFBundleGetInfoString + 420+, Copyright 2006 Apple Computer, Inc. + CFBundleIconFile + + CFBundleIdentifier + com.apple.test.plugins.npn-invoke + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BRPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + CFPlugInDynamicRegisterFunction + + CFPlugInDynamicRegistration + NO + + diff --git a/WebCore/manual-tests/NPN_Invoke/NPN_Invoke.xcodeproj/project.pbxproj b/WebCore/manual-tests/NPN_Invoke/NPN_Invoke.xcodeproj/project.pbxproj new file mode 100644 index 0000000..f89106f --- /dev/null +++ b/WebCore/manual-tests/NPN_Invoke/NPN_Invoke.xcodeproj/project.pbxproj @@ -0,0 +1,246 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + +/* Begin PBXBuildFile section */ + 2220AF6109A447200030077C /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2220AF6009A447200030077C /* WebKit.framework */; }; + 2220B04709A459ED0030077C /* Localized.r in Rez */ = {isa = PBXBuildFile; fileRef = 2220B04609A459ED0030077C /* Localized.r */; }; + 84226A8E06823C4700780194 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84226A8D06823C4700780194 /* Carbon.framework */; }; + 8454AD210680F60300DFAEA4 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 8454AD200680F60300DFAEA4 /* main.c */; }; + 8D576314048677EA00EA77CD /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; + 2220AF6009A447200030077C /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = /System/Library/Frameworks/WebKit.framework; sourceTree = ""; }; + 2220B03809A459B20030077C /* English */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; name = English; path = English.lproj/Localized.r; sourceTree = ""; }; + 84226A8D06823C4700780194 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; + 8454AD200680F60300DFAEA4 /* main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; + 8D576316048677EA00EA77CD /* NPN_Invoke.plugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NPN_Invoke.plugin; sourceTree = BUILT_PRODUCTS_DIR; }; + 8D576317048677EA00EA77CD /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8D576313048677EA00EA77CD /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 84226A8E06823C4700780194 /* Carbon.framework in Frameworks */, + 8D576314048677EA00EA77CD /* CoreFoundation.framework in Frameworks */, + 2220AF6109A447200030077C /* WebKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 089C166AFE841209C02AAC07 /* NetscapeMoviePlugIn */ = { + isa = PBXGroup; + children = ( + 08FB77AFFE84173DC02AAC07 /* Source */, + 089C167CFE841241C02AAC07 /* Resources */, + 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */, + 19C28FB6FE9D52B211CA2CBB /* Products */, + ); + name = NetscapeMoviePlugIn; + sourceTree = ""; + }; + 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 2220AF6009A447200030077C /* WebKit.framework */, + 84226A8D06823C4700780194 /* Carbon.framework */, + 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; + 089C167CFE841241C02AAC07 /* Resources */ = { + isa = PBXGroup; + children = ( + 2220B04609A459ED0030077C /* Localized.r */, + 8D576317048677EA00EA77CD /* Info.plist */, + ); + name = Resources; + sourceTree = ""; + }; + 08FB77AFFE84173DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 8454AD200680F60300DFAEA4 /* main.c */, + ); + name = Source; + sourceTree = ""; + }; + 19C28FB6FE9D52B211CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8D576316048677EA00EA77CD /* NPN_Invoke.plugin */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8D57630D048677EA00EA77CD /* NPN_Invoke */ = { + isa = PBXNativeTarget; + buildConfigurationList = 149C298308902C53008A9EFC /* Build configuration list for PBXNativeTarget "NPN_Invoke" */; + buildPhases = ( + 8D576311048677EA00EA77CD /* Sources */, + 8333A742068B76EA00241F49 /* Rez */, + 8D57630F048677EA00EA77CD /* Resources */, + 8D576313048677EA00EA77CD /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = NPN_Invoke; + productInstallPath = "$(HOME)/Library/Bundles"; + productName = NetscapeMoviePlugIn; + productReference = 8D576316048677EA00EA77CD /* NPN_Invoke.plugin */; + productType = "com.apple.product-type.bundle"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 089C1669FE841209C02AAC07 /* Project object */ = { + isa = PBXProject; + buildConfigurationList = 149C298708902C53008A9EFC /* Build configuration list for PBXProject "NPN_Invoke" */; + compatibilityVersion = "Xcode 2.4"; + hasScannedForEncodings = 1; + mainGroup = 089C166AFE841209C02AAC07 /* NetscapeMoviePlugIn */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8D57630D048677EA00EA77CD /* NPN_Invoke */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8D57630F048677EA00EA77CD /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXRezBuildPhase section */ + 8333A742068B76EA00241F49 /* Rez */ = { + isa = PBXRezBuildPhase; + buildActionMask = 2147483647; + files = ( + 2220B04709A459ED0030077C /* Localized.r in Rez */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXRezBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8D576311048677EA00EA77CD /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8454AD210680F60300DFAEA4 /* main.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 2220B04609A459ED0030077C /* Localized.r */ = { + isa = PBXVariantGroup; + children = ( + 2220B03809A459B20030077C /* English */, + ); + name = Localized.r; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 149C298408902C53008A9EFC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ( + ppc, + i386, + ); + FRAMEWORK_SEARCH_PATHS = "$(FRAMEWORK_SEARCH_PATHS)"; + GCC_DEBUGGING_SYMBOLS = full; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "/Library/Internet Plug-Ins"; + PRODUCT_NAME = NPN_Invoke; + WRAPPER_EXTENSION = plugin; + }; + name = Debug; + }; + 149C298508902C53008A9EFC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ( + ppc, + i386, + ); + FRAMEWORK_SEARCH_PATHS = "$(FRAMEWORK_SEARCH_PATHS)"; + GCC_DEBUGGING_SYMBOLS = full; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "/Library/Internet Plug-Ins"; + PRODUCT_NAME = NPN_Invoke; + WRAPPER_EXTENSION = plugin; + }; + name = Release; + }; + 149C298808902C53008A9EFC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PREBINDING = NO; + SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; + }; + name = Debug; + }; + 149C298908902C53008A9EFC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PREBINDING = NO; + SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 149C298308902C53008A9EFC /* Build configuration list for PBXNativeTarget "NPN_Invoke" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 149C298408902C53008A9EFC /* Debug */, + 149C298508902C53008A9EFC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 149C298708902C53008A9EFC /* Build configuration list for PBXProject "NPN_Invoke" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 149C298808902C53008A9EFC /* Debug */, + 149C298908902C53008A9EFC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 089C1669FE841209C02AAC07 /* Project object */; +} diff --git a/WebCore/manual-tests/NPN_Invoke/main.c b/WebCore/manual-tests/NPN_Invoke/main.c new file mode 100644 index 0000000..f149f54 --- /dev/null +++ b/WebCore/manual-tests/NPN_Invoke/main.c @@ -0,0 +1,265 @@ +/* + IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in + consideration of your agreement to the following terms, and your use, installation, + modification or redistribution of this Apple software constitutes acceptance of these + terms. If you do not agree with these terms, please do not use, install, modify or + redistribute this Apple software. + + In consideration of your agreement to abide by the following terms, and subject to these + terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in + this original Apple software (the "Apple Software"), to use, reproduce, modify and + redistribute the Apple Software, with or without modifications, in source and/or binary + forms; provided that if you redistribute the Apple Software in its entirety and without + modifications, you must retain this notice and the following text and disclaimers in all + such redistributions of the Apple Software. Neither the name, trademarks, service marks + or logos of Apple Computer, Inc. may be used to endorse or promote products derived from + the Apple Software without specific prior written permission from Apple. Except as expressly + stated in this notice, no other rights or licenses, express or implied, are granted by Apple + herein, including but not limited to any patent rights that may be infringed by your + derivative works or by other works in which the Apple Software may be incorporated. + + The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, + EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS + USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. + + IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, + REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND + WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR + OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import +#import +#import + +NPNetscapeFuncs *browser; + +NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved); +NPError NPP_Destroy(NPP instance, NPSavedData** save); +NPError NPP_SetWindow(NPP instance, NPWindow* window); +NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype); +NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason); +int32 NPP_WriteReady(NPP instance, NPStream* stream); +int32 NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer); +void NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname); +void NPP_Print(NPP instance, NPPrint* platformPrint); +int16 NPP_HandleEvent(NPP instance, void* event); +void NPP_URLNotify(NPP instance, const char* URL, NPReason reason, void* notifyData); +NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value); +NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value); + +#pragma export on +// Mach-o entry points +NPError NP_Initialize(NPNetscapeFuncs *browserFuncs); +NPError NP_GetEntryPoints(NPPluginFuncs *pluginFuncs); +void NP_Shutdown(void); +// For compatibility with CFM browsers. +int main(NPNetscapeFuncs *browserFuncs, NPPluginFuncs *pluginFuncs, NPP_ShutdownProcPtr *shutdown); +#pragma export off + + +typedef void (* FunctionPointer) (void); +typedef void (* TransitionVector) (void); +static FunctionPointer functionPointerForTVector(TransitionVector); +static TransitionVector tVectorForFunctionPointer(FunctionPointer); + +// Mach-o entry points +NPError NP_Initialize(NPNetscapeFuncs* browserFuncs) +{ + browser = browserFuncs; + return NPERR_NO_ERROR; +} + +NPError NP_GetEntryPoints(NPPluginFuncs* pluginFuncs) +{ + pluginFuncs->version = 11; + 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; +} + +void NP_Shutdown(void) +{ + +} + +// For compatibility with CFM browsers. +int main(NPNetscapeFuncs *browserFuncs, NPPluginFuncs *pluginFuncs, NPP_ShutdownProcPtr *shutdown) +{ + browser = malloc(sizeof(NPNetscapeFuncs)); + bzero(browser, sizeof(NPNetscapeFuncs)); + + browser->size = browserFuncs->size; + browser->version = browserFuncs->version; + + // Since this is a mach-o plug-in and the browser is CFM because it is calling main, translate + // our function points into TVectors so the browser can call them. + browser->geturl = (NPN_GetURLProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->geturl); + browser->posturl = (NPN_PostURLProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->posturl); + browser->requestread = (NPN_RequestReadProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->requestread); + browser->newstream = (NPN_NewStreamProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->newstream); + browser->write = (NPN_WriteProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->write); + browser->destroystream = (NPN_DestroyStreamProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->destroystream); + browser->status = (NPN_StatusProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->status); + browser->uagent = (NPN_UserAgentProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->uagent); + browser->memalloc = (NPN_MemAllocProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->memalloc); + browser->memfree = (NPN_MemFreeProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->memfree); + browser->memflush = (NPN_MemFlushProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->memflush); + browser->reloadplugins = (NPN_ReloadPluginsProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->reloadplugins); + browser->geturlnotify = (NPN_GetURLNotifyProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->geturlnotify); + browser->posturlnotify = (NPN_PostURLNotifyProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->posturlnotify); + browser->getvalue = (NPN_GetValueProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->getvalue); + browser->setvalue = (NPN_SetValueProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->setvalue); + browser->invalidaterect = (NPN_InvalidateRectProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->invalidaterect); + browser->invalidateregion = (NPN_InvalidateRegionProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->invalidateregion); + browser->forceredraw = (NPN_ForceRedrawProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->forceredraw); + browser->getJavaEnv = (NPN_GetJavaEnvProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->getJavaEnv); + browser->getJavaPeer = (NPN_GetJavaPeerProcPtr)functionPointerForTVector((TransitionVector)browserFuncs->getJavaPeer); + + pluginFuncs->version = 11; + pluginFuncs->size = sizeof(pluginFuncs); + pluginFuncs->newp = (NPP_NewProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_New); + pluginFuncs->destroy = (NPP_DestroyProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_Destroy); + pluginFuncs->setwindow = (NPP_SetWindowProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_SetWindow); + pluginFuncs->newstream = (NPP_NewStreamProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_NewStream); + pluginFuncs->destroystream = (NPP_DestroyStreamProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_DestroyStream); + pluginFuncs->asfile = (NPP_StreamAsFileProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_StreamAsFile); + pluginFuncs->writeready = (NPP_WriteReadyProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_WriteReady); + pluginFuncs->write = (NPP_WriteProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_Write); + pluginFuncs->print = (NPP_PrintProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_Print); + pluginFuncs->event = (NPP_HandleEventProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_HandleEvent); + pluginFuncs->urlnotify = (NPP_URLNotifyProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_URLNotify); + pluginFuncs->getvalue = (NPP_GetValueProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_GetValue); + pluginFuncs->setvalue = (NPP_SetValueProcPtr)tVectorForFunctionPointer((FunctionPointer)NPP_SetValue); + + *shutdown = (NPP_ShutdownProcPtr)tVectorForFunctionPointer((FunctionPointer)NP_Shutdown); + + return NPERR_NO_ERROR; +} + +NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved) +{ + // Call window.alert("Success!") + NPError error; + NPObject *windowObject = NULL; + error = browser->getvalue(instance, NPNVWindowNPObject, &windowObject); + if (error == NPERR_NO_ERROR) { + NPVariant alertMessage; + STRINGZ_TO_NPVARIANT("Success!", alertMessage); + NPVariant result; + browser->invoke(instance, windowObject, browser->getstringidentifier("alert"), &alertMessage, 1, &result); + browser->releaseobject(windowObject); + } + + return NPERR_NO_ERROR; +} + +NPError NPP_Destroy(NPP instance, NPSavedData** save) +{ + return NPERR_NO_ERROR; +} + +NPError NPP_SetWindow(NPP instance, NPWindow* window) +{ + return NPERR_NO_ERROR; +} + +NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype) +{ + *stype = NP_ASFILEONLY; + return NPERR_NO_ERROR; +} + +NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason) +{ + return NPERR_NO_ERROR; +} + +int32 NPP_WriteReady(NPP instance, NPStream* stream) +{ + return 0; +} + +int32 NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer) +{ + return 0; +} + +void NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname) +{ +} + +void NPP_Print(NPP instance, NPPrint* platformPrint) +{ + +} + +int16 NPP_HandleEvent(NPP instance, void* event) +{ + return 1; +} + +void NPP_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData) +{ + +} + +NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value) +{ + return NPERR_GENERIC_ERROR; +} + +NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value) +{ + return NPERR_GENERIC_ERROR; +} + +// function pointer converters + +FunctionPointer functionPointerForTVector(TransitionVector tvp) +{ + const uint32 temp[6] = {0x3D800000, 0x618C0000, 0x800C0000, 0x804C0004, 0x7C0903A6, 0x4E800420}; + uint32 *newGlue = NULL; + + if (tvp != NULL) { + newGlue = (uint32 *)malloc(sizeof(temp)); + if (newGlue != NULL) { + unsigned i; + for (i = 0; i < 6; i++) newGlue[i] = temp[i]; + newGlue[0] |= ((UInt32)tvp >> 16); + newGlue[1] |= ((UInt32)tvp & 0xFFFF); + MakeDataExecutable(newGlue, sizeof(temp)); + } + } + + return (FunctionPointer)newGlue; +} + +TransitionVector tVectorForFunctionPointer(FunctionPointer fp) +{ + FunctionPointer *newGlue = NULL; + if (fp != NULL) { + newGlue = (FunctionPointer *)malloc(2 * sizeof(FunctionPointer)); + if (newGlue != NULL) { + newGlue[0] = fp; + newGlue[1] = NULL; + } + } + return (TransitionVector)newGlue; +} diff --git a/WebCore/manual-tests/NPN_Invoke/test.html b/WebCore/manual-tests/NPN_Invoke/test.html new file mode 100644 index 0000000..5164701 --- /dev/null +++ b/WebCore/manual-tests/NPN_Invoke/test.html @@ -0,0 +1,29 @@ + + +NPN_Invoke() test + + + + +