Open Bug 1616378 Opened 4 years ago Updated 2 years ago

Reimplement Function.prototype.caller

Categories

(Core :: JavaScript Engine, task, P2)

task

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.

Priority: -- → P2

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.

  1. 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.
  2. 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.
  3. I think there was some concern around using the unwrapped function in AdvanceToActiveCallLinear. I think we don't need to unwrap at all, because in IsAllowedReceiverFunction we will just fail for different realms anyway.

(In reply to Tom Schuster [:evilpie] from comment #2)

  1. 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).

Attachment #9127385 - Attachment is obsolete: true
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: