12345678910111213141516171819202122 |
- # Add --disable-beforeunload to always disable beforeunload JavaScript dialogs
- --- a/components/javascript_dialogs/app_modal_dialog_manager.cc
- +++ b/components/javascript_dialogs/app_modal_dialog_manager.cc
- @@ -8,6 +8,7 @@
- #include <utility>
-
- #include "base/bind.h"
- +#include "base/command_line.h"
- #include "base/i18n/rtl.h"
- #include "base/macros.h"
- #include "base/metrics/histogram_macros.h"
- @@ -199,7 +200,8 @@ void AppModalDialogManager::RunBeforeUnl
- ChromeJavaScriptDialogExtraData* extra_data =
- &javascript_dialog_extra_data_[web_contents];
-
- - if (extra_data->suppress_javascript_messages_) {
- + if (extra_data->suppress_javascript_messages_
- + || base::CommandLine::ForCurrentProcess()->HasSwitch("disable-beforeunload")) {
- // If a site harassed the user enough for them to put it on mute, then it
- // lost its privilege to deny unloading.
- std::move(callback).Run(true, base::string16());
|