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
fef6f543
Unverified
Commit
fef6f543
authored
Apr 08, 2021
by
Jenn Magder
Committed by
GitHub
Apr 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check if reg can run before calling it on Windows (#79905)
parent
0ee46566
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
15 deletions
+54
-15
web_device.dart
packages/flutter_tools/lib/src/web/web_device.dart
+18
-15
devices_test.dart
...es/flutter_tools/test/general.shard/web/devices_test.dart
+36
-0
No files found.
packages/flutter_tools/lib/src/web/web_device.dart
View file @
fef6f543
...
...
@@ -210,13 +210,15 @@ class GoogleChromeDevice extends ChromiumDevice {
// See https://bugs.chromium.org/p/chromium/issues/detail?id=158372
String
version
=
'unknown'
;
if
(
_platform
.
isWindows
)
{
final
ProcessResult
result
=
await
_processManager
.
run
(<
String
>[
r'reg'
,
'query'
,
r'HKEY_CURRENT_USER\Software\Google\Chrome\BLBeacon'
,
'/v'
,
'version'
,
]);
if
(
result
.
exitCode
==
0
)
{
final
List
<
String
>
parts
=
(
result
.
stdout
as
String
).
split
(
RegExp
(
r'\s+'
));
if
(
parts
.
length
>
2
)
{
version
=
'Google Chrome '
+
parts
[
parts
.
length
-
2
];
if
(
_processManager
.
canRun
(
'reg'
))
{
final
ProcessResult
result
=
await
_processManager
.
run
(<
String
>[
r'reg'
,
'query'
,
r'HKEY_CURRENT_USER\Software\Google\Chrome\BLBeacon'
,
'/v'
,
'version'
,
]);
if
(
result
.
exitCode
==
0
)
{
final
List
<
String
>
parts
=
(
result
.
stdout
as
String
).
split
(
RegExp
(
r'\s+'
));
if
(
parts
.
length
>
2
)
{
version
=
'Google Chrome '
+
parts
[
parts
.
length
-
2
];
}
}
}
}
else
{
...
...
@@ -231,7 +233,6 @@ class GoogleChromeDevice extends ChromiumDevice {
}
return
version
.
trim
();
}
}
/// The Microsoft Edge browser based on Chromium.
...
...
@@ -270,13 +271,15 @@ class MicrosoftEdgeDevice extends ChromiumDevice {
Future
<
String
>
get
sdkNameAndVersion
async
=>
_sdkNameAndVersion
??=
await
_getSdkNameAndVersion
();
String
_sdkNameAndVersion
;
Future
<
String
>
_getSdkNameAndVersion
()
async
{
final
ProcessResult
result
=
await
_processManager
.
run
(<
String
>[
r'reg'
,
'query'
,
r'HKEY_CURRENT_USER\Software\Microsoft\Edge\BLBeacon'
,
'/v'
,
'version'
,
]);
if
(
result
.
exitCode
==
0
)
{
final
List
<
String
>
parts
=
(
result
.
stdout
as
String
).
split
(
RegExp
(
r'\s+'
));
if
(
parts
.
length
>
2
)
{
return
'Microsoft Edge '
+
parts
[
parts
.
length
-
2
];
if
(
_processManager
.
canRun
(
'reg'
))
{
final
ProcessResult
result
=
await
_processManager
.
run
(<
String
>[
r'reg'
,
'query'
,
r'HKEY_CURRENT_USER\Software\Microsoft\Edge\BLBeacon'
,
'/v'
,
'version'
,
]);
if
(
result
.
exitCode
==
0
)
{
final
List
<
String
>
parts
=
(
result
.
stdout
as
String
).
split
(
RegExp
(
r'\s+'
));
if
(
parts
.
length
>
2
)
{
return
'Microsoft Edge '
+
parts
[
parts
.
length
-
2
];
}
}
}
// Return a non-null string so that the tool can validate the version
...
...
packages/flutter_tools/test/general.shard/web/devices_test.dart
View file @
fef6f543
...
...
@@ -255,6 +255,42 @@ void main() {
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'Chrome and Edge version check handles missing registry on Windows'
,
()
async
{
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[]);
processManager
.
excludedExecutables
.
add
(
'reg'
);
final
Platform
platform
=
FakePlatform
(
operatingSystem:
'windows'
,
environment:
<
String
,
String
>{});
final
ChromiumLauncher
chromeLauncher
=
ChromiumLauncher
(
fileSystem:
MemoryFileSystem
.
test
(),
platform:
platform
,
processManager:
processManager
,
operatingSystemUtils:
null
,
browserFinder:
findChromeExecutable
,
logger:
BufferLogger
.
test
(),
);
final
MicrosoftEdgeDevice
edgeDevice
=
MicrosoftEdgeDevice
(
chromiumLauncher:
chromeLauncher
,
fileSystem:
MemoryFileSystem
.
test
(),
logger:
BufferLogger
.
test
(),
processManager:
processManager
,
);
expect
(
edgeDevice
.
isSupported
(),
true
);
expect
(
await
edgeDevice
.
sdkNameAndVersion
,
''
);
final
GoogleChromeDevice
chromeDevice
=
GoogleChromeDevice
(
chromiumLauncher:
chromeLauncher
,
fileSystem:
MemoryFileSystem
.
test
(),
logger:
BufferLogger
.
test
(),
processManager:
processManager
,
platform:
platform
,
);
expect
(
chromeDevice
.
isSupported
(),
true
);
expect
(
await
chromeDevice
.
sdkNameAndVersion
,
'unknown'
);
});
testWithoutContext
(
'Edge is not supported on versions less than 73'
,
()
async
{
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
...
...
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