diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index c0ba1e2c864..96c41a917b4 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -364,6 +364,19 @@ static HRESULT Function_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPAR return invoke_function(function, lcid, dp, retv, ei, caller); + case DISPATCH_PROPERTYGET: { + HRESULT hres; + BSTR str; + + hres = function_to_string(function, &str); + if(FAILED(hres)) + return hres; + + V_VT(retv) = VT_BSTR; + V_BSTR(retv) = str; + break; + } + case DISPATCH_CONSTRUCT: if(function->value_proc) return invoke_value_proc(function, lcid, flags, dp, retv, ei, caller); diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index 40842414cc4..93f06b95a6d 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -321,6 +321,8 @@ var func = function (a) { }.toString(); ok(func.toString() === "function (a) {\n var a = 1;\n if(a) return;\n }", "func.toString() = " + func.toString()); +ok("" + func === "function (a) {\n var a = 1;\n if(a) return;\n }", + "'' + func.toString() = " + func); function testFuncToString(x,y) { return x+y; @@ -328,5 +330,7 @@ function testFuncToString(x,y) { ok(testFuncToString.toString() === "function testFuncToString(x,y) {\n return x+y;\n}", "testFuncToString.toString() = " + testFuncToString.toString()); +ok("" + testFuncToString === "function testFuncToString(x,y) {\n return x+y;\n}", + "'' + testFuncToString = " + testFuncToString); reportSuccess();