Bug 45480

Summary: missing (new Function).caller for __defineGetter__, __defineSetter__, and Object.defineProperty({get: ... set: ...})
Product: WebKit Reporter: Andrea Giammarchi <andrea.giammarchi>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: barraclough
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
URL: http://www.3site.eu/bugs/getter_setter_caller.html

Description Andrea Giammarchi 2010-09-09 11:28:32 PDT
There is no caller for *non* "use strict" cases when a getter/setter is invoked inside another function.
All other browsers work as expected and since the behavior of caller is undefined but you implemented in any case, I do believe WebKit/Safari should be more consistent bringing the caller in example cases as well.

See the URL for more tests or try this code:

var o = {
    exec: function exec() {
        var wtf = this.test;
    }
};

o.__defineGetter__("test", function test() {
    alert(test.caller);
    return "test";
});

o.exec();


Best Regards,
    Andrea Giammarchi
Comment 1 Andrea Giammarchi 2010-09-09 13:15:25 PDT
this is the reason I am asking for caller, hoping this will never disappear from ECMAScript specs.

http://webreflection.blogspot.com/2010/09/javascript-protected-properties.html

Regards
Comment 2 Gavin Barraclough 2012-03-07 17:20:28 PST

*** This bug has been marked as a duplicate of bug 80011 ***