Support URL patterns for permissions and ssl_strict

See #3636
This commit is contained in:
Florian Bruhin 2018-06-24 21:38:37 +02:00
parent f5e69b2174
commit f2f481d991
4 changed files with 30 additions and 2 deletions

View File

@ -40,11 +40,14 @@ Added
* Support for requesting persistent storage via * Support for requesting persistent storage via
`navigator.webkitPersistentStorage.requestQuota` with a new `navigator.webkitPersistentStorage.requestQuota` with a new
`content.persistent_storage` setting (requires Qt 5.11). `content.persistent_storage` setting (requires Qt 5.11).
This setting also supports URL patterns.
* Support for registering custom protocol handlers via * Support for registering custom protocol handlers via
`navigator.registerProtocolHandler` with a new `navigator.registerProtocolHandler` with a new
`content.register_protocol_handler` setting (requires Qt 5.11). `content.register_protocol_handler` setting (requires Qt 5.11).
This setting also supports URL patterns.
* Support for WebRTC screen sharing with a new `content.desktop_capture` * Support for WebRTC screen sharing with a new `content.desktop_capture`
setting (requires Qt 5.10). setting (requires Qt 5.10).
This setting also supports URL patterns.
* New `content.autoplay` setting to enable/disable automatic video playback * New `content.autoplay` setting to enable/disable automatic video playback
(requires Qt 5.10). (requires Qt 5.10).
* New `content.webrtc_public_interfaces_only` setting to only expose public * New `content.webrtc_public_interfaces_only` setting to only expose public
@ -60,6 +63,10 @@ Changed
- content.headers.custom - content.headers.custom
- content.headers.accept_language - content.headers.accept_language
- content.headers.user_agent - content.headers.user_agent
- content.ssl_strict
- content.geolocation
- content.notifications
- content.media_capture
- The Windows/macOS releases now bundle Qt 5.11.1 which is based on - The Windows/macOS releases now bundle Qt 5.11.1 which is based on
Chromium 65.0.3325.151 with security fixes up to Chromium 67.0.3396.87. Chromium 65.0.3325.151 with security fixes up to Chromium 67.0.3396.87.
- New short flags for commandline arguments: `-B` and `-T` for `--basedir` and - New short flags for commandline arguments: `-B` and `-T` for `--basedir` and

View File

@ -1570,6 +1570,8 @@ Default: +pass:[iso-8859-1]+
Allow websites to share screen content. Allow websites to share screen content.
On Qt < 5.10, a dialog box is always displayed, even if this is set to "true". On Qt < 5.10, a dialog box is always displayed, even if this is set to "true".
This setting supports URL patterns.
Type: <<types,BoolAsk>> Type: <<types,BoolAsk>>
Valid values: Valid values:
@ -1609,6 +1611,8 @@ This setting is only available with the QtWebKit backend.
=== content.geolocation === content.geolocation
Allow websites to request geolocations. Allow websites to request geolocations.
This setting supports URL patterns.
Type: <<types,BoolAsk>> Type: <<types,BoolAsk>>
Valid values: Valid values:
@ -1853,6 +1857,8 @@ Default: +pass:[true]+
=== content.media_capture === content.media_capture
Allow websites to record audio/video. Allow websites to record audio/video.
This setting supports URL patterns.
Type: <<types,BoolAsk>> Type: <<types,BoolAsk>>
Valid values: Valid values:
@ -1878,6 +1884,8 @@ Default: empty
=== content.notifications === content.notifications
Allow websites to show notifications. Allow websites to show notifications.
This setting supports URL patterns.
Type: <<types,BoolAsk>> Type: <<types,BoolAsk>>
Valid values: Valid values:
@ -1905,6 +1913,8 @@ This setting is only available with the QtWebKit backend.
=== content.persistent_storage === content.persistent_storage
Allow websites to request persistent storage quota via `navigator.webkitPersistentStorage.requestQuota`. Allow websites to request persistent storage quota via `navigator.webkitPersistentStorage.requestQuota`.
This setting supports URL patterns.
Type: <<types,BoolAsk>> Type: <<types,BoolAsk>>
Valid values: Valid values:
@ -1977,6 +1987,8 @@ This setting is only available with the QtWebKit backend.
=== content.register_protocol_handler === content.register_protocol_handler
Allow websites to register protocol handlers via `navigator.registerProtocolHandler`. Allow websites to register protocol handlers via `navigator.registerProtocolHandler`.
This setting supports URL patterns.
Type: <<types,BoolAsk>> Type: <<types,BoolAsk>>
Valid values: Valid values:
@ -1995,6 +2007,8 @@ On QtWebKit, this setting is unavailable.
=== content.ssl_strict === content.ssl_strict
Validate SSL handshakes. Validate SSL handshakes.
This setting supports URL patterns.
Type: <<types,BoolAsk>> Type: <<types,BoolAsk>>
Valid values: Valid values:

