Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
d0aa78c0
Commit
d0aa78c0
authored
Jul 16, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Jul 16, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Don't set constructor property to each object instance, it belongs to their prototypes.
parent
49fd9032
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
20 deletions
+28
-20
dispex.c
dlls/jscript/dispex.c
+12
-16
function.c
dlls/jscript/function.c
+3
-1
jscript.h
dlls/jscript/jscript.h
+1
-0
lang.js
dlls/jscript/tests/lang.js
+12
-3
No files found.
dlls/jscript/dispex.c
View file @
d0aa78c0
...
...
@@ -922,7 +922,6 @@ HRESULT init_dispex_from_constr(jsdisp_t *dispex, script_ctx_t *ctx, const built
dispex_prop_t
*
prop
;
HRESULT
hres
;
static
const
WCHAR
constructorW
[]
=
{
'c'
,
'o'
,
'n'
,
's'
,
't'
,
'r'
,
'u'
,
'c'
,
't'
,
'o'
,
'r'
,
0
};
static
const
WCHAR
prototypeW
[]
=
{
'p'
,
'r'
,
'o'
,
't'
,
'o'
,
't'
,
'y'
,
'p'
,
'e'
,
0
};
hres
=
find_prop_name_prot
(
constr
,
string_hash
(
prototypeW
),
prototypeW
,
&
prop
);
...
...
@@ -947,21 +946,6 @@ HRESULT init_dispex_from_constr(jsdisp_t *dispex, script_ctx_t *ctx, const built
if
(
prot
)
jsdisp_release
(
prot
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
ensure_prop_name
(
dispex
,
constructorW
,
FALSE
,
0
,
&
prop
);
if
(
SUCCEEDED
(
hres
))
{
jsexcept_t
jsexcept
;
VARIANT
var
;
var_set_jsdisp
(
&
var
,
constr
);
memset
(
&
jsexcept
,
0
,
sizeof
(
jsexcept
));
hres
=
prop_put
(
dispex
,
prop
,
&
var
,
&
jsexcept
,
NULL
/*FIXME*/
);
}
if
(
FAILED
(
hres
))
jsdisp_release
(
dispex
);
return
hres
;
}
...
...
@@ -1245,6 +1229,18 @@ HRESULT jsdisp_propput_const(jsdisp_t *obj, const WCHAR *name, VARIANT *val)
return
VariantCopy
(
&
prop
->
u
.
var
,
val
);
}
HRESULT
jsdisp_propput_dontenum
(
jsdisp_t
*
obj
,
const
WCHAR
*
name
,
VARIANT
*
val
)
{
dispex_prop_t
*
prop
;
HRESULT
hres
;
hres
=
ensure_prop_name
(
obj
,
name
,
FALSE
,
0
,
&
prop
);
if
(
FAILED
(
hres
))
return
hres
;
return
VariantCopy
(
&
prop
->
u
.
var
,
val
);
}
HRESULT
jsdisp_propput_idx
(
jsdisp_t
*
obj
,
DWORD
idx
,
VARIANT
*
val
,
jsexcept_t
*
ei
)
{
WCHAR
buf
[
12
];
...
...
dlls/jscript/function.c
View file @
d0aa78c0
...
...
@@ -647,7 +647,7 @@ static HRESULT set_constructor_prop(script_ctx_t *ctx, jsdisp_t *constr, jsdisp_
V_VT
(
&
v
)
=
VT_DISPATCH
;
V_DISPATCH
(
&
v
)
=
to_disp
(
constr
);
return
jsdisp_propput_
name
(
prot
,
constructorW
,
&
v
,
NULL
);
return
jsdisp_propput_
dontenum
(
prot
,
constructorW
,
&
v
);
}
HRESULT
create_builtin_constructor
(
script_ctx_t
*
ctx
,
builtin_invoke_t
value_proc
,
const
WCHAR
*
name
,
...
...
@@ -684,6 +684,8 @@ HRESULT create_source_function(script_ctx_t *ctx, bytecode_t *code, function_cod
hres
=
create_function
(
ctx
,
NULL
,
PROPF_CONSTR
,
FALSE
,
NULL
,
&
function
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
set_prototype
(
ctx
,
&
function
->
dispex
,
prototype
);
if
(
SUCCEEDED
(
hres
))
hres
=
set_constructor_prop
(
ctx
,
&
function
->
dispex
,
prototype
);
if
(
FAILED
(
hres
))
jsdisp_release
(
&
function
->
dispex
);
}
...
...
dlls/jscript/jscript.h
View file @
d0aa78c0
...
...
@@ -216,6 +216,7 @@ HRESULT disp_propput(script_ctx_t*,IDispatch*,DISPID,VARIANT*,jsexcept_t*) DECLS
HRESULT
jsdisp_propget
(
jsdisp_t
*
,
DISPID
,
VARIANT
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_propput_name
(
jsdisp_t
*
,
const
WCHAR
*
,
VARIANT
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_propput_const
(
jsdisp_t
*
,
const
WCHAR
*
,
VARIANT
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_propput_dontenum
(
jsdisp_t
*
,
const
WCHAR
*
,
VARIANT
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_propput_idx
(
jsdisp_t
*
,
DWORD
,
VARIANT
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_propget_name
(
jsdisp_t
*
,
LPCWSTR
,
VARIANT
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_get_idx
(
jsdisp_t
*
,
DWORD
,
VARIANT
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
...
...
dlls/jscript/tests/lang.js
View file @
d0aa78c0
...
...
@@ -91,8 +91,15 @@ ok(Function.prototype.prototype === undefined, "Function.prototype.prototype is
ok
(
Date
.
prototype
!==
undefined
,
"Date.prototype is undefined"
);
ok
(
Date
.
prototype
.
prototype
===
undefined
,
"Date.prototype is not undefined"
);
function
testConstructor
(
constr
,
name
)
{
function
testConstructor
(
constr
,
name
,
inst
)
{
ok
(
constr
.
prototype
.
constructor
===
constr
,
name
+
".prototype.constructor !== "
+
name
);
ok
(
constr
.
prototype
.
hasOwnProperty
(
"constructor"
),
name
+
".prototype.hasOwnProperty('constructor')"
);
if
(
!
inst
)
inst
=
new
constr
();
ok
(
inst
.
constructor
===
constr
,
"(new "
+
name
+
"()).constructor !== "
+
name
);
ok
(
!
inst
.
hasOwnProperty
(
"constructor"
),
"(new "
+
name
+
"()).hasOwnProperty('constructor')"
);
}
testConstructor
(
Object
,
"Object"
);
...
...
@@ -100,10 +107,10 @@ testConstructor(String, "String");
testConstructor
(
Array
,
"Array"
);
testConstructor
(
Boolean
,
"Boolean"
);
testConstructor
(
Number
,
"Number"
);
testConstructor
(
RegExp
,
"RegExp"
);
testConstructor
(
RegExp
,
"RegExp"
,
/x/
);
testConstructor
(
Function
,
"Function"
);
testConstructor
(
Date
,
"Date"
);
testConstructor
(
VBArray
,
"VBArray"
);
testConstructor
(
VBArray
,
"VBArray"
,
new
VBArray
(
createArray
())
);
testConstructor
(
Error
,
"Error"
);
testConstructor
(
EvalError
,
"EvalError"
);
testConstructor
(
RangeError
,
"RangeError"
);
...
...
@@ -194,11 +201,13 @@ function testConstr1() {
}
testConstr1
.
prototype
.
pvar
=
1
;
ok
(
testConstr1
.
prototype
.
constructor
===
testConstr1
,
"testConstr1.prototype.constructor !== testConstr1"
);
var
obj2
=
new
testConstr1
(
true
);
ok
(
typeof
(
obj2
)
===
"object"
,
"typeof(obj2) is not object"
);
ok
(
obj2
.
constructor
===
testConstr1
,
"unexpected obj2.constructor"
);
ok
(
obj2
.
pvar
===
1
,
"obj2.pvar is not 1"
);
ok
(
!
obj2
.
hasOwnProperty
(
'constructor'
),
"obj2.hasOwnProperty('constructor')"
);
testConstr1
.
prototype
.
pvar
=
2
;
ok
(
obj2
.
pvar
===
2
,
"obj2.pvar is not 2"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment