View | Details | Raw Unified | Return to bug 229242 | Differences between
and this patch

Collapse All | Expand All

(-)Makefile (-2 / +14 lines)
Lines 2-8 Link Here
2
2
3
PORTNAME=	icedtea-web
3
PORTNAME=	icedtea-web
4
PORTVERSION=	1.6.2
4
PORTVERSION=	1.6.2
5
PORTREVISION=	4
5
PORTREVISION=	5
6
CATEGORIES=	java www
6
CATEGORIES=	java www
7
MASTER_SITES=	http://icedtea.wildebeest.org/download/source/ \
7
MASTER_SITES=	http://icedtea.wildebeest.org/download/source/ \
8
		http://icedtea.classpath.org/download/source/
8
		http://icedtea.classpath.org/download/source/
Lines 42-50 Link Here
42
42
43
TEST_TARGET=	check
43
TEST_TARGET=	check
44
44
45
OPTIONS_DEFINE=	DOCS RHINO TAGSOUP
45
OPTIONS_DEFINE=	DOCS PLUGIN RHINO TAGSOUP
46
OPTIONS_DEFAULT=PLUGIN
46
OPTIONS_SUB=	yes
47
OPTIONS_SUB=	yes
47
48
49
PLUGIN_DESC=	Enable the browser plug-in
48
RHINO_DESC=	Add support for Proxy Auto Config files
50
RHINO_DESC=	Add support for Proxy Auto Config files
49
TAGSOUP_DESC=	Enable cleaning up of malformed JNLP files
51
TAGSOUP_DESC=	Enable cleaning up of malformed JNLP files
50
52
Lines 61-66 Link Here
61
TAGSOUP_VARS=		TAGSOUP_JAR="${JAVALIBDIR}/tagsoup.jar"
63
TAGSOUP_VARS=		TAGSOUP_JAR="${JAVALIBDIR}/tagsoup.jar"
62
TAGSOUP_VARS_OFF=	TAGSOUP_JAR=no
64
TAGSOUP_VARS_OFF=	TAGSOUP_JAR=no
63
65
66
PLUGIN_CONFIGURE_ENABLE=plugin
67
PLUGIN_CONFIGURE_ENV=	MOZILLA_CFLAGS="-I${FILESDIR} -DXP_UNIX" \
68
			MOZILLA_LIBS="-I${LOCALBASE}/lib"
69
PLUGIN_PORTDOCS=	plugin
70
PLUGIN_TEST_TARGET=	plugin-tests
71
PLUGIN_USE=		GNOME=glib20
72
PLUGIN_USES=		webplugin:native
73
PLUGIN_VARS=		WEBPLUGIN_DIR=${PREFIX}/lib
74
PLUGIN_VARS+=		WEBPLUGIN_FILES=IcedTeaPlugin.so
75
64
HAMCREST_JAR=	${JAVALIBDIR}/hamcrest.jar
76
HAMCREST_JAR=	${JAVALIBDIR}/hamcrest.jar
65
JUNIT_JAR=	${JAVALIBDIR}/junit.jar
77
JUNIT_JAR=	${JAVALIBDIR}/junit.jar
66
78
(-)files/npapi.h (+889 lines)
Line 0 Link Here
1
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* This Source Code Form is subject to the terms of the Mozilla Public
3
 * License, v. 2.0. If a copy of the MPL was not distributed with this
4
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
#ifndef npapi_h_
7
#define npapi_h_
8
9
#include "nptypes.h"
10
11
#if defined(_WIN32) && !defined(__SYMBIAN32__)
12
#include <windef.h>
13
#ifndef XP_WIN
14
#define XP_WIN 1
15
#endif
16
#endif
17
18
#if defined(__SYMBIAN32__)
19
#ifndef XP_SYMBIAN
20
#define XP_SYMBIAN 1
21
#undef XP_WIN
22
#endif
23
#endif
24
25
#if defined(__APPLE_CC__) && !defined(XP_UNIX)
26
#ifndef XP_MACOSX
27
#define XP_MACOSX 1
28
#endif
29
#endif
30
31
#if defined(XP_MACOSX) && defined(__LP64__)
32
#define NP_NO_QUICKDRAW
33
#define NP_NO_CARBON
34
#endif
35
36
#if defined(XP_MACOSX)
37
#include <ApplicationServices/ApplicationServices.h>
38
#include <OpenGL/OpenGL.h>
39
#ifndef NP_NO_CARBON
40
#include <Carbon/Carbon.h>
41
#endif
42
#endif
43
44
#if defined(XP_UNIX)
45
#include <stdio.h>
46
#if defined(MOZ_X11)
47
#include <X11/Xlib.h>
48
#include <X11/Xutil.h>
49
#endif
50
#endif
51
52
#if defined(XP_SYMBIAN)
53
#include <QEvent>
54
#include <QRegion>
55
#endif
56
57
/*----------------------------------------------------------------------*/
58
/*                        Plugin Version Constants                      */
59
/*----------------------------------------------------------------------*/
60
61
#define NP_VERSION_MAJOR 0
62
#define NP_VERSION_MINOR 29
63
64
65
/* The OS/2 version of Netscape uses RC_DATA to define the
66
   mime types, file extensions, etc that are required.
67
   Use a vertical bar to separate types, end types with \0.
68
   FileVersion and ProductVersion are 32bit ints, all other
69
   entries are strings that MUST be terminated with a \0.
70
71
AN EXAMPLE:
72
73
RCDATA NP_INFO_ProductVersion { 1,0,0,1,}
74
75
RCDATA NP_INFO_MIMEType    { "video/x-video|",
76
                             "video/x-flick\0" }
77
RCDATA NP_INFO_FileExtents { "avi|",
78
                             "flc\0" }
79
RCDATA NP_INFO_FileOpenName{ "MMOS2 video player(*.avi)|",
80
                             "MMOS2 Flc/Fli player(*.flc)\0" }
81
82
RCDATA NP_INFO_FileVersion       { 1,0,0,1 }
83
RCDATA NP_INFO_CompanyName       { "Netscape Communications\0" }
84
RCDATA NP_INFO_FileDescription   { "NPAVI32 Extension DLL\0"
85
RCDATA NP_INFO_InternalName      { "NPAVI32\0" )
86
RCDATA NP_INFO_LegalCopyright    { "Copyright Netscape Communications \251 1996\0"
87
RCDATA NP_INFO_OriginalFilename  { "NVAPI32.DLL" }
88
RCDATA NP_INFO_ProductName       { "NPAVI32 Dynamic Link Library\0" }
89
*/
90
/* RC_DATA types for version info - required */
91
#define NP_INFO_ProductVersion      1
92
#define NP_INFO_MIMEType            2
93
#define NP_INFO_FileOpenName        3
94
#define NP_INFO_FileExtents         4
95
/* RC_DATA types for version info - used if found */
96
#define NP_INFO_FileDescription     5
97
#define NP_INFO_ProductName         6
98
/* RC_DATA types for version info - optional */
99
#define NP_INFO_CompanyName         7
100
#define NP_INFO_FileVersion         8
101
#define NP_INFO_InternalName        9
102
#define NP_INFO_LegalCopyright      10
103
#define NP_INFO_OriginalFilename    11
104
105
#ifndef RC_INVOKED
106
107
/*----------------------------------------------------------------------*/
108
/*                       Definition of Basic Types                      */
109
/*----------------------------------------------------------------------*/
110
111
typedef unsigned char NPBool;
112
typedef int16_t       NPError;
113
typedef int16_t       NPReason;
114
typedef char*         NPMIMEType;
115
116
/*----------------------------------------------------------------------*/
117
/*                       Structures and definitions                     */
118
/*----------------------------------------------------------------------*/
119
120
#if !defined(__LP64__)
121
#if defined(XP_MACOSX)
122
#pragma options align=mac68k
123
#endif
124
#endif /* __LP64__ */
125
126
/*
127
 *  NPP is a plug-in's opaque instance handle
128
 */
129
typedef struct _NPP
130
{
131
  void* pdata;      /* plug-in private data */
132
  void* ndata;      /* netscape private data */
133
} NPP_t;
134
135
typedef NPP_t*  NPP;
136
137
typedef struct _NPStream
138
{
139
  void*    pdata; /* plug-in private data */
140
  void*    ndata; /* netscape private data */
141
  const    char* url;
142
  uint32_t end;
143
  uint32_t lastmodified;
144
  void*    notifyData;
145
  const    char* headers; /* Response headers from host.
146
                           * Exists only for >= NPVERS_HAS_RESPONSE_HEADERS.
147
                           * Used for HTTP only; nullptr for non-HTTP.
148
                           * Available from NPP_NewStream onwards.
149
                           * Plugin should copy this data before storing it.
150
                           * Includes HTTP status line and all headers,
151
                           * preferably verbatim as received from server,
152
                           * headers formatted as in HTTP ("Header: Value"),
153
                           * and newlines (\n, NOT \r\n) separating lines.
154
                           * Terminated by \n\0 (NOT \n\n\0). */
155
} NPStream;
156
157
typedef struct _NPByteRange
158
{
159
  int32_t  offset; /* negative offset means from the end */
160
  uint32_t length;
161
  struct _NPByteRange* next;
162
} NPByteRange;
163
164
typedef struct _NPSavedData
165
{
166
  int32_t len;
167
  void*   buf;
168
} NPSavedData;
169
170
typedef struct _NPRect
171
{
172
  uint16_t top;
173
  uint16_t left;
174
  uint16_t bottom;
175
  uint16_t right;
176
} NPRect;
177
178
typedef struct _NPSize
179
{
180
  int32_t width;
181
  int32_t height;
182
} NPSize;
183
184
typedef enum {
185
  NPFocusNext = 0,
186
  NPFocusPrevious = 1
187
} NPFocusDirection;
188
189
/* These formats describe the format in the memory byte-order. This means if
190
 * a 32-bit value of a pixel is viewed on a little-endian system the layout will
191
 * be 0xAARRGGBB. The Alpha channel will be stored in the most significant
192
 * bits. */
