jscript: Added ActiveXObject constructor stub implementation.

This commit is contained in:
Jacek Caban 2009-09-29 00:10:50 +02:00 committed by Alexandre Julliard
parent 2e92c726aa
commit 2ea23923a7
5 changed files with 64 additions and 3 deletions

View File

@ -16,6 +16,7 @@ RC_SRCS = \
rsrc.rc rsrc.rc
C_SRCS = \ C_SRCS = \
activex.c \
array.c \ array.c \
bool.c \ bool.c \
date.c \ date.c \

50
dlls/jscript/activex.c Normal file
View File

@ -0,0 +1,50 @@
/*
* Copyright 2009 Jacek Caban for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include "jscript.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
static HRESULT ActiveXObject_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT create_activex_constr(script_ctx_t *ctx, DispatchEx **ret)
{
DispatchEx *prototype;
HRESULT hres;
static const WCHAR ActiveXObjectW[] = {'A','c','t','i','v','e','X','O','b','j','e','c','t',0};
hres = create_object(ctx, NULL, &prototype);
if(FAILED(hres))
return hres;
hres = create_builtin_function(ctx, ActiveXObject_value, ActiveXObjectW, NULL, PROPF_CONSTR, prototype, ret);
jsdisp_release(prototype);
return hres;
}

View File

@ -274,8 +274,9 @@ static HRESULT JSGlobal_RegExp(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D
static HRESULT JSGlobal_ActiveXObject(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, static HRESULT JSGlobal_ActiveXObject(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{ {
FIXME("\n"); TRACE("\n");
return E_NOTIMPL;
return constructor_call(ctx->activex_constr, flags, dp, retv, ei, sp);
} }
static HRESULT JSGlobal_VBArray(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, static HRESULT JSGlobal_VBArray(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
@ -770,7 +771,7 @@ static HRESULT JSGlobal_encodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
} }
static const builtin_prop_t JSGlobal_props[] = { static const builtin_prop_t JSGlobal_props[] = {
{ActiveXObjectW, JSGlobal_ActiveXObject, PROPF_METHOD}, {ActiveXObjectW, JSGlobal_ActiveXObject, PROPF_CONSTR},
{ArrayW, JSGlobal_Array, PROPF_CONSTR}, {ArrayW, JSGlobal_Array, PROPF_CONSTR},
{BooleanW, JSGlobal_Boolean, PROPF_CONSTR}, {BooleanW, JSGlobal_Boolean, PROPF_CONSTR},
{CollectGarbageW, JSGlobal_CollectGarbage, PROPF_METHOD}, {CollectGarbageW, JSGlobal_CollectGarbage, PROPF_METHOD},
@ -828,6 +829,10 @@ static HRESULT init_constructors(script_ctx_t *ctx, DispatchEx *object_prototype
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
hres = create_activex_constr(ctx, &ctx->activex_constr);
if(FAILED(hres))
return hres;
hres = create_array_constr(ctx, object_prototype, &ctx->array_constr); hres = create_array_constr(ctx, object_prototype, &ctx->array_constr);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;

View File

@ -268,6 +268,7 @@ struct _script_ctx_t {
DispatchEx *global; DispatchEx *global;
DispatchEx *function_constr; DispatchEx *function_constr;
DispatchEx *activex_constr;
DispatchEx *array_constr; DispatchEx *array_constr;
DispatchEx *bool_constr; DispatchEx *bool_constr;
DispatchEx *date_constr; DispatchEx *date_constr;
@ -296,6 +297,7 @@ HRESULT init_global(script_ctx_t*);
HRESULT init_function_constr(script_ctx_t*,DispatchEx*); HRESULT init_function_constr(script_ctx_t*,DispatchEx*);
HRESULT create_object_prototype(script_ctx_t*,DispatchEx**); HRESULT create_object_prototype(script_ctx_t*,DispatchEx**);
HRESULT create_activex_constr(script_ctx_t*,DispatchEx**);
HRESULT create_array_constr(script_ctx_t*,DispatchEx*,DispatchEx**); HRESULT create_array_constr(script_ctx_t*,DispatchEx*,DispatchEx**);
HRESULT create_bool_constr(script_ctx_t*,DispatchEx*,DispatchEx**); HRESULT create_bool_constr(script_ctx_t*,DispatchEx*,DispatchEx**);
HRESULT create_date_constr(script_ctx_t*,DispatchEx*,DispatchEx**); HRESULT create_date_constr(script_ctx_t*,DispatchEx*,DispatchEx**);

View File

@ -1532,6 +1532,9 @@ ok(bool.toString() === "true", "bool.toString() = " + bool.toString());
ok(bool.valueOf() === Boolean(1), "bool.valueOf() = " + bool.valueOf()); ok(bool.valueOf() === Boolean(1), "bool.valueOf() = " + bool.valueOf());
ok(bool.toLocaleString() === bool.toString(), "bool.toLocaleString() = " + bool.toLocaleString()); ok(bool.toLocaleString() === bool.toString(), "bool.toLocaleString() = " + bool.toLocaleString());
ok(ActiveXObject instanceof Function, "ActiveXObject is not instance of Function");
ok(ActiveXObject.prototype instanceof Object, "ActiveXObject.prototype is not instance of Object");
ok(Error.prototype !== TypeError.prototype, "Error.prototype === TypeError.prototype"); ok(Error.prototype !== TypeError.prototype, "Error.prototype === TypeError.prototype");
ok(RangeError.prototype !== TypeError.prototype, "RangeError.prototype === TypeError.prototype"); ok(RangeError.prototype !== TypeError.prototype, "RangeError.prototype === TypeError.prototype");
ok(Error.prototype.toLocaleString === Object.prototype.toLocaleString, ok(Error.prototype.toLocaleString === Object.prototype.toLocaleString,