bugGnash - The GNU Flash player - Bugs: bug #21414, Date is converted to float value...

 
 

bug #21414: Date is converted to float value when concatenated to a string

Submitted by:  Udo Giacomozzi <udog>
Submitted on:  Wed 24 Oct 2007 06:40:08 PM 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)

Fri 26 Oct 2007 07:41:55 AM UTC, comment #8:

Seems better now. valueOf keeps returning a number, but primitive value will be string (for Date).

Sandro Santilli <strk>
Project MemberIn charge of this item.
Fri 26 Oct 2007 07:35:13 AM UTC, comment #7:

You're right. valueOf() should always return the number of milliseconds, never a String (just like getTime).

What is to_primitive? I see no reference of it in Date.cpp. You seem to be much more familiar with this stuff, can you have a look at it?

Anyway, the Date tests are a bit bogus since they not even succeed in the proprietary player as we know (see Wiki)...

Udo Giacomozzi <udog>
Project Member
Fri 26 Oct 2007 06:30:37 AM UTC, comment #6:

See ECMA-262 Chapter 8.6.2.6 [[DefaultValue]] (hint)

We didn't really fix it.
What as_value::to_primitive should do (which is not currently)
is take an HINT value, which would default to Number for all but Date object !!

Sandro Santilli <strk>
Project MemberIn charge of this item.
Thu 25 Oct 2007 03:38:21 PM UTC, comment #5:

Thanks, fixed.

Udo Giacomozzi <udog>
Project Member
Thu 25 Oct 2007 10:10:12 AM UTC, comment #4:

I belive the problem is the one exposed by toString_valueOf.as,
which is Date.valueOf should return a string (the same returned by Date.toString) when SWF version is > 5.

So the plan to fix this is:

1) extrapolate code currently in date_tostring (asobj/Date.cpp)
into an instance method for the date_as_object class
2) have date_tostring call the new method
3) have date_valueof call the new method if SWF > 5 or use the
current implementation otherwise.

Sandro Santilli <strk>
Project MemberIn charge of this item.
Thu 25 Oct 2007 09:34:12 AM UTC, comment #3:

Done. Testsuite updated.

Udo Giacomozzi <udog>
Project Member
Wed 24 Oct 2007 07:53:03 PM UTC, comment #2:

Also see testsuite/actionscript.all/toString_valueOf.as, in the Date section, seems related.

Sandro Santilli <strk>
Project MemberIn charge of this item.
Wed 24 Oct 2007 07:35:32 PM UTC, comment #1:

Do we have a test for this in actionscript.all/Date.as ?
If not, could you add one ?

Sandro Santilli <strk>
Project MemberIn charge of this item.
Wed 24 Oct 2007 06:40:08 PM UTC, original submission:

The following code:

var now = new Date();
trace(now);
trace("date = "+now);

prints this with Gnash:

2532] 20:38:47: TRACE: Wed Oct 24 20:38:47 GMT+0200 2007
2532] 20:38:47: TRACE: date = 1193251127915.61

while the proprietary player says:

Wed Oct 24 20:38:31 GMT+0200 2007
date = Wed Oct 24 20:38:31 GMT+0200 2007

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 9 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 26 Oct 2007 09:18:50 AM UTCstrkStatusReady For Test=>Fixed
      Open/ClosedOpen=>Closed
    Fri 26 Oct 2007 07:41:55 AM UTCstrkStatusIn Progress=>Ready For Test
    Fri 26 Oct 2007 06:30:37 AM UTCstrkStatusFixed=>In Progress
      Assigned toudog=>strk
      Open/ClosedClosed=>Open
    Thu 25 Oct 2007 03:38:21 PM UTCudogOpen/ClosedOpen=>Closed
    Thu 25 Oct 2007 03:38:20 PM UTCudogStatusNone=>Fixed
    Thu 25 Oct 2007 10:10:12 AM UTCstrkAssigned toNone=>udog

    Back to the top


    Powered by Savane 3.1-cleanup1