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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
use jsapi::*;
use std::os::raw::c_void;
pub enum Action { }
unsafe impl Sync for ProxyTraps { }
#[repr(C)]
#[derive(Copy, Clone)]
pub struct ProxyTraps {
pub enter: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
proxy: HandleObject, id: HandleId,
action: Action, bp: *mut bool) -> bool>,
pub getOwnPropertyDescriptor: ::std::option::Option<unsafe extern "C" fn
(cx:
*mut JSContext,
proxy:
HandleObject,
id: HandleId,
desc:
MutableHandle<PropertyDescriptor>)
-> bool>,
pub defineProperty: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
proxy: HandleObject,
id: HandleId,
desc:
Handle<PropertyDescriptor>,
result:
*mut ObjectOpResult)
-> bool>,
pub ownPropertyKeys: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
proxy: HandleObject,
props: *mut AutoIdVector)
-> bool>,
pub delete_: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
proxy: HandleObject, id: HandleId,
result: *mut ObjectOpResult)
-> bool>,
pub enumerate: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
proxy: HandleObject,
objp: MutableHandleObject)
-> bool>,
pub getPrototypeIfOrdinary: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
proxy: HandleObject,
isOrdinary: *mut bool,
protop: MutableHandleObject)
-> bool>,
pub preventExtensions: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
proxy: HandleObject,
result:
*mut ObjectOpResult)
-> bool>,
pub isExtensible: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
proxy: HandleObject,
succeeded: *mut bool) -> bool>,
pub has: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
proxy: HandleObject, id: HandleId,
bp: *mut bool) -> bool>,
pub get: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
proxy: HandleObject,
receiver: HandleValue, id: HandleId,
vp: MutableHandleValue) -> bool>,
pub set: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
proxy: HandleObject,
id: HandleId, v: HandleValue,
receiver: HandleValue,
result: *mut ObjectOpResult) -> bool>,
pub call: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
proxy: HandleObject,
args: *const CallArgs) -> bool>,
pub construct: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
proxy: HandleObject,
args: *const CallArgs) -> bool>,
pub getPropertyDescriptor: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
proxy: HandleObject,
id: HandleId,
desc:
MutableHandle<PropertyDescriptor>)
-> bool>,
pub hasOwn: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
proxy: HandleObject, id: HandleId,
bp: *mut bool) -> bool>,
pub getOwnEnumerablePropertyKeys: ::std::option::Option<unsafe extern "C" fn
(cx:
*mut JSContext,
proxy:
HandleObject,
props:
*mut AutoIdVector)
-> bool>,
pub nativeCall: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
test: IsAcceptableThis,
_impl: NativeImpl,
args: CallArgs) -> bool>,
pub hasInstance: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
proxy: HandleObject,
v: MutableHandleValue,
bp: *mut bool) -> bool>,
pub objectClassIs: ::std::option::Option<unsafe extern "C" fn
(obj: HandleObject,
classValue: ESClass,
cx: *mut JSContext) -> bool>,
pub className: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
proxy: HandleObject)
-> *const i8>,
pub fun_toString: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
proxy: HandleObject,
indent: u32)
-> *mut JSString>,
pub boxedValue_unbox: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
proxy: HandleObject,
vp: MutableHandleValue)
-> bool>,
pub defaultValue: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
obj: HandleObject,
hint: JSType,
vp: MutableHandleValue)
-> bool>,
pub trace: ::std::option::Option<unsafe extern "C" fn
(trc: *mut JSTracer,
proxy: *mut JSObject)>,
pub finalize: ::std::option::Option<unsafe extern "C" fn
(fop: *mut JSFreeOp,
proxy: *mut JSObject)>,
pub objectMoved: ::std::option::Option<unsafe extern "C" fn
(proxy: *mut JSObject,
old: *const JSObject)>,
pub isCallable: ::std::option::Option<unsafe extern "C" fn
(obj: *mut JSObject) -> bool>,
pub isConstructor: ::std::option::Option<unsafe extern "C" fn
(obj: *mut JSObject) -> bool>,
}
impl ::std::default::Default for ProxyTraps {
fn default() -> ProxyTraps { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct WrapperProxyHandler {
pub mTraps: ProxyTraps,
}
impl ::std::default::Default for WrapperProxyHandler {
fn default() -> WrapperProxyHandler { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct ForwardingProxyHandler {
pub mTraps: ProxyTraps,
pub mExtra: *const ::libc::c_void,
}
impl ::std::default::Default for ForwardingProxyHandler {
fn default() -> ForwardingProxyHandler { unsafe { ::std::mem::zeroed() } }
}
extern "C" {
pub fn InvokeGetOwnPropertyDescriptor(handler: *const ::libc::c_void,
cx: *mut JSContext,
proxy: HandleObject, id: HandleId,
desc:
MutableHandle<PropertyDescriptor>)
-> bool;
pub fn InvokeHasOwn(handler: *const ::libc::c_void,
cx: *mut JSContext, proxy: HandleObject,
id: HandleId, bp: *mut bool) -> bool;
pub fn RUST_JS_NumberValue(d: f64) -> Value;
pub fn RUST_FUNCTION_VALUE_TO_JITINFO(v: Value) -> *const JSJitInfo;
pub fn CreateCallArgsFromVp(argc: u32, v: *mut Value) -> CallArgs;
pub fn CallJitGetterOp(info: *const JSJitInfo, cx: *mut JSContext,
thisObj: HandleObject,
specializedThis: *mut ::libc::c_void, argc: u32,
vp: *mut Value) -> bool;
pub fn CallJitSetterOp(info: *const JSJitInfo, cx: *mut JSContext,
thisObj: HandleObject,
specializedThis: *mut ::libc::c_void, argc: u32,
vp: *mut Value) -> bool;
pub fn CallJitMethodOp(info: *const JSJitInfo, cx: *mut JSContext,
thisObj: HandleObject,
specializedThis: *mut ::libc::c_void, argc: u32,
vp: *mut Value) -> bool;
pub fn CreateProxyHandler(aTraps: *const ProxyTraps,
aExtra: *const ::libc::c_void)
-> *const ::libc::c_void;
pub fn CreateWrapperProxyHandler(aTraps: *const ProxyTraps)
-> *const ::libc::c_void;
pub fn CreateRustJSPrincipal(origin: *const ::libc::c_void,
destroy: Option<unsafe extern "C" fn
(principal: *mut JSPrincipals)>,
write: Option<unsafe extern "C" fn
(cx: *mut JSContext,
writer: *mut JSStructuredCloneWriter)
-> bool>)
-> *mut JSPrincipals;
pub fn GetPrincipalOrigin(principal: *const JSPrincipals)
-> *const ::libc::c_void;
pub fn GetCrossCompartmentWrapper() -> *const ::libc::c_void;
pub fn GetSecurityWrapper() -> *const ::libc::c_void;
pub fn NewCompileOptions(aCx: *mut JSContext, aFile: *const ::libc::c_char,
aLine: u32) -> *mut ReadOnlyCompileOptions;
pub fn DeleteCompileOptions(aOpts: *mut ReadOnlyCompileOptions);
pub fn NewProxyObject(aCx: *mut JSContext,
aHandler: *const ::libc::c_void, aPriv: HandleValue,
proto: *mut JSObject, parent: *mut JSObject,
call: *mut JSObject, construct: *mut JSObject)
-> *mut JSObject;
pub fn WrapperNew(aCx: *mut JSContext, aObj: HandleObject,
aHandler: *const ::libc::c_void, aClass: *const JSClass,
aSingleton: bool)
-> *mut JSObject;
pub fn NewWindowProxy(aCx: *mut JSContext, aObj: HandleObject,
aHandler: *const ::libc::c_void)
-> *mut JSObject;
pub fn GetWindowProxyClass() -> *const Class;
pub fn GetProxyExtra(obj: *mut JSObject, slot: u32) -> Value;
pub fn GetProxyPrivate(obj: *mut JSObject) -> Value;
pub fn SetProxyExtra(obj: *mut JSObject, slot: u32, val: *const Value);
pub fn RUST_JSID_IS_INT(id: HandleId) -> bool;
pub fn RUST_JSID_TO_INT(id: HandleId) -> i32;
pub fn int_to_jsid(i: i32) -> jsid;
pub fn RUST_JSID_IS_STRING(id: HandleId) -> bool;
pub fn RUST_JSID_TO_STRING(id: HandleId) -> *mut JSString;
pub fn RUST_SYMBOL_TO_JSID(sym: *mut Symbol) -> jsid;
pub fn RUST_SET_JITINFO(func: *mut JSFunction, info: *const JSJitInfo);
pub fn RUST_INTERNED_STRING_TO_JSID(cx: *mut JSContext,
str: *mut JSString) -> jsid;
pub fn RUST_js_GetErrorMessage(userRef: *mut ::libc::c_void,
errorNumber: u32)
-> *const JSErrorFormatString;
pub fn IsProxyHandlerFamily(obj: *mut JSObject) -> u8;
pub fn GetProxyHandlerExtra(obj: *mut JSObject) -> *const ::libc::c_void;
pub fn GetProxyHandler(obj: *mut JSObject) -> *const ::libc::c_void;
pub fn ReportError(aCx: *mut JSContext, aError: *const i8);
pub fn IsWrapper(obj: *mut JSObject) -> bool;
pub fn UnwrapObject(obj: *mut JSObject, stopAtOuter: u8) -> *mut JSObject;
pub fn UncheckedUnwrapObject(obj: *mut JSObject, stopAtOuter: u8) -> *mut JSObject;
pub fn CreateAutoIdVector(cx: *mut JSContext) -> *mut AutoIdVector;
pub fn AppendToAutoIdVector(v: *mut AutoIdVector, id: jsid) -> bool;
pub fn SliceAutoIdVector(v: *const AutoIdVector, length: *mut usize) -> *const jsid;
pub fn DestroyAutoIdVector(v: *mut AutoIdVector);
pub fn CreateAutoObjectVector(aCx: *mut JSContext)
-> *mut AutoObjectVector;
pub fn AppendToAutoObjectVector(v: *mut AutoObjectVector,
obj: *mut JSObject) -> bool;
pub fn DeleteAutoObjectVector(v: *mut AutoObjectVector);
pub fn CollectServoSizes(rt: *mut JSRuntime, sizes: *mut ServoSizes) -> bool;
pub fn CallIdTracer(trc: *mut JSTracer, idp: *mut Heap<jsid>,
name: *const ::libc::c_char);
pub fn CallValueTracer(trc: *mut JSTracer, valuep: *mut Heap<Value>,
name: *const ::libc::c_char);
pub fn CallObjectTracer(trc: *mut JSTracer,
objp: *mut Heap<*mut JSObject>,
name: *const ::libc::c_char);
pub fn CallStringTracer(trc: *mut JSTracer,
strp: *mut Heap<*mut JSString>,
name: *const ::libc::c_char);
pub fn CallScriptTracer(trc: *mut JSTracer,
scriptp: *mut Heap<*mut JSScript>,
name: *const ::libc::c_char);
pub fn CallFunctionTracer(trc: *mut JSTracer,
funp: *mut Heap<*mut JSFunction>,
name: *const ::libc::c_char);
pub fn CallUnbarrieredObjectTracer(trc: *mut JSTracer,
objp: *mut *mut JSObject,
name: *const ::libc::c_char);
pub fn GetProxyHandlerFamily() -> *const c_void;
pub fn GetInt8ArrayLengthAndData(obj: *mut JSObject,
length: *mut u32,
isSharedMemory: *mut bool,
data: *mut *mut i8);
pub fn GetUint8ArrayLengthAndData(obj: *mut JSObject,
length: *mut u32,
isSharedMemory: *mut bool,
data: *mut *mut u8);
pub fn GetUint8ClampedArrayLengthAndData(obj: *mut JSObject,
length: *mut u32,
isSharedMemory: *mut bool,
data: *mut *mut u8);
pub fn GetInt16ArrayLengthAndData(obj: *mut JSObject,
length: *mut u32,
isSharedMemory: *mut bool,
data: *mut *mut i16);
pub fn GetUint16ArrayLengthAndData(obj: *mut JSObject,
length: *mut u32,
isSharedMemory: *mut bool,
data: *mut *mut u16);
pub fn GetInt32ArrayLengthAndData(obj: *mut JSObject,
length: *mut u32,
isSharedMemory: *mut bool,
data: *mut *mut i32);
pub fn GetUint32ArrayLengthAndData(obj: *mut JSObject,
length: *mut u32,
isSharedMemory: *mut bool,
data: *mut *mut u32);
pub fn GetFloat32ArrayLengthAndData(obj: *mut JSObject,
length: *mut u32,
isSharedMemory: *mut bool,
data: *mut *mut f32);
pub fn GetFloat64ArrayLengthAndData(obj: *mut JSObject,
length: *mut u32,
isSharedMemory: *mut bool,
data: *mut *mut f64);
}