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
0e5933f7
Commit
0e5933f7
authored
Nov 30, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Nov 30, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added support for indexed string access.
parent
956cb343
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
1 deletion
+49
-1
string.c
dlls/jscript/string.c
+32
-1
api.js
dlls/jscript/tests/api.js
+3
-0
lang.js
dlls/jscript/tests/lang.js
+14
-0
No files found.
dlls/jscript/string.c
View file @
0e5933f7
...
...
@@ -1396,6 +1396,35 @@ static void String_destructor(jsdisp_t *dispex)
heap_free
(
This
);
}
static
unsigned
String_idx_length
(
jsdisp_t
*
jsdisp
)
{
StringInstance
*
string
=
(
StringInstance
*
)
jsdisp
;
/*
* NOTE: For invoke version < 2, indexed array is not implemented at all.
* Newer jscript.dll versions implement it on string type, not class,
* which is not how it should work according to spec. IE9 implements it
* properly, but it uses its own JavaScript engine inside MSHTML. We
* implement it here, but in the way IE9 and spec work.
*/
return
string
->
dispex
.
ctx
->
version
<
2
?
0
:
jsstr_length
(
string
->
str
);
}
static
HRESULT
String_idx_get
(
jsdisp_t
*
jsdisp
,
unsigned
idx
,
jsval_t
*
r
)
{
StringInstance
*
string
=
(
StringInstance
*
)
jsdisp
;
jsstr_t
*
ret
;
TRACE
(
"%p[%u] = %s
\n
"
,
string
,
idx
,
debugstr_wn
(
string
->
str
->
str
+
idx
,
1
));
ret
=
jsstr_alloc_len
(
string
->
str
->
str
+
idx
,
1
);
if
(
!
ret
)
return
E_OUTOFMEMORY
;
*
r
=
jsval_string
(
ret
);
return
S_OK
;
}
static
const
builtin_prop_t
String_props
[]
=
{
{
anchorW
,
String_anchor
,
PROPF_METHOD
|
1
},
{
bigW
,
String_big
,
PROPF_METHOD
},
...
...
@@ -1451,7 +1480,9 @@ static const builtin_info_t StringInst_info = {
sizeof
(
StringInst_props
)
/
sizeof
(
*
StringInst_props
),
StringInst_props
,
String_destructor
,
NULL
NULL
,
String_idx_length
,
String_idx_get
};
/* ECMA-262 3rd Edition 15.5.3.2 */
...
...
dlls/jscript/tests/api.js
View file @
0e5933f7
...
...
@@ -1785,6 +1785,9 @@ function callTest(argc) {
ok
(
arguments
.
length
===
argc
+
1
,
"arguments.length = "
+
arguments
.
length
+
" expected "
+
(
argc
+
1
));
for
(
var
i
=
1
;
i
<=
argc
;
i
++
)
ok
(
arguments
[
i
]
===
i
,
"arguments[i] = "
+
arguments
[
i
]);
var
a
=
arguments
;
for
(
var
i
=
1
;
i
<=
argc
;
i
++
)
ok
(
a
[
i
]
===
i
,
"a[i] = "
+
a
[
i
]);
}
callTest
.
call
(
tmp
,
1
,
1
);
...
...
dlls/jscript/tests/lang.js
View file @
0e5933f7
...
...
@@ -1199,6 +1199,20 @@ try {
}
catch
(
e
)
{}
ok
(
!
(
"prop"
in
obj
),
"prop in obj"
);
if
(
invokeVersion
>=
2
)
{
ok
(
"test"
[
0
]
===
"t"
,
'"test"[0] = '
+
test
[
0
]);
ok
(
"test"
[
5
]
===
undefined
,
'"test"[0] = '
+
test
[
0
]);
tmp
=
"test"
;
ok
(
tmp
[
1
]
===
"e"
,
"tmp[1] = "
+
tmp
[
1
]);
tmp
[
1
]
=
"x"
;
ok
(
tmp
[
1
]
===
"e"
,
"tmp[1] = "
+
tmp
[
1
]);
ok
(
tmp
[
"1"
]
===
"e"
,
"tmp['1'] = "
+
tmp
[
"1"
]);
ok
(
tmp
[
"0x1"
]
===
undefined
,
"tmp['0x1'] = "
+
tmp
[
"0x1"
]);
}
else
{
ok
(
"test"
[
0
]
===
undefined
,
'"test"[0] = '
+
test
[
0
]);
}
ok
(
isNaN
(
NaN
)
===
true
,
"isNaN(NaN) !== true"
);
ok
(
isNaN
(
0.5
)
===
false
,
"isNaN(0.5) !== false"
);
ok
(
isNaN
(
Infinity
)
===
false
,
"isNaN(Infinity) !== false"
);
...
...
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