193
typedef enum {
194
  /* 32-bit per pixel 8-bit per channel - premultiplied alpha */
195
  NPImageFormatBGRA32     = 0x1,
196
  /* 32-bit per pixel 8-bit per channel - 1 unused channel */
197
  NPImageFormatBGRX32     = 0x2
198
} NPImageFormat;
199
200
typedef struct _NPAsyncSurface
201
{
202
  uint32_t version;
203
  NPSize size;
204
  NPImageFormat format;
205
  union {
206
    struct {
207
      uint32_t stride;
208
      void *data;
209
    } bitmap;
210
#if defined(XP_WIN)
211
    HANDLE sharedHandle;
212
#endif
213
  };
214
} NPAsyncSurface;
215
216
/* Return values for NPP_HandleEvent */
217
#define kNPEventNotHandled 0
218
#define kNPEventHandled 1
219
/* Exact meaning must be spec'd in event model. */
220
#define kNPEventStartIME 2
221
222
#if defined(XP_UNIX)
223
/*
224
 * Unix specific structures and definitions
225
 */
226
227
/*
228
 * Callback Structures.
229
 *
230
 * These are used to pass additional platform specific information.
231
 */
232
enum {
233
  NP_SETWINDOW = 1,
234
  NP_PRINT
235
};
236
237
typedef struct
238
{
239
  int32_t type;
240
} NPAnyCallbackStruct;
241
242
typedef struct
243
{
244
  int32_t      type;
245
#if defined(MOZ_X11)
246
  Display*     display;
247
  Visual*      visual;
248
  Colormap     colormap;
249
  unsigned int depth;
250
#endif
251
} NPSetWindowCallbackStruct;
252
253
typedef struct
254
{
255
  int32_t type;
256
  FILE* fp;
257
} NPPrintCallbackStruct;
258
259
#endif /* XP_UNIX */
260
261
typedef enum {
262
  NPDrawingModelDUMMY
263
#if defined(XP_MACOSX)
264
#ifndef NP_NO_QUICKDRAW
265
  , NPDrawingModelQuickDraw = 0
266
#endif
267
  , NPDrawingModelCoreGraphics = 1
268
  , NPDrawingModelOpenGL = 2
269
  , NPDrawingModelCoreAnimation = 3
270
  , NPDrawingModelInvalidatingCoreAnimation = 4
271
#endif
272
#if defined(XP_WIN)
273
  , NPDrawingModelSyncWin = 5
274
#endif
275
#if defined(MOZ_X11)
276
  , NPDrawingModelSyncX = 6
277
#endif
278
  , NPDrawingModelAsyncBitmapSurface = 7
279
#if defined(XP_WIN)
280
  , NPDrawingModelAsyncWindowsDXGISurface = 8
281
#endif
282
} NPDrawingModel;
283
284
#ifdef XP_MACOSX
285
typedef enum {
286
#ifndef NP_NO_CARBON
287
  NPEventModelCarbon = 0,
288
#endif
289
  NPEventModelCocoa = 1
290
} NPEventModel;
291
#endif
292
293
/*
294
 *   The following masks are applied on certain platforms to NPNV and
295
 *   NPPV selectors that pass around pointers to COM interfaces. Newer
296
 *   compilers on some platforms may generate vtables that are not
297
 *   compatible with older compilers. To prevent older plugins from
298
 *   not understanding a new browser's ABI, these masks change the
299
 *   values of those selectors on those platforms. To remain backwards
300
 *   compatible with different versions of the browser, plugins can
301
 *   use these masks to dynamically determine and use the correct C++
302
 *   ABI that the browser is expecting. This does not apply to Windows
303
 *   as Microsoft's COM ABI will likely not change.
304
 */
305
306
#define NP_ABI_GCC3_MASK  0x10000000
307
/*
308
 *   gcc 3.x generated vtables on UNIX and OSX are incompatible with
309
 *   previous compilers.
310
 */
311
#if (defined(XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3))
312
#define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK
313
#else
314
#define _NP_ABI_MIXIN_FOR_GCC3 0
315
#endif
316
317
#if defined(XP_MACOSX)
318
#define NP_ABI_MACHO_MASK 0x01000000
319
#define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK
320
#else
321
#define _NP_ABI_MIXIN_FOR_MACHO 0
322
#endif
323
324
#define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO)
325
326
/*
327
 * List of variable names for which NPP_GetValue shall be implemented
328
 */
329
typedef enum {
330
  NPPVpluginNameString = 1,
331
  NPPVpluginDescriptionString,
332
  NPPVpluginWindowBool,
333
  NPPVpluginTransparentBool,
334
  NPPVjavaClass,
335
  NPPVpluginWindowSize,
336
  NPPVpluginTimerInterval,
337
  NPPVpluginScriptableInstance = (10 | NP_ABI_MASK),
338
  NPPVpluginScriptableIID = 11,
339
  NPPVjavascriptPushCallerBool = 12,
340
  NPPVpluginKeepLibraryInMemory = 13,
341
  NPPVpluginNeedsXEmbed         = 14,
342
343
  /* Get the NPObject for scripting the plugin. Introduced in NPAPI minor version 14.
344
   */
345
  NPPVpluginScriptableNPObject  = 15,
346
347
  /* Get the plugin value (as \0-terminated UTF-8 string data) for
348
   * form submission if the plugin is part of a form. Use
349
   * NPN_MemAlloc() to allocate memory for the string data. Introduced
350
   * in NPAPI minor version 15.
351
   */
352
  NPPVformValue = 16,
353
354
  NPPVpluginUrlRequestsDisplayedBool = 17,
355
356
  /* Checks if the plugin is interested in receiving the http body of
357
   * all http requests (including failed ones, http status != 200).
358
   */
359
  NPPVpluginWantsAllNetworkStreams = 18,
360
361
  /* Browsers can retrieve a native ATK accessibility plug ID via this variable. */
362
  NPPVpluginNativeAccessibleAtkPlugId = 19,
363
364
  /* Checks to see if the plug-in would like the browser to load the "src" attribute. */
365
  NPPVpluginCancelSrcStream = 20,
366
367
  NPPVsupportsAdvancedKeyHandling = 21,
368
369
  NPPVpluginUsesDOMForCursorBool = 22,
370
371
  /* Used for negotiating drawing models */
372
  NPPVpluginDrawingModel = 1000
373
#if defined(XP_MACOSX)
374
  /* Used for negotiating event models */
375
  , NPPVpluginEventModel = 1001
376
  /* In the NPDrawingModelCoreAnimation drawing model, the browser asks the plug-in for a Core Animation layer. */
377
  , NPPVpluginCoreAnimationLayer = 1003
378
#endif
379
  /* Notification that the plugin just started or stopped playing audio */
380
  , NPPVpluginIsPlayingAudio = 4000
381
382
} NPPVariable;
383
384
/*
385
 * List of variable names for which NPN_GetValue should be implemented.
386
 */
387
typedef enum {
388
  NPNVxDisplay = 1,
389
  NPNVxtAppContext,
390
  NPNVnetscapeWindow,
391
  NPNVjavascriptEnabledBool,
392
  NPNVasdEnabledBool,
393
  NPNVisOfflineBool,
394
395
  NPNVserviceManager = (10 | NP_ABI_MASK),
396
  NPNVDOMElement     = (11 | NP_ABI_MASK),
397
  NPNVDOMWindow      = (12 | NP_ABI_MASK),
398
  NPNVToolkit        = (13 | NP_ABI_MASK),
399
  NPNVSupportsXEmbedBool = 14,
400
401
  /* Get the NPObject wrapper for the browser window. */
402
  NPNVWindowNPObject = 15,
403
404
  /* Get the NPObject wrapper for the plugins DOM element. */
405
  NPNVPluginElementNPObject = 16,
406
407
  NPNVSupportsWindowless = 17,
408
409
  NPNVprivateModeBool = 18,
410
411
  NPNVsupportsAdvancedKeyHandling = 21,
412
413
  NPNVdocumentOrigin = 22,
414
415
  NPNVpluginDrawingModel = 1000 /* Get the current drawing model (NPDrawingModel) */
416
#if defined(XP_MACOSX)
417
  , NPNVcontentsScaleFactor = 1001
418
#ifndef NP_NO_QUICKDRAW
419
  , NPNVsupportsQuickDrawBool = 2000
420
#endif
421
  , NPNVsupportsCoreGraphicsBool = 2001
422
  , NPNVsupportsOpenGLBool = 2002
423
  , NPNVsupportsCoreAnimationBool = 2003
424
  , NPNVsupportsInvalidatingCoreAnimationBool = 2004
425
#endif
426
  , NPNVsupportsAsyncBitmapSurfaceBool = 2007
427
#if defined(XP_WIN)
428
  , NPNVsupportsAsyncWindowsDXGISurfaceBool = 2008
429
  , NPNVpreferredDXGIAdapter = 2009
430
#endif
431
#if defined(XP_MACOSX)
432
#ifndef NP_NO_CARBON
433
  , NPNVsupportsCarbonBool = 3000 /* TRUE if the browser supports the Carbon event model */
434
#endif
435
  , NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event model */
436
  , NPNVsupportsUpdatedCocoaTextInputBool = 3002 /* TRUE if the browser supports the updated
437
                                                    Cocoa text input specification. */
438
#endif
439
  , NPNVmuteAudioBool = 4000 /* Request that the browser wants to mute or unmute the plugin */
440
#if defined(XP_MACOSX)
441
  , NPNVsupportsCompositingCoreAnimationPluginsBool = 74656 /* TRUE if the browser supports
442
                                                               CA model compositing */
443
#endif
444
} NPNVariable;
445
446
typedef enum {
447
  NPNURLVCookie = 501,
448
  NPNURLVProxy
449
} NPNURLVariable;
450
451
/*
452
 * The type of Toolkit the widgets use
453
 */
