Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
b5058ada
Commit
b5058ada
authored
Mar 15, 2019
by
Jacek Caban
Committed by
Alexandre Julliard
Mar 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Add Object.create implementation.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
05994cd6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
0 deletions
+53
-0
object.c
dlls/jscript/object.c
+41
-0
es5.js
dlls/mshtml/tests/es5.js
+12
-0
No files found.
dlls/jscript/object.c
View file @
b5058ada
...
...
@@ -32,6 +32,7 @@ static const WCHAR propertyIsEnumerableW[] =
{
'p'
,
'r'
,
'o'
,
'p'
,
'e'
,
'r'
,
't'
,
'y'
,
'I'
,
's'
,
'E'
,
'n'
,
'u'
,
'm'
,
'e'
,
'r'
,
'a'
,
'b'
,
'l'
,
'e'
,
0
};
static
const
WCHAR
isPrototypeOfW
[]
=
{
'i'
,
's'
,
'P'
,
'r'
,
'o'
,
't'
,
'o'
,
't'
,
'y'
,
'p'
,
'e'
,
'O'
,
'f'
,
0
};
static
const
WCHAR
createW
[]
=
{
'c'
,
'r'
,
'e'
,
'a'
,
't'
,
'e'
,
0
};
static
const
WCHAR
getOwnPropertyDescriptorW
[]
=
{
'g'
,
'e'
,
't'
,
'O'
,
'w'
,
'n'
,
'P'
,
'r'
,
'o'
,
'p'
,
'e'
,
'r'
,
't'
,
'y'
,
'D'
,
'e'
,
's'
,
'c'
,
'r'
,
'i'
,
'p'
,
't'
,
'o'
,
'r'
,
0
};
static
const
WCHAR
getPrototypeOfW
[]
=
...
...
@@ -521,6 +522,45 @@ static HRESULT Object_getOwnPropertyDescriptor(script_ctx_t *ctx, vdisp_t *jsthi
return
hres
;
}
static
HRESULT
Object_create
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
jsdisp_t
*
proto
=
NULL
,
*
obj
;
HRESULT
hres
;
if
(
!
argc
||
(
!
is_object_instance
(
argv
[
0
])
&&
!
is_null
(
argv
[
0
])))
{
FIXME
(
"Invalid arg
\n
"
);
return
E_INVALIDARG
;
}
TRACE
(
"(%s)
\n
"
,
debugstr_jsval
(
argv
[
0
]));
if
(
argc
>
1
)
{
FIXME
(
"Unsupported properties argument %s
\n
"
,
debugstr_jsval
(
argv
[
1
]));
return
E_NOTIMPL
;
}
if
(
argc
&&
is_object_instance
(
argv
[
0
]))
{
if
(
get_object
(
argv
[
0
]))
proto
=
to_jsdisp
(
get_object
(
argv
[
0
]));
if
(
!
proto
)
{
FIXME
(
"Non-JS prototype
\n
"
);
return
E_NOTIMPL
;
}
}
else
if
(
!
is_null
(
argv
[
0
]))
{
FIXME
(
"Invalid arg %s
\n
"
,
debugstr_jsval
(
argc
?
argv
[
0
]
:
jsval_undefined
()));
return
E_INVALIDARG
;
}
if
(
r
)
{
hres
=
create_dispex
(
ctx
,
NULL
,
proto
,
&
obj
);
if
(
FAILED
(
hres
))
return
hres
;
*
r
=
jsval_obj
(
obj
);
}
return
S_OK
;
}
static
HRESULT
Object_getPrototypeOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
...
...
@@ -547,6 +587,7 @@ static HRESULT Object_getPrototypeOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl
}
static
const
builtin_prop_t
ObjectConstr_props
[]
=
{
{
createW
,
Object_create
,
PROPF_ES5
|
PROPF_METHOD
|
2
},
{
definePropertiesW
,
Object_defineProperties
,
PROPF_ES5
|
PROPF_METHOD
|
2
},
{
definePropertyW
,
Object_defineProperty
,
PROPF_ES5
|
PROPF_METHOD
|
2
},
{
getOwnPropertyDescriptorW
,
Object_getOwnPropertyDescriptor
,
PROPF_ES5
|
PROPF_METHOD
|
2
},
...
...
dlls/mshtml/tests/es5.js
View file @
b5058ada
...
...
@@ -637,6 +637,9 @@ function test_string_split() {
}
function
test_getPrototypeOf
()
{
ok
(
Object
.
create
.
length
===
2
,
"Object.create.length = "
+
Object
.
create
.
length
);
ok
(
Object
.
getPrototypeOf
.
length
===
1
,
"Object.getPrototypeOf.length = "
+
Object
.
getPrototypeOf
.
length
);
ok
(
Object
.
getPrototypeOf
(
new
Object
())
===
Object
.
prototype
,
"Object.getPrototypeOf(new Object()) !== Object.prototype"
);
...
...
@@ -660,6 +663,15 @@ function test_getPrototypeOf() {
ok
(
Object
.
getPrototypeOf
(
Object
.
prototype
)
===
null
,
"Object.getPrototypeOf(Object.prototype) !== null"
);
obj
=
Object
.
create
(
proto
=
{
test
:
1
});
ok
(
Object
.
getPrototypeOf
(
obj
)
===
proto
,
"Object.getPrototypeOf(obj) !== proto"
);
ok
(
obj
.
test
===
1
,
"obj.test = "
+
obj
.
test
);
obj
=
Object
.
create
(
null
);
ok
(
!
(
"toString"
in
obj
),
"toString is in obj"
);
ok
(
Object
.
getPrototypeOf
(
obj
)
===
null
,
"Object.getPrototypeOf(obj) = "
+
Object
.
getPrototypeOf
(
obj
));
next_test
();
}
...
...
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