Skip to content

SES-shim's permissive undeclared variable behavior can lead new code astray #1136

@erights

Description

@erights

See Agoric/agoric-sdk#4767 (comment)

At the time of writing, the code that appears there is

const weakRefDeref = WeakRef && WeakRef.prototype.deref;

part of whose purpose is to be conditional on whether there is a WeakRef variable in scope. According to the SES semantics this code is incorrect. If there is no WeakRef variable in scope, it should throw a ReferenceError instead. However, due to necessary limitations of the SES-shim, it returns an undefined instead. Because this code was tested only on the SES-shim, this but went undetected until it was spotted during a manual review.

This bug itself cannot be fixed in the SES-shim at reasonable engineering cost, so I don't expect it to be closed. I file it as a caution against falling into this trap.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions