Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
node: --no-dom-globals CLI flag#5853
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
indutny commented Mar 23, 2016
Hey @zcbenz ! I just decided to land some of the commits that you did in atom/node. May I ask you what was the reasoning behind atom/node@82e10ce#diff-6ff379484cbabad48301d485db111c08R44 ? Would there be any problem for atom, if we won't hide them too? |
Fishrock123 commented Mar 23, 2016
Also requires flag docs in |
src/node.cc Outdated
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.
Spacing?
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.
Not really. There is no \n on previous line.
Fishrock123 commented Mar 23, 2016
Maybe |
test/parallel/test-cli-options.js Outdated
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.
Could you assert.ifError(err) for completeness. And maybe change equal() to strictEqual().
rvagg commented Mar 23, 2016
since the target is embedders, perhaps there's a better way of doing this than using a cmdline flag where its usefulness is much more limited? |
indutny commented Mar 23, 2016
@rvagg like what? |
indutny commented Mar 23, 2016
@Fishrock123 ack |
indutny commented Mar 23, 2016
jasnell commented Mar 23, 2016
I tend to agree with @rvagg on this... it seems like there ought to be a better way. If this is for embedders, for instance, then perhaps a programmatic configuration hook that allows the builtins to be switched off or replaced? Not sure I see the value of having this as a command line option. |
rvagg commented Mar 23, 2016
How about we put it in |
Fishrock123 commented Mar 23, 2016
cc also @rogerwang of nw.js, since I'm sure they also run into this. |
rogerwang commented Mar 23, 2016
Thanks for CCing. It looks good to me either way. |
jasnell commented Mar 23, 2016
A |
indutny commented Mar 23, 2016
Yep, I agree with |
Fishrock123 commented Mar 23, 2016
@jasnell Pretty sure it would. I was the one who originally suggested a CLI option. |
indutny commented Mar 23, 2016
Ok, pushed an update. PTAL |
jasnell commented Mar 23, 2016
LGTM but I do think it needs to be clear that running in this mode is not officially supported in core (similarly to how we treat building without openssl) |
Introduce `--no-browser-globals` configure flag. With this flag set, following globals won't be exported: - `setTimeout`, `clearTimeout`, `setInterval`, `clearInterval`, `setImmediate`, `clearImmediate` - `console` These are provided by the DOM implementation in browser, so the `--no-browser-globals` flag may be helpful when embedding node.js within chromium/webkit. Inspired-By: atom/node@82e10ce
indutny commented Mar 23, 2016
indutny commented Mar 23, 2016
jasnell commented Mar 23, 2016
LGTM |
Fishrock123 commented Mar 24, 2016
@indutny The other globals don't conflict with browser ones. :) |
indutny commented Mar 24, 2016
I know, but the original atom commit has more stuff in removed in it. |
rvagg commented Mar 24, 2016
lgtm but would really like to have @zcbenz weigh in before merging |
zcbenz commented Mar 26, 2016
This is awesome, thanks for doing this! And this PR looks good to me.
In ancient versions of Node.js those lines used to cause troubles, I think it is good to keep them untouched now. |
indutny commented Mar 26, 2016
Great, landing then! @zcbenz thank you! I'm going to port some of the other commits from your repo in one way or another, hope it will simplify node.js update process for electron! |
indutny commented Mar 26, 2016
Landed in 8363ede, thank you! |
Introduce `--no-browser-globals` configure flag. With this flag set, following globals won't be exported: - `setTimeout`, `clearTimeout`, `setInterval`, `clearInterval`, `setImmediate`, `clearImmediate` - `console` These are provided by the DOM implementation in browser, so the `--no-browser-globals` flag may be helpful when embedding node.js within chromium/webkit. Inspired-By: atom/node@82e10ce PR-URL: #5853 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rod Vagg <[email protected]>
Introduce `--no-browser-globals` configure flag. With this flag set, following globals won't be exported: - `setTimeout`, `clearTimeout`, `setInterval`, `clearInterval`, `setImmediate`, `clearImmediate` - `console` These are provided by the DOM implementation in browser, so the `--no-browser-globals` flag may be helpful when embedding node.js within chromium/webkit. Inspired-By: atom/node@82e10ce PR-URL: #5853 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rod Vagg <[email protected]>
Notable changes: * buffer: * make byteLength work with ArrayBuffer & DataView (Jackson Tian) [#5255](#5255) * backport --zero-fill-buffers command line option (James M Snell) [#5744](#5744) * backport new buffer constructor APIs (James M Snell) [#5763](#5763) * add swap16() and swap32() methods (James M Snell) [#5724](#5724) * fs: add the fs.mkdtemp() function. (Florian MARGAINE) [#5333](#5333) * net: emit host in lookup event (HUANG Wei) [#5598](#5598) * node: --no-browser-globals configure flag (Fedor Indutny) [#5853](#5853) * npm: Upgrade to v3.8.3. (Forrest L Norvell) * repl: support standalone blocks (Prince J Wesley) [#5581](#5581) * src: override v8 thread defaults using cli options (Tom Gallacher) [#4344](#4344)
Introduce `--no-browser-globals` configure flag. With this flag set, following globals won't be exported: - `setTimeout`, `clearTimeout`, `setInterval`, `clearInterval`, `setImmediate`, `clearImmediate` - `console` These are provided by the DOM implementation in browser, so the `--no-browser-globals` flag may be helpful when embedding node.js within chromium/webkit. Inspired-By: atom/node@82e10ce PR-URL: #5853 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rod Vagg <[email protected]>
Notable changes: * buffer: * make byteLength work with ArrayBuffer & DataView (Jackson Tian) [#5255](#5255) * backport --zero-fill-buffers command line option (James M Snell) [#5744](#5744) * backport new buffer constructor APIs (James M Snell) [#5763](#5763) * add swap16() and swap32() methods (James M Snell) [#5724](#5724) * fs: add the fs.mkdtemp() function. (Florian MARGAINE) [#5333](#5333) * net: emit host in lookup event (HUANG Wei) [#5598](#5598) * node: --no-browser-globals configure flag (Fedor Indutny) [#5853](#5853) * npm: Upgrade to v3.8.3. Fixes a security flaw in the use of authentication tokens in HTTP requests that would allow an attacker to set up a server that could collect tokens from users of the command-line interface. Authentication tokens have previously been sent with every request made by the CLI for logged-in users, regardless of the destination of the request. This update fixes this by only including those tokens for requests made against the registry or registries used for the current install. (Forrest L Norvell) [npm#6](npm#6) * repl: support standalone blocks (Prince J Wesley) [#5581](#5581) * src: override v8 thread defaults using cli options (Tom Gallacher) [#4344](#4344)
Notable changes: * buffer: * make byteLength work with ArrayBuffer & DataView (Jackson Tian) [#5255](#5255) * backport --zero-fill-buffers command line option (James M Snell) [#5744](#5744) * backport new buffer constructor APIs (James M Snell) [#5763](#5763) * add swap16() and swap32() methods (James M Snell) [#5724](#5724) * fs: add the fs.mkdtemp() function. (Florian MARGAINE) [#5333](#5333) * net: emit host in lookup event (HUANG Wei) [#5598](#5598) * node: --no-browser-globals configure flag (Fedor Indutny) [#5853](#5853) * npm: Upgrade to v3.8.3. Fixes a security flaw in the use of authentication tokens in HTTP requests that would allow an attacker to set up a server that could collect tokens from users of the command-line interface. Authentication tokens have previously been sent with every request made by the CLI for logged-in users, regardless of the destination of the request. This update fixes this by only including those tokens for requests made against the registry or registries used for the current install. (Forrest L Norvell) [npm#6](npm#6) * repl: support standalone blocks (Prince J Wesley) [#5581](#5581) * src: override v8 thread defaults using cli options (Tom Gallacher) [#4344](#4344)
Notable changes: * buffer: * make byteLength work with ArrayBuffer & DataView (Jackson Tian) [#5255](#5255) * backport --zero-fill-buffers command line option (James M Snell) [#5744](#5744) * backport new buffer constructor APIs (James M Snell) [#5763](#5763) * add swap16() and swap32() methods (James M Snell) [#5724](#5724) * fs: add the fs.mkdtemp() function. (Florian MARGAINE) [#5333](#5333) * net: emit host in lookup event (HUANG Wei) [#5598](#5598) * node: --no-browser-globals configure flag (Fedor Indutny) [#5853](#5853) * npm: Upgrade to v3.8.3. Fixes a security flaw in the use of authentication tokens in HTTP requests that would allow an attacker to set up a server that could collect tokens from users of the command-line interface. Authentication tokens have previously been sent with every request made by the CLI for logged-in users, regardless of the destination of the request. This update fixes this by only including those tokens for requests made against the registry or registries used for the current install. (Forrest L Norvell) [npm#6](npm#6) * repl: support standalone blocks (Prince J Wesley) [#5581](#5581) * src: override v8 thread defaults using cli options (Tom Gallacher) [#4344](#4344) PR-URL: #5970
Pull Request check-list
Please make sure to review and check all of these items:
make -j8 test(UNIX) orvcbuild test nosign(Windows) pass withthis change (including linting)?
test (or a benchmark) included?
existing APIs, or introduces new ones)?
NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.
Affected core subsystem(s)
Please provide affected core subsystem(s) (like buffer, cluster, crypto, etc)
Description of change
Introduce
--no-dom-globalsCLI flag. With this flag set, followingglobals won't be exported:
setTimeout,clearTimeout,setInterval,clearInterval,setImmediate,clearImmediateconsoleThese are provided by the DOM implementation in browser, so the
--no-dom-globalsflag may be helpful when embedding node.js withinchromium/webkit.
Inspired-By: atom/node@82e10ce