Skip to content

Commit

Permalink
fix: use file path as key for safeDialogs on filesystem (#17579)
Browse files Browse the repository at this point in the history
  • Loading branch information
trop[bot] authored and MarshallOfSound committed Mar 27, 2019
1 parent f3a2c27 commit 0e5d181
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion atom/browser/atom_javascript_dialog_manager.cc
Expand Up @@ -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());
}
Expand Down

0 comments on commit 0e5d181

Please sign in to comment.