jscript: Throw proper error in Object methods with non-objects args.
According to the ES6 spec, they don't throw anymore (compared to ES5), but native IE seems to not follow it here and throws anyway. Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9785781fbc
commit
ed55216558
|
@ -844,10 +844,8 @@ static HRESULT Object_getPrototypeOf(script_ctx_t *ctx, jsval_t vthis, WORD flag
|
|||
{
|
||||
jsdisp_t *obj;
|
||||
|
||||
if(!argc || !is_object_instance(argv[0])) {
|
||||
FIXME("invalid arguments\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
if(!argc || !is_object_instance(argv[0]))
|
||||
return JS_E_OBJECT_EXPECTED;
|
||||
|
||||
TRACE("(%s)\n", debugstr_jsval(argv[0]));
|
||||
|
||||
|
@ -872,10 +870,8 @@ static HRESULT object_keys(script_ctx_t *ctx, jsval_t arg, enum jsdisp_enum_type
|
|||
jsstr_t *key;
|
||||
HRESULT hres;
|
||||
|
||||
if(!is_object_instance(arg)) {
|
||||
FIXME("invalid arguments %s\n", debugstr_jsval(arg));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
if(!is_object_instance(arg))
|
||||
return JS_E_OBJECT_EXPECTED;
|
||||
|
||||
obj = to_jsdisp(get_object(arg));
|
||||
if(!obj) {
|
||||
|
@ -931,10 +927,8 @@ static HRESULT Object_preventExtensions(script_ctx_t *ctx, jsval_t vthis, WORD f
|
|||
{
|
||||
jsdisp_t *obj;
|
||||
|
||||
if(!argc || !is_object_instance(argv[0])) {
|
||||
FIXME("invalid arguments\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
if(!argc || !is_object_instance(argv[0]))
|
||||
return JS_E_OBJECT_EXPECTED;
|
||||
|
||||
TRACE("(%s)\n", debugstr_jsval(argv[0]));
|
||||
|
||||
|
|
|
@ -1278,6 +1278,30 @@ sync_test("elem_attr", function() {
|
|||
}
|
||||
});
|
||||
|
||||
sync_test("builtins_diffs", function() {
|
||||
var v = document.documentMode;
|
||||
|
||||
/* despite what spec says for ES6, IE still throws */
|
||||
var props = [
|
||||
"freeze",
|
||||
"getPrototypeOf",
|
||||
"isExtensible",
|
||||
"isFrozen",
|
||||
"isSealed",
|
||||
"keys",
|
||||
"preventExtensions",
|
||||
"seal"
|
||||
];
|
||||
for(var i = 0; i < props.length; i++) {
|
||||
try {
|
||||
Object[props[i]]("test");
|
||||
ok(false, "Object." + props[i] + " with non-object: expected exception");
|
||||
}catch(e) {
|
||||
ok(e.number === (v < 9 ? 0xa01b6 : 0xa138f) - 0x80000000, "Object." + props[i] + " with non-object: exception = " + e.number);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
sync_test("__proto__", function() {
|
||||
var v = document.documentMode;
|
||||
var r, x = 42;
|
||||
|
|
Loading…
Reference in New Issue