PageRenderTime 288ms CodeModel.GetById 100ms app.highlight 79ms RepoModel.GetById 102ms app.codeStats 1ms

/npapi/npunix.c

http://firefox-mac-pdf.googlecode.com/
C | 688 lines | 428 code | 94 blank | 166 comment | 16 complexity | c079ef92ef22b901a6ba608f05a0043e MD5 | raw file
  1/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  2 *
  3 * ***** BEGIN LICENSE BLOCK *****
  4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  5 *
  6 * The contents of this file are subject to the Mozilla Public License Version
  7 * 1.1 (the "License"); you may not use this file except in compliance with
  8 * the License. You may obtain a copy of the License at
  9 * http://www.mozilla.org/MPL/
 10 *
 11 * Software distributed under the License is distributed on an "AS IS" basis,
 12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 13 * for the specific language governing rights and limitations under the
 14 * License.
 15 *
 16 * The Original Code is mozilla.org code.
 17 *
 18 * The Initial Developer of the Original Code is
 19 * Netscape Communications Corporation.
 20 * Portions created by the Initial Developer are Copyright (C) 1998
 21 * the Initial Developer. All Rights Reserved.
 22 *
 23 * Contributor(s):
 24 *   Stephen Mak <smak@sun.com>
 25 *
 26 * Alternatively, the contents of this file may be used under the terms of
 27 * either of the GNU General Public License Version 2 or later (the "GPL"),
 28 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 29 * in which case the provisions of the GPL or the LGPL are applicable instead
 30 * of those above. If you wish to allow use of your version of this file only
 31 * under the terms of either the GPL or the LGPL, and not to allow others to
 32 * use your version of this file under the terms of the MPL, indicate your
 33 * decision by deleting the provisions above and replace them with the notice
 34 * and other provisions required by the GPL or the LGPL. If you do not delete
 35 * the provisions above, a recipient may use your version of this file under
 36 * the terms of any one of the MPL, the GPL or the LGPL.
 37 *
 38 * ***** END LICENSE BLOCK ***** */
 39
 40/*
 41 * npunix.c
 42 *
 43 * Netscape Client Plugin API
 44 * - Wrapper function to interface with the Netscape Navigator
 45 *
 46 * dp Suresh <dp@netscape.com>
 47 *
 48 *----------------------------------------------------------------------
 49 * PLUGIN DEVELOPERS:
 50 *  YOU WILL NOT NEED TO EDIT THIS FILE.
 51 *----------------------------------------------------------------------
 52 */
 53 
 54/*
 55 * Modified by Sam Gross for Firefox PDF Plugin for Mac
 56 */
 57
 58#define XP_UNIX 1
 59
 60#include <stdio.h>
 61#include "npapi.h"
 62#include "npfunctions.h"
 63
 64/*
 65 * Define PLUGIN_TRACE to have the wrapper functions print
 66 * messages to stderr whenever they are called.
 67 */
 68
 69#ifdef PLUGIN_TRACE
 70#include <stdio.h>
 71#define PLUGINDEBUGSTR(msg) fprintf(stderr, "%s\n", msg)
 72#else
 73#define PLUGINDEBUGSTR(msg)
 74#endif
 75
 76
 77/***********************************************************************
 78 *
 79 * Globals
 80 *
 81 ***********************************************************************/
 82
 83static NPNetscapeFuncs   gNetscapeFuncs;    /* Netscape Function table */
 84
 85
 86/***********************************************************************
 87 *
 88 * Wrapper functions : plugin calling Netscape Navigator
 89 *
 90 * These functions let the plugin developer just call the APIs
 91 * as documented and defined in npapi.h, without needing to know
 92 * about the function table and call macros in npupp.h.
 93 *
 94 ***********************************************************************/
 95
 96void
 97NPN_Version(int* plugin_major, int* plugin_minor,
 98         int* netscape_major, int* netscape_minor)
 99{
100    *plugin_major = NP_VERSION_MAJOR;
101    *plugin_minor = NP_VERSION_MINOR;
102
103    /* Major version is in high byte */
104    *netscape_major = gNetscapeFuncs.version >> 8;
105    /* Minor version is in low byte */
106    *netscape_minor = gNetscapeFuncs.version & 0xFF;
107}
108
109NPError
110NPN_GetValue(NPP instance, NPNVariable variable, void *r_value)
111{
112    return (*gNetscapeFuncs.getvalue)(instance, variable, r_value);
113}
114
115NPError
116NPN_SetValue(NPP instance, NPPVariable variable, void *value)
117{
118    return (*gNetscapeFuncs.setvalue)(instance, variable, value);
119}
120
121NPError
122NPN_GetURL(NPP instance, const char* url, const char* window)
123{
124    return (*gNetscapeFuncs.geturl)(instance, url, window);
125}
126
127NPError
128NPN_GetURLNotify(NPP instance, const char* url, const char* window, void* notifyData)
129{
130    return (*gNetscapeFuncs.geturlnotify)(instance, url, window, notifyData);
131}
132
133NPError
134NPN_PostURL(NPP instance, const char* url, const char* window,
135         uint32_t len, const char* buf, NPBool file)
136{
137    return (*gNetscapeFuncs.posturl)(instance, url, window, len, buf, file);
138}
139
140NPError
141NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32_t len,
142                  const char* buf, NPBool file, void* notifyData)
143{
144    return (*gNetscapeFuncs.posturlnotify)(instance, url, window, len, buf, file, notifyData);
145}
146
147NPError
148NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
149{
150    return (*gNetscapeFuncs.requestread)(stream, rangeList);
151}
152
153NPError
154NPN_NewStream(NPP instance, NPMIMEType type, const char *window,
155          NPStream** stream_ptr)
156{
157    return (*gNetscapeFuncs.newstream)(instance, type, window, stream_ptr);
158}
159
160int32_t
161NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer)
162{
163    return (*gNetscapeFuncs.write)(instance, stream, len, buffer);
164}
165
166NPError
167NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason)
168{
169    return (*gNetscapeFuncs.destroystream)(instance, stream, reason);
170}
171
172void
173NPN_Status(NPP instance, const char* message)
174{
175    (*gNetscapeFuncs.status)(instance, message);
176}
177
178const char*
179NPN_UserAgent(NPP instance)
180{
181    return (*gNetscapeFuncs.uagent)(instance);
182}
183
184void*
185NPN_MemAlloc(uint32_t size)
186{
187    return (*gNetscapeFuncs.memalloc)(size);
188}
189
190void NPN_MemFree(void* ptr)
191{
192    (*gNetscapeFuncs.memfree)(ptr);
193}
194
195uint32_t NPN_MemFlush(uint32_t size)
196{
197    return (*gNetscapeFuncs.memflush)(size);
198}
199
200void NPN_ReloadPlugins(NPBool reloadPages)
201{
202    (*gNetscapeFuncs.reloadplugins)(reloadPages);
203}
204
205void
206NPN_InvalidateRect(NPP instance, NPRect *invalidRect)
207{
208    (*gNetscapeFuncs.invalidaterect)(instance, invalidRect);
209}
210
211void
212NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion)
213{
214    (*gNetscapeFuncs.invalidateregion)(instance, invalidRegion);
215}
216
217void
218NPN_ForceRedraw(NPP instance)
219{
220    (*gNetscapeFuncs.forceredraw)(instance);
221}
222
223void NPN_PushPopupsEnabledState(NPP instance, NPBool enabled)
224{
225    (*gNetscapeFuncs.pushpopupsenabledstate)(instance, enabled);
226}
227
228void NPN_PopPopupsEnabledState(NPP instance)
229{
230    (*gNetscapeFuncs.poppopupsenabledstate)(instance);
231}
232
233NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name)
234{
235    return (*gNetscapeFuncs.getstringidentifier)(name);
236}
237
238void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount,
239                              NPIdentifier *identifiers)
240{
241    (*gNetscapeFuncs.getstringidentifiers)(names, nameCount, identifiers);
242}
243
244NPIdentifier NPN_GetIntIdentifier(int32_t intid)
245{
246    return (*gNetscapeFuncs.getintidentifier)(intid);
247}
248
249bool NPN_IdentifierIsString(NPIdentifier identifier)
250{
251    return (*gNetscapeFuncs.identifierisstring)(identifier);
252}
253
254NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier)
255{
256    return (*gNetscapeFuncs.utf8fromidentifier)(identifier);
257}
258
259int32_t NPN_IntFromIdentifier(NPIdentifier identifier)
260{
261    return (*gNetscapeFuncs.intfromidentifier)(identifier);
262}
263
264NPObject *NPN_CreateObject(NPP npp, NPClass *aClass)
265{
266    return (*gNetscapeFuncs.createobject)(npp, aClass);
267}
268
269NPObject *NPN_RetainObject(NPObject *obj)
270{
271    return (*gNetscapeFuncs.retainobject)(obj);
272}
273
274void NPN_ReleaseObject(NPObject *obj)
275{
276    (*gNetscapeFuncs.releaseobject)(obj);
277}
278
279bool NPN_Invoke(NPP npp, NPObject* obj, NPIdentifier methodName,
280                const NPVariant *args, uint32_t argCount, NPVariant *result)
281{
282    return (*gNetscapeFuncs.invoke)(npp, obj, methodName, args, argCount, result);
283}
284
285bool NPN_InvokeDefault(NPP npp, NPObject* obj, const NPVariant *args,
286                       uint32_t argCount, NPVariant *result)
287{
288    return (*gNetscapeFuncs.invokeDefault)(npp, obj, args, argCount, result);
289}
290
291bool NPN_Evaluate(NPP npp, NPObject* obj, NPString *script,
292                  NPVariant *result)
293{
294    return (*gNetscapeFuncs.evaluate)(npp, obj, script, result);
295}
296
297bool NPN_GetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName,
298                     NPVariant *result)
299{
300    return (*gNetscapeFuncs.getproperty)(npp, obj, propertyName, result);
301}
302
303bool NPN_SetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName,
304                     const NPVariant *value)
305{
306    return (*gNetscapeFuncs.setproperty)(npp, obj, propertyName, value);
307}
308
309bool NPN_RemoveProperty(NPP npp, NPObject* obj, NPIdentifier propertyName)
310{
311    return (*gNetscapeFuncs.removeproperty)(npp, obj, propertyName);
312}
313
314bool NPN_HasProperty(NPP npp, NPObject* obj, NPIdentifier propertyName)
315{
316    return (*gNetscapeFuncs.hasproperty)(npp, obj, propertyName);
317}
318
319bool NPN_HasMethod(NPP npp, NPObject* obj, NPIdentifier methodName)
320{
321    return (*gNetscapeFuncs.hasmethod)(npp, obj, methodName);
322}
323
324void NPN_ReleaseVariantValue(NPVariant *variant)
325{
326    (*gNetscapeFuncs.releasevariantvalue)(variant);
327}
328
329void NPN_SetException(NPObject* obj, const NPUTF8 *message)
330{
331    (*gNetscapeFuncs.setexception)(obj, message);
332}
333
334
335/***********************************************************************
336 *
337 * Wrapper functions : Netscape Navigator -> plugin
338 *
339 * These functions let the plugin developer just create the APIs
340 * as documented and defined in npapi.h, without needing to 
341 * install those functions in the function table or worry about
342 * setting up globals for 68K plugins.
343 *
344 ***********************************************************************/
345
346NPError
347Private_New(NPMIMEType pluginType, NPP instance, uint16_t mode,
348        int16_t argc, char* argn[], char* argv[], NPSavedData* saved)
349{
350    NPError ret;
351    PLUGINDEBUGSTR("New");
352    ret = NPP_New(pluginType, instance, mode, argc, argn, argv, saved);
353    return ret; 
354}
355
356NPError
357Private_Destroy(NPP instance, NPSavedData** save)
358{
359    PLUGINDEBUGSTR("Destroy");
360    return NPP_Destroy(instance, save);
361}
362
363NPError
364Private_SetWindow(NPP instance, NPWindow* window)
365{
366    NPError err;
367    PLUGINDEBUGSTR("SetWindow");
368    err = NPP_SetWindow(instance, window);
369    return err;
370}
371
372NPError
373Private_NewStream(NPP instance, NPMIMEType type, NPStream* stream,
374            NPBool seekable, uint16_t* stype)
375{
376    NPError err;
377    PLUGINDEBUGSTR("NewStream");
378    err = NPP_NewStream(instance, type, stream, seekable, stype);
379    return err;
380}
381
382int32_t
383Private_WriteReady(NPP instance, NPStream* stream)
384{
385    unsigned int result;
386    PLUGINDEBUGSTR("WriteReady");
387    result = NPP_WriteReady(instance, stream);
388    return result;
389}
390
391int32_t
392Private_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len,
393        void* buffer)
394{
395    unsigned int result;
396    PLUGINDEBUGSTR("Write");
397    result = NPP_Write(instance, stream, offset, len, buffer);
398    return result;
399}
400
401void
402Private_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
403{
404    PLUGINDEBUGSTR("StreamAsFile");
405    NPP_StreamAsFile(instance, stream, fname);
406}
407
408
409NPError
410Private_DestroyStream(NPP instance, NPStream* stream, NPError reason)
411{
412    NPError err;
413    PLUGINDEBUGSTR("DestroyStream");
414    err = NPP_DestroyStream(instance, stream, reason);
415    return err;
416}
417
418void
419Private_URLNotify(NPP instance, const char* url,
420                NPReason reason, void* notifyData)
421                
422{
423    PLUGINDEBUGSTR("URLNotify");
424    NPP_URLNotify(instance, url, reason, notifyData);
425}
426
427
428
429void
430Private_Print(NPP instance, NPPrint* platformPrint)
431{
432    PLUGINDEBUGSTR("Print");
433    NPP_Print(instance, platformPrint);
434}
435
436int16_t
437Private_HandleEvent(NPP instance, void* event)
438{
439    PLUGINDEBUGSTR("HandleEvent");
440    return NPP_HandleEvent(instance, event);
441}
442
443/*********************************************************************** 
444 *
445 * These functions are located automagically by netscape.
446 *
447 ***********************************************************************/
448
449/*
450 * NP_GetPluginVersion [optional]
451 *  - The browser uses the return value to indicate to the user what version of
452 *    this plugin is installed.
453 */
454char *
455NP_GetPluginVersion(void)
456{
457    return "1.0.0.15";
458}
459
460/*
461 * NP_GetMIMEDescription
462 *  - Netscape needs to know about this symbol
463 *  - Netscape uses the return value to identify when an object instance
464 *    of this plugin should be created.
465 */
466//char *
467//NP_GetMIMEDescription(void)
468//{
469//    return NPP_GetMIMEDescription();
470//}
471
472/*
473 * NP_GetValue [optional]
474 *  - Netscape needs to know about this symbol.
475 *  - Interfaces with plugin to get values for predefined variables
476 *    that the navigator needs.
477 */
478NPError
479NP_GetValue(void* future, NPPVariable variable, void *value)
480{
481    return NPP_GetValue(future, variable, value);
482}
483
484/*
485 * NP_Initialize
486 *  - Netscape needs to know about this symbol.
487 *  - It calls this function after looking up its symbol before it
488 *    is about to create the first ever object of this kind.
489 *
490 * PARAMETERS
491 *    nsTable   - The netscape function table. If developers just use these
492 *        wrappers, they don't need to worry about all these function
493 *        tables.
494 * RETURN
495 *    pluginFuncs
496 *      - This functions needs to fill the plugin function table
497 *        pluginFuncs and return it. Netscape Navigator plugin
498 *        library will use this function table to call the plugin.
499 *
500 */
501NPError
502NP_Initialize(NPNetscapeFuncs* nsTable)
503{
504    NPError err = NPERR_NO_ERROR;
505
506    PLUGINDEBUGSTR("NP_Initialize");
507    
508    /* validate input parameters */
509
510    if (nsTable == NULL)
511        err = NPERR_INVALID_FUNCTABLE_ERROR;
512    
513    /*
514     * Check the major version passed in Netscape's function table.
515     * We won't load if the major version is newer than what we expect.
516     * Also check that the function tables passed in are big enough for
517     * all the functions we need (they could be bigger, if Netscape added
518     * new APIs, but that's OK with us -- we'll just ignore them).
519     *
520     */
521
522    if (err == NPERR_NO_ERROR) {
523        if ((nsTable->version >> 8) > NP_VERSION_MAJOR)
524            err = NPERR_INCOMPATIBLE_VERSION_ERROR;
525        if (nsTable->size < ((char *)&nsTable->posturlnotify - (char *)nsTable))
526            err = NPERR_INVALID_FUNCTABLE_ERROR;
527    }
528        
529    
530    if (err == NPERR_NO_ERROR) {
531        /*
532         * Copy all the fields of Netscape function table into our
533         * copy so we can call back into Netscape later.  Note that
534         * we need to copy the fields one by one, rather than assigning
535         * the whole structure, because the Netscape function table
536         * could actually be bigger than what we expect.
537         */
538        gNetscapeFuncs.version       = nsTable->version;
539        gNetscapeFuncs.size          = nsTable->size;
540        gNetscapeFuncs.posturl       = nsTable->posturl;
541        gNetscapeFuncs.geturl        = nsTable->geturl;
542        gNetscapeFuncs.geturlnotify  = nsTable->geturlnotify;
543        gNetscapeFuncs.requestread   = nsTable->requestread;
544        gNetscapeFuncs.newstream     = nsTable->newstream;
545        gNetscapeFuncs.write         = nsTable->write;
546        gNetscapeFuncs.destroystream = nsTable->destroystream;
547        gNetscapeFuncs.status        = nsTable->status;
548        gNetscapeFuncs.uagent        = nsTable->uagent;
549        gNetscapeFuncs.memalloc      = nsTable->memalloc;
550        gNetscapeFuncs.memfree       = nsTable->memfree;
551        gNetscapeFuncs.memflush      = nsTable->memflush;
552        gNetscapeFuncs.reloadplugins = nsTable->reloadplugins;
553        gNetscapeFuncs.getvalue      = nsTable->getvalue;
554        gNetscapeFuncs.setvalue      = nsTable->setvalue;
555        gNetscapeFuncs.posturlnotify = nsTable->posturlnotify;
556
557        if (nsTable->size >= ((char *)&nsTable->setexception - (char *)nsTable))
558        {
559          gNetscapeFuncs.invalidaterect = nsTable->invalidaterect;
560          gNetscapeFuncs.invalidateregion = nsTable->invalidateregion;
561          gNetscapeFuncs.forceredraw = nsTable->forceredraw;
562          gNetscapeFuncs.getstringidentifier = nsTable->getstringidentifier;
563          gNetscapeFuncs.getstringidentifiers = nsTable->getstringidentifiers;
564          gNetscapeFuncs.getintidentifier = nsTable->getintidentifier;
565          gNetscapeFuncs.identifierisstring = nsTable->identifierisstring;
566          gNetscapeFuncs.utf8fromidentifier = nsTable->utf8fromidentifier;
567          gNetscapeFuncs.intfromidentifier = nsTable->intfromidentifier;
568          gNetscapeFuncs.createobject = nsTable->createobject;
569          gNetscapeFuncs.retainobject = nsTable->retainobject;
570          gNetscapeFuncs.releaseobject = nsTable->releaseobject;
571          gNetscapeFuncs.invoke = nsTable->invoke;
572          gNetscapeFuncs.invokeDefault = nsTable->invokeDefault;
573          gNetscapeFuncs.evaluate = nsTable->evaluate;
574          gNetscapeFuncs.getproperty = nsTable->getproperty;
575          gNetscapeFuncs.setproperty = nsTable->setproperty;
576          gNetscapeFuncs.removeproperty = nsTable->removeproperty;
577          gNetscapeFuncs.hasproperty = nsTable->hasproperty;
578          gNetscapeFuncs.hasmethod = nsTable->hasmethod;
579          gNetscapeFuncs.releasevariantvalue = nsTable->releasevariantvalue;
580          gNetscapeFuncs.setexception = nsTable->setexception;
581        }
582         else
583        {
584          gNetscapeFuncs.invalidaterect = NULL;
585          gNetscapeFuncs.invalidateregion = NULL;
586          gNetscapeFuncs.forceredraw = NULL;
587          gNetscapeFuncs.getstringidentifier = NULL;
588          gNetscapeFuncs.getstringidentifiers = NULL;
589          gNetscapeFuncs.getintidentifier = NULL;
590          gNetscapeFuncs.identifierisstring = NULL;
591          gNetscapeFuncs.utf8fromidentifier = NULL;
592          gNetscapeFuncs.intfromidentifier = NULL;
593          gNetscapeFuncs.createobject = NULL;
594          gNetscapeFuncs.retainobject = NULL;
595          gNetscapeFuncs.releaseobject = NULL;
596          gNetscapeFuncs.invoke = NULL;
597          gNetscapeFuncs.invokeDefault = NULL;
598          gNetscapeFuncs.evaluate = NULL;
599          gNetscapeFuncs.getproperty = NULL;
600          gNetscapeFuncs.setproperty = NULL;
601          gNetscapeFuncs.removeproperty = NULL;
602          gNetscapeFuncs.hasproperty = NULL;
603          gNetscapeFuncs.releasevariantvalue = NULL;
604          gNetscapeFuncs.setexception = NULL;
605        }
606        if (nsTable->size >=
607            ((char *)&nsTable->poppopupsenabledstate - (char *)nsTable))
608        {
609          gNetscapeFuncs.pushpopupsenabledstate = nsTable->pushpopupsenabledstate;
610          gNetscapeFuncs.poppopupsenabledstate  = nsTable->poppopupsenabledstate;
611        }
612         else
613        {
614          gNetscapeFuncs.pushpopupsenabledstate = NULL;
615          gNetscapeFuncs.poppopupsenabledstate  = NULL;
616        }
617    }
618    
619    return err;
620}
621
622/*
623 * NP_GetEntryPoints
624 *  - [sgross]: split from NP_Initialize 
625 */
626NPError
627NP_GetEntryPoints(NPPluginFuncs* pluginFuncs)
628{
629    NPError err = NPERR_NO_ERROR;
630
631    PLUGINDEBUGSTR("NP_GetEntryPoints");
632    
633    /* validate input parameters */
634
635    if (pluginFuncs == NULL)
636        err = NPERR_INVALID_FUNCTABLE_ERROR;
637  
638    if (err == NPERR_NO_ERROR) {
639        //if (pluginFuncs->size < sizeof(NPPluginFuncs))      
640        //    err = NPERR_INVALID_FUNCTABLE_ERROR;
641    }
642    
643    if (err == NPERR_NO_ERROR) {
644        /*
645         * Set up the plugin function table that Netscape will use to
646         * call us.  Netscape needs to know about our version and size
647         * and have a UniversalProcPointer for every function we
648         * implement.
649         */
650        pluginFuncs->version    = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
651        pluginFuncs->size       = sizeof(NPPluginFuncs);
652        pluginFuncs->newp       = (NPP_NewProcPtr)(Private_New);
653        pluginFuncs->destroy    = (NPP_DestroyProcPtr)(Private_Destroy);
654        pluginFuncs->setwindow  = (NPP_SetWindowProcPtr)(Private_SetWindow);
655        pluginFuncs->newstream  = (NPP_NewStreamProcPtr)(Private_NewStream);
656        pluginFuncs->destroystream = (NPP_DestroyStreamProcPtr)(Private_DestroyStream);
657        pluginFuncs->asfile     = (NPP_StreamAsFileProcPtr)(Private_StreamAsFile);
658        pluginFuncs->writeready = (NPP_WriteReadyProcPtr)(Private_WriteReady);
659        pluginFuncs->write      = (NPP_WriteProcPtr)(Private_Write);
660        pluginFuncs->print      = (NPP_PrintProcPtr)(Private_Print);
661        pluginFuncs->event      = (NPP_HandleEventProcPtr)(Private_HandleEvent);
662        pluginFuncs->urlnotify  = (NPP_URLNotifyProcPtr)(Private_URLNotify);
663        pluginFuncs->javaClass  = NULL;
664
665        // This function is supposedly loaded magically, but that doesn't
666        // seem to be true.
667        pluginFuncs->getvalue   = (NPP_GetValueProcPtr)(NP_GetValue);
668
669        err = NPP_Initialize();
670    }
671    return err;
672}
673
674
675/*
676 * NP_Shutdown [optional]
677 *  - Netscape needs to know about this symbol.
678 *  - It calls this function after looking up its symbol after
679 *    the last object of this kind has been destroyed.
680 *
681 */
682NPError
683NP_Shutdown(void)
684{
685    PLUGINDEBUGSTR("NP_Shutdown");
686    NPP_Shutdown();
687    return NPERR_NO_ERROR;
688}