[iedriver] Relocate removal of Edge temp directory to session quit, not window close
@@ -469,28 +469,6 @@ LRESULT IECommandExecutor::OnBrowserQuit(UINT uMsg,
LOG(WARN) << "Unable to find browser to quit with ID " << browser_id;
}
- // Delete IEDriver temporary folder when IEDriver drvies Edge in IEMode.
- // Note that the this->factory_ object might have been deleted.
- if (this->edge_temp_dir_ != L"") {
- for (int i = 0; i < 100; i++) {
- // wait for the Edge browser completing read/write work
- // the delete usually completes in 1 retries
- ::Sleep(100);
- if (BrowserFactory::DeleteDirectory(edge_temp_dir_)) {
- // directory delete failed when some files/folders are locked
- LOG(TRACE) << "Failed to delete Edge temporary user data directory "
- << LOGWSTRING(edge_temp_dir_) << ", retrying "
- << i + 1 << "...";
- } else {
- // the temporary folder has been deleted
- LOG(TRACE) << "Deleted Edge temporary user data directory "
- << LOGWSTRING(edge_temp_dir_) << ".";
- break;
- }
- }
- this->edge_temp_dir_ = L"";
- }
-
return 0;
}
@@ -632,6 +610,29 @@ LRESULT IECommandExecutor::OnQuit(UINT uMsg,
WPARAM wParam,
LPARAM lParam,
BOOL& bHandled) {
+
+ // Delete IEDriver temporary folder when IEDriver drvies Edge in IEMode.
+ // Note that the this->factory_ object might have been deleted.
+ if (this->edge_temp_dir_ != L"") {
+ for (int i = 0; i < 100; i++) {
+ // wait for the Edge browser completing read/write work
+ // the delete usually completes in 1 retries
+ ::Sleep(100);
+ if (BrowserFactory::DeleteDirectory(edge_temp_dir_)) {
+ // directory delete failed when some files/folders are locked
+ LOG(TRACE) << "Failed to delete Edge temporary user data directory "
+ << LOGWSTRING(edge_temp_dir_) << ", retrying "
+ << i + 1 << "...";
+ }
+ else {
+ // the temporary folder has been deleted
+ LOG(TRACE) << "Deleted Edge temporary user data directory "
+ << LOGWSTRING(edge_temp_dir_) << ".";
+ break;
+ }
+ }
+ this->edge_temp_dir_ = L"";
+ }
return 0;
}
