Merge branch '3rd-party-cookies' of https://github.com/Carpetsmoker/qutebrowser into Carpetsmoker-3rd-party-cookies
This commit is contained in:
commit
3b4fe97dbc
@ -149,7 +149,7 @@
|
||||
|<<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-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>>|Control which cookies to accept.
|
||||
|<<content-cookies-store,cookies-store>>|Whether to store cookies.
|
||||
|<<content-host-block-lists,host-block-lists>>|List of URLs of lists which contain hosts to block.
|
||||
|<<content-host-blocking-enabled,host-blocking-enabled>>|Whether host blocking is enabled.
|
||||
@ -1316,14 +1316,16 @@ Default: +pass:[true]+
|
||||
|
||||
[[content-cookies-accept]]
|
||||
=== cookies-accept
|
||||
Whether to accept cookies.
|
||||
Control which cookies to accept.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +default+: Default QtWebKit behavior.
|
||||
* +all+: Accept all cookies.
|
||||
* +no-3rdparty+: Accept cookies from the same origin only.
|
||||
* +no-unknown-3rdparty+: Accept cookies from the same origin only, unless a cookie is already set for the domain.
|
||||
* +never+: Don't accept cookies at all.
|
||||
|
||||
Default: +pass:[default]+
|
||||
Default: +pass:[no-3rdparty]+
|
||||
|
||||
[[content-cookies-store]]
|
||||
=== cookies-store
|
||||
|
@ -675,8 +675,8 @@ def data(readonly=False):
|
||||
"local urls."),
|
||||
|
||||
('cookies-accept',
|
||||
SettingValue(typ.AcceptCookies(), 'default'),
|
||||
"Whether to accept cookies."),
|
||||
SettingValue(typ.AcceptCookies(), 'no-3rdparty'),
|
||||
"Control which cookies to accept."),
|
||||
|
||||
('cookies-store',
|
||||
SettingValue(typ.Bool(), 'true'),
|
||||
|
@ -1337,9 +1337,14 @@ class LastClose(BaseType):
|
||||
|
||||
class AcceptCookies(BaseType):
|
||||
|
||||
"""Whether to accept a cookie."""
|
||||
"""Control which cookies to accept."""
|
||||
|
||||
valid_values = ValidValues(('default', "Default QtWebKit behavior."),
|
||||
valid_values = ValidValues(('all', "Accept all cookies."),
|
||||
('no-3rdparty', "Accept cookies from the same"
|
||||
" origin only."),
|
||||
('no-unknown-3rdparty', "Accept cookies from "
|
||||
"the same origin only, unless a cookie is "
|
||||
"already set for the domain."),
|
||||
('never', "Don't accept cookies at all."))
|
||||
|
||||
|
||||
|
@ -238,6 +238,25 @@ class GlobalSetter(Setter):
|
||||
self._setter(*args)
|
||||
|
||||
|
||||
class CookiePolicy(Base):
|
||||
|
||||
"""The ThirdPartyCookiePolicy setting is different from other settings."""
|
||||
|
||||
MAPPING = {
|
||||
'all': QWebSettings.AlwaysAllowThirdPartyCookies,
|
||||
'no-3rdparty': QWebSettings.AlwaysBlockThirdPartyCookies,
|
||||
'never': QWebSettings.AlwaysBlockThirdPartyCookies,
|
||||
'no-unknown-3rdparty': QWebSettings.AllowThirdPartyWithExistingCookies,
|
||||
}
|
||||
|
||||
def get(self, qws=None):
|
||||
return config.get('content', 'cookies-accept')
|
||||
|
||||
def _set(self, value, qws=None):
|
||||
QWebSettings.globalSettings().setThirdPartyCookiePolicy(
|
||||
self.MAPPING[value])
|
||||
|
||||
|
||||
MAPPINGS = {
|
||||
'content': {
|
||||
'allow-images':
|
||||
@ -264,6 +283,8 @@ MAPPINGS = {
|
||||
Attribute(QWebSettings.LocalContentCanAccessRemoteUrls),
|
||||
'local-content-can-access-file-urls':
|
||||
Attribute(QWebSettings.LocalContentCanAccessFileUrls),
|
||||
'cookies-accept':
|
||||
CookiePolicy(),
|
||||
},
|
||||
'network': {
|
||||
'dns-prefetch':
|
||||
|
Loading…
Reference in New Issue
Block a user