454
typedef enum {
455
  NPNVGtk12 = 1,
456
  NPNVGtk2
457
} NPNToolkitType;
458
459
/*
460
 * The type of a NPWindow - it specifies the type of the data structure
461
 * returned in the window field.
462
 */
463
typedef enum {
464
  NPWindowTypeWindow = 1,
465
  NPWindowTypeDrawable
466
} NPWindowType;
467
468
typedef struct _NPWindow
469
{
470
  void* window;  /* Platform specific window handle */
471
                 /* OS/2: x - Position of bottom left corner */
472
                 /* OS/2: y - relative to visible netscape window */
473
  int32_t  x;      /* Position of top left corner relative */
474
  int32_t  y;      /* to a netscape page. */
475
  uint32_t width;  /* Maximum window size */
476
  uint32_t height;
477
  NPRect   clipRect; /* Clipping rectangle in port coordinates */
478
#if (defined(XP_UNIX) || defined(XP_SYMBIAN)) && !defined(XP_MACOSX)
479
  void * ws_info; /* Platform-dependent additional data */
480
#endif /* XP_UNIX */
481
  NPWindowType type; /* Is this a window or a drawable? */
482
} NPWindow;
483
484
typedef struct _NPImageExpose
485
{
486
  char*    data;       /* image pointer */
487
  int32_t  stride;     /* Stride of data image pointer */
488
  int32_t  depth;      /* Depth of image pointer */
489
  int32_t  x;          /* Expose x */
490
  int32_t  y;          /* Expose y */
491
  uint32_t width;      /* Expose width */
492
  uint32_t height;     /* Expose height */
493
  NPSize   dataSize;   /* Data buffer size */
494
  float    translateX; /* translate X matrix value */
495
  float    translateY; /* translate Y matrix value */
496
  float    scaleX;     /* scale X matrix value */
497
  float    scaleY;     /* scale Y matrix value */
498
} NPImageExpose;
499
500
typedef struct _NPFullPrint
501
{
502
  NPBool pluginPrinted;/* Set TRUE if plugin handled fullscreen printing */
503
  NPBool printOne;     /* TRUE if plugin should print one copy to default
504
                          printer */
505
  void* platformPrint; /* Platform-specific printing info */
506
} NPFullPrint;
507
508
typedef struct _NPEmbedPrint
509
{
510
  NPWindow window;
511
  void* platformPrint; /* Platform-specific printing info */
512
} NPEmbedPrint;
513
514
typedef struct _NPPrint
515
{
516
  uint16_t mode;               /* NP_FULL or NP_EMBED */
517
  union
518
  {
519
    NPFullPrint fullPrint;   /* if mode is NP_FULL */
520
    NPEmbedPrint embedPrint; /* if mode is NP_EMBED */
521
  } print;
522
} NPPrint;
523
524
#if defined(XP_MACOSX)
525
#ifndef NP_NO_CARBON
526
typedef EventRecord NPEvent;
527
#endif
528
#elif defined(XP_SYMBIAN)
529
typedef QEvent NPEvent;
530
#elif defined(XP_WIN)
531
typedef struct _NPEvent
532
{
533
  uint16_t event;
534
  uintptr_t wParam;
535
  uintptr_t lParam;
536
} NPEvent;
537
#elif defined(XP_UNIX) && defined(MOZ_X11)
538
typedef XEvent NPEvent;
539
#else
540
typedef void*  NPEvent;
541
#endif
542
543
#if defined(XP_MACOSX)
544
typedef void* NPRegion;
545
#ifndef NP_NO_QUICKDRAW
546
typedef RgnHandle NPQDRegion;
547
#endif
548
typedef CGPathRef NPCGRegion;
549
#elif defined(XP_WIN)
550
typedef HRGN NPRegion;
551
#elif defined(XP_UNIX) && defined(MOZ_X11)
552
typedef Region NPRegion;
553
#elif defined(XP_SYMBIAN)
554
typedef QRegion* NPRegion;
555
#else
556
typedef void *NPRegion;
557
#endif
558
559
typedef struct _NPNSString NPNSString;
560
typedef struct _NPNSWindow NPNSWindow;
561
typedef struct _NPNSMenu   NPNSMenu;
562
563
#if defined(XP_MACOSX)
564
typedef NPNSMenu NPMenu;
565
#else
566
typedef void *NPMenu;
567
#endif
568
569
typedef enum {
570
  NPCoordinateSpacePlugin = 1,
571
  NPCoordinateSpaceWindow,
572
  NPCoordinateSpaceFlippedWindow,
573
  NPCoordinateSpaceScreen,
574
  NPCoordinateSpaceFlippedScreen
575
} NPCoordinateSpace;
576
577
#if defined(XP_MACOSX)
578
579
#ifndef NP_NO_QUICKDRAW
580
typedef struct NP_Port
581
{
582
  CGrafPtr port;
583
  int32_t portx; /* position inside the topmost window */
584
  int32_t porty;
585
} NP_Port;
586
#endif /* NP_NO_QUICKDRAW */
587
588
/*
589
 * NP_CGContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelCoreGraphics
590
 * as its drawing model.
591
 */
592
593
typedef struct NP_CGContext
594
{
595
  CGContextRef context;
596
  void *window; /* A WindowRef under the Carbon event model. */
597
} NP_CGContext;
598
599
/*
600
 * NP_GLContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelOpenGL as its
601
 * drawing model.
602
 */
603
604
typedef struct NP_GLContext
605
{
606
  CGLContextObj context;
607
#ifdef NP_NO_CARBON
608
  NPNSWindow *window;
609
#else
610
  void *window; /* Can be either an NSWindow or a WindowRef depending on the event model */
611
#endif
612
} NP_GLContext;
613
614
typedef enum {
615
  NPCocoaEventDrawRect = 1,
616
  NPCocoaEventMouseDown,
617
  NPCocoaEventMouseUp,
618
  NPCocoaEventMouseMoved,
619
  NPCocoaEventMouseEntered,
620
  NPCocoaEventMouseExited,
621
  NPCocoaEventMouseDragged,
622
  NPCocoaEventKeyDown,
623
  NPCocoaEventKeyUp,
624
  NPCocoaEventFlagsChanged,
625
  NPCocoaEventFocusChanged,
626
  NPCocoaEventWindowFocusChanged,
627
  NPCocoaEventScrollWheel,
628
  NPCocoaEventTextInput
629
} NPCocoaEventType;
630
631
typedef struct _NPCocoaEvent {
632
  NPCocoaEventType type;
633
  uint32_t version;
634
  union {
635
    struct {
636
      uint32_t modifierFlags;
637
      double   pluginX;
638
      double   pluginY;
639
      int32_t  buttonNumber;
640
      int32_t  clickCount;
641
      double   deltaX;
642
      double   deltaY;
643
      double   deltaZ;
644
    } mouse;
645
    struct {
646
      uint32_t    modifierFlags;
647
      NPNSString *characters;
648
      NPNSString *charactersIgnoringModifiers;
649
      NPBool      isARepeat;
650
      uint16_t    keyCode;
651
    } key;
652
    struct {
653
      CGContextRef context;
654
      double x;
655
      double y;
656
      double width;
657
      double height;
658
    } draw;
659
    struct {
660
      NPBool hasFocus;
661
    } focus;
662
    struct {
663
      NPNSString *text;
664
    } text;
665
  } data;
666
} NPCocoaEvent;
667
668
#ifndef NP_NO_CARBON
669
/* Non-standard event types that can be passed to HandleEvent */
670
enum NPEventType {
671
  NPEventType_GetFocusEvent = (osEvt + 16),
672
  NPEventType_LoseFocusEvent,
673
  NPEventType_AdjustCursorEvent,
674
  NPEventType_MenuCommandEvent,
675
  NPEventType_ClippingChangedEvent,
676
  NPEventType_ScrollingBeginsEvent = 1000,
677
  NPEventType_ScrollingEndsEvent
678
};
679
#endif /* NP_NO_CARBON */
680
681
#endif /* XP_MACOSX */
682
683
/*
684
 * Values for mode passed to NPP_New:
685
 */
686
#define NP_EMBED 1
687
#define NP_FULL  2
688
689
/*
690
 * Values for stream type passed to NPP_NewStream:
691
 */
692
#define NP_NORMAL     1
693
#define NP_SEEK       2
694
#define NP_ASFILE     3
695
#define NP_ASFILEONLY 4
696
697
#define NP_MAXREADY (((unsigned)(~0)<<1)>>1)
698
699
/*
700
 * Flags for NPP_ClearSiteData.
701
 */
702
#define NP_CLEAR_ALL   0
703
#define NP_CLEAR_CACHE (1 << 0)
704
705
#if !defined(__LP64__)
706
#if defined(XP_MACOSX)
707
#pragma options align=reset
708
#endif
709
#endif /* __LP64__ */
710
711
/*----------------------------------------------------------------------*/
712
/*       Error and Reason Code definitions                              */
713
/*----------------------------------------------------------------------*/
714
715
/*
716
 * Values of type NPError:
717
 */
