| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
largely rubber stamp lgtm
Sorry, something went wrong.
There was a problem hiding this comment.
Can you use the overload that takes a Local<Context>?
Sorry, something went wrong.
There was a problem hiding this comment.
Done.
Sorry, something went wrong.
There was a problem hiding this comment.
I'd write this as an if statement. It's rather hard to read.
Sorry, something went wrong.
There was a problem hiding this comment.
Agree. Done.
Sorry, something went wrong.
There was a problem hiding this comment.
I suppose the conditional isn't needed?
Sorry, something went wrong.
There was a problem hiding this comment.
Why? If we intercept, it signals that the property was found. I think that's not correct if the property is not present.
Sorry, something went wrong.
There was a problem hiding this comment.
Undefined is the default return value of API callbacks. I.e., the return value is going to be the same, with or without the IsUndefined() check.
Sorry, something went wrong.
There was a problem hiding this comment.
ReturnValue on the CallbackArgs is set to undefined, but the call to the interceptor returns true or false depending on whether the return value was set. This then changes the control flow, see objects.cc.
But taking a closer look, I think the logic can be substantially simplified: take the value from the sandbox if present, otherwise proceed regularly. What do you think?
Sorry, something went wrong.
There was a problem hiding this comment.
This fits on one line (well, two, if you count the LHS.)
Sorry, something went wrong.
There was a problem hiding this comment.
Done.
Sorry, something went wrong.
There was a problem hiding this comment.
Stray debug code, I presume?
Sorry, something went wrong.
There was a problem hiding this comment.
oops
Sorry, something went wrong.
There was a problem hiding this comment.
If this function gets called a lot (which it looks like it is), it's arguably better to use snprintf() instead to avoid the extra allocation, or even to do manual stringification. C++17 adds std::to_chars() but we can't use that yet, unfortunately.
It might even be worthwhile to implement this as Uint32::New(...)->ToString(...) because that would reuse V8's number-to-string cache.
Sorry, something went wrong.
There was a problem hiding this comment.
Yes, if there's any larger array, this is called for every index. Using Uint32::New()->ToString().
Sorry, something went wrong.
There was a problem hiding this comment.
You fixed the style for this further up but not here.
Sorry, something went wrong.
There was a problem hiding this comment.
Done.
Sorry, something went wrong.
There was a problem hiding this comment.
Debug code again.
There's a lot of duplication. Couldn't you implement them by calling UIntToName(isolate, index) and passing the result to GlobalPropertyDefinerCallback(), etc.?
Sorry, something went wrong.
There was a problem hiding this comment.
It's all duplication. Let me think about how to get rid of the code duplication while maintaining readability.
Sorry, something went wrong.
There was a problem hiding this comment.
Can you drop the comment?
Sorry, something went wrong.
There was a problem hiding this comment.
Done.
Sorry, something went wrong.
There was a problem hiding this comment.
You can drop the copyright boilerplate, we don't use it in new files.
Sorry, something went wrong.
There was a problem hiding this comment.
Done
Sorry, something went wrong.
|
@cpojer, since this is fixing bugs/altering behavior, do you want to check if that causes problems for Jest? |
Sorry, something went wrong.
|
I'll run this through the jsdom test suite as well. |
Sorry, something went wrong.
|
Nits addressed, refactoring the code duplication part. Will squash afterwards. |
Sorry, something went wrong.
There was a problem hiding this comment.
See my comment about the default return value but otherwise LGTM. Nice work, Franziska and @AnnaMag.
Sorry, something went wrong.
There was a problem hiding this comment.
Some extraneous blank lines here.
Sorry, something went wrong.
There was a problem hiding this comment.
Done.
Sorry, something went wrong.
There was a problem hiding this comment.
Can you remove the blank line here?
Sorry, something went wrong.
|
@fhinkel mind running this against Jest's version on master? |
Sorry, something went wrong.
|
@cpojer Jest's tests helped me find a fatal error on my side 😄 jest/integration_tests/coverage-threshold/__tests__/a-banana.js 1:1 error Delete `⏎······` prettier/prettier |
Sorry, something went wrong.
|
Can you just try yarn jest on the repo, that'll run the JS tests? It seems like there is some weird eslint issue on your state of the Jest repo (master is green, so not sure what's up). |
Sorry, something went wrong.
|
@cpojer I'm not getting very far with Node master, opend an issue here jestjs/jest#4731. |
Sorry, something went wrong.
|
As mentioned in the Jest issue, using node 9 RC fails worker-farm's tests as well. Jest uses worker-farm to parallelise test runs. https://github.com/rvagg/node-worker-farm Details$ npm version
{ 'worker-farm': '1.5.0',
npm: '5.3.0',
ares: '1.13.0',
cldr: '31.0.1',
http_parser: '2.7.0',
icu: '59.1',
modules: '58',
nghttp2: '1.25.0',
node: '9.0.0-rc.0',
openssl: '1.0.2l',
tz: '2017b',
unicode: '9.0',
uv: '1.15.0',
v8: '6.1.534.42',
zlib: '1.2.11' }> worker-farm@1.5.0 test /Users/simbekkh/repos/node-worker-farm
> node ./tests/
TAP version 13
# simple, exports=function test
ok 1 pid makes sense
ok 2 pid makes sense
ok 3 rnd result makes sense
ok 4 workerFarm ended
# simple, exports.fn test
ok 5 pid makes sense
ok 6 pid makes sense
ok 7 rnd result makes sense
ok 8 workerFarm ended
# single worker
ok 9 only a single process (by pid)
ok 10 workerFarm ended
# two workers
ok 11 only two child processes (by pid)
ok 12 workerFarm ended
# many workers
ok 13 pids are all the same (by pid)
ok 14 workerFarm ended
# auto start workers
ok 15 child has been up before the request
ok 16 child has been up before the request
ok 17 child has been up before the request
ok 18 workerFarm ended
# single call per worker
ok 19 one process for each call (by pid)
ok 20 workerFarm ended
# two calls per worker
ok 21 one process for each call (by pid)
ok 22 workerFarm ended
# many concurrent calls
ok 23 processed tasks concurrently (173ms)
ok 24 workerFarm ended
# single concurrent call
ok 25 processed tasks sequentially (304ms)
ok 26 workerFarm ended
# multiple concurrent calls
ok 27 processed tasks concurrently (277ms)
ok 28 workerFarm ended
# durability
events.js:195
throw er; // Unhandled 'error' event
^
Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed
at ChildProcess.target.send (internal/child_process.js:606:16)
at Object.send (/Users/simbekkh/repos/node-worker-farm/lib/fork.js:24:17)
at Farm.stopChild (/Users/simbekkh/repos/node-worker-farm/lib/farm.js:131:11)
at Farm.<anonymous> (/Users/simbekkh/repos/node-worker-farm/lib/farm.js:96:10)
at ontimeout (timers.js:478:11)
at tryOnTimeout (timers.js:302:5)
at Timer.listOnTimeout (timers.js:262:5)
npm ERR! Test failed. See above for more details.
|
Sorry, something went wrong.
|
git bisect blames f2b01cb Bisect script if anyone wants to double-check Details#!/bin/sh
./configure
make -j4 || exit 125 # an exit code of 125 asks "git bisect" to "skip" the current commit
# run the application and check that it produces good output
./node ../node-worker-farm/tests 2>&1 | grep 'ERR_IPC_CHANNEL_CLOSED'
if [ $? -eq 0 ]; then
exit 1
fi
exit 0I can confirm that reverting f2b01cb makes both worker-farm's and jest's test suites pass |
Sorry, something went wrong.
|
@SimenB Do you mind putting your code snippets in details, as they are not related to this issue? Thanks! |
Sorry, something went wrong.
Sorry, something went wrong.
Remove the CopyProperties() hack in the vm module, i.e., Contextify. Use different V8 API methods, that allow interception of DefineProperty() and do not flatten accessor descriptors to property descriptors. Move many known issues to test cases. Factor out the last test in test-vm-context.js for nodejs#10223 into its own file, test-vm-strict-assign.js. Part of this CL is taken from a stalled PR by https://github.com/AnnaMag nodejs#13265 This PR requires a backport of https://chromium.googlesource.com/v8/v8/+/37a3a15c3e52e2146e45f41c427f24414e4d7f6f Refs: nodejs#6283 Refs: nodejs#15114 Refs: nodejs#13265 Fixes: nodejs#2734 Fixes: nodejs#10223 Fixes: nodejs#11803 Fixes: nodejs#11902
Sorry, something went wrong.
Remove the CopyProperties() hack in the vm module, i.e., Contextify. Use different V8 API methods, that allow interception of DefineProperty() and do not flatten accessor descriptors to property descriptors. Move many known issues to test cases. Factor out the last test in test-vm-context.js for nodejs#10223 into its own file, test-vm-strict-assign.js. Part of this CL is taken from a stalled PR by https://github.com/AnnaMag nodejs#13265 This PR requires a backport of https://chromium.googlesource.com/v8/v8/+/37a3a15c3e52e2146e45f41c427f24414e4d7f6f PR-URL: nodejs#16293 Fixes: nodejs#2734 Fixes: nodejs#10223 Fixes: nodejs#11803 Fixes: nodejs#11902 Ref: nodejs#6283 Ref: nodejs#15114 Ref: nodejs#13265 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
|
Nice. Thank you and @AnnaMag for doing this! |
Sorry, something went wrong.
The known issue is fixed with nodejs#16293. The text needs to call `Object.hasOwnProperty(this)` instead of `this.hasOwnProperty()`, otherwise `this` is from the wrong context is used. Add a second test case taken verbatim from issue nodejs#5350 Fixes: nodejs#5350 Refs: nodejs#16293
The known issue is fixed with nodejs#16293. The text needs to call `Object.hasOwnProperty(this)` instead of `this.hasOwnProperty()`, otherwise `this` is from the wrong context is used. Add a second test case taken verbatim from issue nodejs#5350 PR-URL: nodejs#16411 Fixes: nodejs#5350 Ref: nodejs#16293 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Remove the CopyProperties() hack in the vm module, i.e., Contextify. Use different V8 API methods, that allow interception of DefineProperty() and do not flatten accessor descriptors to property descriptors. Move many known issues to test cases. Factor out the last test in test-vm-context.js for nodejs/node#10223 into its own file, test-vm-strict-assign.js. Part of this CL is taken from a stalled PR by https://github.com/AnnaMag nodejs/node#13265 This PR requires a backport of https://chromium.googlesource.com/v8/v8/+/37a3a15c3e52e2146e45f41c427f24414e4d7f6f PR-URL: nodejs/node#16293 Fixes: nodejs/node#2734 Fixes: nodejs/node#10223 Fixes: nodejs/node#11803 Fixes: nodejs/node#11902 Ref: nodejs/node#6283 Ref: nodejs/node#15114 Ref: nodejs/node#13265 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
The known issue is fixed with nodejs/node#16293. The text needs to call `Object.hasOwnProperty(this)` instead of `this.hasOwnProperty()`, otherwise `this` is from the wrong context is used. Add a second test case taken verbatim from issue nodejs/node#5350 PR-URL: nodejs/node#16411 Fixes: nodejs/node#5350 Ref: nodejs/node#16293 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
PR-URL: nodejs/node#16409 Refs: nodejs/node#16293 Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
The known issue is fixed with #16293. The text needs to call `Object.hasOwnProperty(this)` instead of `this.hasOwnProperty()`, otherwise `this` is from the wrong context is used. Add a second test case taken verbatim from issue #5350 PR-URL: #16411 Fixes: #5350 Ref: #16293 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Remove the CopyProperties() hack in the vm module, i.e., Contextify. Use different V8 API methods, that allow interception of DefineProperty() and do not flatten accessor descriptors to property descriptors. Move many known issues to test cases. Factor out the last test in test-vm-context.js for nodejs/node#10223 into its own file, test-vm-strict-assign.js. Part of this CL is taken from a stalled PR by https://github.com/AnnaMag nodejs/node#13265 This PR requires a backport of https://chromium.googlesource.com/v8/v8/+/37a3a15c3e52e2146e45f41c427f24414e4d7f6f PR-URL: nodejs/node#16293 Fixes: nodejs/node#2734 Fixes: nodejs/node#10223 Fixes: nodejs/node#11803 Fixes: nodejs/node#11902 Ref: nodejs/node#6283 Ref: nodejs/node#15114 Ref: nodejs/node#13265 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
The known issue is fixed with nodejs/node#16293. The text needs to call `Object.hasOwnProperty(this)` instead of `this.hasOwnProperty()`, otherwise `this` is from the wrong context is used. Add a second test case taken verbatim from issue nodejs/node#5350 PR-URL: nodejs/node#16411 Fixes: nodejs/node#5350 Ref: nodejs/node#16293 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
PR-URL: nodejs/node#16409 Refs: nodejs/node#16293 Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
| Back | FazBrowse Home | New Git URL |
This PR removes the CopyProperties() hack in the vm module, i.e., Contextify.
Instead, it uses different V8 API methods, that allow interception of
DefineProperty() and do not flatten accessor descriptors to
property descriptors.
Move many known issues to test cases. Factor out the last test in
test-vm-context.js for
#10223
into its own file, test-vm-strict-assign.js.
Part of this CL is taken from a stalled PR by
https://github.com/AnnaMag
#13265
Refs: #6283
Refs: #15114
Refs: #13265
Fixes: #2734
Fixes: #10223
Fixes: #11803
Fixes: #11902
This PR requires a backport of
37a3a15 otherwise some tests will fail. Cherry pick PR.
Checklist
Affected core subsystem(s)
src
Checklist
Affected core subsystem(s)
src