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
8cb5d741
Commit
8cb5d741
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: Pass correct 'this' to callbacks called by builtins.
Signed-off-by:
Gabriel Ivăncescu
<
gabrielopcode@gmail.com
>
parent
da842966
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
45 deletions
+21
-45
array.c
dlls/jscript/array.c
+6
-37
set.c
dlls/jscript/set.c
+1
-6
documentmode.js
dlls/mshtml/tests/documentmode.js
+4
-2
es5.js
dlls/mshtml/tests/es5.js
+10
-0
No files found.
dlls/jscript/array.c
View file @
8cb5d741
...
...
@@ -1048,14 +1048,8 @@ static HRESULT Array_every(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigne
}
callback
=
get_object
(
argv
[
0
]);
if
(
argc
>
1
&&
!
is_undefined
(
argv
[
1
]))
{
if
(
!
is_object_instance
(
argv
[
1
]))
{
FIXME
(
"Unsupported context this %s
\n
"
,
debugstr_jsval
(
argv
[
1
]));
hres
=
E_NOTIMPL
;
goto
done
;
}
if
(
argc
>
1
)
context_this
=
argv
[
1
];
}
for
(
i
=
0
;
i
<
length
;
i
++
)
{
hres
=
jsdisp_get_idx
(
jsthis
,
i
,
&
value
);
...
...
@@ -1115,14 +1109,8 @@ static HRESULT Array_filter(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsign
}
callback
=
get_object
(
argv
[
0
]);
if
(
argc
>
1
&&
!
is_undefined
(
argv
[
1
]))
{
if
(
!
is_object_instance
(
argv
[
1
]))
{
FIXME
(
"Unsupported context this %s
\n
"
,
debugstr_jsval
(
argv
[
1
]));
hres
=
E_NOTIMPL
;
goto
done
;
}
if
(
argc
>
1
)
context_this
=
argv
[
1
];
}
hres
=
create_array
(
ctx
,
0
,
&
arr
);
if
(
FAILED
(
hres
))
...
...
@@ -1189,14 +1177,8 @@ static HRESULT Array_forEach(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsig
}
callback
=
get_object
(
argv
[
0
]);
if
(
argc
>
1
&&
!
is_undefined
(
argv
[
1
]))
{
if
(
!
is_object_instance
(
argv
[
1
]))
{
FIXME
(
"Unsupported context this %s
\n
"
,
debugstr_jsval
(
argv
[
1
]));
hres
=
E_NOTIMPL
;
goto
done
;
}
if
(
argc
>
1
)
context_this
=
argv
[
1
];
}
for
(
i
=
0
;
i
<
length
;
i
++
)
{
hres
=
jsdisp_get_idx
(
jsthis
,
i
,
&
value
);
...
...
@@ -1367,15 +1349,8 @@ static HRESULT Array_map(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned
}
callback
=
get_object
(
argv
[
0
]);
if
(
argc
>
1
)
{
if
(
is_object_instance
(
argv
[
1
]))
{
context_this
=
argv
[
1
];
}
else
if
(
!
is_undefined
(
argv
[
1
]))
{
FIXME
(
"Unsupported context this %s
\n
"
,
debugstr_jsval
(
argv
[
1
]));
hres
=
E_NOTIMPL
;
goto
done
;
}
}
if
(
argc
>
1
)
context_this
=
argv
[
1
];
hres
=
create_array
(
ctx
,
length
,
&
array
);
if
(
FAILED
(
hres
))
...
...
@@ -1505,14 +1480,8 @@ static HRESULT Array_some(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned
}
callback
=
get_object
(
argv
[
0
]);
if
(
argc
>
1
&&
!
is_undefined
(
argv
[
1
]))
{
if
(
!
is_object_instance
(
argv
[
1
]))
{
FIXME
(
"Unsupported context this %s
\n
"
,
debugstr_jsval
(
argv
[
1
]));
hres
=
E_NOTIMPL
;
goto
done
;
}
if
(
argc
>
1
)
context_this
=
argv
[
1
];
}
for
(
i
=
0
;
i
<
length
;
i
++
)
{
hres
=
jsdisp_get_idx
(
jsthis
,
i
,
&
value
);
...
...
dlls/jscript/set.c
View file @
8cb5d741
...
...
@@ -192,13 +192,8 @@ static HRESULT iterate_map(MapInstance *map, script_ctx_t *ctx, unsigned argc, j
return
E_FAIL
;
}
if
(
argc
>
1
&&
!
is_undefined
(
argv
[
1
]))
{
if
(
!
is_object_instance
(
argv
[
1
]))
{
FIXME
(
"Unsupported context this %s
\n
"
,
debugstr_jsval
(
argv
[
1
]));
return
E_NOTIMPL
;
}
if
(
argc
>
1
)
context_this
=
argv
[
1
];
}
while
(
iter
)
{
struct
jsval_map_entry
*
entry
=
LIST_ENTRY
(
iter
,
struct
jsval_map_entry
,
list_entry
);
...
...
dlls/mshtml/tests/documentmode.js
View file @
8cb5d741
...
...
@@ -1293,7 +1293,8 @@ sync_test("set_obj", function() {
r
++
;
s
.
clear
();
ok
(
s
.
size
===
0
,
"size = "
+
s
.
size
);
});
ok
(
this
.
valueOf
()
===
42
,
"this.valueOf() = "
+
this
.
valueOf
());
},
42
);
ok
(
r
===
1
,
"r = "
+
r
);
});
...
...
@@ -1447,7 +1448,8 @@ sync_test("map_obj", function() {
r
++
;
s
.
clear
();
ok
(
s
.
size
===
0
,
"size = "
+
s
.
size
);
});
ok
(
this
.
valueOf
()
===
42
,
"this.valueOf() = "
+
this
.
valueOf
());
},
42
);
ok
(
r
===
1
,
"r = "
+
r
);
});
...
...
dlls/mshtml/tests/es5.js
View file @
8cb5d741
...
...
@@ -280,6 +280,8 @@ sync_test("filter", function() {
test
([
"a"
,
"b"
],
function
(
v
)
{
if
(
v
===
"b"
)
delete
arr
[
0
];
return
typeof
v
===
"string"
;
});
test
([
"b"
],
function
(
v
)
{
if
(
arr
[
arr
.
length
-
1
]
!==
"c"
)
arr
.
push
(
"c"
);
return
typeof
v
===
"string"
;
});
test
([
true
,
"b"
,
42
,
Math
,
arr
[
9
],
"c"
],
function
(
v
)
{
return
v
;
},
Object
);
[
0
].
filter
(
function
()
{
ok
(
this
.
valueOf
()
===
"wine"
,
"this.valueOf() = "
+
this
.
valueOf
());
return
true
;
},
"wine"
);
});
sync_test
(
"every & some"
,
function
()
{
...
...
@@ -314,6 +316,9 @@ sync_test("every & some", function() {
test
(
false
,
false
,
function
(
v
)
{
return
v
;
});
arr
.
push
(
1
);
test
(
false
,
true
,
function
(
v
)
{
return
v
;
});
[
0
].
every
(
function
()
{
ok
(
this
.
valueOf
()
===
42
,
"this.valueOf() = "
+
this
.
valueOf
());
return
true
;
},
42
);
[
0
].
some
(
function
()
{
ok
(
this
.
valueOf
()
===
137
,
"this.valueOf() = "
+
this
.
valueOf
());
return
false
;
},
137
);
});
sync_test
(
"forEach"
,
function
()
{
...
...
@@ -347,6 +352,8 @@ sync_test("forEach", function() {
ok
(
array
===
a
,
"array != a"
);
ok
(
this
===
o
,
"this != o"
);
},
o
);
a
.
forEach
(
function
()
{
ok
(
this
.
valueOf
()
===
"foobar"
,
"this.valueOf() = "
+
this
.
valueOf
());
},
"foobar"
);
});
sync_test
(
"isArray"
,
function
()
{
...
...
@@ -412,6 +419,9 @@ sync_test("array_map", function() {
[
1
,
2
].
map
(
function
()
{
ok
(
this
===
window
,
"this != window"
);
},
undefined
);
[
1
,
2
].
map
(
function
()
{
ok
(
this
.
valueOf
()
===
137
,
"this.valueOf() = "
+
this
.
valueOf
());
},
137
);
});
sync_test
(
"array_sort"
,
function
()
{
...
...
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