-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
v8: warn in Template::Set() on improper use #6277
Conversation
This LGTM |
@@ -939,6 +939,15 @@ void Template::Set(v8::Local<Name> name, v8::Local<Data> value, | |||
i::Isolate* isolate = templ->GetIsolate(); | |||
ENTER_V8(isolate); | |||
i::HandleScope scope(isolate); | |||
auto value_obj = Utils::OpenHandle(*value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to leave a to-do here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can add a TODO but what should it say?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps TODO: Throw Error instead of warning in v7.0
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, it's not going to throw; newer V8 versions replace it with a CHECK that aborts when it fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we use dep: as the subsystem? Apart from that LGTM. |
It's a bit of both. Historically, |
Oh, I didn't notice that before. Then we can leave it as it is. |
I forgot, cc @nodejs/v8 @jeisinger. |
I wonder if it makes sense to add a flag (upstream, and floated here) to silence such runtime deprecation warnings. I do think it is good to be noisy by default on such imminent deprecations, but it would also be nice to be able to silence the warning if the user wishes. One the problems native modules have had is that they never realize that things have been deprecated for a long time, and discover it when next Node.js major w/ new V8 drop them. If such a runtime deprecation warning flag existed, we could potentially use it for more things. |
I'd be okay with adding a flag but I assume that also calls for some kind of framework inside V8 for logging deprecation notices? Input on what that should look like appreciated; or if you're willing to take that on, I'm happy to step aside. |
@ofrobots ... well, we do already have a flags for handling deprecations and warnings in node of course. Perhaps it would be possible to provide an API for embedders that would allow handling of the runtime deprecations/warnings to be deferred to the embedder? We could then insert our own logic and control the output using the existing |
Of more immediate concern, however, is whether this particular PR can land as is for v6 or does it need to be tweaked some more? |
If it needs a complete overhaul, then it's not going to be ready for v6.0.0, which would be a shame, IMO. I can add a flag to |
Given that this is urgent for v6, deciding on the framework before then might not be feasible, I agree. How about something specific for this case for now; specially if we are not pushing it upstream first? Perhaps |
Sounds good, that's more or less what I had in mind. I'll update the PR later today. |
467b4b8
to
50b35aa
Compare
Updated, PTAL. CI: https://ci.nodejs.org/job/node-test-pull-request/2369/ |
LGTM if CI is green |
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>
50b35aa
to
7940ecf
Compare
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>
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>
@bnoordhuis looks like this is specific to v8 > 5 |
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>
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>
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>
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>
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.)
Refs: #6216
Speculative - I'd like some input whether other collaborators think it's a good approach. It can get pretty noisy when native code abuses
v8::Template::Set()
a lot but OTOH, hopefully that means it gets fixed quickly.CI: https://ci.nodejs.org/job/node-test-pull-request/2319/