2 * Copyright 2008-2009 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
33 #include "wine/unicode.h"
34 #include "wine/heap.h"
35 #include "wine/list.h"
38 * This is Wine jscript extension for ES5 compatible mode. Native IE9+ implements
39 * a separated JavaScript enging in side MSHTML. We implement its features here
40 * and enable it when HTML flag is specified in SCRIPTPROP_INVOKEVERSIONING property.
42 #define SCRIPTLANGUAGEVERSION_HTML 0x400
45 * This is Wine jscript extension for ES5 compatible mode. Allowed only in HTML mode.
47 #define SCRIPTLANGUAGEVERSION_ES5 0x102
49 typedef struct _jsval_t jsval_t
;
50 typedef struct _jsstr_t jsstr_t
;
51 typedef struct _script_ctx_t script_ctx_t
;
52 typedef struct _dispex_prop_t dispex_prop_t
;
60 struct list custom_blocks
;
63 void heap_pool_init(heap_pool_t
*) DECLSPEC_HIDDEN
;
64 void *heap_pool_alloc(heap_pool_t
*,DWORD
) __WINE_ALLOC_SIZE(2) DECLSPEC_HIDDEN
;
65 void *heap_pool_grow(heap_pool_t
*,void*,DWORD
,DWORD
) DECLSPEC_HIDDEN
;
66 void heap_pool_clear(heap_pool_t
*) DECLSPEC_HIDDEN
;
67 void heap_pool_free(heap_pool_t
*) DECLSPEC_HIDDEN
;
68 heap_pool_t
*heap_pool_mark(heap_pool_t
*) DECLSPEC_HIDDEN
;
70 static inline LPWSTR
heap_strdupW(LPCWSTR str
)
77 size
= (strlenW(str
)+1)*sizeof(WCHAR
);
78 ret
= heap_alloc(size
);
80 memcpy(ret
, str
, size
);
86 typedef struct jsdisp_t jsdisp_t
;
88 extern HINSTANCE jscript_hinstance DECLSPEC_HIDDEN
;
90 #define PROPF_ARGMASK 0x00ff
91 #define PROPF_METHOD 0x0100
92 #define PROPF_ENUM 0x0200
93 #define PROPF_CONSTR 0x0400
94 #define PROPF_CONST 0x0800
95 #define PROPF_DONTDELETE 0x1000
97 #define PROPF_VERSION_MASK 0x01ff0000
98 #define PROPF_VERSION_SHIFT 16
99 #define PROPF_HTML (SCRIPTLANGUAGEVERSION_HTML << PROPF_VERSION_SHIFT)
100 #define PROPF_ES5 ((SCRIPTLANGUAGEVERSION_HTML|SCRIPTLANGUAGEVERSION_ES5) << PROPF_VERSION_SHIFT)
103 * This is our internal dispatch flag informing calee that it's called directly from interpreter.
104 * If calee is executed as interpreted function, we may let already running interpreter to take
107 #define DISPATCH_JSCRIPT_CALLEREXECSSOURCE 0x8000
108 #define DISPATCH_JSCRIPT_INTERNAL_MASK DISPATCH_JSCRIPT_CALLEREXECSSOURCE
110 /* NOTE: Keep in sync with names in Object.toString implementation */
129 jsdisp_t
*iface_to_jsdisp(IDispatch
*) DECLSPEC_HIDDEN
;
140 #define VDISP_DISPEX 0x0001
141 #define VDISP_JSDISP 0x0002
143 static inline void vdisp_release(vdisp_t
*vdisp
)
145 IDispatch_Release(vdisp
->u
.disp
);
148 static inline BOOL
is_jsdisp(vdisp_t
*vdisp
)
150 return (vdisp
->flags
& VDISP_JSDISP
) != 0;
153 static inline BOOL
is_dispex(vdisp_t
*vdisp
)
155 return (vdisp
->flags
& VDISP_DISPEX
) != 0;
158 static inline void set_jsdisp(vdisp_t
*vdisp
, jsdisp_t
*jsdisp
)
160 vdisp
->u
.jsdisp
= jsdisp
;
161 vdisp
->flags
= VDISP_JSDISP
| VDISP_DISPEX
;
162 IDispatch_AddRef(vdisp
->u
.disp
);
165 static inline void set_disp(vdisp_t
*vdisp
, IDispatch
*disp
)
171 jsdisp
= iface_to_jsdisp(disp
);
173 vdisp
->u
.jsdisp
= jsdisp
;
174 vdisp
->flags
= VDISP_JSDISP
| VDISP_DISPEX
;
178 hres
= IDispatch_QueryInterface(disp
, &IID_IDispatchEx
, (void**)&dispex
);
179 if(SUCCEEDED(hres
)) {
180 vdisp
->u
.dispex
= dispex
;
181 vdisp
->flags
= VDISP_DISPEX
;
185 IDispatch_AddRef(disp
);
186 vdisp
->u
.disp
= disp
;
190 static inline jsdisp_t
*get_jsdisp(vdisp_t
*vdisp
)
192 return is_jsdisp(vdisp
) ? vdisp
->u
.jsdisp
: NULL
;
195 typedef HRESULT (*builtin_invoke_t
)(script_ctx_t
*,vdisp_t
*,WORD
,unsigned,jsval_t
*,jsval_t
*);
196 typedef HRESULT (*builtin_getter_t
)(script_ctx_t
*,jsdisp_t
*,jsval_t
*);
197 typedef HRESULT (*builtin_setter_t
)(script_ctx_t
*,jsdisp_t
*,jsval_t
);
199 HRESULT
builtin_set_const(script_ctx_t
*,jsdisp_t
*,jsval_t
) DECLSPEC_HIDDEN
;
203 builtin_invoke_t invoke
;
205 builtin_getter_t getter
;
206 builtin_setter_t setter
;
211 builtin_prop_t value_prop
;
213 const builtin_prop_t
*props
;
214 void (*destructor
)(jsdisp_t
*);
215 void (*on_put
)(jsdisp_t
*,const WCHAR
*);
216 unsigned (*idx_length
)(jsdisp_t
*);
217 HRESULT (*idx_get
)(jsdisp_t
*,unsigned,jsval_t
*);
218 HRESULT (*idx_put
)(jsdisp_t
*,unsigned,jsval_t
);
222 IDispatchEx IDispatchEx_iface
;
228 dispex_prop_t
*props
;
233 const builtin_info_t
*builtin_info
;
236 static inline IDispatch
*to_disp(jsdisp_t
*jsdisp
)
238 return (IDispatch
*)&jsdisp
->IDispatchEx_iface
;
241 jsdisp_t
*as_jsdisp(IDispatch
*) DECLSPEC_HIDDEN
;
242 jsdisp_t
*to_jsdisp(IDispatch
*) DECLSPEC_HIDDEN
;
243 void jsdisp_free(jsdisp_t
*) DECLSPEC_HIDDEN
;
248 * We do a lot of refcount calls during script execution, so having an inline
249 * version is a nice perf win. Define TRACE_REFCNT macro when debugging
250 * refcount bugs to have traces. Also, since jsdisp_t is not thread safe anyways,
251 * there is no point in using atomic operations.
253 static inline jsdisp_t
*jsdisp_addref(jsdisp_t
*jsdisp
)
259 static inline void jsdisp_release(jsdisp_t
*jsdisp
)
267 jsdisp_t
*jsdisp_addref(jsdisp_t
*) DECLSPEC_HIDDEN
;
268 void jsdisp_release(jsdisp_t
*) DECLSPEC_HIDDEN
;
272 HRESULT
create_dispex(script_ctx_t
*,const builtin_info_t
*,jsdisp_t
*,jsdisp_t
**) DECLSPEC_HIDDEN
;
273 HRESULT
init_dispex(jsdisp_t
*,script_ctx_t
*,const builtin_info_t
*,jsdisp_t
*) DECLSPEC_HIDDEN
;
274 HRESULT
init_dispex_from_constr(jsdisp_t
*,script_ctx_t
*,const builtin_info_t
*,jsdisp_t
*) DECLSPEC_HIDDEN
;
276 HRESULT
disp_call(script_ctx_t
*,IDispatch
*,DISPID
,WORD
,unsigned,jsval_t
*,jsval_t
*) DECLSPEC_HIDDEN
;
277 HRESULT
disp_call_value(script_ctx_t
*,IDispatch
*,IDispatch
*,WORD
,unsigned,jsval_t
*,jsval_t
*) DECLSPEC_HIDDEN
;
278 HRESULT
jsdisp_call_value(jsdisp_t
*,IDispatch
*,WORD
,unsigned,jsval_t
*,jsval_t
*) DECLSPEC_HIDDEN
;
279 HRESULT
jsdisp_call(jsdisp_t
*,DISPID
,WORD
,unsigned,jsval_t
*,jsval_t
*) DECLSPEC_HIDDEN
;
280 HRESULT
jsdisp_call_name(jsdisp_t
*,const WCHAR
*,WORD
,unsigned,jsval_t
*,jsval_t
*) DECLSPEC_HIDDEN
;
281 HRESULT
disp_propget(script_ctx_t
*,IDispatch
*,DISPID
,jsval_t
*) DECLSPEC_HIDDEN
;
282 HRESULT
disp_propput(script_ctx_t
*,IDispatch
*,DISPID
,jsval_t
) DECLSPEC_HIDDEN
;
283 HRESULT
jsdisp_propget(jsdisp_t
*,DISPID
,jsval_t
*) DECLSPEC_HIDDEN
;
284 HRESULT
jsdisp_propput(jsdisp_t
*,const WCHAR
*,DWORD
,jsval_t
) DECLSPEC_HIDDEN
;
285 HRESULT
jsdisp_propput_name(jsdisp_t
*,const WCHAR
*,jsval_t
) DECLSPEC_HIDDEN
;
286 HRESULT
jsdisp_propput_const(jsdisp_t
*,const WCHAR
*,jsval_t
) DECLSPEC_HIDDEN
;
287 HRESULT
jsdisp_propput_dontenum(jsdisp_t
*,const WCHAR
*,jsval_t
) DECLSPEC_HIDDEN
;
288 HRESULT
jsdisp_propput_idx(jsdisp_t
*,DWORD
,jsval_t
) DECLSPEC_HIDDEN
;
289 HRESULT
jsdisp_propget_name(jsdisp_t
*,LPCWSTR
,jsval_t
*) DECLSPEC_HIDDEN
;
290 HRESULT
jsdisp_get_idx(jsdisp_t
*,DWORD
,jsval_t
*) DECLSPEC_HIDDEN
;
291 HRESULT
jsdisp_get_id(jsdisp_t
*,const WCHAR
*,DWORD
,DISPID
*) DECLSPEC_HIDDEN
;
292 HRESULT
disp_delete(IDispatch
*,DISPID
,BOOL
*) DECLSPEC_HIDDEN
;
293 HRESULT
disp_delete_name(script_ctx_t
*,IDispatch
*,jsstr_t
*,BOOL
*) DECLSPEC_HIDDEN
;
294 HRESULT
jsdisp_delete_idx(jsdisp_t
*,DWORD
) DECLSPEC_HIDDEN
;
295 HRESULT
jsdisp_is_own_prop(jsdisp_t
*,const WCHAR
*,BOOL
*) DECLSPEC_HIDDEN
;
296 HRESULT
jsdisp_is_enumerable(jsdisp_t
*,const WCHAR
*,BOOL
*) DECLSPEC_HIDDEN
;
298 HRESULT
create_builtin_function(script_ctx_t
*,builtin_invoke_t
,const WCHAR
*,const builtin_info_t
*,DWORD
,
299 jsdisp_t
*,jsdisp_t
**) DECLSPEC_HIDDEN
;
300 HRESULT
create_builtin_constructor(script_ctx_t
*,builtin_invoke_t
,const WCHAR
*,const builtin_info_t
*,DWORD
,
301 jsdisp_t
*,jsdisp_t
**) DECLSPEC_HIDDEN
;
302 HRESULT
Function_invoke(jsdisp_t
*,IDispatch
*,WORD
,unsigned,jsval_t
*,jsval_t
*) DECLSPEC_HIDDEN
;
304 HRESULT
Function_value(script_ctx_t
*,vdisp_t
*,WORD
,unsigned,jsval_t
*,jsval_t
*) DECLSPEC_HIDDEN
;
305 HRESULT
Function_get_value(script_ctx_t
*,jsdisp_t
*,jsval_t
*) DECLSPEC_HIDDEN
;
306 #define DEFAULT_FUNCTION_VALUE {NULL, Function_value,0, Function_get_value}
308 HRESULT
throw_eval_error(script_ctx_t
*,HRESULT
,const WCHAR
*) DECLSPEC_HIDDEN
;
309 HRESULT
throw_generic_error(script_ctx_t
*,HRESULT
,const WCHAR
*) DECLSPEC_HIDDEN
;
310 HRESULT
throw_range_error(script_ctx_t
*,HRESULT
,const WCHAR
*) DECLSPEC_HIDDEN
;
311 HRESULT
throw_reference_error(script_ctx_t
*,HRESULT
,const WCHAR
*) DECLSPEC_HIDDEN
;
312 HRESULT
throw_regexp_error(script_ctx_t
*,HRESULT
,const WCHAR
*) DECLSPEC_HIDDEN
;
313 HRESULT
throw_syntax_error(script_ctx_t
*,HRESULT
,const WCHAR
*) DECLSPEC_HIDDEN
;
314 HRESULT
throw_type_error(script_ctx_t
*,HRESULT
,const WCHAR
*) DECLSPEC_HIDDEN
;
315 HRESULT
throw_uri_error(script_ctx_t
*,HRESULT
,const WCHAR
*) DECLSPEC_HIDDEN
;
317 HRESULT
create_object(script_ctx_t
*,jsdisp_t
*,jsdisp_t
**) DECLSPEC_HIDDEN
;
318 HRESULT
create_math(script_ctx_t
*,jsdisp_t
**) DECLSPEC_HIDDEN
;
319 HRESULT
create_array(script_ctx_t
*,DWORD
,jsdisp_t
**) DECLSPEC_HIDDEN
;
320 HRESULT
create_regexp(script_ctx_t
*,jsstr_t
*,DWORD
,jsdisp_t
**) DECLSPEC_HIDDEN
;
321 HRESULT
create_regexp_var(script_ctx_t
*,jsval_t
,jsval_t
*,jsdisp_t
**) DECLSPEC_HIDDEN
;
322 HRESULT
create_string(script_ctx_t
*,jsstr_t
*,jsdisp_t
**) DECLSPEC_HIDDEN
;
323 HRESULT
create_bool(script_ctx_t
*,BOOL
,jsdisp_t
**) DECLSPEC_HIDDEN
;
324 HRESULT
create_number(script_ctx_t
*,double,jsdisp_t
**) DECLSPEC_HIDDEN
;
325 HRESULT
create_vbarray(script_ctx_t
*,SAFEARRAY
*,jsdisp_t
**) DECLSPEC_HIDDEN
;
326 HRESULT
create_json(script_ctx_t
*,jsdisp_t
**) DECLSPEC_HIDDEN
;
334 HRESULT
to_primitive(script_ctx_t
*,jsval_t
,jsval_t
*, hint_t
) DECLSPEC_HIDDEN
;
335 HRESULT
to_boolean(jsval_t
,BOOL
*) DECLSPEC_HIDDEN
;
336 HRESULT
to_number(script_ctx_t
*,jsval_t
,double*) DECLSPEC_HIDDEN
;
337 HRESULT
to_integer(script_ctx_t
*,jsval_t
,double*) DECLSPEC_HIDDEN
;
338 HRESULT
to_int32(script_ctx_t
*,jsval_t
,INT
*) DECLSPEC_HIDDEN
;
339 HRESULT
to_uint32(script_ctx_t
*,jsval_t
,UINT32
*) DECLSPEC_HIDDEN
;
340 HRESULT
to_string(script_ctx_t
*,jsval_t
,jsstr_t
**) DECLSPEC_HIDDEN
;
341 HRESULT
to_flat_string(script_ctx_t
*,jsval_t
,jsstr_t
**,const WCHAR
**) DECLSPEC_HIDDEN
;
342 HRESULT
to_object(script_ctx_t
*,jsval_t
,IDispatch
**) DECLSPEC_HIDDEN
;
344 HRESULT
jsval_strict_equal(jsval_t
,jsval_t
,BOOL
*) DECLSPEC_HIDDEN
;
346 HRESULT
variant_change_type(script_ctx_t
*,VARIANT
*,VARIANT
*,VARTYPE
) DECLSPEC_HIDDEN
;
348 HRESULT
decode_source(WCHAR
*) DECLSPEC_HIDDEN
;
350 HRESULT
double_to_string(double,jsstr_t
**) DECLSPEC_HIDDEN
;
351 BOOL
is_finite(double) DECLSPEC_HIDDEN
;
353 typedef struct named_item_t
{
358 struct named_item_t
*next
;
361 typedef struct _cc_var_t cc_var_t
;
367 void release_cc(cc_ctx_t
*) DECLSPEC_HIDDEN
;
370 IServiceProvider IServiceProvider_iface
;
389 struct _script_ctx_t
{
393 IActiveScript
*active_script
;
395 struct _call_frame_t
*call_ctx
;
396 named_item_t
*named_items
;
397 IActiveScriptSite
*site
;
398 IInternetHostSecurityManager
*secmgr
;
407 heap_pool_t tmp_heap
;
409 IDispatch
*host_global
;
416 match_result_t match_parens
[9];
417 DWORD last_match_index
;
418 DWORD last_match_length
;
421 jsdisp_t
*function_constr
;
422 jsdisp_t
*array_constr
;
423 jsdisp_t
*bool_constr
;
424 jsdisp_t
*date_constr
;
425 jsdisp_t
*error_constr
;
426 jsdisp_t
*eval_error_constr
;
427 jsdisp_t
*range_error_constr
;
428 jsdisp_t
*reference_error_constr
;
429 jsdisp_t
*regexp_error_constr
;
430 jsdisp_t
*syntax_error_constr
;
431 jsdisp_t
*type_error_constr
;
432 jsdisp_t
*uri_error_constr
;
433 jsdisp_t
*number_constr
;
434 jsdisp_t
*object_constr
;
435 jsdisp_t
*regexp_constr
;
436 jsdisp_t
*string_constr
;
437 jsdisp_t
*vbarray_constr
;
440 void script_release(script_ctx_t
*) DECLSPEC_HIDDEN
;
441 void clear_ei(script_ctx_t
*) DECLSPEC_HIDDEN
;
443 static inline void script_addref(script_ctx_t
*ctx
)
448 HRESULT
init_global(script_ctx_t
*) DECLSPEC_HIDDEN
;
449 HRESULT
init_function_constr(script_ctx_t
*,jsdisp_t
*) DECLSPEC_HIDDEN
;
450 HRESULT
create_object_prototype(script_ctx_t
*,jsdisp_t
**) DECLSPEC_HIDDEN
;
452 HRESULT
create_activex_constr(script_ctx_t
*,jsdisp_t
**) DECLSPEC_HIDDEN
;
453 HRESULT
create_array_constr(script_ctx_t
*,jsdisp_t
*,jsdisp_t
**) DECLSPEC_HIDDEN
;
454 HRESULT
create_bool_constr(script_ctx_t
*,jsdisp_t
*,jsdisp_t
**) DECLSPEC_HIDDEN
;
455 HRESULT
create_date_constr(script_ctx_t
*,jsdisp_t
*,jsdisp_t
**) DECLSPEC_HIDDEN
;
456 HRESULT
init_error_constr(script_ctx_t
*,jsdisp_t
*) DECLSPEC_HIDDEN
;
457 HRESULT
create_number_constr(script_ctx_t
*,jsdisp_t
*,jsdisp_t
**) DECLSPEC_HIDDEN
;
458 HRESULT
create_object_constr(script_ctx_t
*,jsdisp_t
*,jsdisp_t
**) DECLSPEC_HIDDEN
;
459 HRESULT
create_regexp_constr(script_ctx_t
*,jsdisp_t
*,jsdisp_t
**) DECLSPEC_HIDDEN
;
460 HRESULT
create_string_constr(script_ctx_t
*,jsdisp_t
*,jsdisp_t
**) DECLSPEC_HIDDEN
;
461 HRESULT
create_vbarray_constr(script_ctx_t
*,jsdisp_t
*,jsdisp_t
**) DECLSPEC_HIDDEN
;
463 IUnknown
*create_ax_site(script_ctx_t
*) DECLSPEC_HIDDEN
;
464 HRESULT
create_jscaller(script_ctx_t
*) DECLSPEC_HIDDEN
;
466 #define REM_CHECK_GLOBAL 0x0001
467 #define REM_RESET_INDEX 0x0002
468 #define REM_NO_CTX_UPDATE 0x0004
469 #define REM_ALLOC_RESULT 0x0008
470 #define REM_NO_PARENS 0x0010
471 struct match_state_t
;
472 HRESULT
regexp_match_next(script_ctx_t
*,jsdisp_t
*,DWORD
,jsstr_t
*,struct match_state_t
**) DECLSPEC_HIDDEN
;
473 HRESULT
parse_regexp_flags(const WCHAR
*,DWORD
,DWORD
*) DECLSPEC_HIDDEN
;
474 HRESULT
regexp_string_match(script_ctx_t
*,jsdisp_t
*,jsstr_t
*,jsval_t
*) DECLSPEC_HIDDEN
;
476 BOOL
bool_obj_value(jsdisp_t
*) DECLSPEC_HIDDEN
;
477 unsigned array_get_length(jsdisp_t
*) DECLSPEC_HIDDEN
;
479 HRESULT
JSGlobal_eval(script_ctx_t
*,vdisp_t
*,WORD
,unsigned,jsval_t
*,jsval_t
*) DECLSPEC_HIDDEN
;
481 static inline BOOL
is_class(jsdisp_t
*jsdisp
, jsclass_t
class)
483 return jsdisp
->builtin_info
->class == class;
486 static inline BOOL
is_vclass(vdisp_t
*vdisp
, jsclass_t
class)
488 return is_jsdisp(vdisp
) && is_class(vdisp
->u
.jsdisp
, class);
492 #define INT32_MIN (-2147483647-1)
496 #define INT32_MAX (2147483647)
499 static inline BOOL
is_int32(double d
)
501 return INT32_MIN
<= d
&& d
<= INT32_MAX
&& (double)(int)d
== d
;
504 static inline DWORD
make_grfdex(script_ctx_t
*ctx
, DWORD flags
)
506 return ((ctx
->version
& 0xff) << 28) | flags
;
509 #define FACILITY_JSCRIPT 10
511 #define MAKE_JSERROR(code) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_JSCRIPT, code)
513 #define JS_E_TO_PRIMITIVE MAKE_JSERROR(IDS_TO_PRIMITIVE)
514 #define JS_E_INVALIDARG MAKE_JSERROR(IDS_INVALID_CALL_ARG)
515 #define JS_E_SUBSCRIPT_OUT_OF_RANGE MAKE_JSERROR(IDS_SUBSCRIPT_OUT_OF_RANGE)
516 #define JS_E_OBJECT_REQUIRED MAKE_JSERROR(IDS_OBJECT_REQUIRED)
517 #define JS_E_CANNOT_CREATE_OBJ MAKE_JSERROR(IDS_CREATE_OBJ_ERROR)
518 #define JS_E_INVALID_PROPERTY MAKE_JSERROR(IDS_NO_PROPERTY)
519 #define JS_E_INVALID_ACTION MAKE_JSERROR(IDS_UNSUPPORTED_ACTION)
520 #define JS_E_MISSING_ARG MAKE_JSERROR(IDS_ARG_NOT_OPT)
521 #define JS_E_SYNTAX MAKE_JSERROR(IDS_SYNTAX_ERROR)
522 #define JS_E_MISSING_SEMICOLON MAKE_JSERROR(IDS_SEMICOLON)
523 #define JS_E_MISSING_LBRACKET MAKE_JSERROR(IDS_LBRACKET)
524 #define JS_E_MISSING_RBRACKET MAKE_JSERROR(IDS_RBRACKET)
525 #define JS_E_EXPECTED_IDENTIFIER MAKE_JSERROR(IDS_EXPECTED_IDENTIFIER)
526 #define JS_E_EXPECTED_ASSIGN MAKE_JSERROR(IDS_EXPECTED_ASSIGN)
527 #define JS_E_INVALID_CHAR MAKE_JSERROR(IDS_INVALID_CHAR)
528 #define JS_E_UNTERMINATED_STRING MAKE_JSERROR(IDS_UNTERMINATED_STR)
529 #define JS_E_MISPLACED_RETURN MAKE_JSERROR(IDS_MISPLACED_RETURN)
530 #define JS_E_INVALID_BREAK MAKE_JSERROR(IDS_INVALID_BREAK)
531 #define JS_E_INVALID_CONTINUE MAKE_JSERROR(IDS_INVALID_CONTINUE)
532 #define JS_E_LABEL_REDEFINED MAKE_JSERROR(IDS_LABEL_REDEFINED)
533 #define JS_E_LABEL_NOT_FOUND MAKE_JSERROR(IDS_LABEL_NOT_FOUND)
534 #define JS_E_EXPECTED_CCEND MAKE_JSERROR(IDS_EXPECTED_CCEND)
535 #define JS_E_DISABLED_CC MAKE_JSERROR(IDS_DISABLED_CC)
536 #define JS_E_EXPECTED_AT MAKE_JSERROR(IDS_EXPECTED_AT)
537 #define JS_E_FUNCTION_EXPECTED MAKE_JSERROR(IDS_NOT_FUNC)
538 #define JS_E_DATE_EXPECTED MAKE_JSERROR(IDS_NOT_DATE)
539 #define JS_E_NUMBER_EXPECTED MAKE_JSERROR(IDS_NOT_NUM)
540 #define JS_E_OBJECT_EXPECTED MAKE_JSERROR(IDS_OBJECT_EXPECTED)
541 #define JS_E_ILLEGAL_ASSIGN MAKE_JSERROR(IDS_ILLEGAL_ASSIGN)
542 #define JS_E_UNDEFINED_VARIABLE MAKE_JSERROR(IDS_UNDEFINED)
543 #define JS_E_BOOLEAN_EXPECTED MAKE_JSERROR(IDS_NOT_BOOL)
544 #define JS_E_VBARRAY_EXPECTED MAKE_JSERROR(IDS_NOT_VBARRAY)
545 #define JS_E_INVALID_DELETE MAKE_JSERROR(IDS_INVALID_DELETE)
546 #define JS_E_JSCRIPT_EXPECTED MAKE_JSERROR(IDS_JSCRIPT_EXPECTED)
547 #define JS_E_REGEXP_SYNTAX MAKE_JSERROR(IDS_REGEXP_SYNTAX_ERROR)
548 #define JS_E_INVALID_URI_CODING MAKE_JSERROR(IDS_URI_INVALID_CODING)
549 #define JS_E_INVALID_URI_CHAR MAKE_JSERROR(IDS_URI_INVALID_CHAR)
550 #define JS_E_FRACTION_DIGITS_OUT_OF_RANGE MAKE_JSERROR(IDS_FRACTION_DIGITS_OUT_OF_RANGE)
551 #define JS_E_PRECISION_OUT_OF_RANGE MAKE_JSERROR(IDS_PRECISION_OUT_OF_RANGE)
552 #define JS_E_INVALID_LENGTH MAKE_JSERROR(IDS_INVALID_LENGTH)
553 #define JS_E_ARRAY_EXPECTED MAKE_JSERROR(IDS_ARRAY_EXPECTED)
555 static inline BOOL
is_jscript_error(HRESULT hres
)
557 return HRESULT_FACILITY(hres
) == FACILITY_JSCRIPT
;
560 const char *debugstr_jsval(const jsval_t
) DECLSPEC_HIDDEN
;
562 HRESULT
create_jscript_object(BOOL
,REFIID
,void**) DECLSPEC_HIDDEN
;
564 extern LONG module_ref DECLSPEC_HIDDEN
;
566 static inline void lock_module(void)
568 InterlockedIncrement(&module_ref
);
571 static inline void unlock_module(void)
573 InterlockedDecrement(&module_ref
);