Index: lib/src/trace.dart |
diff --git a/lib/src/trace.dart b/lib/src/trace.dart |
index 8537b6236109fc3f3db452b2c5f894e4bd851d15..20343ad5a53bbe27829d6f19a1fb00046ba63236 100644 |
--- a/lib/src/trace.dart |
+++ b/lib/src/trace.dart |
@@ -81,7 +81,11 @@ class Trace implements StackTrace { |
} |
var trace = new Trace.from(StackTrace.current); |
- return new LazyTrace(() => new Trace(trace.frames.skip(level + 1))); |
+ return new LazyTrace(() { |
+ // JS includes a frame for the call to StackTrace.current, but the VM |
+ // doesn't, so we skip an extra frame in a JS context. |
+ return new Trace(trace.frames.skip(level + (inJS ? 2 : 1))); |
+ }); |
} |
/// Returns a new stack trace containing the same data as [trace]. |