View File

@ -156,7 +156,7 @@ def ignore_certificate_errors(url, errors, abort_on):
Return: Return:
True if the error should be ignored, False otherwise. True if the error should be ignored, False otherwise.
""" """
ssl_strict = config.val.content.ssl_strict ssl_strict = config.instance.get('content.ssl_strict', url=url)
log.webview.debug("Certificate errors {!r}, strict {}".format( log.webview.debug("Certificate errors {!r}, strict {}".format(
errors, ssl_strict)) errors, ssl_strict))
@ -213,7 +213,7 @@ def feature_permission(url, option, msg, yes_action, no_action, abort_on,
The Question object if a question was asked (and blocking=False), The Question object if a question was asked (and blocking=False),
None otherwise. None otherwise.
""" """
config_val = config.instance.get(option) config_val = config.instance.get(option, url=url)
if config_val == 'ask': if config_val == 'ask':
if url.isValid(): if url.isValid():
urlstr = url.toString(QUrl.RemovePassword | QUrl.FullyEncoded) urlstr = url.toString(QUrl.RemovePassword | QUrl.FullyEncoded)

View File

@ -321,6 +321,7 @@ content.windowed_fullscreen:
content.desktop_capture: content.desktop_capture:
type: BoolAsk type: BoolAsk
default: ask default: ask
supports_pattern: true
desc: >- desc: >-
Allow websites to share screen content. Allow websites to share screen content.
@ -350,6 +351,7 @@ content.frame_flattening:
content.geolocation: content.geolocation:
default: ask default: ask
type: BoolAsk type: BoolAsk
supports_pattern: true
desc: Allow websites to request geolocations. desc: Allow websites to request geolocations.
content.headers.accept_language: content.headers.accept_language:
@ -604,6 +606,7 @@ content.local_storage:
content.media_capture: content.media_capture:
default: ask default: ask
type: BoolAsk type: BoolAsk
supports_pattern: true
backend: QtWebEngine backend: QtWebEngine
desc: Allow websites to record audio/video. desc: Allow websites to record audio/video.
@ -620,6 +623,7 @@ content.netrc_file:
content.notifications: content.notifications:
default: ask default: ask
type: BoolAsk type: BoolAsk
supports_pattern: true
backend: QtWebKit backend: QtWebKit
desc: Allow websites to show notifications. desc: Allow websites to show notifications.
@ -636,6 +640,7 @@ content.pdfjs:
content.persistent_storage: content.persistent_storage:
default: ask default: ask
type: BoolAsk type: BoolAsk
supports_pattern: true
backend: backend:
QtWebKit: false QtWebKit: false
QtWebEngine: Qt 5.11 QtWebEngine: Qt 5.11
@ -682,6 +687,7 @@ content.proxy_dns_requests:
content.register_protocol_handler: content.register_protocol_handler:
default: ask default: ask
type: BoolAsk type: BoolAsk
supports_pattern: true
backend: backend:
QtWebKit: false QtWebKit: false
QtWebEngine: Qt 5.11 QtWebEngine: Qt 5.11
@ -691,6 +697,7 @@ content.register_protocol_handler:
content.ssl_strict: content.ssl_strict:
default: ask default: ask
type: BoolAsk type: BoolAsk
supports_pattern: true
desc: Validate SSL handshakes. desc: Validate SSL handshakes.
content.user_stylesheets: content.user_stylesheets: