Jacek Caban : jscript: Don' t use builtin property for exposing ActiveXObject constructor.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Oct 13 11:18:10 CDT 2014


Module: wine
Branch: master
Commit: 0eec97e29bed40ea0770e06714eecf11eff43282
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0eec97e29bed40ea0770e06714eecf11eff43282

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Oct 13 12:36:30 2014 +0200

jscript: Don't use builtin property for exposing ActiveXObject constructor.

---

 dlls/jscript/global.c      | 24 ++++++++++--------------
 dlls/jscript/jscript.h     |  1 -
 dlls/jscript/tests/lang.js |  3 +++
 3 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/dlls/jscript/global.c b/dlls/jscript/global.c
index 4d1350f..5ae6019 100644
--- a/dlls/jscript/global.c
+++ b/dlls/jscript/global.c
@@ -249,14 +249,6 @@ static HRESULT JSGlobal_RegExp(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
     return constructor_call(ctx->regexp_constr, flags, argc, argv, r);
 }
 
-static HRESULT JSGlobal_ActiveXObject(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
-        jsval_t *r)
-{
-    TRACE("\n");
-
-    return constructor_call(ctx->activex_constr, flags, argc, argv, r);
-}
-
 static HRESULT JSGlobal_VBArray(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
         jsval_t *r)
 {
@@ -1087,7 +1079,6 @@ static HRESULT JSGlobal_decodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, W
 }
 
 static const builtin_prop_t JSGlobal_props[] = {
-    {ActiveXObjectW,             JSGlobal_ActiveXObject,             PROPF_CONSTR|1},
     {ArrayW,                     JSGlobal_Array,                     PROPF_CONSTR|1},
     {BooleanW,                   JSGlobal_Boolean,                   PROPF_CONSTR|1},
     {CollectGarbageW,            JSGlobal_CollectGarbage,            PROPF_METHOD},
@@ -1146,10 +1137,6 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
     if(FAILED(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);
     if(FAILED(hres))
         return hres;
@@ -1187,7 +1174,7 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
 
 HRESULT init_global(script_ctx_t *ctx)
 {
-    jsdisp_t *math, *object_prototype;
+    jsdisp_t *math, *object_prototype, *constr;
     HRESULT hres;
 
     if(ctx->global)
@@ -1215,6 +1202,15 @@ HRESULT init_global(script_ctx_t *ctx)
     if(FAILED(hres))
         return hres;
 
+    hres = create_activex_constr(ctx, &constr);
+    if(FAILED(hres))
+        return hres;
+
+    hres = jsdisp_propput_dontenum(ctx->global, ActiveXObjectW, jsval_obj(constr));
+    jsdisp_release(constr);
+    if(FAILED(hres))
+        return hres;
+
     hres = jsdisp_propput_dontenum(ctx->global, undefinedW, jsval_undefined());
     if(FAILED(hres))
         return hres;
diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h
index 0273b00..1e306b6 100644
--- a/dlls/jscript/jscript.h
+++ b/dlls/jscript/jscript.h
@@ -395,7 +395,6 @@ struct _script_ctx_t {
 
     jsdisp_t *global;
     jsdisp_t *function_constr;
-    jsdisp_t *activex_constr;
     jsdisp_t *array_constr;
     jsdisp_t *bool_constr;
     jsdisp_t *date_constr;
diff --git a/dlls/jscript/tests/lang.js b/dlls/jscript/tests/lang.js
index ccbdb51..a55bf75 100644
--- a/dlls/jscript/tests/lang.js
+++ b/dlls/jscript/tests/lang.js
@@ -1450,6 +1450,9 @@ function returnTest() {
 
 ok(returnTest() === undefined, "returnTest = " + returnTest());
 
+ActiveXObject = 1;
+ok(ActiveXObject === 1, "ActiveXObject = " + ActiveXObject);
+
 /* Keep this test in the end of file */
 undefined = 6;
 ok(undefined === 6, "undefined = " + undefined);




More information about the wine-cvs mailing list