Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ekaterine Papava
wine
Commits
627e5b3b
Commit
627e5b3b
authored
1 year ago
by
Gabriel Ivăncescu
Committed by
Alexandre Julliard
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
jscript: Return undefined for empty RegExp captures in ES5+ mode.
Signed-off-by:
Gabriel Ivăncescu
<
gabrielopcode@gmail.com
>
parent
ce453e42
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dlls/jscript/jsregexp.c
+14
-9
14 additions, 9 deletions
dlls/jscript/jsregexp.c
dlls/jscript/tests/regexp.js
+12
-0
12 additions, 0 deletions
dlls/jscript/tests/regexp.js
dlls/mshtml/tests/es5.js
+16
-0
16 additions, 0 deletions
dlls/mshtml/tests/es5.js
with
42 additions
and
9 deletions
dlls/jscript/jsregexp.c
+
14
−
9
View file @
627e5b3b
...
...
@@ -361,17 +361,22 @@ static HRESULT create_match_array(script_ctx_t *ctx, jsstr_t *input_str,
return
hres
;
for
(
i
=
0
;
i
<
result
->
paren_count
;
i
++
)
{
if
(
result
->
parens
[
i
].
index
!=
-
1
)
str
=
jsstr_substr
(
input_str
,
result
->
parens
[
i
].
index
,
result
->
parens
[
i
].
length
);
else
str
=
jsstr_empty
();
if
(
!
str
)
{
hres
=
E_OUTOFMEMORY
;
break
;
jsval_t
val
;
if
(
result
->
parens
[
i
].
index
!=
-
1
)
{
if
(
!
(
str
=
jsstr_substr
(
input_str
,
result
->
parens
[
i
].
index
,
result
->
parens
[
i
].
length
)))
{
hres
=
E_OUTOFMEMORY
;
break
;
}
val
=
jsval_string
(
str
);
}
else
if
(
ctx
->
version
<
SCRIPTLANGUAGEVERSION_ES5
)
{
val
=
jsval_string
(
jsstr_empty
());
}
else
{
val
=
jsval_undefined
();
}
hres
=
jsdisp_propput_idx
(
array
,
i
+
1
,
js
val
_string
(
str
)
);
js
str
_release
(
str
);
hres
=
jsdisp_propput_idx
(
array
,
i
+
1
,
val
);
js
val
_release
(
val
);
if
(
FAILED
(
hres
))
break
;
}
...
...
This diff is collapsed.
Click to expand it.
dlls/jscript/tests/regexp.js
+
12
−
0
View file @
627e5b3b
...
...
@@ -625,6 +625,18 @@ ok(tmp === "x*y", '"x/y".replace(/[/]/, "*") = ' + tmp);
tmp
=
"
x/y
"
.
replace
(
/
[
xy
/]
/g
,
"
*
"
);
ok
(
tmp
===
"
***
"
,
'
"x/y".replace(/[xy/]/, "*") =
'
+
tmp
);
tmp
=
/
()
/
.
exec
(
""
)[
1
];
ok
(
tmp
===
""
,
"
/()/ captured:
"
+
tmp
);
tmp
=
/
()?
/
.
exec
(
""
)[
1
];
ok
(
tmp
===
""
,
"
/()?/ captured:
"
+
tmp
);
tmp
=
/
()??
/
.
exec
(
""
)[
1
];
ok
(
tmp
===
""
,
"
/()??/ captured:
"
+
tmp
);
tmp
=
/
()
*/
.
exec
(
""
)[
1
];
ok
(
tmp
===
""
,
"
/()*/ captured:
"
+
tmp
);
tmp
=
/
()??()
/
.
exec
(
""
);
ok
(
tmp
[
1
]
===
""
,
"
/()??()/ [1] captured:
"
+
tmp
);
ok
(
tmp
[
2
]
===
""
,
"
/()??()/ [2] captured:
"
+
tmp
);
/
(
b
)
/
.
exec
(
"
abc
"
);
ok
(
RegExp
.
$1
===
"
b
"
,
"
RegExp.$1 =
"
+
RegExp
.
$1
);
ok
(
"
$2
"
in
RegExp
,
"
RegExp.$2 doesn't exist
"
);
...
...
This diff is collapsed.
Click to expand it.
dlls/mshtml/tests/es5.js
+
16
−
0
View file @
627e5b3b
...
...
@@ -1610,6 +1610,22 @@ sync_test("isFrozen", function() {
}
});
sync_test
(
"
RegExp
"
,
function
()
{
var
r
;
r
=
/
()
/
.
exec
(
""
)[
1
];
ok
(
r
===
""
,
"
/()/ captured:
"
+
r
);
r
=
/
()?
/
.
exec
(
""
)[
1
];
ok
(
r
===
undefined
,
"
/()?/ captured:
"
+
r
);
r
=
/
()??
/
.
exec
(
""
)[
1
];
ok
(
r
===
undefined
,
"
/()??/ captured:
"
+
r
);
r
=
/
()
*/
.
exec
(
""
)[
1
];
ok
(
r
===
undefined
,
"
/()*/ captured:
"
+
r
);
r
=
/
()??()
/
.
exec
(
""
);
ok
(
r
[
1
]
===
undefined
,
"
/()??()/ [1] captured:
"
+
r
);
ok
(
r
[
2
]
===
""
,
"
/()??()/ [2] captured:
"
+
r
);
});
sync_test
(
"
builtin_context
"
,
function
()
{
var
nullDisp
=
external
.
nullDisp
;
var
tests
=
[
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment