Skip to content
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

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

Closed
jeisinger opened this issue Apr 15, 2016 · 6 comments
Closed

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

jeisinger opened this issue Apr 15, 2016 · 6 comments
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. v8 engine Issues and PRs related to the V8 dependency.

Comments

@jeisinger
Copy link
Contributor

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

@ChALkeR ChALkeR added c++ Issues and PRs that require attention from people who are familiar with C++. v8 engine Issues and PRs related to the V8 dependency. labels Apr 15, 2016
@ofrobots
Copy link
Contributor

I can investigate this next week. If anyone else is interested in investigating, feel free (but let me know).

@bnoordhuis
Copy link
Member

I checked earlier today. It looks like it's fairly straightforward to fix in core (don't know yet how or if it affects performance) but it's going to create a lot of fallout in the module ecosystem. Again. Le sigh.

@jeisinger
Copy link
Contributor Author

Yeah, if only node had a proper API ...

@bnoordhuis
Copy link
Member

#6228

bnoordhuis added a commit to bnoordhuis/io.js that referenced this issue Apr 18, 2016
V8 is going to disallow non-primitive values on v8::FunctionTemplate
and v8::ObjectTemplate because those can't be shared across contexts.

Fixes: nodejs#6216
PR-URL: nodejs#6228
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
@Fishrock123
Copy link
Contributor

When is the patch that causes this landing? Not in v6 right?

@Fishrock123 Fishrock123 removed this from the 7.0.0 milestone Apr 19, 2016
@jeisinger
Copy link
Contributor Author

It's part of v8 5.2 which @bnoordhuis tells me is v7 timeframe

bnoordhuis added a commit to bnoordhuis/io.js that referenced this issue Apr 22, 2016
The next major release will make it a fatal error to use non-primitive
values in function templates and object templates.

Print a warning that includes the C and JS stack trace to tell people to
upgrade their add-ons.  The C stack trace is only printed on platforms
that support it (the BSDs, OS X and Linux+glibc.)

The warning can be disabled with the new `--nowarn_template_set` flag.

Refs: nodejs#6216
PR-URL: nodejs#6277
Reviewed-By: James M Snell <jasnell@gmail.com>
joelostrowski pushed a commit to joelostrowski/node that referenced this issue Apr 25, 2016
V8 is going to disallow non-primitive values on v8::FunctionTemplate
and v8::ObjectTemplate because those can't be shared across contexts.

Fixes: nodejs#6216
PR-URL: nodejs#6228
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
joelostrowski pushed a commit to joelostrowski/node that referenced this issue Apr 25, 2016
The next major release will make it a fatal error to use non-primitive
values in function templates and object templates.

Print a warning that includes the C and JS stack trace to tell people to
upgrade their add-ons.  The C stack trace is only printed on platforms
that support it (the BSDs, OS X and Linux+glibc.)

The warning can be disabled with the new `--nowarn_template_set` flag.

Refs: nodejs#6216
PR-URL: nodejs#6277
Reviewed-By: James M Snell <jasnell@gmail.com>
jasnell pushed a commit that referenced this issue Apr 26, 2016
V8 is going to disallow non-primitive values on v8::FunctionTemplate
and v8::ObjectTemplate because those can't be shared across contexts.

Fixes: #6216
PR-URL: #6228
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
jasnell pushed a commit that referenced this issue Apr 26, 2016
The next major release will make it a fatal error to use non-primitive
values in function templates and object templates.

Print a warning that includes the C and JS stack trace to tell people to
upgrade their add-ons.  The C stack trace is only printed on platforms
that support it (the BSDs, OS X and Linux+glibc.)

The warning can be disabled with the new `--nowarn_template_set` flag.

Refs: #6216
PR-URL: #6277
Reviewed-By: James M Snell <jasnell@gmail.com>
xzyfer added a commit to sass/node-sass that referenced this issue Apr 28, 2016
evanlucas added a commit to evanlucas/node-oniguruma that referenced this issue Apr 28, 2016
See [0] and [1]: starting with node.js v6, setting non-primitive values
on FunctionTemplate and ObjectTemplate instances is discouraged; v7 will
downright disallow it. Update the code base.

[0] nodejs/node#6216
[1] nodejs/node#6228
targos pushed a commit to targos/node that referenced this issue Jun 3, 2016
The next major release will make it a fatal error to use non-primitive
values in function templates and object templates.

Print a warning that includes the C and JS stack trace to tell people to
upgrade their add-ons.  The C stack trace is only printed on platforms
that support it (the BSDs, OS X and Linux+glibc.)

The warning can be disabled with the new `--nowarn_template_set` flag.

Refs: nodejs#6216
PR-URL: nodejs#6277
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit to targos/node that referenced this issue Jun 29, 2016
The next major release will make it a fatal error to use non-primitive
values in function templates and object templates.

Print a warning that includes the C and JS stack trace to tell people to
upgrade their add-ons.  The C stack trace is only printed on platforms
that support it (the BSDs, OS X and Linux+glibc.)

The warning can be disabled with the new `--nowarn_template_set` flag.

Refs: nodejs#6216
PR-URL: nodejs#6277
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit to targos/node that referenced this issue Jul 26, 2016
The next major release will make it a fatal error to use non-primitive
values in function templates and object templates.

Print a warning that includes the C and JS stack trace to tell people to
upgrade their add-ons.  The C stack trace is only printed on platforms
that support it (the BSDs, OS X and Linux+glibc.)

The warning can be disabled with the new `--nowarn_template_set` flag.

Refs: nodejs#6216
PR-URL: nodejs#6277
Reviewed-By: James M Snell <jasnell@gmail.com>
ofrobots pushed a commit to ofrobots/node that referenced this issue Aug 25, 2016
The next major release will make it a fatal error to use non-primitive
values in function templates and object templates.

Print a warning that includes the C and JS stack trace to tell people to
upgrade their add-ons.  The C stack trace is only printed on platforms
that support it (the BSDs, OS X and Linux+glibc.)

The warning can be disabled with the new `--nowarn_template_set` flag.

Refs: nodejs#6216
PR-URL: nodejs#6277
Reviewed-By: James M Snell <jasnell@gmail.com>
pmed added a commit to pmed/v8pp that referenced this issue Oct 5, 2016
According to nodejs/node#6216 only primitive values
and V8 templates are allowed to set in a v8::ObjectTemplate.
mcampa pushed a commit to mcampa/node-sass that referenced this issue Apr 21, 2017
mcampa pushed a commit to mcampa/node-sass that referenced this issue Apr 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

No branches or pull requests

5 participants