Merge the cookies-accept and third-party-cookie-policy settings
This commit is contained in:
parent
472071c047
commit
fc4c7bd2e4
@ -149,9 +149,8 @@
|
|||||||
|<<content-ignore-javascript-alert,ignore-javascript-alert>>|Whether all javascript alerts 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>>|Control which cookies to accept.
|
||||||
|<<content-cookies-store,cookies-store>>|Whether to store cookies.
|
|<<content-cookies-store,cookies-store>>|Whether to store cookies.
|
||||||
|<<content-third-party-cookie-policy,third-party-cookie-policy>>|Accept cookies from domains other than the main website
|
|
||||||
|<<content-host-block-lists,host-block-lists>>|List of URLs of lists which contain hosts to block.
|
|<<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.
|
|<<content-host-blocking-enabled,host-blocking-enabled>>|Whether host blocking is enabled.
|
||||||
|==============
|
|==============
|
||||||
@ -1317,14 +1316,16 @@ Default: +pass:[true]+
|
|||||||
|
|
||||||
[[content-cookies-accept]]
|
[[content-cookies-accept]]
|
||||||
=== cookies-accept
|
=== cookies-accept
|
||||||
Whether to accept cookies.
|
Control which cookies to accept.
|
||||||
|
|
||||||
Valid values:
|
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.
|
* +never+: Don't accept cookies at all.
|
||||||
|
|
||||||
Default: +pass:[default]+
|
Default: +pass:[no-3rdparty]+
|
||||||
|
|
||||||
[[content-cookies-store]]
|
[[content-cookies-store]]
|
||||||
=== cookies-store
|
=== cookies-store
|
||||||
@ -1337,18 +1338,6 @@ Valid values:
|
|||||||
|
|
||||||
Default: +pass:[true]+
|
Default: +pass:[true]+
|
||||||
|
|
||||||
[[content-third-party-cookie-policy]]
|
|
||||||
=== third-party-cookie-policy
|
|
||||||
Accept cookies from domains other than the main website
|
|
||||||
|
|
||||||
Valid values:
|
|
||||||
|
|
||||||
* +always+: Always accept.
|
|
||||||
* +never+: Never accept.
|
|
||||||
* +existing+: Only accept if we already have acookie stored for the domain
|
|
||||||
|
|
||||||
Default: +pass:[never]+
|
|
||||||
|
|
||||||
[[content-host-block-lists]]
|
[[content-host-block-lists]]
|
||||||
=== host-block-lists
|
=== host-block-lists
|
||||||
List of URLs of lists which contain hosts to block.
|
List of URLs of lists which contain hosts to block.
|
||||||
|
@ -674,17 +674,13 @@ def data(readonly=False):
|
|||||||
"local urls."),
|
"local urls."),
|
||||||
|
|
||||||
('cookies-accept',
|
('cookies-accept',
|
||||||
SettingValue(typ.AcceptCookies(), 'default'),
|
SettingValue(typ.AcceptCookies(), 'no-3rdparty'),
|
||||||
"Whether to accept cookies."),
|
"Control which cookies to accept."),
|
||||||
|
|
||||||
('cookies-store',
|
('cookies-store',
|
||||||
SettingValue(typ.Bool(), 'true'),
|
SettingValue(typ.Bool(), 'true'),
|
||||||
"Whether to store cookies."),
|
"Whether to store cookies."),
|
||||||
|
|
||||||
('third-party-cookie-policy',
|
|
||||||
SettingValue(typ.ThirdPartyCookiePolicy(), 'never'),
|
|
||||||
"Accept cookies from domains other than the main website"),
|
|
||||||
|
|
||||||
('host-block-lists',
|
('host-block-lists',
|
||||||
SettingValue(
|
SettingValue(
|
||||||
typ.UrlList(none_ok=True),
|
typ.UrlList(none_ok=True),
|
||||||
|
@ -1323,22 +1323,17 @@ class LastClose(BaseType):
|
|||||||
|
|
||||||
class AcceptCookies(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."))
|
('never', "Don't accept cookies at all."))
|
||||||
|
|
||||||
|
|
||||||
class ThirdPartyCookiePolicy(BaseType):
|
|
||||||
|
|
||||||
"""Accept cookies from domains other than the main website."""
|
|
||||||
|
|
||||||
valid_values = ValidValues(('always', "Always accept."),
|
|
||||||
('never', "Never accept."),
|
|
||||||
('existing', "Only accept if we already have a"
|
|
||||||
"cookie stored for the domain."))
|
|
||||||
|
|
||||||
|
|
||||||
class ConfirmQuit(List):
|
class ConfirmQuit(List):
|
||||||
|
|
||||||
"""Whether to display a confirmation when the window is closed."""
|
"""Whether to display a confirmation when the window is closed."""
|
||||||
|
@ -238,23 +238,23 @@ class GlobalSetter(Setter):
|
|||||||
self._setter(*args)
|
self._setter(*args)
|
||||||
|
|
||||||
|
|
||||||
class ThirdPartyCookies(Base):
|
class CookiePolicy(Base):
|
||||||
|
|
||||||
"""The ThirdPartyCookiePolicy setting is different from other settings."""
|
"""The ThirdPartyCookiePolicy setting is different from other settings."""
|
||||||
|
|
||||||
mapping = (
|
MAPPING = {
|
||||||
('always', QWebSettings.AlwaysAllowThirdPartyCookies),
|
'all': QWebSettings.AlwaysAllowThirdPartyCookies,
|
||||||
('never', QWebSettings.AlwaysBlockThirdPartyCookies),
|
'no-3rdparty': QWebSettings.AlwaysBlockThirdPartyCookies,
|
||||||
('existing', QWebSettings.AllowThirdPartyWithExistingCookies),
|
'never': QWebSettings.AlwaysBlockThirdPartyCookies,
|
||||||
)
|
'no-unknown-3rdparty': QWebSettings.AllowThirdPartyWithExistingCookies,
|
||||||
|
}
|
||||||
|
|
||||||
def get(self, qws=None):
|
def get(self, qws=None):
|
||||||
policy = QWebSettings.globalSettings().thirdPartyCookiePolicy()
|
return config.get('content', 'cookies-accept')
|
||||||
return tuple(filter(lambda i: i[1] == policy, self.mapping))[0][0]
|
|
||||||
|
|
||||||
def _set(self, value, qws=None):
|
def _set(self, value, qws=None):
|
||||||
x = filter(lambda i: i[0] == value, self.mapping)
|
QWebSettings.globalSettings().setThirdPartyCookiePolicy(
|
||||||
QWebSettings.globalSettings().setThirdPartyCookiePolicy(tuple(x)[0][1])
|
self.MAPPING[value])
|
||||||
|
|
||||||
|
|
||||||
MAPPINGS = {
|
MAPPINGS = {
|
||||||
@ -283,8 +283,8 @@ MAPPINGS = {
|
|||||||
Attribute(QWebSettings.LocalContentCanAccessRemoteUrls),
|
Attribute(QWebSettings.LocalContentCanAccessRemoteUrls),
|
||||||
'local-content-can-access-file-urls':
|
'local-content-can-access-file-urls':
|
||||||
Attribute(QWebSettings.LocalContentCanAccessFileUrls),
|
Attribute(QWebSettings.LocalContentCanAccessFileUrls),
|
||||||
'third-party-cookie-policy':
|
'cookies-accept':
|
||||||
ThirdPartyCookies(),
|
CookiePolicy(),
|
||||||
},
|
},
|
||||||
'network': {
|
'network': {
|
||||||
'dns-prefetch':
|
'dns-prefetch':
|
||||||
|
Loading…
Reference in New Issue
Block a user