[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: |
Mon, 07 Mar 2016 12:21:35 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:25.8) Gecko/20151123 Firefox/31.9 PaleMoon/25.8.1 |
URL:
<http://savannah.gnu.org/bugs/?47354>
Summary: `Function.call(null)` and `Function.call(undefined)`
provided an incorrect `this` instance
Project: Gnash - The GNU Flash player
Submitted by: nachanon
Submitted on: Mon 07 Mar 2016 07:21:34 PM ICT
Category: ActionScript
Severity: 3 - Normal
Release: master
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
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`
<https://savannah.gnu.org/bugs/?37223#comment24> provided in bug #37223)
This is a trace output of `fncall-nothis-v7.swf` under Flash Player:
PASSED: _global object should be an object type
Warning: valueOf is not a function
PASSED: _global object should be equal to undefined value
Warning: valueOf is not a function
PASSED: _global object should be equal to null value
Warning: valueOf is not a function
PASSED: Appending _global object to empty string should give "undefined"
string
PASSED: _global object should not be strictly equal to undefined value
PASSED: _global object should not be strictly equal to null value
PASSED: this pointer inside fn_nullthis should be an object type
Warning: valueOf is not a function
PASSED: this pointer inside fn_nullthis should be equal to undefined value
Warning: valueOf is not a function
PASSED: this pointer inside fn_nullthis should be equal to null value
Warning: valueOf is not a function
PASSED: Appending this pointer inside fn_nullthis to empty string should give
"undefined" string
PASSED: this pointer inside fn_nullthis should not be strictly equal to
undefined value
PASSED: this pointer inside fn_nullthis should not be strictly equal to null
value
PASSED: this pointer inside fn_nullthis should be strictly equal to _global
object
PASSED: this pointer inside fn_undefinedthis should be an object type
Warning: valueOf is not a function
PASSED: this pointer inside fn_undefinedthis should be equal to undefined
value
Warning: valueOf is not a function
PASSED: this pointer inside fn_undefinedthis should be equal to null value
Warning: valueOf is not a function
PASSED: Appending this pointer inside fn_undefinedthis to empty string should
give "undefined" string
PASSED: this pointer inside fn_undefinedthis should not be strictly equal to
undefined value
PASSED: this pointer inside fn_undefinedthis should not be strictly equal to
null value
PASSED: this pointer inside fn_undefinedthis should be strictly equal to
_global object
PASSED: _global.nullthis_value should be set to the correct value
PASSED: _global.undefinedthis_value should be set to the correct value
PASSED: There should be 22 tests run
You'd see that all tests were passed.
This is a debug output (verbosity 1) of `fncall-nothis-v7.swf` under Gnash:
105 SECURITY: Checking security of URL
'file:///mnt/gnashdev/fncall-nothis/fncall-nothis/fncall-nothis-v7.swf'
105 SECURITY: Load of file
/mnt/gnashdev/fncall-nothis/fncall-nothis/fncall-nothis-v7.swf granted (under
local sandbox /mnt/gnashdev/fncall-nothis/fncall-nothis/)
136 SECURITY: Extensions disabled
138 TRACE: PASSED: _global object should be an object type
138 TRACE: PASSED: _global object should be equal to undefined value
138 TRACE: PASSED: _global object should be equal to null value
138 TRACE: PASSED: Appending _global object to empty string should give
"undefined" string
138 TRACE: PASSED: _global object should not be strictly equal to undefined
value
138 TRACE: PASSED: _global object should not be strictly equal to null value
138 TRACE: PASSED: this pointer inside fn_nullthis should be an object type
138 TRACE: PASSED: this pointer inside fn_nullthis should be equal to
undefined value
139 TRACE: PASSED: this pointer inside fn_nullthis should be equal to null
value
139 TRACE: PASSED: Appending this pointer inside fn_nullthis to empty string
should give "undefined" string
139 TRACE: PASSED: this pointer inside fn_nullthis should not be strictly
equal to undefined value
139 TRACE: PASSED: this pointer inside fn_nullthis should not be strictly
equal to null value
139 TRACE: FAILED: this pointer inside fn_nullthis should be strictly equal to
_global object
139 TRACE: PASSED: this pointer inside fn_undefinedthis should be an object
type
139 TRACE: PASSED: this pointer inside fn_undefinedthis should be equal to
undefined value
139 TRACE: PASSED: this pointer inside fn_undefinedthis should be equal to
null value
139 TRACE: PASSED: Appending this pointer inside fn_undefinedthis to empty
string should give "undefined" string
139 TRACE: PASSED: this pointer inside fn_undefinedthis should not be strictly
equal to undefined value
139 TRACE: PASSED: this pointer inside fn_undefinedthis should not be strictly
equal to null value
140 TRACE: FAILED: this pointer inside fn_undefinedthis should be strictly
equal to _global object
140 ACTIONSCRIPT ERROR: Reference to undefined member [string:nullthis_value]
of object [object(gnash::Global_as):0xb8a24278]
140 TRACE: FAILED: _global.nullthis_value should be set to the correct value
("undefined" != "fn_nullthis")
140 ACTIONSCRIPT ERROR: Reference to undefined member
[string:undefinedthis_value] of object [object(gnash::Global_as):0xb8a24278]
140 TRACE: FAILED: _global.undefinedthis_value should be set to the correct
value ("undefined" != "fn_undefinedthis")
140 TRACE: PASSED: There should be 22 tests run
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
<http://git.savannah.gnu.org/cgit/gnash.git/tree/testsuite/actionscript.all/Function.as?id=8b336929d19917a4d85629e8a9cd8483ad7f1c60#n131>
doesn't seem to have automated test on this issue.
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Mon 07 Mar 2016 07:21:34 PM ICT Name: fncall-nothis.zip Size: 11kB
By: nachanon
`Function.call()` test SWF files, source code, and debug logs
<http://savannah.gnu.org/bugs/download.php?file_id=36565>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?47354>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Gnash-commit] [bug #47354] `Function.call(null)` and `Function.call(undefined)` provided an incorrect `this` instance,
Nutchanon Wetchasit <=