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
0620cfa7
Unverified
Commit
0620cfa7
authored
Jun 08, 2020
by
Jonah Williams
Committed by
GitHub
Jun 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Send text error in JSON and print in tools (#58994)" (#59002)
This reverts commit
f0174b17
.
parent
ef9b77d9
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
16 additions
and
158 deletions
+16
-158
widget_inspector.dart
packages/flutter/lib/src/widgets/widget_inspector.dart
+1
-10
widget_inspector_test.dart
packages/flutter/test/widgets/widget_inspector_test.dart
+0
-5
resident_web_runner.dart
...utter_tools/lib/src/build_runner/resident_web_runner.dart
+0
-10
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+2
-17
vmservice.dart
packages/flutter_tools/lib/src/vmservice.dart
+0
-17
attach_test.dart
...utter_tools/test/commands.shard/hermetic/attach_test.dart
+0
-1
cold_test.dart
packages/flutter_tools/test/general.shard/cold_test.dart
+0
-1
hot_test.dart
packages/flutter_tools/test/general.shard/hot_test.dart
+0
-1
resident_runner_test.dart
...lutter_tools/test/general.shard/resident_runner_test.dart
+0
-1
resident_web_runner_test.dart
...er_tools/test/general.shard/resident_web_runner_test.dart
+13
-70
vmservice_test.dart
...ages/flutter_tools/test/general.shard/vmservice_test.dart
+0
-25
No files found.
packages/flutter/lib/src/widgets/widget_inspector.dart
View file @
0620cfa7
...
...
@@ -929,17 +929,8 @@ mixin WidgetInspectorService {
);
errorJson
[
'errorsSinceReload'
]
=
_errorsSinceReload
;
if
(
_errorsSinceReload
==
0
)
{
errorJson
[
'renderedErrorText'
]
=
TextTreeRenderer
(
wrapWidth:
FlutterError
.
wrapWidth
,
wrapWidthProperties:
FlutterError
.
wrapWidth
,
maxDescendentsTruncatableNode:
5
,
).
render
(
details
.
toDiagnosticsNode
(
style:
DiagnosticsTreeStyle
.
error
)).
trimRight
();
}
else
{
errorJson
[
'renderedErrorText'
]
=
'Another exception was thrown:
${details.summary}
'
;
}
_errorsSinceReload
+=
1
;
postEvent
(
'Flutter.Error'
,
errorJson
);
}
...
...
packages/flutter/test/widgets/widget_inspector_test.dart
View file @
0620cfa7
...
...
@@ -2254,10 +2254,6 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
// Validate that we received an error count.
expect
(
error
[
'errorsSinceReload'
],
0
);
expect
(
error
[
'renderedErrorText'
],
startsWith
(
'══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞════════════'
));
// Send a second error.
FlutterError
.
reportError
(
FlutterErrorDetailsForRendering
(
...
...
@@ -2271,7 +2267,6 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
expect
(
flutterErrorEvents
,
hasLength
(
2
));
error
=
flutterErrorEvents
.
last
;
expect
(
error
[
'errorsSinceReload'
],
1
);
expect
(
error
[
'renderedErrorText'
],
startsWith
(
'Another exception was thrown:'
));
// Reloads the app.
final
FlutterExceptionHandler
oldHandler
=
FlutterError
.
onError
;
...
...
packages/flutter_tools/lib/src/build_runner/resident_web_runner.dart
View file @
0620cfa7
...
...
@@ -112,7 +112,6 @@ abstract class ResidentWebRunner extends ResidentRunner {
ConnectionResult
_connectionResult
;
StreamSubscription
<
vmservice
.
Event
>
_stdOutSub
;
StreamSubscription
<
vmservice
.
Event
>
_stdErrSub
;
StreamSubscription
<
vmservice
.
Event
>
_extensionEventSub
;
bool
_exited
=
false
;
WipConnection
_wipConnection
;
ChromiumLauncher
_chromiumLauncher
;
...
...
@@ -151,7 +150,6 @@ abstract class ResidentWebRunner extends ResidentRunner {
}
await
_stdOutSub
?.
cancel
();
await
_stdErrSub
?.
cancel
();
await
_extensionEventSub
?.
cancel
();
await
device
.
device
.
stopApp
(
null
);
try
{
_generatedEntrypointDirectory
?.
deleteSync
(
recursive:
true
);
...
...
@@ -677,8 +675,6 @@ class _ResidentWebRunner extends ResidentWebRunner {
final
String
message
=
utf8
.
decode
(
base64
.
decode
(
log
.
bytes
));
globals
.
printStatus
(
message
,
newline:
false
);
});
_extensionEventSub
=
_vmService
.
onExtensionEvent
.
listen
(
printStructuredErrorLog
);
try
{
await
_vmService
.
streamListen
(
vmservice
.
EventStreams
.
kStdout
);
}
on
vmservice
.
RPCError
{
...
...
@@ -697,12 +693,6 @@ class _ResidentWebRunner extends ResidentWebRunner {
// It is safe to ignore this error because we expect an error to be
// thrown if we're not already subscribed.
}
try
{
await
_vmService
.
streamListen
(
vmservice
.
EventStreams
.
kExtension
);
}
on
vmservice
.
RPCError
{
// It is safe to ignore this error because we expect an error to be
// thrown if we're not already subscribed.
}
unawaited
(
_vmService
.
registerService
(
'reloadSources'
,
'FlutterTools'
));
_vmService
.
registerServiceCallback
(
'reloadSources'
,
(
Map
<
String
,
Object
>
params
)
async
{
final
bool
pause
=
params
[
'pause'
]
as
bool
??
false
;
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
0620cfa7
...
...
@@ -188,7 +188,6 @@ class FlutterDevice {
CompileExpression
compileExpression
,
ReloadMethod
reloadMethod
,
GetSkSLMethod
getSkSLMethod
,
PrintStructuredErrorLogMethod
printStructuredErrorLogMethod
,
})
{
final
Completer
<
void
>
completer
=
Completer
<
void
>();
StreamSubscription
<
void
>
subscription
;
...
...
@@ -208,7 +207,6 @@ class FlutterDevice {
compileExpression:
compileExpression
,
reloadMethod:
reloadMethod
,
getSkSLMethod:
getSkSLMethod
,
printStructuredErrorLogMethod:
printStructuredErrorLogMethod
,
device:
device
,
);
}
on
Exception
catch
(
exception
)
{
...
...
@@ -1063,23 +1061,11 @@ abstract class ResidentRunner {
final
String
copyPath
=
getDefaultCachedKernelPath
(
trackWidgetCreation:
trackWidgetCreation
,
);
globals
.
fs
.
file
(
copyPath
)
.
parent
.
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
copyPath
).
parent
.
createSync
(
recursive:
true
);
outputDill
.
copySync
(
copyPath
);
}
}
void
printStructuredErrorLog
(
vm_service
.
Event
event
)
{
if
(
event
.
extensionKind
==
'Flutter.Error'
)
{
final
Map
<
dynamic
,
dynamic
>
json
=
event
.
extensionData
?.
data
;
if
(
json
!=
null
&&
json
.
containsKey
(
'renderedErrorText'
))
{
globals
.
printStatus
(
'
\n
${json['renderedErrorText']}
'
);
}
}
}
/// If the [reloadSources] parameter is not null the 'reloadSources' service
/// will be registered.
//
...
...
@@ -1104,8 +1090,7 @@ abstract class ResidentRunner {
restart:
restart
,
compileExpression:
compileExpression
,
reloadMethod:
reloadMethod
,
getSkSLMethod:
getSkSLMethod
,
printStructuredErrorLogMethod:
printStructuredErrorLog
,
getSkSLMethod:
getSkSLMethod
);
// This will wait for at least one flutter view before returning.
final
Status
status
=
globals
.
logger
.
startProgress
(
...
...
packages/flutter_tools/lib/src/vmservice.dart
View file @
0620cfa7
...
...
@@ -31,8 +31,6 @@ const int kIsolateReloadBarred = 1005;
/// for [WebSocket]s (used by tests).
typedef
WebSocketConnector
=
Future
<
io
.
WebSocket
>
Function
(
String
url
,
{
io
.
CompressionOptions
compression
});
typedef
PrintStructuredErrorLogMethod
=
void
Function
(
vm_service
.
Event
);
WebSocketConnector
_openChannel
=
_defaultOpenChannel
;
/// The error codes for the JSON-RPC standard.
...
...
@@ -151,7 +149,6 @@ typedef VMServiceConnector = Future<vm_service.VmService> Function(Uri httpUri,
CompileExpression
compileExpression
,
ReloadMethod
reloadMethod
,
GetSkSLMethod
getSkSLMethod
,
PrintStructuredErrorLogMethod
printStructuredErrorLogMethod
,
io
.
CompressionOptions
compression
,
Device
device
,
});
...
...
@@ -178,7 +175,6 @@ vm_service.VmService setUpVmService(
Device
device
,
ReloadMethod
reloadMethod
,
GetSkSLMethod
skSLMethod
,
PrintStructuredErrorLogMethod
printStructuredErrorLogMethod
,
vm_service
.
VmService
vmService
)
{
if
(
reloadSources
!=
null
)
{
...
...
@@ -297,15 +293,6 @@ vm_service.VmService setUpVmService(
});
vmService
.
registerService
(
'flutterGetSkSL'
,
'Flutter Tools'
);
}
if
(
printStructuredErrorLogMethod
!=
null
)
{
try
{
vmService
.
streamListen
(
vm_service
.
EventStreams
.
kExtension
);
}
on
vm_service
.
RPCError
{
// It is safe to ignore this error because we expect an error to be
// thrown if we're already subscribed.
}
vmService
.
onExtensionEvent
.
listen
(
printStructuredErrorLogMethod
);
}
return
vmService
;
}
...
...
@@ -324,7 +311,6 @@ Future<vm_service.VmService> connectToVmService(
CompileExpression
compileExpression
,
ReloadMethod
reloadMethod
,
GetSkSLMethod
getSkSLMethod
,
PrintStructuredErrorLogMethod
printStructuredErrorLogMethod
,
io
.
CompressionOptions
compression
=
io
.
CompressionOptions
.
compressionDefault
,
Device
device
,
})
async
{
...
...
@@ -337,7 +323,6 @@ Future<vm_service.VmService> connectToVmService(
device:
device
,
reloadMethod:
reloadMethod
,
getSkSLMethod:
getSkSLMethod
,
printStructuredErrorLogMethod:
printStructuredErrorLogMethod
,
);
}
...
...
@@ -348,7 +333,6 @@ Future<vm_service.VmService> _connect(
CompileExpression
compileExpression
,
ReloadMethod
reloadMethod
,
GetSkSLMethod
getSkSLMethod
,
PrintStructuredErrorLogMethod
printStructuredErrorLogMethod
,
io
.
CompressionOptions
compression
=
io
.
CompressionOptions
.
compressionDefault
,
Device
device
,
})
async
{
...
...
@@ -370,7 +354,6 @@ Future<vm_service.VmService> _connect(
device
,
reloadMethod
,
getSkSLMethod
,
printStructuredErrorLogMethod
,
delegateService
,
);
_httpAddressExpando
[
service
]
=
httpUri
;
...
...
packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart
View file @
0620cfa7
...
...
@@ -705,7 +705,6 @@ VMServiceConnector getFakeVmServiceFactory({
CompileExpression
compileExpression
,
ReloadMethod
reloadMethod
,
GetSkSLMethod
getSkSLMethod
,
PrintStructuredErrorLogMethod
printStructuredErrorLogMethod
,
CompressionOptions
compression
,
Device
device
,
})
async
{
...
...
packages/flutter_tools/test/general.shard/cold_test.dart
View file @
0620cfa7
...
...
@@ -135,7 +135,6 @@ class TestFlutterDevice extends FlutterDevice {
CompileExpression
compileExpression
,
ReloadMethod
reloadMethod
,
GetSkSLMethod
getSkSLMethod
,
PrintStructuredErrorLogMethod
printStructuredErrorLogMethod
,
})
async
{
throw
exception
;
}
...
...
packages/flutter_tools/test/general.shard/hot_test.dart
View file @
0620cfa7
...
...
@@ -510,7 +510,6 @@ class TestFlutterDevice extends FlutterDevice {
CompileExpression
compileExpression
,
ReloadMethod
reloadMethod
,
GetSkSLMethod
getSkSLMethod
,
PrintStructuredErrorLogMethod
printStructuredErrorLogMethod
,
})
async
{
throw
exception
;
}
...
...
packages/flutter_tools/test/general.shard/resident_runner_test.dart
View file @
0620cfa7
...
...
@@ -1357,7 +1357,6 @@ void main() {
CompileExpression
compileExpression
,
ReloadMethod
reloadMethod
,
GetSkSLMethod
getSkSLMethod
,
PrintStructuredErrorLogMethod
printStructuredErrorLogMethod
,
io
.
CompressionOptions
compression
,
Device
device
,
})
async
=>
mockVMService
,
...
...
packages/flutter_tools/test/general.shard/resident_web_runner_test.dart
View file @
0620cfa7
...
...
@@ -4,7 +4,6 @@
import
'dart:async'
;
import
'dart:convert'
;
import
'dart:io'
;
import
'package:dwds/dwds.dart'
;
import
'package:flutter_tools/src/base/common.dart'
;
...
...
@@ -57,12 +56,6 @@ const List<VmServiceExpectation> kAttachIsolateExpectations = <VmServiceExpectat
'streamId'
:
'Isolate'
}
),
FakeVmServiceRequest
(
method:
'streamListen'
,
args:
<
String
,
Object
>{
'streamId'
:
'Extension'
,
},
),
FakeVmServiceRequest
(
method:
'registerService'
,
args:
<
String
,
Object
>{
...
...
@@ -347,68 +340,6 @@ void main() {
expect
(
testLogger
.
statusText
,
contains
(
'SO IS THIS'
));
}));
test
(
'Listens to extension events with structured errors'
,
()
=>
testbed
.
run
(()
async
{
final
Map
<
String
,
String
>
extensionData
=
<
String
,
String
>{
'test'
:
'data'
,
'renderedErrorText'
:
'error text'
,
};
final
Map
<
String
,
String
>
emptyExtensionData
=
<
String
,
String
>{
'test'
:
'data'
,
'renderedErrorText'
:
''
,
};
final
Map
<
String
,
String
>
nonStructuredErrorData
=
<
String
,
String
>{
'other'
:
'other stuff'
,
};
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[
...
kAttachExpectations
,
FakeVmServiceStreamResponse
(
streamId:
'Extension'
,
event:
vm_service
.
Event
(
timestamp:
0
,
extensionKind:
'Flutter.Error'
,
extensionData:
vm_service
.
ExtensionData
.
parse
(
extensionData
),
kind:
vm_service
.
EventStreams
.
kExtension
,
),
),
// Empty error text should not break anything.
FakeVmServiceStreamResponse
(
streamId:
'Extension'
,
event:
vm_service
.
Event
(
timestamp:
0
,
extensionKind:
'Flutter.Error'
,
extensionData:
vm_service
.
ExtensionData
.
parse
(
emptyExtensionData
),
kind:
vm_service
.
EventStreams
.
kExtension
,
),
),
// This is not Flutter.Error kind data, so it should not be logged.
FakeVmServiceStreamResponse
(
streamId:
'Extension'
,
event:
vm_service
.
Event
(
timestamp:
0
,
extensionKind:
'Other'
,
extensionData:
vm_service
.
ExtensionData
.
parse
(
nonStructuredErrorData
),
kind:
vm_service
.
EventStreams
.
kExtension
,
),
),
]);
_setupMocks
();
final
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
=
Completer
<
DebugConnectionInfo
>();
unawaited
(
residentWebRunner
.
run
(
connectionInfoCompleter:
connectionInfoCompleter
,
));
await
connectionInfoCompleter
.
future
;
// Need these to run events, otherwise expect statements below run before
// structured errors are processed.
await
null
;
await
null
;
await
null
;
expect
(
testLogger
.
statusText
,
contains
(
'
\n
error text'
));
expect
(
testLogger
.
statusText
,
isNot
(
contains
(
'other stuff'
)));
}));
test
(
'Does not run main with --start-paused'
,
()
=>
testbed
.
run
(()
async
{
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
kAttachExpectations
.
toList
());
residentWebRunner
=
DwdsWebRunnerFactory
().
createWebRunner
(
...
...
@@ -1142,7 +1073,19 @@ void main() {
test
(
'Sends launched app.webLaunchUrl event for Chrome device'
,
()
=>
testbed
.
run
(()
async
{
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[
...
kAttachLogExpectations
,
...
kAttachIsolateExpectations
,
const
FakeVmServiceRequest
(
method:
'streamListen'
,
args:
<
String
,
Object
>{
'streamId'
:
'Isolate'
}
),
const
FakeVmServiceRequest
(
method:
'registerService'
,
args:
<
String
,
Object
>{
'service'
:
'reloadSources'
,
'alias'
:
'FlutterTools'
,
}
)
]);
_setupMocks
();
final
ChromiumLauncher
chromiumLauncher
=
MockChromeLauncher
();
...
...
packages/flutter_tools/test/general.shard/vmservice_test.dart
View file @
0620cfa7
...
...
@@ -104,7 +104,6 @@ void main() {
null
,
null
,
null
,
null
,
mockVMService
,
);
...
...
@@ -124,7 +123,6 @@ void main() {
null
,
reloadMethod
,
null
,
null
,
mockVMService
,
);
...
...
@@ -144,7 +142,6 @@ void main() {
mockDevice
,
null
,
null
,
null
,
mockVMService
,
);
...
...
@@ -162,7 +159,6 @@ void main() {
null
,
null
,
()
async
=>
'hello'
,
null
,
mockVMService
,
);
...
...
@@ -171,26 +167,6 @@ void main() {
Logger:
()
=>
BufferLogger
.
test
()
});
testUsingContext
(
'VmService registers flutterPrintStructuredErrorLogMethod'
,
()
async
{
final
MockVMService
mockVMService
=
MockVMService
();
when
(
mockVMService
.
onExtensionEvent
).
thenAnswer
((
Invocation
invocation
)
{
return
const
Stream
<
vm_service
.
Event
>.
empty
();
});
setUpVmService
(
null
,
null
,
null
,
null
,
null
,
null
,
(
vm_service
.
Event
event
)
async
=>
'hello'
,
mockVMService
,
);
verify
(
mockVMService
.
streamListen
(
vm_service
.
EventStreams
.
kExtension
)).
called
(
1
);
},
overrides:
<
Type
,
Generator
>{
Logger:
()
=>
BufferLogger
.
test
()
});
testUsingContext
(
'VMService returns correct FlutterVersion'
,
()
async
{
final
MockVMService
mockVMService
=
MockVMService
();
setUpVmService
(
...
...
@@ -200,7 +176,6 @@ void main() {
null
,
null
,
null
,
null
,
mockVMService
,
);
...
...
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