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;
|
jsdisp_t *obj;
|
||||||
|
|
||||||
if(!argc || !is_object_instance(argv[0])) {
|
if(!argc || !is_object_instance(argv[0]))
|
||||||
FIXME("invalid arguments\n");
|
return JS_E_OBJECT_EXPECTED;
|
||||||
return E_NOTIMPL;
|
|
||||||
}
|
|
||||||
|
|
||||||
TRACE("(%s)\n", debugstr_jsval(argv[0]));
|
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;
|
jsstr_t *key;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
if(!is_object_instance(arg)) {
|
if(!is_object_instance(arg))
|
||||||
FIXME("invalid arguments %s\n", debugstr_jsval(arg));
|
return JS_E_OBJECT_EXPECTED;
|
||||||
return E_NOTIMPL;
|
|
||||||
}
|
|
||||||
|
|
||||||
obj = to_jsdisp(get_object(arg));
|
obj = to_jsdisp(get_object(arg));
|
||||||
if(!obj) {
|
if(!obj) {
|
||||||
|
@ -931,10 +927,8 @@ static HRESULT Object_preventExtensions(script_ctx_t *ctx, jsval_t vthis, WORD f
|
||||||
{
|
{
|
||||||
jsdisp_t *obj;
|
jsdisp_t *obj;
|
||||||
|
|
||||||
if(!argc || !is_object_instance(argv[0])) {
|
if(!argc || !is_object_instance(argv[0]))
|
||||||
FIXME("invalid arguments\n");
|
return JS_E_OBJECT_EXPECTED;
|
||||||
return E_NOTIMPL;
|
|
||||||
}
|
|
||||||
|
|
||||||
TRACE("(%s)\n", debugstr_jsval(argv[0]));
|
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() {
|
sync_test("__proto__", function() {
|
||||||
var v = document.documentMode;
|
var v = document.documentMode;
|
||||||
var r, x = 42;
|
var r, x = 42;
|
||||||
|
|
Loading…
Reference in New Issue