Commit Graph

43 Commits

Author SHA1 Message Date
Trevor Norris
0a4ebc3d2c src: replace Holder() with This()
Switch to always use args.This() to retrieve object instance.
2013-04-19 15:24:01 +02:00
Trevor Norris
f65e14ed1d src: pass Isolate to all applicable api
Update the api to pass node_isolate to all supported methods.

Much thanks to Ben Noordhuis and his work in 51f6e6a.
2013-03-20 01:11:02 +01:00
Trevor Norris
0bba590283 bindings: update api
All compile time warnings about using deprecated APIs have been
suppressed by updating node's API. Though there are still many function
calls that can accept Isolate, and still need to be updated.

node_isolate had to be added as an extern variable in node.h and
node_object_wrap.h

Also a couple small fixes for Error handling.

Before v8 3.16.6 the error stack message was lazily written when it was
needed, which allowed you to change the message after instantiation.
Then the stack would be written with the new message the first time it
was accessed. Though that has changed. Now it creates the stack message
on instantiation. So setting a different message afterwards won't be
displayed.

This is not a complete fix for the problem. Getting error without any
message isn't very useful.
2013-03-20 01:11:01 +01:00
Ben Noordhuis
51f6e6a9b3 src, test: downgrade to v8 3.14 api 2013-02-25 23:45:02 +01:00
Ben Noordhuis
01c3d0aa88 src: pass node_isolate to Local<>::New 2013-01-07 17:39:57 +01:00
isaacs
b3cf3f35fc Report errors properly from --eval and stdin 2012-07-30 08:21:39 -07:00
Fedor Indutny
9f9c333cbc vm: accept only object as arg of .createContext()
Converting strings and others to objects is very slow and essentially
wrong.
2012-05-02 01:59:59 +07:00
Marcel Laverdet
70635753a3 Cleanup vm module memory leakage
There are some paths here that led to dangling contexts. By being
smarter with handle management we can get rid of all the cleanup code
and fix those issues.
2012-04-27 10:32:40 -07:00
Ben Noordhuis
ff4a9d381d core: use proper #include directives 2012-03-10 00:14:14 +01:00
Ben Noordhuis
b92a919500 Remove unused variables. 2012-02-23 04:11:07 -08:00
Ben Noordhuis
74a8215a86 Revert support for isolates.
It was decided that the performance benefits that isolates offer (faster spin-up
times for worker processes, faster inter-worker communication, possibly a lower
memory footprint) are not actual bottlenecks for most people and do not outweigh
the potential stability issues and intrusive changes to the code base that
first-class support for isolates requires.

Hence, this commit backs out all isolates-related changes.

Good bye, isolates. We hardly knew ye.
2012-02-06 15:44:42 +01:00
Fedor Indutny
a5f74b4da7 added isolates support 2012-01-10 02:19:14 +01:00
Ben Noordhuis
cdcb1118c8 Remove stray NODE_MODULE() semi-colons. 2011-11-09 16:34:09 +01:00
Ryan Dahl
9d27faa2c4 Revert "Fix #1801 vm: Use 'sandbox' as global_prototype"
Accidentally committed. Revert until review.

This reverts commit 200df8641b.
2011-10-19 11:01:08 -07:00
elliottcable
200df8641b Fix #1801 vm: Use 'sandbox' as global_prototype
Squashed commit:

(- re tests) Cleaning up the `Script` test suite.

For whatever reason, there were several duplicate test files related to `Script`
and the `'vm'` module. I removed these, and fixed a few other small issues.
(More fixes coming in subsequent commits.)

Squashes: 19e86045a0..1e3dcff4eb

(api fix:1801 new:1801) `'vm'` module uses sandbox as prototype

As described in GH-1801, the `'vm'` module was handling the `sandbox` object
provided by the API consumer in a particularly terrible and fragile fashion: it
was simply shallow-copying any enumerable properties from the sandbox onto the
global context before executing the code, and then eventually copying any values
on the global context back into the sandbox object *afterwards*.

This commit removes all of that implementation, and utilizes the passed sandbox
object as the *prototype of the context* instead. A bit of a hack, but a very
effective one.

This no longer allows for new variables created in the global context to be
placed into your sandbox after execution has completed, but that’s for the best
anyway, as it’s not very in line with the concept of a “box of passed-in
context.” I’m planning to further implement an interface for API consumers to
acquire the *actual global* from within the VM soon, thus allowing for
separation-of-concerns: providing data *to* the VM via the sandbox-prototype,
and exploring the internal environment of the VM itself.

