Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/jscript/dispex.c | 3 +++ dlls/jscript/tests/run.c | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+)
diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index e140010..1cacd49 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -2007,6 +2007,9 @@ HRESULT jsdisp_call_name(jsdisp_t *disp, const WCHAR *name, WORD flags, unsigned if(FAILED(hres)) return hres;
+ if(!prop || prop->type == PROP_DELETED) + return JS_E_INVALID_PROPERTY; + return invoke_prop_func(disp, to_disp(disp), prop, flags, argc, argv, r, NULL); }
diff --git a/dlls/jscript/tests/run.c b/dlls/jscript/tests/run.c index 63d8115..86d6fa4 100644 --- a/dlls/jscript/tests/run.c +++ b/dlls/jscript/tests/run.c @@ -2946,6 +2946,28 @@ static void test_script_exprs(void) CHECK_CALLED(global_success_d); CHECK_CALLED(global_success_i);
+ hres = parse_script_expr(L"var o=new Object(); Object.prototype.toLocaleString.call(o)", &v, NULL); + ok(hres == S_OK, "parse_script_expr failed: %08lx\n", hres); + ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v)); + ok(!lstrcmpW(V_BSTR(&v), L"[object Object]"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v))); + VariantClear(&v); + + hres = parse_script_expr(L"var o=new Object(); Object.prototype.toString = function() {return "wine";}; Object.prototype.toLocaleString.call(o)", &v, NULL); + ok(hres == S_OK, "parse_script_expr failed: %08lx\n", hres); + ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v)); + todo_wine + ok(!lstrcmpW(V_BSTR(&v), L"wine"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v))); + VariantClear(&v); + + hres = parse_script_expr(L"var o=new Object(); delete Object.prototype.toString; Object.prototype.toLocaleString.call(o)", &v, NULL); + ok(hres == 0x800a01b6, "parse_script_expr failed: %08lx\n", hres); + + hres = parse_script_expr(L"var o=new Object(); o.toString = function() {return "wine";}; Object.prototype.toLocaleString.call(o)", &v, NULL); + ok(hres == S_OK, "parse_script_expr failed: %08lx\n", hres); + ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v)); + ok(!lstrcmpW(V_BSTR(&v), L"wine"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v))); + VariantClear(&v); + test_default_value(); test_retval();
Methods can be overriden by simple assignment, not just via defineProperty, unlike accessors.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/jscript/dispex.c | 6 ++++++ dlls/jscript/tests/run.c | 1 - 2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index 1cacd49..03062ee 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -495,6 +495,12 @@ static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, jsval_t val)
switch(prop->type) { case PROP_BUILTIN: + if(prop->u.p->invoke) { + prop->type = PROP_JSVAL; + prop->flags = PROPF_CONFIGURABLE | PROPF_WRITABLE; + prop->u.val = jsval_undefined(); + break; + } if(!prop->u.p->setter) { TRACE("getter with no setter\n"); return S_OK; diff --git a/dlls/jscript/tests/run.c b/dlls/jscript/tests/run.c index 86d6fa4..5e797a1 100644 --- a/dlls/jscript/tests/run.c +++ b/dlls/jscript/tests/run.c @@ -2955,7 +2955,6 @@ static void test_script_exprs(void) hres = parse_script_expr(L"var o=new Object(); Object.prototype.toString = function() {return "wine";}; Object.prototype.toLocaleString.call(o)", &v, NULL); ok(hres == S_OK, "parse_script_expr failed: %08lx\n", hres); ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v)); - todo_wine ok(!lstrcmpW(V_BSTR(&v), L"wine"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v))); VariantClear(&v);
Signed-off-by: Jacek Caban jacek@codeweavers.com
We have to define it after the constructors are initiated.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com ---
__proto__ seems to be specially treated as an actual accessor builtin on native; the other builtin accessor props are already tested to be values when retrieved via getOwnPropertyDescriptor, despite what the spec says (see "getOwnPropertyDescriptor" test in mshtml/tests/es5.js).
This also allows us to get rid of the workaround treating builtins with setters as accessors on prop_put (which was just for __proto__ anyway) which prevented tests from failing.
dlls/jscript/dispex.c | 3 +- dlls/jscript/global.c | 29 +++++++++++++ dlls/jscript/jscript.h | 2 + dlls/jscript/object.c | 71 +++++++++++++++++++++++-------- dlls/mshtml/tests/documentmode.js | 60 ++++++++++++++++++++++++++ 5 files changed, 146 insertions(+), 19 deletions(-)
diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index 03062ee..a74840e 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -488,8 +488,7 @@ static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, jsval_t val) prop_iter = prototype_iter->props + prop_iter->u.ref; } while(prop_iter->type == PROP_PROTREF);
- if(prop_iter->type == PROP_ACCESSOR || - (prop_iter->type == PROP_BUILTIN && prop_iter->u.p->setter)) + if(prop_iter->type == PROP_ACCESSOR) prop = prop_iter; }
diff --git a/dlls/jscript/global.c b/dlls/jscript/global.c index b9e3d89..c0ed954 100644 --- a/dlls/jscript/global.c +++ b/dlls/jscript/global.c @@ -911,6 +911,31 @@ static const builtin_info_t JSGlobal_info = { NULL };
+static HRESULT init_object_prototype_accessors(script_ctx_t *ctx, jsdisp_t *object_prototype) +{ + property_desc_t desc; + HRESULT hres = S_OK; + + /* __proto__ is an actual accessor on native, despite being a builtin */ + if(ctx->version >= SCRIPTLANGUAGEVERSION_ES6) { + desc.flags = PROPF_CONFIGURABLE; + desc.mask = PROPF_CONFIGURABLE | PROPF_ENUMERABLE; + desc.explicit_getter = desc.explicit_setter = TRUE; + desc.explicit_value = FALSE; + + hres = create_builtin_function(ctx, Object_get_proto_, NULL, NULL, PROPF_METHOD, NULL, &desc.getter); + if(SUCCEEDED(hres)) { + hres = create_builtin_function(ctx, Object_set_proto_, NULL, NULL, PROPF_METHOD|1, NULL, &desc.setter); + if(SUCCEEDED(hres)) { + hres = jsdisp_define_property(object_prototype, L"__proto__", &desc); + jsdisp_release(desc.setter); + } + jsdisp_release(desc.getter); + } + } + return hres; +} + static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype) { HRESULT hres; @@ -1073,6 +1098,10 @@ HRESULT init_global(script_ctx_t *ctx) if(FAILED(hres)) return hres;
+ hres = init_object_prototype_accessors(ctx, ctx->object_prototype); + if(FAILED(hres)) + return hres; + hres = create_math(ctx, &math); if(FAILED(hres)) return hres; diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 41b6c01..4a4d303 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -451,6 +451,8 @@ BOOL bool_obj_value(jsdisp_t*) DECLSPEC_HIDDEN; unsigned array_get_length(jsdisp_t*) DECLSPEC_HIDDEN;
HRESULT JSGlobal_eval(script_ctx_t*,jsval_t,WORD,unsigned,jsval_t*,jsval_t*) DECLSPEC_HIDDEN; +HRESULT Object_get_proto_(script_ctx_t*,jsval_t,WORD,unsigned,jsval_t*,jsval_t*) DECLSPEC_HIDDEN; +HRESULT Object_set_proto_(script_ctx_t*,jsval_t,WORD,unsigned,jsval_t*,jsval_t*) DECLSPEC_HIDDEN;
static inline BOOL is_class(jsdisp_t *jsdisp, jsclass_t class) { diff --git a/dlls/jscript/object.c b/dlls/jscript/object.c index c01fbcc..f8f1407 100644 --- a/dlls/jscript/object.c +++ b/dlls/jscript/object.c @@ -289,31 +289,69 @@ done: return hres; }
-static HRESULT Object_get_proto_(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) +HRESULT Object_get_proto_(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) { - TRACE("%p\n", jsthis); + jsdisp_t *jsthis; + IDispatch *disp; + HRESULT hres;
- if(r) - *r = jsthis->prototype - ? jsval_obj(jsdisp_addref(jsthis->prototype)) - : jsval_null(); - return S_OK; + TRACE("%s\n", debugstr_jsval(vthis)); + + hres = to_object(ctx, vthis, &disp); + if(FAILED(hres)) + return hres; + + if(!r) + goto done; + + if(!(jsthis = to_jsdisp(disp))) { + FIXME("Host object this\n"); + hres = E_FAIL; + goto done; + } + + *r = jsthis->prototype + ? jsval_obj(jsdisp_addref(jsthis->prototype)) + : jsval_null(); +done: + IDispatch_Release(disp); + return hres; }
-static HRESULT Object_set_proto_(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value) +HRESULT Object_set_proto_(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) { - jsdisp_t *proto; + jsdisp_t *jsthis, *proto; + HRESULT hres;
- TRACE("%p\n", jsthis); + TRACE("%s\n", debugstr_jsval(vthis));
- if(is_undefined(value) || is_null(value)) - proto = NULL; - else if(!is_object_instance(value) || !(proto = to_jsdisp(get_object(value)))) { - FIXME("not an object\n"); - return E_FAIL; + if(is_undefined(vthis) || is_null(vthis)) + return JS_E_OBJECT_EXPECTED; + if(!argc) { + if(r) + *r = jsval_undefined(); + return S_OK; } + if(!is_object_instance(vthis) || !(jsthis = to_jsdisp(get_object(vthis)))) + goto done;
- return jsdisp_change_prototype(jsthis, proto); + if(is_null(argv[0])) { + proto = NULL; + }else if(is_object_instance(argv[0])) { + proto = to_jsdisp(get_object(argv[0])); + if(!proto) { + FIXME("Host object value\n"); + return E_FAIL; + } + }else + goto done; + + hres = jsdisp_change_prototype(jsthis, proto); + if(FAILED(hres)) + return hres; + +done: + return r ? jsval_copy(argv[0], r) : S_OK; }
static void Object_destructor(jsdisp_t *dispex) @@ -322,7 +360,6 @@ static void Object_destructor(jsdisp_t *dispex) }
static const builtin_prop_t Object_props[] = { - {L"__proto__", NULL, PROPF_ES6, Object_get_proto_, Object_set_proto_}, {L"hasOwnProperty", Object_hasOwnProperty, PROPF_METHOD|1}, {L"isPrototypeOf", Object_isPrototypeOf, PROPF_METHOD|1}, {L"propertyIsEnumerable", Object_propertyIsEnumerable, PROPF_METHOD|1}, diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 243a8fa..43ebd56 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -1330,6 +1330,66 @@ sync_test("__proto__", function() { ok(Object.prototype.hasOwnProperty("__proto__"), "__proto__ is not a property of Object.prototype after delete"); r = Object.getPrototypeOf(x); ok(r === ctor.prototype, "x.__proto__ after delete = " + r); + + var desc = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__"); + ok(desc.value === undefined, "__proto__ value = " + desc.value); + ok(Object.getPrototypeOf(desc.get) === Function.prototype, "__proto__ getter not a function"); + ok(Object.getPrototypeOf(desc.set) === Function.prototype, "__proto__ setter not a function"); + ok(desc.get.length === 0, "__proto__ getter length = " + desc.get.length); + ok(desc.set.length === 1, "__proto__ setter length = " + desc.set.length); + + r = desc.get.call(x, 1, 2, 3, 4); + ok(r === x.__proto__, "calling __proto__ getter on x returned " + r); + + r = desc.set.call(x, obj); + ok(r === obj, "calling __proto__ setter(obj) on x returned " + r); + check(obj, "after set to obj via calling setter"); + r = desc.set.call(x, 42); + ok(r === 42, "calling __proto__ setter(42) on x returned " + r); + check(obj, "after set to obj via calling setter(42)"); + r = desc.set.call(x, "foo"); + ok(r === "foo", "calling __proto__ setter('foo') on x returned " + r); + check(obj, "after set to obj via calling setter('foo')"); + r = desc.set.call(x); + ok(r === undefined, "calling __proto__ setter() on x returned " + r); + r = desc.set.call(true, obj); + ok(r === obj, "calling __proto__ setter(obj) on true value returned " + r); + x = true; + r = desc.set.call(x, obj); + ok(r === obj, "calling __proto__ setter(obj) on x set to true returned " + r); + ok(x.__proto__ === Boolean.prototype, "true value __proto__ after set to obj = " + x.__proto__); + x = new Boolean(true); + r = desc.set.call(x, obj); + ok(r === obj, "calling __proto__ setter(obj) on x set to Boolean(true) returned " + r); + ok(x.__proto__ === obj, "Boolean(true) __proto__ after set to obj = " + x.__proto__); + + r = desc.get.call(13); + ok(r === Number.prototype, "calling __proto__ getter on 13 returned " + r); + try { + r = desc.get.call(undefined); + ok(false, "expected exception calling __proto__ getter on undefined"); + }catch(e) { + ok(e.number === 0xa138f - 0x80000000, "calling __proto__ getter on undefined threw exception " + e.number); + } + try { + r = desc.get.call(null); + ok(false, "expected exception calling __proto__ getter on null"); + }catch(e) { + ok(e.number === 0xa138f - 0x80000000, "calling __proto__ getter on null threw exception " + e.number); + } + + try { + r = desc.set.call(undefined, obj); + ok(false, "expected exception calling __proto__ setter on undefined"); + }catch(e) { + ok(e.number === 0xa138f - 0x80000000, "calling __proto__ setter on undefined threw exception " + e.number); + } + try { + r = desc.set.call(null, obj); + ok(false, "expected exception calling __proto__ setter on null"); + }catch(e) { + ok(e.number === 0xa138f - 0x80000000, "calling __proto__ setter on null threw exception " + e.number); + } });
async_test("postMessage", function() {
Signed-off-by: Jacek Caban jacek@codeweavers.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/jscript/dispex.c | 5 +++++ dlls/jscript/error.c | 1 + dlls/jscript/jscript.h | 1 + dlls/jscript/jscript.rc | 1 + dlls/jscript/resource.h | 1 + dlls/mshtml/tests/documentmode.js | 13 +++++++++++++ 6 files changed, 22 insertions(+)
diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index a74840e..eff91e9 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -2708,11 +2708,16 @@ HRESULT jsdisp_define_data_property(jsdisp_t *obj, const WCHAR *name, unsigned f
HRESULT jsdisp_change_prototype(jsdisp_t *obj, jsdisp_t *proto) { + jsdisp_t *iter; DWORD i;
if(obj->prototype == proto) return S_OK;
+ for(iter = proto; iter; iter = iter->prototype) + if(iter == obj) + return JS_E_CYCLIC_PROTO_VALUE; + if(obj->prototype) { for(i = 0; i < obj->prop_cnt; i++) if(obj->props[i].type == PROP_PROTREF) diff --git a/dlls/jscript/error.c b/dlls/jscript/error.c index 6f17699..4db95e5 100644 --- a/dlls/jscript/error.c +++ b/dlls/jscript/error.c @@ -477,6 +477,7 @@ jsdisp_t *create_builtin_error(script_ctx_t *ctx) case JS_E_ENUMERATOR_EXPECTED: case JS_E_REGEXP_EXPECTED: case JS_E_ARRAY_EXPECTED: + case JS_E_CYCLIC_PROTO_VALUE: case JS_E_OBJECT_NONEXTENSIBLE: case JS_E_NONCONFIGURABLE_REDEFINED: case JS_E_NONWRITABLE_MODIFIED: diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 4a4d303..96f2270 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -518,6 +518,7 @@ static inline DWORD make_grfdex(script_ctx_t *ctx, DWORD flags) #define JS_E_PRECISION_OUT_OF_RANGE MAKE_JSERROR(IDS_PRECISION_OUT_OF_RANGE) #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) #define JS_E_OBJECT_NONEXTENSIBLE MAKE_JSERROR(IDS_OBJECT_NONEXTENSIBLE) #define JS_E_NONCONFIGURABLE_REDEFINED MAKE_JSERROR(IDS_NONCONFIGURABLE_REDEFINED) #define JS_E_NONWRITABLE_MODIFIED MAKE_JSERROR(IDS_NONWRITABLE_MODIFIED) diff --git a/dlls/jscript/jscript.rc b/dlls/jscript/jscript.rc index 50e2c30..38a49d9 100644 --- a/dlls/jscript/jscript.rc +++ b/dlls/jscript/jscript.rc @@ -70,6 +70,7 @@ STRINGTABLE 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" + IDS_CYCLIC_PROTO_VALUE "Cyclic __proto__ value" IDS_OBJECT_NONEXTENSIBLE "Cannot define property '|': object is not extensible" IDS_NONCONFIGURABLE_REDEFINED "Cannot redefine non-configurable property '|'" IDS_NONWRITABLE_MODIFIED "Cannot modify non-writable property '|'" diff --git a/dlls/jscript/resource.h b/dlls/jscript/resource.h index b17f9fb..0793431 100644 --- a/dlls/jscript/resource.h +++ b/dlls/jscript/resource.h @@ -68,6 +68,7 @@ #define IDS_INVALID_LENGTH 0x13A5 #define IDS_ARRAY_EXPECTED 0x13A7 #define IDS_INVALID_WRITABLE_PROP_DESC 0x13AC +#define IDS_CYCLIC_PROTO_VALUE 0x13B0 #define IDS_OBJECT_NONEXTENSIBLE 0x13D5 #define IDS_NONCONFIGURABLE_REDEFINED 0x13D6 #define IDS_NONWRITABLE_MODIFIED 0x13D7 diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 43ebd56..51a8fe0 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -1390,6 +1390,19 @@ sync_test("__proto__", function() { }catch(e) { ok(e.number === 0xa138f - 0x80000000, "calling __proto__ setter on null threw exception " + e.number); } + + x = {}; + r = Object.create(x); + ok(r.__proto__ === x, "r.__proto__ = " + r.__proto__); + r = Object.create(r); + ok(r.__proto__.__proto__ === x, "r.__proto__.__proto__ = " + r.__proto__.__proto__); + try { + x.__proto__ = r; + ok(false, "expected exception setting circular proto chain"); + }catch(e) { + ok(e.number === 0xa13b0 - 0x80000000 && e.name === "TypeError", + "setting circular proto chain threw exception " + e.number + " (" + e.name + ")"); + } });
async_test("postMessage", function() {
Signed-off-by: Jacek Caban jacek@codeweavers.com
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=110852
Your paranoid android.
=== w8 (32 bit report) ===
mshtml: htmldoc.c:2541: Test failed: unexpected call UpdateUI htmldoc.c:2853: Test failed: unexpected call Exec_UPDATECOMMANDS htmldoc.c:350: Test failed: expected Exec_SETTITLE htmldoc.c:2859: Test failed: unexpected call Exec_SETTITLE
=== w1064_tsign (32 bit report) ===
mshtml: htmldoc.c:2541: Test failed: unexpected call UpdateUI htmldoc.c:2853: Test failed: unexpected call Exec_UPDATECOMMANDS htmldoc.c:350: Test failed: expected Exec_SETTITLE htmldoc.c:2859: Test failed: unexpected call Exec_SETTITLE
=== w7u_adm (32 bit report) ===
mshtml: script.c:624: Test failed: L"/index.html?es5.js:date_now: unexpected Date.now() result 1647882766049 expected 1647882766112"
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/jscript/dispex.c | 2 ++ dlls/jscript/error.c | 1 + dlls/jscript/jscript.h | 1 + dlls/jscript/jscript.rc | 1 + dlls/jscript/resource.h | 1 + dlls/mshtml/tests/documentmode.js | 10 ++++++++++ 6 files changed, 16 insertions(+)
diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index eff91e9..df2f65f 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -2713,6 +2713,8 @@ HRESULT jsdisp_change_prototype(jsdisp_t *obj, jsdisp_t *proto)
if(obj->prototype == proto) return S_OK; + if(!obj->extensible) + return JS_E_CANNOT_CREATE_FOR_NONEXTENSIBLE;
for(iter = proto; iter; iter = iter->prototype) if(iter == obj) diff --git a/dlls/jscript/error.c b/dlls/jscript/error.c index 4db95e5..d309d42 100644 --- a/dlls/jscript/error.c +++ b/dlls/jscript/error.c @@ -478,6 +478,7 @@ jsdisp_t *create_builtin_error(script_ctx_t *ctx) case JS_E_REGEXP_EXPECTED: case JS_E_ARRAY_EXPECTED: case JS_E_CYCLIC_PROTO_VALUE: + case JS_E_CANNOT_CREATE_FOR_NONEXTENSIBLE: case JS_E_OBJECT_NONEXTENSIBLE: case JS_E_NONCONFIGURABLE_REDEFINED: case JS_E_NONWRITABLE_MODIFIED: diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 96f2270..7ed4425 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -519,6 +519,7 @@ static inline DWORD make_grfdex(script_ctx_t *ctx, DWORD flags) #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) +#define JS_E_CANNOT_CREATE_FOR_NONEXTENSIBLE MAKE_JSERROR(IDS_CREATE_FOR_NONEXTENSIBLE) #define JS_E_OBJECT_NONEXTENSIBLE MAKE_JSERROR(IDS_OBJECT_NONEXTENSIBLE) #define JS_E_NONCONFIGURABLE_REDEFINED MAKE_JSERROR(IDS_NONCONFIGURABLE_REDEFINED) #define JS_E_NONWRITABLE_MODIFIED MAKE_JSERROR(IDS_NONWRITABLE_MODIFIED) diff --git a/dlls/jscript/jscript.rc b/dlls/jscript/jscript.rc index 38a49d9..c931eef 100644 --- a/dlls/jscript/jscript.rc +++ b/dlls/jscript/jscript.rc @@ -71,6 +71,7 @@ STRINGTABLE 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" IDS_CYCLIC_PROTO_VALUE "Cyclic __proto__ value" + IDS_CREATE_FOR_NONEXTENSIBLE "Cannot create property for a non-extensible object" IDS_OBJECT_NONEXTENSIBLE "Cannot define property '|': object is not extensible" IDS_NONCONFIGURABLE_REDEFINED "Cannot redefine non-configurable property '|'" IDS_NONWRITABLE_MODIFIED "Cannot modify non-writable property '|'" diff --git a/dlls/jscript/resource.h b/dlls/jscript/resource.h index 0793431..1338ac5 100644 --- a/dlls/jscript/resource.h +++ b/dlls/jscript/resource.h @@ -69,6 +69,7 @@ #define IDS_ARRAY_EXPECTED 0x13A7 #define IDS_INVALID_WRITABLE_PROP_DESC 0x13AC #define IDS_CYCLIC_PROTO_VALUE 0x13B0 +#define IDS_CREATE_FOR_NONEXTENSIBLE 0x13B6 #define IDS_OBJECT_NONEXTENSIBLE 0x13D5 #define IDS_NONCONFIGURABLE_REDEFINED 0x13D6 #define IDS_NONWRITABLE_MODIFIED 0x13D7 diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 51a8fe0..2902902 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -1403,6 +1403,16 @@ sync_test("__proto__", function() { ok(e.number === 0xa13b0 - 0x80000000 && e.name === "TypeError", "setting circular proto chain threw exception " + e.number + " (" + e.name + ")"); } + + Object.preventExtensions(x); + x.__proto__ = Object.prototype; /* same prototype */ + try { + x.__proto__ = Number.prototype; + ok(false, "expected exception changing __proto__ on non-extensible object"); + }catch(e) { + ok(e.number === 0xa13b6 - 0x80000000 && e.name === "TypeError", + "changing __proto__ on non-extensible object threw exception " + e.number + " (" + e.name + ")"); + } });
async_test("postMessage", function() {
Signed-off-by: Jacek Caban jacek@codeweavers.com
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=110853
Your paranoid android.
=== w10pro64_ar (64 bit report) ===
mshtml: htmldoc.c:2541: Test failed: unexpected call UpdateUI htmldoc.c:2853: Test failed: unexpected call Exec_UPDATECOMMANDS
=== w10pro64_zh_CN (64 bit report) ===
mshtml: htmldoc.c:2541: Test failed: unexpected call UpdateUI htmldoc.c:2853: Test failed: unexpected call Exec_UPDATECOMMANDS htmldoc.c:350: Test failed: expected Exec_SETTITLE htmldoc.c:2859: Test failed: unexpected call Exec_SETTITLE
=== w7u_adm (32 bit report) ===
mshtml: script.c:624: Test failed: L"/index.html?es5.js:date_now: unexpected Date.now() result 1647884680569 expected 1647884680620"