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
4e887493
Commit
4e887493
authored
Jun 05, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Jun 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Support passing non-string pattern to RegExp constructor.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ccd6b205
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
17 deletions
+38
-17
jsregexp.c
dlls/jscript/jsregexp.c
+14
-17
regexp.js
dlls/jscript/tests/regexp.js
+24
-0
No files found.
dlls/jscript/jsregexp.c
View file @
4e887493
...
...
@@ -674,7 +674,7 @@ HRESULT create_regexp_var(script_ctx_t *ctx, jsval_t src_arg, jsval_t *flags_arg
unsigned
flags
,
opt_len
=
0
;
const
WCHAR
*
opt
=
NULL
;
jsstr_t
*
src
;
HRESULT
hres
;
HRESULT
hres
=
S_OK
;
if
(
is_object_instance
(
src_arg
))
{
jsdisp_t
*
obj
;
...
...
@@ -693,12 +693,12 @@ HRESULT create_regexp_var(script_ctx_t *ctx, jsval_t src_arg, jsval_t *flags_arg
}
}
if
(
!
is_string
(
src_arg
))
{
FIXME
(
"src_arg = %s
\n
"
,
debugstr_jsval
(
src_arg
)
);
return
E_NOTIMPL
;
}
src
=
get_string
(
src_arg
)
;
if
(
is_undefined
(
src_arg
))
src
=
jsstr_empty
(
);
else
hres
=
to_string
(
ctx
,
src_arg
,
&
src
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
flags_arg
)
{
jsstr_t
*
opt_str
;
...
...
@@ -710,16 +710,18 @@ HRESULT create_regexp_var(script_ctx_t *ctx, jsval_t src_arg, jsval_t *flags_arg
opt_str
=
get_string
(
*
flags_arg
);
opt
=
jsstr_flatten
(
opt_str
);
if
(
!
opt
)
if
(
!
opt
)
{
jsstr_release
(
src
);
return
E_OUTOFMEMORY
;
}
opt_len
=
jsstr_length
(
opt_str
);
}
hres
=
parse_regexp_flags
(
opt
,
opt_len
,
&
flags
);
if
(
FAILED
(
hres
))
if
(
SUCCEEDED
(
hres
))
hres
=
create_regexp
(
ctx
,
src
,
flags
,
ret
);
jsstr_release
(
src
);
return
hres
;
return
create_regexp
(
ctx
,
src
,
flags
,
ret
);
}
HRESULT
regexp_string_match
(
script_ctx_t
*
ctx
,
jsdisp_t
*
re
,
jsstr_t
*
jsstr
,
jsval_t
*
r
)
...
...
@@ -953,12 +955,7 @@ static HRESULT RegExpConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
jsdisp_t
*
ret
;
HRESULT
hres
;
if
(
!
argc
)
{
FIXME
(
"no args
\n
"
);
return
E_NOTIMPL
;
}
hres
=
create_regexp_var
(
ctx
,
argv
[
0
],
argc
>
1
?
argv
+
1
:
NULL
,
&
ret
);
hres
=
create_regexp_var
(
ctx
,
argc
?
argv
[
0
]
:
jsval_undefined
(),
argc
>
1
?
argv
+
1
:
NULL
,
&
ret
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
dlls/jscript/tests/regexp.js
View file @
4e887493
...
...
@@ -677,4 +677,28 @@ ok(re.ignoreCase === false, "re.ignoreCase = " + re.ignoreCase);
ok
(
re
.
multiline
===
true
,
"re.multiline = "
+
re
.
multiline
);
ok
(
re
.
global
===
true
,
"re.global = "
+
re
.
global
);
re
=
new
RegExp
(
undefined
);
ok
(
re
.
source
===
""
,
"re.source = "
+
re
.
source
);
ok
(
re
.
ignoreCase
===
false
,
"re.ignoreCase = "
+
re
.
ignoreCase
);
ok
(
re
.
multiline
===
false
,
"re.multiline = "
+
re
.
multiline
);
ok
(
re
.
global
===
false
,
"re.global = "
+
re
.
global
);
re
=
new
RegExp
();
ok
(
re
.
source
===
""
,
"re.source = "
+
re
.
source
);
ok
(
re
.
ignoreCase
===
false
,
"re.ignoreCase = "
+
re
.
ignoreCase
);
ok
(
re
.
multiline
===
false
,
"re.multiline = "
+
re
.
multiline
);
ok
(
re
.
global
===
false
,
"re.global = "
+
re
.
global
);
re
=
new
RegExp
(
true
);
ok
(
re
.
source
===
"true"
,
"re.source = "
+
re
.
source
);
ok
(
re
.
ignoreCase
===
false
,
"re.ignoreCase = "
+
re
.
ignoreCase
);
ok
(
re
.
multiline
===
false
,
"re.multiline = "
+
re
.
multiline
);
ok
(
re
.
global
===
false
,
"re.global = "
+
re
.
global
);
re
=
new
RegExp
({
toString
:
function
()
{
return
"test"
;
}
});
ok
(
re
.
source
===
"test"
,
"re.source = "
+
re
.
source
);
ok
(
re
.
ignoreCase
===
false
,
"re.ignoreCase = "
+
re
.
ignoreCase
);
ok
(
re
.
multiline
===
false
,
"re.multiline = "
+
re
.
multiline
);
ok
(
re
.
global
===
false
,
"re.global = "
+
re
.
global
);
reportSuccess
();
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