// GitHub cruft: closes #1801

Squashes: 43b8e3c..209ed86
2011-10-18 17:56:35 -07:00
Ben Noordhuis
0dc844de17 node_script: remove unused variable 2011-10-14 15:01:21 +00:00
Fedor Indutny
b942c6339a Remove obsolete 'using v8::Null'
Fixes #1680.
2011-09-10 17:44:52 -07:00
Fedor Indutny
8c2c7bb8a9 vm context with accessors
fixes #1673
2011-09-10 10:51:58 -07:00
Ryan Dahl
26834b0524 Revert "vm context with accessors"
This reverts commit 4527de8cba.

Causes segfault in test/message/undefined_reference_in_new_context.js
2011-09-08 13:30:52 -07:00
Fedor Indutny
4527de8cba vm context with accessors
true copy of sandbox properties

catch sealed errors, pass global's prototype to CloneObject

Fixes #1673
2011-09-08 11:59:21 -07:00
Antranig Basman
c05936ca13 vm: fix incorrect dispatch of vm.runInContext for argument "filename"
Adds test case and documentation for vm.runInContext and vm.createContext.

Fixes #1140.
2011-08-16 14:50:04 +02:00
Ben Noordhuis
f087206067 Verify that the argument passed to vm.runInContext() is a context object.
Fixes #558.
2011-07-05 23:39:13 +02:00
Ryan Dahl
598792ba91 Merge branch 'v0.4'
Conflicts:
	src/platform_sunos.cc
	test/simple/test-os.js
2011-04-14 01:11:21 +00:00
Jakub Lekstan
81cbd42cf5 Fixes the circular reference in vm modules.
Fixes the circular reference problem. Closes GH-822.
2011-04-12 15:51:57 -07:00
Ryan Dahl
75db1995b6 Don't conflict with V8's Script class
Closes GH-203.
2011-03-30 10:06:25 -07:00
Ryan Dahl
55048cdf79 Update copyright headers 2011-03-14 17:37:05 -07:00
Ryan Dahl
1f50d711b2 Fix memleak in vm.runInNewContext
Closes GH-704.
2011-02-24 15:46:55 -08:00
Ryan Dahl
1345103c3a Fix typos 2011-01-02 01:13:27 -08:00
Ryan Dahl
1c7cd4aac3 Make syntax error display optional
Fixes GH-543
2011-01-01 16:38:31 -08:00
Ryan Dahl
40f29dd48a Lint node_script.cc 2011-01-01 13:41:04 -08:00
Ryan Dahl
b57c1f51b9 Saner, yet still ugly, fix to displaying syntax errors 2010-11-23 18:46:13 -08:00
Ryan Dahl
f123a1ab40 hack to display syntax errors. FIXME 2010-11-22 17:55:04 -08:00
Ryan Dahl
fe74283e1d Fix a few compiler warnings... 2010-10-09 16:04:38 -07:00
Ben Noordhuis
55c65cc2d5 Safe constructor for ObjectWrapped classes
New() methods should be invoked as constructors, not regular functions.
Corner cases like Script::New() may cause a SIGSEGV when the GC is run.

More details: http://groups.google.com/group/nodejs/browse_thread/thread/a7e5db68d4cd6356
2010-09-29 16:02:45 -07:00
Herbert Vojčík
71651bf8b2 Make test-global work with NODE_MODULE_CONTEXTS. 2010-09-08 10:40:55 -07:00
Ryan Dahl
31b59400f8 Allow null context in Script 2010-08-04 10:20:40 -07:00
Paul Querna
870aa3d97f Move evals to extension module. 2010-07-14 10:55:07 -07:00
Blake Mizerany
8c8534046c fix whitespace errors 2010-06-29 23:59:24 -07:00
Ryan Dahl
23172c5d85 Lint node_script.cc 2010-06-28 19:37:50 -07:00
Ruben Rodriguez
242161bef2 Added new API to Script, and implemented it in the REPL 2010-06-28 15:16:26 -07:00
Ryan Dahl
f1a4f17897 script.runIn*Context not throwing errors properly. 2010-06-19 19:31:09 -07:00
isaacs
78be1e4930 Remove the ReportException from the Script class
This is so that syntax errors can be handled discretely in places like the
repl, where SyntaxErrors are expected and normal.
2010-05-19 15:02:47 -07:00
Herbert Vojcik
c2a06725d6 Script class with eval-function-family in binding('evals') plus tests. 2010-04-18 15:01:36 -04:00