From e09bfe5e84d4f64345893f8d0574c0410b85a2b1 Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Tue, 26 Apr 2011 12:35:51 -0500 Subject: [PATCH] fix back reference to the highlevel context from the low-level context. --- lib/v8/context.rb | 2 +- spec/ext/cxt_spec.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/v8/context.rb b/lib/v8/context.rb index a07a744..9ab6271 100644 --- a/lib/v8/context.rb +++ b/lib/v8/context.rb @@ -73,7 +73,7 @@ module V8 def self.stack(limit = 99) if native = C::Context::GetEntered() - global = native.Global().instance_eval {@native} + global = native.Global() cxt = global.GetHiddenValue(C::String::NewSymbol("TheRubyRacer::RubyContext")).Value() cxt.instance_eval {@to.rb(C::StackTrace::CurrentStackTrace(limit))} else diff --git a/spec/ext/cxt_spec.rb b/spec/ext/cxt_spec.rb index b795575..2a6c262 100644 --- a/spec/ext/cxt_spec.rb +++ b/spec/ext/cxt_spec.rb @@ -11,10 +11,11 @@ describe C::Context do it "can get the current javascript execution stack" do V8::Context.new do |cxt| + trace = nil cxt['getTrace'] = lambda do - V8::Context.stack + trace = V8::Context.stack end - trace = cxt.eval(<<-JS, 'trace.js') + cxt.eval(<<-JS, 'trace.js') function one() { return two(); } @@ -28,7 +29,6 @@ describe C::Context do } one(); JS - trace.length.should be(4) trace.first.tap do |frame| frame.line_number.should == 10