johnson 2.0.0.pre2 → 2.0.0.pre3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,9 @@
1
+ === 2.0.0.pre3 / 2010-03-02
2
+
3
+ * convert/protect predicates so that exceptions don't cause stack-jumping SEGVs
4
+ * various cleanup of ext functions
5
+ * convert runtime size parameter correctly
6
+
1
7
  === 2.0.0.pre2 / 2010-02-23
2
8
 
3
9
  * Raise NoMemoryError as appropriate; acccept a size parameter or env variable for runtime size
@@ -101,13 +101,13 @@ split_addProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
101
101
  uintN attrs = 0;
102
102
  JSBool found;
103
103
 
104
- JS_GetPropertyAttrsGetterAndSetterById(cx, obj, id, &attrs, &found, &getter, &setter);
105
-
106
- if (!JS_ValueToId(cx, *vp, &asId)) {
104
+ if (!JS_ValueToId(cx, id, &asId)) {
107
105
  return JS_FALSE;
108
106
  }
109
107
 
110
- return JS_DefinePropertyById(cx, cpx->inner, id, asId, getter, setter, attrs | JSPROP_ENUMERATE);
108
+ JS_GetPropertyAttrsGetterAndSetterById(cx, obj, asId, &attrs, &found, &getter, &setter);
109
+
110
+ return JS_DefinePropertyById(cx, cpx->inner, asId, *vp, getter, setter, attrs | JSPROP_ENUMERATE);
111
111
  }
112
112
  return JS_TRUE;
113
113
  }
@@ -99,35 +99,61 @@ JSBool call_ruby_from_js2(JohnsonRuntime* runtime, VALUE* retval, VALUE self, ID
99
99
  return okay;
100
100
  }
101
101
 
102
- static bool autovivified_p(VALUE UNUSED(ruby_context), VALUE self, char* name)
102
+ static VALUE autovivified_p(VALUE self, VALUE name, ID id);
103
+
104
+ DECLARE_RUBY_WRAPPER(autovivified_p, VALUE self; VALUE name; ID id);
105
+ DEFINE_RUBY_WRAPPER(autovivified_p, autovivified_p, ARGLIST3(self, name, id));
106
+
107
+ static VALUE autovivified_p(VALUE self, VALUE name, ID UNUSED(id))
103
108
  {
104
109
  return RTEST(rb_funcall(Johnson_TraceMonkey_JSLandProxy(), rb_intern("autovivified?"), 2,
105
- self, rb_str_new2(name)));
110
+ self, name)) ? Qtrue : Qfalse;
106
111
  }
107
112
 
108
- static bool const_p(VALUE self, char* name)
113
+ static VALUE const_p(VALUE self, VALUE name, ID id);
114
+
115
+ DECLARE_RUBY_WRAPPER(const_p, VALUE self; VALUE name; ID id);
116
+ DEFINE_RUBY_WRAPPER(const_p, const_p, ARGLIST3(self, name, id));
117
+
118
+ static VALUE const_p(VALUE self, VALUE UNUSED(name), VALUE id)
109
119
  {
110
- return rb_obj_is_kind_of(self, rb_cModule)
111
- && rb_is_const_id(rb_intern(name))
112
- && RTEST( rb_funcall(self, rb_intern("const_defined?"), 1, ID2SYM(rb_intern(name))) );
120
+
121
+ return (rb_obj_is_kind_of(self, rb_cModule)
122
+ && rb_is_const_id(id)
123
+ && RTEST( rb_funcall(self, rb_intern("const_defined?"), 1, ID2SYM(id) ))) ? Qtrue : Qfalse;
113
124
  }
114
125
 
