Timothy Gu
2cb2145162
vm: allow modifying context name in inspector
...
The `auxData` field is not exposed to JavaScript, as DevTools uses it
for its `isDefault` parameter, which is implemented faithfully,
contributing to the nice indentation in the context selection panel.
Without the indentation, when `Target` domain gets implemented (along
with a single Inspector for cluster) in #16627 , subprocesses and VM
contexts will be mixed up, causing confusion.
PR-URL: https://github.com/nodejs/node/pull/17720
Refs: https://github.com/nodejs/node/pull/14231#issuecomment-315924067
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Jon Moss <me@jonathanmoss.me >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-12-23 14:05:18 +08:00
Daniel Bevenius
51c6737d3c
src: remove unused variable in node_contextify
...
Currently the following warning is show when building:
../src/node_contextify.cc:642:10:
warning: unused variable 'display_errors' [-Wunused-variable]
bool display_errors = maybe_display_errors.ToChecked();
This commit removes the unused variable which became unused in commit
aeddc3676b ("src: remove tracking for
exception arrow data").
PR-URL: https://github.com/nodejs/node/pull/17491
Refs: https://github.com/nodejs/node/pull/17394
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-12-08 11:22:10 +01:00
Anna Henningsen
b73e66e949
vm: never abort on caught syntax error
...
Keep track of C++ `TryCatch` state to avoid aborting when
an exception is thrown inside one, and re-throw in JS
to make sure the exception is being picked up a second time by
a second uncaught exception handler, if necessary.
Add a bit of a hack to `AppendExceptionLine` to avoid overriding
the line responsible for re-throwing the exception.
PR-URL: https://github.com/nodejs/node/pull/17394
Fixes: https://github.com/nodejs/node/issues/13258
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-12-05 23:49:36 +01:00
Anna Henningsen
aeddc3676b
src: remove tracking for exception arrow data
...
This is unnecessary since we only run `AppendExceptionLine()`
once per exception at this point anyway.
PR-URL: https://github.com/nodejs/node/pull/17394
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-12-05 23:49:36 +01:00
Leko
19221d1d6f
src: use non-deprecated versions of ->To*() utils
...
Squashed from multiple commits:
- src: replace ->To*(isolate) with ->To*(context).ToLocalChecked()
- test: use .As<Object> on Exception::Error
> Exception::Error always returns an object, so e.As<Object>() should also work fine
See https://github.com/nodejs/node/pull/17343#discussion_r153232027
- test: use .As<Object> instead of ->ToObject
we already checked that its a buffer
- src: use FromMaybe instead of ToLocalChecked
It fixed this test case: 19a1b2e414
- src: pass context to Get()
Dont pass Local<Context> is deprecated soon.
So we migrate to maybe version.
- src: return if Get or ToObject return an empty before call ToLocalChecked
Refs: https://github.com/nodejs/node/issues/17244
PR-URL: https://github.com/nodejs/node/pull/17343
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
2017-12-01 20:37:58 +01:00
Ben Noordhuis
6f724e1563
lib,src: remove vm.runInDebugContext()
...
The V8 API it is based on is deprecated and scheduled for removal later
this year. Remove it.
PR-URL: https://github.com/nodejs/node/pull/13295
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
2017-11-24 00:13:44 +01:00
Daniel Bevenius
a515e593f3
src: rename base-object -> base_object
...
This commit renames base-object to base_object for consitency with other
c++ source files.
PR-URL: https://github.com/nodejs/node/pull/17022
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
2017-11-17 12:49:10 +01:00
Yihong Wang
8680bb9f1a
src: explicitly register built-in modules
...
Previously, built-in modules are registered before main() via
__attribute__((constructor)) mechanism in GCC and similiar
mechanism in MSVC. This causes some issues when node is built as
static library. Calling module registration function for built-in
modules in node::Init() helps to avoid the issues.
Signed-off-by: Yihong Wang <yh.wang@ibm.com >
PR-URL: https://github.com/nodejs/node/pull/16565
Refs: https://github.com/nodejs/node/pull/14986#issuecomment-332758206
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-11-13 23:17:34 +00:00
Franziska Hinkelmann
f0c674d95b
src: explain implementation of vm module
...
The vm module uses interceptors on the object template. This is not
straight forward and a comment in the source will help the next
person working on this.
PR-URL: https://github.com/nodejs/node/pull/16962
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-11-12 11:09:03 -08:00
Toon Verwaest
ba885c42ef
src: remove unnecessary call to SetHiddenPrototype
...
Currently the template for the global object is explicitly marked as
hidden. This is unnecessary since the global object is automatically
marked as hidden by V8. Getting rid of this call gets rid of the last
use of SetHiddenPrototype.
PR-URL: https://github.com/nodejs/node/pull/16554
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
2017-11-06 15:09:05 +01:00
Joyee Cheung
cdb263d3ba
src: do not include x.h if x-inl.h is included
...
PR-URL: https://github.com/nodejs/node/pull/16548
Fixes: https://github.com/nodejs/node/issues/16519
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-10-30 18:56:38 +08:00
Franziska Hinkelmann
5856c836ea
src: fix vm module for strict mode
...
This patch fixes the problem with variables that
are declared only on the sandbox but not on the
global proxy.
PR-URL: https://github.com/nodejs/node/pull/16487
Fixes: https://github.com/nodejs/node/issues/12300
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-10-27 10:12:02 +02:00
Michaël Zasso
f0b871bada
src: remove unused warning in node_contextify
...
PR-URL: https://github.com/nodejs/node/pull/16408
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
2017-10-26 10:24:38 +02:00
Franziska Hinkelmann
f1d6b04ac9
src: use new V8 API in vm module
...
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
https://github.com/nodejs/node/issues/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
https://github.com/nodejs/node/pull/13265
This PR requires a backport of
https://chromium.googlesource.com/v8/v8/+/37a3a15c3e52e2146e45f41c427f24414e4d7f6f
PR-URL: https://github.com/nodejs/node/pull/16293
Fixes: https://github.com/nodejs/node/issues/2734
Fixes: https://github.com/nodejs/node/issues/10223
Fixes: https://github.com/nodejs/node/issues/11803
Fixes: https://github.com/nodejs/node/issues/11902
Ref: https://github.com/nodejs/node/issues/6283
Ref: https://github.com/nodejs/node/pull/15114
Ref: https://github.com/nodejs/node/pull/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 >
2017-10-23 14:35:09 +02:00
Anna Henningsen
290315ace7
src: refactor #include handling
...
`node_internals.h` already includes the most common headers,
so double includes can be avoided in a lot of cases. Also don’t include
`node_internals.h` from `node.h` implicitly anymore, as that is mostly
unnecessary.
PR-URL: https://github.com/nodejs/node/pull/14697
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-09-14 17:38:38 +02:00
Ben Noordhuis
668ad44922
intl: unexpose Intl.v8BreakIterator
...
It was never an official Ecma-402 API, it is about to be superseded
by `Intl.Segmenter` and it's prone to crash under some circumstances.
Searches don't turn up any usage in the wild and the recommendation
from the V8 team is to remove it. Now seems like a good a time as
any to do that.
Fixes: https://github.com/nodejs/node/issues/8865
Fixes: https://github.com/nodejs/node/issues/14909
Refs: https://github.com/tc39/proposal-intl-segmenter
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/620755
PR-URL: https://github.com/nodejs/node/pull/15238
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-09-10 22:00:25 +02:00
Timothy Gu
d932e80231
vm: support parsing a script in a specific context
...
PR-URL: https://github.com/nodejs/node/pull/14888
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com >
2017-09-05 10:47:42 +08:00
Marcel Laverdet
e018c33111
vm: fix race condition with timeout param
...
This fixes a race condition in the watchdog timer used for vm timeouts.
The condition would terminate the main stack's execution instead of the
code running under the sandbox.
PR-URL: https://github.com/nodejs/node/pull/13074
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-05-23 21:00:40 +02:00
Marcel Laverdet
3c5bfba28b
vm: fix displayErrors in runIn.. functions
...
This option has been broken for almost a year when used with any of the
vm.runIn.. family of functions, except for syntax errors.
PR-URL: https://github.com/nodejs/node/pull/13074
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-05-23 20:59:24 +02:00
Gabriel Schulhof
276720921b
addons: remove semicolons from after module definition
...
Having semicolons there runs counter to our documentation and illicits
warnings in pedantic mode. This removes semicolons from after uses of
NODE_MODULE and NODE_MODULE_CONTEXT_AWARE_BUILTIN.
PR-URL: https://github.com/nodejs/node/pull/12919
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com >
2017-05-15 20:33:06 +02:00
Tobias Nießen
88aab45c92
os,vm: fix segfaults and CHECK failure
...
Fixes multiple possible segmentation faults in node_contextify.cc and
an assertion failure in node_os.cc
Fixes: https://github.com/nodejs/node/issues/12369
Fixes: https://github.com/nodejs/node/issues/12370
PR-URL: https://github.com/nodejs/node/pull/12371
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-04-14 23:02:45 +02:00
Anna Henningsen
9d522225e7
src: reduce number of exported symbols
...
Use `static` definitions and anonymous namespaces to reduce the
number of symbols that are exported from the `node` binary.
PR-URL: https://github.com/nodejs/node/pull/12366
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-04-14 22:47:29 +02:00
AnnaMag
241de510a8
vm: use SetterCallback to set func declarations
...
Currently, when in strict mode, function
declarations are copied on the sandbox by
CopyProperties(), which is not necessary
and will break when CP is removed.
This change maintains current behavior,
letting GlobalPropertySetterCallback
copy functions on the sandbox instead
of using CP to do the task.
PR-URL: https://github.com/nodejs/node/pull/12051
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-03-31 22:07:45 +02:00
Ben Noordhuis
f35e80d9af
src: use persistent strings from node::Environment
...
Replace a few calls to FIXED_ONE_BYTE_STRING() with their persistent
counterparts from `node::Environment`. None of the calls are in hot
code paths but why create a new string when one already exists?
PR-URL: https://github.com/nodejs/node/pull/11945
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Brian White <mscdex@mscdex.net >
2017-03-22 09:19:48 -07:00
James M Snell
98e54b0bd4
meta: restore original copyright header
...
A prior io.js era commit inappropriately removed the
original copyright statements from the source. This
restores those in any files still remaining from that
edit.
Ref: https://github.com/nodejs/TSC/issues/174
Ref: https://github.com/nodejs/node/pull/10599
PR-URL: https://github.com/nodejs/node/pull/10155
Note: This PR was required, reviewed-by and approved
by the Node.js Foundation Legal Committee and the TSC.
There is no `Approved-By:` meta data.
2017-03-10 11:23:48 -08:00
Yang Guo
99b75fae10
src: remove usage of deprecated debug API
...
Debug::GetMirror is used in contextify to force loading of the debug
context. There is a better way to achieve this.
PR-URL: https://github.com/nodejs/node/pull/11437
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Evan Lucas <evanlucas@me.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2017-02-19 10:17:55 +01:00
Franziska Hinkelmann
02371985f1
src: fix delete operator on vm context
...
In the implementation of the vm module,
if a property is successfully deleted
on the sandbox, we also need to delete it
on the global_proxy object. Therefore, we
must not call args.GetReturnValue().Set().
We only intercept, i.e., call
args.GetReturnValue().Set(), in the
DeleterCallback, if Delete() failed, e.g. because
the property was read only.
PR-URL: https://github.com/nodejs/node/pull/11266
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2017-02-11 09:01:15 -08:00
Ben Noordhuis
6af0bfe1a0
src: fix -Wunused-result compiler warning
...
Fix a warning that was introduced in commit 67af1ad ("src: refactor
CopyProperties to remove JS") from a few days ago. This particular
change was suggested by me, mea culpa.
Fixes the following warning:
../src/node_contextify.cc:151:13: warning: ignoring return
value of function declared with warn_unused_result attribute
[-Wunused-result]
sandbox_obj->DefineProperty(context, key, *desc);
PR-URL: https://github.com/nodejs/node/pull/11197
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
2017-02-09 14:56:30 +01:00
AnnaMag
67af1ad671
src: refactor CopyProperties to remove JS
...
CopyProperties() is refactored to use
the V8 5.5 DefineProperty() API call.
The change does not alter current behaviour.
It is a step prior to removing the function
CopyProperties, which becomes reduntant
after fixes of V8 SetNamedPropertyHandler
in 5.5. V8.
Strings used as property attributes
(value, enumerable etc) and accessors
are defined as persistent strings
in src/env.h
PR-URL: https://github.com/nodejs/node/pull/11102
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-02-05 09:59:51 +01:00
Franziska Hinkelmann
e116cbe320
src: don't overwrite non-writable vm globals
...
Check that the property doesn't have the read-only flag set before
overwriting it.
This is Ben Noordhuis previous commit, but keeping
is_contextual_store. is_contextual_store describes whether
this.foo = 42 or foo = 42 was called. The second is contextual
and will fail in strict mode if foo is used without
declaration. Therefore only do an early return if it is
a contextual store. In particular, don't do an early
return for Object.defineProperty(this, ...).
Fixes: https://github.com/nodejs/node/issues/10223
Refs: https://github.com/nodejs/node/pull/10227
PR-URL: https://github.com/nodejs/node/pull/11109
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
2017-02-04 12:23:43 +01:00
Anna Henningsen
3e851cf18b
Revert "src: don't overwrite non-writable vm globals"
...
This reverts commit 524f693872 .
Fixes: https://github.com/nodejs/node/issues/10806
Fixes: https://github.com/nodejs/node/issues/10492
Ref: https://github.com/nodejs/node/pull/10227
PR-URL: https://github.com/nodejs/node/pull/10920
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2017-01-25 15:43:51 -08:00
Ben Noordhuis
524f693872
src: don't overwrite non-writable vm globals
...
Check that the property doesn't have the read-only flag set before
overwriting it.
Fixes: https://github.com/nodejs/node/issues/10223
PR-URL: https://github.com/nodejs/node/pull/10227
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
2016-12-13 13:13:24 +01:00
Franziska Hinkelmann
f7842ad169
src: refactor contextify
...
Small refactoring to make contextify more readable.
Remove auto and inline FromJust(). Simplify
if statement.
PR-URL: https://github.com/nodejs/node/pull/8909
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2016-10-16 12:54:40 +01:00
Franziska Hinkelmann
c32cfcbe39
src: refactor reading of options in contextify
...
Refactor various functions that read values from the contextify
options object. Rather than passing args and the index, pass the
value at that index.
We use env->isolate() rather than args.GetIsolate(), but since env
was constructed from args, this is the same isolate.
PR-URL: https://github.com/nodejs/node/pull/8850
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2016-10-03 12:25:09 +02:00
Daniel Bevenius
4f832ebaf6
src: fix minor typo in comments
...
Correcting a couple of minor spelling typos in comments.
PR-URL: https://github.com/nodejs/node/pull/8736
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com >
2016-09-24 21:09:43 +02:00
cjihrig
d7994db70c
src: handle thrown errors in CopyProperties()
...
This commit prevents thrown JavaScript exceptions from crashing
the process in node_contextify's CopyProperties() function.
Fixes: https://github.com/nodejs/node/issues/8537
PR-URL: https://github.com/nodejs/node/pull/8649
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2016-09-20 19:46:01 -04:00
Ben Noordhuis
0e6c336031
src: remove unneeded Environment error methods
...
They seem to have been introduced as "convenience methods" in commit
75adde0 ("src: remove `node_isolate` from source") for reasons I can
only guess at but they can be removed without much hassle.
PR-URL: https://github.com/nodejs/node/pull/8427
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2016-09-11 12:45:39 +02:00
Haojian Wu
43ef58005e
src: remove unused using decls
...
PR-URL: https://github.com/nodejs/node/pull/7990
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Brian White <mscdex@mscdex.net >
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com >
2016-08-08 09:17:12 -07:00
Franziska Hinkelmann
588ee2296a
src: do not copy on failing setProperty()
...
In vm, the setter interceptor should not copy a value onto the
sandbox, if setting it on the global object will fail. It will fail if
we are in strict mode and set a value without declaring it.
Fixes: https://github.com/nodejs/node/issues/5344
PR-URL: https://github.com/nodejs/node/pull/7908
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2016-08-04 12:42:55 -07:00
Anna Henningsen
3cac616791
vm: don't print out arrow message for custom error
...
In `AppendExceptionLine()`, which is used both by the `vm`
module and the uncaught exception handler, don’t print anything
to stderr when called from the `vm` module, even if the
thrown object is not a native error instance.
Fixes: https://github.com/nodejs/node/issues/7397
PR-URL: https://github.com/nodejs/node/pull/7398
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2016-06-30 13:02:19 +02:00
Ben Noordhuis
2f2002a75c
src: fix runtime/references cpplint warnings
...
PR-URL: https://github.com/nodejs/node/pull/7462
Reviewed-By: Trevor Norris <trev.norris@gmail.com >
2016-06-28 21:21:21 +02:00
Anna Henningsen
61196dedad
vm: test for abort condition of current invocation
...
When a vm script aborted after a timeout/signal interruption, test
whether the local timeout/signal watchdog was responsible for
terminating the execution.
Without this, when a shorter timer from an outer `vm.run*` invocation
fires before an inner timeout, the inner timeout would throw an error
instead of the outer one, but because it did not witness the timeout
itself, it would assume the termination was the result of a signal
interruption.
PR-URL: https://github.com/nodejs/node/pull/7373
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2016-06-25 05:50:26 +02:00
Anna Henningsen
0815b9401d
vm: add ability to break on sigint/ctrl+c
...
- Adds the `breakEvalOnSigint` option to `vm.runIn(This)Context`.
This uses a watchdog thread to wait for SIGINT and generally works
just like the existing `timeout` option.
- Adds a method to the existing timer-based watchdog to check if it
stopped regularly or by running into the timeout. This is used to
tell a SIGINT abort from a timer-based one.
- Adds (internal) `process._{start,stop}SigintWatchdog` methods to
start/stop the watchdog thread used by the above option manually.
This will be used in the REPL to set up SIGINT handling before
entering terminal raw mode, so that there is no time window in
which Ctrl+C fully aborts the process.
PR-URL: https://github.com/nodejs/node/pull/6635
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2016-06-18 20:44:16 +02:00
Trevor Norris
c0e6c668e6
src: no abort from getter if object isn't wrapped
...
v8::Object::GetAlignedPointerFromInternalField() returns a random value
if Wrap() hasn't been run on the object handle. Causing v8 to abort if
certain getters are accessed. It's possible to access these getters and
functions during class construction through the AsyncWrap init()
callback, and also possible in a subset of those scenarios while running
the persistent handle visitor.
Mitigate this issue by manually setting the internal aligned pointer
field to nullptr in the BaseObject constructor and add necessary logic
to return appropriate values when nullptr is encountered.
PR-URL: https://github.com/nodejs/node/pull/6184
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2016-05-24 14:40:22 -06:00
Anna Henningsen
4bd410bbbe
vm: don't abort process when stack space runs out
...
Make less assumptions about what objects will be available when
vm context creation or error message printing fail because V8
runs out of JS stack space.
Ref: https://github.com/nodejs/node/issues/6899
PR-URL: https://github.com/nodejs/node/pull/6907
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2016-05-24 17:03:02 +02:00
Sakthipriyan Vairamani
2c480bdae6
src: fix check-imports.py linter errors
...
This patch fixes all the linter errors.
PR-URL: https://github.com/nodejs/node/pull/6105
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2016-04-25 19:24:27 +05:30
Ben Noordhuis
a7581d0859
src: replace ARRAY_SIZE with typesafe arraysize
...
To prevent `ARRAY_SIZE(&arg)` (i.e., taking the array size of a pointer)
from happening again.
PR-URL: https://github.com/nodejs/node/pull/5969
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2016-04-05 11:37:02 +02:00
Ali Ijaz Sheikh
a53b2ac4b1
contextify: tie lifetimes of context & sandbox
...
When the previous set of changes (bfff07b4 ) it was possible to have the
context get garbage collected while sandbox was still live. We need to
tie the lifetime of the context to the lifetime of the sandbox.
Fixes: https://github.com/nodejs/node/issues/5768
PR-URL: https://github.com/nodejs/node/pull/5786
Reviewed-By: jasnell - James M Snell <jasnell@gmail.com >
Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: trevnorris - Trevor Norris <trev.norris@gmail.com >
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl >
2016-03-19 07:45:38 -07:00
Michaël Zasso
ad0ce57432
src: fix NewInstance deprecation warnings
...
PR-URL: https://github.com/nodejs/node/pull/4722
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com >
2016-03-03 20:35:20 -08:00
Ali Ijaz Sheikh
66566df577
contextify: cache sandbox and context in locals
...
PR-URL: https://github.com/nodejs/node/pull/5392
Reviewed-By: Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl >
2016-03-03 20:35:20 -08:00