patchGnash - The GNU Flash player - Patches: patch #8935, Patch for providing `_global` as a...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #8935: Patch for providing `_global` as a fallback instance in `Function.call()` and `Function.apply()`

Submitter:  Nutchanon Wetchasit <nachanon>
Submitted:  Tue 08 Mar 2016 03:16:37 PM UTC
   
 
Category:  ActionScript Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  strk Open/Closed:  Closed

Tue 29 Mar 2016 06:06:10 PM UTC, comment #5: 

Patch1: a794319ac28c02365eddffd571a37c3ec4fb1eea
Patch2: 484ca4cd2fecb73c3308fd451004f6cc2e976fbe

Sandro Santilli <strk>
Group Member
Thu 10 Mar 2016 11:11:52 AM UTC, comment #4: 

Side note: The reason that my integrated automated tests are usually
submitted last, is that integrated tests are more difficult to write;
extra care must be taken regarding the convention and avoid interfering
with other tests.

So I mostly rely on isolated (non-integrated) tests to identify the
correct behavior, and to confirm the fix. Then, work on the integrated version
after the fix is accepted.

Hope you'd understand.

Nutchanon Wetchasit <nachanon>
Thu 10 Mar 2016 11:08:51 AM UTC, comment #3: 

As a reference, after applying the second patch, running
`testsuite/actionscript.all/Function-v*.swf` under Flash Player
gives following text output:

Function-v5.swf:

 - xtrace enabled -
SWF5 - WIN 11,3,300,271

[Function.as master-22362-650a19f]


#passed: 150
#failed: 0
#total tests run: 150


Function-v6.swf:

 - xtrace enabled -
SWF6 - WIN 11,3,300,271

[Function.as master-22362-650a19f]
custom text rep
[type Function]
#passed: 263
#failed: 0
#total tests run: 263


Function-v7.swf:

 - xtrace enabled -
SWF7 - WIN 11,3,300,271

[Function.as master-22362-650a19f]
custom text rep
[type Function]
#passed: 264
#failed: 0
#total tests run: 264


Function-v8.swf:

 - xtrace enabled -
SWF8 - WIN 11,3,300,271

[Function.as master-22362-650a19f]
custom text rep
[type Function]
#passed: 264
#failed: 0
#total tests run: 264


Gnash testsuite: 0.8.11dev (patched against git a72afa5 9-Mar-2016)
Flash Player: 11.3 r300 (11.3.300.271) NPAPI binary
Browser: Opera 11.51
System: Microsoft Windows XP SP3

Nutchanon Wetchasit <nachanon>
Thu 10 Mar 2016 11:03:45 AM UTC, comment #2: 

Patch 2 of 2:
See the attached `0002_add-function-call-global-fallback-instance-tests.patch`.

This patch adds following automated checks on `Function.call()` and
`Function.apply()` to ActionScript section of Gnash testsuite:

  • Function.apply() tests:
    • `this` inside function called with `Function.apply()` should be strictly equal to `_global`.
    • Property set to `this` inside function called with `Function.apply()` should end up in `_global` object.
    • `this` inside function called with `Function.apply(undefined)` should be strictly equal to `_global`.
    • Property set to `this` inside function called with `Function.apply(undefined)` should end up in `_global` object.
    • `this` inside function called with `Function.apply(null)` should be strictly equal to `_global`.
    • Property set to `this` inside function called with `Function.apply(null)` should end up in `_global` object.
  • Function.call() tests:
    • `this` inside function called with `Function.call()` should be strictly equal to `_global`.
    • Property set to `this` inside function called with `Function.call()` should end up in `_global` object.
    • `this` inside function called with `Function.call(undefined)` should be strictly equal to `_global`.
    • Property set to `this` inside function called with `Function.call(undefined)` should end up in `_global` object.
    • `this` inside function called with `Function.call(null)` should be strictly equal to `_global`.
    • Property set to `this` inside function called with `Function.call(null)` should end up in `_global` object.


Might need a review, for the same reason as second half of patch #8933.

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


(file #36594)

Nutchanon Wetchasit <nachanon>
Tue 08 Mar 2016 06:17:35 PM UTC, comment #1: 

Is patch 2 going to contain the test ?
I'd like this to come with tests, and hopefully Function.as in actionscript.all is a good place to add them.

We have support for XCHECK for the specific reason of allowing tests to be submitted even before  fixes :)

Sandro Santilli <strk>
Group Member
Tue 08 Mar 2016 03:16:37 PM UTC, original submission:  

Current Gnash's implementation of `Function.call()` and `Function.apply()`
have an incorrect behavior when user specified `thisObject` argument as
`null` or `undefined`, which it caused the function to be called with `this`
instance set to an empty object rather than the `_global` object.

Patch 1 of 2:
See the attached `0001_supply-global-instance-fallback-for-function-call-apply.patch`.

This patch makes `Function.call()` and `Function.apply()` supply a reference
to `Global_as` (a.k.a. ActionScript `_global`) as the context of function call
if the `thisObject` argument of the method is specified as `null`
or `undefined`; fixing bug #47354.

Gnash: 0.8.11dev (patched against git 8b33692 7-Mar-2016)
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.)

Attached Files
file #36594:  0002_add-function-call-global-fallback-instance-tests.patch added by nachanon (4KiB - text/x-diff - Patch to add automated tests on `this` and `_global` relationship in `Function.call()`/`Function.apply()` when no/undefined/null context was given)
file #36570:  0001_supply-global-instance-fallback-for-function-call-apply.patch added by nachanon (1KiB - text/x-diff - Patch to use `_global` as function context if called via `Function.call()`/`Function.apply()` with null/undefined instance)

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-03-29 strk StatusNone Done
        Open/ClosedOpen Closed
    2016-03-10 nachanon Attached File- Added 0002_add-function-call-global-fallback-instance-tests.patch, #36594
    2016-03-08 strk Assigned toNone strk
    2016-03-08 nachanon Attached File- Added 0001_supply-global-instance-fallback-for-function-call-apply.patch, #36570

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code