Reimplement Function.prototype.caller
Categories
(Core :: JavaScript Engine, task, P2)
Tracking
()
People
(Reporter: evilpie, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(1 obsolete file)
This reimplement Function.prototype.caller to closely follow the new proposed spec. More details soon.
Reporter | ||
Comment 1•4 years ago
|
||
Updated•4 years ago
|
Reporter | ||
Comment 2•4 years ago
•
|
||
I think this should now hopefully correctly implement the draft spec. Removing the caller setter causes a number of test262 failures, I opened an issue to discuss that.
- From an implementation perspective maybe we should change
IsAllowedReceiverFunctionForCallerAndArguments
to follow the spec and check for [[Constructor]] instead of the individual function types like generator, async etc. - The restrictions that require the getter realm to be equal to the |this| function realm and similarly the restriction requiring the caller realm to be equal to the getter realm are probably the biggest possible compatibility fallout. I am not even sure if this works with the browser, I need to do some test runs.
- I think there was some concern around using the unwrapped function in
AdvanceToActiveCallLinear
. I think we don't need to unwrap at all, because inIsAllowedReceiverFunction
we will just fail for different realms anyway.
Comment 3•4 years ago
|
||
(In reply to Tom Schuster [:evilpie] from comment #2)
- From an implementation perspective maybe we should change
IsAllowedReceiverFunctionForCallerAndArguments
to follow the spec and check for [[Constructor]] instead of the individual function types like generator, async etc.
The intention of the spec is to exclude everything but what you call IsSloppyNormalFunction()
(with additional cross-realm restriction), at least if I’m guessing correctly what IsSloppyNormalFunction()
is doing. From the spec side, it happens that it suffices to inspect the [[Strict]] and the [[Construct]] slots, but it is in fact a somewhat indirect way to have the intended semantics (the intention is given in the Note following the IsAllowedReceiverFunctionForCallerAndArguments
algorithm).
Updated•4 years ago
|
Updated•2 years ago
|
Description
•