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
346619d0
Commit
346619d0
authored
Jul 14, 2009
by
Piotr Caban
Committed by
Alexandre Julliard
Jul 14, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added Array length setting implementation.
parent
eeeb349e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
0 deletions
+52
-0
array.c
dlls/jscript/array.c
+28
-0
dispex.c
dlls/jscript/dispex.c
+16
-0
jscript.h
dlls/jscript/jscript.h
+1
-0
api.js
dlls/jscript/tests/api.js
+7
-0
No files found.
dlls/jscript/array.c
View file @
346619d0
...
@@ -16,6 +16,8 @@
...
@@ -16,6 +16,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
*/
#include <math.h>
#include "jscript.h"
#include "jscript.h"
#include "wine/debug.h"
#include "wine/debug.h"
...
@@ -60,6 +62,32 @@ static HRESULT Array_length(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
...
@@ -60,6 +62,32 @@ static HRESULT Array_length(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
V_VT
(
retv
)
=
VT_I4
;
V_VT
(
retv
)
=
VT_I4
;
V_I4
(
retv
)
=
This
->
length
;
V_I4
(
retv
)
=
This
->
length
;
break
;
break
;
case
DISPATCH_PROPERTYPUT
:
{
VARIANT
num
;
DOUBLE
len
=
-
1
;
DWORD
i
;
HRESULT
hres
;
hres
=
to_number
(
dispex
->
ctx
,
get_arg
(
dp
,
0
),
ei
,
&
num
);
if
(
V_VT
(
&
num
)
==
VT_I4
)
len
=
V_I4
(
&
num
);
else
len
=
floor
(
V_R8
(
&
num
));
if
(
len
!=
(
DWORD
)
len
)
{
FIXME
(
"Throw RangeError
\n
"
);
return
E_FAIL
;
}
for
(
i
=
len
;
i
<
This
->
length
;
i
++
)
{
hres
=
jsdisp_delete_idx
(
dispex
,
i
);
if
(
FAILED
(
hres
))
return
hres
;
}
This
->
length
=
len
;
break
;
}
default:
default:
FIXME
(
"unimplemented flags %x
\n
"
,
flags
);
FIXME
(
"unimplemented flags %x
\n
"
,
flags
);
return
E_NOTIMPL
;
return
E_NOTIMPL
;
...
...
dlls/jscript/dispex.c
View file @
346619d0
...
@@ -1010,3 +1010,19 @@ HRESULT disp_propget(IDispatch *disp, DISPID id, LCID lcid, VARIANT *val, jsexce
...
@@ -1010,3 +1010,19 @@ HRESULT disp_propget(IDispatch *disp, DISPID id, LCID lcid, VARIANT *val, jsexce
return
hres
;
return
hres
;
}
}
HRESULT
jsdisp_delete_idx
(
DispatchEx
*
obj
,
DWORD
idx
)
{
static
const
WCHAR
formatW
[]
=
{
'%'
,
'd'
,
0
};
WCHAR
buf
[
12
];
dispex_prop_t
*
prop
;
HRESULT
hres
;
sprintfW
(
buf
,
formatW
,
idx
);
hres
=
find_prop_name
(
obj
,
buf
,
&
prop
);
if
(
FAILED
(
hres
)
||
!
prop
)
return
hres
;
return
delete_prop
(
prop
);
}
dlls/jscript/jscript.h
View file @
346619d0
...
@@ -132,6 +132,7 @@ HRESULT jsdisp_propput_idx(DispatchEx*,DWORD,LCID,VARIANT*,jsexcept_t*,IServiceP
...
@@ -132,6 +132,7 @@ HRESULT jsdisp_propput_idx(DispatchEx*,DWORD,LCID,VARIANT*,jsexcept_t*,IServiceP
HRESULT
jsdisp_propget_name
(
DispatchEx
*
,
LPCWSTR
,
LCID
,
VARIANT
*
,
jsexcept_t
*
,
IServiceProvider
*
);
HRESULT
jsdisp_propget_name
(
DispatchEx
*
,
LPCWSTR
,
LCID
,
VARIANT
*
,
jsexcept_t
*
,
IServiceProvider
*
);
HRESULT
jsdisp_propget_idx
(
DispatchEx
*
,
DWORD
,
LCID
,
VARIANT
*
,
jsexcept_t
*
,
IServiceProvider
*
);
HRESULT
jsdisp_propget_idx
(
DispatchEx
*
,
DWORD
,
LCID
,
VARIANT
*
,
jsexcept_t
*
,
IServiceProvider
*
);
HRESULT
jsdisp_get_id
(
DispatchEx
*
,
const
WCHAR
*
,
DWORD
,
DISPID
*
);
HRESULT
jsdisp_get_id
(
DispatchEx
*
,
const
WCHAR
*
,
DWORD
,
DISPID
*
);
HRESULT
jsdisp_delete_idx
(
DispatchEx
*
,
DWORD
);
HRESULT
create_builtin_function
(
script_ctx_t
*
,
builtin_invoke_t
,
const
builtin_info_t
*
,
DWORD
,
HRESULT
create_builtin_function
(
script_ctx_t
*
,
builtin_invoke_t
,
const
builtin_info_t
*
,
DWORD
,
DispatchEx
*
,
DispatchEx
**
);
DispatchEx
*
,
DispatchEx
**
);
...
...
dlls/jscript/tests/api.js
View file @
346619d0
...
@@ -494,6 +494,13 @@ ok(arr.sort() === arr, "arr.sort() !== arr");
...
@@ -494,6 +494,13 @@ ok(arr.sort() === arr, "arr.sort() !== arr");
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
ok
(
arr
[
i
]
===
tmp
[
i
],
"arr["
+
i
+
"] = "
+
arr
[
i
]
+
" expected "
+
tmp
[
i
]);
ok
(
arr
[
i
]
===
tmp
[
i
],
"arr["
+
i
+
"] = "
+
arr
[
i
]
+
" expected "
+
tmp
[
i
]);
arr
=
[
"1"
,
"2"
,
"3"
];
arr
.
length
=
1
;
ok
(
arr
.
length
===
1
,
"arr.length = "
+
arr
.
length
);
arr
.
length
=
3
;
ok
(
arr
.
length
===
3
,
"arr.length = "
+
arr
.
length
);
ok
(
arr
.
toString
()
===
"1,,"
,
"arr.toString() = "
+
arr
.
toString
());
ok
(
arr
.
valueOf
===
Object
.
prototype
.
valueOf
,
"arr.valueOf !== Object.prototype.valueOf"
);
ok
(
arr
.
valueOf
===
Object
.
prototype
.
valueOf
,
"arr.valueOf !== Object.prototype.valueOf"
);
ok
(
arr
===
arr
.
valueOf
(),
"arr !== arr.valueOf"
);
ok
(
arr
===
arr
.
valueOf
(),
"arr !== arr.valueOf"
);
...
...
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