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 --- dlls/jscript/object.c | 18 ++++++------------ dlls/mshtml/tests/documentmode.js | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 12 deletions(-)
diff --git a/dlls/jscript/object.c b/dlls/jscript/object.c index bf0be64..d1522b1 100644 --- a/dlls/jscript/object.c +++ b/dlls/jscript/object.c @@ -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]));
diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 4a776f8..b4d0beb 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -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;