Commit Graph

31 Commits

Author SHA1 Message Date
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