Bug 126680

Summary: Incorrect this value for callbacks (like requestAnimationFrame)
Product: WebKit Reporter: Boris Zbarsky <bzbarsky>
Component: WebCore JavaScriptAssignee: Nobody <webkit-unassigned>
Status: RESOLVED CONFIGURATION CHANGED    
Severity: Normal CC: ahmad.saleem792, andrea.giammarchi, ap, dbates, dino, ggaren, john.david.dalton, oliver
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
URL: http://jsfiddle.net/3BLzU/2/

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!