parent
deb3c31f2f
commit
9a5839650c
@ -325,7 +325,8 @@ class BrowserPage(QWebPage):
|
||||
QWebPage.Notifications: ('content', 'notifications'),
|
||||
QWebPage.Geolocation: ('content', 'geolocation'),
|
||||
}
|
||||
if config.get(*options[feature]) == 'ask':
|
||||
config_val = config.get(*options[feature])
|
||||
if config_val == 'ask':
|
||||
bridge = objreg.get('message-bridge', scope='window',
|
||||
window=self._win_id)
|
||||
q = usertypes.Question(bridge)
|
||||
@ -361,6 +362,9 @@ class BrowserPage(QWebPage):
|
||||
self.loadStarted.connect(q.abort)
|
||||
|
||||
bridge.ask(q, blocking=False)
|
||||
elif config_val:
|
||||
self.setFeaturePermission(frame, feature,
|
||||
QWebPage.PermissionGrantedByUser)
|
||||
else:
|
||||
self.setFeaturePermission(frame, feature,
|
||||
QWebPage.PermissionDeniedByUser)
|
||||
|
@ -606,11 +606,11 @@ def data(readonly=False):
|
||||
"are not affected by this setting."),
|
||||
|
||||
('geolocation',
|
||||
SettingValue(typ.NoAsk(), 'ask'),
|
||||
SettingValue(typ.BoolAsk(), 'ask'),
|
||||
"Allow websites to request geolocations."),
|
||||
|
||||
('notifications',
|
||||
SettingValue(typ.NoAsk(), 'ask'),
|
||||
SettingValue(typ.BoolAsk(), 'ask'),
|
||||
"Allow websites to show notifications."),
|
||||
|
||||
#('allow-java',
|
||||
|
@ -266,34 +266,6 @@ class BoolAsk(Bool):
|
||||
super().validate(value)
|
||||
|
||||
|
||||
class NoAsk(BaseType):
|
||||
|
||||
"""A no/ask question."""
|
||||
|
||||
valid_values = ValidValues('false', 'ask')
|
||||
|
||||
def transform(self, value):
|
||||
if value.lower() == 'ask':
|
||||
return 'ask'
|
||||
else:
|
||||
return BOOLEAN_STATES[value.lower()]
|
||||
|
||||
def validate(self, value):
|
||||
if not value:
|
||||
if self._none_ok:
|
||||
return
|
||||
else:
|
||||
raise configexc.ValidationError(value, "may not be empty!")
|
||||
if value.lower() == 'ask':
|
||||
return
|
||||
try:
|
||||
v = BOOLEAN_STATES[value.lower()]
|
||||
if v:
|
||||
raise configexc.ValidationError(value, "must be ask/false!")
|
||||
except KeyError:
|
||||
raise configexc.ValidationError(value, "must be ask/false!")
|
||||
|
||||
|
||||
class Int(BaseType):
|
||||
|
||||
"""Base class for an integer setting.
|
||||
|
Loading…
Reference in New Issue
Block a user