718
#define NPERR_BASE                         0
719
#define NPERR_NO_ERROR                    (NPERR_BASE + 0)
720
#define NPERR_GENERIC_ERROR               (NPERR_BASE + 1)
721
#define NPERR_INVALID_INSTANCE_ERROR      (NPERR_BASE + 2)
722
#define NPERR_INVALID_FUNCTABLE_ERROR     (NPERR_BASE + 3)
723
#define NPERR_MODULE_LOAD_FAILED_ERROR    (NPERR_BASE + 4)
724
#define NPERR_OUT_OF_MEMORY_ERROR         (NPERR_BASE + 5)
725
#define NPERR_INVALID_PLUGIN_ERROR        (NPERR_BASE + 6)
726
#define NPERR_INVALID_PLUGIN_DIR_ERROR    (NPERR_BASE + 7)
727
#define NPERR_INCOMPATIBLE_VERSION_ERROR  (NPERR_BASE + 8)
728
#define NPERR_INVALID_PARAM               (NPERR_BASE + 9)
729
#define NPERR_INVALID_URL                 (NPERR_BASE + 10)
730
#define NPERR_FILE_NOT_FOUND              (NPERR_BASE + 11)
731
#define NPERR_NO_DATA                     (NPERR_BASE + 12)
732
#define NPERR_STREAM_NOT_SEEKABLE         (NPERR_BASE + 13)
733
#define NPERR_TIME_RANGE_NOT_SUPPORTED    (NPERR_BASE + 14)
734
#define NPERR_MALFORMED_SITE              (NPERR_BASE + 15)
735
736
/*
737
 * Values of type NPReason:
738
 */
739
#define NPRES_BASE          0
740
#define NPRES_DONE         (NPRES_BASE + 0)
741
#define NPRES_NETWORK_ERR  (NPRES_BASE + 1)
742
#define NPRES_USER_BREAK   (NPRES_BASE + 2)
743
744
/*
745
 * Don't use these obsolete error codes any more.
746
 */
747
#define NP_NOERR  NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
748
#define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
749
#define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
750
751
/*
752
 * Version feature information
753
 */
754
#define NPVERS_HAS_STREAMOUTPUT             8
755
#define NPVERS_HAS_NOTIFICATION             9
756
#define NPVERS_HAS_LIVECONNECT              9
757
#define NPVERS_68K_HAS_LIVECONNECT          11
758
#define NPVERS_HAS_WINDOWLESS               11
759
#define NPVERS_HAS_XPCONNECT_SCRIPTING      13
760
#define NPVERS_HAS_NPRUNTIME_SCRIPTING      14
761
#define NPVERS_HAS_FORM_VALUES              15
762
#define NPVERS_HAS_POPUPS_ENABLED_STATE     16
763
#define NPVERS_HAS_RESPONSE_HEADERS         17
764
#define NPVERS_HAS_NPOBJECT_ENUM            18
765
#define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19
766
#define NPVERS_HAS_ALL_NETWORK_STREAMS      20
767
#define NPVERS_HAS_URL_AND_AUTH_INFO        21
768
#define NPVERS_HAS_PRIVATE_MODE             22
769
#define NPVERS_MACOSX_HAS_COCOA_EVENTS      23
770
#define NPVERS_HAS_ADVANCED_KEY_HANDLING    25
771
#define NPVERS_HAS_URL_REDIRECT_HANDLING    26
772
#define NPVERS_HAS_CLEAR_SITE_DATA          27
773
774
/*----------------------------------------------------------------------*/
775
/*                        Function Prototypes                           */
776
/*----------------------------------------------------------------------*/
777
778
#ifdef __cplusplus
779
extern "C" {
780
#endif
781
782
/* NPP_* functions are provided by the plugin and called by the navigator. */
783
784
#if defined(XP_UNIX)
785
const char* NPP_GetMIMEDescription(void);
786
#endif
787
788
NPError NPP_New(NPMIMEType pluginType, NPP instance,
789
                uint16_t mode, int16_t argc, char* argn[],
790
                char* argv[], NPSavedData* saved);
791
NPError NPP_Destroy(NPP instance, NPSavedData** save);
792
NPError NPP_SetWindow(NPP instance, NPWindow* window);
793
NPError NPP_NewStream(NPP instance, NPMIMEType type,
794
                      NPStream* stream, NPBool seekable,
795
                      uint16_t* stype);
796
NPError NPP_DestroyStream(NPP instance, NPStream* stream,
797
                          NPReason reason);
798
int32_t NPP_WriteReady(NPP instance, NPStream* stream);
799
int32_t NPP_Write(NPP instance, NPStream* stream, int32_t offset,
800
                  int32_t len, void* buffer);
801
void    NPP_StreamAsFile(NPP instance, NPStream* stream,
802
                         const char* fname);
803
void    NPP_Print(NPP instance, NPPrint* platformPrint);
804
int16_t NPP_HandleEvent(NPP instance, void* event);
805
void    NPP_URLNotify(NPP instance, const char* url,
806
                      NPReason reason, void* notifyData);
807
NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value);
808
NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value);
809
NPBool  NPP_GotFocus(NPP instance, NPFocusDirection direction);
810
void    NPP_LostFocus(NPP instance);
811
void    NPP_URLRedirectNotify(NPP instance, const char* url, int32_t status, void* notifyData);
812
NPError NPP_ClearSiteData(const char* site, uint64_t flags, uint64_t maxAge);
813
char**  NPP_GetSitesWithData(void);
814
void    NPP_DidComposite(NPP instance);
815
816
/* NPN_* functions are provided by the navigator and called by the plugin. */
817
void        NPN_Version(int* plugin_major, int* plugin_minor,
818
                        int* netscape_major, int* netscape_minor);
819
NPError     NPN_GetURLNotify(NPP instance, const char* url,
820
                             const char* target, void* notifyData);
821
NPError     NPN_GetURL(NPP instance, const char* url,
822
                       const char* target);
823
NPError     NPN_PostURLNotify(NPP instance, const char* url,
824
                              const char* target, uint32_t len,
825
                              const char* buf, NPBool file,
826
                              void* notifyData);
827
NPError     NPN_PostURL(NPP instance, const char* url,
828
                        const char* target, uint32_t len,
829
                        const char* buf, NPBool file);
830
NPError     NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
831
NPError     NPN_NewStream(NPP instance, NPMIMEType type,
832
                          const char* target, NPStream** stream);
833
int32_t     NPN_Write(NPP instance, NPStream* stream, int32_t len,
834
                      void* buffer);
835
NPError     NPN_DestroyStream(NPP instance, NPStream* stream,
836
                              NPReason reason);
837
void        NPN_Status(NPP instance, const char* message);
838
const char* NPN_UserAgent(NPP instance);
839
void*       NPN_MemAlloc(uint32_t size);
840
void        NPN_MemFree(void* ptr);
841
uint32_t    NPN_MemFlush(uint32_t size);
842
void        NPN_ReloadPlugins(NPBool reloadPages);
843
NPError     NPN_GetValue(NPP instance, NPNVariable variable,
844
                         void *value);
845
NPError     NPN_SetValue(NPP instance, NPPVariable variable,
846
                         void *value);
847
void        NPN_InvalidateRect(NPP instance, NPRect *invalidRect);
848
void        NPN_InvalidateRegion(NPP instance,
849
                                 NPRegion invalidRegion);
850
void        NPN_ForceRedraw(NPP instance);
851
void        NPN_PushPopupsEnabledState(NPP instance, NPBool enabled);
852
void        NPN_PopPopupsEnabledState(NPP instance);
853
void        NPN_PluginThreadAsyncCall(NPP instance,
854
                                      void (*func) (void *),
855
                                      void *userData);
856
NPError     NPN_GetValueForURL(NPP instance, NPNURLVariable variable,
857
                               const char *url, char **value,
858
                               uint32_t *len);
859
NPError     NPN_SetValueForURL(NPP instance, NPNURLVariable variable,
860
                               const char *url, const char *value,
861
                               uint32_t len);
862
NPError     NPN_GetAuthenticationInfo(NPP instance,
863
                                      const char *protocol,
864
                                      const char *host, int32_t port,
865
                                      const char *scheme,
866
                                      const char *realm,
867
                                      char **username, uint32_t *ulen,
868
                                      char **password,
869
                                      uint32_t *plen);
870
uint32_t    NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
871
void        NPN_UnscheduleTimer(NPP instance, uint32_t timerID);
872
NPError     NPN_PopUpContextMenu(NPP instance, NPMenu* menu);
873
NPBool      NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
874
NPBool      NPN_HandleEvent(NPP instance, void *event, NPBool handled);
875
NPBool      NPN_UnfocusInstance(NPP instance, NPFocusDirection direction);
876
void        NPN_URLRedirectResponse(NPP instance, void* notifyData, NPBool allow);
877
NPError     NPN_InitAsyncSurface(NPP instance, NPSize *size,
878
                                 NPImageFormat format, void *initData,
879
                                 NPAsyncSurface *surface);
