Module: wine Branch: master Commit: a4c2f6ab72d233f103445f711808b29fa2cc8590 URL: https://gitlab.winehq.org/wine/wine/-/commit/a4c2f6ab72d233f103445f711808b29...
Author: Gabriel Ivăncescu gabrielopcode@gmail.com Date: Thu Jun 22 16:19:01 2023 +0300
jscript: Throw error when accessing `arguments` prop of bind functions.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com
---
dlls/jscript/function.c | 7 ++++++- dlls/mshtml/tests/es5.js | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index abd6638cab8..c4ee495a428 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -912,13 +912,18 @@ HRESULT create_source_function(script_ctx_t *ctx, bytecode_t *code, function_cod return S_OK; }
+static HRESULT BindFunction_get_arguments(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) +{ + return JS_E_INVALID_ACTION; +} + static HRESULT BindFunction_get_caller(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) { return JS_E_INVALID_ACTION; }
static const builtin_prop_t BindFunction_props[] = { - {L"arguments", NULL, 0, Function_get_arguments}, + {L"arguments", NULL, 0, BindFunction_get_arguments}, {L"caller", NULL, 0, BindFunction_get_caller}, {L"length", NULL, 0, Function_get_length} }; diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index 43723a68d00..fb9b710c70c 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -532,8 +532,10 @@ sync_test("getOwnPropertyDescriptor", function() { test_own_data_prop_desc(String, "prototype", false, false, false); test_own_data_prop_desc(function(){}, "prototype", true, false, false); test_own_data_prop_desc(function(){}, "caller", false, false, false); + test_own_data_prop_desc(function(){}, "arguments", false, false, false); test_own_data_prop_desc(Function, "prototype", false, false, false); test_own_data_prop_desc(Function.prototype, "caller", false, false, false); + test_own_data_prop_desc(Function.prototype, "arguments", false, false, false); test_own_data_prop_desc(String.prototype, "constructor", true, false, true);
try { @@ -1140,6 +1142,13 @@ sync_test("bind", function() { r = f.call(o2); ok(r === 1, "r = " + r);
+ try { + f.arguments; + ok(false, "expected exception getting f.arguments"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_INVALID_ACTION, "f.arguments threw " + n); + } try { f.caller; ok(false, "expected exception getting f.caller");