bugGnash - The GNU Flash player - Bugs: bug #47280, Gnash's ExternalInterface does not...

 
 

bug #47280: Gnash's ExternalInterface does not return Number value correctly

Submitted by:  Nutchanon Wetchasit <nachanon>
Submitted on:  Sat 27 Feb 2016 10:13:27 AM UTC  
 
Category: pluginSeverity: 3 - Normal
Release: masterStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Open

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 29 Mar 2016 09:50:41 AM UTC, comment #7:

We usually try to track as closely as possible the proprietary player as most SWF authors code using the proprietary player as a reference. Sometimes different versions of the proprietary player (PP for short) behave differently and that's why we setup an online repository of our actionscript.all tests to make it easier for different people on the net to report eventual weird behavior (failures) with their version of the player.

Unfortunately the online versions are not available at the moment, but you could produce them with "make online-tests" from under testsuite/actioncsript.all. I guess we'll want to publish them somewhere else and call users for testing.

When the platform makes a difference, we pick the Windows version as the reference one. As for the version, the most stable version should be considered.

Sandro Santilli <strk>
Project Member
Sun 13 Mar 2016 01:07:04 PM UTC, comment #6:

Note: Some tests are still failing as Flash Player has some quirks/bugs
regarding number value. Some of them are not very easy to investigate:

  • `Infinity` and `-Infinity` return value from JavaScript function are passed as `NaN`.
  • Not all significands in return value of ActionScript callback are passed correctly.

These quirks would need additional testing and discussion before including them in Gnash.

Nutchanon Wetchasit <nachanon>
Sun 13 Mar 2016 01:05:14 PM UTC, comment #5:

Patch included for fixing `Infinity`/`-Infinity`/`NaN` parsing of ActionScript
callback return value, and precision loss of JavaScript function return value.
See patch #8942.

Relevant text output from `js2flash-rtypes.html` with patched Gnash:

You'd see that `Infinity` return value from `infinite_call(), `-Infinity` from
`neginfinite_call()`, and `NaN` from `nan_call()` are now passed correctly
from ActionScript callback to JavaScript.

Relevant trace output from `flash2js-rtypes.html` with patched Gnash:

You'd see that return value from `float_call()` JavaScript function is now
passed back to ActionScript correctly.

Gnash: 0.8.11dev (patched against git a72afa5 9-Mar-2016) NPAPI
Browser: Iceweasel 10.0.12 (debian)
System: Debian GNU/Linux 7.0 Wheezy i386

Nutchanon Wetchasit <nachanon>
Tue 01 Mar 2016 02:27:44 PM UTC, comment #4:

The precision problem on Flash-calls-JavaScript return value boils down to how
libgnashplugin marshall floating point number data:

This causes precision loss as iostream used only few decimal digits when
printing `double` type to the stream. (To losslessly represent the number,
17 decimal significands were required)

Gnash: 0.8.11dev (git c12c3cf 22-Feb-2016)
System: Debian GNU/Linux 7.0 Wheezy i386

Nutchanon Wetchasit <nachanon>
Tue 01 Mar 2016 02:20:51 PM UTC, comment #3:

The problem on JavaScript-calls-Flash return value boils down to how
libgnashplugin parses `<number>` data from player side:

There are few problem with this:

  • It fails when `Infinity`, `-Infinity`, or `NaN` is encountered, as the plugin would parse it as an integer (and results in zero value).
  • It fails when the number is a whole number but is not in `int32_t` range, e.g. 4294967295.

As I understand, plugin's `ExternalInterface::parseXML()` is used only for
parsing player's answer from JavaScript call (both ExternalInterface and
built-in plugin functions), unconditionally parsing the number as `double`
shouldn't cause any problem, as it is same type as JavaScript's `Number`.

Gnash: 0.8.11dev (git c12c3cf 22-Feb-2016)
System: Debian GNU/Linux 7.0 Wheezy i386

Nutchanon Wetchasit <nachanon>
Sat 27 Feb 2016 04:12:36 PM UTC, comment #2:

On the first post I said `NaN` was returned incorrectly as 0 in
Flash-calls-JavaScript case. That was a mistake, sorry; the `NaN` value
was actually returned correctly in that case.

Updated list of problems:

In JavaScript-calls-Flash scenario:

  • `Infinity` and `-Infinity` are returned incorrectly as 0.
  • `NaN` is returned incorrectly as 0.

In Flash-calls-JavaScript scenario:

  • There is a precision loss (e.g. 1234.5678 got passed as 1234.57).
  • `Infinity` and `-Infinity` are not returned correctly*.

* The `Infinity` and `-Infinity` value in Flash-calls-JavaScript
direction are returned as `NaN` on Flash Player. On Gnash, the actual
`Infinity` or `-Infinity` value is returned.

Nutchanon Wetchasit <nachanon>
Sat 27 Feb 2016 10:21:07 AM UTC, comment #1:

Original `js2flash-rtypes.html` test is attached as `js2flash-rtypes.zip` (file #36330).
Original `flash2js-rtypes.html` test is attached as `flash2js-rtypes.zip` (file #36331).
Both files were originally posted in bug #47004.

Nutchanon Wetchasit <nachanon>
Sat 27 Feb 2016 10:13:27 AM UTC, original submission:

This is a spin-off from bug #47004 (ExternalInterface in-band error code issue).

From the result of `js2flash-rtypes.html` and `flash2js-rtypes.html` test
(file #36405) posted in bug #47004, Gnash has few problem on `Number`
type handing of ExternalInterface return value.

In JavaScript-calls-Flash scenario:

  • `Infinity` and `-Infinity` are returned incorrectly as 0.
  • `NaN` is returned incorrectly as 0.

Relevant text output from `js2flash-rtypes.html`:

In Flash-calls-JavaScript scenario:

  • There is a precision loss (e.g. 1234.5678 got passed as 1234.57).
  • `Infinity` and `-Infinity` are not returned correctly*.
  • `NaN` is returned incorrectly as 0.

Relevant Gnash's trace output from `flash2js-rtypes.html`:

* The `Infinity` and `-Infinity` value on Flash-calls-JavaScript
direction are returned as `NaN` on Flash Player.

Test result, screenshots, text outputs, debug outputs, and GDB backtrace,
are attached as `jsflash-rtypes_roundup.c12c3cf.zip`. (Crash is
due to bug #32411, backtrace is only attached for completeness)
Reference results are in the original test ZIP file.

For the record: According to Adobe's documentation, `Number` is an IEEE-754 `double` type.
The same holds for number in JavaScript (according to Mozilla).

Gnash: 0.8.11dev (git c12c3cf 22-Feb-2016) NPAPI
Browser: Iceweasel 10.0.12 (debian)
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 File(s):
   
   
Comment:
   

Attached Files
file #36488:  jsflash-rtypes_roundup.c12c3cf.zip added by nachanon (28KiB - application/zip - Outputs, screenshots, and logs from `js2flash-rtypes.html` and `flash2js-rtypes.html` test on Gnash 0.8.11dev git c12c3cf)

 

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

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 27 Feb 2016 10:13:27 AM UTCnachanonAttached File-=>Added jsflash-rtypes_roundup.c12c3cf.zip, #36488

    Back to the top


    Powered by Savane 3.1-cleanup1