[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] [bug #47354] `Function.call(null)` and `Function.call(und
From: |
Nutchanon Wetchasit |
Subject: |
[Gnash-commit] [bug #47354] `Function.call(null)` and `Function.call(undefined)` provided an incorrect `this` instance |
Date: |
Tue, 08 Mar 2016 12:47:06 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:25.8) Gecko/20151123 Firefox/31.9 PaleMoon/25.8.1 |
Follow-up Comment #2, bug #47354 (project gnash):
This issue could be narrowed down directly to how `Function.call()` and
`Function.apply()` are currently implemented in Gnash.
`Function.apply()` at `libcore/asobj/Function_as.cpp` around line 107
<http://git.savannah.gnu.org/cgit/gnash.git/tree/libcore/asobj/Function_as.cpp?id=8b336929d19917a4d85629e8a9cd8483ad7f1c60#n107>:
if (!fn.nargs) {
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("Function.apply() called with no args"));
);
new_fn_call.this_ptr = new as_object(getGlobal(fn));
}
else {
// Get the object to use as 'this' reference
as_object* obj = toObject(fn.arg(0), getVM(fn));
if (!obj) obj = new as_object(getGlobal(fn));
new_fn_call.this_ptr = obj;
`Function.call()` at `libcore/asobj/Function_as.cpp` around line 159
<http://git.savannah.gnu.org/cgit/gnash.git/tree/libcore/asobj/Function_as.cpp?id=8b336929d19917a4d85629e8a9cd8483ad7f1c60#n159>:
if (!fn.nargs || fn.arg(0).is_undefined() || fn.arg(0).is_null()) {
tp = new as_object(getGlobal(fn));
}
In both methods, `this` inside the called function would be set to an empty
object
<http://git.savannah.gnu.org/cgit/gnash.git/tree/libcore/as_object.h?id=8b336929d19917a4d85629e8a9cd8483ad7f1c60#n166>
if `thisObject` argument was not specified, or specified as `null` or
`undefined`.
Gnash: 0.8.11dev (git 8b33692 7-Mar-2016)
System: Debian GNU/Linux 7.0 Wheezy i386
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?47354>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/