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
5406258f
Unverified
Commit
5406258f
authored
Feb 12, 2020
by
Jonah Williams
Committed by
GitHub
Feb 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] fix crash when IsolateRef returns sentinel (#50611)
parent
bfbb3476
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
2 deletions
+35
-2
fallback_discovery.dart
packages/flutter_tools/lib/src/ios/fallback_discovery.dart
+6
-2
fallback_discovery_test.dart
...tools/test/general.shard/ios/fallback_discovery_test.dart
+29
-0
No files found.
packages/flutter_tools/lib/src/ios/fallback_discovery.dart
View file @
5406258f
...
...
@@ -132,8 +132,12 @@ class FallbackDiscovery {
final
VmService
vmService
=
await
_vmServiceConnectUri
(
assumedWsUri
.
toString
());
final
VM
vm
=
await
vmService
.
getVM
();
for
(
final
IsolateRef
isolateRefs
in
vm
.
isolates
)
{
final
Isolate
isolate
=
await
vmService
.
getIsolate
(
isolateRefs
.
id
)
as
Isolate
;
final
LibraryRef
library
=
isolate
.
rootLib
;
final
dynamic
isolateResponse
=
await
vmService
.
getIsolate
(
isolateRefs
.
id
);
if
(
isolateResponse
is
Sentinel
)
{
// Might have been a Sentinel. Try again later.
throw
Exception
(
'Expected Isolate but found Sentinel:
$isolateResponse
'
);
}
final
LibraryRef
library
=
(
isolateResponse
as
Isolate
).
rootLib
;
if
(
library
.
uri
.
startsWith
(
'package:
$packageName
'
))
{
UsageEvent
(
_kEventName
,
'success'
).
send
();
return
Uri
.
parse
(
'http://localhost:
$hostPort
'
);
...
...
packages/flutter_tools/test/general.shard/ios/fallback_discovery_test.dart
View file @
5406258f
...
...
@@ -67,6 +67,35 @@ void main() {
),
Uri
.
parse
(
'http://localhost:1'
));
});
testUsingContext
(
'Selects mdns discovery if VM service connecton fails due to Sentinel'
,
()
async
{
when
(
mockVmService
.
getVM
()).
thenAnswer
((
Invocation
invocation
)
async
{
return
VM
()..
isolates
=
<
IsolateRef
>[
IsolateRef
(),
];
});
when
(
mockVmService
.
getIsolate
(
any
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
Sentinel
();
});
when
(
mockMDnsObservatoryDiscovery
.
getObservatoryUri
(
'hello'
,
null
,
// Device
usesIpv6:
false
,
hostVmservicePort:
1
,
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
Uri
.
parse
(
'http://localhost:1234'
);
});
expect
(
await
fallbackDiscovery
.
discover
(
assumedDevicePort:
23
,
deivce:
null
,
hostVmservicePort:
1
,
packageId:
'hello'
,
usesIpv6:
false
,
packageName:
'hello'
,
),
Uri
.
parse
(
'http://localhost:1234'
));
});
testUsingContext
(
'Selects mdns discovery if VM service connecton fails'
,
()
async
{
when
(
mockVmService
.
getVM
()).
thenThrow
(
Exception
());
...
...
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