1
/* -*- Mode: C; tab-width: 8; 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/. */
7
* Header for JavaScript Debugging support - All public functions
13
/* Get jstypes.h included first. After that we can use PR macros for doing
14
* this extern "C" stuff!
34
* The linkage of JSD API functions differs depending on whether the file is
35
* used within the JSD library or not. Any source file within the JSD
36
* libraray should define EXPORT_JSD_API whereas any client of the library
40
#define JSD_PUBLIC_API(t) JS_EXPORT_API(t)
41
#define JSD_PUBLIC_DATA(t) JS_EXPORT_DATA(t)
43
#define JSD_PUBLIC_API(t) JS_IMPORT_API(t)
44
#define JSD_PUBLIC_DATA(t) JS_IMPORT_DATA(t)
47
#define JSD_FRIEND_API(t) JSD_PUBLIC_API(t)
48
#define JSD_FRIEND_DATA(t) JSD_PUBLIC_DATA(t)
50
/***************************************************************************/
51
/* Opaque typedefs for handles */
53
typedef struct JSDContext JSDContext;
54
typedef struct JSDScript JSDScript;
55
typedef struct JSDSourceText JSDSourceText;
56
typedef struct JSDThreadState JSDThreadState;
57
typedef struct JSDStackFrameInfo JSDStackFrameInfo;
58
typedef struct JSDValue JSDValue;
59
typedef struct JSDProperty JSDProperty;
60
typedef struct JSDObject JSDObject;
62
/***************************************************************************/
63
/* High Level calls */
66
* callback stuff for calls in EXE to be accessed by this code
67
* when it lives in an explicitly loaded DLL
71
* This callback allows JSD to inform the embedding when JSD has been
72
* turned on or off. This is especially useful in the Java-based debugging
73
* system used in mozilla because the debugger applet controls starting
77
(* JSD_SetContextProc)(JSDContext* jsdc, void* user);
79
/* This struct could have more fields in future versions */
82
unsigned size; /* size of this struct (init before use)*/
83
JSD_SetContextProc setContext;
87
* Used by an embedding to tell JSD what JSRuntime to use and to set
88
* callbacks without starting up JSD. This assumes only one JSRuntime
89
* will be used. This exists to support the mozilla Java-based debugger
92
extern JSD_PUBLIC_API(void)
93
JSD_SetUserCallbacks(JSRuntime* jsrt,
94
JSD_UserCallbacks* callbacks,
99
* This version of the init function requires that JSD_SetUserCallbacks()
100
* has been previously called (with a non-NULL callback struct pointer)
102
extern JSD_PUBLIC_API(JSDContext*)
103
JSD_DebuggerOn(void);
106
* Startup JSD on a particular JSRuntime with (optional) callbacks
108
extern JSD_PUBLIC_API(JSDContext*)
109
JSD_DebuggerOnForUser(JSRuntime* jsrt,
110
JSD_UserCallbacks* callbacks,
114
* Startup JSD in an application that uses compartments. Debugger
115
* objects will be allocated in the same compartment as scopeobj.
117
extern JSD_PUBLIC_API(JSDContext*)
118
JSD_DebuggerOnForUserWithCompartment(JSRuntime* jsrt,
119
JSD_UserCallbacks* callbacks,
124
* Shutdown JSD for this JSDContext
126
extern JSD_PUBLIC_API(void)
127
JSD_DebuggerOff(JSDContext* jsdc);
130
* Pause JSD for this JSDContext
132
extern JSD_PUBLIC_API(void)
133
JSD_DebuggerPause(JSDContext* jsdc);
136
* Unpause JSD for this JSDContext
138
extern JSD_PUBLIC_API(void)
139
JSD_DebuggerUnpause(JSDContext* jsdc);
142
* Get the Major Version (initial JSD release used major version = 1)
144
extern JSD_PUBLIC_API(unsigned)
145
JSD_GetMajorVersion(void);
148
* Get the Minor Version (initial JSD release used minor version = 0)
150
extern JSD_PUBLIC_API(unsigned)
151
JSD_GetMinorVersion(void);
154
* Returns a 'dumb' JSContext that can be used for utility purposes as needed
156
extern JSD_PUBLIC_API(JSContext*)
157
JSD_GetDefaultJSContext(JSDContext* jsdc);
160
* Returns a JSRuntime this context is associated with
162
extern JSD_PUBLIC_API(JSRuntime*)
163
JSD_GetJSRuntime(JSDContext* jsdc);
166
* Set the private data for this context, returns previous value
168
extern JSD_PUBLIC_API(void *)
169
JSD_SetContextPrivate(JSDContext *jsdc, void *data);
172
* Get the private data for this context
174
extern JSD_PUBLIC_API(void *)
175
JSD_GetContextPrivate(JSDContext *jsdc);
178
* Clear profile data for all scripts
180
extern JSD_PUBLIC_API(void)
181
JSD_ClearAllProfileData(JSDContext* jsdc);
187
/* Include native frames in JSDThreadStates. */
188
#define JSD_INCLUDE_NATIVE_FRAMES 0x01
190
* Normally, if a script has a 0 in JSD_SCRIPT_PROFILE_BIT it is included in
191
* profile data, otherwise it is not profiled. Setting the JSD_PROFILE_WHEN_SET
192
* flag reverses this convention.
194
#define JSD_PROFILE_WHEN_SET 0x02
196
* Normally, when the script in the top frame of a thread state has a 1 in
197
* JSD_SCRIPT_DEBUG_BIT, the execution hook is ignored. Setting the
198
* JSD_DEBUG_WHEN_SET flag reverses this convention.
200
#define JSD_DEBUG_WHEN_SET 0x04
202
* When this flag is set the internal call hook will collect profile data.
204
#define JSD_COLLECT_PROFILE_DATA 0x08
206
* When this flag is set, stack frames that are disabled for debugging
207
* will not appear in the call stack chain.
209
#define JSD_HIDE_DISABLED_FRAMES 0x10
211
* When this flag is set, the debugger will only check the
212
* JSD_SCRIPT_DEBUG_BIT on the top (most recent) stack frame. This
213
* makes it possible to stop in an enabled frame which was called from
214
* a stack that contains a disabled frame.
216
* When this flag is *not* set, any stack that contains a disabled frame
217
* will not be debugged (the execution hook will not be invoked.)
219
* This only applies when the reason for calling the hook would have
220
* been JSD_HOOK_INTERRUPTED or JSD_HOOK_THROW. JSD_HOOK_BREAKPOINT,
221
* JSD_HOOK_DEBUG_REQUESTED, and JSD_HOOK_DEBUGGER_KEYWORD always stop,
222
* regardless of this setting, as long as the top frame is not disabled.
224
* If JSD_HIDE_DISABLED_FRAMES is set, this is effectively set as well.
226
#define JSD_MASK_TOP_FRAME_ONLY 0x20
229
* 0x40 was formerly used to hook into object creation.
231
#define JSD_DISABLE_OBJECT_TRACE_RETIRED 0x40
234
extern JSD_PUBLIC_API(void)
235
JSD_SetContextFlags (JSDContext* jsdc, uint32_t flags);
237
extern JSD_PUBLIC_API(uint32_t)
238
JSD_GetContextFlags (JSDContext* jsdc);
241
* Notify JSD that this JSContext is 'in use'. This allows JSD to hook the
242
* ErrorReporter. For the most part this is done automatically whenever
243
* events like script loading happen. But, it is a good idea to call this
244
* from the embedding when new contexts come into use.
246
extern JSD_PUBLIC_API(void)
247
JSD_JSContextInUse(JSDContext* jsdc, JSContext* context);
250
* Find the JSDContext (if any) associated with the JSRuntime of a
253
extern JSD_PUBLIC_API(JSDContext*)
254
JSD_JSDContextForJSContext(JSContext* context);
256
/***************************************************************************/
257
/* Script functions */
260
* Lock the entire script subsystem. This grabs a highlevel lock that
261
* protects the JSD internal information about scripts. It is important
262
* to wrap script related calls in this lock in multithreaded situations
263
* -- i.e. where the debugger is running on a different thread than the
264
* interpreter -- or when multiple debugger threads may be accessing this
265
* subsystem. It is safe (and best) to use this locking even if the
266
* environment might not be multi-threaded. Safely nestable.
268
extern JSD_PUBLIC_API(void)
269
JSD_LockScriptSubsystem(JSDContext* jsdc);
272
* Unlock the entire script subsystem -- see JSD_LockScriptSubsystem
274
extern JSD_PUBLIC_API(void)
275
JSD_UnlockScriptSubsystem(JSDContext* jsdc);
278
* Iterate through all the active scripts for this JSDContext.
279
* NOTE: must initialize iterp to NULL to start iteration.
280
* NOTE: must lock and unlock the subsystem
283
* JSDScript jsdscript;
284
* JSDScript iter = NULL;
286
* JSD_LockScriptSubsystem(jsdc);
287
* while((jsdscript = JSD_IterateScripts(jsdc, &iter)) != NULL) {
288
* *** use jsdscript here ***
290
* JSD_UnlockScriptSubsystem(jsdc);
292
extern JSD_PUBLIC_API(JSDScript*)
293
JSD_IterateScripts(JSDContext* jsdc, JSDScript **iterp);
296
* Get the number of times this script has been called.
298
extern JSD_PUBLIC_API(unsigned)
299
JSD_GetScriptCallCount(JSDContext* jsdc, JSDScript *script);
302
* Get the max number of times this script called itself, directly or indirectly.
304
extern JSD_PUBLIC_API(unsigned)
305
JSD_GetScriptMaxRecurseDepth(JSDContext* jsdc, JSDScript *script);
308
* Get the shortest execution time recorded.
310
extern JSD_PUBLIC_API(double)
311
JSD_GetScriptMinExecutionTime(JSDContext* jsdc, JSDScript *script);
314
* Get the longest execution time recorded.
316
extern JSD_PUBLIC_API(double)
317
JSD_GetScriptMaxExecutionTime(JSDContext* jsdc, JSDScript *script);
320
* Get the total amount of time spent in this script.
322
extern JSD_PUBLIC_API(double)
323
JSD_GetScriptTotalExecutionTime(JSDContext* jsdc, JSDScript *script);
326
* Get the shortest execution time recorded, excluding time spent in called
329
extern JSD_PUBLIC_API(double)
330
JSD_GetScriptMinOwnExecutionTime(JSDContext* jsdc, JSDScript *script);
333
* Get the longest execution time recorded, excluding time spent in called
336
extern JSD_PUBLIC_API(double)
337
JSD_GetScriptMaxOwnExecutionTime(JSDContext* jsdc, JSDScript *script);
340
* Get the total amount of time spent in this script, excluding time spent
341
* in called functions.
343
extern JSD_PUBLIC_API(double)
344
JSD_GetScriptTotalOwnExecutionTime(JSDContext* jsdc, JSDScript *script);
347
* Clear profile data for this script.
349
extern JSD_PUBLIC_API(void)
350
JSD_ClearScriptProfileData(JSDContext* jsdc, JSDScript *script);
353
* Get the JSScript for a JSDScript
355
extern JSD_PUBLIC_API(JSScript*)
356
JSD_GetJSScript(JSDContext* jsdc, JSDScript *script);
359
* Get the JSFunction for a JSDScript
361
extern JSD_PUBLIC_API(JSFunction*)
362
JSD_GetJSFunction(JSDContext* jsdc, JSDScript *script);
365
* Determines whether or not to collect profile information for this
366
* script. The context flag JSD_PROFILE_WHEN_SET decides the logic.
368
#define JSD_SCRIPT_PROFILE_BIT 0x01
370
* Determines whether or not to ignore breakpoints, etc. in this script.
371
* The context flag JSD_DEBUG_WHEN_SET decides the logic.
373
#define JSD_SCRIPT_DEBUG_BIT 0x02
375
* Determines whether to invoke the onScriptDestroy callback for this
376
* script. The default is for this to be true if the onScriptCreated
377
* callback was invoked for this script.
379
#define JSD_SCRIPT_CALL_DESTROY_HOOK_BIT 0x04
381
extern JSD_PUBLIC_API(uint32_t)
382
JSD_GetScriptFlags(JSDContext *jsdc, JSDScript* jsdscript);
384
extern JSD_PUBLIC_API(void)
385
JSD_SetScriptFlags(JSDContext *jsdc, JSDScript* jsdscript, uint32_t flags);
388
* Set the private data for this script, returns previous value
390
extern JSD_PUBLIC_API(void *)
391
JSD_SetScriptPrivate(JSDScript* jsdscript, void *data);
394
* Get the private data for this script
396
extern JSD_PUBLIC_API(void *)
397
JSD_GetScriptPrivate(JSDScript* jsdscript);
400
* Determine if this script is still loaded in the interpreter
402
extern JSD_PUBLIC_API(JSBool)
403
JSD_IsActiveScript(JSDContext* jsdc, JSDScript *jsdscript);
406
* Get the filename associated with this script
408
extern JSD_PUBLIC_API(const char*)
409
JSD_GetScriptFilename(JSDContext* jsdc, JSDScript *jsdscript);
412
* Get the function name associated with this script (NULL if not a function).
413
* If the function does not have a name the result is the string "anonymous".
414
* *** new for gecko 2.0 ****
416
extern JSD_PUBLIC_API(JSString *)
417
JSD_GetScriptFunctionId(JSDContext* jsdc, JSDScript *jsdscript);
420
* Get the base linenumber of the sourcefile from which this script was loaded.
421
* This is one-based -- i.e. the first line of a file is line '1'. This may
422
* return 0 if this infomation is unknown.
424
extern JSD_PUBLIC_API(unsigned)
425
JSD_GetScriptBaseLineNumber(JSDContext* jsdc, JSDScript *jsdscript);
428
* Get the count of source lines associated with this script (1 or greater)
430
extern JSD_PUBLIC_API(unsigned)
431
JSD_GetScriptLineExtent(JSDContext* jsdc, JSDScript *jsdscript);
434
* Declaration of callback for notification of script creation and destruction.
435
* 'creating' is JS_TRUE if creating new script, JS_FALSE if destroying existing
436
* script (callback called just before actual destruction).
437
* 'callerdata' is what was passed to JSD_SetScriptHook to set the hook.
440
(* JSD_ScriptHookProc)(JSDContext* jsdc,
441
JSDScript* jsdscript,
446
* Set a hook to be called when scripts are created or destroyed (loaded or
448
* 'callerdata' can be whatever you want it to be.
450
extern JSD_PUBLIC_API(JSBool)
451
JSD_SetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc hook, void* callerdata);
454
* Get the current script hook.
456
extern JSD_PUBLIC_API(JSBool)
457
JSD_GetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc* hook, void** callerdata);
460
* Get a 'Program Counter' value for a given line. This represents the location
461
* of the first bit of executable code for this line of source. This 'pc' should
462
* be considered an opaque handle.
463
* 0 is returned for invalid scripts, or lines that lie outside the script.
464
* If no code is on the given line, then the returned pc represents the first
465
* code within the script (if any) after the given line.
466
* This function can be used to set breakpoints -- see JSD_SetExecutionHook
468
extern JSD_PUBLIC_API(uintptr_t)
469
JSD_GetClosestPC(JSDContext* jsdc, JSDScript* jsdscript, unsigned line);
472
* Get the source line number for a given 'Program Counter' location.
473
* Returns 0 if no source line information is appropriate (or available) for
476
extern JSD_PUBLIC_API(unsigned)
477
JSD_GetClosestLine(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc);
480
* Get a list of lines and the corresponding earliest PC for each (see
481
* JSD_GetClosestPC). Lines with no PCs associated will not be returned. NULL
482
* may be passed for either lines or pcs to avoid filling anything in for that
485
extern JSD_PUBLIC_API(JSBool)
486
JSD_GetLinePCs(JSDContext* jsdc, JSDScript* jsdscript,
487
unsigned startLine, unsigned maxLines,
488
unsigned* count, unsigned** lines, uintptr_t** pcs);
490
/* these are only used in cases where scripts are created outside of JS*/
493
* Direct call to notify JSD that a script has been created.
494
* Embeddings that use the normal jsapi script functions need not call this.
495
* Any embedding that follows the (discouraged!) practice of contructing script
496
* structures manually should call this function to inform JSD. (older ssjs
499
extern JSD_PUBLIC_API(void)
500
JSD_ScriptCreated(JSDContext* jsdc,
502
const char *filename, /* URL this script loads from */
503
unsigned lineno, /* line where this script starts */
508
* see JSD_ScriptCreated
510
extern JSD_PUBLIC_API(void)
511
JSD_ScriptDestroyed(JSDContext* jsdc,
515
/***************************************************************************/
516
/* Source Text functions */
519
* In some embeddings (e.g. mozilla) JavaScript source code from a 'file' may be
520
* execute before the entire 'file' has even been loaded. This system supports
521
* access to such incrmentally loaded source. It also allows for the possibility
522
* that source loading may fail or be aborted (though the source that did load
523
* may still be usable). Remember that this source is the entire 'file'
524
* contents and that the JavaScript code may only be part of that source.
526
* For any given URL there can only be one source text item (the most recently
530
/* these coorespond to netscape.jsdebug.SourceTextItem.java values -
531
* change in both places if anywhere
536
JSD_SOURCE_INITED = 0, /* initialized, but contains no source yet */
537
JSD_SOURCE_PARTIAL = 1, /* some source loaded, more expected */
538
JSD_SOURCE_COMPLETED = 2, /* all source finished loading */
539
JSD_SOURCE_ABORTED = 3, /* user aborted loading, some may be loaded */
540
JSD_SOURCE_FAILED = 4, /* loading failed, some may be loaded */
541
JSD_SOURCE_CLEARED = 5 /* text has been cleared by debugger */
545
* Lock the entire source text subsystem. This grabs a highlevel lock that
546
* protects the JSD internal information about sources. It is important to
547
* wrap source text related calls in this lock in multithreaded situations
548
* -- i.e. where the debugger is running on a different thread than the
549
* interpreter (or the loader of sources) -- or when multiple debugger
550
* threads may be accessing this subsystem. It is safe (and best) to use
551
* this locking even if the environment might not be multi-threaded.
554
extern JSD_PUBLIC_API(void)
555
JSD_LockSourceTextSubsystem(JSDContext* jsdc);
558
* Unlock the entire source text subsystem. see JSD_LockSourceTextSubsystem.
560
extern JSD_PUBLIC_API(void)
561
JSD_UnlockSourceTextSubsystem(JSDContext* jsdc);
564
* Iterate the source test items. Use the same pattern of calls shown in
565
* the example for JSD_IterateScripts - NOTE that the SourceTextSubsystem.
566
* must be locked before and unlocked after iterating.
568
extern JSD_PUBLIC_API(JSDSourceText*)
569
JSD_IterateSources(JSDContext* jsdc, JSDSourceText **iterp);
572
* Find the source text item for the given URL (or filename - or whatever
573
* string the given embedding uses to describe source locations).
574
* Returns NULL is not found.
576
extern JSD_PUBLIC_API(JSDSourceText*)
577
JSD_FindSourceForURL(JSDContext* jsdc, const char* url);
580
* Get the URL string associated with the given source text item
582
extern JSD_PUBLIC_API(const char*)
583
JSD_GetSourceURL(JSDContext* jsdc, JSDSourceText* jsdsrc);
586
* Get the actual source text. This gives access to the actual storage of
587
* the source - it sHould *not* be written to.
588
* The buffer is NOT zero terminated (nor is it guaranteed to have space to
589
* hold a zero terminating char).
590
* XXX this is 8-bit character data. Unicode source is not yet supported.
592
extern JSD_PUBLIC_API(JSBool)
593
JSD_GetSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc,
594
const char** ppBuf, int* pLen);
597
* Clear the text -- delete the text and set the status to JSD_SOURCE_CLEARED.
598
* This is useful if source is done loading and the debugger wishes to store
599
* the text data itself (e.g. in a Java String). This allows avoidance of
600
* storing the same text in multiple places.
602
extern JSD_PUBLIC_API(void)
603
JSD_ClearSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc);
606
* Return the status of the source text item. see JSDSourceStatus enum.
608
extern JSD_PUBLIC_API(JSDSourceStatus)
609
JSD_GetSourceStatus(JSDContext* jsdc, JSDSourceText* jsdsrc);
612
* Has the source been altered since the last call to JSD_SetSourceDirty?
613
* Use of JSD_IsSourceDirty and JSD_SetSourceDirty is still supported, but
614
* discouraged in favor of the JSD_GetSourceAlterCount system. This dirty
615
* scheme ASSUMES that there is only one consumer of the data.
617
extern JSD_PUBLIC_API(JSBool)
618
JSD_IsSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc);
621
* Clear the dirty flag
623
extern JSD_PUBLIC_API(void)
624
JSD_SetSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc, JSBool dirty);
627
* Each time a source text item is altered this value is incremented. Any
628
* consumer can store this value when they retieve other data about the
629
* source text item and then check later to see if the current value is
630
* different from their stored value. Thus they can know if they have stale
631
* data or not. NOTE: this value is not gauranteed to start at any given number.
633
extern JSD_PUBLIC_API(unsigned)
634
JSD_GetSourceAlterCount(JSDContext* jsdc, JSDSourceText* jsdsrc);
637
* Force an increment in the alter count for a source text item. This is
638
* normally automatic when the item changes, but a give consumer may want to
639
* force this to amke an item appear to have changed even if it has not.
641
extern JSD_PUBLIC_API(unsigned)
642
JSD_IncrementSourceAlterCount(JSDContext* jsdc, JSDSourceText* jsdsrc);
645
* Destroy *all* the source text items
646
* (new for server-side USE WITH CARE)
648
extern JSD_PUBLIC_API(void)
649
JSD_DestroyAllSources( JSDContext* jsdc );
651
/* functions for adding source items */
654
* Add a new item for a given URL. If an iten already exists for the given URL
655
* then the old item is removed.
656
* 'url' may not be NULL.
658
* ifdef LIVEWIRE url is treated as a char* and ownership is claimed by jsd
660
extern JSD_PUBLIC_API(JSDSourceText*)
661
JSD_NewSourceText(JSDContext* jsdc, const char* url);
664
* Append text (or change status -- e.g. set completed) for a source text
665
* item. Text need not be zero terminated. Callers should consider the returned
666
* JSDSourceText to be the 'current' item for future use. This may return NULL
667
* if called after this item has been replaced by a call to JSD_NewSourceText.
669
extern JSD_PUBLIC_API(JSDSourceText*)
670
JSD_AppendSourceText(JSDContext* jsdc,
671
JSDSourceText* jsdsrc,
672
const char* text, /* *not* zero terminated */
674
JSDSourceStatus status);
677
* Unicode varient of JSD_AppendSourceText.
679
* NOTE: At this point text is stored in 8bit ASCII so this function just
680
* extracts the bottom 8bits from each jschar. At some future point we may
681
* switch to storing and exposing 16bit Unicode.
683
extern JSD_PUBLIC_API(JSDSourceText*)
684
JSD_AppendUCSourceText(JSDContext* jsdc,
685
JSDSourceText* jsdsrc,
686
const jschar* text, /* *not* zero terminated */
688
JSDSourceStatus status);
690
* Convienence function for adding complete source of url in one call.
692
* JSDSourceText* jsdsrc;
693
* JSD_LOCK_SOURCE_TEXT(jsdc);
694
* jsdsrc = jsd_NewSourceText(jsdc, url);
696
* jsdsrc = jsd_AppendSourceText(jsdc, jsdsrc,
697
* text, length, JSD_SOURCE_PARTIAL);
699
* jsdsrc = jsd_AppendSourceText(jsdc, jsdsrc,
700
* NULL, 0, JSD_SOURCE_COMPLETED);
701
* JSD_UNLOCK_SOURCE_TEXT(jsdc);
702
* return jsdsrc ? JS_TRUE : JS_FALSE;
704
extern JSD_PUBLIC_API(JSBool)
705
JSD_AddFullSourceText(JSDContext* jsdc,
706
const char* text, /* *not* zero terminated */
710
/***************************************************************************/
711
/* Execution/Interrupt Hook functions */
713
/* possible 'type' params for JSD_ExecutionHookProc */
714
#define JSD_HOOK_INTERRUPTED 0
715
#define JSD_HOOK_BREAKPOINT 1
716
#define JSD_HOOK_DEBUG_REQUESTED 2
717
#define JSD_HOOK_DEBUGGER_KEYWORD 3
718
#define JSD_HOOK_THROW 4
720
/* legal return values for JSD_ExecutionHookProc */
721
#define JSD_HOOK_RETURN_HOOK_ERROR 0
722
#define JSD_HOOK_RETURN_CONTINUE 1
723
#define JSD_HOOK_RETURN_ABORT 2
724
#define JSD_HOOK_RETURN_RET_WITH_VAL 3
725
#define JSD_HOOK_RETURN_THROW_WITH_VAL 4
726
#define JSD_HOOK_RETURN_CONTINUE_THROW 5
729
* Implement a callback of this form in order to hook execution.
732
(* JSD_ExecutionHookProc)(JSDContext* jsdc,
733
JSDThreadState* jsdthreadstate,
738
/* possible 'type' params for JSD_CallHookProc */
739
#define JSD_HOOK_TOPLEVEL_START 0 /* about to evaluate top level script */
740
#define JSD_HOOK_TOPLEVEL_END 1 /* done evaluting top level script */
741
#define JSD_HOOK_FUNCTION_CALL 2 /* about to call a function */
742
#define JSD_HOOK_FUNCTION_RETURN 3 /* done calling function */
745
* Implement a callback of this form in order to hook function call/returns.
746
* Return JS_TRUE from a TOPLEVEL_START or FUNCTION_CALL type call hook if you
747
* want to hear about the TOPLEVEL_END or FUNCTION_RETURN too. Return value is
748
* ignored to TOPLEVEL_END and FUNCTION_RETURN type hooks.
751
(* JSD_CallHookProc)(JSDContext* jsdc,
752
JSDThreadState* jsdthreadstate,
757
* Set Hook to be called whenever the given pc is about to be executed --
758
* i.e. for 'trap' or 'breakpoint'
760
extern JSD_PUBLIC_API(JSBool)
761
JSD_SetExecutionHook(JSDContext* jsdc,
762
JSDScript* jsdscript,
764
JSD_ExecutionHookProc hook,
768
* Clear the hook for this pc
770
extern JSD_PUBLIC_API(JSBool)
771
JSD_ClearExecutionHook(JSDContext* jsdc,
772
JSDScript* jsdscript,
776
* Clear all the pc specific hooks for this script
778
extern JSD_PUBLIC_API(JSBool)
779
JSD_ClearAllExecutionHooksForScript(JSDContext* jsdc, JSDScript* jsdscript);
782
* Clear all the pc specific hooks for the entire JSRuntime associated with
785
extern JSD_PUBLIC_API(JSBool)
786
JSD_ClearAllExecutionHooks(JSDContext* jsdc);
789
* Set a hook to be called before the next instruction is executed. Depending
790
* on the threading situation and whether or not an JS code is currently
791
* executing the hook might be called before this call returns, or at some
792
* future time. The hook will continue to be called as each instruction
793
* executes until cleared.
795
extern JSD_PUBLIC_API(JSBool)
796
JSD_SetInterruptHook(JSDContext* jsdc,
797
JSD_ExecutionHookProc hook,
801
* Call the interrupt hook at least once per source line
803
extern JSD_PUBLIC_API(JSBool)
804
JSD_EnableSingleStepInterrupts(JSDContext* jsdc, JSDScript *jsdscript, JSBool enable);
807
* Clear the current interrupt hook.
809
extern JSD_PUBLIC_API(JSBool)
810
JSD_ClearInterruptHook(JSDContext* jsdc);
813
* Set the hook that should be called whenever a JSD_ErrorReporter hook
814
* returns JSD_ERROR_REPORTER_DEBUG.
816
extern JSD_PUBLIC_API(JSBool)
817
JSD_SetDebugBreakHook(JSDContext* jsdc,
818
JSD_ExecutionHookProc hook,
822
* Clear the debug break hook
824
extern JSD_PUBLIC_API(JSBool)
825
JSD_ClearDebugBreakHook(JSDContext* jsdc);
828
* Set the hook that should be called when the 'debugger' keyword is
829
* encountered by the JavaScript interpreter during execution.
831
extern JSD_PUBLIC_API(JSBool)
832
JSD_SetDebuggerHook(JSDContext* jsdc,
833
JSD_ExecutionHookProc hook,
837
* Clear the 'debugger' keyword hook
839
extern JSD_PUBLIC_API(JSBool)
840
JSD_ClearDebuggerHook(JSDContext* jsdc);
843
* Set the hook that should be called when a JS exception is thrown.
844
* NOTE: the 'do default' return value is: JSD_HOOK_RETURN_CONTINUE_THROW
846
extern JSD_PUBLIC_API(JSBool)
847
JSD_SetThrowHook(JSDContext* jsdc,
848
JSD_ExecutionHookProc hook,
851
* Clear the throw hook
853
extern JSD_PUBLIC_API(JSBool)
854
JSD_ClearThrowHook(JSDContext* jsdc);
857
* Set the hook that should be called when a toplevel script begins or completes.
859
extern JSD_PUBLIC_API(JSBool)
860
JSD_SetTopLevelHook(JSDContext* jsdc,
861
JSD_CallHookProc hook,
864
* Clear the toplevel call hook
866
extern JSD_PUBLIC_API(JSBool)
867
JSD_ClearTopLevelHook(JSDContext* jsdc);
870
* Set the hook that should be called when a function call or return happens.
872
extern JSD_PUBLIC_API(JSBool)
873
JSD_SetFunctionHook(JSDContext* jsdc,
874
JSD_CallHookProc hook,
877
* Clear the function call hook
879
extern JSD_PUBLIC_API(JSBool)
880
JSD_ClearFunctionHook(JSDContext* jsdc);
882
/***************************************************************************/
883
/* Stack Frame functions */
886
* Get the count of call stack frames for the given JSDThreadState
888
extern JSD_PUBLIC_API(unsigned)
889
JSD_GetCountOfStackFrames(JSDContext* jsdc, JSDThreadState* jsdthreadstate);
892
* Get the 'current' call stack frame for the given JSDThreadState
894
extern JSD_PUBLIC_API(JSDStackFrameInfo*)
895
JSD_GetStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate);
898
* Get the JSContext for the given JSDThreadState
900
extern JSD_PUBLIC_API(JSContext*)
901
JSD_GetJSContext(JSDContext* jsdc, JSDThreadState* jsdthreadstate);
904
* Get the calling call stack frame for the given frame
906
extern JSD_PUBLIC_API(JSDStackFrameInfo*)
907
JSD_GetCallingStackFrame(JSDContext* jsdc,
908
JSDThreadState* jsdthreadstate,
909
JSDStackFrameInfo* jsdframe);
912
* Get the script for the given call stack frame
914
extern JSD_PUBLIC_API(JSDScript*)
915
JSD_GetScriptForStackFrame(JSDContext* jsdc,
916
JSDThreadState* jsdthreadstate,
917
JSDStackFrameInfo* jsdframe);
920
* Get the 'Program Counter' for the given call stack frame
922
extern JSD_PUBLIC_API(uintptr_t)
923
JSD_GetPCForStackFrame(JSDContext* jsdc,
924
JSDThreadState* jsdthreadstate,
925
JSDStackFrameInfo* jsdframe);
928
* Get the JavaScript Call Object for the given call stack frame.
929
* *** new for version 1.1 ****
931
extern JSD_PUBLIC_API(JSDValue*)
932
JSD_GetCallObjectForStackFrame(JSDContext* jsdc,
933
JSDThreadState* jsdthreadstate,
934
JSDStackFrameInfo* jsdframe);
937
* Get the head of the scope chain for the given call stack frame.
938
* the chain can be traversed using JSD_GetValueParent.
939
* *** new for version 1.1 ****
941
extern JSD_PUBLIC_API(JSDValue*)
942
JSD_GetScopeChainForStackFrame(JSDContext* jsdc,
943
JSDThreadState* jsdthreadstate,
944
JSDStackFrameInfo* jsdframe);
947
* Get the 'this' Object for the given call stack frame.
948
* *** new for version 1.1 ****
950
extern JSD_PUBLIC_API(JSDValue*)
951
JSD_GetThisForStackFrame(JSDContext* jsdc,
952
JSDThreadState* jsdthreadstate,
953
JSDStackFrameInfo* jsdframe);
956
* Get the name of the function executing in this stack frame. Especially useful
957
* for native frames (without script objects.)
958
* *** new for gecko 2.0 ****
960
extern JSD_PUBLIC_API(JSString *)
961
JSD_GetIdForStackFrame(JSDContext* jsdc,
962
JSDThreadState* jsdthreadstate,
963
JSDStackFrameInfo* jsdframe);
966
* True if stack frame represents a frame created as a result of a debugger
969
extern JSD_PUBLIC_API(JSBool)
970
JSD_IsStackFrameDebugger(JSDContext* jsdc,
971
JSDThreadState* jsdthreadstate,
972
JSDStackFrameInfo* jsdframe);
975
* True if stack frame is constructing a new object.
977
extern JSD_PUBLIC_API(JSBool)
978
JSD_IsStackFrameConstructing(JSDContext* jsdc,
979
JSDThreadState* jsdthreadstate,
980
JSDStackFrameInfo* jsdframe);
983
* Evaluate the given unicode source code in the context of the given stack frame.
984
* returns JS_TRUE and puts result in rval on success, JS_FALSE on failure.
985
* NOTE: The ErrorReporter hook might be called if this fails.
987
extern JSD_PUBLIC_API(JSBool)
988
JSD_EvaluateUCScriptInStackFrame(JSDContext* jsdc,
989
JSDThreadState* jsdthreadstate,
990
JSDStackFrameInfo* jsdframe,
991
const jschar *bytes, unsigned length,
992
const char *filename, unsigned lineno,
996
* Same as above, but does not eat exceptions.
998
extern JSD_PUBLIC_API(JSBool)
999
JSD_AttemptUCScriptInStackFrame(JSDContext* jsdc,
1000
JSDThreadState* jsdthreadstate,
1001
JSDStackFrameInfo* jsdframe,
1002
const jschar *bytes, unsigned length,
1003
const char *filename, unsigned lineno,
1006
/* single byte character version of JSD_EvaluateUCScriptInStackFrame */
1007
extern JSD_PUBLIC_API(JSBool)
1008
JSD_EvaluateScriptInStackFrame(JSDContext* jsdc,
1009
JSDThreadState* jsdthreadstate,
1010
JSDStackFrameInfo* jsdframe,
1011
const char *bytes, unsigned length,
1012
const char *filename, unsigned lineno, jsval *rval);
1015
* Same as above, but does not eat exceptions.
1017
extern JSD_PUBLIC_API(JSBool)
1018
JSD_AttemptScriptInStackFrame(JSDContext* jsdc,
1019
JSDThreadState* jsdthreadstate,
1020
JSDStackFrameInfo* jsdframe,
1021
const char *bytes, unsigned length,
1022
const char *filename, unsigned lineno, jsval *rval);
1025
* Convert the given jsval to a string
1026
* NOTE: The ErrorReporter hook might be called if this fails.
1028
extern JSD_PUBLIC_API(JSString*)
1029
JSD_ValToStringInStackFrame(JSDContext* jsdc,
1030
JSDThreadState* jsdthreadstate,
1031
JSDStackFrameInfo* jsdframe,
1035
* Get the JSDValue currently being thrown as an exception (may be NULL).
1036
* NOTE: must eventually release by calling JSD_DropValue (if not NULL)
1037
* *** new for version 1.1 ****
1039
extern JSD_PUBLIC_API(JSDValue*)
1040
JSD_GetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate);
1043
* Set the JSDValue currently being thrown as an exception.
1044
* *** new for version 1.1 ****
1046
extern JSD_PUBLIC_API(JSBool)
1047
JSD_SetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate,
1050
/***************************************************************************/
1051
/* Error Reporter functions */
1054
* XXX The ErrorReporter Hook scheme is going to change soon to more
1055
* Fully support exceptions.
1058
/* legal return values for JSD_ErrorReporter */
1059
#define JSD_ERROR_REPORTER_PASS_ALONG 0 /* pass along to regular reporter */
1060
#define JSD_ERROR_REPORTER_RETURN 1 /* don't pass to error reporter */
1061
#define JSD_ERROR_REPORTER_DEBUG 2 /* force call to DebugBreakHook */
1062
#define JSD_ERROR_REPORTER_CLEAR_RETURN 3 /* clear exception and don't pass */
1065
* Implement a callback of this form in order to hook the ErrorReporter
1068
(* JSD_ErrorReporter)(JSDContext* jsdc,
1070
const char* message,
1071
JSErrorReport* report,
1074
/* Set ErrorReporter hook */
1075
extern JSD_PUBLIC_API(JSBool)
1076
JSD_SetErrorReporter(JSDContext* jsdc,
1077
JSD_ErrorReporter reporter,
1080
/* Get Current ErrorReporter hook */
1081
extern JSD_PUBLIC_API(JSBool)
1082
JSD_GetErrorReporter(JSDContext* jsdc,
1083
JSD_ErrorReporter* reporter,
1086
/***************************************************************************/
1087
/* Generic locks that callers can use for their own purposes */
1090
* Is Locking and GetThread supported in this build?
1092
extern JSD_PUBLIC_API(JSBool)
1093
JSD_IsLockingAndThreadIdSupported();
1096
* Create a reentrant/nestable lock
1098
extern JSD_PUBLIC_API(void*)
1102
* Aquire lock for this thread (or block until available). Increments a
1103
* counter if this thread already owns the lock.
1105
extern JSD_PUBLIC_API(void)
1106
JSD_Lock(void* lock);
1109
* Release lock for this thread (or decrement the counter if JSD_Lock
1110
* was previous called more than once).
1112
extern JSD_PUBLIC_API(void)
1113
JSD_Unlock(void* lock);
1116
* For debugging only if not (JS_THREADSAFE AND DEBUG) then returns JS_TRUE
1117
* So JSD_IsLocked(lock) may not equal !JSD_IsUnlocked(lock)
1119
extern JSD_PUBLIC_API(JSBool)
1120
JSD_IsLocked(void* lock);
1125
extern JSD_PUBLIC_API(JSBool)
1126
JSD_IsUnlocked(void* lock);
1129
* return an ID uniquely identifying this thread.
1131
extern JSD_PUBLIC_API(void*)
1132
JSD_CurrentThread();
1134
/***************************************************************************/
1135
/* Value and Property Functions --- All NEW for 1.1 --- */
1138
* NOTE: JSDValue and JSDProperty objects are reference counted. This allows
1139
* for rooting these objects AND any underlying garbage collected jsvals.
1140
* ALL JSDValue and JSDProperty objects returned by the functions below
1141
* MUST eventually be released using the appropriate JSD_Dropxxx function.
1145
* Create a new JSDValue to wrap the given jsval
1146
* NOTE: must eventually release by calling JSD_DropValue (if not NULL)
1147
* *** new for version 1.1 ****
1149
extern JSD_PUBLIC_API(JSDValue*)
1150
JSD_NewValue(JSDContext* jsdc, jsval val);
1153
* Release the JSDValue. After this call the object MUST not be referenced again!
1154
* *** new for version 1.1 ****
1156
extern JSD_PUBLIC_API(void)
1157
JSD_DropValue(JSDContext* jsdc, JSDValue* jsdval);
1160
* Get the jsval wrapped by this JSDValue
1161
* *** new for version 1.1 ****
1163
extern JSD_PUBLIC_API(jsval)
1164
JSD_GetValueWrappedJSVal(JSDContext* jsdc, JSDValue* jsdval);
1167
* Clear all property and association information about the given JSDValue.
1168
* Such information will be lazily regenerated when later accessed. This
1169
* function must be called to make changes to the properties of an object
1170
* visible to the accessor functions below (if the properties et.al. have
1171
* changed since a previous call to those accessors).
1172
* *** new for version 1.1 ****
1174
extern JSD_PUBLIC_API(void)
1175
JSD_RefreshValue(JSDContext* jsdc, JSDValue* jsdval);
1177
/**************************************************/
1180
* Does the JSDValue wrap a JSObject?
1181
* *** new for version 1.1 ****
1183
extern JSD_PUBLIC_API(JSBool)
1184
JSD_IsValueObject(JSDContext* jsdc, JSDValue* jsdval);
1187
* Does the JSDValue wrap a number (int or double)?
1188
* *** new for version 1.1 ****
1190
extern JSD_PUBLIC_API(JSBool)
1191
JSD_IsValueNumber(JSDContext* jsdc, JSDValue* jsdval);
1194
* Does the JSDValue wrap an int?
1195
* *** new for version 1.1 ****
1197
extern JSD_PUBLIC_API(JSBool)
1198
JSD_IsValueInt(JSDContext* jsdc, JSDValue* jsdval);
1201
* Does the JSDValue wrap a double?
1202
* *** new for version 1.1 ****
1204
extern JSD_PUBLIC_API(JSBool)
1205
JSD_IsValueDouble(JSDContext* jsdc, JSDValue* jsdval);
1208
* Does the JSDValue wrap a JSString?
1209
* *** new for version 1.1 ****
1211
extern JSD_PUBLIC_API(JSBool)
1212
JSD_IsValueString(JSDContext* jsdc, JSDValue* jsdval);
1215
* Does the JSDValue wrap a JSBool?
1216
* *** new for version 1.1 ****
1218
extern JSD_PUBLIC_API(JSBool)
1219
JSD_IsValueBoolean(JSDContext* jsdc, JSDValue* jsdval);
1222
* Does the JSDValue wrap a JSVAL_NULL?
1223
* *** new for version 1.1 ****
1225
extern JSD_PUBLIC_API(JSBool)
1226
JSD_IsValueNull(JSDContext* jsdc, JSDValue* jsdval);
1229
* Does the JSDValue wrap a JSVAL_VOID?
1230
* *** new for version 1.1 ****
1232
extern JSD_PUBLIC_API(JSBool)
1233
JSD_IsValueVoid(JSDContext* jsdc, JSDValue* jsdval);
1236
* Does the JSDValue wrap a primative (not a JSObject)?
1237
* *** new for version 1.1 ****
1239
extern JSD_PUBLIC_API(JSBool)
1240
JSD_IsValuePrimitive(JSDContext* jsdc, JSDValue* jsdval);
1243
* Does the JSDValue wrap a function?
1244
* *** new for version 1.1 ****
1246
extern JSD_PUBLIC_API(JSBool)
1247
JSD_IsValueFunction(JSDContext* jsdc, JSDValue* jsdval);
1250
* Does the JSDValue wrap a native function?
1251
* *** new for version 1.1 ****
1253
extern JSD_PUBLIC_API(JSBool)
1254
JSD_IsValueNative(JSDContext* jsdc, JSDValue* jsdval);
1256
/**************************************************/
1259
* Return JSBool value (does NOT do conversion).
1260
* *** new for version 1.1 ****
1262
extern JSD_PUBLIC_API(JSBool)
1263
JSD_GetValueBoolean(JSDContext* jsdc, JSDValue* jsdval);
1266
* Return int32_t value (does NOT do conversion).
1267
* *** new for version 1.1 ****
1269
extern JSD_PUBLIC_API(int32_t)
1270
JSD_GetValueInt(JSDContext* jsdc, JSDValue* jsdval);
1273
* Return double value (does NOT do conversion).
1274
* *** new for version 1.1 ****
1276
extern JSD_PUBLIC_API(double)
1277
JSD_GetValueDouble(JSDContext* jsdc, JSDValue* jsdval);
1280
* Return JSString value (DOES do conversion if necessary).
1281
* NOTE that the JSString returned is not protected from garbage
1282
* collection. It should be immediately read or wrapped using
1283
* JSD_NewValue(jsdc,STRING_TO_JSVAL(str)) if necessary.
1284
* *** new for version 1.1 ****
1286
extern JSD_PUBLIC_API(JSString*)
1287
JSD_GetValueString(JSDContext* jsdc, JSDValue* jsdval);
1290
* Return name of function IFF JSDValue represents a function.
1291
* *** new for gecko 2.0 ****
1293
extern JSD_PUBLIC_API(JSString *)
1294
JSD_GetValueFunctionId(JSDContext* jsdc, JSDValue* jsdval);
1297
* Return function object IFF JSDValue represents a function or an object
1298
* wrapping a function.
1299
* *** new for version 1.1 ****
1301
extern JSD_PUBLIC_API(JSFunction*)
1302
JSD_GetValueFunction(JSDContext* jsdc, JSDValue* jsdval);
1304
/**************************************************/
1307
* Return the number of properties for the JSDValue.
1308
* *** new for version 1.1 ****
1310
extern JSD_PUBLIC_API(unsigned)
1311
JSD_GetCountOfProperties(JSDContext* jsdc, JSDValue* jsdval);
1314
* Iterate through the properties of the JSDValue.
1315
* Use form similar to that shown for JSD_IterateScripts (no locking required).
1316
* NOTE: each JSDProperty returned must eventually be released by calling
1318
* *** new for version 1.1 ****
1320
extern JSD_PUBLIC_API(JSDProperty*)
1321
JSD_IterateProperties(JSDContext* jsdc, JSDValue* jsdval, JSDProperty **iterp);
1324
* Get the JSDProperty for the property of this JSDVal with this name.
1325
* NOTE: must eventually release by calling JSD_DropProperty (if not NULL)
1326
* *** new for version 1.1 ****
1328
extern JSD_PUBLIC_API(JSDProperty*)
1329
JSD_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* name);
1332
* Get the prototype object for this JSDValue.
1333
* NOTE: must eventually release by calling JSD_DropValue (if not NULL)
1334
* *** new for version 1.1 ****
1336
extern JSD_PUBLIC_API(JSDValue*)
1337
JSD_GetValuePrototype(JSDContext* jsdc, JSDValue* jsdval);
1340
* Get the parent object for this JSDValue.
1341
* NOTE: must eventually release by calling JSD_DropValue (if not NULL)
1342
* *** new for version 1.1 ****
1344
extern JSD_PUBLIC_API(JSDValue*)
1345
JSD_GetValueParent(JSDContext* jsdc, JSDValue* jsdval);
1348
* Get the ctor object for this JSDValue (or likely its prototype's ctor).
1349
* NOTE: must eventually release by calling JSD_DropValue (if not NULL)
1350
* *** new for version 1.1 ****
1352
extern JSD_PUBLIC_API(JSDValue*)
1353
JSD_GetValueConstructor(JSDContext* jsdc, JSDValue* jsdval);
1356
* Get the name of the class for this object.
1357
* *** new for version 1.1 ****
1359
extern JSD_PUBLIC_API(const char*)
1360
JSD_GetValueClassName(JSDContext* jsdc, JSDValue* jsdval);
1363
* Get the script for the given value if the given value represents a
1364
* scripted function. Otherwise, return null.
1366
extern JSD_PUBLIC_API(JSDScript*)
1367
JSD_GetScriptForValue(JSDContext* jsdc, JSDValue* jsdval);
1369
/**************************************************/
1371
/* possible or'd together bitflags returned by JSD_GetPropertyFlags
1373
* XXX these must stay the same as the JSPD_ flags in jsdbgapi.h
1375
#define JSDPD_ENUMERATE JSPD_ENUMERATE /* visible to for/in loop */
1376
#define JSDPD_READONLY JSPD_READONLY /* assignment is error */
1377
#define JSDPD_PERMANENT JSPD_PERMANENT /* property cannot be deleted */
1378
#define JSDPD_ALIAS JSPD_ALIAS /* property has an alias id */
1379
#define JSDPD_EXCEPTION JSPD_EXCEPTION /* exception occurred looking up */
1380
/* proprety, value is exception */
1381
#define JSDPD_ERROR JSPD_ERROR /* native getter returned JS_FALSE */
1382
/* without throwing an exception */
1383
/* this is not one of the JSPD_ flags in jsdbgapi.h - careful not to overlap*/
1384
#define JSDPD_HINTED 0x800 /* found via explicit lookup */
1387
* Release this JSDProperty
1388
* *** new for version 1.1 ****
1390
extern JSD_PUBLIC_API(void)
1391
JSD_DropProperty(JSDContext* jsdc, JSDProperty* jsdprop);
1394
* Get the JSDValue represeting the name of this property (int or string)
1395
* NOTE: must eventually release by calling JSD_DropValue
1396
* *** new for version 1.1 ****
1398
extern JSD_PUBLIC_API(JSDValue*)
1399
JSD_GetPropertyName(JSDContext* jsdc, JSDProperty* jsdprop);
1402
* Get the JSDValue represeting the current value of this property
1403
* NOTE: must eventually release by calling JSD_DropValue (if not NULL)
1404
* *** new for version 1.1 ****
1406
extern JSD_PUBLIC_API(JSDValue*)
1407
JSD_GetPropertyValue(JSDContext* jsdc, JSDProperty* jsdprop);
1410
* Get the JSDValue represeting the alias of this property (if JSDPD_ALIAS set)
1411
* NOTE: must eventually release by calling JSD_DropValue (if not NULL)
1412
* *** new for version 1.1 ****
1414
extern JSD_PUBLIC_API(JSDValue*)
1415
JSD_GetPropertyAlias(JSDContext* jsdc, JSDProperty* jsdprop);
1418
* Get the flags for this property
1419
* *** new for version 1.1 ****
1421
extern JSD_PUBLIC_API(unsigned)
1422
JSD_GetPropertyFlags(JSDContext* jsdc, JSDProperty* jsdprop);
1424
/***************************************************************************/
1425
/* Object Functions --- All NEW for 1.1 --- */
1428
* JSDObjects exist to allow a means of iterating through all JSObjects in the
1429
* engine. They are created and destroyed as the wrapped JSObjects are created
1430
* and destroyed in the engine. JSDObjects additionally track the location in
1431
* the JavaScript source where their wrapped JSObjects were created and the name
1432
* and location of the (non-native) constructor used.
1434
* NOTE: JSDObjects are NOT reference counted. The have only weak links to
1435
* jsObjects - thus they do not inhibit garbage collection of JSObjects. If
1436
* you need a JSDObject to safely persist then wrap it in a JSDValue (using
1437
* jsd_GetValueForObject).
1441
* Lock the entire Object subsystem -- see JSD_UnlockObjectSubsystem
1442
* *** new for version 1.1 ****
1444
extern JSD_PUBLIC_API(void)
1445
JSD_LockObjectSubsystem(JSDContext* jsdc);
1448
* Unlock the entire Object subsystem -- see JSD_LockObjectSubsystem
1449
* *** new for version 1.1 ****
1451
extern JSD_PUBLIC_API(void)
1452
JSD_UnlockObjectSubsystem(JSDContext* jsdc);
1455
* Iterate through the known objects
1456
* Use form similar to that shown for JSD_IterateScripts.
1457
* NOTE: the ObjectSubsystem must be locked before and unlocked after iterating.
1458
* *** new for version 1.1 ****
1460
extern JSD_PUBLIC_API(JSDObject*)
1461
JSD_IterateObjects(JSDContext* jsdc, JSDObject** iterp);
1464
* Get the JSObject represented by this JSDObject
1465
* *** new for version 1.1 ****
1467
extern JSD_PUBLIC_API(JSObject*)
1468
JSD_GetWrappedObject(JSDContext* jsdc, JSDObject* jsdobj);
1471
* Get the URL of the line of source that caused this object to be created.
1473
* *** new for version 1.1 ****
1475
extern JSD_PUBLIC_API(const char*)
1476
JSD_GetObjectNewURL(JSDContext* jsdc, JSDObject* jsdobj);
1479
* Get the line number of the line of source that caused this object to be
1480
* created. May be 0 indicating that the line number is unknown.
1481
* *** new for version 1.1 ****
1483
extern JSD_PUBLIC_API(unsigned)
1484
JSD_GetObjectNewLineNumber(JSDContext* jsdc, JSDObject* jsdobj);
1487
* Get the URL of the line of source of the constructor for this object.
1489
* *** new for version 1.1 ****
1491
extern JSD_PUBLIC_API(const char*)
1492
JSD_GetObjectConstructorURL(JSDContext* jsdc, JSDObject* jsdobj);
1495
* Get the line number of the line of source of the constructor for this object.
1496
* created. May be 0 indicating that the line number is unknown.
1497
* *** new for version 1.1 ****
1499
extern JSD_PUBLIC_API(unsigned)
1500
JSD_GetObjectConstructorLineNumber(JSDContext* jsdc, JSDObject* jsdobj);
1503
* Get the name of the constructor for this object.
1505
* *** new for version 1.1 ****
1507
extern JSD_PUBLIC_API(const char*)
1508
JSD_GetObjectConstructorName(JSDContext* jsdc, JSDObject* jsdobj);
1511
* Get JSDObject representing this JSObject.
1513
* *** new for version 1.1 ****
1515
extern JSD_PUBLIC_API(JSDObject*)
1516
JSD_GetJSDObjectForJSObject(JSDContext* jsdc, JSObject* jsobj);
1519
* Get JSDObject representing this JSDValue.
1521
* *** new for version 1.1 ****
1523
extern JSD_PUBLIC_API(JSDObject*)
1524
JSD_GetObjectForValue(JSDContext* jsdc, JSDValue* jsdval);
1527
* Create a JSDValue to wrap (and root) this JSDObject.
1528
* NOTE: must eventually release by calling JSD_DropValue (if not NULL)
1529
* *** new for version 1.1 ****
1531
extern JSD_PUBLIC_API(JSDValue*)
1532
JSD_GetValueForObject(JSDContext* jsdc, JSDObject* jsdobj);
1534
/***************************************************************************/
1535
/* Livewire specific API */
1538
extern JSD_PUBLIC_API(LWDBGScript*)
1539
JSDLW_GetLWScript(JSDContext* jsdc, JSDScript* jsdscript);
1541
extern JSD_PUBLIC_API(JSDSourceText*)
1542
JSDLW_PreLoadSource(JSDContext* jsdc, LWDBGApp* app,
1543
const char* filename, JSBool clear);
1545
extern JSD_PUBLIC_API(JSDSourceText*)
1546
JSDLW_ForceLoadSource(JSDContext* jsdc, JSDSourceText* jsdsrc);
1548
extern JSD_PUBLIC_API(JSBool)
1549
JSDLW_RawToProcessedLineNumber(JSDContext* jsdc, JSDScript* jsdscript,
1550
unsigned lineIn, unsigned* lineOut);
1552
extern JSD_PUBLIC_API(JSBool)
1553
JSDLW_ProcessedToRawLineNumber(JSDContext* jsdc, JSDScript* jsdscript,
1554
unsigned lineIn, unsigned* lineOut);
1557
/***************************************************************************/
1561
#endif /* jsdebug_h___ */