880
NPError     NPN_FinalizeAsyncSurface(NPP instance, NPAsyncSurface *surface);
881
void        NPN_SetCurrentAsyncSurface(NPP instance, NPAsyncSurface *surface, NPRect *changed);
882
883
#ifdef __cplusplus
884
}  /* end extern "C" */
885
#endif
886
887
#endif /* RC_INVOKED */
888
889
#endif /* npapi_h_ */
(-)files/npfunctions.h (+281 lines)
Line 0 Link Here
1
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/* This Source Code Form is subject to the terms of the Mozilla Public
3
 * License, v. 2.0. If a copy of the MPL was not distributed with this
4
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
#ifndef npfunctions_h_
7
#define npfunctions_h_
8
9
#include "npapi.h"
10
#include "npruntime.h"
11
12
#ifdef MOZ_WIDGET_ANDROID
13
#include <jni.h>
14
#endif
15
16
typedef NPError      (* NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved);
17
typedef NPError      (* NPP_DestroyProcPtr)(NPP instance, NPSavedData** save);
18
typedef NPError      (* NPP_SetWindowProcPtr)(NPP instance, NPWindow* window);
19
typedef NPError      (* NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype);
20
typedef NPError      (* NPP_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
21
typedef int32_t      (* NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream);
22
typedef int32_t      (* NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
23
typedef void         (* NPP_StreamAsFileProcPtr)(NPP instance, NPStream* stream, const char* fname);
24
typedef void         (* NPP_PrintProcPtr)(NPP instance, NPPrint* platformPrint);
25
typedef int16_t      (* NPP_HandleEventProcPtr)(NPP instance, void* event);
26
typedef void         (* NPP_URLNotifyProcPtr)(NPP instance, const char* url, NPReason reason, void* notifyData);
27
/* Any NPObjects returned to the browser via NPP_GetValue should be retained
28
   by the plugin on the way out. The browser is responsible for releasing. */
