Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(657)

Unified Diff: lib/src/trace.dart

Issue 2067063002: Trace.current skips an extra frame in JS. (Closed) Base URL: git@github.com:dart-lang/stack_trace@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « CHANGELOG.md ('k') | lib/src/utils.dart » ('j') | lib/src/utils.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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].
« no previous file with comments | « CHANGELOG.md ('k') | lib/src/utils.dart » ('j') | lib/src/utils.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698