Skip to content

Calls to v8::Template::Set must not pass in non-primitive values #6216

Closed
@jeisinger

Description

@jeisinger

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++Issues and PRs that require attention from people who are familiar with C++.v8 engineIssues and PRs related to the V8 dependency.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions