From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/jscript/error.c | 1 + dlls/jscript/function.c | 6 +++--- dlls/jscript/jscript.h | 1 + dlls/jscript/jscript.rc | 1 + dlls/jscript/resource.h | 1 + dlls/mshtml/tests/documentmode.js | 3 --- 6 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/dlls/jscript/error.c b/dlls/jscript/error.c index 3ff40a1e1e7..a7513981676 100644 --- a/dlls/jscript/error.c +++ b/dlls/jscript/error.c @@ -489,6 +489,7 @@ jsdisp_t *create_builtin_error(script_ctx_t *ctx) case JS_E_JSCRIPT_EXPECTED: case JS_E_ENUMERATOR_EXPECTED: case JS_E_REGEXP_EXPECTED: + case JS_E_ARRAY_OR_ARGS_EXPECTED: case JS_E_ARRAY_EXPECTED: case JS_E_CYCLIC_PROTO_VALUE: case JS_E_CANNOT_CREATE_FOR_NONEXTENSIBLE: diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index 59384d1f0a2..f4f9dd57d3b 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -426,14 +426,14 @@ static HRESULT array_to_args(script_ctx_t *ctx, IDispatch *disp, unsigned *argc,
hres = disp_propget_name(ctx, disp, L"length", &val); if(FAILED(hres)) - return (hres == DISP_E_UNKNOWNNAME) ? JS_E_JSCRIPT_EXPECTED : hres; + return (hres == DISP_E_UNKNOWNNAME) ? JS_E_ARRAY_OR_ARGS_EXPECTED : hres;
hres = to_int32(ctx, val, &length); jsval_release(val); if(FAILED(hres)) return hres; if(length < 0) - return JS_E_JSCRIPT_EXPECTED; + return JS_E_ARRAY_OR_ARGS_EXPECTED;
argv = malloc(length * sizeof(*argv)); if(!argv) @@ -503,7 +503,7 @@ static HRESULT Function_apply(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsi } }
- hres = obj ? array_to_args(ctx, obj, &cnt, &args) : JS_E_JSCRIPT_EXPECTED; + hres = obj ? array_to_args(ctx, obj, &cnt, &args) : ctx->html_mode ? JS_E_ARRAY_OR_ARGS_EXPECTED : JS_E_JSCRIPT_EXPECTED; }
if(SUCCEEDED(hres)) { diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 5660ee48435..30f3d8d6bfa 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -567,6 +567,7 @@ static inline HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, jsval_ #define JS_E_INVALID_URI_CHAR MAKE_JSERROR(IDS_URI_INVALID_CHAR) #define JS_E_FRACTION_DIGITS_OUT_OF_RANGE MAKE_JSERROR(IDS_FRACTION_DIGITS_OUT_OF_RANGE) #define JS_E_PRECISION_OUT_OF_RANGE MAKE_JSERROR(IDS_PRECISION_OUT_OF_RANGE) +#define JS_E_ARRAY_OR_ARGS_EXPECTED MAKE_JSERROR(IDS_ARRAY_OR_ARGS_EXPECTED) #define JS_E_INVALID_LENGTH MAKE_JSERROR(IDS_INVALID_LENGTH) #define JS_E_ARRAY_EXPECTED MAKE_JSERROR(IDS_ARRAY_EXPECTED) #define JS_E_CYCLIC_PROTO_VALUE MAKE_JSERROR(IDS_CYCLIC_PROTO_VALUE) diff --git a/dlls/jscript/jscript.rc b/dlls/jscript/jscript.rc index 3e46023adc6..998082a1046 100644 --- a/dlls/jscript/jscript.rc +++ b/dlls/jscript/jscript.rc @@ -69,6 +69,7 @@ STRINGTABLE IDS_URI_INVALID_CHAR "URI to be encoded contains invalid characters" IDS_FRACTION_DIGITS_OUT_OF_RANGE "Number of fraction digits is out of range" IDS_PRECISION_OUT_OF_RANGE "Precision is out of range" + IDS_ARRAY_OR_ARGS_EXPECTED "Array or arguments object expected" IDS_INVALID_LENGTH "Array length must be a finite positive integer" IDS_ARRAY_EXPECTED "Array object expected" IDS_INVALID_WRITABLE_PROP_DESC "'writable' attribute on the property descriptor cannot be set to 'true' on this object" diff --git a/dlls/jscript/resource.h b/dlls/jscript/resource.h index 640cc01cff9..30147f683a0 100644 --- a/dlls/jscript/resource.h +++ b/dlls/jscript/resource.h @@ -67,6 +67,7 @@ #define IDS_URI_INVALID_CODING 0x13A1 #define IDS_FRACTION_DIGITS_OUT_OF_RANGE 0x13A2 #define IDS_PRECISION_OUT_OF_RANGE 0x13A3 +#define IDS_ARRAY_OR_ARGS_EXPECTED 0x13A4 #define IDS_INVALID_LENGTH 0x13A5 #define IDS_ARRAY_EXPECTED 0x13A7 #define IDS_INVALID_WRITABLE_PROP_DESC 0x13AC diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 562761a022f..3a9fb8319bb 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -521,7 +521,6 @@ sync_test("builtin_obj", function() { }catch(ex) { e = ex.number; } - todo_wine. ok(e === 0xa13a4 - 0x80000000, "[function.apply with elem without length] e = " + e); }else { (function(a, b) { @@ -545,7 +544,6 @@ sync_test("builtin_obj", function() { }catch(ex) { e = ex.number; } - todo_wine. ok(e === 0xa13a4 - 0x80000000, "[function.apply with Object without length] e = " + e); }else { (function(c, d) { @@ -561,7 +559,6 @@ sync_test("builtin_obj", function() { }catch(ex) { e = ex.number; } - todo_wine. ok(e === 0xa13a4 - 0x80000000, "[function.apply with Object with length] e = " + e); }else { (function(c, d) {