Discussion:
[Gnash-commit] [bug #45840] Gnash ignores bare `var` declaration in timeline ActionScript
Nutchanon Wetchasit
2015-08-28 13:09:23 UTC
Permalink
URL:
<http://savannah.gnu.org/bugs/?45840>

Summary: Gnash ignores bare `var` declaration in timeline
ActionScript
Project: Gnash - The GNU Flash player
Submitted by: nachanon
Submitted on: Fri 28 Aug 2015 08:09:21 PM ICT
Category: core
Severity: 3 - Normal
Release: master
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any

_______________________________________________________

Details:

This is a follow-up to patch #8721 (GetVariable fix) and bug #42395
(Panopticlick issue).

From bug #42395, getvariable test does not give a correct result
<https://savannah.gnu.org/bugs/?42395#comment7> for
an unassigned variable declared on the timeline; it mistakenly reported
that the variable was not declared at all (instead of being declared with an
`undefined` value).

The cause of this issue could be narrowed down to one line of Gnash's debug
output (verbosity 2 + action error log):

124 ACTIONSCRIPT ERROR: The 'var whatever' syntax in timeline context is a
no-op.


I have created test flash file (using libming's makeswf) that tries
to assign an `undefined` property on root MovieClip from the main timeline
in various way:
* Declaring variable on the timeline
* Declaring variable on the timeline, with `undefined` value assigned
* Assigning through member operator on `this` instance
* Assigning through associative array operator on `this` instance
Then test for its existence using `Object.hasOwnProperty()`.

This is a trace output from Adobe Flash Player:

`this` has `undefined_timeline_declared` property?: true
`this` has `undefined_timeline_assigned` property?: true
`this` has `undefined_object_assigned` property?: true
`this` has `undefined_assoc_assigned` property?: true


You'd see that all method of assigning `undefined` property work as expected.

This is a trace output from current Gnash:

203 ACTIONSCRIPT ERROR: The 'var whatever' syntax in timeline context is a
no-op.
203 TRACE: `this` has `undefined_timeline_declared` property?: false
203 TRACE: `this` has `undefined_timeline_assigned` property?: true
203 TRACE: `this` has `undefined_object_assigned` property?: true
203 TRACE: `this` has `undefined_assoc_assigned` property?: true


You'd see that under Gnash, declaring `var undefined_timeline_declared`
on the timeline does not assign the property on root MovieClip,
which is incorrect.

Test Flash file, optional HTML container, source code, build script,
and full debug logs of both cases are attached (undefprop.zip).

Gnash: 0.8.11dev (git f341372 25-Aug-2015)
Adobe Flash Player: 11.2 r202 (11.2.202.491) standalone binary
System: Debian GNU/Linux 7.0 Wheezy i386



_______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 28 Aug 2015 08:09:21 PM ICT Name: undefprop.zip Size: 4kB By:
nachanon
Undefined Properties Test Flash file, with source code, and logs
<http://savannah.gnu.org/bugs/download.php?file_id=34760>

_______________________________________________________

Reply to this item at:

<http://savannah.gnu.org/bugs/?45840>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
Sandro Santilli
2015-08-28 16:29:12 UTC
Permalink
Follow-up Comment #1, bug #45840 (project gnash):

Good catch! There's a testsuite/actionscript.all/getvariable.as file you could
add these tests to.

It's a good thing that there's an error message, so you can spot exactly where
the code for considering that a no-op is found :)

_______________________________________________________

Reply to this item at:

<http://savannah.gnu.org/bugs/?45840>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
Sandro Santilli
2015-08-28 16:29:37 UTC
Permalink
Update of bug #45840 (project gnash):

Category: core => ActionScript
Status: None => In Progress
Assigned to: None => strk


_______________________________________________________

Reply to this item at:

<http://savannah.gnu.org/bugs/?45840>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
Sandro Santilli
2015-08-28 17:41:13 UTC
Permalink
Update of bug #45840 (project gnash):

Status: In Progress => Ready For Test

_______________________________________________________

Follow-up Comment #2:

As of commit 062edf672abbd849a4a67447b5c3fb9f30d1a701 the "var" declaration in
timeline will set an undefined variable to the "this" pointer. Please see if
it passes all the tests in your .zip, and eventually provide a patch to add
more in getvariable.

You may notice the current test does not run in SWF5 due to the lack of
hasOwnProperty at that level. You you have an idea about testing the SWF5
behavior that'd be great.

Also by running the tests (make getvariable-v{5,6,7,8}.swf under
build/testsuite/actionscript.all) with the adobe player I've also found a test
that fails (wrong exepctance, could you check with your version ?)

_______________________________________________________

Reply to this item at:

<http://savannah.gnu.org/bugs/?45840>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
Nutchanon Wetchasit
2015-09-24 15:50:54 UTC
Permalink
Follow-up Comment #3, bug #45840 (project gnash):

Current git version of Gnash gives correct result when tested with
`undefprop.swf`:

TRACE: `this` has `undefined_timeline_declared` property?: true
TRACE: `this` has `undefined_timeline_assigned` property?: true
TRACE: `this` has `undefined_object_assigned` property?: true
TRACE: `this` has `undefined_assoc_assigned` property?: true


and also gives correct result when tested with `getvariable-v3.html` from bug
#42395:

Flash's string_variable: type=string, value=Hello!
Flash's integer_variable: type=string, value=1234
Flash's float_variable: type=string, value=1234.5678
Flash's infinite_variable: type=string, value=Infinity
Flash's neginfinite_variable: type=string, value=-Infinity
Flash's nan_variable: type=string, value=NaN
Flash's boolean_variable: type=string, value=true
Flash's unassigned_variable: type=string, value=undefined
Flash's undefined_variable: type=string, value=undefined
Flash's nonexistent_variable: type=object, value=null
Flash's null_variable: type=string, value=null
Flash's array_variable: type=string,
value=The,quick,brown,fox,jumps,over,the,lazy,dog
Flash's object_variable: type=string, value=[object Object]
Flash's object_variable_customstring: type=string, value=This is
object_variable_customstring.toString()
Flash's function_variable: type=string, value=[type Function]


Gnash: 0.8.11dev (git f0f66ce 23-Sep-2015)
Adobe Flash Player: 11.2 r202 (11.2.202.491) NPAPI binary
Browser: Iceweasel 10.0.12 (debian)
System: Debian GNU/Linux 7.0 Wheezy i386

_______________________________________________________

Reply to this item at:

<http://savannah.gnu.org/bugs/?45840>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
Nutchanon Wetchasit
2015-09-24 15:52:33 UTC
Permalink
Follow-up Comment #4, bug #45840 (project gnash):

Regarding the test on SWF5 (and possibly SWF4) environment, using
a Plugin-provided `GetVariable()` interface might helps since it seems
to be available all the way back to Flash 4 era
<http://stackoverflow.com/questions/1283733/how-to-getvariable-flash-class-variable/1285752#1285752>.
The HTML container `undefprop.html` also tested it this way.

This automated test could be implemented using an emulated host container
<https://savannah.gnu.org/bugs/?37223#comment7>,
as a part of `GetVariable()` plugin function test (patch #8721).

_______________________________________________________

Reply to this item at:

<http://savannah.gnu.org/bugs/?45840>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
Nutchanon Wetchasit
2015-12-19 05:32:48 UTC
Permalink
Follow-up Comment #5, bug #45840 (project gnash):

See patch #8835 which provides automated check for this issue under SWF5
using `GetVariable()` plugin function, but it is currently giving an XFAIL
result due to a different issue
<https://savannah.gnu.org/bugs/?42395#comment16>.

_______________________________________________________

Reply to this item at:

<http://savannah.gnu.org/bugs/?45840>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
Nutchanon Wetchasit
2015-12-19 17:09:36 UTC
Permalink
Follow-up Comment #6, bug #45840 (project gnash):

For the issue that prevents this bug from being checked
under SWF5 environment, see bug #46719.

_______________________________________________________

Reply to this item at:

<http://savannah.gnu.org/bugs/?45840>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
Nutchanon Wetchasit
2016-01-11 15:13:59 UTC
Permalink
Follow-up Comment #7, bug #45840 (project gnash):

See patch #8851, which fixes testability of this bug under SWF5.

Note (for the record): There is no need to test this under SWF4,
as `var` statement is available only in Flash 5 and later versions.

_______________________________________________________

Reply to this item at:

<http://savannah.gnu.org/bugs/?45840>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
Nutchanon Wetchasit
2016-02-02 10:28:52 UTC
Permalink
Follow-up Comment #8, bug #45840 (project gnash):

On current Gnash git version, `var` declaration on timeline ActionScript of
MovieClip seems to correctly set property on it.

Verbosity = 1 debug output from running `undefprop.swf` under Gnash:

115 SECURITY: Checking security of URL
'file:///home/window/Desktop/undefprop.swf'
115 SECURITY: Load of file /home/window/Desktop/undefprop.swf granted (under
local sandbox /home/window/Desktop/)
132 SECURITY: Extensions disabled
133 TRACE: `this` has `undefined_timeline_declared` property?: true
133 TRACE: `this` has `undefined_timeline_assigned` property?: true
133 TRACE: `this` has `undefined_object_assigned` property?: true
133 TRACE: `this` has `undefined_assoc_assigned` property?: true


Text output from running `extgetvariable-testrunner.html`
(from bug #42395 file #35743) on web browser with Gnash:

PASSED: Gnash should return a correct type from GetVariable call on string
PASSED: Gnash should return a correct value from GetVariable call on string
PASSED: Gnash should return a correct type from GetVariable call on integer
PASSED: Gnash should return a correct value from GetVariable call on integer
PASSED: Gnash should return a correct type from GetVariable call on floating
point
PASSED: Gnash should return a correct value from GetVariable call on floating
point
PASSED: Gnash should return a correct type from GetVariable call on infinity
floating point
PASSED: Gnash should return a correct value from GetVariable call on infinity
floating point
PASSED: Gnash should return a correct type from GetVariable call on negative
infinity floating point
PASSED: Gnash should return a correct value from GetVariable call on negative
infinity floating point
PASSED: Gnash should return a correct type from GetVariable call on non-number
floating point
PASSED: Gnash should return a correct value from GetVariable call on
non-number floating point
PASSED: Gnash should return a correct type from GetVariable call on boolean
PASSED: Gnash should return a correct value from GetVariable call on boolean
PASSED: Gnash should return a correct type from GetVariable call on null
PASSED: Gnash should return a correct value from GetVariable call on null
PASSED: Gnash should return a correct type from GetVariable call on unassigned
variable
PASSED: Gnash should return a correct value from GetVariable call on
unassigned variable
PASSED: Gnash should return a correct type from GetVariable call on variable
with undefined value
PASSED: Gnash should return a correct value from GetVariable call on variable
with undefined value
PASSED: Gnash should return a correct type from GetVariable call on
non-existent variable
PASSED: Gnash should return a correct value from GetVariable call on
non-existent variable
PASSED: Gnash should return a correct type from GetVariable call on array
variable
PASSED: Gnash should return a correct value from GetVariable call on array
variable
PASSED: Gnash should return a correct type from GetVariable call on object
variable
PASSED: Gnash should return a correct value from GetVariable call on object
variable
PASSED: Gnash should return a correct type from GetVariable call on object
variable with custom toString()
PASSED: Gnash should return a correct value from GetVariable call on object
variable with custom toString()
PASSED: Gnash should return a correct type from GetVariable call on function
variable
PASSED: Gnash should return a correct value from GetVariable call on function
variable


Moreover, if one tried to revert the fix
<http://git.savannah.gnu.org/cgit/gnash.git/commit/?id=062edf672abbd849a4a67447b5c3fb9f30d1a701>
using following patch:

diff --git a/libcore/vm/ASHandlers.cpp b/libcore/vm/ASHandlers.cpp
index 073bca5..60a3fd7 100644
--- a/libcore/vm/ASHandlers.cpp
+++ b/libcore/vm/ASHandlers.cpp
@@ -2346,11 +2346,10 @@ ActionVar(ActionExec& thread)
declareLocal(vm.currentCall(), name);
}
else {
- // See https://savannah.gnu.org/patch/?8721
- as_object* this_ptr = thread.getThisPointer();
- if (!hasOwnProperty(*this_ptr, name)) {
- this_ptr->set_member(name, as_value());
- }
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("The 'var whatever' syntax in timeline context is a
"
+ "no-op."));
+ );
}
env.drop(1);
}


