Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Freeze Template Objects in __makeTemplateObject #51806

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

DanielRosenwasser
Copy link
Member

This PR has our __makeTemplateObject helper freeze the arrays passed into it. This is more correct according to the ECMAScript spec for our downlevel support in ES5 for tagged template strings, as template objects (a.k.a TemplateStringsArrays) are supposed to be deeply frozen.

While we're here, maybe I should also make the raw property non-enumerable. I don't know if configurability/writability matters if we're just freezing the object after anyway.

Fixes #51789.

@antongolub
Copy link

maybe I should also make the raw property non-enumerable

The closer to the spec, the better for reliability.

14. Perform ! DefinePropertyOrThrow(template, "raw", PropertyDescriptor { [[Value]]: rawObj, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Backlog Bug PRs that fix a backlog bug
Projects
Status: Waiting on reviewers
Development

Successfully merging this pull request may close these issues.

Downlevel TemplateStringsArray for tagged templates should be frozen
3 participants