jscript: Throw SyntaxError in eval function.
This commit is contained in:
parent
d1fbdbce32
commit
98223b96e7
|
@ -424,7 +424,8 @@ static HRESULT throw_error(script_ctx_t *ctx, jsexcept_t *ei, UINT id, const WCH
|
|||
DispatchEx *err;
|
||||
HRESULT hres;
|
||||
|
||||
LoadStringW(jscript_hinstance, id, buf, sizeof(buf)/sizeof(WCHAR));
|
||||
buf[0] = '\0';
|
||||
LoadStringW(jscript_hinstance, id&0xFFFF, buf, sizeof(buf)/sizeof(WCHAR));
|
||||
|
||||
if(str) pos = strchrW(buf, '|');
|
||||
if(pos) {
|
||||
|
@ -435,7 +436,7 @@ static HRESULT throw_error(script_ctx_t *ctx, jsexcept_t *ei, UINT id, const WCH
|
|||
|
||||
WARN("%s\n", debugstr_w(buf));
|
||||
|
||||
id |= 0x800A0000;
|
||||
id |= JSCRIPT_ERROR;
|
||||
hres = create_error(ctx, constr, &id, buf, &err);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
|
|
@ -330,7 +330,7 @@ static HRESULT JSGlobal_eval(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARA
|
|||
hres = script_parse(dispex->ctx, V_BSTR(arg), NULL, &parser_ctx);
|
||||
if(FAILED(hres)) {
|
||||
WARN("parse (%s) failed: %08x\n", debugstr_w(V_BSTR(arg)), hres);
|
||||
return hres;
|
||||
return throw_syntax_error(dispex->ctx, ei, hres, NULL);
|
||||
}
|
||||
|
||||
hres = exec_source(dispex->ctx->exec_ctx, parser_ctx, parser_ctx->source, ei, retv);
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include "wine/unicode.h"
|
||||
#include "wine/list.h"
|
||||
|
||||
#define JSCRIPT_ERROR 0x800A0000
|
||||
|
||||
typedef struct _script_ctx_t script_ctx_t;
|
||||
typedef struct _exec_ctx_t exec_ctx_t;
|
||||
typedef struct _dispex_prop_t dispex_prop_t;
|
||||
|
|
|
@ -26,6 +26,7 @@ STRINGTABLE DISCARDABLE
|
|||
IDS_INVALID_CALL_ARG "Invalid procedure call or argument"
|
||||
IDS_NO_PROPERTY "Object doesn't support this property or method"
|
||||
IDS_ARG_NOT_OPT "Argument not optional"
|
||||
IDS_SYNTAX_ERROR "Syntax error"
|
||||
IDS_NOT_FUNC "Function expected"
|
||||
IDS_NOT_DATE "'[object]' is not a date object"
|
||||
IDS_NOT_NUM "Number expected"
|
||||
|
|
|
@ -1568,7 +1568,7 @@ HRESULT script_parse(script_ctx_t *ctx, const WCHAR *code, const WCHAR *delimite
|
|||
return E_OUTOFMEMORY;
|
||||
|
||||
parser_ctx->ref = 1;
|
||||
parser_ctx->hres = E_FAIL;
|
||||
parser_ctx->hres = JSCRIPT_ERROR|IDS_SYNTAX_ERROR;
|
||||
parser_ctx->is_html = delimiter && !strcmpiW(delimiter, html_tagW);
|
||||
|
||||
parser_ctx->begin = parser_ctx->ptr = code;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#define IDS_INVALID_CALL_ARG 0x0005
|
||||
#define IDS_NO_PROPERTY 0x01B6
|
||||
#define IDS_ARG_NOT_OPT 0x01c1
|
||||
#define IDS_SYNTAX_ERROR 0x03EA
|
||||
#define IDS_NOT_FUNC 0x138A
|
||||
#define IDS_NOT_DATE 0x138E
|
||||
#define IDS_NOT_NUM 0x1389
|
||||
|
|
|
@ -1317,5 +1317,6 @@ exception_test(function() {not_existing_variable.something();}, "TypeError", -21
|
|||
exception_test(function() {arr.toString = Function.prototype.toString; arr.toString();}, "TypeError", -2146823286);
|
||||
exception_test(function() {date();}, "TypeError", -2146823286);
|
||||
exception_test(function() {arr();}, "TypeError", -2146823286);
|
||||
exception_test(function() {eval("for(i=0;) {}");}, "SyntaxError", -2146827286);
|
||||
|
||||
reportSuccess();
|
||||
|
|
Loading…
Reference in New Issue