2013-04-17 00:47:10 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
* vim: set ts=8 sts=4 et sw=4 tw=99:
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
2012-05-21 15:12:37 +04:00
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1998-03-28 05:44:41 +03:00
|
|
|
|
|
|
|
/*
|
1998-11-05 11:57:24 +03:00
|
|
|
* Header for JavaScript Debugging support - Internal ONLY declarations
|
|
|
|
*/
|
1998-03-28 05:44:41 +03:00
|
|
|
|
|
|
|
#ifndef jsd_h___
|
|
|
|
#define jsd_h___
|
|
|
|
|
1998-11-05 11:57:24 +03:00
|
|
|
/*
|
|
|
|
* NOTE: This is a *private* header file and should only be included by
|
|
|
|
* the sources in js/jsd. Defining EXPORT_JSD_API in an outside module
|
|
|
|
* using jsd would be bad.
|
|
|
|
*/
|
|
|
|
#define EXPORT_JSD_API 1 /* if used, must be set before include of jsdebug.h */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* These can be controled by the makefile, but this allows a place to set
|
2010-05-13 16:19:50 +04:00
|
|
|
* the values always used in the mozilla client, but perhaps done differently
|
1998-11-05 11:57:24 +03:00
|
|
|
* in other embeddings.
|
|
|
|
*/
|
|
|
|
#ifdef MOZILLA_CLIENT
|
|
|
|
#define JSD_THREADSAFE 1
|
2001-08-14 11:59:59 +04:00
|
|
|
/* define JSD_HAS_DANGEROUS_THREAD 1 */
|
1998-11-05 11:57:24 +03:00
|
|
|
#define JSD_USE_NSPR_LOCKS 1
|
|
|
|
#endif /* MOZILLA_CLIENT */
|
|
|
|
|
2013-09-06 03:08:06 +04:00
|
|
|
#include "jsapi.h"
|
2013-08-18 02:50:18 +04:00
|
|
|
#include "jshash.h"
|
1998-11-05 11:57:24 +03:00
|
|
|
#include "jsclist.h"
|
1998-03-28 05:44:41 +03:00
|
|
|
#include "jsdebug.h"
|
2013-08-27 06:05:20 +04:00
|
|
|
#include "js/OldDebugAPI.h"
|
1998-11-05 11:57:24 +03:00
|
|
|
#include "jsd_lock.h"
|
2002-02-27 12:24:14 +03:00
|
|
|
|
1998-11-05 11:57:24 +03:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
1998-03-28 05:44:41 +03:00
|
|
|
|
|
|
|
#define JSD_MAJOR_VERSION 1
|
1998-11-05 11:57:24 +03:00
|
|
|
#define JSD_MINOR_VERSION 1
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
/* handy macros */
|
|
|
|
#undef CHECK_BIT_FLAG
|
|
|
|
#define CHECK_BIT_FLAG(f,b) ((f)&(b))
|
|
|
|
#undef SET_BIT_FLAG
|
|
|
|
#define SET_BIT_FLAG(f,b) ((f)|=(b))
|
|
|
|
#undef CLEAR_BIT_FLAG
|
|
|
|
#define CLEAR_BIT_FLAG(f,b) ((f)&=(~(b)))
|
|
|
|
|
2002-02-27 12:24:14 +03:00
|
|
|
#define JSD_IS_DEBUG_ENABLED(jsdc,jsdscript) \
|
|
|
|
(!(((jsdc->flags & JSD_DEBUG_WHEN_SET) ? 1 : 0) ^ \
|
|
|
|
((jsdscript->flags & JSD_SCRIPT_DEBUG_BIT) ? 1 : 0)))
|
|
|
|
#define JSD_IS_PROFILE_ENABLED(jsdc,jsdscript) \
|
|
|
|
((jsdc->flags & JSD_COLLECT_PROFILE_DATA) && \
|
|
|
|
(!(((jsdc->flags & JSD_PROFILE_WHEN_SET) ? 1 : 0) ^ \
|
|
|
|
((jsdscript->flags & JSD_SCRIPT_PROFILE_BIT) ? 1 : 0))))
|
|
|
|
|
1998-11-05 11:57:24 +03:00
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
/* These are not exposed in jsdebug.h - typedef here for consistency */
|
1998-03-28 05:44:41 +03:00
|
|
|
|
1998-11-05 11:57:24 +03:00
|
|
|
typedef struct JSDExecHook JSDExecHook;
|
|
|
|
typedef struct JSDAtom JSDAtom;
|
2002-02-27 12:24:14 +03:00
|
|
|
typedef struct JSDProfileData JSDProfileData;
|
1998-03-28 05:44:41 +03:00
|
|
|
/***************************************************************************/
|
|
|
|
/* Our structures */
|
|
|
|
|
1998-11-05 11:57:24 +03:00
|
|
|
/*
|
|
|
|
* XXX What I'm calling a JSDContext is really more of a JSDTaskState.
|
1998-03-28 05:44:41 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
struct JSDContext
|
|
|
|
{
|
1998-11-05 11:57:24 +03:00
|
|
|
JSCList links; /* we are part of a JSCList */
|
2013-08-09 02:53:04 +04:00
|
|
|
bool inited;
|
2001-04-20 07:43:07 +04:00
|
|
|
void* data;
|
Bug 708735 - Use <stdint.h> types in JSAPI and throughout SpiderMonkey. Continue to provide the {u,}int{8,16,32,64} and JS{Uint,Int}{8,16,32,64} integer types through a single header, however, for a simpler backout strategy -- and also to ease the transition for embedders. r=timeless on switching the jsd API to use the <stdint.h> types, r=luke, r=dmandelin
2011-12-09 07:54:10 +04:00
|
|
|
uint32_t flags;
|
1998-03-28 05:44:41 +03:00
|
|
|
JSD_ScriptHookProc scriptHook;
|
|
|
|
void* scriptHookData;
|
|
|
|
JSD_ExecutionHookProc interruptHook;
|
|
|
|
void* interruptHookData;
|
1998-11-05 11:57:24 +03:00
|
|
|
JSRuntime* jsrt;
|
1998-03-28 05:44:41 +03:00
|
|
|
JSD_ErrorReporter errorReporter;
|
|
|
|
void* errorReporterData;
|
1998-11-05 11:57:24 +03:00
|
|
|
JSCList threadsStates;
|
1998-03-28 05:44:41 +03:00
|
|
|
JSD_ExecutionHookProc debugBreakHook;
|
|
|
|
void* debugBreakHookData;
|
1998-11-05 11:57:24 +03:00
|
|
|
JSD_ExecutionHookProc debuggerHook;
|
|
|
|
void* debuggerHookData;
|
|
|
|
JSD_ExecutionHookProc throwHook;
|
|
|
|
void* throwHookData;
|
2001-09-01 22:03:53 +04:00
|
|
|
JSD_CallHookProc functionHook;
|
|
|
|
void* functionHookData;
|
|
|
|
JSD_CallHookProc toplevelHook;
|
|
|
|
void* toplevelHookData;
|
1998-03-28 05:44:41 +03:00
|
|
|
JSObject* glob;
|
1998-11-05 11:57:24 +03:00
|
|
|
JSD_UserCallbacks userCallbacks;
|
|
|
|
void* user;
|
|
|
|
JSCList scripts;
|
2002-02-27 12:24:14 +03:00
|
|
|
JSHashTable* scriptsTable;
|
1998-11-05 11:57:24 +03:00
|
|
|
JSCList sources;
|
|
|
|
JSCList removedSources;
|
2012-02-29 03:11:11 +04:00
|
|
|
unsigned sourceAlterCount;
|
1998-11-05 11:57:24 +03:00
|
|
|
JSHashTable* atoms;
|
|
|
|
JSCList objectsList;
|
|
|
|
JSHashTable* objectsTable;
|
2005-08-02 19:53:59 +04:00
|
|
|
JSDProfileData* callingFunctionPData;
|
Bug 708735 - Use <stdint.h> types in JSAPI and throughout SpiderMonkey. Continue to provide the {u,}int{8,16,32,64} and JS{Uint,Int}{8,16,32,64} integer types through a single header, however, for a simpler backout strategy -- and also to ease the transition for embedders. r=timeless on switching the jsd API to use the <stdint.h> types, r=luke, r=dmandelin
2011-12-09 07:54:10 +04:00
|
|
|
int64_t lastReturnTime;
|
1998-11-05 11:57:24 +03:00
|
|
|
#ifdef JSD_THREADSAFE
|
2012-09-04 20:02:03 +04:00
|
|
|
JSDStaticLock* scriptsLock;
|
|
|
|
JSDStaticLock* sourceTextLock;
|
|
|
|
JSDStaticLock* objectsLock;
|
|
|
|
JSDStaticLock* atomsLock;
|
|
|
|
JSDStaticLock* threadStatesLock;
|
1998-11-05 11:57:24 +03:00
|
|
|
#endif /* JSD_THREADSAFE */
|
|
|
|
#ifdef JSD_HAS_DANGEROUS_THREAD
|
|
|
|
void* dangerousThread;
|
|
|
|
#endif /* JSD_HAS_DANGEROUS_THREAD */
|
1998-03-28 05:44:41 +03:00
|
|
|
|
1998-11-05 11:57:24 +03:00
|
|
|
};
|
1998-03-28 05:44:41 +03:00
|
|
|
|
|
|
|
struct JSDScript
|
|
|
|
{
|
1998-11-05 11:57:24 +03:00
|
|
|
JSCList links; /* we are part of a JSCList */
|
1998-03-28 05:44:41 +03:00
|
|
|
JSDContext* jsdc; /* JSDContext for this jsdscript */
|
|
|
|
JSScript* script; /* script we are wrapping */
|
2012-02-29 03:11:11 +04:00
|
|
|
unsigned lineBase; /* we cache this */
|
|
|
|
unsigned lineExtent; /* we cache this */
|
1998-11-05 11:57:24 +03:00
|
|
|
JSCList hooks; /* JSCList of JSDExecHooks for this script */
|
1998-03-28 05:44:41 +03:00
|
|
|
char* url;
|
Bug 708735 - Use <stdint.h> types in JSAPI and throughout SpiderMonkey. Continue to provide the {u,}int{8,16,32,64} and JS{Uint,Int}{8,16,32,64} integer types through a single header, however, for a simpler backout strategy -- and also to ease the transition for embedders. r=timeless on switching the jsd API to use the <stdint.h> types, r=luke, r=dmandelin
2011-12-09 07:54:10 +04:00
|
|
|
uint32_t flags;
|
2001-04-20 07:43:07 +04:00
|
|
|
void* data;
|
2002-02-27 12:24:14 +03:00
|
|
|
|
|
|
|
JSDProfileData *profileData;
|
1998-03-28 05:44:41 +03:00
|
|
|
};
|
|
|
|
|
2002-02-27 12:24:14 +03:00
|
|
|
struct JSDProfileData
|
|
|
|
{
|
2005-08-02 19:53:59 +04:00
|
|
|
JSDProfileData* caller;
|
Bug 708735 - Use <stdint.h> types in JSAPI and throughout SpiderMonkey. Continue to provide the {u,}int{8,16,32,64} and JS{Uint,Int}{8,16,32,64} integer types through a single header, however, for a simpler backout strategy -- and also to ease the transition for embedders. r=timeless on switching the jsd API to use the <stdint.h> types, r=luke, r=dmandelin
2011-12-09 07:54:10 +04:00
|
|
|
int64_t lastCallStart;
|
|
|
|
int64_t runningTime;
|
2012-02-29 03:11:11 +04:00
|
|
|
unsigned callCount;
|
|
|
|
unsigned recurseDepth;
|
|
|
|
unsigned maxRecurseDepth;
|
2012-02-25 02:19:52 +04:00
|
|
|
double minExecutionTime;
|
|
|
|
double maxExecutionTime;
|
|
|
|
double totalExecutionTime;
|
|
|
|
double minOwnExecutionTime;
|
|
|
|
double maxOwnExecutionTime;
|
|
|
|
double totalOwnExecutionTime;
|
2002-02-27 12:24:14 +03:00
|
|
|
};
|
|
|
|
|
1998-03-28 05:44:41 +03:00
|
|
|
struct JSDSourceText
|
|
|
|
{
|
1998-11-05 11:57:24 +03:00
|
|
|
JSCList links; /* we are part of a JSCList */
|
1998-03-28 05:44:41 +03:00
|
|
|
char* url;
|
1998-11-05 11:57:24 +03:00
|
|
|
char* text;
|
2013-08-09 02:53:04 +04:00
|
|
|
unsigned textLength;
|
|
|
|
unsigned textSpace;
|
|
|
|
bool dirty;
|
1998-03-28 05:44:41 +03:00
|
|
|
JSDSourceStatus status;
|
2013-08-09 02:53:04 +04:00
|
|
|
unsigned alterCount;
|
|
|
|
bool doingEval;
|
1998-03-28 05:44:41 +03:00
|
|
|
};
|
|
|
|
|
1998-11-05 11:57:24 +03:00
|
|
|
struct JSDExecHook
|
1998-03-28 05:44:41 +03:00
|
|
|
{
|
1998-11-05 11:57:24 +03:00
|
|
|
JSCList links; /* we are part of a JSCList */
|
1998-03-28 05:44:41 +03:00
|
|
|
JSDScript* jsdscript;
|
2012-01-11 12:23:05 +04:00
|
|
|
uintptr_t pc;
|
1998-03-28 05:44:41 +03:00
|
|
|
JSD_ExecutionHookProc hook;
|
|
|
|
void* callerdata;
|
1998-11-05 11:57:24 +03:00
|
|
|
};
|
1998-03-28 05:44:41 +03:00
|
|
|
|
2003-04-19 00:12:11 +04:00
|
|
|
#define TS_HAS_DISABLED_FRAME 0x01
|
|
|
|
|
1998-03-28 05:44:41 +03:00
|
|
|
struct JSDThreadState
|
|
|
|
{
|
1998-11-05 11:57:24 +03:00
|
|
|
JSCList links; /* we are part of a JSCList */
|
1998-03-28 05:44:41 +03:00
|
|
|
JSContext* context;
|
1998-11-05 11:57:24 +03:00
|
|
|
void* thread;
|
|
|
|
JSCList stack;
|
2012-02-29 03:11:11 +04:00
|
|
|
unsigned stackDepth;
|
|
|
|
unsigned flags;
|
1998-03-28 05:44:41 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct JSDStackFrameInfo
|
|
|
|
{
|
1998-11-05 11:57:24 +03:00
|
|
|
JSCList links; /* we are part of a JSCList */
|
1998-03-28 05:44:41 +03:00
|
|
|
JSDThreadState* jsdthreadstate;
|
|
|
|
JSDScript* jsdscript;
|
2012-01-11 12:23:05 +04:00
|
|
|
uintptr_t pc;
|
2013-01-25 12:49:29 +04:00
|
|
|
bool isConstructing;
|
|
|
|
JSAbstractFramePtr frame;
|
1998-03-28 05:44:41 +03:00
|
|
|
};
|
|
|
|
|
1998-11-05 11:57:24 +03:00
|
|
|
#define GOT_PROTO ((short) (1 << 0))
|
|
|
|
#define GOT_PROPS ((short) (1 << 1))
|
|
|
|
#define GOT_PARENT ((short) (1 << 2))
|
|
|
|
#define GOT_CTOR ((short) (1 << 3))
|
|
|
|
|
|
|
|
struct JSDValue
|
|
|
|
{
|
|
|
|
jsval val;
|
2012-02-29 03:11:11 +04:00
|
|
|
int nref;
|
1998-11-05 11:57:24 +03:00
|
|
|
JSCList props;
|
|
|
|
JSString* string;
|
2010-11-24 19:56:43 +03:00
|
|
|
JSString* funName;
|
1998-11-05 11:57:24 +03:00
|
|
|
const char* className;
|
|
|
|
JSDValue* proto;
|
|
|
|
JSDValue* parent;
|
|
|
|
JSDValue* ctor;
|
2012-02-29 03:11:11 +04:00
|
|
|
unsigned flags;
|
1998-11-05 11:57:24 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct JSDProperty
|
|
|
|
{
|
|
|
|
JSCList links; /* we are part of a JSCList */
|
2012-02-29 03:11:11 +04:00
|
|
|
int nref;
|
1998-11-05 11:57:24 +03:00
|
|
|
JSDValue* val;
|
|
|
|
JSDValue* name;
|
|
|
|
JSDValue* alias;
|
2012-02-29 03:11:11 +04:00
|
|
|
unsigned flags;
|
1998-11-05 11:57:24 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct JSDAtom
|
|
|
|
{
|
2006-02-23 12:36:43 +03:00
|
|
|
char* str; /* must be first element in struct for compare */
|
2012-02-29 03:11:11 +04:00
|
|
|
int refcount;
|
1998-11-05 11:57:24 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct JSDObject
|
|
|
|
{
|
|
|
|
JSCList links; /* we are part of a JSCList */
|
|
|
|
JSObject* obj;
|
|
|
|
JSDAtom* newURL;
|
2012-02-29 03:11:11 +04:00
|
|
|
unsigned newLineno;
|
1998-11-05 11:57:24 +03:00
|
|
|
JSDAtom* ctorURL;
|
2012-02-29 03:11:11 +04:00
|
|
|
unsigned ctorLineno;
|
1998-11-05 11:57:24 +03:00
|
|
|
JSDAtom* ctorName;
|
|
|
|
};
|
|
|
|
|
1998-03-28 05:44:41 +03:00
|
|
|
/***************************************************************************/
|
|
|
|
/* Code validation support */
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
1998-11-05 11:57:24 +03:00
|
|
|
extern void JSD_ASSERT_VALID_CONTEXT(JSDContext* jsdc);
|
|
|
|
extern void JSD_ASSERT_VALID_SCRIPT(JSDScript* jsdscript);
|
|
|
|
extern void JSD_ASSERT_VALID_SOURCE_TEXT(JSDSourceText* jsdsrc);
|
|
|
|
extern void JSD_ASSERT_VALID_THREAD_STATE(JSDThreadState* jsdthreadstate);
|
|
|
|
extern void JSD_ASSERT_VALID_STACK_FRAME(JSDStackFrameInfo* jsdframe);
|
|
|
|
extern void JSD_ASSERT_VALID_EXEC_HOOK(JSDExecHook* jsdhook);
|
|
|
|
extern void JSD_ASSERT_VALID_VALUE(JSDValue* jsdval);
|
|
|
|
extern void JSD_ASSERT_VALID_PROPERTY(JSDProperty* jsdprop);
|
|
|
|
extern void JSD_ASSERT_VALID_OBJECT(JSDObject* jsdobj);
|
1998-03-28 05:44:41 +03:00
|
|
|
#else
|
1998-11-05 11:57:24 +03:00
|
|
|
#define JSD_ASSERT_VALID_CONTEXT(x) ((void)0)
|
|
|
|
#define JSD_ASSERT_VALID_SCRIPT(x) ((void)0)
|
|
|
|
#define JSD_ASSERT_VALID_SOURCE_TEXT(x) ((void)0)
|
|
|
|
#define JSD_ASSERT_VALID_THREAD_STATE(x)((void)0)
|
|
|
|
#define JSD_ASSERT_VALID_STACK_FRAME(x) ((void)0)
|
|
|
|
#define JSD_ASSERT_VALID_EXEC_HOOK(x) ((void)0)
|
|
|
|
#define JSD_ASSERT_VALID_VALUE(x) ((void)0)
|
|
|
|
#define JSD_ASSERT_VALID_PROPERTY(x) ((void)0)
|
|
|
|
#define JSD_ASSERT_VALID_OBJECT(x) ((void)0)
|
1998-03-28 05:44:41 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
/* higher level functions */
|
|
|
|
|
1998-11-05 11:57:24 +03:00
|
|
|
extern JSDContext*
|
|
|
|
jsd_DebuggerOnForUser(JSRuntime* jsrt,
|
|
|
|
JSD_UserCallbacks* callbacks,
|
2010-09-15 03:24:59 +04:00
|
|
|
void* user,
|
|
|
|
JSObject* scopeobj);
|
|
|
|
|
1998-03-28 05:44:41 +03:00
|
|
|
extern JSDContext*
|
|
|
|
jsd_DebuggerOn(void);
|
|
|
|
|
|
|
|
extern void
|
|
|
|
jsd_DebuggerOff(JSDContext* jsdc);
|
|
|
|
|
2009-12-13 00:35:04 +03:00
|
|
|
extern void
|
2013-08-09 02:53:04 +04:00
|
|
|
jsd_DebuggerPause(JSDContext* jsdc, bool forceAllHooksOff);
|
2009-12-13 00:35:04 +03:00
|
|
|
|
|
|
|
extern void
|
|
|
|
jsd_DebuggerUnpause(JSDContext* jsdc);
|
|
|
|
|
1998-03-28 05:44:41 +03:00
|
|
|
extern void
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_SetUserCallbacks(JSRuntime* jsrt, JSD_UserCallbacks* callbacks, void* user);
|
1998-03-28 05:44:41 +03:00
|
|
|
|
|
|
|
extern JSDContext*
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_JSDContextForJSContext(JSContext* context);
|
1998-03-28 05:44:41 +03:00
|
|
|
|
2001-04-20 07:43:07 +04:00
|
|
|
extern void*
|
|
|
|
jsd_SetContextPrivate(JSDContext* jsdc, void *data);
|
|
|
|
|
|
|
|
extern void*
|
|
|
|
jsd_GetContextPrivate(JSDContext* jsdc);
|
|
|
|
|
2002-02-27 12:24:14 +03:00
|
|
|
extern void
|
|
|
|
jsd_ClearAllProfileData(JSDContext* jsdc);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_SetErrorReporter(JSDContext* jsdc,
|
|
|
|
JSD_ErrorReporter reporter,
|
|
|
|
void* callerdata);
|
1998-03-28 05:44:41 +03:00
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_GetErrorReporter(JSDContext* jsdc,
|
|
|
|
JSD_ErrorReporter* reporter,
|
|
|
|
void** callerdata);
|
|
|
|
|
1998-03-28 05:44:41 +03:00
|
|
|
/***************************************************************************/
|
|
|
|
/* Script functions */
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
2002-02-27 12:24:14 +03:00
|
|
|
jsd_InitScriptManager(JSDContext *jsdc);
|
|
|
|
|
1998-03-28 05:44:41 +03:00
|
|
|
extern void
|
2002-02-27 12:24:14 +03:00
|
|
|
jsd_DestroyScriptManager(JSDContext* jsdc);
|
1998-03-28 05:44:41 +03:00
|
|
|
|
|
|
|
extern JSDScript*
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_FindJSDScript(JSDContext* jsdc,
|
|
|
|
JSScript *script);
|
1998-03-28 05:44:41 +03:00
|
|
|
|
2009-03-14 17:57:31 +03:00
|
|
|
extern JSDScript*
|
|
|
|
jsd_FindOrCreateJSDScript(JSDContext *jsdc,
|
|
|
|
JSContext *cx,
|
|
|
|
JSScript *script,
|
2013-01-25 12:49:29 +04:00
|
|
|
JSAbstractFramePtr frame);
|
2009-03-14 17:57:31 +03:00
|
|
|
|
2002-02-27 12:24:14 +03:00
|
|
|
extern JSDProfileData*
|
|
|
|
jsd_GetScriptProfileData(JSDContext* jsdc, JSDScript *script);
|
|
|
|
|
Bug 708735 - Use <stdint.h> types in JSAPI and throughout SpiderMonkey. Continue to provide the {u,}int{8,16,32,64} and JS{Uint,Int}{8,16,32,64} integer types through a single header, however, for a simpler backout strategy -- and also to ease the transition for embedders. r=timeless on switching the jsd API to use the <stdint.h> types, r=luke, r=dmandelin
2011-12-09 07:54:10 +04:00
|
|
|
extern uint32_t
|
2002-02-27 12:24:14 +03:00
|
|
|
jsd_GetScriptFlags(JSDContext *jsdc, JSDScript *script);
|
|
|
|
|
|
|
|
extern void
|
Bug 708735 - Use <stdint.h> types in JSAPI and throughout SpiderMonkey. Continue to provide the {u,}int{8,16,32,64} and JS{Uint,Int}{8,16,32,64} integer types through a single header, however, for a simpler backout strategy -- and also to ease the transition for embedders. r=timeless on switching the jsd API to use the <stdint.h> types, r=luke, r=dmandelin
2011-12-09 07:54:10 +04:00
|
|
|
jsd_SetScriptFlags(JSDContext *jsdc, JSDScript *script, uint32_t flags);
|
2002-02-27 12:24:14 +03:00
|
|
|
|
2012-02-29 03:11:11 +04:00
|
|
|
extern unsigned
|
2002-02-27 12:24:14 +03:00
|
|
|
jsd_GetScriptCallCount(JSDContext* jsdc, JSDScript *script);
|
|
|
|
|
2012-02-29 03:11:11 +04:00
|
|
|
extern unsigned
|
2002-02-27 12:24:14 +03:00
|
|
|
jsd_GetScriptMaxRecurseDepth(JSDContext* jsdc, JSDScript *script);
|
|
|
|
|
2012-02-25 02:19:52 +04:00
|
|
|
extern double
|
2002-02-27 12:24:14 +03:00
|
|
|
jsd_GetScriptMinExecutionTime(JSDContext* jsdc, JSDScript *script);
|
|
|
|
|
2012-02-25 02:19:52 +04:00
|
|
|
extern double
|
2002-02-27 12:24:14 +03:00
|
|
|
jsd_GetScriptMaxExecutionTime(JSDContext* jsdc, JSDScript *script);
|
|
|
|
|
2012-02-25 02:19:52 +04:00
|
|
|
extern double
|
2002-02-27 12:24:14 +03:00
|
|
|
jsd_GetScriptTotalExecutionTime(JSDContext* jsdc, JSDScript *script);
|
|
|
|
|
2012-02-25 02:19:52 +04:00
|
|
|
extern double
|
2005-08-02 19:53:59 +04:00
|
|
|
jsd_GetScriptMinOwnExecutionTime(JSDContext* jsdc, JSDScript *script);
|
|
|
|
|
2012-02-25 02:19:52 +04:00
|
|
|
extern double
|
2005-08-02 19:53:59 +04:00
|
|
|
jsd_GetScriptMaxOwnExecutionTime(JSDContext* jsdc, JSDScript *script);
|
|
|
|
|
2012-02-25 02:19:52 +04:00
|
|
|
extern double
|
2005-08-02 19:53:59 +04:00
|
|
|
jsd_GetScriptTotalOwnExecutionTime(JSDContext* jsdc, JSDScript *script);
|
|
|
|
|
2002-02-27 12:24:14 +03:00
|
|
|
extern void
|
|
|
|
jsd_ClearScriptProfileData(JSDContext* jsdc, JSDScript *script);
|
|
|
|
|
2002-01-12 03:56:35 +03:00
|
|
|
extern JSScript *
|
|
|
|
jsd_GetJSScript (JSDContext *jsdc, JSDScript *script);
|
|
|
|
|
|
|
|
extern JSFunction *
|
|
|
|
jsd_GetJSFunction (JSDContext *jsdc, JSDScript *script);
|
|
|
|
|
1998-03-28 05:44:41 +03:00
|
|
|
extern JSDScript*
|
|
|
|
jsd_IterateScripts(JSDContext* jsdc, JSDScript **iterp);
|
|
|
|
|
2001-04-20 07:43:07 +04:00
|
|
|
extern void *
|
|
|
|
jsd_SetScriptPrivate (JSDScript *jsdscript, void *data);
|
|
|
|
|
|
|
|
extern void *
|
|
|
|
jsd_GetScriptPrivate (JSDScript *jsdscript);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_IsActiveScript(JSDContext* jsdc, JSDScript *jsdscript);
|
|
|
|
|
1998-03-28 05:44:41 +03:00
|
|
|
extern const char*
|
|
|
|
jsd_GetScriptFilename(JSDContext* jsdc, JSDScript *jsdscript);
|
|
|
|
|
2010-11-24 19:56:43 +03:00
|
|
|
extern JSString*
|
2011-01-30 00:40:29 +03:00
|
|
|
jsd_GetScriptFunctionId(JSDContext* jsdc, JSDScript *jsdscript);
|
1998-03-28 05:44:41 +03:00
|
|
|
|
2012-02-29 03:11:11 +04:00
|
|
|
extern unsigned
|
1998-03-28 05:44:41 +03:00
|
|
|
jsd_GetScriptBaseLineNumber(JSDContext* jsdc, JSDScript *jsdscript);
|
|
|
|
|
2012-02-29 03:11:11 +04:00
|
|
|
extern unsigned
|
1998-03-28 05:44:41 +03:00
|
|
|
jsd_GetScriptLineExtent(JSDContext* jsdc, JSDScript *jsdscript);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-03-28 05:44:41 +03:00
|
|
|
jsd_SetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc hook, void* callerdata);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_GetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc* hook, void** callerdata);
|
1998-03-28 05:44:41 +03:00
|
|
|
|
2012-01-11 12:23:05 +04:00
|
|
|
extern uintptr_t
|
2012-02-29 03:11:11 +04:00
|
|
|
jsd_GetClosestPC(JSDContext* jsdc, JSDScript* jsdscript, unsigned line);
|
1998-03-28 05:44:41 +03:00
|
|
|
|
2012-02-29 03:11:11 +04:00
|
|
|
extern unsigned
|
2012-01-11 12:23:05 +04:00
|
|
|
jsd_GetClosestLine(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc);
|
1998-03-28 05:44:41 +03:00
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
2011-03-03 21:11:54 +03:00
|
|
|
jsd_GetLinePCs(JSDContext* jsdc, JSDScript* jsdscript,
|
2012-02-29 03:11:11 +04:00
|
|
|
unsigned startLine, unsigned maxLines,
|
|
|
|
unsigned* count, unsigned** lines, uintptr_t** pcs);
|
2011-03-03 21:11:54 +03:00
|
|
|
|
2008-09-07 02:21:43 +04:00
|
|
|
extern void
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_NewScriptHookProc(
|
1998-03-28 05:44:41 +03:00
|
|
|
JSContext *cx,
|
|
|
|
const char *filename, /* URL this script loads from */
|
2012-02-29 03:11:11 +04:00
|
|
|
unsigned lineno, /* line where this script starts */
|
1998-03-28 05:44:41 +03:00
|
|
|
JSScript *script,
|
1998-11-05 11:57:24 +03:00
|
|
|
JSFunction *fun,
|
|
|
|
void* callerdata);
|
|
|
|
|
2008-09-07 02:21:43 +04:00
|
|
|
extern void
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_DestroyScriptHookProc(
|
2012-04-27 22:49:57 +04:00
|
|
|
JSFreeOp *fop,
|
1998-03-28 05:44:41 +03:00
|
|
|
JSScript *script,
|
1998-11-05 11:57:24 +03:00
|
|
|
void* callerdata);
|
1998-03-28 05:44:41 +03:00
|
|
|
|
|
|
|
/* Script execution hook functions */
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_SetExecutionHook(JSDContext* jsdc,
|
1998-03-28 05:44:41 +03:00
|
|
|
JSDScript* jsdscript,
|
2012-01-11 12:23:05 +04:00
|
|
|
uintptr_t pc,
|
1998-03-28 05:44:41 +03:00
|
|
|
JSD_ExecutionHookProc hook,
|
|
|
|
void* callerdata);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_ClearExecutionHook(JSDContext* jsdc,
|
1998-03-28 05:44:41 +03:00
|
|
|
JSDScript* jsdscript,
|
2012-01-11 12:23:05 +04:00
|
|
|
uintptr_t pc);
|
1998-03-28 05:44:41 +03:00
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-03-28 05:44:41 +03:00
|
|
|
jsd_ClearAllExecutionHooksForScript(JSDContext* jsdc, JSDScript* jsdscript);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-03-28 05:44:41 +03:00
|
|
|
jsd_ClearAllExecutionHooks(JSDContext* jsdc);
|
|
|
|
|
|
|
|
extern void
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_ScriptCreated(JSDContext* jsdc,
|
|
|
|
JSContext *cx,
|
|
|
|
const char *filename, /* URL this script loads from */
|
2012-02-29 03:11:11 +04:00
|
|
|
unsigned lineno, /* line where this script starts */
|
1998-11-05 11:57:24 +03:00
|
|
|
JSScript *script,
|
|
|
|
JSFunction *fun);
|
1998-03-28 05:44:41 +03:00
|
|
|
|
|
|
|
extern void
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_ScriptDestroyed(JSDContext* jsdc,
|
2012-04-27 22:49:57 +04:00
|
|
|
JSFreeOp *fop,
|
1998-11-05 11:57:24 +03:00
|
|
|
JSScript *script);
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
/* Source Text functions */
|
1998-03-28 05:44:41 +03:00
|
|
|
|
|
|
|
extern JSDSourceText*
|
|
|
|
jsd_IterateSources(JSDContext* jsdc, JSDSourceText **iterp);
|
|
|
|
|
|
|
|
extern JSDSourceText*
|
|
|
|
jsd_FindSourceForURL(JSDContext* jsdc, const char* url);
|
|
|
|
|
|
|
|
extern const char*
|
|
|
|
jsd_GetSourceURL(JSDContext* jsdc, JSDSourceText* jsdsrc);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-03-28 05:44:41 +03:00
|
|
|
jsd_GetSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc,
|
2012-02-29 03:11:11 +04:00
|
|
|
const char** ppBuf, int* pLen);
|
1998-03-28 05:44:41 +03:00
|
|
|
|
|
|
|
extern void
|
|
|
|
jsd_ClearSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc);
|
|
|
|
|
|
|
|
extern JSDSourceStatus
|
|
|
|
jsd_GetSourceStatus(JSDContext* jsdc, JSDSourceText* jsdsrc);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-03-28 05:44:41 +03:00
|
|
|
jsd_IsSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc);
|
|
|
|
|
|
|
|
extern void
|
2013-08-09 02:53:04 +04:00
|
|
|
jsd_SetSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc, bool dirty);
|
1998-03-28 05:44:41 +03:00
|
|
|
|
2012-02-29 03:11:11 +04:00
|
|
|
extern unsigned
|
1998-03-28 05:44:41 +03:00
|
|
|
jsd_GetSourceAlterCount(JSDContext* jsdc, JSDSourceText* jsdsrc);
|
|
|
|
|
2012-02-29 03:11:11 +04:00
|
|
|
extern unsigned
|
1998-03-28 05:44:41 +03:00
|
|
|
jsd_IncrementSourceAlterCount(JSDContext* jsdc, JSDSourceText* jsdsrc);
|
|
|
|
|
|
|
|
extern JSDSourceText*
|
|
|
|
jsd_NewSourceText(JSDContext* jsdc, const char* url);
|
|
|
|
|
|
|
|
extern JSDSourceText*
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_AppendSourceText(JSDContext* jsdc,
|
1998-03-28 05:44:41 +03:00
|
|
|
JSDSourceText* jsdsrc,
|
|
|
|
const char* text, /* *not* zero terminated */
|
|
|
|
size_t length,
|
|
|
|
JSDSourceStatus status);
|
|
|
|
|
1998-11-05 11:57:24 +03:00
|
|
|
extern JSDSourceText*
|
|
|
|
jsd_AppendUCSourceText(JSDContext* jsdc,
|
|
|
|
JSDSourceText* jsdsrc,
|
|
|
|
const jschar* text, /* *not* zero terminated */
|
|
|
|
size_t length,
|
|
|
|
JSDSourceStatus status);
|
|
|
|
|
|
|
|
/* convienence function for adding complete source of url in one call */
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_AddFullSourceText(JSDContext* jsdc,
|
|
|
|
const char* text, /* *not* zero terminated */
|
|
|
|
size_t length,
|
|
|
|
const char* url);
|
|
|
|
|
1998-03-28 05:44:41 +03:00
|
|
|
extern void
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_DestroyAllSources(JSDContext* jsdc);
|
1998-03-28 05:44:41 +03:00
|
|
|
|
2011-03-29 00:49:16 +04:00
|
|
|
extern char*
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_BuildNormalizedURL(const char* url_string);
|
|
|
|
|
|
|
|
extern void
|
|
|
|
jsd_StartingEvalUsingFilename(JSDContext* jsdc, const char* url);
|
|
|
|
|
|
|
|
extern void
|
|
|
|
jsd_FinishedEvalUsingFilename(JSDContext* jsdc, const char* url);
|
|
|
|
|
1998-03-28 05:44:41 +03:00
|
|
|
/***************************************************************************/
|
|
|
|
/* Interrupt Hook functions */
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_SetInterruptHook(JSDContext* jsdc,
|
1998-03-28 05:44:41 +03:00
|
|
|
JSD_ExecutionHookProc hook,
|
|
|
|
void* callerdata);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_ClearInterruptHook(JSDContext* jsdc);
|
1998-03-28 05:44:41 +03:00
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
2011-02-01 02:01:08 +03:00
|
|
|
jsd_EnableSingleStepInterrupts(JSDContext* jsdc,
|
|
|
|
JSDScript* jsdscript,
|
2013-08-09 02:53:04 +04:00
|
|
|
bool enable);
|
2011-02-01 02:01:08 +03:00
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_SetDebugBreakHook(JSDContext* jsdc,
|
1998-03-28 05:44:41 +03:00
|
|
|
JSD_ExecutionHookProc hook,
|
|
|
|
void* callerdata);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_ClearDebugBreakHook(JSDContext* jsdc);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_SetDebuggerHook(JSDContext* jsdc,
|
|
|
|
JSD_ExecutionHookProc hook,
|
|
|
|
void* callerdata);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_ClearDebuggerHook(JSDContext* jsdc);
|
|
|
|
|
|
|
|
extern JSTrapStatus
|
2001-09-01 22:03:53 +04:00
|
|
|
jsd_CallExecutionHook(JSDContext* jsdc,
|
|
|
|
JSContext* cx,
|
2012-02-29 03:11:11 +04:00
|
|
|
unsigned type,
|
1998-11-05 11:57:24 +03:00
|
|
|
JSD_ExecutionHookProc hook,
|
2001-09-01 22:03:53 +04:00
|
|
|
void* hookData,
|
|
|
|
jsval* rval);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
2001-09-01 22:03:53 +04:00
|
|
|
jsd_CallCallHook (JSDContext* jsdc,
|
|
|
|
JSContext* cx,
|
2012-02-29 03:11:11 +04:00
|
|
|
unsigned type,
|
2001-09-01 22:03:53 +04:00
|
|
|
JSD_CallHookProc hook,
|
|
|
|
void* hookData);
|
1998-11-05 11:57:24 +03:00
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_SetThrowHook(JSDContext* jsdc,
|
|
|
|
JSD_ExecutionHookProc hook,
|
|
|
|
void* callerdata);
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_ClearThrowHook(JSDContext* jsdc);
|
|
|
|
|
2008-09-07 02:21:43 +04:00
|
|
|
extern JSTrapStatus
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_DebuggerHandler(JSContext *cx, JSScript *script, jsbytecode *pc,
|
|
|
|
jsval *rval, void *closure);
|
|
|
|
|
2008-09-07 02:21:43 +04:00
|
|
|
extern JSTrapStatus
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_ThrowHandler(JSContext *cx, JSScript *script, jsbytecode *pc,
|
|
|
|
jsval *rval, void *closure);
|
1998-03-28 05:44:41 +03:00
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
2001-09-01 22:03:53 +04:00
|
|
|
jsd_SetFunctionHook(JSDContext* jsdc,
|
|
|
|
JSD_CallHookProc hook,
|
|
|
|
void* callerdata);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
2001-09-01 22:03:53 +04:00
|
|
|
jsd_ClearFunctionHook(JSDContext* jsdc);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
2001-09-01 22:03:53 +04:00
|
|
|
jsd_SetTopLevelHook(JSDContext* jsdc,
|
|
|
|
JSD_CallHookProc hook,
|
|
|
|
void* callerdata);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
2001-09-01 22:03:53 +04:00
|
|
|
jsd_ClearTopLevelHook(JSDContext* jsdc);
|
|
|
|
|
1998-03-28 05:44:41 +03:00
|
|
|
/***************************************************************************/
|
|
|
|
/* Stack Frame functions */
|
|
|
|
|
2012-02-29 03:11:11 +04:00
|
|
|
extern unsigned
|
1998-03-28 05:44:41 +03:00
|
|
|
jsd_GetCountOfStackFrames(JSDContext* jsdc, JSDThreadState* jsdthreadstate);
|
|
|
|
|
|
|
|
extern JSDStackFrameInfo*
|
|
|
|
jsd_GetStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate);
|
|
|
|
|
2001-10-30 16:41:32 +03:00
|
|
|
extern JSContext*
|
|
|
|
jsd_GetJSContext(JSDContext* jsdc, JSDThreadState* jsdthreadstate);
|
|
|
|
|
1998-03-28 05:44:41 +03:00
|
|
|
extern JSDStackFrameInfo*
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_GetCallingStackFrame(JSDContext* jsdc,
|
1998-03-28 05:44:41 +03:00
|
|
|
JSDThreadState* jsdthreadstate,
|
|
|
|
JSDStackFrameInfo* jsdframe);
|
|
|
|
|
|
|
|
extern JSDScript*
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_GetScriptForStackFrame(JSDContext* jsdc,
|
1998-03-28 05:44:41 +03:00
|
|
|
JSDThreadState* jsdthreadstate,
|
|
|
|
JSDStackFrameInfo* jsdframe);
|
|
|
|
|
2012-01-11 12:23:05 +04:00
|
|
|
extern uintptr_t
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_GetPCForStackFrame(JSDContext* jsdc,
|
1998-03-28 05:44:41 +03:00
|
|
|
JSDThreadState* jsdthreadstate,
|
|
|
|
JSDStackFrameInfo* jsdframe);
|
|
|
|
|
1998-11-05 11:57:24 +03:00
|
|
|
extern JSDValue*
|
|
|
|
jsd_GetCallObjectForStackFrame(JSDContext* jsdc,
|
|
|
|
JSDThreadState* jsdthreadstate,
|
|
|
|
JSDStackFrameInfo* jsdframe);
|
|
|
|
|
|
|
|
extern JSDValue*
|
|
|
|
jsd_GetScopeChainForStackFrame(JSDContext* jsdc,
|
|
|
|
JSDThreadState* jsdthreadstate,
|
|
|
|
JSDStackFrameInfo* jsdframe);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
2002-02-14 10:57:30 +03:00
|
|
|
jsd_IsStackFrameDebugger(JSDContext* jsdc,
|
|
|
|
JSDThreadState* jsdthreadstate,
|
|
|
|
JSDStackFrameInfo* jsdframe);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
2002-02-14 10:57:30 +03:00
|
|
|
jsd_IsStackFrameConstructing(JSDContext* jsdc,
|
|
|
|
JSDThreadState* jsdthreadstate,
|
|
|
|
JSDStackFrameInfo* jsdframe);
|
|
|
|
|
1998-11-05 11:57:24 +03:00
|
|
|
extern JSDValue*
|
|
|
|
jsd_GetThisForStackFrame(JSDContext* jsdc,
|
|
|
|
JSDThreadState* jsdthreadstate,
|
|
|
|
JSDStackFrameInfo* jsdframe);
|
|
|
|
|
2010-11-24 19:56:43 +03:00
|
|
|
extern JSString*
|
2011-01-30 00:40:29 +03:00
|
|
|
jsd_GetIdForStackFrame(JSDContext* jsdc,
|
|
|
|
JSDThreadState* jsdthreadstate,
|
|
|
|
JSDStackFrameInfo* jsdframe);
|
2002-02-14 10:57:30 +03:00
|
|
|
|
1998-03-28 05:44:41 +03:00
|
|
|
extern JSDThreadState*
|
|
|
|
jsd_NewThreadState(JSDContext* jsdc, JSContext *cx);
|
|
|
|
|
|
|
|
extern void
|
|
|
|
jsd_DestroyThreadState(JSDContext* jsdc, JSDThreadState* jsdthreadstate);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
2001-04-20 07:43:07 +04:00
|
|
|
jsd_EvaluateUCScriptInStackFrame(JSDContext* jsdc,
|
|
|
|
JSDThreadState* jsdthreadstate,
|
|
|
|
JSDStackFrameInfo* jsdframe,
|
2012-02-29 03:11:11 +04:00
|
|
|
const jschar *bytes, unsigned length,
|
|
|
|
const char *filename, unsigned lineno,
|
2013-08-09 02:53:04 +04:00
|
|
|
bool eatExceptions, JS::MutableHandleValue rval);
|
2001-04-20 07:43:07 +04:00
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_EvaluateScriptInStackFrame(JSDContext* jsdc,
|
1998-03-28 05:44:41 +03:00
|
|
|
JSDThreadState* jsdthreadstate,
|
|
|
|
JSDStackFrameInfo* jsdframe,
|
2012-02-29 03:11:11 +04:00
|
|
|
const char *bytes, unsigned length,
|
|
|
|
const char *filename, unsigned lineno,
|
2013-08-09 02:53:04 +04:00
|
|
|
bool eatExceptions, JS::MutableHandleValue rval);
|
1998-03-28 05:44:41 +03:00
|
|
|
|
|
|
|
extern JSString*
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_ValToStringInStackFrame(JSDContext* jsdc,
|
1998-03-28 05:44:41 +03:00
|
|
|
JSDThreadState* jsdthreadstate,
|
|
|
|
JSDStackFrameInfo* jsdframe,
|
|
|
|
jsval val);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_IsValidThreadState(JSDContext* jsdc,
|
|
|
|
JSDThreadState* jsdthreadstate);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_IsValidFrameInThreadState(JSDContext* jsdc,
|
|
|
|
JSDThreadState* jsdthreadstate,
|
|
|
|
JSDStackFrameInfo* jsdframe);
|
|
|
|
|
|
|
|
extern JSDValue*
|
|
|
|
jsd_GetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_SetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate,
|
|
|
|
JSDValue* jsdval);
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
/* Locking support */
|
|
|
|
|
|
|
|
/* protos are in js_lock.h for:
|
|
|
|
* jsd_CreateLock
|
|
|
|
* jsd_Lock
|
|
|
|
* jsd_Unlock
|
|
|
|
* jsd_IsLocked
|
|
|
|
* jsd_CurrentThread
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef JSD_THREADSAFE
|
|
|
|
|
|
|
|
/* the system-wide lock */
|
2012-09-04 20:02:03 +04:00
|
|
|
extern JSDStaticLock* _jsd_global_lock;
|
1998-11-05 11:57:24 +03:00
|
|
|
#define JSD_LOCK() \
|
|
|
|
JS_BEGIN_MACRO \
|
|
|
|
if(!_jsd_global_lock) \
|
|
|
|
_jsd_global_lock = jsd_CreateLock(); \
|
|
|
|
JS_ASSERT(_jsd_global_lock); \
|
|
|
|
jsd_Lock(_jsd_global_lock); \
|
|
|
|
JS_END_MACRO
|
|
|
|
|
|
|
|
#define JSD_UNLOCK() \
|
|
|
|
JS_BEGIN_MACRO \
|
|
|
|
JS_ASSERT(_jsd_global_lock); \
|
|
|
|
jsd_Unlock(_jsd_global_lock); \
|
|
|
|
JS_END_MACRO
|
|
|
|
|
|
|
|
/* locks for the subsystems of a given context */
|
2013-09-19 23:26:36 +04:00
|
|
|
#define JSD_INIT_LOCKS(jsdc) \
|
|
|
|
( (nullptr != (jsdc->scriptsLock = jsd_CreateLock())) && \
|
|
|
|
(nullptr != (jsdc->sourceTextLock = jsd_CreateLock())) && \
|
|
|
|
(nullptr != (jsdc->atomsLock = jsd_CreateLock())) && \
|
|
|
|
(nullptr != (jsdc->objectsLock = jsd_CreateLock())) && \
|
|
|
|
(nullptr != (jsdc->threadStatesLock = jsd_CreateLock())) )
|
1998-11-05 11:57:24 +03:00
|
|
|
|
|
|
|
#define JSD_LOCK_SCRIPTS(jsdc) jsd_Lock(jsdc->scriptsLock)
|
|
|
|
#define JSD_UNLOCK_SCRIPTS(jsdc) jsd_Unlock(jsdc->scriptsLock)
|
|
|
|
|
|
|
|
#define JSD_LOCK_SOURCE_TEXT(jsdc) jsd_Lock(jsdc->sourceTextLock)
|
|
|
|
#define JSD_UNLOCK_SOURCE_TEXT(jsdc) jsd_Unlock(jsdc->sourceTextLock)
|
|
|
|
|
|
|
|
#define JSD_LOCK_ATOMS(jsdc) jsd_Lock(jsdc->atomsLock)
|
|
|
|
#define JSD_UNLOCK_ATOMS(jsdc) jsd_Unlock(jsdc->atomsLock)
|
|
|
|
|
|
|
|
#define JSD_LOCK_OBJECTS(jsdc) jsd_Lock(jsdc->objectsLock)
|
|
|
|
#define JSD_UNLOCK_OBJECTS(jsdc) jsd_Unlock(jsdc->objectsLock)
|
|
|
|
|
|
|
|
#define JSD_LOCK_THREADSTATES(jsdc) jsd_Lock(jsdc->threadStatesLock)
|
|
|
|
#define JSD_UNLOCK_THREADSTATES(jsdc) jsd_Unlock(jsdc->threadStatesLock)
|
|
|
|
|
|
|
|
#else /* !JSD_THREADSAFE */
|
|
|
|
|
|
|
|
#define JSD_LOCK() ((void)0)
|
|
|
|
#define JSD_UNLOCK() ((void)0)
|
|
|
|
|
|
|
|
#define JSD_INIT_LOCKS(jsdc) 1
|
|
|
|
|
|
|
|
#define JSD_LOCK_SCRIPTS(jsdc) ((void)0)
|
|
|
|
#define JSD_UNLOCK_SCRIPTS(jsdc) ((void)0)
|
|
|
|
|
|
|
|
#define JSD_LOCK_SOURCE_TEXT(jsdc) ((void)0)
|
|
|
|
#define JSD_UNLOCK_SOURCE_TEXT(jsdc) ((void)0)
|
|
|
|
|
|
|
|
#define JSD_LOCK_ATOMS(jsdc) ((void)0)
|
|
|
|
#define JSD_UNLOCK_ATOMS(jsdc) ((void)0)
|
|
|
|
|
|
|
|
#define JSD_LOCK_OBJECTS(jsdc) ((void)0)
|
|
|
|
#define JSD_UNLOCK_OBJECTS(jsdc) ((void)0)
|
|
|
|
|
|
|
|
#define JSD_LOCK_THREADSTATES(jsdc) ((void)0)
|
|
|
|
#define JSD_UNLOCK_THREADSTATES(jsdc) ((void)0)
|
|
|
|
|
|
|
|
#endif /* JSD_THREADSAFE */
|
|
|
|
|
|
|
|
/* NOTE: These are intended for ASSERTs. Thus we supply checks for both
|
|
|
|
* LOCKED and UNLOCKED (rather that just LOCKED and !LOCKED) so that in
|
|
|
|
* the DEBUG non-Threadsafe case we can have an ASSERT that always succeeds
|
|
|
|
* without having to special case things in the code.
|
|
|
|
*/
|
|
|
|
#if defined(JSD_THREADSAFE) && defined(DEBUG)
|
|
|
|
#define JSD_SCRIPTS_LOCKED(jsdc) (jsd_IsLocked(jsdc->scriptsLock))
|
|
|
|
#define JSD_SOURCE_TEXT_LOCKED(jsdc) (jsd_IsLocked(jsdc->sourceTextLock))
|
|
|
|
#define JSD_ATOMS_LOCKED(jsdc) (jsd_IsLocked(jsdc->atomsLock))
|
|
|
|
#define JSD_OBJECTS_LOCKED(jsdc) (jsd_IsLocked(jsdc->objectsLock))
|
|
|
|
#define JSD_THREADSTATES_LOCKED(jsdc) (jsd_IsLocked(jsdc->threadStatesLock))
|
|
|
|
#define JSD_SCRIPTS_UNLOCKED(jsdc) (!jsd_IsLocked(jsdc->scriptsLock))
|
|
|
|
#define JSD_SOURCE_TEXT_UNLOCKED(jsdc) (!jsd_IsLocked(jsdc->sourceTextLock))
|
|
|
|
#define JSD_ATOMS_UNLOCKED(jsdc) (!jsd_IsLocked(jsdc->atomsLock))
|
|
|
|
#define JSD_OBJECTS_UNLOCKED(jsdc) (!jsd_IsLocked(jsdc->objectsLock))
|
|
|
|
#define JSD_THREADSTATES_UNLOCKED(jsdc) (!jsd_IsLocked(jsdc->threadStatesLock))
|
|
|
|
#else
|
|
|
|
#define JSD_SCRIPTS_LOCKED(jsdc) 1
|
|
|
|
#define JSD_SOURCE_TEXT_LOCKED(jsdc) 1
|
|
|
|
#define JSD_ATOMS_LOCKED(jsdc) 1
|
|
|
|
#define JSD_OBJECTS_LOCKED(jsdc) 1
|
|
|
|
#define JSD_THREADSTATES_LOCKED(jsdc) 1
|
|
|
|
#define JSD_SCRIPTS_UNLOCKED(jsdc) 1
|
|
|
|
#define JSD_SOURCE_TEXT_UNLOCKED(jsdc) 1
|
|
|
|
#define JSD_ATOMS_UNLOCKED(jsdc) 1
|
|
|
|
#define JSD_OBJECTS_UNLOCKED(jsdc) 1
|
|
|
|
#define JSD_THREADSTATES_UNLOCKED(jsdc) 1
|
|
|
|
#endif /* defined(JSD_THREADSAFE) && defined(DEBUG) */
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
/* Threading support */
|
|
|
|
|
|
|
|
#ifdef JSD_THREADSAFE
|
|
|
|
|
|
|
|
#define JSD_CURRENT_THREAD() jsd_CurrentThread()
|
|
|
|
|
|
|
|
#else /* !JSD_THREADSAFE */
|
|
|
|
|
|
|
|
#define JSD_CURRENT_THREAD() ((void*)0)
|
|
|
|
|
|
|
|
#endif /* JSD_THREADSAFE */
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
/* Dangerous thread support */
|
|
|
|
|
|
|
|
#ifdef JSD_HAS_DANGEROUS_THREAD
|
|
|
|
|
|
|
|
#define JSD_IS_DANGEROUS_THREAD(jsdc) \
|
|
|
|
(JSD_CURRENT_THREAD() == jsdc->dangerousThread)
|
|
|
|
|
|
|
|
#else /* !JSD_HAS_DANGEROUS_THREAD */
|
|
|
|
|
|
|
|
#define JSD_IS_DANGEROUS_THREAD(jsdc) 0
|
|
|
|
|
|
|
|
#endif /* JSD_HAS_DANGEROUS_THREAD */
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
/* Value and Property Functions */
|
|
|
|
|
|
|
|
extern JSDValue*
|
|
|
|
jsd_NewValue(JSDContext* jsdc, jsval val);
|
|
|
|
|
1998-03-28 05:44:41 +03:00
|
|
|
extern void
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_DropValue(JSDContext* jsdc, JSDValue* jsdval);
|
|
|
|
|
|
|
|
extern jsval
|
|
|
|
jsd_GetValueWrappedJSVal(JSDContext* jsdc, JSDValue* jsdval);
|
1998-03-28 05:44:41 +03:00
|
|
|
|
|
|
|
extern void
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_RefreshValue(JSDContext* jsdc, JSDValue* jsdval);
|
|
|
|
|
|
|
|
/**************************************************/
|
1998-03-28 05:44:41 +03:00
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_IsValueObject(JSDContext* jsdc, JSDValue* jsdval);
|
1998-03-28 05:44:41 +03:00
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_IsValueNumber(JSDContext* jsdc, JSDValue* jsdval);
|
1998-03-28 05:44:41 +03:00
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_IsValueInt(JSDContext* jsdc, JSDValue* jsdval);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_IsValueDouble(JSDContext* jsdc, JSDValue* jsdval);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_IsValueString(JSDContext* jsdc, JSDValue* jsdval);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_IsValueBoolean(JSDContext* jsdc, JSDValue* jsdval);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_IsValueNull(JSDContext* jsdc, JSDValue* jsdval);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_IsValueVoid(JSDContext* jsdc, JSDValue* jsdval);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_IsValuePrimitive(JSDContext* jsdc, JSDValue* jsdval);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_IsValueFunction(JSDContext* jsdc, JSDValue* jsdval);
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_IsValueNative(JSDContext* jsdc, JSDValue* jsdval);
|
|
|
|
|
|
|
|
/**************************************************/
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_GetValueBoolean(JSDContext* jsdc, JSDValue* jsdval);
|
|
|
|
|
Bug 708735 - Use <stdint.h> types in JSAPI and throughout SpiderMonkey. Continue to provide the {u,}int{8,16,32,64} and JS{Uint,Int}{8,16,32,64} integer types through a single header, however, for a simpler backout strategy -- and also to ease the transition for embedders. r=timeless on switching the jsd API to use the <stdint.h> types, r=luke, r=dmandelin
2011-12-09 07:54:10 +04:00
|
|
|
extern int32_t
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_GetValueInt(JSDContext* jsdc, JSDValue* jsdval);
|
|
|
|
|
2012-02-25 02:19:52 +04:00
|
|
|
extern double
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_GetValueDouble(JSDContext* jsdc, JSDValue* jsdval);
|
|
|
|
|
|
|
|
extern JSString*
|
|
|
|
jsd_GetValueString(JSDContext* jsdc, JSDValue* jsdval);
|
|
|
|
|
2010-11-24 19:56:43 +03:00
|
|
|
extern JSString*
|
2011-01-30 00:40:29 +03:00
|
|
|
jsd_GetValueFunctionId(JSDContext* jsdc, JSDValue* jsdval);
|
1998-11-05 11:57:24 +03:00
|
|
|
|
2011-01-12 01:24:52 +03:00
|
|
|
extern JSFunction*
|
|
|
|
jsd_GetValueFunction(JSDContext* jsdc, JSDValue* jsdval);
|
|
|
|
|
1998-11-05 11:57:24 +03:00
|
|
|
/**************************************************/
|
|
|
|
|
2012-02-29 03:11:11 +04:00
|
|
|
extern unsigned
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_GetCountOfProperties(JSDContext* jsdc, JSDValue* jsdval);
|
|
|
|
|
|
|
|
extern JSDProperty*
|
|
|
|
jsd_IterateProperties(JSDContext* jsdc, JSDValue* jsdval, JSDProperty **iterp);
|
|
|
|
|
|
|
|
extern JSDProperty*
|
|
|
|
jsd_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* name);
|
|
|
|
|
|
|
|
extern JSDValue*
|
|
|
|
jsd_GetValuePrototype(JSDContext* jsdc, JSDValue* jsdval);
|
|
|
|
|
|
|
|
extern JSDValue*
|
|
|
|
jsd_GetValueParent(JSDContext* jsdc, JSDValue* jsdval);
|
|
|
|
|
|
|
|
extern JSDValue*
|
|
|
|
jsd_GetValueConstructor(JSDContext* jsdc, JSDValue* jsdval);
|
|
|
|
|
|
|
|
extern const char*
|
|
|
|
jsd_GetValueClassName(JSDContext* jsdc, JSDValue* jsdval);
|
|
|
|
|
2009-10-08 05:19:54 +04:00
|
|
|
extern JSDScript*
|
|
|
|
jsd_GetScriptForValue(JSDContext* jsdc, JSDValue* jsdval);
|
|
|
|
|
1998-11-05 11:57:24 +03:00
|
|
|
/**************************************************/
|
|
|
|
|
|
|
|
extern void
|
|
|
|
jsd_DropProperty(JSDContext* jsdc, JSDProperty* jsdprop);
|
|
|
|
|
|
|
|
extern JSDValue*
|
|
|
|
jsd_GetPropertyName(JSDContext* jsdc, JSDProperty* jsdprop);
|
|
|
|
|
|
|
|
extern JSDValue*
|
|
|
|
jsd_GetPropertyValue(JSDContext* jsdc, JSDProperty* jsdprop);
|
|
|
|
|
|
|
|
extern JSDValue*
|
|
|
|
jsd_GetPropertyAlias(JSDContext* jsdc, JSDProperty* jsdprop);
|
|
|
|
|
2012-02-29 03:11:11 +04:00
|
|
|
extern unsigned
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_GetPropertyFlags(JSDContext* jsdc, JSDProperty* jsdprop);
|
|
|
|
|
|
|
|
/**************************************************/
|
|
|
|
/* Stepping Functions */
|
|
|
|
|
2008-09-07 02:21:43 +04:00
|
|
|
extern void *
|
2013-01-25 12:49:29 +04:00
|
|
|
jsd_FunctionCallHook(JSContext *cx, JSAbstractFramePtr frame, bool isConstructing,
|
2013-08-09 02:53:04 +04:00
|
|
|
bool before, bool *ok, void *closure);
|
2001-09-01 22:03:53 +04:00
|
|
|
|
2008-09-07 02:21:43 +04:00
|
|
|
extern void *
|
2013-01-25 12:49:29 +04:00
|
|
|
jsd_TopLevelCallHook(JSContext *cx, JSAbstractFramePtr frame, bool isConstructing,
|
2013-08-09 02:53:04 +04:00
|
|
|
bool before, bool *ok, void *closure);
|
1998-11-05 11:57:24 +03:00
|
|
|
|
|
|
|
/**************************************************/
|
|
|
|
/* Object Functions */
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_InitObjectManager(JSDContext* jsdc);
|
|
|
|
|
|
|
|
extern void
|
|
|
|
jsd_DestroyObjectManager(JSDContext* jsdc);
|
|
|
|
|
2009-12-15 08:31:59 +03:00
|
|
|
extern void
|
|
|
|
jsd_DestroyObjects(JSDContext* jsdc);
|
|
|
|
|
1998-11-05 11:57:24 +03:00
|
|
|
extern void
|
|
|
|
jsd_Constructing(JSDContext* jsdc, JSContext *cx, JSObject *obj,
|
2013-01-25 12:49:29 +04:00
|
|
|
JSAbstractFramePtr frame);
|
1998-11-05 11:57:24 +03:00
|
|
|
|
|
|
|
extern JSDObject*
|
|
|
|
jsd_IterateObjects(JSDContext* jsdc, JSDObject** iterp);
|
|
|
|
|
|
|
|
extern JSObject*
|
|
|
|
jsd_GetWrappedObject(JSDContext* jsdc, JSDObject* jsdobj);
|
|
|
|
|
|
|
|
extern const char*
|
|
|
|
jsd_GetObjectNewURL(JSDContext* jsdc, JSDObject* jsdobj);
|
|
|
|
|
2012-02-29 03:11:11 +04:00
|
|
|
extern unsigned
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_GetObjectNewLineNumber(JSDContext* jsdc, JSDObject* jsdobj);
|
|
|
|
|
|
|
|
extern const char*
|
|
|
|
jsd_GetObjectConstructorURL(JSDContext* jsdc, JSDObject* jsdobj);
|
|
|
|
|
2012-02-29 03:11:11 +04:00
|
|
|
extern unsigned
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_GetObjectConstructorLineNumber(JSDContext* jsdc, JSDObject* jsdobj);
|
|
|
|
|
|
|
|
extern const char*
|
|
|
|
jsd_GetObjectConstructorName(JSDContext* jsdc, JSDObject* jsdobj);
|
|
|
|
|
|
|
|
extern JSDObject*
|
|
|
|
jsd_GetJSDObjectForJSObject(JSDContext* jsdc, JSObject* jsobj);
|
|
|
|
|
|
|
|
extern JSDObject*
|
|
|
|
jsd_GetObjectForValue(JSDContext* jsdc, JSDValue* jsdval);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* returns new refcounted JSDValue
|
|
|
|
*/
|
|
|
|
extern JSDValue*
|
|
|
|
jsd_GetValueForObject(JSDContext* jsdc, JSDObject* jsdobj);
|
|
|
|
|
|
|
|
/**************************************************/
|
|
|
|
/* Atom Functions */
|
|
|
|
|
2013-08-09 02:53:04 +04:00
|
|
|
extern bool
|
1998-11-05 11:57:24 +03:00
|
|
|
jsd_CreateAtomTable(JSDContext* jsdc);
|
|
|
|
|
|
|
|
extern void
|
|
|
|
jsd_DestroyAtomTable(JSDContext* jsdc);
|
|
|
|
|
|
|
|
extern JSDAtom*
|
|
|
|
jsd_AddAtom(JSDContext* jsdc, const char* str);
|
|
|
|
|
|
|
|
extern JSDAtom*
|
|
|
|
jsd_CloneAtom(JSDContext* jsdc, JSDAtom* atom);
|
|
|
|
|
|
|
|
extern void
|
|
|
|
jsd_DropAtom(JSDContext* jsdc, JSDAtom* atom);
|
|
|
|
|
|
|
|
#define JSD_ATOM_TO_STRING(a) ((const char*)((a)->str))
|
1998-03-28 05:44:41 +03:00
|
|
|
|
2013-06-13 01:17:54 +04:00
|
|
|
struct AutoSaveExceptionState {
|
|
|
|
AutoSaveExceptionState(JSContext *cx) : mCx(cx) {
|
|
|
|
mState = JS_SaveExceptionState(cx);
|
|
|
|
}
|
|
|
|
~AutoSaveExceptionState() {
|
|
|
|
JS_RestoreExceptionState(mCx, mState);
|
|
|
|
}
|
|
|
|
JSContext *mCx;
|
|
|
|
JSExceptionState *mState;
|
|
|
|
};
|
|
|
|
|
1998-03-28 05:44:41 +03:00
|
|
|
#endif /* jsd_h___ */
|