bugGnash - The GNU Flash player - Bugs: bug #45840, Gnash ignores bare `var`...

 
 

bug #45840: Gnash ignores bare `var` declaration in timeline ActionScript

Submitted by:  Nutchanon Wetchasit <nachanon>
Submitted on:  Fri 28 Aug 2015 01:09:21 PM UTC  
 
Category:  ActionScript Severity:  3 - Normal
Release:  master Status:  Fixed
Privacy:  Public Assigned to:  Sandro Santilli <strk>
Open/Closed:  Closed

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Thu 12 May 2016 01:39:28 PM UTC, comment #11: 

The XMLSocketTester problem is now reported separately as bug #47906.

Nutchanon Wetchasit <nachanon>
Wed 03 Feb 2016 01:09:26 PM UTC, comment #10: 

The testsuite failure problem 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.

Nutchanon Wetchasit <nachanon>
Tue 02 Feb 2016 10:30:57 AM UTC, comment #9: 

Thanks again !

Sandro Santilli <strk>
Project MemberIn charge of this item.
Tue 02 Feb 2016 10:28:52 AM UTC, comment #8: 

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 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
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

Nutchanon Wetchasit <nachanon>
Mon 11 Jan 2016 03:13:59 PM UTC, comment #7: 

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.

Nutchanon Wetchasit <nachanon>
Sat 19 Dec 2015 05:09:36 PM UTC, comment #6: 

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

Nutchanon Wetchasit <nachanon>
Sat 19 Dec 2015 05:32:48 AM UTC, comment #5: 

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.

Nutchanon Wetchasit <nachanon>
Thu 24 Sep 2015 03:52:33 PM UTC, comment #4: 

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.
The HTML container `undefprop.html` also tested it this way.

This automated test could be implemented using an emulated host container,
as a part of `GetVariable()` plugin function test (patch #8721).

Nutchanon Wetchasit <nachanon>
Thu 24 Sep 2015 03:50:54 PM UTC, comment #3: 

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

Nutchanon Wetchasit <nachanon>
Fri 28 Aug 2015 05:41:12 PM UTC, 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 ?)

Sandro Santilli <strk>
Project MemberIn charge of this item.
Fri 28 Aug 2015 04:29:11 PM UTC, comment #1: 

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 :)

Sandro Santilli <strk>
Project MemberIn charge of this item.
Fri 28 Aug 2015 01:09:21 PM UTC, original submission:  

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 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

Nutchanon Wetchasit <nachanon>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #34760:  undefprop.zip added by nachanon (4KiB - application/zip - Undefined Properties Test Flash file, with source code, and logs)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by strk (Posted a comment)
  • -email is unavailable- added by nachanon (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-02-02 strk StatusReady For Test => Fixed
        Open/ClosedOpen => Closed
    2015-08-28 strk StatusIn Progress => Ready For Test
    2015-08-28 strk Categorycore => ActionScript
        StatusNone => In Progress
        Assigned toNone => strk
    2015-08-28 nachanon Attached File- => Added undefprop.zip, #34760

    Back to the top


    Powered by Savane 3.7