Jacek Caban : jscript: Pass 'this' as jsdisp_t to setters.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Feb 6 10:41:39 CST 2015


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Feb  6 12:09:47 2015 +0100

jscript: Pass 'this' as jsdisp_t to setters.

---

 dlls/jscript/array.c    |  4 ++--
 dlls/jscript/dispex.c   | 11 +++--------
 dlls/jscript/function.c |  2 +-
 dlls/jscript/jscript.h  |  4 ++--
 dlls/jscript/jsregexp.c | 12 ++++++------
 dlls/jscript/string.c   |  2 +-
 6 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/dlls/jscript/array.c b/dlls/jscript/array.c
index 6092555..a005309 100644
--- a/dlls/jscript/array.c
+++ b/dlls/jscript/array.c
@@ -126,9 +126,9 @@ static HRESULT Array_get_length(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
     return S_OK;
 }
 
-static HRESULT Array_set_length(script_ctx_t *ctx, vdisp_t *jsthis, jsval_t value)
+static HRESULT Array_set_length(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
 {
-    ArrayInstance *This = array_from_vdisp(jsthis);
+    ArrayInstance *This = array_from_jsdisp(jsthis);
     DOUBLE len = -1;
     DWORD i;
     HRESULT hres;
diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c
index 6f225da..40e1749 100644
--- a/dlls/jscript/dispex.c
+++ b/dlls/jscript/dispex.c
@@ -470,14 +470,9 @@ static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, jsval_t val, IServi
 
     switch(prop->type) {
     case PROP_BUILTIN:
-        if(prop->u.p->setter) {
-            vdisp_t vthis;
+        if(prop->u.p->setter)
+            return prop->u.p->setter(This->ctx, This, val);
 
-            set_jsdisp(&vthis, This);
-            hres = prop->u.p->setter(This->ctx, &vthis, val);
-            vdisp_release(&vthis);
-            return hres;
-        }
         if(prop->u.p->setter) {
             FIXME("getter with no setter\n");
             return E_FAIL;
@@ -512,7 +507,7 @@ static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, jsval_t val, IServi
     return S_OK;
 }
 
-HRESULT builtin_set_const(script_ctx_t *ctx, vdisp_t *jsthis, jsval_t value)
+HRESULT builtin_set_const(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
 {
     TRACE("%p %s\n", jsthis, debugstr_jsval(value));
     return S_OK;
diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c
index ec610cf..0ac6c61 100644
--- a/dlls/jscript/function.c
+++ b/dlls/jscript/function.c
@@ -375,7 +375,7 @@ static HRESULT Function_get_length(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t
     return S_OK;
 }
 
-static HRESULT Function_set_length(script_ctx_t *ctx, vdisp_t *jsthis, jsval_t value)
+static HRESULT Function_set_length(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
 {
     FIXME("\n");
     return E_NOTIMPL;
diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h
index 9dd772b..3cfc4ba 100644
--- a/dlls/jscript/jscript.h
+++ b/dlls/jscript/jscript.h
@@ -188,9 +188,9 @@ static inline jsdisp_t *get_jsdisp(vdisp_t *vdisp)
 
 typedef HRESULT (*builtin_invoke_t)(script_ctx_t*,vdisp_t*,WORD,unsigned,jsval_t*,jsval_t*);
 typedef HRESULT (*builtin_getter_t)(script_ctx_t*,jsdisp_t*,jsval_t*);
-typedef HRESULT (*builtin_setter_t)(script_ctx_t*,vdisp_t*,jsval_t);
+typedef HRESULT (*builtin_setter_t)(script_ctx_t*,jsdisp_t*,jsval_t);
 
-HRESULT builtin_set_const(script_ctx_t*,vdisp_t*,jsval_t) DECLSPEC_HIDDEN;
+HRESULT builtin_set_const(script_ctx_t*,jsdisp_t*,jsval_t) DECLSPEC_HIDDEN;
 
 typedef struct {
     const WCHAR *name;
diff --git a/dlls/jscript/jsregexp.c b/dlls/jscript/jsregexp.c
index ed3d0b1..402b527 100644
--- a/dlls/jscript/jsregexp.c
+++ b/dlls/jscript/jsregexp.c
@@ -256,7 +256,7 @@ static HRESULT RegExp_get_source(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r
     return S_OK;
 }
 
-static HRESULT RegExp_set_source(script_ctx_t *ctx, vdisp_t *jsthis, jsval_t value)
+static HRESULT RegExp_set_source(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
 {
     FIXME("\n");
     return E_NOTIMPL;
@@ -268,7 +268,7 @@ static HRESULT RegExp_get_global(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r
     return E_NOTIMPL;
 }
 
-static HRESULT RegExp_set_global(script_ctx_t *ctx, vdisp_t *jsthis, jsval_t value)
+static HRESULT RegExp_set_global(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
 {
     FIXME("\n");
     return E_NOTIMPL;
@@ -280,7 +280,7 @@ static HRESULT RegExp_get_ignoreCase(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_
     return E_NOTIMPL;
 }
 
-static HRESULT RegExp_set_ignoreCase(script_ctx_t *ctx, vdisp_t *jsthis, jsval_t value)
+static HRESULT RegExp_set_ignoreCase(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
 {
     FIXME("\n");
     return E_NOTIMPL;
@@ -292,7 +292,7 @@ static HRESULT RegExp_get_multiline(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t
     return E_NOTIMPL;
 }
 
-static HRESULT RegExp_set_multiline(script_ctx_t *ctx, vdisp_t *jsthis, jsval_t value)
+static HRESULT RegExp_set_multiline(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
 {
     FIXME("\n");
     return E_NOTIMPL;
@@ -322,9 +322,9 @@ static HRESULT RegExp_get_lastIndex(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t
     return jsval_copy(regexp->last_index_val, r);
 }
 
-static HRESULT RegExp_set_lastIndex(script_ctx_t *ctx, vdisp_t *jsthis, jsval_t value)
+static HRESULT RegExp_set_lastIndex(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
 {
-    RegExpInstance *regexp = regexp_from_vdisp(jsthis);
+    RegExpInstance *regexp = regexp_from_jsdisp(jsthis);
     HRESULT hres;
 
     TRACE("\n");
diff --git a/dlls/jscript/string.c b/dlls/jscript/string.c
index 3f83675..73de517 100644
--- a/dlls/jscript/string.c
+++ b/dlls/jscript/string.c
@@ -121,7 +121,7 @@ static HRESULT String_get_length(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r
     return S_OK;
 }
 
-static HRESULT String_set_length(script_ctx_t *ctx, vdisp_t *jsthis, jsval_t value)
+static HRESULT String_set_length(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
 {
     FIXME("%p\n", jsthis);
     return E_NOTIMPL;




More information about the wine-cvs mailing list