Module: wine Branch: master Commit: 534b977c62c7deaa12fcfb99449f8f8ba5d9c6fc URL: https://gitlab.winehq.org/wine/wine/-/commit/534b977c62c7deaa12fcfb99449f8f8...
Author: Gabriel Ivăncescu gabrielopcode@gmail.com Date: Tue Nov 22 18:53:20 2022 +0200
jscript: Throw proper error when calling Set constructor as method.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com
---
dlls/jscript/set.c | 3 +++ dlls/mshtml/tests/documentmode.js | 7 +++++++ 2 files changed, 10 insertions(+)
diff --git a/dlls/jscript/set.c b/dlls/jscript/set.c index 09f3746740c..535ecdc49a4 100644 --- a/dlls/jscript/set.c +++ b/dlls/jscript/set.c @@ -572,6 +572,9 @@ static HRESULT Set_constructor(script_ctx_t *ctx, jsval_t vthis, WORD flags, uns *r = jsval_obj(&set->dispex); return S_OK;
+ case DISPATCH_METHOD: + return throw_error(ctx, JS_E_WRONG_THIS, L"Set"); + default: FIXME("unimplemented flags %x\n", flags); return E_NOTIMPL; diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index c6a12203af6..3965c8ec41b 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -1201,6 +1201,13 @@ sync_test("func_scope", function() { sync_test("set_obj", function() { if(!("Set" in window)) return;
+ try { + var s = Set(); + ok(false, "expected exception calling constructor as method"); + }catch(e) { + ok(e.number === 0xa13fc - 0x80000000, "calling constructor as method threw " + e.number); + } + var s = new Set, r; ok(Object.getPrototypeOf(s) === Set.prototype, "unexpected Set prototype");