226667e764
In CSP mode we cannot use `eval()`, so use static interop mechanism to set stack trace limit. It seems `window` is available in Chrome and others have higher limit anyway. Change-Id: Id57dc86936d0568338a8ee4436e69e39be8eb32c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349483 Reviewed-by: Slava Egorov <vegorov@google.com> Commit-Queue: Martin Kustermann <kustermann@google.com>
35 lines
851 B
Dart
35 lines
851 B
Dart
// (c) 2024, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'dart:js_interop';
|
|
|
|
void configureStackFrameLimit() {
|
|
// Different browsers have different limits on how many top frames
|
|
// are captured in stack traces (e.g. Chrome's limit is 10).
|
|
// We can configure that here manually, to ensure the tests pass
|
|
// on all compiler+browser combinations.
|
|
jsWindow?.error.stackTraceLimit = 100;
|
|
}
|
|
|
|
@JS('window')
|
|
external JSWindow? get jsWindow;
|
|
|
|
@JS()
|
|
@staticInterop
|
|
class JSWindow {}
|
|
|
|
extension on JSWindow {
|
|
@JS('Error')
|
|
external JSError get error;
|
|
}
|
|
|
|
@JS()
|
|
@staticInterop
|
|
class JSError {}
|
|
|
|
extension on JSError {
|
|
@JS('stackTraceLimit')
|
|
external void set stackTraceLimit(int value);
|
|
}
|