File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -369,6 +369,8 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
369
369
consecutive dialog protection is triggered. If not defined the default
370
370
message would be used, note that currently the default message is in
371
371
English and not localized.
372
+ * ` disableDialogs ` Boolean (optional) - Whether to disable dialogs
373
+ completely. Overrides ` safeDialogs ` . Default is ` false ` .
372
374
* ` navigateOnDragDrop ` Boolean (optional) - Whether dragging and dropping a
373
375
file or link onto the page causes a navigation. Default is ` false ` .
374
376
* ` autoplayPolicy ` String (optional) - Autoplay policy to apply to
Original file line number Diff line number Diff line change @@ -61,6 +61,12 @@ void ElectronJavaScriptDialogManager::RunJavaScriptDialog(
61
61
return ;
62
62
}
63
63
64
+ auto * web_preferences = WebContentsPreferences::From (web_contents);
65
+
66
+ if (web_preferences && web_preferences->IsEnabled (" disableDialogs" )) {
67
+ return std::move (callback).Run (false , base::string16 ());
68
+ }
69
+
64
70
// No default button
65
71
int default_id = -1 ;
66
72
int cancel_id = 0 ;
@@ -75,7 +81,6 @@ void ElectronJavaScriptDialogManager::RunJavaScriptDialog(
75
81
76
82
origin_counts_[origin]++;
77
83
78
- auto * web_preferences = WebContentsPreferences::From (web_contents);
79
84
std::string checkbox;
80
85
if (origin_counts_[origin] > 1 && web_preferences &&
81
86
web_preferences->IsEnabled (" safeDialogs" ) &&
You can’t perform that action at this time.
0 commit comments