public
Rubygem
Description: Johnson wraps JavaScript in a loving Ruby embrace.
Homepage: http://github.com/jbarnette/johnson/wikis
Clone URL: git://github.com/jbarnette/johnson.git
Search Repo:
a null filename will cause a crash when using eval
aaronp (author)
Tue May 13 16:29:11 -0700 2008
commit  41b8a99fbc315a35868a84c3ca163039198eca0d
tree    695f4012ac02f1e538f0ae55c8ad97997556d071
parent  2fc2742302331b2a95a339c5c41977e08ce1ce66
...
37
38
39
40
 
41
42
43
...
37
38
39
 
40
41
42
43
0
@@ -37,7 +37,7 @@
0
   context->ex = 0;
0
   memset(context->msg, 0, MAX_EXCEPTION_MESSAGE_SIZE);
0
 
0
- char* filenamez = RTEST(filename) ? StringValueCStr(filename) : NULL;
0
+ char* filenamez = RTEST(filename) ? StringValueCStr(filename) : "none";
0
   int linenumi = RTEST(linenum) ? NUM2INT(linenum) : 1;
0
 
0
   jsval js;
...
13
14
15
 
 
 
 
16
17
...
13
14
15
16
17
18
19
20
21
0
@@ -13,6 +13,10 @@
0
     def test_evaluate_returns_nil_for_nil_expression
0
       assert_nil(@context.evaluate(nil))
0
     end
0
+
0
+ def test_js_eval
0
+ assert_equal(1, @context.evaluate('eval("1");'))
0
+ end
0
   end
0
 end

Comments

    No one has commented yet.