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
3805eef4
Commit
3805eef4
authored
Nov 22, 2022
by
Gabriel Ivăncescu
Committed by
Alexandre Julliard
Nov 23, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Initialize source and lastIndex for RegExp.prototype.
Signed-off-by:
Gabriel Ivăncescu
<
gabrielopcode@gmail.com
>
parent
f8a0d965
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
jsregexp.c
dlls/jscript/jsregexp.c
+8
-6
api.js
dlls/jscript/tests/api.js
+2
-0
No files found.
dlls/jscript/jsregexp.c
View file @
3805eef4
...
...
@@ -585,7 +585,7 @@ static const builtin_info_t RegExpInst_info = {
NULL
};
static
HRESULT
alloc_regexp
(
script_ctx_t
*
ctx
,
jsdisp_t
*
object_prototype
,
RegExpInstance
**
ret
)
static
HRESULT
alloc_regexp
(
script_ctx_t
*
ctx
,
js
str_t
*
str
,
js
disp_t
*
object_prototype
,
RegExpInstance
**
ret
)
{
RegExpInstance
*
regexp
;
HRESULT
hres
;
...
...
@@ -604,6 +604,9 @@ static HRESULT alloc_regexp(script_ctx_t *ctx, jsdisp_t *object_prototype, RegEx
return
hres
;
}
regexp
->
str
=
jsstr_addref
(
str
);
regexp
->
last_index_val
=
jsval_number
(
0
);
*
ret
=
regexp
;
return
S_OK
;
}
...
...
@@ -620,13 +623,10 @@ HRESULT create_regexp(script_ctx_t *ctx, jsstr_t *src, DWORD flags, jsdisp_t **r
TRACE
(
"%s %lx
\n
"
,
debugstr_wn
(
str
,
jsstr_length
(
src
)),
flags
);
hres
=
alloc_regexp
(
ctx
,
NULL
,
&
regexp
);
hres
=
alloc_regexp
(
ctx
,
src
,
NULL
,
&
regexp
);
if
(
FAILED
(
hres
))
return
hres
;
regexp
->
str
=
jsstr_addref
(
src
);
regexp
->
last_index_val
=
jsval_number
(
0
);
regexp
->
jsregexp
=
regexp_new
(
ctx
,
&
ctx
->
tmp_heap
,
str
,
jsstr_length
(
regexp
->
str
),
flags
,
FALSE
);
if
(
!
regexp
->
jsregexp
)
{
WARN
(
"regexp_new failed
\n
"
);
...
...
@@ -959,10 +959,12 @@ static const builtin_info_t RegExpConstr_info = {
HRESULT
create_regexp_constr
(
script_ctx_t
*
ctx
,
jsdisp_t
*
object_prototype
,
jsdisp_t
**
ret
)
{
jsstr_t
*
str
=
jsstr_empty
();
RegExpInstance
*
regexp
;
HRESULT
hres
;
hres
=
alloc_regexp
(
ctx
,
object_prototype
,
&
regexp
);
hres
=
alloc_regexp
(
ctx
,
str
,
object_prototype
,
&
regexp
);
jsstr_release
(
str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
dlls/jscript/tests/api.js
View file @
3805eef4
...
...
@@ -335,6 +335,8 @@ ok(obj.hasOwnProperty('source'), "obj.hasOwnProperty('source') is false");
ok
(
!
RegExp
.
hasOwnProperty
(
'exec'
),
"RegExp.hasOwnProperty('exec') is true"
);
ok
(
!
RegExp
.
hasOwnProperty
(
'source'
),
"RegExp.hasOwnProperty('source') is true"
);
ok
(
RegExp
.
prototype
.
hasOwnProperty
(
'source'
),
"RegExp.prototype.hasOwnProperty('source') is false"
);
ok
(
RegExp
.
prototype
.
source
===
""
,
"RegExp.prototype.source = "
+
RegExp
.
prototype
.
source
);
ok
(
RegExp
.
prototype
.
lastIndex
===
0
,
"RegExp.prototype.lastIndex = "
+
RegExp
.
prototype
.
lastIndex
);
String
();
new
String
();
...
...
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