When built and run `make check`, it also shown test failures correctly:
(SWF6-SWF8 failures from getvariable test, and SWF5-SWF8 failures from
extgetvariable test)

--=[ testsuite/actionscript.all ]=--
FAIL: astests-v6-Runner: this.hasOwnProperty('undefined_timeline_declared')
[./getvariable.as:692]
FAIL: astests-v7-Runner: this.hasOwnProperty('undefined_timeline_declared')
[./getvariable.as:692]
FAIL: astests-v8-Runner: this.hasOwnProperty('undefined_timeline_declared')
[./getvariable.as:692]
--=[ testsuite/misc-ming.all ]=--
FAIL: XMLSocketTester: expected: true obtained: false [./XMLSocketTest.as:52]
FAIL: XMLSocketTester: consistency check: last trace from run of test
(Initial connection failed!) doesn't match pattern (ENDOFTEST)
FAIL: extgetvariable_testrunner_v5: Gnash should return a correct value from
GetVariable call on unassigned variable ("<null/>" != "<string></string>")
FAIL: extgetvariable_testrunner_v6: Gnash should return a correct value from
GetVariable call on unassigned variable ("<null/>" != "<string></string>")
FAIL: extgetvariable_testrunner_v7: Gnash should return a correct value from
GetVariable call on unassigned variable ("<null/>" !=
"<string>undefined</string>")
FAIL: extgetvariable_testrunner_v8: Gnash should return a correct value from
GetVariable call on unassigned variable ("<null/>" !=
"<string>undefined</string


This bug could now be considered as fixed.

I'll try to file the suspected incorrect test issue
<https://savannah.gnu.org/bugs/?45840#comment2>
as a separate report after I checked it on multiple version
of Flash Player on different platforms. Same goes for the
unrelated XMLSocketTester failure.

Gnash: 0.8.11dev (git e705394 29-Jan-2016)
Browser: Iceweasel 10.0.12 (debian)
System: Debian GNU/Linux 7.0 Wheezy i386

_______________________________________________________

Reply to this item at:

<http://savannah.gnu.org/bugs/?45840>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
Sandro Santilli
2016-02-02 10:30:57 UTC
Permalink
Update of bug #45840 (project gnash):

Status: Ready For Test => Fixed
Open/Closed: Open => Closed

_______________________________________________________

Follow-up Comment #9:

Thanks again !

_______________________________________________________

Reply to this item at:

<http://savannah.gnu.org/bugs/?45840>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
Nutchanon Wetchasit
2016-02-03 13:09:26 UTC
Permalink
Follow-up Comment #10, bug #45840 (project gnash):

The testsuite failure problem <https://savannah.gnu.org/bugs/?45840#comment2>
is now reported separately as bug #47054.

It is likely to be _Adobe Flash Player_'s regression. But I filed it anyway,
mostly to document the case in detailed manner, and update relevant
testsuite documentation.


_______________________________________________________

Reply to this item at:

<http://savannah.gnu.org/bugs/?45840>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
Nutchanon Wetchasit
2016-05-12 13:39:28 UTC
Permalink
Follow-up Comment #11, bug #45840 (project gnash):

The XMLSocketTester problem <https://savannah.gnu.org/bugs/?45840#comment8> is
now reported separately as bug #47906.

_______________________________________________________

Reply to this item at:

<http://savannah.gnu.org/bugs/?45840>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/

Loading...