therubyracer-tmpfork 0.12.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +23 -0
  3. data/.travis.yml +14 -0
  4. data/Changelog.md +263 -0
  5. data/Gemfile +15 -0
  6. data/README.md +224 -0
  7. data/Rakefile +42 -0
  8. data/benchmarks.rb +218 -0
  9. data/ext/v8/accessor.cc +181 -0
  10. data/ext/v8/array.cc +26 -0
  11. data/ext/v8/backref.cc +45 -0
  12. data/ext/v8/constants.cc +34 -0
  13. data/ext/v8/constraints.cc +52 -0
  14. data/ext/v8/context.cc +130 -0
  15. data/ext/v8/date.cc +18 -0
  16. data/ext/v8/exception.cc +38 -0
  17. data/ext/v8/extconf.rb +34 -0
  18. data/ext/v8/external.cc +43 -0
  19. data/ext/v8/function.cc +58 -0
  20. data/ext/v8/gc.cc +43 -0
  21. data/ext/v8/handles.cc +34 -0
  22. data/ext/v8/heap.cc +35 -0
  23. data/ext/v8/init.cc +39 -0
  24. data/ext/v8/invocation.cc +86 -0
  25. data/ext/v8/locker.cc +77 -0
  26. data/ext/v8/message.cc +51 -0
  27. data/ext/v8/object.cc +335 -0
  28. data/ext/v8/primitive.cc +8 -0
  29. data/ext/v8/rr.cc +83 -0
  30. data/ext/v8/rr.h +934 -0
  31. data/ext/v8/script.cc +115 -0
  32. data/ext/v8/signature.cc +18 -0
  33. data/ext/v8/stack.cc +76 -0
  34. data/ext/v8/string.cc +47 -0
  35. data/ext/v8/template.cc +175 -0
  36. data/ext/v8/trycatch.cc +87 -0
  37. data/ext/v8/v8.cc +87 -0
  38. data/ext/v8/value.cc +239 -0
  39. data/lib/therubyracer.rb +1 -0
  40. data/lib/v8.rb +30 -0
  41. data/lib/v8/access.rb +5 -0
  42. data/lib/v8/access/indices.rb +40 -0
  43. data/lib/v8/access/invocation.rb +47 -0
  44. data/lib/v8/access/names.rb +65 -0
  45. data/lib/v8/array.rb +26 -0
  46. data/lib/v8/context.rb +258 -0
  47. data/lib/v8/conversion.rb +36 -0
  48. data/lib/v8/conversion/array.rb +11 -0
  49. data/lib/v8/conversion/class.rb +119 -0
  50. data/lib/v8/conversion/code.rb +38 -0
  51. data/lib/v8/conversion/fixnum.rb +11 -0
  52. data/lib/v8/conversion/fundamental.rb +11 -0
  53. data/lib/v8/conversion/hash.rb +11 -0
  54. data/lib/v8/conversion/indentity.rb +31 -0
  55. data/lib/v8/conversion/method.rb +26 -0
  56. data/lib/v8/conversion/object.rb +28 -0
  57. data/lib/v8/conversion/primitive.rb +7 -0
  58. data/lib/v8/conversion/proc.rb +5 -0
  59. data/lib/v8/conversion/reference.rb +16 -0
  60. data/lib/v8/conversion/string.rb +12 -0
  61. data/lib/v8/conversion/symbol.rb +7 -0
  62. data/lib/v8/conversion/time.rb +13 -0
  63. data/lib/v8/error.rb +169 -0
  64. data/lib/v8/function.rb +28 -0
  65. data/lib/v8/object.rb +79 -0
  66. data/lib/v8/stack.rb +85 -0
  67. data/lib/v8/version.rb +3 -0
  68. data/lib/v8/weak.rb +82 -0
  69. data/spec/c/array_spec.rb +17 -0
  70. data/spec/c/constants_spec.rb +20 -0
  71. data/spec/c/exception_spec.rb +26 -0
  72. data/spec/c/external_spec.rb +9 -0
  73. data/spec/c/function_spec.rb +46 -0
  74. data/spec/c/handles_spec.rb +35 -0
  75. data/spec/c/locker_spec.rb +38 -0
  76. data/spec/c/object_spec.rb +46 -0
  77. data/spec/c/script_spec.rb +28 -0
  78. data/spec/c/string_spec.rb +16 -0
  79. data/spec/c/template_spec.rb +30 -0
  80. data/spec/c/trycatch_spec.rb +51 -0
  81. data/spec/mem/blunt_spec.rb +42 -0
  82. data/spec/redjs_spec.rb +10 -0
  83. data/spec/spec_helper.rb +45 -0
  84. data/spec/threading_spec.rb +64 -0
  85. data/spec/v8/context_spec.rb +19 -0
  86. data/spec/v8/conversion_spec.rb +52 -0
  87. data/spec/v8/error_spec.rb +167 -0
  88. data/spec/v8/function_spec.rb +9 -0
  89. data/spec/v8/object_spec.rb +15 -0
  90. data/thefrontside.png +0 -0
  91. data/therubyracer-tmpfork.gemspec +22 -0
  92. metadata +186 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a23fd244a37ab382802b2403f93a5301adc3c979
4
+ data.tar.gz: 830f46b89a6f5e80c5988670d6123c2f652b29ca
5
+ SHA512:
6
+ metadata.gz: 3393e9705ce45ab9115154be5f4f443928ecd6b2e80b707f3f79534f355a4041978d90b6ce431d94ca674de1b00633c0e81086ec18d2a1935c6462abf7bf3312
7
+ data.tar.gz: 81766e3f874c1cd4a31a0061d2b0d4f8fef3f7193ad04729da7383e2ce8df6ac5db7fce402beb15862a7917286fa8e34b63f7984492d417244babad300311e33
@@ -0,0 +1,23 @@
1
+ *.gem
2
+ *.rbc
3
+ .rbx/
4
+ .rvmrc
5
+ .bundle
6
+ .config
7
+ .yardoc
8
+ .project
9
+ .cproject
10
+ Gemfile.lock
11
+ InstalledFiles
12
+ _yardoc
13
+ coverage
14
+ doc/
15
+ lib/bundler/man
16
+ lib/v8/*.bundle
17
+ lib/v8/*.so
18
+ pkg
19
+ rdoc
20
+ spec/reports
21
+ test/tmp
22
+ test/version_tmp
23
+ tmp
@@ -0,0 +1,14 @@
1
+ cache: bundler
2
+ rvm:
3
+ - 2.1.0
4
+ - 2.0.0
5
+ - 1.9.3
6
+ - 1.9.2
7
+ - 1.8.7
8
+ - rbx-2.2.3
9
+ notifications:
10
+ recipients:
11
+ - cowboyd@thefrontside.net
12
+ before_install:
13
+ - gem update --system 2.1.11
14
+ script: bundle exec rake compile spec
@@ -0,0 +1,263 @@
1
+ # Changelog
2
+
3
+ ## 0.12.2 2015/04/06
4
+
5
+ * fix memory leak where weak hash map entries were not being cleaned
6
+ up. Thanks to @SamSaffon
7
+
8
+ ## 0.12.1 2014/02/03
9
+
10
+ * add `timeout` option to `V8::Context` to forcibly abort long running scripts (thanks to @SamSaffron)
11
+ * allow canonical require via `require "therubyracer"` instead of oddball `require "v8"`(thanks @gaffneyc)
12
+
13
+ ## 0.12.0 2013/08/20
14
+
15
+ * upgrade v8 to 3.16.4 (thanks to @ignisf)
16
+ * enable native (and functional) weakref implementation for MRI > 2.0
17
+ * expose low level interface for `V8::C::HeapStatistics#total_physical_size`
18
+
19
+ ## 0.11.1 2013/01/04
20
+
21
+ * reintroduce the dependency on libv8
22
+ * libv8 can be disabled by installing it with the --with-system-v8 flag
23
+
24
+ ## 0.11.0 2012/12/04
25
+
26
+ * upgrade V8 version to 3.11.8
27
+ * remove dependency on libv8. enable compilation against system v8
28
+ * complete re-write of low-level C layer for dramatically increased stability and performance
29
+ * more faithful and complete coverage of the low-level C API
30
+ * ease the building of binary gems
31
+ * official support for Rubinius
32
+ * ability to query V8 for memory usage and set resource constraints
33
+ * extensible conversion framework for thunking Ruby values to V8 and vice-versa
34
+ * extensible invocation framework for calling Ruby code (Proc, Method, etc...) from JavaScript
35
+ * extensible access framework for interacting with Ruby properties from JavaScript
36
+ * provide explicit context teardown for distributed cycles of garbage.
37
+
38
+
39
+ ## 0.10.1 2012/04/05
40
+
41
+ * [bugfix] V8::Object#respond_to? did not call super
42
+
43
+ ## 0.10.0 2012/03/28
44
+
45
+ * [incompatible] embedded lambdas now take JS `this` object as first object
46
+ * add sponsorship image to the README
47
+ * enable Travis CI
48
+
49
+ ## 0.9.9 2011/11/08
50
+
51
+ * remove GCC specific C++ extension to fix llvm build.
52
+
53
+ ## 0.9.8 2011/11/07
54
+
55
+ * let Rake version float again.
56
+
57
+ ## 0.9.7 2011/10/06
58
+ * build fixes
59
+ * fix rake dependency at 0.8.7 while the Rake team sorts some shit out.
60
+
61
+ ## 0.9.6 2011/10/06
62
+
63
+ * make build compatible with Gentoo
64
+
65
+ ## 0.9.5 - 2011/10/05
66
+
67
+ * remove GCC specific code to enable build on BSD
68
+ * let Rake dependency float
69
+
70
+ ## 0.9.4 - 2011/08/22
71
+
72
+ * Fix an issue with the compilation include paths which allowed compilation against conflicting libv8's
73
+
74
+ ## 0.9.3 - 2011/08/11
75
+
76
+ * Better documentation for the C extension memory management
77
+ * Always lock V8 operations, always.
78
+ * GH-86 Context#[], Context#[]= always looks up values from the JavaScript scope, even when it's a Ruby object
79
+
80
+ ## 0.9.2 - 2011/06/23
81
+
82
+ * fix issue with 1.8.7 where object allocation inside of GC was segfaulting
83
+
84
+ ## 0.9.1 - 2011/06/17
85
+
86
+ * never perform V8 operations inside Ruby GC
87
+ * refactor locking interface
88
+ * add documentation for v8_handle
89
+
90
+ ## 0.9.0 - 2011/06/10
91
+
92
+ * extract libv8 into installable binary for most platforms
93
+ * fix numerous memory leaks
94
+ * expose the V8 debugger via V8::C::Debug::EnableAgent()
95
+ * force UTf-8 encoding on strings returned from javascript in ruby 1.9
96
+ * remove deprecated evaluate() methods
97
+ * make the currently executing JavaScript stack available via Context#stack
98
+
99
+ ## 0.8.1 - 2011/03/07
100
+
101
+ * upgrade to v8 3.1.8
102
+ * remove bin/v8 which conflicted with v8 executeable
103
+ * decruft all the crap that had accumulated in the gem
104
+ * Javascript Objects are now always mapped to the same V8::Object when read from the context
105
+
106
+ ## 0.8.0 - 2010/12/02
107
+
108
+ * every V8 Context gets its own unique access strategy
109
+ * ruby methods and procs embedded in javascript always return the same function per context.
110
+ * ruby classes and subclasses are now all connected via the javascript prototype chain
111
+ * better error reporting on syntax errors
112
+ * upgrade to rspec 2
113
+ * several bug fixes and stability fixes
114
+
115
+ ## 0.7.5 - 2010/08/03
116
+
117
+ * upgrade to V8 2.3.3
118
+ * property interceptors from ruby via [] and []=
119
+ * indexed property access via [] and []=
120
+ * property
121
+ * several bugfixes
122
+ * stability: eliminate many segfaults
123
+ * don't enumerate property setters such as foo= from javascript
124
+
125
+ ## 0.7.4 - 2010/06/15
126
+
127
+ * bug fix for rvm ruby installs incorrectly detected as 32bit
128
+
129
+ ## 0.7.3 - 2010/06/15
130
+
131
+ * don't catch SystemExit and NoMemoryError
132
+ * fix bug bundling gem
133
+
134
+ ## 0.7.2 - 2010/06/14
135
+
136
+ * embed ruby classes as constructors
137
+ * support for rubinius
138
+ * uniform backtrace() function on JSError mixes the ruby
139
+ * String::NewSymbol() is now scriptable
140
+ * InstanceTemplate(), PrototypeTemplate(), Inherit() methods on v8::FunctionTemplate now scriptable.
141
+ * reuse the standard ruby object access template
142
+ * fix a bunch of compile warnings
143
+ * Store any ruby object in V8 with V8::C::External
144
+
145
+ ## 0.7.1 - 2010/06/03
146
+
147
+ * Function#call() now uses the global scope for 'this' by default
148
+ * Function#methodcall() added to allow passing in 'this' object
149
+ * Function#new() method to invoke javascript constructor from ruby
150
+ * access javascript properties and call javascript methods from ruby
151
+ * bundled Jasmine DOM-Less browser testing framework.
152
+
153
+ * added Object::GetHiddenValue() to v8 metal
154
+ * added Handle::IsEmpty() to v8 metal
155
+ * fixed bug where iterating over arrays sometimes failed
156
+ * numerous bug /segfault fixes.
157
+
158
+ ## 0.7.0 - 2010/05/31
159
+
160
+ * upgraded to V8 2.1.10
161
+ * added low level scripting interface for V8 objects
162
+ * ruby object property/method access is now implemented in ruby
163
+ * auto-convert javascript arrays to rb arrays and vice-versa
164
+ * auto-convert ruby hashes into javascript objects
165
+ * auto-convert javascript Date into ruby Time object and vice versa.
166
+ * better exception handling when passing through multiple language boundaries
167
+ * objects maintain referential integrity when passing objects from ruby to javascript and vice-versa
168
+ * added debug compile option for getting C/C++ backtraces whenever segfaults occur.
169
+ * official support for REE 1.8.7
170
+ * fixed numerous segfaults
171
+ * implemented V8::Value#to_s
172
+ * the global scope is available to every V8::Context as the 'scope' attribute
173
+ * properly convert ruby boolean values into V8 booleans.
174
+
175
+ ## 0.6.3 - 2010/05/07
176
+
177
+ * FIX: linkage error on OSX /usr/bin/ruby
178
+
179
+ ## 0.6.2 - 2010/05/06
180
+
181
+ * FIX: linkage error on OSX 10.5
182
+
183
+ ## 0.6.1 - 2010/05/03
184
+
185
+ * call JavaScript functions from Ruby
186
+
187
+ ## 0.6.0 - 2010/03/31
188
+
189
+ * ruby 1.9 compatible
190
+ * full featured command line bin/v8 and bin/therubyracer
191
+ * self validating install (v8 --selftest)
192
+ * Only dependency to build gem from source is rubygems.
193
+
194
+ ## 0.5.5 - 2010/03/15
195
+
196
+ * fix string encoding issue that was breaking RHEL 5.x
197
+ * fix pthread linking issue on RHEL 5.2
198
+
199
+ ## 0.5.4 - 2010/03/09
200
+
201
+ * add ext directory to gem require paths which was causing problems for non-binary gems
202
+
203
+ ## 0.5.3 - 2010/03/01
204
+
205
+ * added full back trace to javascript code
206
+
207
+ ## 0.5.2 - 2010/02/26
208
+
209
+ * added javascript shell (bin/therubyracer)
210
+ * added to_s method for embedded ruby objects
211
+ * added line number and file name to error message.
212
+
213
+ ## 0.5.1 - 2010/02/17
214
+
215
+ * fix bug in 1.8.6 by creating Object#tap if it does not exist
216
+
217
+ ## 0.5.0 - 2010/02/17
218
+
219
+ * support for Linux 64 bit
220
+
221
+ ## 0.4.9 - 2010/02/16
222
+
223
+ * support for Linux 32 bit
224
+
225
+ ## 0.4.8 - 2010/02/08
226
+
227
+ * expose line number and source name on JavascriptErrors.
228
+
229
+ ## 0.4.5 - 2010/01/18
230
+
231
+ * case munging so that ruby methods(perl_case) are accessed through javascript in camelCase.
232
+ * access 0-arity ruby methods as javascript properties
233
+ * invoke ruby setters from javascript as properties
234
+ * contexts detect whether they are open or not and open when needed
235
+
236
+ ## 0.4.4 - 2010/01/14
237
+
238
+ * Ruby objects embedded into javascript are passed back to ruby as themselves and not a wrapped V8 object wrapping a ruby object.
239
+ * Use any ruby object as the scope of eval().
240
+ * quick and dirty V8.eval() method added
241
+ * native objects have a reference to the context that created them.
242
+ * context now has equality check.
243
+ * expose InContext() and GetCurrent() methods.
244
+ * fix a couple of segmentation faults
245
+
246
+ ## 0.4.3 - 2010/10/11
247
+
248
+ * access properties on Ruby objects with their camel case equivalents
249
+ * reflect JavaScript objects into Ruby and access their properties
250
+ * load JavaScript source from an IO object or by filename
251
+
252
+ ## 0.4.2 - 2010/10/10
253
+
254
+ * embed Ruby Objects into Javascript and call their methods
255
+
256
+ ## 0.4.1 - 2010/01/09
257
+
258
+ * embed bare Proc and Method objects into JavaScript and call them
259
+ * catch JavaScript exceptions from Ruby
260
+
261
+ ## 0.4.0 - 2009/12/21
262
+
263
+ * evaluate JavaScript code from inside Ruby.
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ # Remove this line completely once libv8 3.16.14.14 is released.
6
+ # https://github.com/cowboyd/libv8/pull/206
7
+ gem 'libv8', github: 'burke/libv8', branch: 'c73-1', ref: 'c425f874da72a47330e463be8a641100f19e1a87', submodules: true
8
+
9
+ gem "rubysl", :platforms => :rbx
10
+ gem 'redjs', :git => 'https://github.com/cowboyd/redjs.git'
11
+ gem "rake"
12
+ gem "rspec", "~> 2.0"
13
+ gem "rake-compiler"
14
+ gem "gem-compiler", :platforms => :mri
15
+
@@ -0,0 +1,224 @@
1
+ # therubyracer
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/therubyracer.png)](http://badge.fury.io/rb/therubyracer)
4
+ [![Build Status](https://travis-ci.org/cowboyd/therubyracer.png?branch=master)](https://travis-ci.org/cowboyd/therubyracer)
5
+ [![Dependency Status](https://gemnasium.com/cowboyd/therubyracer.png)](https://gemnasium.com/cowboyd/therubyracer)
6
+
7
+
8
+ * GitHub Project: [http://github.com/cowboyd/therubyracer](http://github.com/cowboyd/therubyracer)
9
+ * Mailing List: [http://groups.google.com/group/therubyracer](http://groups.google.com/group/therubyracer)
10
+ * IRC / Chat: [irc://irc.freenode.net/therubyracer](http://groups.google.com/group/therubyracer)
11
+ * Documentation: [GitHub Wiki](https://github.com/cowboyd/therubyracer/wiki) and [RubyDoc](http://rubydoc.info/gems/therubyracer)
12
+
13
+ ### DESCRIPTION
14
+
15
+ Embed the V8 JavaScript interpreter into Ruby.
16
+
17
+ ### FEATURES
18
+
19
+ * Evaluate JavaScript from within Ruby
20
+ * Embed your Ruby objects into the JavaScript world
21
+ * Manipulate JavaScript objects and call JavaScript functions from Ruby
22
+ * API compatible with the The Ruby Rhino (for JRuby: http://github.com/cowboyd/therubyrhino)
23
+
24
+ ### SYNOPSIS
25
+
26
+ gem install therubyracer
27
+
28
+ then in your Ruby code
29
+
30
+ require 'v8'
31
+
32
+ or if using bundler (as with Rails), add the following to your Gemfile
33
+
34
+ gem "therubyracer"
35
+
36
+ evaluate some simple JavaScript
37
+
38
+ cxt = V8::Context.new
39
+ cxt.eval('7 * 6') #=> 42
40
+
41
+ access values inside your JavaScript context from Ruby
42
+
43
+ cxt.eval 'var val = {num: 5, fun: function isTruthy(arg) { return !!arg }}'
44
+ val = cxt[:val] #=> V8::Object
45
+ cxt[:val] == cxt.scope.val #=> true
46
+ val.num #=> 5
47
+ val.isTruthy(1) #=> true
48
+
49
+ this includes references to JavaScript functions
50
+
51
+ truthy = val[:isTruthy] #=> V8::Function
52
+ truthy.call(' ') #=> true
53
+ truthy.call(0) #=> false
54
+
55
+
56
+ embed values into the scope of your context
57
+
58
+ cxt['foo'] = "bar"
59
+ cxt.eval('foo') # => "bar"
60
+
61
+ embed Ruby code into your scope and call it from JavaScript
62
+
63
+ cxt["say"] = lambda {|this, word, times| word * times}
64
+ cxt.eval("say('Hello', 3)") #=> HelloHelloHello
65
+
66
+ embed a Ruby object into your scope and access its properties/methods
67
+ from JavaScript
68
+
69
+ class MyMath
70
+ def plus(lhs, rhs)
71
+ lhs + rhs
72
+ end
73
+ end
74
+
75
+ cxt['math'] = MyMath.new
76
+ cxt.eval("math.plus(20,22)") #=> 42
77
+
78
+ make a Ruby object *be* your global JavaScript scope.
79
+
80
+ math = MyMath.new
81
+ V8::Context.new(:with => math) do |cxt|
82
+ cxt.eval("plus(20,22)") #=> 42
83
+ end
84
+
85
+ you can do the same thing with Object#eval_js
86
+
87
+ math.eval_js("plus(20,22)")
88
+
89
+ ### Different ways of loading JavaScript source
90
+
91
+ In addition to just evaluating strings, you can also use streams, such
92
+ as files.
93
+
94
+ evaluate bytes read from any File/IO object:
95
+
96
+ File.open("mysource.js") do |file|
97
+ cxt.eval(file, "mysource.js")
98
+ end
99
+
100
+ or load it by filename
101
+
102
+ cxt.load("mysource.js")
103
+
104
+ ### Safe by default, dangerous by demand
105
+
106
+ The Ruby Racer is designed to let you evaluate JavaScript as safely as
107
+ possible unless you tell it to do something more dangerous. The
108
+ default context is a hermetically sealed JavaScript environment with
109
+ only the standard JavaScript objects and functions. Nothing from the
110
+ Ruby world is accessible at all.
111
+
112
+ For Ruby objects that you explicitly embed into JavaScript, by default
113
+ only the _public_ methods _below_ `Object` are exposed by default.
114
+ E.g.
115
+
116
+ class A
117
+ def a
118
+ "a"
119
+ end
120
+
121
+ def to_s
122
+ super
123
+ end
124
+ end
125
+
126
+ class B < A
127
+ def b
128
+ "b"
129
+ end
130
+ end
131
+
132
+
133
+ V8::Context.new do |cxt|
134
+ cxt['a'] = A.new
135
+ cxt['b'] = B.new
136
+ cxt.eval("a.a") # => 'a'
137
+ cxt.eval("b.b") # => 'b'
138
+ cxt.eval("b.a") # => 'a'
139
+ cxt.eval("b.to_s") # => #<B:0x101776be8> (because A explicitly defined it)
140
+ cxt.eval("b.object_id") #=> undefined, object_id is on Object
141
+ end
142
+
143
+ If needed, you can override the [Ruby Access][access] to allow whatever
144
+ behavior you'd like.
145
+
146
+ [access]:https://github.com/cowboyd/therubyracer/blob/master/lib/v8/access.rb
147
+
148
+ More documentation can be found on the [GitHub wiki](https://github.com/cowboyd/therubyracer/wiki)
149
+
150
+ ### Protecting Your CPU cycles
151
+
152
+ When running untrusted JavaScript code, you not only have to protect
153
+ which functions it has access to, but also how much of your CPU it can
154
+ consume. Take this simple, yet thoroughly malicious script:
155
+
156
+ ```javascript
157
+ while (true) {}
158
+ ```
159
+
160
+ It will loop forever and never return control to the calling Ruby
161
+ thread. To protect against such JavaScript code that either
162
+ deliberately or accidentally runs longer that it should, you can
163
+ set an explicit timeout on your context. If the code runs longer that
164
+ the allowed timeout, then it will throw an exception. Note that this
165
+ exception could be raised at any point in the execution of the
166
+ JavaScript.
167
+
168
+ To specify the timeout (in milliseconds), pass in the `timeout` option
169
+ to the constructor.
170
+
171
+ ```ruby
172
+ cxt = V8::Context.new timeout: 700
173
+ cxt.eval "while (true);" #= exception after 700ms!
174
+ ```
175
+
176
+ ### PREREQUISITES
177
+
178
+ The Ruby Racer requires the V8 Javascript engine, but it offloads the
179
+ handling of this dependency to the
180
+ [libv8](https://github.com/cowboyd/libv8) gem. Because libv8 is now a
181
+ gem dependency, you do not need a separate libv8 entry in your
182
+ project's Gemfile.
183
+
184
+ Please see [libv8](https://github.com/cowboyd/libv8) for V8 runtime
185
+ installation options.
186
+
187
+ ### DEVELOP
188
+
189
+ git clone git://github.com/cowboyd/therubyracer.git
190
+ cd therubyracer
191
+ bundle install
192
+ rake compile
193
+
194
+ ### Sponsored by
195
+
196
+ <a href="http://thefrontside.net">![The Frontside](http://github.com/cowboyd/therubyracer/raw/master/thefrontside.png)</a>
197
+
198
+ ### LICENSE:
199
+
200
+ (The MIT License)
201
+
202
+ Copyright (c) 2009,2010,2011,2012 Charles Lowell
203
+
204
+ Permission is hereby granted, free of charge, to any person obtaining
205
+ a copy of this software and associated documentation files (the
206
+ 'Software'), to deal in the Software without restriction, including
207
+ without limitation the rights to use, copy, modify, merge, publish,
208
+ distribute, sublicense, and/or sell copies of the Software, and to
209
+ permit persons to whom the Software is furnished to do so, subject to
210
+ the following conditions:
211
+
212
+ The above copyright notice and this permission notice shall be
213
+ included in all copies or substantial portions of the Software.
214
+
215
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
216
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
217
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
218
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
219
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
220
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
221
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
222
+
223
+ [1]: https://github.com/cowboyd/libv8
224
+ [2]: http://code.google.com/p/v8/wiki/BuildingWithGYP