fix: use file path as key for safeDialogs on filesystem (#17546)

This commit is contained in:
Samuel Attard 2019-03-27 11:21:10 -07:00 committed by GitHub
parent 2188a6ea99
commit f4434763fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -41,7 +41,16 @@ void AtomJavaScriptDialogManager::RunJavaScriptDialog(
DialogClosedCallback callback,
bool* did_suppress_message) {
auto origin_url = rfh->GetLastCommittedURL();
const std::string& origin = origin_url.GetOrigin().spec();
std::string origin;
// For file:// URLs we do the alert filtering by the
// file path currently loaded
if (origin_url.SchemeIsFile()) {
origin = origin_url.path();
} else {
origin = origin_url.GetOrigin().spec();
}
if (origin_counts_[origin] == kUserWantsNoMoreDialogs) {
return std::move(callback).Run(false, base::string16());
}