Closed
Bug 586168
Opened 15 years ago
Closed 7 years ago
can't implement Function.caller with function proxies
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 892903
People
(Reporter: dherman, Unassigned)
References
()
Details
I can't see any way to write a function proxy that implements Function.caller (docs at attached URL). I tried the following:
function call() { saved = fproxy.caller }
function trap(receiver, name) {
if (name === "caller")
return trap.caller;
}
fproxy = Proxy.createFunction({ get: trap }, call, call)
function main() { fproxy() }
main()
If you read the saved global, you get the call function. If you change trap to return trap.caller.caller and rerun the program, the saved global is null.
Dave
Comment 1•15 years ago
|
||
Function.caller is poison in ES5 (which can easily be emulated); isn't not implementing it desirable, even a feature perhaps?
Comment 2•15 years ago
|
||
We already censor .caller across wrappers, for what its worth.
Comment 3•15 years ago
|
||
Narcissus may want to implement guest .caller but it won't be based on the host .caller I hope.
Re: comment 1, .caller is poison only in ES5 strict, not ES5 non-strict, but of course ES5 strict is what Harmony is based on, so the deck is stacked.
The main interest in supporting .caller in Narcissus is to pass most of the tests that SpiderMonkey and Rhino pass.
/be
Comment 4•15 years ago
|
||
(In reply to comment #3)
> Re: comment 1, .caller is poison only in ES5 strict, not ES5 non-strict, but of
> course ES5 strict is what Harmony is based on, so the deck is stacked.
Oops, yes, I was imprecise. What I meant is that, in strict mode and where new functions can be created, fun.caller is poison: fun.bind().caller is poison, for example.
Comment 5•14 years ago
|
||
Is this bug WONTFIX? Those tests should be excluded from Narcissus test runs, as a badge of honor :-|.
/be
Assignee | ||
Updated•11 years ago
|
Assignee: general → nobody
Comment 6•7 years ago
|
||
Proxy.createFunction() was removed in bug 892903.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•