Delete Chrome temp cache after closing (#119062)
* Delete Chrome temp cache after closeing * Update packages/flutter_tools/lib/src/web/chrome.dart Co-authored-by: Christopher Fujino <fujino@google.com> --------- Co-authored-by: Christopher Fujino <fujino@google.com>
This commit is contained in:
parent
298c874eac
commit
25c2c22d29
@ -222,6 +222,12 @@ class ChromiumLauncher {
|
|||||||
if (process != null && cacheDir != null) {
|
if (process != null && cacheDir != null) {
|
||||||
unawaited(process.exitCode.whenComplete(() {
|
unawaited(process.exitCode.whenComplete(() {
|
||||||
_cacheUserSessionInformation(userDataDir, cacheDir);
|
_cacheUserSessionInformation(userDataDir, cacheDir);
|
||||||
|
// cleanup temp dir
|
||||||
|
try {
|
||||||
|
userDataDir.deleteSync(recursive: true);
|
||||||
|
} on FileSystemException {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
return connect(Chromium(
|
return connect(Chromium(
|
||||||
|
@ -419,13 +419,6 @@ void main() {
|
|||||||
cacheDir: dataDir,
|
cacheDir: dataDir,
|
||||||
);
|
);
|
||||||
|
|
||||||
exitCompleter.complete();
|
|
||||||
await Future<void>.delayed(const Duration(milliseconds: 1));
|
|
||||||
|
|
||||||
// writes non-crash back to dart_tool
|
|
||||||
expect(preferencesFile.readAsStringSync(), '"exit_type":"Normal"');
|
|
||||||
|
|
||||||
|
|
||||||
// validate any Default content is copied
|
// validate any Default content is copied
|
||||||
final Directory defaultContentDir = fileSystem
|
final Directory defaultContentDir = fileSystem
|
||||||
.directory('.tmp_rand0/flutter_tools_chrome_device.rand0')
|
.directory('.tmp_rand0/flutter_tools_chrome_device.rand0')
|
||||||
@ -434,6 +427,12 @@ void main() {
|
|||||||
|
|
||||||
expect(defaultContentDir, exists);
|
expect(defaultContentDir, exists);
|
||||||
|
|
||||||
|
exitCompleter.complete();
|
||||||
|
await Future<void>.delayed(const Duration(milliseconds: 1));
|
||||||
|
|
||||||
|
// writes non-crash back to dart_tool
|
||||||
|
expect(preferencesFile.readAsStringSync(), '"exit_type":"Normal"');
|
||||||
|
|
||||||
// Validate cache dirs are not copied.
|
// Validate cache dirs are not copied.
|
||||||
for (final String cache in kCodeCache) {
|
for (final String cache in kCodeCache) {
|
||||||
expect(fileSystem
|
expect(fileSystem
|
||||||
@ -441,6 +440,9 @@ void main() {
|
|||||||
.childDirectory('Default')
|
.childDirectory('Default')
|
||||||
.childDirectory(cache), isNot(exists));
|
.childDirectory(cache), isNot(exists));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// validate defaultContentDir is deleted after exit, data is in cache
|
||||||
|
expect(defaultContentDir, isNot(exists));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('can retry launch when glibc bug happens', () async {
|
testWithoutContext('can retry launch when glibc bug happens', () async {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user