Commit 7dd73f87 authored by ggaren's avatar ggaren

LayoutTests:

        Layout test for http://bugzilla.opendarwin.org/show_bug.cgi?id=6318
        REGRESSION: Repro crash in JS called from Flash on bdash.net.nz

        * fast/plugins/netscape-back-forward-expected.txt: Added.
        * fast/plugins/netscape-back-forward.html: Added.
        * fast/plugins/resources/go-back.html: Added.

WebKit:

        Reviewed by Darin.

        - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=6361
        Add plugin support to DumpRenderTree

        * WebKit.exp: export WebPluginDatabase class, which DumpRenderTree
        needs to add plugins to the runtime.

WebKitTools:

        Reviewed by darin.

        - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=6361
        Add plugin support to DumpRenderTree

        Also wrote first test plugin.

        * DumpRenderTree/DumpRenderTree.m:
        (main):
        (1) Put the WebView in an invisible window, because PlugIns are
        optimized not to load if there's no parent window.
        (2) Tell WebKit to load any PlugIns in the directory from which we
        loaded. This means we can build nasty PlugIns alongside DumpRenderTree
        and they'll load automagically during layout testing, but they won't be
        added to the user's system, hosing apps like Safari.

        * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj: Added new
        test PlugIn to project.

        PlugIn added to project:

        * DumpRenderTree/TestNetscapePlugIn.subproj/Info.plist: Added.
        * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.c: Added.
        (getPluginClass):
        (initializeIdentifiers):
        (pluginHasProperty):
        (pluginHasMethod):
        (pluginGetProperty):
        (pluginSetProperty):
        (pluginInvoke):
        (pluginInvokeDefault):
        (pluginInvalidate):
        (pluginAllocate):
        (pluginDeallocate):
        * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h: Added.
        * DumpRenderTree/TestNetscapePlugIn.subproj/main.c: Added.
        (NP_Initialize):
        (NP_GetEntryPoints):
        (NP_Shutdown):
        (NPP_New):
        (NPP_Destroy):
        (NPP_SetWindow):
        (NPP_NewStream):
        (NPP_DestroyStream):
        (NPP_WriteReady):
        (NPP_Write):
        (NPP_StreamAsFile):
        (NPP_Print):
        (NPP_HandleEvent):
        (NPP_URLNotify):
        (NPP_GetValue):
        (NPP_SetValue):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@11885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9cd074c5
