bugGnash - The GNU Flash player - Bugs: bug #22006, for (each in an object) finds...

 
 

bug #22006: for (each in an object) finds $version

Submitted by:  Udo Giacomozzi <udog>
Submitted on:  Sat 12 Jan 2008 10:54:45 AM UTC  
 
Category: ActionScriptSeverity: 3 - Normal
Release: NoneStatus: Fixed
Privacy: PublicAssigned 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 Jump to the original submission)

Tue 15 Jan 2008 10:45:00 AM UTC, comment #13:

Committed.

Sandro Santilli <strk>
Project MemberIn charge of this item.
Tue 15 Jan 2008 09:59:03 AM UTC, comment #12:

mc["$foo"] = "OK"; // printed, not sent
mc["fo$o"] = "OK";
mc["foo$"] = "OK";

mc["%foo"] = "OK";
mc["fo%o"] = "OK";
mc["foo%"] = "OK";

mc["&foo"] = "OK";
mc["fo&o"] = "OK";
mc["foo&"] = "OK";

mc["(foo"] = "OK";
mc["fo(o"] = "OK";
mc["foo("] = "OK";

mc["§foo"] = "OK";
mc["fo§o"] = "OK";
mc["foo§"] = "OK";

mc["'foo"] = "OK";
mc["fo'o"] = "OK";
mc["foo'"] = "OK";

mc["/foo"] = "OK";
mc["fo/o"] = "OK";
mc["foo/"] = "OK";

mc["\\foo"] = "OK";
mc["fo\\o"] = "OK";
mc["foo\\"] = "OK";

mc["!foo"] = "OK";
mc["fo!o"] = "OK";
mc["foo!"] = "OK";

mc[".foo"] = "OK";
mc["fo.o"] = "OK";
mc["foo."] = "OK";

mc[":foo"] = "OK";
mc["fo:o"] = "OK";
mc["foo:"] = "OK";

// all others: printed and sent

So yes, probably dollar at beginning is always skipped.

Udo Giacomozzi <udog>
Project Member
Tue 15 Jan 2008 09:45:39 AM UTC, comment #11:

I guess skipping everything starting with a dollar would do for
now. A last test would be testing other starting characters, like number, underscore, dash, slash, backslash, at....

you can use the _root['@name'] syntax to avoid syntax errors..

Sandro Santilli <strk>
Project MemberIn charge of this item.
Tue 15 Jan 2008 09:43:18 AM UTC, comment #10:

Not confirmed.

var mc = this.createEmptyMovieClip("mc", 100);
mc.foo="bar";
mc.key="value";
mc.tricky="this is a value with some spaces and & ampersands....";
mc.$dollarfirst = "accepted";
mc.dollar$middle = "accepted";
mc.dollarlast$ = "accepted";
mc.$version = "foobar";

for(var key in mc)
trace(key+"="+mc[key]);

/*
PRINTS:

$version=foobar
dollarlast$=accepted
dollar$middle=accepted
$dollarfirst=accepted
tricky=this is a value with some spaces and & ampersands....
key=value
foo=bar
*/

mc.loadVariables("http://10.1.1.1/formtest.php", "Post");

/*
SENDS:

array(5) {
["foo"]=>
string(3) "bar"
["key"]=>
string(5) "value"
["tricky"]=>
string(53) "this is a value with some spaces and & ampersands...."
["dollar$middle"]=>
string(8) "accepted"
["dollarlast$"]=>
string(8) "accepted"
}
*/

ie. variables with dollar sign at the beginning of the name are not being sent

Udo Giacomozzi <udog>
Project Member
Tue 15 Jan 2008 09:32:57 AM UTC, comment #9:

> Could be that variable names with special chars are stripped for security reasons, too.


Could you test the above statement ?
Name a variable with the dollar sign in the middle,
or other unsafe characters ?

Make sure the variable assignment worked fine always.

Sandro Santilli <strk>
Project MemberIn charge of this item.
Tue 15 Jan 2008 09:24:31 AM UTC, comment #8:

mc.$dollarvar = "accepted";
mc.$version = "foobar";

Both variables are printed with { for (key in mc) } but none of them is posted via loadVars (tested GET and POST).

Could be that variable names with special chars are stripped for security reasons, too.

