From adc2a5697b745c49ea33a14721f2c5dc1172c408 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Wed, 7 Oct 2009 22:11:38 +0200 Subject: [PATCH] jscript: Added Date.toGMTString implementation. --- dlls/jscript/date.c | 19 ++++++++++++------- dlls/jscript/tests/api.js | 1 + 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/dlls/jscript/date.c b/dlls/jscript/date.c index c75358743c0..f8d3522939b 100644 --- a/dlls/jscript/date.c +++ b/dlls/jscript/date.c @@ -675,9 +675,8 @@ static HRESULT Date_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP return S_OK; } -/* ECMA-262 3rd Edition 15.9.5.42 */ -static HRESULT Date_toUTCString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, - VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller) +static inline HRESULT create_utc_string(script_ctx_t *ctx, vdisp_t *jsthis, + VARIANT *retv, jsexcept_t *ei) { static const WCHAR NaNW[] = { 'N','a','N',0 }; static const WCHAR formatADW[] = { '%','s',',',' ','%','d',' ','%','s',' ','%','d',' ', @@ -702,8 +701,6 @@ static HRESULT Date_toUTCString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, int len, size, year, day; DWORD lcid_en, week_id, month_id; - TRACE("\n"); - if(!(date = date_this(jsthis))) return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL); @@ -781,11 +778,19 @@ static HRESULT Date_toUTCString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, return S_OK; } +/* ECMA-262 3rd Edition 15.9.5.42 */ +static HRESULT Date_toUTCString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, + VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller) +{ + TRACE("\n"); + return create_utc_string(ctx, jsthis, retv, ei); +} + static HRESULT Date_toGMTString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller) { - FIXME("\n"); - return E_NOTIMPL; + TRACE("\n"); + return create_utc_string(ctx, jsthis, retv, ei); } /* ECMA-262 3rd Edition 15.9.5.3 */ diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index 268820cc504..ea1a5b2fb19 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -1874,6 +1874,7 @@ testFunctions(Date.prototype, [ ["toString", 0], ["toTimeString", 0], ["toUTCString", 0], + ["toGMTString", 0], ["valueOf", 0] ]);