2006-01-06 Geoffrey Garen <ggaren@apple.com>
Layout test for http://bugzilla.opendarwin.org/show_bug.cgi?id=6318
REGRESSION: Repro crash in JS called from Flash on bdash.net.nz
* fast/plugins/netscape-back-forward-expected.txt: Added.
* fast/plugins/netscape-back-forward.html: Added.
* fast/plugins/resources/go-back.html: Added.
2006-01-05 Alexey Proskuryakov <ap@nypop.com>
Reviewed by Darin.
......
Bug: REGRESSION: Repro crash in JS called from Flash on bdash.net.nz
If this test passes, you will see a PASS messge below.
----- AFTER back/forward navigation: -----
plugin.property is 'property'
callback received from plugin
PASS
<html>
<head>
<script>
/* Helper functions */
function print(message) {
var paragraph = document.createElement("p");
paragraph.appendChild(document.createTextNode(message));
document.getElementById("console").appendChild(paragraph);
}
/* Evaluator -- use for evaluating an expression in a funny way */
var Evaluator = new Object();
Evaluator.evaluateAfterBackForwardNavigation = function(expression)
{
/* onload doesn't fire after a back/forward navigation, but timers get restored.
* So, to execute a script after the back/forward navigation has completed,
* we set a timer.
*/
Evaluator.interval = window.setInterval("Evaluator.evaluate(" + expression + ")", 1000);
window.location.href = "resources/go-back.html";
}
Evaluator.evaluate = function(expression)
{
window.clearInterval(Evaluator.interval);
eval(expression);
}
/* Test */
var Test = new Object();
Test.didReceiveCallback = false;
Test.callback = function()
{
Test.didReceiveCallback = true;
print('callback received from plugin');
}
Test.continueAfterBackForwardNavigation = function()
{
print("----- AFTER back/forward navigation: -----");
try {
var plugin = document.embeds["testPlugin"];
if (plugin.property)
print("plugin.property is '" + plugin.property + "'");
// Netscape plugins seem to be able to call window-level functions only
window.callback = Test.callback;
if (plugin.testCallback)
plugin.testCallback("callback");
delete window.callback;
if (plugin.property && Test.didReceiveCallback)
print ("PASS");
else
print("FAIL");
}
catch (e) {
print("FAIL");
}
if (window.layoutTestController) {
layoutTestController.notifyDone();
}
}
Test.run = function()
{
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
Evaluator.evaluateAfterBackForwardNavigation('Test.continueAfterBackForwardNavigation()');
}
</script>
</head>
<body onload="Test.run()">
<p>Bug: <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=6318">REGRESSION: Repro crash in JS called from Flash on bdash.net.nz</a></p>
<p>If this test passes, you will see a PASS messge below.</p>
<hr>
<embed name="testPlugin" width="0" height="0" src="" type="application/x-webkit-test-netscape"></embed>
<div id="console"></div>
</body>
</html>
<html>
<body onload="window.history.back()"> </body>
</html>
2006-01-05 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin.
- Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=6361
Add plugin support to DumpRenderTree
* WebKit.exp: export WebPluginDatabase class, which DumpRenderTree
needs to add plugins to the runtime.
2006-01-03 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
.objc_class_name_WebPluginDatabase
.objc_class_name_WebArchive
.objc_class_name_WebBackForwardList
.objc_class_name_WebCoreStatistics
......
2006-01-06 Geoffrey Garen <ggaren@apple.com>
Reviewed by darin.
- Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=6361
Add plugin support to DumpRenderTree
Also wrote first test plugin.
* DumpRenderTree/DumpRenderTree.m:
(main):
(1) Put the WebView in an invisible window, because PlugIns are
optimized not to load if there's no parent window.
(2) Tell WebKit to load any PlugIns in the directory from which we
loaded. This means we can build nasty PlugIns alongside DumpRenderTree
and they'll load automagically during layout testing, but they won't be
added to the user's system, hosing apps like Safari.
* DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj: Added new
test PlugIn to project.
PlugIn added to project:
* DumpRenderTree/TestNetscapePlugIn.subproj/Info.plist: Added.
* DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.c: Added.
(getPluginClass):
(initializeIdentifiers):
(pluginHasProperty):
(pluginHasMethod):
(pluginGetProperty):
(pluginSetProperty):
(pluginInvoke):
(pluginInvokeDefault):
(pluginInvalidate):
(pluginAllocate):
(pluginDeallocate):
* DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h: Added.
* DumpRenderTree/TestNetscapePlugIn.subproj/main.c: Added.
(NP_Initialize):
(NP_GetEntryPoints):
(NP_Shutdown):
(NPP_New):
(NPP_Destroy):
(NPP_SetWindow):
(NPP_NewStream):
(NPP_DestroyStream):
(NPP_WriteReady):
(NPP_Write):
(NPP_StreamAsFile):
(NPP_Print):
(NPP_HandleEvent):
(NPP_URLNotify):
(NPP_GetValue):
(NPP_SetValue):
2006-01-04 Timothy Hatcher <timothy@apple.com>
Reviewed by Darin.
......
......@@ -34,6 +34,7 @@
#import <WebKit/WebFrameView.h>
#import <WebKit/WebPreferences.h>
#import <WebKit/WebView.h>
#import <WebKit/WebPluginDatabase.h>
#import <Carbon/Carbon.h> // for GetCurrentEventTime()
#import <ApplicationServices/ApplicationServices.h> // for CMSetDefaultProfileBySpace
......@@ -185,6 +186,16 @@ int main(int argc, const char *argv[])
localPasteboard = [NSPasteboard pasteboardWithUniqueName];
WebView *webView = [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)];
NSWindow *window = [[NSWindow alloc] initWithContentRect:NSZeroRect
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreNonretained
defer:YES];
[window setContentView:webView];
NSString *pwd = [[NSString stringWithCString:argv[0]] stringByDeletingLastPathComponent];
[WebPluginDatabase setAdditionalWebPlugInPaths:[NSArray arrayWithObject:pwd]];
[[WebPluginDatabase installedPlugins] refresh];
WaitUntilDoneDelegate *delegate = [[WaitUntilDoneDelegate alloc] init];
EditingDelegate *editingDelegate = [[EditingDelegate alloc] init];
[webView setFrameLoadDelegate:delegate];
......@@ -223,6 +234,7 @@ int main(int argc, const char *argv[])
[webView setUIDelegate:nil];
[webView release];
[window release];
[delegate release];
[editingDelegate release];
......
<?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>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>
/*
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 Apples 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 "PluginObject.h"
void pluginInvalidate ();
bool pluginHasProperty (NPClass *theClass, NPIdentifier name);
bool pluginHasMethod (NPClass *theClass, NPIdentifier name);
void pluginGetProperty (PluginObject *obj, NPIdentifier name, NPVariant *variant);
void pluginSetProperty (PluginObject *obj, NPIdentifier name, const NPVariant *variant);
void pluginInvoke (PluginObject *obj, NPIdentifier name, NPVariant *args, uint32_t argCount, NPVariant *result);
void pluginInvokeDefault (PluginObject *obj, NPVariant *args, uint32_t argCount, NPVariant *result);
NPObject *pluginAllocate (NPP npp, NPClass *theClass);
void pluginDeallocate (PluginObject *obj);
static NPClass _pluginFunctionPtrs = {
NP_CLASS_STRUCT_VERSION,
(NPAllocateFunctionPtr) pluginAllocate,
(NPDeallocateFunctionPtr) pluginDeallocate,
(NPInvalidateFunctionPtr) pluginInvalidate,
(NPHasMethodFunctionPtr) pluginHasMethod,
(NPInvokeFunctionPtr) pluginInvoke,
(NPInvokeDefaultFunctionPtr) pluginInvokeDefault,
(NPHasPropertyFunctionPtr) pluginHasProperty,
(NPGetPropertyFunctionPtr) pluginGetProperty,
(NPSetPropertyFunctionPtr) pluginSetProperty,
};
NPClass *getPluginClass(void)
{
return &_pluginFunctionPtrs;
}
static bool identifiersInitialized = false;
#define ID_PROPERTY_PROPERTY 0
#define NUM_PROPERTY_IDENTIFIERS 1
static NPIdentifier pluginPropertyIdentifiers[NUM_PROPERTY_IDENTIFIERS];
static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = {
"property"
};
#define ID_TEST_CALLBACK_METHOD 0
#define NUM_METHOD_IDENTIFIERS 1
static NPIdentifier pluginMethodIdentifiers[NUM_METHOD_IDENTIFIERS];
static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
"testCallback"
};
static void initializeIdentifiers()
{
browser->getstringidentifiers (pluginPropertyIdentifierNames, NUM_PROPERTY_IDENTIFIERS, pluginPropertyIdentifiers);
browser->getstringidentifiers (pluginMethodIdentifierNames, NUM_METHOD_IDENTIFIERS, pluginMethodIdentifiers);
};
bool pluginHasProperty (NPClass *theClass, NPIdentifier name)
{
for (int i = 0; i < NUM_PROPERTY_IDENTIFIERS; i++) {
if (name == pluginPropertyIdentifiers[i])
return true;
}
return false;
}
bool pluginHasMethod (NPClass *theClass, NPIdentifier name)
{
for (int i = 0; i < NUM_METHOD_IDENTIFIERS; i++) {
if (name == pluginMethodIdentifiers[i])
return true;
}
return false;
}
void pluginGetProperty (PluginObject *obj, NPIdentifier name, NPVariant *variant)
{
if (name == pluginPropertyIdentifiers[ID_PROPERTY_PROPERTY]) {
// just return "property"
NPString propertyNameString;
propertyNameString.UTF8Characters = "property";
propertyNameString.UTF8Length = sizeof("property") - 1;
variant->type = NPVariantType_String;
variant->value.stringValue = propertyNameString;
} else
variant->type = NPVariantType_Void;
}
void pluginSetProperty (PluginObject *obj, NPIdentifier name, const NPVariant *variant)
{
}
void pluginInvoke (PluginObject *obj, NPIdentifier name, NPVariant *args, unsigned argCount, NPVariant *result)
{
if (name == pluginMethodIdentifiers[ID_TEST_CALLBACK_METHOD]) {
// call whatever method name we're given
if (argCount > 0 && args->type == NPVariantType_String) {
NPVariant browserResult;
NPObject *windowScriptObject;
browser->getvalue(obj->npp, NPPVpluginScriptableNPObject, &windowScriptObject);
NPString argString = args[0].value.stringValue;
int size = argString.UTF8Length + 1;
NPUTF8 callbackString[size];
strncpy(callbackString, argString.UTF8Characters, argString.UTF8Length);
callbackString[size - 1] = '\0';
NPIdentifier callbackMethodID = browser->getstringidentifier(callbackString);
browser->invoke(obj->npp, windowScriptObject, callbackMethodID, 0, 0, &browserResult);
}
}
result->type = NPVariantType_Void;
}
void pluginInvokeDefault (PluginObject *obj, NPVariant *args, unsigned argCount, NPVariant *result)
{
result->type = NPVariantType_Void;
}
void pluginInvalidate ()
{
// Make sure we've released any remainging references to JavaScript
// objects.
}
NPObject *pluginAllocate (NPP npp, NPClass *theClass)
{
PluginObject *newInstance = (PluginObject *)malloc (sizeof(PluginObject));
if (!identifiersInitialized) {
identifiersInitialized = true;
initializeIdentifiers();
}
newInstance->npp = npp;
return (NPObject *)newInstance;
}
void pluginDeallocate (PluginObject *obj)
{
free ((void *)obj);
}
/*
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 <WebKit/npapi.h>
#import <WebKit/npfunctions.h>
#import <WebKit/npruntime.h>
extern NPNetscapeFuncs* browser;
typedef struct
{
NPClass *_class;
uint32_t referenceCount;
NPP npp;
NPWindow* window;
} PluginObject;
extern NPClass *getPluginClass(void);
/*
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 Apples 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 "PluginObject.h"
NPNetscapeFuncs *browser;
// Mach-o entry points
NPError NP_Initialize(NPNetscapeFuncs *browserFuncs);
NPError NP_GetEntryPoints(NPPluginFuncs *pluginFuncs);
void NP_Shutdown(void);
// 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)
{
}
NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char *argn[], char *argv[], NPSavedData *saved)
{
if (browser->version >= 14)
instance->pdata = browser->createobject (instance, getPluginClass());
return NPERR_NO_ERROR;
}
NPError NPP_Destroy(NPP instance, NPSavedData **save)
{
return NPERR_NO_ERROR;
}
NPError NPP_SetWindow(NPP instance, NPWindow *window)
{
PluginObject *obj = instance->pdata;
// Do nothing if browser didn't support NPN_CreateObject which would have created the PluginObject.
if (obj != NULL)
obj->window = 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 0;
}
void NPP_URLNotify(NPP instance, const char *url, NPReason reason, void *notifyData)
{
}
NPError NPP_GetValue(NPP instance, NPPVariable variable,