| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
Looks great! Could you please add a test?
Sorry, something went wrong.
|
@ryzokuken I'm also wondering. In these lines: https://github.com/nodejs/node/pull/23206/files#diff-0cf206672499c2f86db4ffb0cc5b668bR1041 and https://github.com/nodejs/node/pull/23206/files#diff-0cf206672499c2f86db4ffb0cc5b668bR1052 should we also be checking against parsing_context instead of context? I'm not actually 100% sure what this check is doing but it looks like we're checking the wrong object. Sorry for the slowness here, I've never actually written c++ before and I'm not exactly familiar with the v8 APIs. I am trying though 😄 |
Sorry, something went wrong.
|
@ryzokuken I'd be happy to help write a test. Is it good enough to test this from the JS layer or should the test be written in C++? Sorry for all the questions! |
Sorry, something went wrong.
Nope. Those get calls should happen in whatever the current context is. |
Sorry, something went wrong.
|
@devsnek thanks. Now I think understand what's happening in both of those loops. We're basically checking (by name) to see if that particular value exists in the current context, and if so, then we can add it right? Working on some small tests now! |
Sorry, something went wrong.
|
@ryzokuken just added some small test cases. Hope they're okay :) |
Sorry, something went wrong.
JS tests should be fine. Thanks. |
Sorry, something went wrong.
There was a problem hiding this comment.
The tests look great, can you confirm that they all pass with the changed code?
Sorry, something went wrong.
|
@ryzokuken using ./configure && make -j4 test shows everything passes. Additionally, I was able to run the individual test file I modified with python tools/test.py -J --mode=release parallel/test-vm-basic. Surely this would be running in the Travis build too right? |
Sorry, something went wrong.
Sorry, something went wrong.
|
@darahayes It would, yes! The CI failures are probably not related to your change, and it will be fixed soon. |
Sorry, something went wrong.
|
pinging @ryzokuken, just wondering is there any more work to be done on my side to get this merged? Thanks! |
Sorry, something went wrong.
|
@darahayes while we are at it could you rebase on master to make CI easier? |
Sorry, something went wrong.
Sorry, something went wrong.
|
CI is green! If nobody lands with in the next few hours, I will. |
Sorry, something went wrong.
There was a problem hiding this comment.
Final LG.
Sorry, something went wrong.
|
@darahayes shucks, the other two commits aren't fixups. Would you mind squashing the three commits into one? |
Sorry, something went wrong.
ContextifyContext::CompileFunction in src/node_contextify.cc was incorrectly passing the context variable to ScriptCompiler::CompileFunctionInContext This meant that the parsingContext option in vm.compileFunction was not being applied properly to the compiled function. fixes: nodejs#23194 doc: clarify parsingContext option for vm.compileScript test: usage of parsingContext in vm.compileFunction
|
@ryzokuken looks like the build failed for some unrelated reason. Some timeout. Is it possible to rerun it and see what happens? |
Sorry, something went wrong.
|
@darahayes timeout in not ok 519 parallel/test-worker-memory indeed. Weird that it'd happen only on Windows. Could you check if it's a known flake? |
Sorry, something went wrong.
There was a problem hiding this comment.
Now that parsingContext is also the context/realm in which the function is created, the name becomes a misnomer. For v8.Script, the parsingContext option only controls behavior seen through the Inspector API, as the created script is not bound to a V8 context. I suggest we change the name to context or something similar, if we can still do so.
Sorry, something went wrong.
Hi! Are you looking for a review from me? Or is there something else you'd like/need? |
Sorry, something went wrong.
|
Resume CI: https://ci.nodejs.org/job/node-test-pull-request/17728/ Though, @darahayes perhaps you can come up with a better name for the context (refs #23206 (review)) |
Sorry, something went wrong.
|
@Trott pinged you because of the flaky test, thought it'd bring this particular failure to your notice plus you'll have a better idea about the flake in general 😅. |
Sorry, something went wrong.
Ah! Well, yes, that test has been observed timing out elsewhere and is reported in #23277. The Resume Build passed, so I think you can proceed. |
Sorry, something went wrong.
ContextifyContext::CompileFunction in src/node_contextify.cc was incorrectly passing the context variable to ScriptCompiler::CompileFunctionInContext This meant that the parsingContext option in vm.compileFunction was not being applied properly to the compiled function. fixes: #23194 doc: clarify parsingContext option for vm.compileScript test: usage of parsingContext in vm.compileFunction PR-URL: #23206 Fixes: #23194 Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Apologies for the delay in getting back to this. I would have preferred to get my changes right over getting them merged right now.
You'll have to forgive me, I'm super new to this.
In any case if you folks think it's more appropriate, I'd be happy to submit a small PR that renames parsingContext to context from the JS side and the native side (and docs of course). This would rename an option passed in from userland code, so these would be breaking changes right? Is there anything from a process or technical perspective that I need to be aware of when submitting a PR with breaking changes? |
Sorry, something went wrong.
Sorry about that. I saw the author ready label and thought is was good to go. |
Sorry, something went wrong.
It's all good. It's really my fault because I didn't respond quick enough 😄 |
Sorry, something went wrong.
|
IMO it's not like this PR is not 'ready', that part was an addition that could happen here or in a follow-up PR as this one was opened for 'pass correct context to CompileFunctionInContext in CompileFunction'. Edit: also, @darahayes no worries, there is no such thing as be quick enough, there are obviously some sane limits of how much time a change might take but usually a PR is either 'needs changes' and it will wait or 'ready to go'. If the change was critical people would just use 'Request changes' to make sure this doesn't get landed before they are fixed. |
Sorry, something went wrong.
|
Thanks @lundibundi I'm happy to create a new issue around the naming and work on a follow up PR if you think that's the way to go 😊 |
Sorry, something went wrong.
ContextifyContext::CompileFunction in src/node_contextify.cc was incorrectly passing the context variable to ScriptCompiler::CompileFunctionInContext This meant that the parsingContext option in vm.compileFunction was not being applied properly to the compiled function. fixes: #23194 doc: clarify parsingContext option for vm.compileScript test: usage of parsingContext in vm.compileFunction PR-URL: #23206 Fixes: #23194 Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
ContextifyContext::CompileFunction in src/node_contextify.cc was incorrectly passing the context variable to ScriptCompiler::CompileFunctionInContext This meant that the parsingContext option in vm.compileFunction was not being applied properly to the compiled function. fixes: #23194 doc: clarify parsingContext option for vm.compileScript test: usage of parsingContext in vm.compileFunction PR-URL: #23206 Fixes: #23194 Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
ContextifyContext::CompileFunction in src/node_contextify.cc was incorrectly passing the context variable to ScriptCompiler::CompileFunctionInContext This meant that the parsingContext option in vm.compileFunction was not being applied properly to the compiled function. fixes: #23194 doc: clarify parsingContext option for vm.compileScript test: usage of parsingContext in vm.compileFunction PR-URL: #23206 Fixes: #23194 Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
ContextifyContext::CompileFunction in src/node_contextify.cc was incorrectly passing the context variable to ScriptCompiler::CompileFunctionInContext This meant that the parsingContext option in vm.compileFunction was not being applied properly to the compiled function. fixes: #23194 doc: clarify parsingContext option for vm.compileScript test: usage of parsingContext in vm.compileFunction PR-URL: #23206 Fixes: #23194 Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
ContextifyContext::CompileFunction in src/node_contextify.cc was incorrectly passing the context variable to ScriptCompiler::CompileFunctionInContext This meant that the parsingContext option in vm.compileFunction was not being applied properly to the compiled function. fixes: #23194 doc: clarify parsingContext option for vm.compileScript test: usage of parsingContext in vm.compileFunction PR-URL: #23206 Fixes: #23194 Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
| Back | FazBrowse Home | New Git URL |
Fixes: #23194
The ContextifyContext::CompileFunction function was accidentally passing the wrong context variable into ScriptCompiler::CompileFunctionInContext this resulted in the incorrect context being passed to the compiled function.
You can quickly test this with the following code:
With Node v10.10.0 I get the following output:
:1 return 'hello ' + name ^ ReferenceError: name is not defined at <anonymous>:1:19 at Object.<anonymous> (/Users/dara/mydev/vmtest/index.js:10:13) at Module._compile (internal/modules/cjs/loader.js:689:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Function.Module.runMain (internal/modules/cjs/loader.js:742:12) at startup (internal/bootstrap/node.js:279:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:696:3)With the proposed changes, the output is hello world.
I also edited the description of the parsingContext option in the docs to explicitly use the word contextified. The docs use this word everywhere else when referring to a context object.
Checklist