Permalink
Browse files

Pin rubyracer version to 0.10

This is a temporary fix. See #405 (comment)
  • Loading branch information...
1 parent 118594f commit f671c2e3d7bd297ea505502a7478080f63e02145 @kpdecker kpdecker committed Jan 13, 2013
Showing with 32 additions and 7 deletions.
  1. +1 −1 Gemfile
  2. +4 −6 Gemfile.lock
  3. +27 −0 spec/spec_helper.rb
View
@@ -1,5 +1,5 @@
source "http://rubygems.org"
gem "rake"
-gem "therubyracer", ">= 0.9.8"
+gem "therubyracer", ">= 0.9.8", "< 0.11"
gem "rspec"
View
@@ -2,9 +2,8 @@ GEM
remote: http://rubygems.org/
specs:
diff-lcs (1.1.3)
- libv8 (3.11.8.11)
+ libv8 (3.3.10.4)
rake (10.0.3)
- ref (1.0.2)
rspec (2.12.0)
rspec-core (~> 2.12.0)
rspec-expectations (~> 2.12.0)
@@ -13,14 +12,13 @@ GEM
rspec-expectations (2.12.1)
diff-lcs (~> 1.1.3)
rspec-mocks (2.12.1)
- therubyracer (0.11.1)
- libv8 (~> 3.11.8.7)
- ref
+ therubyracer (0.10.2)
+ libv8 (~> 3.3.10)
PLATFORMS
ruby
DEPENDENCIES
rake
rspec
- therubyracer (>= 0.9.8)
+ therubyracer (>= 0.9.8, < 0.11)
View
@@ -1,5 +1,32 @@
require "v8"
+# Monkey patches due to bugs in RubyRacer
+class V8::JSError
+ def initialize(try, to)
+ @to = to
+ begin
+ super(initialize_unsafe(try))
+ rescue Exception => e
+ # Original code does not make an Array here
+ @boundaries = [Boundary.new(:rbframes => e.backtrace)]
+ @value = e
+ super("BUG! please report. JSError#initialize failed!: #{e.message}")
+ end
+ end
+
+ def parse_js_frames(try)
+ raw = @to.rb(try.StackTrace())
+ if raw && !raw.empty?
+ raw.split("\n")[1..-1].tap do |frames|
+ # Original code uses strip!, and the frames are not guaranteed to be strippable
+ frames.each {|frame| frame.strip.chomp!(",")}
+ end
+ else
+ []
+ end
+ end
+end
+
module Handlebars
module Spec
def self.js_backtrace(context)

0 comments on commit f671c2e

Please sign in to comment.