Steps to repro: apply https://codereview.chromium.org/1839983002/ to v8, attempt to run node.js
Templates are globally shared objects, if a template references a non-primitive value (i.e. anything but numbers, strings, or other templates), two things happen
- the non-primitive value will never day and so will the context it was created in, or anything referenced from that context
- all contexts the template is instantiated in can access each other via the shared non-primitive value
To fix this, you can either introduce an accessor with the same name, and have the getter return the value (Template::SetAccessorProperty), or you can install a native data property. That will look like a regular value to JS, but under the hood, a getter is invoked (Template::SetNativeDataProperty)
/cc @ofrobots @nodejs/v8
Steps to repro: apply https://codereview.chromium.org/1839983002/ to v8, attempt to run node.js
Templates are globally shared objects, if a template references a non-primitive value (i.e. anything but numbers, strings, or other templates), two things happen
To fix this, you can either introduce an accessor with the same name, and have the getter return the value (Template::SetAccessorProperty), or you can install a native data property. That will look like a regular value to JS, but under the hood, a getter is invoked (Template::SetNativeDataProperty)
/cc @ofrobots @nodejs/v8