[JSCRIPT] Sync with Wine Staging 3.3. CORE-14434

This commit is contained in:
Amine Khaldi 2018-03-17 13:11:29 +01:00
parent 919215fd3b
commit 8dba275bd6
38 changed files with 859 additions and 453 deletions

View file

@ -33,7 +33,7 @@ list(APPEND SOURCE
regexp.c
string.c
vbarray.c
jscript.h)
precomp.h)
list(APPEND jscript_rc_deps
${CMAKE_CURRENT_SOURCE_DIR}/jscript.rgs
@ -54,5 +54,5 @@ add_dependencies(jscript jscript_idlheader stdole2)
set_module_type(jscript win32dll)
target_link_libraries(jscript uuid wine)
add_importlibs(jscript user32 ole32 oleaut32 advapi32 msvcrt kernel32 ntdll)
add_pch(jscript jscript.h SOURCE)
add_pch(jscript precomp.h SOURCE)
add_cd_file(TARGET jscript DESTINATION reactos/system32 FOR all)

View file

@ -16,9 +16,16 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "jscript.h"
#include "config.h"
#include "wine/port.h"
#include <mshtmhst.h>
#include "jscript.h"
#include "objsafe.h"
#include "mshtmhst.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
/* Defined as extern in urlmon.idl, but not exported by uuid.lib */
const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY =

View file

@ -16,8 +16,18 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <math.h>
#include <assert.h>
#include "jscript.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
typedef struct {
jsdisp_t dispex;
@ -37,6 +47,7 @@ static const WCHAR spliceW[] = {'s','p','l','i','c','e',0};
static const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0};
static const WCHAR toLocaleStringW[] = {'t','o','L','o','c','a','l','e','S','t','r','i','n','g',0};
static const WCHAR unshiftW[] = {'u','n','s','h','i','f','t',0};
static const WCHAR indexOfW[] = {'i','n','d','e','x','O','f',0};
static const WCHAR default_separatorW[] = {',',0};
@ -377,9 +388,10 @@ static HRESULT Array_pop(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned
hres = jsdisp_get_idx(jsthis, length, &val);
if(SUCCEEDED(hres))
hres = jsdisp_delete_idx(jsthis, length);
else if(hres == DISP_E_UNKNOWNNAME)
else if(hres == DISP_E_UNKNOWNNAME) {
val = jsval_undefined();
else
hres = S_OK;
}else
return hres;
if(SUCCEEDED(hres))
@ -938,6 +950,61 @@ static HRESULT Array_toLocaleString(script_ctx_t *ctx, vdisp_t *vthis, WORD flag
return E_NOTIMPL;
}
static HRESULT Array_indexOf(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
jsdisp_t *jsthis;
unsigned length, i, from = 0;
jsval_t search, value;
BOOL eq;
HRESULT hres;
TRACE("\n");
hres = get_length(ctx, vthis, &jsthis, &length);
if(FAILED(hres))
return hres;
if(!length) {
if(r) *r = jsval_number(-1);
return S_OK;
}
search = argc ? argv[0] : jsval_undefined();
if(argc > 1) {
double from_arg;
hres = to_integer(ctx, argv[1], &from_arg);
if(FAILED(hres))
return hres;
if(from_arg >= 0)
from = min(from_arg, length);
else
from = max(from_arg + length, 0);
}
for(i = from; i < length; i++) {
hres = jsdisp_get_idx(jsthis, i, &value);
if(hres == DISP_E_UNKNOWNNAME)
continue;
if(FAILED(hres))
return hres;
hres = jsval_strict_equal(value, search, &eq);
jsval_release(value);
if(FAILED(hres))
return hres;
if(eq) {
if(r) *r = jsval_number(i);
return S_OK;
}
}
if(r) *r = jsval_number(-1);
return S_OK;
}
/* ECMA-262 3rd Edition 15.4.4.13 */
static HRESULT Array_unshift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
@ -1036,6 +1103,7 @@ static void Array_on_put(jsdisp_t *dispex, const WCHAR *name)
static const builtin_prop_t Array_props[] = {
{concatW, Array_concat, PROPF_METHOD|1},
{indexOfW, Array_indexOf, PROPF_ES5|PROPF_METHOD|1},
{joinW, Array_join, PROPF_METHOD|1},
{lengthW, NULL,0, Array_get_length, Array_set_length},
{popW, Array_pop, PROPF_METHOD},
@ -1072,6 +1140,24 @@ static const builtin_info_t ArrayInst_info = {
Array_on_put
};
/* ECMA-262 5.1 Edition 15.4.3.2 */
static HRESULT ArrayConstr_isArray(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
{
jsdisp_t *obj;
TRACE("\n");
if(!argc || !is_object_instance(argv[0])) {
if(r) *r = jsval_bool(FALSE);
return S_OK;
}
obj = iface_to_jsdisp(get_object(argv[0]));
if(r) *r = jsval_bool(obj && is_class(obj, JSCLASS_ARRAY));
if(obj) jsdisp_release(obj);
return S_OK;
}
static HRESULT ArrayConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
@ -1146,6 +1232,21 @@ static HRESULT alloc_array(script_ctx_t *ctx, jsdisp_t *object_prototype, ArrayI
return S_OK;
}
static const WCHAR isArrayW[] = {'i','s','A','r','r','a','y',0};
static const builtin_prop_t ArrayConstr_props[] = {
{isArrayW, ArrayConstr_isArray, PROPF_ES5|PROPF_METHOD|1}
};
static const builtin_info_t ArrayConstr_info = {
JSCLASS_FUNCTION,
DEFAULT_FUNCTION_VALUE,
sizeof(ArrayConstr_props)/sizeof(*ArrayConstr_props),
ArrayConstr_props,
NULL,
NULL
};
HRESULT create_array_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdisp_t **ret)
{
ArrayInstance *array;
@ -1157,7 +1258,7 @@ HRESULT create_array_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdis
if(FAILED(hres))
return hres;
hres = create_builtin_constructor(ctx, ArrayConstr_value, ArrayW, NULL, PROPF_CONSTR|1, &array->dispex, ret);
hres = create_builtin_constructor(ctx, ArrayConstr_value, ArrayW, &ArrayConstr_info, PROPF_CONSTR|1, &array->dispex, ret);
jsdisp_release(&array->dispex);
return hres;

View file

@ -17,8 +17,14 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <assert.h>
#include "jscript.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
typedef struct {
jsdisp_t dispex;

View file

@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 3.0.2. */
/* A Bison parser, made by GNU Bison 3.0. */
/* Bison implementation for Yacc-like parsers in C
@ -44,7 +44,7 @@
#define YYBISON 1
/* Bison version. */
#define YYBISON_VERSION "3.0.2"
#define YYBISON_VERSION "3.0"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@ -70,15 +70,23 @@
/* Copy the first part of user declarations. */
#line 19 "cc_parser.y" /* yacc.c:339 */
#include "jscript.h"
#include "engine.h"
#include "parser.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
#line 84 "cc_parser.tab.c" /* yacc.c:339 */
# ifndef YY_NULLPTR
# ifndef YY_NULL
# if defined __cplusplus && 201103L <= __cplusplus
# define YY_NULLPTR nullptr
# define YY_NULL nullptr
# else
# define YY_NULLPTR 0
# define YY_NULL 0
# endif
# endif
@ -90,7 +98,10 @@
# define YYERROR_VERBOSE 0
#endif
/* In a future release of Bison, this section will be replaced
by #include "cc_parser.tab.h". */
#ifndef YY_CC_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_CC_PARSER_TAB_H_INCLUDED
# define YY_CC_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_CC_PARSER_TAB_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
@ -128,7 +139,7 @@ union YYSTYPE
ccval_t ccval;
#line 140 "cc_parser.tab.c" /* yacc.c:355 */
#line 143 "cc_parser.tab.c" /* yacc.c:355 */
};
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
@ -138,7 +149,7 @@ union YYSTYPE
int cc_parser_parse (parser_ctx_t *ctx);
#endif /* !YY_CC_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_CC_PARSER_TAB_H_INCLUDED */
/* Copy the second part of user declarations. */
#line 47 "cc_parser.y" /* yacc.c:358 */
@ -235,7 +246,7 @@ static int cc_parser_lex(void *lval, parser_ctx_t *ctx)
}
#line 247 "cc_parser.tab.c" /* yacc.c:358 */
#line 250 "cc_parser.tab.c" /* yacc.c:358 */
#ifdef short
# undef short
@ -292,30 +303,11 @@ typedef short int yytype_int16;
# endif
#endif
#ifndef YY_ATTRIBUTE
# if (defined __GNUC__ \
&& (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
|| defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
# else
# define YY_ATTRIBUTE(Spec) /* empty */
# endif
#endif
#ifndef YY_ATTRIBUTE_PURE
# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
#endif
#ifndef YY_ATTRIBUTE_UNUSED
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
#endif
#if !defined _Noreturn \
&& (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
# if defined _MSC_VER && 1200 <= _MSC_VER
# define _Noreturn __declspec (noreturn)
# else
# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */
# if (! defined __GNUC__ || __GNUC__ < 2 \
|| (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
# define __attribute__(Spec) /* empty */
# endif
#endif
@ -553,7 +545,7 @@ static const char *const yytname[] =
"CCBitwiseORExpression", "CCBitwiseXORExpression",
"CCBitwiseANDExpression", "CCEqualityExpression",
"CCRelationalExpression", "CCShiftExpression", "CCAdditiveExpression",
"CCMultiplicativeExpression", YY_NULLPTR
"CCMultiplicativeExpression", YY_NULL
};
#endif
@ -955,11 +947,11 @@ static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULLPTR;
const char *yyformat = YY_NULL;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
@ -1016,7 +1008,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
}
yyarg[yycount++] = yytname[yyx];
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
@ -1355,233 +1347,233 @@ yyreduce:
case 2:
#line 146 "cc_parser.y" /* yacc.c:1646 */
{ ctx->ccval = (yyvsp[0].ccval); YYACCEPT; }
#line 1367 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1351 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 3:
#line 149 "cc_parser.y" /* yacc.c:1646 */
{ (yyval.ccval) = (yyvsp[0].ccval); }
#line 1373 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1357 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 4:
#line 150 "cc_parser.y" /* yacc.c:1646 */
{ (yyval.ccval) = (yyvsp[-1].ccval); }
#line 1379 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1363 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 5:
#line 151 "cc_parser.y" /* yacc.c:1646 */
{ (yyval.ccval) = ccval_bool(!get_ccbool((yyvsp[0].ccval))); }
#line 1385 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1369 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 6:
#line 152 "cc_parser.y" /* yacc.c:1646 */
{ FIXME("'~' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
#line 1391 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1375 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 7:
#line 153 "cc_parser.y" /* yacc.c:1646 */
{ FIXME("'+' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
#line 1397 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1381 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 8:
#line 154 "cc_parser.y" /* yacc.c:1646 */
{ FIXME("'-' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
#line 1403 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1387 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 9:
#line 157 "cc_parser.y" /* yacc.c:1646 */
{ (yyval.ccval) = (yyvsp[0].ccval); }
#line 1409 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1393 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 10:
#line 159 "cc_parser.y" /* yacc.c:1646 */
{ FIXME("'||' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
#line 1415 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1399 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 11:
#line 162 "cc_parser.y" /* yacc.c:1646 */
{ (yyval.ccval) = (yyvsp[0].ccval); }
#line 1421 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1405 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 12:
#line 164 "cc_parser.y" /* yacc.c:1646 */
{ FIXME("'&&' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
#line 1427 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1411 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 13:
#line 167 "cc_parser.y" /* yacc.c:1646 */
{ (yyval.ccval) = (yyvsp[0].ccval); }
#line 1433 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1417 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 14:
#line 169 "cc_parser.y" /* yacc.c:1646 */
{ FIXME("'|' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
#line 1439 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1423 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 15:
#line 172 "cc_parser.y" /* yacc.c:1646 */
{ (yyval.ccval) = (yyvsp[0].ccval); }
#line 1445 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1429 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 16:
#line 174 "cc_parser.y" /* yacc.c:1646 */
{ FIXME("'^' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
#line 1451 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1435 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 17:
#line 177 "cc_parser.y" /* yacc.c:1646 */
{ (yyval.ccval) = (yyvsp[0].ccval); }
#line 1457 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1441 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 18:
#line 179 "cc_parser.y" /* yacc.c:1646 */
{ FIXME("'&' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
#line 1463 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1447 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 19:
#line 182 "cc_parser.y" /* yacc.c:1646 */
{ (yyval.ccval) = (yyvsp[0].ccval); }
#line 1469 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1453 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 20:
#line 184 "cc_parser.y" /* yacc.c:1646 */
{ (yyval.ccval) = ccval_bool(get_ccnum((yyvsp[-2].ccval)) == get_ccnum((yyvsp[0].ccval))); }
#line 1475 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1459 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 21:
#line 186 "cc_parser.y" /* yacc.c:1646 */
{ (yyval.ccval) = ccval_bool(get_ccnum((yyvsp[-2].ccval)) != get_ccnum((yyvsp[0].ccval))); }
#line 1481 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1465 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 22:
#line 188 "cc_parser.y" /* yacc.c:1646 */
{ FIXME("'===' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
#line 1487 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1471 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 23:
#line 190 "cc_parser.y" /* yacc.c:1646 */
{ FIXME("'!==' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
#line 1493 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1477 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 24:
#line 193 "cc_parser.y" /* yacc.c:1646 */
{ (yyval.ccval) = (yyvsp[0].ccval); }
#line 1499 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1483 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 25:
#line 195 "cc_parser.y" /* yacc.c:1646 */
{ (yyval.ccval) = ccval_bool(get_ccnum((yyvsp[-2].ccval)) < get_ccnum((yyvsp[0].ccval))); }
#line 1505 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1489 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 26:
#line 197 "cc_parser.y" /* yacc.c:1646 */
{ (yyval.ccval) = ccval_bool(get_ccnum((yyvsp[-2].ccval)) <= get_ccnum((yyvsp[0].ccval))); }
#line 1511 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1495 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 27:
#line 199 "cc_parser.y" /* yacc.c:1646 */
{ (yyval.ccval) = ccval_bool(get_ccnum((yyvsp[-2].ccval)) > get_ccnum((yyvsp[0].ccval))); }
#line 1517 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1501 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 28:
#line 201 "cc_parser.y" /* yacc.c:1646 */
{ (yyval.ccval) = ccval_bool(get_ccnum((yyvsp[-2].ccval)) >= get_ccnum((yyvsp[0].ccval))); }
#line 1523 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1507 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 29:
#line 204 "cc_parser.y" /* yacc.c:1646 */
{ (yyval.ccval) = (yyvsp[0].ccval); }
#line 1529 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1513 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 30:
#line 206 "cc_parser.y" /* yacc.c:1646 */
{ FIXME("'<<' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
#line 1535 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1519 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 31:
#line 208 "cc_parser.y" /* yacc.c:1646 */
{ FIXME("'>>' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
#line 1541 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1525 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 32:
#line 210 "cc_parser.y" /* yacc.c:1646 */
{ FIXME("'>>>' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
#line 1547 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1531 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 33:
#line 213 "cc_parser.y" /* yacc.c:1646 */
{ (yyval.ccval) = (yyvsp[0].ccval); }
#line 1553 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1537 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 34:
#line 215 "cc_parser.y" /* yacc.c:1646 */
{ (yyval.ccval) = ccval_num(get_ccnum((yyvsp[-2].ccval)) + get_ccnum((yyvsp[0].ccval))); }
#line 1559 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1543 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 35:
#line 217 "cc_parser.y" /* yacc.c:1646 */
{ (yyval.ccval) = ccval_num(get_ccnum((yyvsp[-2].ccval)) - get_ccnum((yyvsp[0].ccval))); }
#line 1565 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1549 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 36:
#line 220 "cc_parser.y" /* yacc.c:1646 */
{ (yyval.ccval) = (yyvsp[0].ccval); }
#line 1571 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1555 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 37:
#line 222 "cc_parser.y" /* yacc.c:1646 */
{ (yyval.ccval) = ccval_num(get_ccnum((yyvsp[-2].ccval)) * get_ccnum((yyvsp[0].ccval))); }
#line 1577 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1561 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 38:
#line 224 "cc_parser.y" /* yacc.c:1646 */
{ (yyval.ccval) = ccval_num(get_ccnum((yyvsp[-2].ccval)) / get_ccnum((yyvsp[0].ccval))); }
#line 1583 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1567 "cc_parser.tab.c" /* yacc.c:1646 */
break;
case 39:
#line 226 "cc_parser.y" /* yacc.c:1646 */
{ FIXME("'%%' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
#line 1589 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1573 "cc_parser.tab.c" /* yacc.c:1646 */
break;
#line 1593 "cc_parser.tab.c" /* yacc.c:1646 */
#line 1577 "cc_parser.tab.c" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires

View file

@ -0,0 +1,82 @@
/* A Bison parser, made by GNU Bison 3.0. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
#ifndef YY_CC_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_CC_PARSER_TAB_H_INCLUDED
# define YY_CC_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_CC_PARSER_TAB_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int cc_parser_debug;
#endif
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
tEQ = 258,
tEQEQ = 259,
tNEQ = 260,
tNEQEQ = 261,
tLSHIFT = 262,
tRSHIFT = 263,
tRRSHIFT = 264,
tOR = 265,
tAND = 266,
tLEQ = 267,
tGEQ = 268,
tCCValue = 269
};
#endif
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE YYSTYPE;
union YYSTYPE
{
#line 36 "cc_parser.y" /* yacc.c:1909 */
ccval_t ccval;
#line 73 "cc_parser.tab.h" /* yacc.c:1909 */
};
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif
int cc_parser_parse (parser_ctx_t *ctx);
#endif /* !YY_CC_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_CC_PARSER_TAB_H_INCLUDED */

View file

@ -19,6 +19,12 @@
%{
#include "jscript.h"
#include "engine.h"
#include "parser.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
%}

View file

@ -16,10 +16,17 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <math.h>
#include <assert.h>
#include "jscript.h"
#include "engine.h"
#include "parser.h"
#include <wine/rbtree.h>
#include "wine/rbtree.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
WINE_DECLARE_DEBUG_CHANNEL(jscript_disas);
typedef struct _statement_ctx_t {
@ -854,29 +861,29 @@ static HRESULT literal_as_bstr(compiler_ctx_t *ctx, literal_t *literal, BSTR *st
static HRESULT compile_array_literal(compiler_ctx_t *ctx, array_literal_expression_t *expr)
{
unsigned i, elem_cnt = expr->length;
unsigned length = 0;
array_element_t *iter;
unsigned array_instr;
HRESULT hres;
for(iter = expr->element_list; iter; iter = iter->next) {
elem_cnt += iter->elision+1;
array_instr = push_instr(ctx, OP_carray);
for(i=0; i < iter->elision; i++) {
if(!push_instr(ctx, OP_undefined))
return E_OUTOFMEMORY;
}
for(iter = expr->element_list; iter; iter = iter->next) {
length += iter->elision;
hres = compile_expression(ctx, iter->expr, TRUE);
if(FAILED(hres))
return hres;
hres = push_instr_uint(ctx, OP_carray_set, length);
if(FAILED(hres))
return hres;
length++;
}
for(i=0; i < expr->length; i++) {
if(!push_instr(ctx, OP_undefined))
return E_OUTOFMEMORY;
}
return push_instr_uint(ctx, OP_carray, elem_cnt);
instr_ptr(ctx, array_instr)->u.arg[0].uint = length + expr->length;
return S_OK;
}
static HRESULT compile_object_literal(compiler_ctx_t *ctx, property_value_expression_t *expr)

View file

@ -17,8 +17,19 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <limits.h>
#include <math.h>
#include <assert.h>
#include "jscript.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
/* 1601 to 1970 is 369 years plus 89 leap days */
#define TIME_EPOCH ((ULONGLONG)(369 * 365 + 89) * 86400 * 1000)
@ -81,6 +92,7 @@ static const WCHAR getYearW[] = {'g','e','t','Y','e','a','r',0};
static const WCHAR setYearW[] = {'s','e','t','Y','e','a','r',0};
static const WCHAR UTCW[] = {'U','T','C',0};
static const WCHAR nowW[] = {'n','o','w',0};
static const WCHAR parseW[] = {'p','a','r','s','e',0};
static inline DateInstance *date_from_jsdisp(jsdisp_t *jsdisp)
@ -441,6 +453,17 @@ static inline DOUBLE time_clip(DOUBLE time)
return floor(time);
}
static double date_now(void)
{
FILETIME ftime;
LONGLONG time;
GetSystemTimeAsFileTime(&ftime);
time = ((LONGLONG)ftime.dwHighDateTime << 32) + ftime.dwLowDateTime;
return time/10000 - TIME_EPOCH;
}
static SYSTEMTIME create_systemtime(DOUBLE time)
{
SYSTEMTIME st;
@ -2350,6 +2373,15 @@ static HRESULT DateConstr_UTC(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
return hres;
}
/* ECMA-262 5.1 Edition 15.9.4.4 */
static HRESULT DateConstr_now(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
{
TRACE("\n");
if(r) *r = jsval_number(date_now());
return S_OK;
}
static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
@ -2362,19 +2394,11 @@ static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
case DISPATCH_CONSTRUCT:
switch(argc) {
/* ECMA-262 3rd Edition 15.9.3.3 */
case 0: {
FILETIME time;
LONGLONG lltime;
GetSystemTimeAsFileTime(&time);
lltime = ((LONGLONG)time.dwHighDateTime<<32)
+ time.dwLowDateTime;
hres = create_date(ctx, NULL, lltime/10000-TIME_EPOCH, &date);
case 0:
hres = create_date(ctx, NULL, date_now(), &date);
if(FAILED(hres))
return hres;
break;
}
/* ECMA-262 3rd Edition 15.9.3.2 */
case 1: {
@ -2443,6 +2467,7 @@ static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
static const builtin_prop_t DateConstr_props[] = {
{UTCW, DateConstr_UTC, PROPF_METHOD},
{nowW, DateConstr_now, PROPF_HTML|PROPF_METHOD},
{parseW, DateConstr_parse, PROPF_METHOD}
};

View file

@ -18,6 +18,10 @@
#include "jscript.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
/*
* This file implements algorithm for decoding scripts encoded by
* screnc.exe. The 'secret' algorithm that's well documented here:

View file

@ -16,8 +16,15 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <assert.h>
#include "jscript.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
#define FDEX_VERSION_MASK 0xf0000000
#define GOLDEN_RATIO 0x9E3779B9U
@ -83,8 +90,19 @@ static const builtin_prop_t *find_builtin_prop(jsdisp_t *This, const WCHAR *name
i = (min+max)/2;
r = strcmpW(name, This->builtin_info->props[i].name);
if(!r)
if(!r) {
/* Skip prop if it's available only in higher compatibility mode. */
unsigned version = (This->builtin_info->props[i].flags & PROPF_VERSION_MASK)
>> PROPF_VERSION_SHIFT;
if(version && version > This->ctx->version)
return NULL;
/* Skip prop if it's available only in HTML mode and we're not running in HTML mode. */
if((This->builtin_info->props[i].flags & PROPF_HTML) && !This->ctx->html_mode)
return NULL;
return This->builtin_info->props + i;
}
if(r < 0)
max = i-1;

View file

@ -16,7 +16,18 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <math.h>
#include <assert.h>
#include "jscript.h"
#include "engine.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
static const WCHAR booleanW[] = {'b','o','o','l','e','a','n',0};
static const WCHAR functionW[] = {'f','u','n','c','t','i','o','n',0};
@ -514,7 +525,7 @@ static HRESULT disp_cmp(IDispatch *disp1, IDispatch *disp2, BOOL *ret)
}
/* ECMA-262 3rd Edition 11.9.6 */
static HRESULT equal2_values(jsval_t lval, jsval_t rval, BOOL *ret)
HRESULT jsval_strict_equal(jsval_t lval, jsval_t rval, BOOL *ret)
{
jsval_type_t type = jsval_type(lval);
@ -843,7 +854,7 @@ static HRESULT interp_case(script_ctx_t *ctx)
TRACE("\n");
v = stack_pop(ctx);
hres = equal2_values(stack_top(ctx), v, &b);
hres = jsval_strict_equal(stack_top(ctx), v, &b);
jsval_release(v);
if(FAILED(hres))
return hres;
@ -1290,7 +1301,7 @@ static HRESULT interp_local(script_ctx_t *ctx)
jsval_t copy;
HRESULT hres;
TRACE("%d\n", arg);
TRACE("%d: %s\n", arg, debugstr_w(local_name(frame, arg)));
if(!frame->base_scope || !frame->base_scope->frame)
return identifier_value(ctx, local_name(frame, arg));
@ -1393,8 +1404,6 @@ static HRESULT interp_carray(script_ctx_t *ctx)
{
const unsigned arg = get_op_uint(ctx, 0);
jsdisp_t *array;
jsval_t val;
unsigned i;
HRESULT hres;
TRACE("%u\n", arg);
@ -1403,20 +1412,27 @@ static HRESULT interp_carray(script_ctx_t *ctx)
if(FAILED(hres))
return hres;
i = arg;
while(i--) {
val = stack_pop(ctx);
hres = jsdisp_propput_idx(array, i, val);
jsval_release(val);
if(FAILED(hres)) {
jsdisp_release(array);
return hres;
}
}
return stack_push(ctx, jsval_obj(array));
}
static HRESULT interp_carray_set(script_ctx_t *ctx)
{
const unsigned index = get_op_uint(ctx, 0);
jsval_t value, array;
HRESULT hres;
value = stack_pop(ctx);
TRACE("[%u] = %s\n", index, debugstr_jsval(value));
array = stack_top(ctx);
assert(is_object_instance(array));
hres = jsdisp_propput_idx(iface_to_jsdisp(get_object(array)), index, value);
jsval_release(value);
return hres;
}
/* ECMA-262 3rd Edition 11.1.5 */
static HRESULT interp_new_obj(script_ctx_t *ctx)
{
@ -2092,7 +2108,7 @@ static HRESULT interp_preinc(script_ctx_t *ctx)
static HRESULT equal_values(script_ctx_t *ctx, jsval_t lval, jsval_t rval, BOOL *ret)
{
if(jsval_type(lval) == jsval_type(rval) || (is_number(lval) && is_number(rval)))
return equal2_values(lval, rval, ret);
return jsval_strict_equal(lval, rval, ret);
/* FIXME: NULL disps should be handled in more general way */
if(is_object_instance(lval) && !get_object(lval))
@ -2222,7 +2238,7 @@ static HRESULT interp_eq2(script_ctx_t *ctx)
TRACE("%s === %s\n", debugstr_jsval(l), debugstr_jsval(r));
hres = equal2_values(r, l, &b);
hres = jsval_strict_equal(r, l, &b);
jsval_release(l);
jsval_release(r);
if(FAILED(hres))
@ -2243,7 +2259,7 @@ static HRESULT interp_neq2(script_ctx_t *ctx)
r = stack_pop(ctx);
l = stack_pop(ctx);
hres = equal2_values(r, l, &b);
hres = jsval_strict_equal(r, l, &b);
jsval_release(l);
jsval_release(r);
if(FAILED(hres))

View file

@ -23,12 +23,13 @@
X(and, 1, 0,0) \
X(array, 1, 0,0) \
X(assign, 1, 0,0) \
X(assign_call,1, ARG_UINT, 0) \
X(assign_call,1, ARG_UINT, 0) \
X(bool, 1, ARG_INT, 0) \
X(bneg, 1, 0,0) \
X(call, 1, ARG_UINT, ARG_UINT) \
X(call_member,1, ARG_UINT, ARG_UINT) \
X(carray, 1, ARG_UINT, 0) \
X(carray_set, 1, ARG_UINT, 0) \
X(case, 0, ARG_ADDR, 0) \
X(cnd_nz, 0, ARG_ADDR, 0) \
X(cnd_z, 0, ARG_ADDR, 0) \

View file

@ -16,8 +16,17 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <math.h>
#include "jscript.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
static const WCHAR descriptionW[] = {'d','e','s','c','r','i','p','t','i','o','n',0};
static const WCHAR messageW[] = {'m','e','s','s','a','g','e',0};
static const WCHAR nameW[] = {'n','a','m','e',0};

View file

@ -16,7 +16,14 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <assert.h>
#include "jscript.h"
#include "engine.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
typedef struct {
jsdisp_t dispex;

View file

@ -16,8 +16,18 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "jscript.h"
#include "config.h"
#include "wine/port.h"
#include <math.h>
#include <limits.h>
#include "jscript.h"
#include "engine.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
static const WCHAR NaNW[] = {'N','a','N',0};
static const WCHAR InfinityW[] = {'I','n','f','i','n','i','t','y',0};

View file

@ -16,7 +16,15 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <assert.h>
#include "jscript.h"
#include "engine.h"
#include "objsafe.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
#ifdef _WIN64
@ -47,6 +55,7 @@ typedef struct {
LONG thread_id;
LCID lcid;
DWORD version;
BOOL html_mode;
BOOL is_encode;
IActiveScriptSite *site;
@ -704,6 +713,7 @@ static HRESULT WINAPI JScriptParse_InitNew(IActiveScriptParse *iface)
ctx->active_script = &This->IActiveScript_iface;
ctx->safeopt = This->safeopt;
ctx->version = This->version;
ctx->html_mode = This->html_mode;
ctx->ei.val = jsval_undefined();
heap_pool_init(&ctx->tmp_heap);
@ -912,12 +922,14 @@ static HRESULT WINAPI JScriptProperty_SetProperty(IActiveScriptProperty *iface,
switch(dwProperty) {
case SCRIPTPROP_INVOKEVERSIONING:
if(V_VT(pvarValue) != VT_I4 || V_I4(pvarValue) < 0 || V_I4(pvarValue) > 15) {
if(V_VT(pvarValue) != VT_I4 || V_I4(pvarValue) < 0
|| (V_I4(pvarValue) > 15 && !(V_I4(pvarValue) & SCRIPTLANGUAGEVERSION_HTML))) {
WARN("invalid value %s\n", debugstr_variant(pvarValue));
return E_INVALIDARG;
}
This->version = V_I4(pvarValue);
This->version = V_I4(pvarValue) & 0x1ff;
This->html_mode = (V_I4(pvarValue) & SCRIPTLANGUAGEVERSION_HTML) != 0;
break;
default:
FIXME("Unimplemented property %x\n", dwProperty);

View file

@ -16,37 +16,38 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef _WINE_JSCRIPT_H
#define _WINE_JSCRIPT_H
#pragma once
#include <wine/config.h>
#include <wine/port.h>
#include <assert.h>
#include <stdarg.h>
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
#include <stdio.h>
#define COBJMACROS
#include <windef.h>
#include <winbase.h>
#include <objbase.h>
#include <oleauto.h>
#include <dispex.h>
#include <activscp.h>
#include <objsafe.h>
#include <wine/debug.h>
#include <wine/list.h>
#include <wine/unicode.h>
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "ole2.h"
#include "dispex.h"
#include "activscp.h"
#include "resource.h"
#include "wine/unicode.h"
#include "wine/heap.h"
#include "wine/list.h"
/*
* This is Wine jscript extension for ES5 compatible mode. Native IE9+ implements
* a separated JavaScript enging in side MSHTML. We implement its features here
* and enable it when HTML flag is specified in SCRIPTPROP_INVOKEVERSIONING property.
*/
#define SCRIPTLANGUAGEVERSION_HTML 0x400
/*
* This is Wine jscript extension for ES5 compatible mode. Allowed only in HTML mode.
*/
#define SCRIPTLANGUAGEVERSION_ES5 0x102
typedef struct _jsval_t jsval_t;
typedef struct _jsstr_t jsstr_t;
typedef struct _script_ctx_t script_ctx_t;
@ -68,26 +69,6 @@ void heap_pool_clear(heap_pool_t*) DECLSPEC_HIDDEN;
void heap_pool_free(heap_pool_t*) DECLSPEC_HIDDEN;
heap_pool_t *heap_pool_mark(heap_pool_t*) DECLSPEC_HIDDEN;
static inline void* __WINE_ALLOC_SIZE(1) heap_alloc(size_t size)
{
return HeapAlloc(GetProcessHeap(), 0, size);
}
static inline void* __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t size)
{
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
}
static inline void* __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t size)
{
return HeapReAlloc(GetProcessHeap(), 0, mem, size);
}
static inline BOOL heap_free(void *mem)
{
return HeapFree(GetProcessHeap(), 0, mem);
}
static inline LPWSTR heap_strdupW(LPCWSTR str)
{
LPWSTR ret = NULL;
@ -115,6 +96,11 @@ extern HINSTANCE jscript_hinstance DECLSPEC_HIDDEN;
#define PROPF_CONST 0x0800
#define PROPF_DONTDELETE 0x1000
#define PROPF_VERSION_MASK 0x01ff0000
#define PROPF_VERSION_SHIFT 16
#define PROPF_HTML (SCRIPTLANGUAGEVERSION_HTML << PROPF_VERSION_SHIFT)
#define PROPF_ES5 ((SCRIPTLANGUAGEVERSION_HTML|SCRIPTLANGUAGEVERSION_ES5) << PROPF_VERSION_SHIFT)
/*
* This is our internal dispatch flag informing calee that it's called directly from interpreter.
* If calee is executed as interpreted function, we may let already running interpreter to take
@ -357,6 +343,8 @@ HRESULT to_string(script_ctx_t*,jsval_t,jsstr_t**) DECLSPEC_HIDDEN;
HRESULT to_flat_string(script_ctx_t*,jsval_t,jsstr_t**,const WCHAR**) DECLSPEC_HIDDEN;
HRESULT to_object(script_ctx_t*,jsval_t,IDispatch**) DECLSPEC_HIDDEN;
HRESULT jsval_strict_equal(jsval_t,jsval_t,BOOL*) DECLSPEC_HIDDEN;
HRESULT variant_change_type(script_ctx_t*,VARIANT*,VARIANT*,VARTYPE) DECLSPEC_HIDDEN;
HRESULT decode_source(WCHAR*) DECLSPEC_HIDDEN;
@ -412,6 +400,7 @@ struct _script_ctx_t {
IInternetHostSecurityManager *secmgr;
DWORD safeopt;
DWORD version;
BOOL html_mode;
LCID lcid;
cc_ctx_t *cc;
JSCaller *jscaller;
@ -516,7 +505,7 @@ static inline BOOL is_int32(double d)
static inline DWORD make_grfdex(script_ctx_t *ctx, DWORD flags)
{
return (ctx->version << 28) | flags;
return ((ctx->version & 0xff) << 28) | flags;
}
#define FACILITY_JSCRIPT 10
@ -585,9 +574,3 @@ static inline void unlock_module(void)
{
InterlockedDecrement(&module_ref);
}
#include "engine.h"
#include "parser.h"
#include "regexp.h"
#endif /* _WINE_JSCRIPT_H */

View file

@ -16,14 +16,26 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "initguid.h"
#include "jscript.h"
#include <rpcproxy.h>
#include <initguid.h>
#include <jscript_classes.h>
#include "winreg.h"
#include "advpub.h"
#include "activaut.h"
#include "objsafe.h"
#include "mshtmhst.h"
#include "rpcproxy.h"
#include "jscript_classes.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
LONG module_ref = 0;
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
HINSTANCE jscript_hinstance;
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)

View file

@ -16,7 +16,16 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <math.h>
#include <assert.h>
#include "jscript.h"
#include "parser.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
static const WCHAR parseW[] = {'p','a','r','s','e',0};
static const WCHAR stringifyW[] = {'s','t','r','i','n','g','i','f','y',0};
@ -536,15 +545,18 @@ static HRESULT stringify_array(stringify_ctx_t *ctx, jsdisp_t *obj)
}
hres = jsdisp_get_idx(obj, i, &val);
if(FAILED(hres))
if(SUCCEEDED(hres)) {
hres = stringify(ctx, val);
if(FAILED(hres))
return hres;
if(hres == S_FALSE && !append_string(ctx, nullW))
return E_OUTOFMEMORY;
}else if(hres == DISP_E_UNKNOWNNAME) {
if(!append_string(ctx, nullW))
return E_OUTOFMEMORY;
}else {
return hres;
hres = stringify(ctx, val);
if(FAILED(hres))
return hres;
if(hres == S_FALSE && !append_string(ctx, nullW))
return E_OUTOFMEMORY;
}
}
if((length && *ctx->gap && !append_char(ctx, '\n')) || !append_char(ctx, ']'))

View file

@ -16,7 +16,14 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <math.h>
#include "jscript.h"
#include "regexp.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
typedef struct {
jsdisp_t dispex;

View file

@ -16,8 +16,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <assert.h>
#include "jscript.h"
#include "wine/debug.h"
/*
* This is the length of a string that is considered to be long enough to be
* worth the rope to avoid copy.

View file

@ -16,8 +16,18 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "jscript.h"
#include "config.h"
#include "wine/port.h"
#include <math.h>
#include <assert.h>
#include "jscript.h"
#include "engine.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
WINE_DECLARE_DEBUG_CHANNEL(heap);
const char *debugstr_jsval(const jsval_t v)

View file

@ -246,4 +246,4 @@ HRESULT jsval_to_variant(jsval_t,VARIANT*) DECLSPEC_HIDDEN;
void jsval_release(jsval_t) DECLSPEC_HIDDEN;
HRESULT jsval_copy(jsval_t,jsval_t*) DECLSPEC_HIDDEN;
#endif /* JSVAL_H */
#endif

View file

@ -16,10 +16,24 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <limits.h>
#include "jscript.h"
#include "activscp.h"
#include "objsafe.h"
#include "engine.h"
#include "parser.h"
#include "parser.tab.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
static const WCHAR breakW[] = {'b','r','e','a','k',0};
static const WCHAR caseW[] = {'c','a','s','e',0};
static const WCHAR catchW[] = {'c','a','t','c','h',0};

View file

@ -17,9 +17,18 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "jscript.h"
#include "config.h"
#include "wine/port.h"
#include <ntsecapi.h>
#include <math.h>
#include <limits.h>
#include "jscript.h"
#include "ntsecapi.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
static const WCHAR EW[] = {'E',0};
static const WCHAR LOG2EW[] = {'L','O','G','2','E',0};

View file

@ -16,8 +16,15 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <math.h>
#include <assert.h>
#include "jscript.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
typedef struct {
jsdisp_t dispex;

View file

@ -16,8 +16,14 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <assert.h>
#include "jscript.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
static const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0};
static const WCHAR toLocaleStringW[] = {'t','o','L','o','c','a','l','e','S','t','r','i','n','g',0};
static const WCHAR valueOfW[] = {'v','a','l','u','e','O','f',0};

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 3.0.2. */
/* A Bison parser, made by GNU Bison 3.0. */
/* Bison interface for Yacc-like parsers in C
@ -30,8 +30,8 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
#ifndef YY_PARSER_PARSER_TAB_H_INCLUDED
# define YY_PARSER_PARSER_TAB_H_INCLUDED
#ifndef YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_PARSER_TAB_H_INCLUDED
# define YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_PARSER_TAB_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
@ -129,4 +129,4 @@ union YYSTYPE
int parser_parse (parser_ctx_t *ctx);
#endif /* !YY_PARSER_PARSER_TAB_H_INCLUDED */
#endif /* !YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_PARSER_TAB_H_INCLUDED */

View file

@ -19,6 +19,12 @@
%{
#include "jscript.h"
#include "engine.h"
#include "parser.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
static int parser_error(parser_ctx_t*,const char*);
static void set_error(parser_ctx_t*,UINT);

View file

@ -0,0 +1,24 @@
#ifndef _JSCRIPT_PRECOMP_H
#define _JSCRIPT_PRECOMP_H
#include <wine/config.h>
#include <wine/port.h>
#include <assert.h>
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
#include "jscript.h"
#include <objsafe.h>
#include <wine/debug.h>
#include "engine.h"
#include "parser.h"
#include "regexp.h"
#endif /* !_JSCRIPT_PRECOMP_H */

View file

@ -31,7 +31,14 @@
* the Initial Developer. All Rights Reserved.
*/
#include <assert.h>
#include "jscript.h"
#include "regexp.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
/* FIXME: Better error handling */
#define ReportRegExpError(a,b,c)

View file

@ -18,6 +18,8 @@
#pragma once
#include <windef.h>
#define JSCRIPT_MAJOR_VERSION 5
#define JSCRIPT_MINOR_VERSION 8
#define JSCRIPT_BUILD_VERSION 16475

View file

@ -16,8 +16,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <windef.h>
#include "resource.h"
/* @makedep: jscript.rgs */

View file

@ -16,7 +16,15 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include "jscript.h"
#include "regexp.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
typedef struct {
jsdisp_t dispex;

View file

@ -18,6 +18,10 @@
#include "jscript.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
typedef struct {
jsdisp_t dispex;

View file

@ -85,7 +85,7 @@ reactos/dll/win32/inseng # Synced to WineStaging-3.3
reactos/dll/win32/iphlpapi # Out of sync
reactos/dll/win32/itircl # Synced to WineStaging-3.3
reactos/dll/win32/itss # Synced to WineStaging-3.3
reactos/dll/win32/jscript # Synced to Wine-3.0
reactos/dll/win32/jscript # Synced to WineStaging-3.3
reactos/dll/win32/jsproxy # Synced to WineStaging-2.16
reactos/dll/win32/loadperf # Synced to WineStaging-2.9
reactos/dll/win32/lz32 # Synced to WineStaging-2.9