Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
e7984bd4
Unverified
Commit
e7984bd4
authored
Jan 29, 2020
by
Dan Field
Committed by
GitHub
Jan 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle StackOverflows (#49629)
parent
f2865090
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
stack_frame.dart
packages/flutter/lib/src/foundation/stack_frame.dart
+14
-0
stack_frame_test.dart
packages/flutter/test/foundation/stack_frame_test.dart
+22
-0
No files found.
packages/flutter/lib/src/foundation/stack_frame.dart
View file @
e7984bd4
...
...
@@ -59,6 +59,18 @@ class StackFrame {
source
:
'<asynchronous suspension>'
,
);
/// A stack frame representing a Dart elided stack overflow frame.
static
const
StackFrame
stackOverFlowElision
=
StackFrame
(
number:
-
1
,
column:
-
1
,
line:
-
1
,
method:
'...'
,
packageScheme:
''
,
package:
''
,
packagePath:
''
,
source
:
'...'
,
);
/// Parses a list of [StackFrame]s from a [StackTrace] object.
///
/// This is normally useful with [StackTrace.current].
...
...
@@ -113,6 +125,8 @@ class StackFrame {
assert
(
line
!=
null
);
if
(
line
==
'<asynchronous suspension>'
)
{
return
asynchronousSuspension
;
}
else
if
(
line
==
'...'
)
{
return
stackOverFlowElision
;
}
// Web frames.
...
...
packages/flutter/test/foundation/stack_frame_test.dart
View file @
e7984bd4
...
...
@@ -47,6 +47,28 @@ void main() {
webStackTraceFrames
,
);
});
test
(
'Parses ...'
,
()
{
expect
(
StackFrame
.
fromStackTraceLine
(
'...'
),
StackFrame
.
stackOverFlowElision
,
);
});
test
(
'Live handling of Stack Overflows'
,
()
{
void
overflow
(
int
seed
)
{
overflow
(
seed
+
1
);
}
bool
overflowed
=
false
;
try
{
overflow
(
1
);
}
on
StackOverflowError
catch
(
e
,
stack
)
{
overflowed
=
true
;
final
List
<
StackFrame
>
frames
=
StackFrame
.
fromStackTrace
(
stack
);
expect
(
frames
.
contains
(
StackFrame
.
stackOverFlowElision
),
true
);
}
expect
(
overflowed
,
true
);
},
skip:
isBrowser
);
}
const
String
stackString
=
'''#0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:42:39)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment