diff --git a/dlls/jscript/string.c b/dlls/jscript/string.c index 5c074e8bf69..4cfc082fb69 100644 --- a/dlls/jscript/string.c +++ b/dlls/jscript/string.c @@ -123,6 +123,33 @@ static HRESULT String_valueOf(DispatchEx *dispex, LCID lcid, WORD flags, DISPPAR return String_toString(dispex, lcid, flags, dp, retv, ei, sp); } +static HRESULT do_attributeless_tag_format(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp, + VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp, const WCHAR *tagname) +{ + static const WCHAR tagfmt[] = {'<','%','s','>','%','s','<','/','%','s','>',0}; + StringInstance *string; + BSTR ret; + + if(!is_class(dispex, JSCLASS_STRING)) { + WARN("this is not a string object\n"); + return E_NOTIMPL; + } + + string = (StringInstance*)dispex; + + if(retv) { + ret = SysAllocStringLen(NULL, string->length + 2*strlenW(tagname) + 5); + if(!ret) + return E_OUTOFMEMORY; + + sprintfW(ret, tagfmt, tagname, string->str, tagname); + + V_VT(retv) = VT_BSTR; + V_BSTR(retv) = ret; + } + return S_OK; +} + static HRESULT String_anchor(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) { @@ -133,8 +160,8 @@ static HRESULT String_anchor(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARA static HRESULT String_big(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) { - FIXME("\n"); - return E_NOTIMPL; + static const WCHAR bigtagW[] = {'B','I','G',0}; + return do_attributeless_tag_format(dispex, lcid, flags, dp, retv, ei, sp, bigtagW); } static HRESULT String_blink(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp, diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index 4f843ec7ad0..e0d70256af7 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -269,6 +269,15 @@ ok(tmp === "TEST", "''.toUpperCase() = " + tmp); tmp = "tEsT".toUpperCase(3); ok(tmp === "TEST", "''.toUpperCase(3) = " + tmp); +tmp = "".big(); +ok(tmp === "", "''.big() = " + tmp); +tmp = "".big(3); +ok(tmp === "", "''.big(3) = " + tmp); +tmp = "test".big(); +ok(tmp === "test", "'test'.big() = " + tmp); +tmp = "test".big(3); +ok(tmp === "test", "'test'.big(3) = " + tmp); + var arr = new Array(); ok(typeof(arr) === "object", "arr () is not object"); ok((arr.length === 0), "arr.length is not 0");