Add options to ignore javascript prompts/alerts.
New options: content -> ignore-javascript-{prompt,alert}.
This commit is contained in:
parent
238761bd5b
commit
b31a432a1a
@ -128,6 +128,8 @@
|
|||||||
|<<content-javascript-can-open-windows,javascript-can-open-windows>>|Whether JavaScript programs can open new windows.
|
|<<content-javascript-can-open-windows,javascript-can-open-windows>>|Whether JavaScript programs can open new windows.
|
||||||
|<<content-javascript-can-close-windows,javascript-can-close-windows>>|Whether JavaScript programs can close windows.
|
|<<content-javascript-can-close-windows,javascript-can-close-windows>>|Whether JavaScript programs can close windows.
|
||||||
|<<content-javascript-can-access-clipboard,javascript-can-access-clipboard>>|Whether JavaScript programs can read or write to the clipboard.
|
|<<content-javascript-can-access-clipboard,javascript-can-access-clipboard>>|Whether JavaScript programs can read or write to the clipboard.
|
||||||
|
|<<content-ignore-javascript-prompt,ignore-javascript-prompt>>|Whether all javascript prompts should be ignored.
|
||||||
|
|<<content-ignore-javascript-alert,ignore-javascript-alert>>|Whether all javascript alerts should be ignored.
|
||||||
|<<content-local-content-can-access-remote-urls,local-content-can-access-remote-urls>>|Whether locally loaded documents are allowed to access remote urls.
|
|<<content-local-content-can-access-remote-urls,local-content-can-access-remote-urls>>|Whether locally loaded documents are allowed to access remote urls.
|
||||||
|<<content-local-content-can-access-file-urls,local-content-can-access-file-urls>>|Whether locally loaded documents are allowed to access other local urls.
|
|<<content-local-content-can-access-file-urls,local-content-can-access-file-urls>>|Whether locally loaded documents are allowed to access other local urls.
|
||||||
|<<content-cookies-accept,cookies-accept>>|Whether to accept cookies.
|
|<<content-cookies-accept,cookies-accept>>|Whether to accept cookies.
|
||||||
@ -1079,6 +1081,28 @@ Valid values:
|
|||||||
|
|
||||||
Default: +pass:[false]+
|
Default: +pass:[false]+
|
||||||
|
|
||||||
|
[[content-ignore-javascript-prompt]]
|
||||||
|
=== ignore-javascript-prompt
|
||||||
|
Whether all javascript prompts should be ignored.
|
||||||
|
|
||||||
|
Valid values:
|
||||||
|
|
||||||
|
* +true+
|
||||||
|
* +false+
|
||||||
|
|
||||||
|
Default: +pass:[false]+
|
||||||
|
|
||||||
|
[[content-ignore-javascript-alert]]
|
||||||
|
=== ignore-javascript-alert
|
||||||
|
Whether all javascript alerts should be ignored.
|
||||||
|
|
||||||
|
Valid values:
|
||||||
|
|
||||||
|
* +true+
|
||||||
|
* +false+
|
||||||
|
|
||||||
|
Default: +pass:[false]+
|
||||||
|
|
||||||
[[content-local-content-can-access-remote-urls]]
|
[[content-local-content-can-access-remote-urls]]
|
||||||
=== local-content-can-access-remote-urls
|
=== local-content-can-access-remote-urls
|
||||||
Whether locally loaded documents are allowed to access remote urls.
|
Whether locally loaded documents are allowed to access remote urls.
|
||||||
|
@ -87,7 +87,8 @@ class BrowserPage(QWebPage):
|
|||||||
|
|
||||||
def javaScriptPrompt(self, _frame, msg, default):
|
def javaScriptPrompt(self, _frame, msg, default):
|
||||||
"""Override javaScriptPrompt to use the statusbar."""
|
"""Override javaScriptPrompt to use the statusbar."""
|
||||||
if self._is_shutting_down:
|
if (self._is_shutting_down or
|
||||||
|
config.get('content', 'ignore-javascript-prompt')):
|
||||||
return (False, "")
|
return (False, "")
|
||||||
answer = self._ask("js: {}".format(msg), usertypes.PromptMode.text,
|
answer = self._ask("js: {}".format(msg), usertypes.PromptMode.text,
|
||||||
default)
|
default)
|
||||||
@ -433,7 +434,8 @@ class BrowserPage(QWebPage):
|
|||||||
|
|
||||||
def javaScriptAlert(self, _frame, msg):
|
def javaScriptAlert(self, _frame, msg):
|
||||||
"""Override javaScriptAlert to use the statusbar."""
|
"""Override javaScriptAlert to use the statusbar."""
|
||||||
if self._is_shutting_down:
|
if (self._is_shutting_down or
|
||||||
|
config.get('content', 'ignore-javascript-alert')):
|
||||||
return
|
return
|
||||||
self._ask("[js alert] {}".format(msg), usertypes.PromptMode.alert)
|
self._ask("[js alert] {}".format(msg), usertypes.PromptMode.alert)
|
||||||
|
|
||||||
|
@ -542,6 +542,14 @@ DATA = collections.OrderedDict([
|
|||||||
SettingValue(typ.Bool(), 'false'),
|
SettingValue(typ.Bool(), 'false'),
|
||||||
"Whether JavaScript programs can read or write to the clipboard."),
|
"Whether JavaScript programs can read or write to the clipboard."),
|
||||||
|
|
||||||
|
('ignore-javascript-prompt',
|
||||||
|
SettingValue(typ.Bool(), 'false'),
|
||||||
|
"Whether all javascript prompts should be ignored."),
|
||||||
|
|
||||||
|
('ignore-javascript-alert',
|
||||||
|
SettingValue(typ.Bool(), 'false'),
|
||||||
|
"Whether all javascript alerts should be ignored."),
|
||||||
|
|
||||||
('local-content-can-access-remote-urls',
|
('local-content-can-access-remote-urls',
|
||||||
SettingValue(typ.Bool(), 'false'),
|
SettingValue(typ.Bool(), 'false'),
|
||||||
"Whether locally loaded documents are allowed to access remote "
|
"Whether locally loaded documents are allowed to access remote "
|
||||||
|
Loading…
Reference in New Issue
Block a user