29
typedef NPError      (* NPP_GetValueProcPtr)(NPP instance, NPPVariable variable, void *ret_value);
30
typedef NPError      (* NPP_SetValueProcPtr)(NPP instance, NPNVariable variable, void *value);
31
typedef NPBool       (* NPP_GotFocusPtr)(NPP instance, NPFocusDirection direction);
32
typedef void         (* NPP_LostFocusPtr)(NPP instance);
33
typedef void         (* NPP_URLRedirectNotifyPtr)(NPP instance, const char* url, int32_t status, void* notifyData);
34
typedef NPError      (* NPP_ClearSiteDataPtr)(const char* site, uint64_t flags, uint64_t maxAge);
35
typedef char**       (* NPP_GetSitesWithDataPtr)(void);
36
typedef void         (* NPP_DidCompositePtr)(NPP instance);
37
38
typedef NPError      (*NPN_GetValueProcPtr)(NPP instance, NPNVariable variable, void *ret_value);
39
typedef NPError      (*NPN_SetValueProcPtr)(NPP instance, NPPVariable variable, void *value);
40
typedef NPError      (*NPN_GetURLNotifyProcPtr)(NPP instance, const char* url, const char* window, void* notifyData);
41
typedef NPError      (*NPN_PostURLNotifyProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData);
42
typedef NPError      (*NPN_GetURLProcPtr)(NPP instance, const char* url, const char* window);
43
typedef NPError      (*NPN_PostURLProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file);
44
typedef NPError      (*NPN_RequestReadProcPtr)(NPStream* stream, NPByteRange* rangeList);
45
typedef NPError      (*NPN_NewStreamProcPtr)(NPP instance, NPMIMEType type, const char* window, NPStream** stream);
46
typedef int32_t      (*NPN_WriteProcPtr)(NPP instance, NPStream* stream, int32_t len, void* buffer);
47
typedef NPError      (*NPN_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
48
typedef void         (*NPN_StatusProcPtr)(NPP instance, const char* message);
49
/* Browser manages the lifetime of the buffer returned by NPN_UserAgent, don't
50
   depend on it sticking around and don't free it. */
51
typedef const char*  (*NPN_UserAgentProcPtr)(NPP instance);
52
typedef void*        (*NPN_MemAllocProcPtr)(uint32_t size);
53
typedef void         (*NPN_MemFreeProcPtr)(void* ptr);
54
typedef uint32_t     (*NPN_MemFlushProcPtr)(uint32_t size);
55
typedef void         (*NPN_ReloadPluginsProcPtr)(NPBool reloadPages);
56
typedef void*        (*NPN_GetJavaEnvProcPtr)(void);
57
typedef void*        (*NPN_GetJavaPeerProcPtr)(NPP instance);
58
typedef void         (*NPN_InvalidateRectProcPtr)(NPP instance, NPRect *rect);
59
typedef void         (*NPN_InvalidateRegionProcPtr)(NPP instance, NPRegion region);
60
typedef void         (*NPN_ForceRedrawProcPtr)(NPP instance);
61
typedef NPIdentifier (*NPN_GetStringIdentifierProcPtr)(const NPUTF8* name);
62
typedef void         (*NPN_GetStringIdentifiersProcPtr)(const NPUTF8** names, int32_t nameCount, NPIdentifier* identifiers);
63
typedef NPIdentifier (*NPN_GetIntIdentifierProcPtr)(int32_t intid);
64
typedef bool         (*NPN_IdentifierIsStringProcPtr)(NPIdentifier identifier);
65
typedef NPUTF8*      (*NPN_UTF8FromIdentifierProcPtr)(NPIdentifier identifier);
66
typedef int32_t      (*NPN_IntFromIdentifierProcPtr)(NPIdentifier identifier);
67
typedef NPObject*    (*NPN_CreateObjectProcPtr)(NPP npp, NPClass *aClass);
68
typedef NPObject*    (*NPN_RetainObjectProcPtr)(NPObject *obj);
69
typedef void         (*NPN_ReleaseObjectProcPtr)(NPObject *obj);
70
typedef bool         (*NPN_InvokeProcPtr)(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result);
71
typedef bool         (*NPN_InvokeDefaultProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
72
typedef bool         (*NPN_EvaluateProcPtr)(NPP npp, NPObject *obj, NPString *script, NPVariant *result);
73
typedef bool         (*NPN_GetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result);
74
typedef bool         (*NPN_SetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, const NPVariant *value);
75
typedef bool         (*NPN_RemovePropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
76
typedef bool         (*NPN_HasPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
77
typedef bool         (*NPN_HasMethodProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
78
typedef void         (*NPN_ReleaseVariantValueProcPtr)(NPVariant *variant);
79
typedef void         (*NPN_SetExceptionProcPtr)(NPObject *obj, const NPUTF8 *message);
80
typedef void         (*NPN_PushPopupsEnabledStateProcPtr)(NPP npp, NPBool enabled);
81
typedef void         (*NPN_PopPopupsEnabledStateProcPtr)(NPP npp);
82
typedef bool         (*NPN_EnumerateProcPtr)(NPP npp, NPObject *obj, NPIdentifier **identifier, uint32_t *count);
83
typedef void         (*NPN_PluginThreadAsyncCallProcPtr)(NPP instance, void (*func)(void *), void *userData);
84
typedef bool         (*NPN_ConstructProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
85
typedef NPError      (*NPN_GetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, char **value, uint32_t *len);
86
typedef NPError      (*NPN_SetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, const char *value, uint32_t len);
87
typedef NPError      (*NPN_GetAuthenticationInfoPtr)(NPP npp, const char *protocol, const char *host, int32_t port, const char *scheme, const char *realm, char **username, uint32_t *ulen, char **password, uint32_t *plen);
88
typedef uint32_t     (*NPN_ScheduleTimerPtr)(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
89
typedef void         (*NPN_UnscheduleTimerPtr)(NPP instance, uint32_t timerID);
90
typedef NPError      (*NPN_PopUpContextMenuPtr)(NPP instance, NPMenu* menu);
91
typedef NPBool       (*NPN_ConvertPointPtr)(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
92
typedef NPBool       (*NPN_HandleEventPtr)(NPP instance, void *event, NPBool handled);
93
typedef NPBool       (*NPN_UnfocusInstancePtr)(NPP instance, NPFocusDirection direction);
94
typedef void         (*NPN_URLRedirectResponsePtr)(NPP instance, void* notifyData, NPBool allow);
95
typedef NPError      (*NPN_InitAsyncSurfacePtr)(NPP instance, NPSize *size, NPImageFormat format, void *initData, NPAsyncSurface *surface);
96
typedef NPError      (*NPN_FinalizeAsyncSurfacePtr)(NPP instance, NPAsyncSurface *surface);
97
typedef void         (*NPN_SetCurrentAsyncSurfacePtr)(NPP instance, NPAsyncSurface *surface, NPRect *changed);
98
99
typedef void         (*NPN_DummyPtr)(void);
100
101
typedef struct _NPPluginFuncs {
102
  uint16_t size;
103
  uint16_t version;
104
  NPP_NewProcPtr newp;
105
  NPP_DestroyProcPtr destroy;
106
  NPP_SetWindowProcPtr setwindow;
107
  NPP_NewStreamProcPtr newstream;
108
  NPP_DestroyStreamProcPtr destroystream;
109
  NPP_StreamAsFileProcPtr asfile;
110
  NPP_WriteReadyProcPtr writeready;
111
  NPP_WriteProcPtr write;
112
  NPP_PrintProcPtr print;
113
  NPP_HandleEventProcPtr event;
114
  NPP_URLNotifyProcPtr urlnotify;
115
  void* javaClass;
116
  NPP_GetValueProcPtr getvalue;
117
  NPP_SetValueProcPtr setvalue;
118
  NPP_GotFocusPtr gotfocus;
119
  NPP_LostFocusPtr lostfocus;
120
  NPP_URLRedirectNotifyPtr urlredirectnotify;
121
  NPP_ClearSiteDataPtr clearsitedata;
122
  NPP_GetSitesWithDataPtr getsiteswithdata;
123
  NPP_DidCompositePtr didComposite;
124
} NPPluginFuncs;
125
126
typedef struct _NPNetscapeFuncs {
127
  uint16_t size;
128
  uint16_t version;
129
  NPN_GetURLProcPtr geturl;
130
  NPN_PostURLProcPtr posturl;
131
  NPN_RequestReadProcPtr requestread;
132
  NPN_NewStreamProcPtr newstream;
133
  NPN_WriteProcPtr write;
134
  NPN_DestroyStreamProcPtr destroystream;
135
  NPN_StatusProcPtr status;
136
  NPN_UserAgentProcPtr uagent;
137
  NPN_MemAllocProcPtr memalloc;
138
  NPN_MemFreeProcPtr memfree;
139
  NPN_MemFlushProcPtr memflush;
140
  NPN_ReloadPluginsProcPtr reloadplugins;
141
  NPN_GetJavaEnvProcPtr getJavaEnv;
142
  NPN_GetJavaPeerProcPtr getJavaPeer;
143
  NPN_GetURLNotifyProcPtr geturlnotify;
144
  NPN_PostURLNotifyProcPtr posturlnotify;
145
  NPN_GetValueProcPtr getvalue;
146
  NPN_SetValueProcPtr setvalue;
147
  NPN_InvalidateRectProcPtr invalidaterect;
148
  NPN_InvalidateRegionProcPtr invalidateregion;
149
  NPN_ForceRedrawProcPtr forceredraw;
150
  NPN_GetStringIdentifierProcPtr getstringidentifier;
151
  NPN_GetStringIdentifiersProcPtr getstringidentifiers;
152
  NPN_GetIntIdentifierProcPtr getintidentifier;
153
  NPN_IdentifierIsStringProcPtr identifierisstring;
154
  NPN_UTF8FromIdentifierProcPtr utf8fromidentifier;
155
  NPN_IntFromIdentifierProcPtr intfromidentifier;
156
  NPN_CreateObjectProcPtr createobject;
157
  NPN_RetainObjectProcPtr retainobject;
158
  NPN_ReleaseObjectProcPtr releaseobject;
159
  NPN_InvokeProcPtr invoke;
160
  NPN_InvokeDefaultProcPtr invokeDefault;
161
  NPN_EvaluateProcPtr evaluate;
162
  NPN_GetPropertyProcPtr getproperty;
163
  NPN_SetPropertyProcPtr setproperty;
164
  NPN_RemovePropertyProcPtr removeproperty;
165
  NPN_HasPropertyProcPtr hasproperty;
166
  NPN_HasMethodProcPtr hasmethod;
167
  NPN_ReleaseVariantValueProcPtr releasevariantvalue;
168
  NPN_SetExceptionProcPtr setexception;
169
  NPN_PushPopupsEnabledStateProcPtr pushpopupsenabledstate;
170
  NPN_PopPopupsEnabledStateProcPtr poppopupsenabledstate;
171
  NPN_EnumerateProcPtr enumerate;
172
  NPN_PluginThreadAsyncCallProcPtr pluginthreadasynccall;
173
  NPN_ConstructProcPtr construct;
174
  NPN_GetValueForURLPtr getvalueforurl;
175
  NPN_SetValueForURLPtr setvalueforurl;
176
  NPN_GetAuthenticationInfoPtr getauthenticationinfo;
177
  NPN_ScheduleTimerPtr scheduletimer;
178
  NPN_UnscheduleTimerPtr unscheduletimer;
179
  NPN_PopUpContextMenuPtr popupcontextmenu;
180
  NPN_ConvertPointPtr convertpoint;
181
  NPN_HandleEventPtr handleevent;
182
  NPN_UnfocusInstancePtr unfocusinstance;
183
  NPN_URLRedirectResponsePtr urlredirectresponse;
184
  NPN_InitAsyncSurfacePtr initasyncsurface;
185
  NPN_FinalizeAsyncSurfacePtr finalizeasyncsurface;
186
  NPN_SetCurrentAsyncSurfacePtr setcurrentasyncsurface;
187
} NPNetscapeFuncs;
188
189
#ifdef XP_MACOSX
190
/*
191
 * Mac OS X version(s) of NP_GetMIMEDescription(const char *)
192
 * These can be called to retreive MIME information from the plugin dynamically
193
 *
194
 * Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way
195
 *       to get mime info from the plugin only on OSX and may not be supported
196
 *       in furture version -- use NP_GetMIMEDescription instead
197
 */
198
enum
199
{
200
 kBPSupportedMIMETypesStructVers_1    = 1
201
};
202
typedef struct _BPSupportedMIMETypes
203
{
204
 SInt32    structVersion;      /* struct version */
205
 Handle    typeStrings;        /* STR# formated handle, allocated by plug-in */
206
 Handle    infoStrings;        /* STR# formated handle, allocated by plug-in */
207
} BPSupportedMIMETypes;
208
OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags);
209
#define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription"
210
typedef const char* (*NP_GetMIMEDescriptionProcPtr)(void);
211
typedef OSErr (*BP_GetSupportedMIMETypesProcPtr)(BPSupportedMIMETypes*, UInt32);
212
#endif
213
214
#if defined(_WIN32)
215
#define OSCALL WINAPI
216
#else
217
#define OSCALL
218
#endif
219
220
#if defined(XP_UNIX)
221
/* GCC 3.3 and later support the visibility attribute. */
222
#if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
223
#define NP_VISIBILITY_DEFAULT __attribute__((visibility("default")))
224
#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
225
#define NP_VISIBILITY_DEFAULT __global
226
#else
227
#define NP_VISIBILITY_DEFAULT
228
#endif
229
#define NP_EXPORT(__type) NP_VISIBILITY_DEFAULT __type
230
#endif
231
232
#if defined(_WIN32)
233
#ifdef __cplusplus
234
extern "C" {
235
#endif
236
/* plugin meta member functions */
237
typedef NPError     (OSCALL *NP_GetEntryPointsFunc)(NPPluginFuncs*);
238
NPError OSCALL      NP_GetEntryPoints(NPPluginFuncs* pFuncs);
239
typedef NPError     (OSCALL *NP_InitializeFunc)(NPNetscapeFuncs*);
240
NPError OSCALL      NP_Initialize(NPNetscapeFuncs* bFuncs);
241
typedef NPError     (OSCALL *NP_ShutdownFunc)(void);
242
NPError OSCALL      NP_Shutdown(void);
243
typedef const char* (*NP_GetMIMEDescriptionFunc)(void);
244
const char*         NP_GetMIMEDescription(void);
245
#ifdef __cplusplus
246
}
247
#endif
248
#endif
249
250
#ifdef XP_UNIX
251
#ifdef __cplusplus
252
extern "C" {
253
#endif
254
typedef char*          (*NP_GetPluginVersionFunc)(void);
255
NP_EXPORT(char*)       NP_GetPluginVersion(void);
256
typedef const char*    (*NP_GetMIMEDescriptionFunc)(void);
257
NP_EXPORT(const char*) NP_GetMIMEDescription(void);
258
#ifdef XP_MACOSX
259
typedef NPError        (*NP_InitializeFunc)(NPNetscapeFuncs*);
260
NP_EXPORT(NPError)     NP_Initialize(NPNetscapeFuncs* bFuncs);
261
typedef NPError        (*NP_GetEntryPointsFunc)(NPPluginFuncs*);
262
NP_EXPORT(NPError)     NP_GetEntryPoints(NPPluginFuncs* pFuncs);
263
#else
264
#ifdef MOZ_WIDGET_ANDROID
265
typedef NPError    (*NP_InitializeFunc)(NPNetscapeFuncs*, NPPluginFuncs*, JNIEnv* pEnv);
266
NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, JNIEnv* pEnv);
267
#else
268
typedef NPError    (*NP_InitializeFunc)(NPNetscapeFuncs*, NPPluginFuncs*);
269
NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs);
270
#endif
271
#endif
272
typedef NPError        (*NP_ShutdownFunc)(void);
273
NP_EXPORT(NPError)     NP_Shutdown(void);
274
typedef NPError        (*NP_GetValueFunc)(void *, NPPVariable, void *);
275
NP_EXPORT(NPError)     NP_GetValue(void *future, NPPVariable aVariable, void *aValue);
276
#ifdef __cplusplus
277
}
278
#endif
279
#endif
280
281
#endif /* npfunctions_h_ */
(-)files/npruntime.h (+393 lines)
Line 0 Link Here
1
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * Copyright (c) 2004, Apple Computer, Inc. and The Mozilla Foundation.
4
 * All rights reserved.
5
 *
6
 * Redistribution and use in source and binary forms, with or without
7
 * modification, are permitted provided that the following conditions are
8
 * met:
9
 *
10
 * 1. Redistributions of source code must retain the above copyright
11
 * notice, this list of conditions and the following disclaimer.
12
 * 2. Redistributions in binary form must reproduce the above copyright
13
 * notice, this list of conditions and the following disclaimer in the
14
 * documentation and/or other materials provided with the distribution.
15
 * 3. Neither the names of Apple Computer, Inc. ("Apple") or The Mozilla
16
 * Foundation ("Mozilla") nor the names of their contributors may be used
17
 * to endorse or promote products derived from this software without
18
 * specific prior written permission.
19
 *
20
 * THIS SOFTWARE IS PROVIDED BY APPLE, MOZILLA AND THEIR CONTRIBUTORS "AS
21
 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE, MOZILLA OR
24
 * THEIR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
26
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
 *
32
 */
33
#ifndef _NP_RUNTIME_H_
34
#define _NP_RUNTIME_H_
35
36
#ifdef __cplusplus
37
extern "C" {
38
#endif
39
40
#include "nptypes.h"
41
42
/*
43
    This API is used to facilitate binding code written in C to script
44
    objects.  The API in this header does not assume the presence of a
45
    user agent.  That is, it can be used to bind C code to scripting
46
    environments outside of the context of a user agent.
47
48
    However, the normal use of the this API is in the context of a
49
    scripting environment running in a browser or other user agent.
50
    In particular it is used to support the extended Netscape
51
    script-ability API for plugins (NP-SAP).  NP-SAP is an extension
52
    of the Netscape plugin API.  As such we have adopted the use of
53
    the "NP" prefix for this API.
54
55
    The following NP{N|P}Variables were added to the Netscape plugin
56
    API (in npapi.h):
57
58
    NPNVWindowNPObject
59
    NPNVPluginElementNPObject
60
    NPPVpluginScriptableNPObject
61
62
    These variables are exposed through NPN_GetValue() and
63
    NPP_GetValue() (respectively) and are used to establish the
64
    initial binding between the user agent and native code.  The DOM
65
    objects in the user agent can be examined and manipulated using
66
    the NPN_ functions that operate on NPObjects described in this
67
    header.
68
69
    To the extent possible the assumptions about the scripting
70
    language used by the scripting environment have been minimized.
71
*/
72
73
#define NP_BEGIN_MACRO  do {
74
#define NP_END_MACRO    } while (0)
75
76
/*
77
    Objects (non-primitive data) passed between 'C' and script is
78
    always wrapped in an NPObject.  The 'interface' of an NPObject is
79
    described by an NPClass.
80
*/
81
typedef struct NPObject NPObject;
82
typedef struct NPClass NPClass;
83
84
typedef char NPUTF8;
85
typedef struct _NPString {
86
    const NPUTF8 *UTF8Characters;
87
    uint32_t UTF8Length;
88
} NPString;
89
90
typedef enum {
91
    NPVariantType_Void,
92
    NPVariantType_Null,
93
    NPVariantType_Bool,
94
    NPVariantType_Int32,
95
    NPVariantType_Double,
96
    NPVariantType_String,
97
    NPVariantType_Object
98
} NPVariantType;
99
100
typedef struct _NPVariant {
101
    NPVariantType type;
102
    union {
103
        bool boolValue;
104
        int32_t intValue;
105
        double doubleValue;
106
        NPString stringValue;
107
        NPObject *objectValue;
108
    } value;
109
} NPVariant;
110
111
/*
112
    NPN_ReleaseVariantValue is called on all 'out' parameters
113
    references.  Specifically it is to be called on variants that own
114
    their value, as is the case with all non-const NPVariant*
115
    arguments after a successful call to any methods (except this one)
116
    in this API.
117
118
    After calling NPN_ReleaseVariantValue, the type of the variant
119
    will be NPVariantType_Void.
120
*/
121
void NPN_ReleaseVariantValue(NPVariant *variant);
122
123
#define NPVARIANT_IS_VOID(_v)    ((_v).type == NPVariantType_Void)
124
#define NPVARIANT_IS_NULL(_v)    ((_v).type == NPVariantType_Null)
125
#define NPVARIANT_IS_BOOLEAN(_v) ((_v).type == NPVariantType_Bool)
126
#define NPVARIANT_IS_INT32(_v)   ((_v).type == NPVariantType_Int32)
127
#define NPVARIANT_IS_DOUBLE(_v)  ((_v).type == NPVariantType_Double)
128
#define NPVARIANT_IS_STRING(_v)  ((_v).type == NPVariantType_String)
129
#define NPVARIANT_IS_OBJECT(_v)  ((_v).type == NPVariantType_Object)
130
131
#define NPVARIANT_TO_BOOLEAN(_v) ((_v).value.boolValue)
132
#define NPVARIANT_TO_INT32(_v)   ((_v).value.intValue)
133
#define NPVARIANT_TO_DOUBLE(_v)  ((_v).value.doubleValue)
134
#define NPVARIANT_TO_STRING(_v)  ((_v).value.stringValue)
135
#define NPVARIANT_TO_OBJECT(_v)  ((_v).value.objectValue)
136
137
#define VOID_TO_NPVARIANT(_v)                                                 \
138
NP_BEGIN_MACRO                                                                \
139
    (_v).type = NPVariantType_Void;                                           \
140
    (_v).value.objectValue = NULL;                                            \
141
NP_END_MACRO
142
143
#define NULL_TO_NPVARIANT(_v)                                                 \
144
NP_BEGIN_MACRO                                                                \
145
    (_v).type = NPVariantType_Null;                                           \
146
    (_v).value.objectValue = NULL;                                            \
147
NP_END_MACRO
148
149
#define BOOLEAN_TO_NPVARIANT(_val, _v)                                        \
150
NP_BEGIN_MACRO                                                                \
151
    (_v).type = NPVariantType_Bool;                                           \
152
    (_v).value.boolValue = !!(_val);                                          \
153
NP_END_MACRO
154
155
#define INT32_TO_NPVARIANT(_val, _v)                                          \
156
NP_BEGIN_MACRO                                                                \
157
    (_v).type = NPVariantType_Int32;                                          \
158
    (_v).value.intValue = _val;                                               \
159
NP_END_MACRO
160
161
#define DOUBLE_TO_NPVARIANT(_val, _v)                                         \
162
NP_BEGIN_MACRO                                                                \
163
    (_v).type = NPVariantType_Double;                                         \
164
    (_v).value.doubleValue = _val;                                            \
165
NP_END_MACRO
166
167
#define STRINGZ_TO_NPVARIANT(_val, _v)                                        \
168
NP_BEGIN_MACRO                                                                \
169
    (_v).type = NPVariantType_String;                                         \
170
    NPString str = { _val, (uint32_t)(strlen(_val)) };                        \
171
    (_v).value.stringValue = str;                                             \
172
NP_END_MACRO
173
174
#define STRINGN_TO_NPVARIANT(_val, _len, _v)                                  \
175
NP_BEGIN_MACRO                                                                \
176
    (_v).type = NPVariantType_String;                                         \
177
    NPString str = { _val, (uint32_t)(_len) };                                \
178
    (_v).value.stringValue = str;                                             \
179
NP_END_MACRO
180
181
#define OBJECT_TO_NPVARIANT(_val, _v)                                         \
182
NP_BEGIN_MACRO                                                                \
183
    (_v).type = NPVariantType_Object;                                         \
184
    (_v).value.objectValue = _val;                                            \
185
NP_END_MACRO
186
187
188
/*
189
  Type mappings (JavaScript types have been used for illustration
190
    purposes):
191
192
  JavaScript       to             C (NPVariant with type:)
193
  undefined                       NPVariantType_Void
194
  null                            NPVariantType_Null
195
  Boolean                         NPVariantType_Bool
196
  Number                          NPVariantType_Double or NPVariantType_Int32
197
  String                          NPVariantType_String
198
  Object                          NPVariantType_Object
199
200
  C (NPVariant with type:)   to   JavaScript
201
  NPVariantType_Void              undefined
202
  NPVariantType_Null              null
203
  NPVariantType_Bool              Boolean
204
  NPVariantType_Int32             Number
205
  NPVariantType_Double            Number
206
  NPVariantType_String            String
207
  NPVariantType_Object            Object
208
*/
209
210
typedef void *NPIdentifier;
211
212
/*
213
    NPObjects have methods and properties.  Methods and properties are
214
    identified with NPIdentifiers.  These identifiers may be reflected
215
    in script.  NPIdentifiers can be either strings or integers, IOW,
216
    methods and properties can be identified by either strings or
217
    integers (i.e. foo["bar"] vs foo[1]). NPIdentifiers can be
218
    compared using ==.  In case of any errors, the requested
219
    NPIdentifier(s) will be NULL. NPIdentifier lifetime is controlled
220
    by the browser. Plugins do not need to worry about memory management
221
    with regards to NPIdentifiers.
222
*/
223
NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name);
224
void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount,
225
                              NPIdentifier *identifiers);
226
NPIdentifier NPN_GetIntIdentifier(int32_t intid);
227
bool NPN_IdentifierIsString(NPIdentifier identifier);
228
229
/*
230
    The NPUTF8 returned from NPN_UTF8FromIdentifier SHOULD be freed.
231
*/
232
NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier);
233
234
/*
235
    Get the integer represented by identifier. If identifier is not an
236
    integer identifier, the behaviour is undefined.
237
*/
238
int32_t NPN_IntFromIdentifier(NPIdentifier identifier);
239
240
/*
241
    NPObject behavior is implemented using the following set of
242
    callback functions.
243
244
    The NPVariant *result argument of these functions (where
245
    applicable) should be released using NPN_ReleaseVariantValue().
246
*/
247
typedef NPObject *(*NPAllocateFunctionPtr)(NPP npp, NPClass *aClass);
248
typedef void (*NPDeallocateFunctionPtr)(NPObject *npobj);
249
typedef void (*NPInvalidateFunctionPtr)(NPObject *npobj);
250
typedef bool (*NPHasMethodFunctionPtr)(NPObject *npobj, NPIdentifier name);
251
typedef bool (*NPInvokeFunctionPtr)(NPObject *npobj, NPIdentifier name,
252
                                    const NPVariant *args, uint32_t argCount,
253
                                    NPVariant *result);
254
typedef bool (*NPInvokeDefaultFunctionPtr)(NPObject *npobj,
255
                                           const NPVariant *args,
256
                                           uint32_t argCount,
257
                                           NPVariant *result);
258
typedef bool (*NPHasPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name);
259
typedef bool (*NPGetPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name,
260
                                         NPVariant *result);
261
typedef bool (*NPSetPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name,
262
                                         const NPVariant *value);
263
typedef bool (*NPRemovePropertyFunctionPtr)(NPObject *npobj,
264
                                            NPIdentifier name);
265
typedef bool (*NPEnumerationFunctionPtr)(NPObject *npobj, NPIdentifier **value,
266
                                         uint32_t *count);
267
typedef bool (*NPConstructFunctionPtr)(NPObject *npobj,
268
                                       const NPVariant *args,
269
                                       uint32_t argCount,
270
                                       NPVariant *result);
271
272
/*
273
    NPObjects returned by create, retain, invoke, and getProperty pass
274
    a reference count to the caller.  That is, the callee adds a
275
    reference count which passes to the caller.  It is the caller's
276
    responsibility to release the returned object.
277
278
    NPInvokeFunctionPtr function may return 0 to indicate a void
279
    result.
280
281
    NPInvalidateFunctionPtr is called by the scripting environment
282
    when the native code is shutdown.  Any attempt to message a
283
    NPObject instance after the invalidate callback has been
284
    called will result in undefined behavior, even if the native code
285
    is still retaining those NPObject instances.  (The runtime
286
    will typically return immediately, with 0 or NULL, from an
287
    attempt to dispatch to a NPObject, but this behavior should not
288
    be depended upon.)
289
290
    The NPEnumerationFunctionPtr function may pass an array of
291
    NPIdentifiers back to the caller. The callee allocs the memory of
292
    the array using NPN_MemAlloc(), and it's the caller's responsibility
293
    to release it using NPN_MemFree().
294
*/
295
struct NPClass
296
{
297
    uint32_t structVersion;
298
    NPAllocateFunctionPtr allocate;
299
    NPDeallocateFunctionPtr deallocate;
300
    NPInvalidateFunctionPtr invalidate;
301
    NPHasMethodFunctionPtr hasMethod;
302
    NPInvokeFunctionPtr invoke;
303
    NPInvokeDefaultFunctionPtr invokeDefault;
304
    NPHasPropertyFunctionPtr hasProperty;
305
    NPGetPropertyFunctionPtr getProperty;
306
    NPSetPropertyFunctionPtr setProperty;
307
    NPRemovePropertyFunctionPtr removeProperty;
308
    NPEnumerationFunctionPtr enumerate;
309
    NPConstructFunctionPtr construct;
310
};
311
312
#define NP_CLASS_STRUCT_VERSION      3
313
314
#define NP_CLASS_STRUCT_VERSION_ENUM 2
315
#define NP_CLASS_STRUCT_VERSION_CTOR 3
316
317
#define NP_CLASS_STRUCT_VERSION_HAS_ENUM(npclass)   \
318
        ((npclass)->structVersion >= NP_CLASS_STRUCT_VERSION_ENUM)
319
320
#define NP_CLASS_STRUCT_VERSION_HAS_CTOR(npclass)   \
321
        ((npclass)->structVersion >= NP_CLASS_STRUCT_VERSION_CTOR)
322
323
struct NPObject {
324
    NPClass *_class;
325
    uint32_t referenceCount;
326
    /*
327
     * Additional space may be allocated here by types of NPObjects
328
     */
329
};
330
331
/*
332
    If the class has an allocate function, NPN_CreateObject invokes
333
    that function, otherwise a NPObject is allocated and
334
    returned. This method will initialize the referenceCount member of
335
    the NPObject to 1.
336
*/
337
NPObject *NPN_CreateObject(NPP npp, NPClass *aClass);
338
339
/*
340
    Increment the NPObject's reference count.
341
*/
342
NPObject *NPN_RetainObject(NPObject *npobj);
343
344
/*
345
    Decremented the NPObject's reference count.  If the reference
346
    count goes to zero, the class's destroy function is invoke if
347
    specified, otherwise the object is freed directly.
348
*/
349
void NPN_ReleaseObject(NPObject *npobj);
350
351
/*
352
    Functions to access script objects represented by NPObject.
353
354
    Calls to script objects are synchronous.  If a function returns a
355
    value, it will be supplied via the result NPVariant
356
    argument. Successful calls will return true, false will be
357
    returned in case of an error.
358
359
    Calls made from plugin code to script must be made from the thread
360
    on which the plugin was initialized.
361
*/
362
363
bool NPN_Invoke(NPP npp, NPObject *npobj, NPIdentifier methodName,
364
                const NPVariant *args, uint32_t argCount, NPVariant *result);
365
bool NPN_InvokeDefault(NPP npp, NPObject *npobj, const NPVariant *args,
366
                       uint32_t argCount, NPVariant *result);
367
bool NPN_Evaluate(NPP npp, NPObject *npobj, NPString *script,
368
                  NPVariant *result);
369
bool NPN_GetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName,
370
                     NPVariant *result);
371
bool NPN_SetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName,
372
                     const NPVariant *value);
373
bool NPN_RemoveProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName);
374
bool NPN_HasProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName);
375
bool NPN_HasMethod(NPP npp, NPObject *npobj, NPIdentifier methodName);
376
bool NPN_Enumerate(NPP npp, NPObject *npobj, NPIdentifier **identifier,
377
                   uint32_t *count);
