-
Notifications
You must be signed in to change notification settings - Fork 2
/
NOTES.spidermonkey
120 lines (69 loc) · 2.69 KB
/
NOTES.spidermonkey
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
This document briefly outlines correspondences in the
SEE API with Mozilla's Spidermonkey API.
References: http://www.mozilla.org/js/spidermonkey/
------------------------------------------------------------
Included headers:
#include <see/see.h> #include <jsapi.h>
Creating an environment:
SEE_interpreter_init() JS_NewRuntime()/JS_InitStandardClasses()
SEE_interpreter_init_compat() .../JS_SetVersion()
n/a (caller owns mutex) JS_NewContext()
Memory management:
"conservative gc" "exact gc"
n/a (implicit) JS_AddRoot()
JS_DestroyRuntime()
JS_ShutDown()
SEE_malloc() JS_malloc()
n/a (implicit) JS_free()
(*SEE_mem_exhausted_hook)() JS_ReportOutOfMemory()
ECMAscript data types:
SEE_boolean_t JSBool
SEE_number_t jsdouble
SEE_string_t jsstr
SEE_unicode_t jschar
struct SEE_object * JSObject *
struct SEE_value jsval
SEE_VALUE_GET_TYPE() JS_TypeOfValue()
n/a (use ==) JSVAL_IS_<type>()
SEE_ToInt32 JS_ConvertArguments('u')
String handling
string->data JS_GetStringBytes()
string->len JS_GetStringLength()
SEE_intern() JS_InternString()
SEE_string_new() JS_NewString()
SEE_string_cmp() JS_CompareStrings()
SEE_string_dup() JS_NewStringCopy()
SEE_ToString() JS_ValueToString()
Arrays
SEE_OBJECT_CONSTRUCT(interp->Array) JS_NewArrayObject()
Binding application classes to ECMAScript classes:
struct SEE_objectclass JSClass / JSObjectOps
SEE_native_init() JS_InitClass()
SEE_OBJECT_CONSTRUCT() JS_NewObject()
SEE_cfunction_make()/SEE_OBJECT_PUT() JS_FunctionSpec()/JS_DefineFunctions()
SEE_Object_new() JS_NewObject()
Invoking Javascript functions
SEE_OBJECT_CALL() JS_CallFunction()
Adding application data to objects:
struct SEE_object extension JS_SetPrivate() / JS_GetPrivate()
Modifying and inspecting ECMAScript objects:
SEE_OBJECT_PUT() JS_SetProperty()
SEE_OBJECT_GET() JS_GetProperty()
SEE_OBJECT_DELETE() JS_DeleteProperty()
SEE_OBJECT_ENUMERATE() JS_Enumerate()
Compiling and running ECMAScript source text:
SEE_Function_new() JS_CompileFunction()
SEE_input_utf8() / SEE_Global_eval() JS_CompileScript() / JS_ExecuteScript()
SEE_input_file() / SEE_Global_eval() JS_CompileFile() / JS_ExecuteScript()
ECMAScript exceptions:
SEE_TRY/SEE_CATCH/SEE_THROW n/a [JSErrorReport() is closest]
Debugging
trace() trap()
Unicode
SEE_input is always UCS-32 JS_*UC*() Unicode-enabled functions
Exceptions
SEE_THROW() if (!JS_..) return JS_FALSE;
Security
SEE_system.transit_sec_domain JS_CompileScriptForPrincipals()
JS_EvaluateScriptForPrincipals()
(host supplied) JS_CheckAccess()