Module: wine Branch: master Commit: d7e4193df2f22a87031e44ce358a626a5f92b295 URL: http://source.winehq.org/git/wine.git/?a=commit;h=d7e4193df2f22a87031e44ce35...
Author: Jacek Caban jacek@codeweavers.com Date: Wed Jan 6 16:29:42 2016 +0100
jscript: Added support for Function constructor called as a function.
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/jscript/function.c | 1 + dlls/jscript/tests/api.js | 10 ++++++++++ 2 files changed, 11 insertions(+)
diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index 0ac6c61..dcddf59 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -821,6 +821,7 @@ static HRESULT FunctionConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla TRACE("\n");
switch(flags) { + case DISPATCH_METHOD: case DISPATCH_CONSTRUCT: { IDispatch *ret;
diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index f4f42b0..78145c6 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -1869,6 +1869,16 @@ ok(tmp === undefined, "func() = " + tmp); tmp = func.toString(); ok(tmp == "function anonymous() {\n\n}", "func.toString() = " + tmp);
+// Function constructor called as function +func = Function("return 3;"); + +tmp = func(); +ok(tmp === 3, "func() = " + tmp); +ok(func.call() === 3, "func.call() = " + tmp); +ok(func.length === 0, "func.length = " + func.length); +tmp = func.toString(); +ok(tmp === "function anonymous() {\nreturn 3;\n}", "func.toString() = " + tmp); + func = (function() { var tmp = 3; return new Function("return tmp;");