Skip to content

CommonJS model: writes to non-writable or frozen exports are modelled as taking effect #40

Open

Description

@inth3shadows

Found in the round-1 review of branch fix/commonjs-model-gaps (stacked on PR #29). It is probably older than that branch, since the model code involved is unchanged there.

In sloppy mode, a write to a non-writable or frozen property is silently ignored, but the model applies it:

  • Object.defineProperty(exports, 'run', { value: a }); exports.run = b; gives go -> b, while runtime is a. The same happens with { value: a, writable: false }.
  • exports.run = a; Object.freeze(exports); exports.run = b; gives go -> b, while runtime is a.
  • Baseline has no edge for either.

Fix direction: track writable: false and frozen state on the owned object, and drop later writes (or send the file to the pre-model path).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions