Bug 126680 - Incorrect this value for callbacks (like requestAnimationFrame)
Summary: Incorrect this value for callbacks (like requestAnimationFrame)
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL: http://jsfiddle.net/3BLzU/2/
Keywords:
: 136635 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-01-08 21:57 PST by Boris Zbarsky
Modified: 2022-09-03 06:42 PDT (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Boris Zbarsky 2014-01-08 21:57:13 PST
Steps to reproduce: Load this testcase:

  <script>
    function f() { "use strict"; alert(this + ""); }
    requestAnimationFrame(f);
  </script>

Expected result:  Alert saying either "null" or "undefined", preferably the latter.

Actual result: Alert saying 'function f() { "use strict"; alert(this + ""); }'

Additional information:

Per WebIDL spec, the callback this value is set to null, by default, though it should probably be undefined instead (see <https://www.w3.org/Bugs/Public/show_bug.cgi?id=24248>).  The requestAnimationFrame specification doesn't say to pass any special this value.  So in this case the this value should be undefined, or at worst null, not the function object being called.
Comment 1 Alexey Proskuryakov 2014-09-08 23:45:44 PDT
*** Bug 136635 has been marked as a duplicate of this bug. ***
Comment 2 Ahmad Saleem 2022-09-03 06:42:29 PDT
I am not able to reproduce this bug in Safari Technology Preview 152 and it shows "undefined' for JSFiddle from URL field in all other browsers (Chrome Canary 107, Firefox Nightly 106) as well and also in STP 152.

I am going to mark this as "RESOLVED CONFIGURATION CHANGED" since all browsers are matching and showing "Expected Results". Thanks!