| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
idea seems sound to me |
Sorry, something went wrong.
There was a problem hiding this comment.
What does global in the inner context refer to now? I think it should still be context, right?
(The second line here also seems to have been superfluous?)
Sorry, something went wrong.
There was a problem hiding this comment.
Both lines should stay the same
Sorry, something went wrong.
There was a problem hiding this comment.
@addaleax - yes, this was an oversight...
Sorry, something went wrong.
|
@lance This solution has some side effects! node 🙈 ₹ git:(master) cat ~/Desktop/test.js
let repl = require('repl')
repl.start({useGlobal: false})
node 🙈 ₹ git:(master) ./node !$
./node ~/Desktop/test.js
> [] instanceof Array
false
> /vm/ instanceof RegExp
false
> |
Sorry, something went wrong.
|
@princejwesley hmm - this is strange. I will take a look at this. |
Sorry, something went wrong.
|
@princejwesley this issue should be addressed with my latest push. |
Sorry, something went wrong.
There was a problem hiding this comment.
@lance instanceof test for this filtered list may fail!. e.g Int16Array. Can you confirm that? Adding those missing properties to GLOBAL_OBJECT_PROPERTIES will solve this issue.
Sorry, something went wrong.
There was a problem hiding this comment.
I couldn't figure out the best way to test this programmatically, but the CLI behavior tests manually as expected.
~/s/node git:repl-useglobal-false-tab-completion ❯❯❯ ./node test-use-global-auto-complete.js > const x = new Int16Array() undefined > x instanceof Int16Array true >
I think this is the case because there is no builtin shorthand for Int16Array and the like. For builtin objects that have a shorthand representation such as [] or /\w+/ that representation is an instanceofthe builtin language object no matter what. But there is no builtin shorthand for Int16Array.
Sorry, something went wrong.
|
nice work, LGTM with two questions |
Sorry, something went wrong.
When `useGlobal` is false, tab completion in the repl does not enumerate
global properties. Instead of just setting these properties blindly on
the global context, e.g.
context[prop] = global[prop]
Use `Object.defineProperty` and the property descriptor found on
`global` for the new property in `context`.
Also addresses a previously unnoticed issue where `console` is writable
when `useGlobal` is false.
Ref: #7353
When `useGlobal` is false, all of the properties on `global` are copied to the new context (excluding `console` and `global`). Since `Object.getOwnPropertyNames()` returns all properties, not just enumerable ones, builtin properties on `global` are returned. We need to filter those out.
This existed in the original `repl.js` code, but it's not clear what the purpose is. It appears to be redundant.
| const parentModule = module; | ||
| const replMap = new WeakMap(); | ||
|
|
||
| const GLOBAL_OBJECT_PROPERTIES = ['NaN', 'Infinity', 'undefined', |
There was a problem hiding this comment.
I really wish we had a better way of tracking these... ah well.
Sorry, something went wrong.
|
LGTM with a couple of nits |
Sorry, something went wrong.
If the binary has been built with `./configure --without-intl` then the `Intl` builtin type will not be available in a repl runtime. Check for this in the test.
|
CI: https://ci.nodejs.org/job/node-test-pull-request/3094/ @addaleax have I answered your questions well enough? |
Sorry, something went wrong.
|
CI is green & this still LGTM |
Sorry, something went wrong.
|
LGTM |
Sorry, something went wrong.
When `useGlobal` is false, tab completion in the repl does not enumerate
global properties. Instead of just setting these properties blindly on
the global context, e.g.
context[prop] = global[prop]
Use `Object.defineProperty` and the property descriptor found on
`global` for the new property in `context`.
Also addresses a previously unnoticed issue where `console` is writable
when `useGlobal` is false.
If the binary has been built with `./configure --without-intl` then the
`Intl` builtin type will not be available in a repl runtime. Check for
this in the test.
Fixes: #7353
PR-URL: #7369
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
When `useGlobal` is false, tab completion in the repl does not enumerate
global properties. Instead of just setting these properties blindly on
the global context, e.g.
context[prop] = global[prop]
Use `Object.defineProperty` and the property descriptor found on
`global` for the new property in `context`.
Also addresses a previously unnoticed issue where `console` is writable
when `useGlobal` is false.
If the binary has been built with `./configure --without-intl` then the
`Intl` builtin type will not be available in a repl runtime. Check for
this in the test.
Fixes: #7353
PR-URL: #7369
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Sorry, something went wrong.
|
Yes, but I think I’d like to give it a bit more time in v6? @lance feel free to overrule me here. :) |
Sorry, something went wrong.
|
I agree, this should be in a couple v6 releases first. |
Sorry, something went wrong.
Sorry, something went wrong.
When `useGlobal` is false, tab completion in the repl does not enumerate
global properties. Instead of just setting these properties blindly on
the global context, e.g.
context[prop] = global[prop]
Use `Object.defineProperty` and the property descriptor found on
`global` for the new property in `context`.
Also addresses a previously unnoticed issue where `console` is writable
when `useGlobal` is false.
If the binary has been built with `./configure --without-intl` then the
`Intl` builtin type will not be available in a repl runtime. Check for
this in the test.
Fixes: #7353
PR-URL: #7369
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
When `useGlobal` is false, tab completion in the repl does not enumerate
global properties. Instead of just setting these properties blindly on
the global context, e.g.
context[prop] = global[prop]
Use `Object.defineProperty` and the property descriptor found on
`global` for the new property in `context`.
Also addresses a previously unnoticed issue where `console` is writable
when `useGlobal` is false.
If the binary has been built with `./configure --without-intl` then the
`Intl` builtin type will not be available in a repl runtime. Check for
this in the test.
Fixes: #7353
PR-URL: #7369
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
When `useGlobal` is false, tab completion in the repl does not enumerate
global properties. Instead of just setting these properties blindly on
the global context, e.g.
context[prop] = global[prop]
Use `Object.defineProperty` and the property descriptor found on
`global` for the new property in `context`.
Also addresses a previously unnoticed issue where `console` is writable
when `useGlobal` is false.
If the binary has been built with `./configure --without-intl` then the
`Intl` builtin type will not be available in a repl runtime. Check for
this in the test.
Fixes: #7353
PR-URL: #7369
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
When `useGlobal` is false, tab completion in the repl does not enumerate
global properties. Instead of just setting these properties blindly on
the global context, e.g.
context[prop] = global[prop]
Use `Object.defineProperty` and the property descriptor found on
`global` for the new property in `context`.
Also addresses a previously unnoticed issue where `console` is writable
when `useGlobal` is false.
If the binary has been built with `./configure --without-intl` then the
`Intl` builtin type will not be available in a repl runtime. Check for
this in the test.
Fixes: #7353
PR-URL: #7369
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This LTS release comes with 219 commits. This includes 80 commits that
are docs related, 58 commits that are test related, 20 commits that
are build / tool related, and 9 commits that are updates to
dependencies.
Notable Changes
* build:
- It is now possible to build the documentation from the release
tarball (Anna Henningsen)
#8413
* buffer:
- Buffer will no longer incorrectly return a zero filled buffer when
an encoding is passed (Teddy Katz)
#9238
* deps:
- upgrade npm in LTS to 2.15.11 (Kat Marchán)
#8928
* repl:
- Enable tab completion for global properties (Lance Ball)
#7369
* url:
- `url.format()` will now encode all `#` in `search` (Ilkka Myller)
#8072
PR-URL: #9298
This LTS release comes with 219 commits. This includes 80 commits that
are docs related, 58 commits that are test related, 20 commits that
are build / tool related, and 9 commits that are updates to
dependencies.
Notable Changes
* build:
- It is now possible to build the documentation from the release
tarball (Anna Henningsen)
#8413
* buffer:
- Buffer.alloc() will no longer incorrectly return a zero filled
buffer when an encoding is passed (Teddy Katz)
#9238
* deps:
- upgrade npm in LTS to 2.15.11 (Kat Marchán)
#8928
* repl:
- Enable tab completion for global properties (Lance Ball)
#7369
* url:
- `url.format()` will now encode all `#` in `search` (Ilkka Myller)
#8072
PR-URL: #9298
This LTS release comes with 219 commits. This includes 80 commits that
are docs related, 58 commits that are test related, 20 commits that
are build / tool related, and 9 commits that are updates to
dependencies.
Notable Changes
* build:
- It is now possible to build the documentation from the release
tarball (Anna Henningsen)
#8413
* buffer:
- Buffer.alloc() will no longer incorrectly return a zero filled
buffer when an encoding is passed (Teddy Katz)
#9238
* deps:
- upgrade npm in LTS to 2.15.11 (Kat Marchán)
#8928
* repl:
- Enable tab completion for global properties (Lance Ball)
#7369
* url:
- `url.format()` will now encode all `#` in `search` (Ilkka Myller)
#8072
PR-URL: #9298
This LTS release comes with 219 commits. This includes 80 commits that
are docs related, 58 commits that are test related, 20 commits that
are build / tool related, and 9 commits that are updates to
dependencies.
Notable Changes
* build:
- It is now possible to build the documentation from the release
tarball (Anna Henningsen)
#8413
* buffer:
- Buffer.alloc() will no longer incorrectly return a zero filled
buffer when an encoding is passed (Teddy Katz)
#9238
* deps:
- upgrade npm in LTS to 2.15.11 (Kat Marchán)
#8928
* repl:
- Enable tab completion for global properties (Lance Ball)
#7369
* url:
- `url.format()` will now encode all `#` in `search` (Ilkka Myller)
#8072
PR-URL: #9298
This LTS release comes with 219 commits. This includes 80 commits that
are docs related, 58 commits that are test related, 20 commits that
are build / tool related, and 9 commits that are updates to
dependencies.
Notable Changes
* build:
- It is now possible to build the documentation from the release
tarball (Anna Henningsen)
nodejs/node#8413
* buffer:
- Buffer.alloc() will no longer incorrectly return a zero filled
buffer when an encoding is passed (Teddy Katz)
nodejs/node#9238
* deps:
- upgrade npm in LTS to 2.15.11 (Kat Marchan)
nodejs/node#8928
* repl:
- Enable tab completion for global properties (Lance Ball)
nodejs/node#7369
* url:
- `url.format()` will now encode all `#` in `search` (Ilkka Myller)
nodejs/node#8072
PR-URL: nodejs/node#9298
Signed-off-by: Ilkka Myller <ilkka.myller@nodefield.com>
| Back | FazBrowse Home | New Git URL |
Checklist
Affected core subsystem(s)
repl
Description of change
When useGlobal is false, tab completion in the repl does not enumerate
global properties. Instead of just setting these properties blindly on
the global context, e.g.
Use Object.defineProperty and the property descriptor found on
global for the new property in context.
Also addresses a previously unnoticed issue where console is writable
when useGlobal is false.
Ref: #7353