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
1625befc
Unverified
Commit
1625befc
authored
Jun 03, 2021
by
Jonah Williams
Committed by
GitHub
Jun 03, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] check for empty host in protocol_discovery (#83847)
parent
53e0c50a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
protocol_discovery.dart
packages/flutter_tools/lib/src/protocol_discovery.dart
+1
-1
protocol_discovery_test.dart
...ter_tools/test/general.shard/protocol_discovery_test.dart
+15
-1
No files found.
packages/flutter_tools/lib/src/protocol_discovery.dart
View file @
1625befc
...
...
@@ -128,7 +128,7 @@ class ProtocolDiscovery {
}
on
FormatException
catch
(
error
,
stackTrace
)
{
_uriStreamController
.
addError
(
error
,
stackTrace
);
}
if
(
uri
==
null
)
{
if
(
uri
==
null
||
uri
.
host
.
isEmpty
)
{
return
;
}
if
(
devicePort
!=
null
&&
uri
.
port
!=
devicePort
)
{
...
...
packages/flutter_tools/test/general.shard/protocol_discovery_test.dart
View file @
1625befc
...
...
@@ -24,7 +24,7 @@ void main() {
ipv6:
false
,
hostPort:
null
,
devicePort:
null
,
throttleDuration:
const
Duration
(
milliseconds:
200
),
throttleDuration:
const
Duration
(
milliseconds:
5
),
logger:
BufferLogger
.
test
(),
);
});
...
...
@@ -47,6 +47,20 @@ void main() {
expect
(
'
$uri
'
,
'http://127.0.0.1:9999'
);
});
testWithoutContext
(
'does not discover uri with no host'
,
()
async
{
final
Future
<
Uri
>
pendingUri
=
discoverer
.
uri
;
logReader
.
addLine
(
'Observatory listening on http12asdasdsd9999'
);
await
Future
<
void
>.
delayed
(
const
Duration
(
milliseconds:
10
));
logReader
.
addLine
(
'Observatory listening on http://127.0.0.1:9999'
);
await
Future
<
void
>.
delayed
(
Duration
.
zero
);
final
Uri
uri
=
await
pendingUri
;
expect
(
uri
,
isNotNull
);
expect
(
uri
.
port
,
9999
);
expect
(
'
$uri
'
,
'http://127.0.0.1:9999'
);
});
testWithoutContext
(
'discovers uri if logs already produced output and no listener is attached'
,
()
async
{
logReader
.
addLine
(
'HELLO WORLD'
);
logReader
.
addLine
(
'Observatory listening on http://127.0.0.1:9999'
);
...
...
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