Udo Giacomozzi <udog>
Project Member
Tue 15 Jan 2008 08:59:17 AM UTC, comment #7:

I belive I removed the $version skip, sending everything is enumerable. That should have reintroduced sending $version.
Could you try defining a parameter starting with the dollar
sign, and also overriding $version and see if those are
sent ?

Sandro Santilli <strk>
Project MemberIn charge of this item.
Tue 15 Jan 2008 08:42:16 AM UTC, comment #6:

Looks good, thanks.

However, even though Adobe has a _root.$version, it does not send it with loadVariables().

//--------

var mc = this.createEmptyMovieClip("mc", 100);
mc.foo="bar";
mc.key="value";
mc.tricky="this is a value with some spaces and & ampersands....";

for(var key in mc)
trace(key+"="+mc[key]);

trace("TEST: mc.$version="+mc.$version); // empty string
trace("TEST: _root.$version="+_root.$version); // WIN 8,0,22,0

_root.loadVariables("http://10.1.1.1/formtest.php", "Get");

//--------

Posted vars (proprietary player):

array(2) {
["mc"]=>
string(10) "_level0.mc"
["key"]=>
string(3) "foo"
}

PS: I think we can remove that "TESTING" message now...

Udo Giacomozzi <udog>
Project Member
Mon 14 Jan 2008 08:09:20 PM UTC, comment #5:

There was good test coverage in swfdec testsuite.
Committed a fix for this.
Please let me know if it fixes your case.

Sandro Santilli <strk>
Project MemberIn charge of this item.
Sat 12 Jan 2008 08:01:18 PM UTC, comment #4:

About being only defined for _root, could you try adding
test for it in misc-mtasc.all/levelxx.as
and to misc-ming.all/DragDropTest.as ?

Both testcases load stuff. levelxx.as onlhy load in levels,
DragDropTest.as load both in a _level and in a child movieclip.

Every load is on itself a kind of "root" (would be _root
if loaded directly). The question is: do these "loaded"
movie contain a $version member ?
If so, do a function defined in an SWF4 called by code
defined in an SWF5 that loads the SWF4 one get access to a $version
trought the call stack, and which one ?

Sandro Santilli <strk>
Project MemberIn charge of this item.
Sat 12 Jan 2008 03:43:10 PM UTC, comment #3:

BTW, I tried to filter user members ("foo") from standard properties ("_alpha") using getOwnProperty() but it returns always a valid pointer.

if (getOwnProperty(VM::get().getStringTable().find(name))) continue;

Udo Giacomozzi <udog>
Project Member
Sat 12 Jan 2008 03:39:08 PM UTC, comment #2:

But $version does not even exist in the proprietary player:

var mc = this.createEmptyMovieClip("mc", 100);
trace(mc+".$version = ["+(mc.$version)+"]");

//prints: _level0.mc.$version = [undefined]

That property seems to exist in _root only.

Udo Giacomozzi <udog>
Project Member
Sat 12 Jan 2008 03:14:47 PM UTC, comment #1:

enumerating or not is a property flag.
Whether or not $version is a property can be
checked using hasOwnProperty('$version')
Also, there are some variables that are members
but return false by hasOwnProperty. we call them
non-proper properties.

Most of the time it is possible to figure out
what object contains the member using hasOwnProperty.
Like Object.prototype ? _global ?

Sandro Santilli <strk>
Project MemberIn charge of this item.
Sat 12 Jan 2008 10:54:45 AM UTC, original submission:

The following code prints a "$version" variable, while Adobe Flash does not (and apparently doesn't know about a "$version" member).

var mc = this.createEmptyMovieClip("mc", 100);
mc.foo="bar";
mc.key="value";

for(var key in mc)
trace(key+"="+mc[key]);

Gnash output:

TRACE: foo=bar
TRACE: $version=LNX 8,0,99,0
TRACE: key=value

Udo Giacomozzi <udog>
Project Member

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

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

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 15 Jan 2008 10:45:00 AM UTCstrkStatusReady For Test=>Fixed
      Open/ClosedOpen=>Closed
    Mon 14 Jan 2008 08:09:20 PM UTCstrkStatusNone=>Ready For Test
      Assigned toNone=>strk
    Sat 12 Jan 2008 10:54:54 AM UTCudogCategoryNone=>ActionScript

    Back to the top


    Powered by Savane 3.1-cleanup1