QtWebEngine: Restore Qt 5.6 compatibility
This commit is contained in:
parent
029ea2e5a7
commit
94cf3fa4ff
@ -149,7 +149,7 @@
|
||||
|<<content-allow-images,allow-images>>|Whether images are automatically loaded in web pages.
|
||||
|<<content-allow-javascript,allow-javascript>>|Enables or disables the running of JavaScript programs.
|
||||
|<<content-allow-plugins,allow-plugins>>|Enables or disables plugins in Web pages.
|
||||
|<<content-webgl,webgl>>|Enables or disables WebGL.
|
||||
|<<content-webgl,webgl>>|Enables or disables WebGL. For QtWebEngine, Qt/PyQt >= 5.7 is required for this setting.
|
||||
|<<content-css-regions,css-regions>>|Enable or disable support for CSS regions.
|
||||
|<<content-hyperlink-auditing,hyperlink-auditing>>|Enable or disable hyperlink auditing (<a ping>).
|
||||
|<<content-geolocation,geolocation>>|Allow websites to request geolocations.
|
||||
@ -1377,7 +1377,7 @@ Default: +pass:[false]+
|
||||
|
||||
[[content-webgl]]
|
||||
=== webgl
|
||||
Enables or disables WebGL.
|
||||
Enables or disables WebGL. For QtWebEngine, Qt/PyQt >= 5.7 is required for this setting.
|
||||
|
||||
Valid values:
|
||||
|
||||
|
@ -110,8 +110,6 @@ MAPPINGS = {
|
||||
Attribute(QWebEngineSettings.JavascriptCanAccessClipboard),
|
||||
'allow-plugins':
|
||||
Attribute(QWebEngineSettings.PluginsEnabled),
|
||||
'webgl':
|
||||
Attribute(QWebEngineSettings.WebGLEnabled),
|
||||
'hyperlink-auditing':
|
||||
Attribute(QWebEngineSettings.HyperlinkAuditingEnabled),
|
||||
'local-content-can-access-remote-urls':
|
||||
@ -183,3 +181,9 @@ MAPPINGS = {
|
||||
setter=QWebEngineSettings.setDefaultTextEncoding),
|
||||
}
|
||||
}
|
||||
|
||||
try:
|
||||
MAPPINGS['content']['webgl'] = Attribute(QWebEngineSettings.WebGLEnabled)
|
||||
except AttributeError:
|
||||
# Added in Qt 5.7
|
||||
pass
|
||||
|
@ -348,10 +348,17 @@ class WebEngineTab(browsertab.AbstractTab):
|
||||
|
||||
def run_js_async(self, code, callback=None):
|
||||
world = QWebEngineScript.ApplicationWorld
|
||||
if callback is None:
|
||||
self._widget.page().runJavaScript(code, world)
|
||||
else:
|
||||
self._widget.page().runJavaScript(code, world, callback)
|
||||
try:
|
||||
if callback is None:
|
||||
self._widget.page().runJavaScript(code, world)
|
||||
else:
|
||||
self._widget.page().runJavaScript(code, world, callback)
|
||||
except TypeError:
|
||||
# Qt < 5.7
|
||||
if callback is None:
|
||||
self._widget.page().runJavaScript(code)
|
||||
else:
|
||||
self._widget.page().runJavaScript(code, callback)
|
||||
|
||||
def run_js_blocking(self, code):
|
||||
unset = object()
|
||||
|
@ -775,7 +775,8 @@ def data(readonly=False):
|
||||
|
||||
('webgl',
|
||||
SettingValue(typ.Bool(), 'false'),
|
||||
"Enables or disables WebGL."),
|
||||
"Enables or disables WebGL. For QtWebEngine, Qt/PyQt >= 5.7 is "
|
||||
"required for this setting."),
|
||||
|
||||
('css-regions',
|
||||
SettingValue(typ.Bool(), 'true',
|
||||
|
Loading…
Reference in New Issue
Block a user