378
bool NPN_Construct(NPP npp, NPObject *npobj, const NPVariant *args,
379
                   uint32_t argCount, NPVariant *result);
380
381
/*
382
    NPN_SetException may be called to trigger a script exception upon
383
    return from entry points into NPObjects.  Typical usage:
384
385
    NPN_SetException (npobj, message);
386
*/
387
void NPN_SetException(NPObject *npobj, const NPUTF8 *message);
388
389
#ifdef __cplusplus
390
}
391
#endif
392
393
#endif
(-)files/nptypes.h (+88 lines)
Line 0 Link Here
1
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* This Source Code Form is subject to the terms of the Mozilla Public
3
 * License, v. 2.0. If a copy of the MPL was not distributed with this
4
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
#ifndef nptypes_h_
7
#define nptypes_h_
8
9
/*
10
 * Header file for ensuring that C99 types ([u]int32_t, [u]int64_t and bool) and
11
 * true/false macros are available.
12
 */
13
14
#if defined(WIN32)
15
  /*
16
   * Win32 and OS/2 don't know C99, so define [u]int_16/32/64 here. The bool
17
   * is predefined tho, both in C and C++.
18
   */
19
  typedef short int16_t;
20
  typedef unsigned short uint16_t;
21
  typedef int int32_t;
