Mon 07 Mar 2016 12:21:34 PM UTC, original submission:
This is a spin-off from bug #37223 (ExternalInterface issue).
While I was testing on Gnash's ExternalInterface callback behavior when SWF
registered a callback with accompanied `this` object set to `null`
or `undefined`, I found that `this` object inside the callback is supposed
to be the same as one inside function called with `Function.call(null)` or
`Function.call(undefined)`.
On Flash Player, `this` object is actually the ActionScript's `_global` object.
On Gnash, a plain object with no prototype was returned instead, which is incorrect.
I have made test SWF files (using libming's makeswf) which checks following
properties of `this` inside a function called via `Function.call(null)`
and `Function.call(undefined)`:
- `typeof(this)` should return "object".
- `this` should be equal to `null` and `undefined`.
- `this` should not be strictly equal to `null` and `undefined`.
- When appending `this` to an empty string, it must give "undefined" (Flash 7+) or empty string (Flash 6).
- `this` should be strictly equal to `_global`.
- Properties set to `this` must be retrievable later via `_global` object, outside the function.
(The test is similar to `js2flash-nothis-v2.zip` provided in bug #37223)
This is a trace output of `fncall-nothis-v7.swf` under Flash Player:
You'd see that all tests were passed.
This is a debug output (verbosity 1) of `fncall-nothis-v7.swf` under Gnash:
You'd see that tests of properties highlighted above in bold were failed.
Test SWF files (Flash 6-8), full debug logs, and source code are attached
as `fncall-nothis.zip`.
Gnash: 0.8.11dev (git 8b33692 7-Mar-2016)
Flash Player: 11.2 r202 (11.2.202.491) Standalone
System: Debian GNU/Linux 7.0 Wheezy i386
P.S. Gnash's testsute doesn't seem to have automated test on this issue.
|