vm: support parsing a script in a specific context#14888
vm: support parsing a script in a specific context#14888TimothyGu merged 1 commit intonodejs:masterfrom
Conversation
9a38ab7 to
1ea23ac
Compare
|
/cc @nodejs/v8-inspector |
bnoordhuis
left a comment
There was a problem hiding this comment.
LGTM, I suppose, although it feels a bit like a workaround rather than a proper fix, and since it adds a public property, we might come to regret that later.
src/node_contextify.cc
Outdated
|
@bnoordhuis Would you be more satisfied had I made the option an "internal" one through unexposed symbols? |
|
I think that would be best. We can always make it public later if a good use case presents itself. |
330e27b to
ce77785
Compare
|
@bnoordhuis Okay, done. |
lib/vm.js
Outdated
There was a problem hiding this comment.
This seems like over-complicating it. You can create the symbol in InitContextify() or ContextifyScript::Init() and set it on target and then use it directly from the binding object, no need for a new file in lib/internal.
There was a problem hiding this comment.
... not sure what got into my head. Will do.
src/node_contextify.cc
Outdated
There was a problem hiding this comment.
You won't need this check if you do.
src/node_contextify.cc
Outdated
There was a problem hiding this comment.
FWIW, it's possible to condense this to:
Local<Value> value;
if (!obj->Get(context, key).ToLocal(&value)) return MaybeLocal<Context>();
src/node_contextify.cc
Outdated
There was a problem hiding this comment.
This branch cannot realistically be taken, can it?
There was a problem hiding this comment.
Not sure, but the same check is in a couple of other places in the file so I wouldn't touch them in this PR.
|
@bnoordhuis would you mind taking another look? Thanks! |
|
I'll apply this early next week if I don't see any comments. |
src/node_contextify.cc
Outdated
There was a problem hiding this comment.
Could be shortened to Context::Scope scope(maybe_context.FromMaybe(env->context()));.
There was a problem hiding this comment.
Teeny tiny style nit but line continuations are indented by four spaces. (I don't know why the linter doesn't enforce that.)
PR-URL: nodejs#14888 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
f40774e to
d932e80
Compare
|
Landed in d932e80 with @bnoordhuis's comments fixed. |
PR-URL: nodejs/node#14888 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
PR-URL: #14888 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
PR-URL: #14888 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
|
It appears that this change is breaking I'm going to drop this from the 8.5.0 release and add semver-major for now |
|
@MylesBorins That sounds like a bug. I shall create a PR that fixes it. |
|
@TimothyGu to confirm, a bug with node or with browserify / watchify? |
|
@MylesBorins Node.js (this PR specifically). |
|
@MylesBorins Upon a second look, it seems to me that this bug is with Browserify -- or more specifically, an old and buggy version of Traceur's // Object.assign (19.1.3.1)
function assign(target, source) {
var props = $getOwnPropertyNames(source);
var p, length = props.length;
for (p = 0; p < length; p++) {
target[props[p]] = source[props[p]];
}
return target;
}So, not a bug in Node.js after all... |
PR-URL: #14888 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
|
Marking this Semver-Major until it is not longer breaking the browserify test suite |
bug in traceur compiler polyfill in browserify is causing errors in 8.x and above. This needs to be fixed in browserify. Refs: nodejs/node#14888 (comment)
Differences are only observable through Inspector's
Debugger.scriptParsedevent (hence the Dev Tools frontend).Before when executing
vm.runInNewContext('debugger'):After:
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
vm