22
  typedef unsigned int uint32_t;
23
  typedef long long int64_t;
24
  typedef unsigned long long uint64_t;
25
#elif defined(_AIX) || defined(__sun) || defined(__osf__) || defined(IRIX) || defined(HPUX)
26
  /*
27
   * AIX and SunOS ship a inttypes.h header that defines [u]int32_t,
28
   * but not bool for C.
29
   */
30
  #include <inttypes.h>
31
32
  #ifndef __cplusplus
33
    typedef int bool;
34
    #define true   1
35
    #define false  0
36
  #endif
37
#elif defined(bsdi) || defined(FREEBSD) || defined(OPENBSD)
38
  /*
39
   * BSD/OS, FreeBSD, and OpenBSD ship sys/types.h that define int32_t and
40
   * u_int32_t.
41
   */
42
  #include <sys/types.h>
43
44
  /*
45
   * BSD/OS ships no header that defines uint32_t, nor bool (for C)
46
   */
47
  #if defined(bsdi)
48
  typedef u_int32_t uint32_t;
49
  typedef u_int64_t uint64_t;
50
51
  #if !defined(__cplusplus)
52
    typedef int bool;
53
    #define true   1
54
    #define false  0
55
  #endif
56
  #else
57
  /*
58
   * FreeBSD and OpenBSD define uint32_t and bool.
59
   */
60
    #include <inttypes.h>
61
    #include <stdbool.h>
62
  #endif
63
#elif defined(BEOS)
64
  #include <inttypes.h>
65
#else
66
  /*
67
   * For those that ship a standard C99 stdint.h header file, include
68
   * it. Can't do the same for stdbool.h tho, since some systems ship
69
   * with a stdbool.h file that doesn't compile!
70
   */
71
  #include <stdint.h>
72
73
  #ifndef __cplusplus
74
    #if !defined(__GNUC__) || (__GNUC__ > 2 || __GNUC_MINOR__ > 95)
75
      #include <stdbool.h>
76
    #else
77
      /*
78
       * GCC 2.91 can't deal with a typedef for bool, but a #define
79
       * works.
80
       */
81
      #define bool int
82
      #define true   1
83
      #define false  0
84
    #endif
85
  #endif
86
#endif
87
88
#endif /* nptypes_h_ */
(-)pkg-plist (+2 lines)
Lines 1-6 Link Here
1
bin/itweb-javaws
1
bin/itweb-javaws
2
bin/itweb-policyeditor
2
bin/itweb-policyeditor
3
bin/itweb-settings
3
bin/itweb-settings
4
%%PLUGIN%%%%WEBPLUGIN_DIR%%/IcedTeaPlugin.so
4
man/cs/man1/icedtea-web-plugin.1.gz
5
man/cs/man1/icedtea-web-plugin.1.gz
5
man/cs/man1/icedtea-web.1.gz
6
man/cs/man1/icedtea-web.1.gz
6
man/cs/man1/itweb-javaws.1.gz
7
man/cs/man1/itweb-javaws.1.gz
Lines 26-29 Link Here
26
share/applications/itweb-settings.desktop
27
share/applications/itweb-settings.desktop
27
%%DATADIR%%/javaws_splash.png
28
%%DATADIR%%/javaws_splash.png
28
%%DATADIR%%/netx.jar
29
%%DATADIR%%/netx.jar
30
%%PLUGIN%%%%DATADIR%%/plugin.jar
29
share/pixmaps/itweb-javaws.png
31
share/pixmaps/itweb-javaws.png

Return to bug 229242