115
- static bool global_p(char* name)
126
+ static VALUE global_p(VALUE name);
127
+
128
+ DECLARE_RUBY_WRAPPER(global_p, VALUE name);
129
+ DEFINE_RUBY_WRAPPER(global_p, global_p, ARGLIST1(name));
130
+
131
+ static VALUE global_p(VALUE name)
116
132
  {
117
- return *name == '$' && rb_ary_includes(rb_f_global_variables(), rb_str_new2(name));
133
+ return (*StringValuePtr(name) == '$' && rb_ary_includes(rb_f_global_variables(), name)) ? Qtrue : Qfalse;
118
134
  }
119
135
 
120
- static bool method_p(VALUE self, char* name)
136
+ static VALUE method_p(VALUE self, VALUE name, ID id);
137
+
138
+ DECLARE_RUBY_WRAPPER(method_p, VALUE self; VALUE name; ID id);
139
+ DEFINE_RUBY_WRAPPER(method_p, method_p, ARGLIST3(self, name, id));
140
+
141
+ static VALUE method_p(VALUE self, VALUE UNUSED(name), ID id)
121
142
  {
122
- return RTEST( rb_funcall(self, rb_intern("respond_to?"), 1, ID2SYM(rb_intern(name))) );
143
+ return (RTEST( rb_funcall(self, rb_intern("respond_to?"), 1, ID2SYM(id) ) )) ? Qtrue : Qfalse;
123
144
  }
124
145
 
125
- static bool attribute_p(VALUE self, char* name)
146
+ static VALUE attribute_p(VALUE self, VALUE name, ID id);
147
+
148
+ DECLARE_RUBY_WRAPPER(attribute_p, VALUE self; VALUE name; ID id);
149
+ DEFINE_RUBY_WRAPPER(attribute_p, attribute_p, ARGLIST3(self, name, id));
150
+
151
+ static VALUE attribute_p(VALUE self, VALUE name, ID id)
126
152
  {
127
- if (!method_p(self, name))
128
- return false;
153
+ if (!method_p(self, name, id))
154
+ return Qfalse;
129
155
 
130
- VALUE rb_id = rb_intern(name);
156
+ VALUE rb_id = id;
131
157
  VALUE rb_method = rb_funcall(self, rb_intern("method"), 1, ID2SYM(rb_id));
132
158
 
133
159
  if (TYPE(rb_method) == T_DATA)
@@ -139,50 +165,56 @@ static bool attribute_p(VALUE self, char* name)
139
165
  Data_Get_Struct(rb_method, METHOD, method);
140
166
 
141
167
  if (method && nd_type(method->body) == NODE_IVAR)
142
- return true;
168
+ return Qtrue;
143
169
  }
144
170
  }
145
171
 
146
- return RTEST(rb_funcall(Johnson_TraceMonkey_JSLandProxy(),
147
- rb_intern("js_property?"), 2, self, ID2SYM(rb_id)));
172
+ return (RTEST(rb_funcall(Johnson_TraceMonkey_JSLandProxy(),
173
+ rb_intern("js_property?"), 2, self, ID2SYM(rb_id)))) ? Qtrue : Qfalse;
148
174
  }
149
175
 
150
- static bool indexable_p(VALUE self)
176
+ static VALUE indexable_p(VALUE self);
177
+
178
+ DECLARE_RUBY_WRAPPER(indexable_p, VALUE self);
179
+ DEFINE_RUBY_WRAPPER(indexable_p, indexable_p, ARGLIST1(self));
180
+
181
+ static VALUE indexable_p(VALUE self)
151
182
  {
152
- return RTEST(rb_funcall(self, rb_intern("respond_to?"), 1, ID2SYM(rb_intern("[]"))));
183
+ return (RTEST(rb_funcall(self, rb_intern("respond_to?"), 1, ID2SYM(rb_intern("[]"))))) ? Qtrue : Qfalse;
153
184
  }
154
185
 
155
- static bool has_key_p(VALUE self, char* name)
186
+ static VALUE has_key_p(VALUE self, VALUE name, ID id);
187
+
188
+ DECLARE_RUBY_WRAPPER(has_key_p, VALUE self; VALUE name; ID id);
189
+ DEFINE_RUBY_WRAPPER(has_key_p, has_key_p, ARGLIST3(self, name, id));
190
+
191
+ static VALUE has_key_p(VALUE self, VALUE name, ID UNUSED(id))
156
192
  {
157
- return RTEST(rb_funcall(self, rb_intern("respond_to?"), 1, ID2SYM(rb_intern("[]"))))
193
+ return (RTEST(rb_funcall(self, rb_intern("respond_to?"), 1, ID2SYM(rb_intern("[]"))))
158
194
  && RTEST(rb_funcall(self, rb_intern("respond_to?"), 1, ID2SYM(rb_intern("key?"))))
159
- && RTEST(rb_funcall(self, rb_intern("key?"), 1, rb_str_new2(name)));
195
+ && RTEST(rb_funcall(self, rb_intern("key?"), 1, name))) ? Qtrue : Qfalse;
160
196
  }
161
197
 
162
- static bool respond_to_p(JSContext* js_context, JSObject* obj, char* name)
163
- {
164
- VALUE ruby_context = (VALUE)JS_GetContextPrivate(js_context);
165
-
166
- JohnsonContext* context;
167
- Data_Get_Struct(ruby_context, JohnsonContext, context);
168
-
169
- VALUE self = (VALUE)JS_GetInstancePrivate(
170
- context->js, obj, JS_GET_CLASS(context->js, obj), NULL);
198
+ static VALUE respond_to_p(VALUE self, VALUE name, ID id);
171
199
 
172
- if (!self) return false;
200
+ DECLARE_RUBY_WRAPPER(respond_to_p, VALUE self; VALUE name; ID id);
201
+ DEFINE_RUBY_WRAPPER(respond_to_p, respond_to_p, ARGLIST3(self, name, id));
173
202
 
174
- return autovivified_p(ruby_context, self, name)
175
- || const_p(self, name)
203
+ static VALUE respond_to_p(VALUE self, VALUE name, ID id)
204
+ {
205
+ return (autovivified_p(self, name, id)
206
+ || const_p(self, name, id)
176
207
  || global_p(name)
177
- || attribute_p(self, name)
178
- || method_p(self, name)
179
- || has_key_p(self, name);
208
+ || attribute_p(self, name, id)
209
+ || method_p(self, name, id)
210
+ || has_key_p(self, name, id)) ? Qtrue : Qfalse;
180
211
  }
181
212
 
182
- static jsval evaluate_js_property_expression(JohnsonRuntime * runtime, const char * property, jsval* retval) {
183
- JSContext * context = johnson_get_current_context(runtime);
213
+ static jsval evaluate_js_property_expression(JohnsonRuntime * runtime,
214
+ JSContext * js_context,
215
+ const char * property, jsval* retval) {
184
216
  assert(strlen(property) < INT_MAX);
185
- return JS_EvaluateScript(context, runtime->global,
217
+ return JS_EvaluateScript(js_context, runtime->global,
186
218
  property, (unsigned int)strlen(property), "johnson:evaluate_js_property_expression", 1,
187
219
  retval);
188
220
  }
@@ -213,7 +245,8 @@ static JSBool get(JSContext* js_context, JSObject* obj, jsval id, jsval* retval)
213
245
 
214
246
  if (JSVAL_IS_INT(id))
215
247
  {
216
- if (indexable_p(self)) {
248
+ if (CALL_RUBY_WRAPPER(indexable_p, self))
249
+ {
217
250
  VALUE idx = INT2FIX(JSVAL_TO_INT(id));
218
251
  JCHECK(call_ruby_from_js(runtime, retval, self, rb_intern("[]"), 1, idx));
219
252
  }
@@ -222,19 +255,20 @@ static JSBool get(JSContext* js_context, JSObject* obj, jsval id, jsval* retval)
222
255
  }
223
256
 
224
257
  char* name = JS_GetStringBytes(JSVAL_TO_STRING(id));
225
- VALUE ruby_id = rb_intern(name);
258
+ VALUE name_value = rb_str_new2(name);
259
+ VALUE ruby_id = rb_to_id(name_value);
226
260
 
227
261
  // FIXME: we should probably just JS_DefineProperty this, and it shouldn't be enumerable
228
262
 
229
263
  if (!strcasecmp("__iterator__", name)) {
230
- JCHECK(evaluate_js_property_expression(runtime, "Johnson.Generator.create", retval));
264
+ JCHECK(evaluate_js_property_expression(runtime, js_context, "Johnson.Generator.create", retval));
231
265
  }
232
266
 
233
267
  // if the Ruby object has a dynamic js property with a key
234
268
  // matching the property we're looking for, pull the value out of
235
269
  // that map.
236
270
 
237
- else if (autovivified_p(ruby_context, self, name))
271
+ else if (CALL_RUBY_WRAPPER(autovivified_p, self, name_value, ruby_id))
238
272
  {
239
273
  JCHECK(call_ruby_from_js(runtime, retval, Johnson_TraceMonkey_JSLandProxy(),
240
274
  rb_intern("autovivified"), 2, self, rb_str_new2(name)));
@@ -243,14 +277,14 @@ static JSBool get(JSContext* js_context, JSObject* obj, jsval id, jsval* retval)
243
277
  // if the Ruby object is a Module or Class and has a matching
244
278
  // const defined, return the converted result of const_get
245
279
 
246
- else if (const_p(self, name))
280
+ else if (CALL_RUBY_WRAPPER(const_p, self, name_value, ruby_id))
247
281
  {
248
282
  JCHECK(call_ruby_from_js(runtime, retval, self, rb_intern("const_get"),
249
283
  1, ID2SYM(ruby_id)));
250
284
  }
251
285
 
252
286
  // otherwise, if it's a global, return the global
253
- else if (global_p(name))
287
+ else if (CALL_RUBY_WRAPPER(global_p, name_value))
254
288
  {
255
289
  JCHECK(convert_to_js(runtime, rb_gv_get(name), retval));
256
290
  }
@@ -258,7 +292,7 @@ static JSBool get(JSContext* js_context, JSObject* obj, jsval id, jsval* retval)
258
292
  // otherwise, if the Ruby object has a an attribute method matching
259
293
  // the property we're trying to get, call it and return the converted result
260
294
 
261
- else if (attribute_p(self, name))
295
+ else if (CALL_RUBY_WRAPPER(attribute_p, self, name_value, ruby_id))
262
296
  {
263
297
  JCHECK(call_ruby_from_js(runtime, retval, self, ruby_id, 0));
264
298
  }
@@ -266,7 +300,7 @@ static JSBool get(JSContext* js_context, JSObject* obj, jsval id, jsval* retval)
266
300
  // otherwise, if the Ruby object quacks sorta like a hash (it responds to
267
301
  // "[]" and "key?"), index it by key and return the converted result
268
302
 
269
- else if (has_key_p(self, name))
303
+ else if (CALL_RUBY_WRAPPER(has_key_p, self, name_value, ruby_id))
270
304
  {
271
305
  JCHECK(call_ruby_from_js(runtime, retval, self, rb_intern("[]"), 1, rb_str_new2(name)));
272
306
  }
@@ -277,7 +311,7 @@ static JSBool get(JSContext* js_context, JSObject* obj, jsval id, jsval* retval)
277
311
  // FIXME: this should really wrap the Method for 'name' in a JS class
278
312
  // rather than generating a wrapper Proc
279
313
 
280
- else if (method_p(self, name))
314
+ else if (CALL_RUBY_WRAPPER(method_p, self, name_value, ruby_id))
281
315
  {
282
316
  JCHECK(call_ruby_from_js(runtime, retval, self, rb_intern("method"), 1, rb_str_new2(name)));
283
317
  }
@@ -319,7 +353,7 @@ static JSBool set(JSContext* js_context, JSObject* obj, jsval id, jsval* value)
319
353
 
320
354
  if (JSVAL_IS_INT(id))
321
355
  {
322
- if (indexable_p(self))
356
+ if (CALL_RUBY_WRAPPER(indexable_p, self))
323
357
  {
324
358
  VALUE idx = INT2FIX(JSVAL_TO_INT(id));
325
359
  VALUE val = CONVERT_TO_RUBY(runtime, *value);
@@ -403,11 +437,17 @@ static JSBool resolve(JSContext *js_context, JSObject *obj, jsval id, uintN UNUS
403
437
  PREPARE_JROOTS(js_context, 1);
404
438
  JROOT(id);
405
439
 
406
- char* name = JS_GetStringBytes(JS_ValueToString(js_context, id));
440
+ VALUE self =
441
+ (VALUE)JS_GetInstancePrivate(js_context, obj, JS_GET_CLASS(js_context, obj), NULL);
407
442
 
408
- if (respond_to_p(js_context, obj, name))
443
+ char* cname = JS_GetStringBytes(JS_ValueToString(js_context, id));
444
+
445
+ VALUE name = rb_str_new2(cname);
446
+ ID ruby_id = rb_intern(cname);
447
+
448
+ if (CALL_RUBY_WRAPPER(respond_to_p, self, name, ruby_id))
409
449
  {
410
- JCHECK(JS_DefineProperty(js_context, obj, name, JSVAL_VOID,
450
+ JCHECK(JS_DefineProperty(js_context, obj, cname, JSVAL_VOID,
411
451
  get_and_destroy_resolved_property, set, JSPROP_ENUMERATE));
412
452
 
413
453
  *objp = obj;
@@ -512,8 +552,9 @@ static JSBool call(JSContext* js_context, JSObject* UNUSED(obj), uintN argc, jsv
512
552
 
513
553
  bool js_value_is_proxy(JohnsonRuntime* MAYBE_UNUSED(runtime), jsval maybe_proxy)
514
554
  {
555
+ JSContext* js_context = johnson_get_current_context(runtime);
515
556
  JSClass* klass = JS_GET_CLASS(
516
- johnson_get_current_context(runtime),
557
+ js_context,
517
558
  JSVAL_TO_OBJECT(maybe_proxy));
518
559
 
519
560
  return &JSLandProxyClass == klass
@@ -565,7 +606,7 @@ JSBool make_js_land_proxy(JohnsonRuntime* runtime, VALUE value, jsval* retval)
565
606
  PREPARE_JROOTS(context, 2);
566
607
 
567
608
  jsval johnson = JSVAL_NULL;
568
- JCHECK(evaluate_js_property_expression(runtime, "Johnson", &johnson));
609
+ JCHECK(evaluate_js_property_expression(runtime, context, "Johnson", &johnson));
569
610
  JROOT(johnson);
570
611
 
571
612
  if (base_value)
@@ -618,3 +659,8 @@ JSBool make_js_land_proxy(JohnsonRuntime* runtime, VALUE value, jsval* retval)
618
659
  JRETURN;
619
660
  }
620
661
  }
662
+
663
+ // Local Variables:
664
+ // c-basic-offset:2
665
+ // tab-width:2
666
+ // End:
@@ -19,6 +19,7 @@ static VALUE global(VALUE self)
19
19
  {
20
20
  JohnsonRuntime* runtime;
21
21
  Data_Get_Struct(self, JohnsonRuntime, runtime);
22
+ JSContext * context = johnson_get_current_context(runtime);
22
23
  return convert_to_ruby(runtime, OBJECT_TO_JSVAL(runtime->global));
23
24
  }
24
25
 
@@ -27,10 +28,8 @@ static VALUE new_global(VALUE self)
27
28
  JohnsonRuntime* runtime;
28
29
  Data_Get_Struct(self, JohnsonRuntime, runtime);
29
30
  JSContext * context = johnson_get_current_context(runtime);
30
-
31
- PREPARE_RUBY_JROOTS(context, 0);
32
31
  JSObject* obj = johnson_create_global_object(context);
33
- JRETURN_RUBY(convert_to_ruby(runtime, OBJECT_TO_JSVAL(obj)));
32
+ return convert_to_ruby(runtime, OBJECT_TO_JSVAL(obj));
34
33
  }
35
34
 
36
35
  static VALUE new_split_global_outer(VALUE self)
@@ -38,12 +37,8 @@ static VALUE new_split_global_outer(VALUE self)
38
37
  JohnsonRuntime* runtime;
39
38
  Data_Get_Struct(self, JohnsonRuntime, runtime);
40
39
  JSContext * context = johnson_get_current_context(runtime);
41
-
42
- PREPARE_RUBY_JROOTS(context, 0);
43
-
44
40
  JSObject* new_split_global_outer_object = johnson_create_split_global_outer_object(context);
45
-
46
- JRETURN_RUBY(convert_to_ruby(runtime, OBJECT_TO_JSVAL(new_split_global_outer_object)));
41
+ return convert_to_ruby(runtime, OBJECT_TO_JSVAL(new_split_global_outer_object));
47
42
  }
48
43
 
49
44
  static VALUE new_split_global_inner(VALUE self, VALUE ruby_outer)
@@ -51,17 +46,10 @@ static VALUE new_split_global_inner(VALUE self, VALUE ruby_outer)
51
46
  JohnsonRuntime* runtime;
52
47
  Data_Get_Struct(self, JohnsonRuntime, runtime);
53
48
  JSContext * context = johnson_get_current_context(runtime);
54
-
55
- PREPARE_RUBY_JROOTS(context, 1);
56
-
57
49
  jsval outer;
58
-
59
- JCHECK(convert_to_js(runtime,ruby_outer,&outer));
60
- JROOT(outer);
61
-
50
+ convert_to_js(runtime,ruby_outer,&outer);
62
51
  JSObject* new_inner_object = johnson_create_split_global_inner_object(context,JSVAL_TO_OBJECT(outer));
63
-
64
- JRETURN_RUBY(convert_to_ruby(runtime, OBJECT_TO_JSVAL(new_inner_object)));
52
+ return convert_to_ruby(runtime, OBJECT_TO_JSVAL(new_inner_object));
65
53
  }
66
54
 
67
55
  static VALUE seal(VALUE self, VALUE ruby_object, VALUE deep)
@@ -75,11 +63,11 @@ static VALUE seal(VALUE self, VALUE ruby_object, VALUE deep)
75
63
  jsval object;
76
64
 
77
65
  JCHECK(convert_to_js(runtime,ruby_object,&object));
78
- JROOT(object);
79
66
 
80
- JSBool ok = JS_SealObject(context, JSVAL_TO_OBJECT(object), deep == Qfalse || deep == Qnil ? JS_FALSE : JS_TRUE);
67
+ JROOT(object);
81
68
 
82
- JRETURN_RUBY(convert_to_ruby(runtime, ok ? JSVAL_TRUE : JSVAL_FALSE));
69
+ JCHECK(JS_SealObject(context, JSVAL_TO_OBJECT(object), RTEST(deep) ? JS_TRUE : JS_FALSE));
70
+ JRETURN_RUBY(Qtrue);
83
71
  }
84
72
 
85
73
  static JSTrapStatus trap_handler( JSContext *context,
@@ -253,7 +241,8 @@ static VALUE evaluate_compiled_script(VALUE self, VALUE compiled_script, VALUE r
253
241
  return Qnil;
254
242
  }
255
243
 
256
- return convert_to_ruby(runtime, js);
244
+ PREPARE_RUBY_JROOTS(context, 0);
245
+ JRETURN_RUBY(CONVERT_TO_RUBY(runtime, js));
257
246
  }
258
247
 
259
248
  #ifdef JS_GC_ZEAL
@@ -525,7 +514,7 @@ void init_Johnson_TraceMonkey_Runtime(VALUE tracemonkey)
525
514
  rb_define_private_method(klass, "initialize_native", (ruby_callback)initialize_native, 2);
526
515
 
527
516
  rb_define_method(klass, "global", (ruby_callback)global, 0);
528
- rb_define_method(klass, "new_global", (ruby_callback)global, 0);
517
+ rb_define_method(klass, "new_global", (ruby_callback)new_global, 0);
529
518
 
530
519
  rb_define_method(klass, "new_split_global_outer", (ruby_callback)new_split_global_outer, 0);
531
520
  rb_define_method(klass, "new_split_global_inner", (ruby_callback)new_split_global_inner, 1);
@@ -16,7 +16,7 @@ require "johnson/visitors"
16
16
  require "johnson/nodes"
17
17
 
18
18
  module Johnson
19
- VERSION = "2.0.0.pre2"
19
+ VERSION = "2.0.0.pre3"
20
20
 
21
21
  def self.version
22
22
  VERSION
@@ -157,7 +157,10 @@ this.__defineGetter__("__FILE__", function() {
157
157
 
158
158
  Johnson.getStack = function() {
159
159
  try { throw new Error; } catch(e) {
160
- return e.stack.replace(/(.*\n){3}/, '');
160
+ return e.stack.
161
+ replace(/^Error\(\)@:0\n/,"").
162
+ replace(/^\(\)@[^\n]*prelude\.js[^\n]*\n/,"").
163
+ replace(/^@:0\n/,"");
161
164
  }
162
165
  };
163
166
 
@@ -12,7 +12,7 @@ module Johnson #:nodoc:
12
12
  @debugger = nil
13
13
  @gcthings = {}
14
14
  @traps = []
15
- size = (options[:size] || options["size"] || ENV["JOHNSON_HEAP_SIZE"] || 0x2000000).to_i
15
+ size = (options[:size] || options["size"] || Integer(ENV["JOHNSON_HEAP_SIZE"] || 0x2000000))
16
16
  options.delete(:size)
17
17
  initialize_native(size, options)
18
18
  super()
@@ -252,23 +252,12 @@ module Johnson
252
252
  assert_equal(3, z)
253
253
  end
254
254
 
255
- # FIXME: If you uncomment this test, we get this error:
256
- #
257
- # JS API usage error: the address passed to JS_AddNamedRoot currently holds an
258
- # invalid jsval. This is usually caused by a missing call to JS_RemoveRoot.
259
- # The root's name is "ruby_land_proxy.c[210]:native_call: proxy_value".
260
- # Assertion failure: root_points_to_gcArenaList, at jsgc.c:2618
261
- #
262
- # WTF?
263
- #
264
- # -Aaron
265
- #
266
- #def test_throwing_in_js_goes_to_ruby
267
- # func = @runtime.evaluate('function () { throw "foo"; }')
268
- # assert_raise(Johnson::Error) {
269
- # func.call
270
- # }
271
- #end
255
+ def test_throwing_in_js_goes_to_ruby
256
+ func = @runtime.evaluate('function () { throw "foo"; }')
257
+ assert_raise(Johnson::Error) {
258
+ func.call
259
+ }
260
+ end
272
261
  end
273
262
  end
274
263
  end
metadata CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 2
7
7
  - 0
8
8
  - 0
9
- - pre2
10
- version: 2.0.0.pre2
9
+ - pre3
10
+ version: 2.0.0.pre3
11
11
  platform: ruby
12
12
  authors:
13
13
  - John Barnette
@@ -19,7 +19,7 @@ autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
21
 
22
- date: 2010-02-23 00:00:00 -08:00
22
+ date: 2010-03-02 00:00:00 -08:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency