Update comment.
This commit is contained in:
parent
54ca9b34e5
commit
521268a1f7
@ -874,18 +874,18 @@ class _WebEngineScripts(QObject):
|
|||||||
self._inject_early_js('stylesheet', js_code, subframes=True)
|
self._inject_early_js('stylesheet', js_code, subframes=True)
|
||||||
|
|
||||||
def _inject_userscripts(self):
|
def _inject_userscripts(self):
|
||||||
"""Register user JavaScript files with the global profiles."""
|
"""Register user JavaScript files with the current tab."""
|
||||||
# The Greasemonkey metadata block support in QtWebEngine only starts at
|
# The Greasemonkey metadata block support in QtWebEngine only starts at
|
||||||
# Qt 5.8. With 5.7.1, we need to inject the scripts ourselves in
|
# Qt 5.8. With 5.7.1, we need to inject the scripts ourselves in
|
||||||
# response to urlChanged.
|
# response to urlChanged.
|
||||||
if not qtutils.version_check('5.8'):
|
if not qtutils.version_check('5.8'):
|
||||||
return
|
return
|
||||||
|
|
||||||
# Since we are inserting scripts into profile.scripts they won't
|
# Since we are inserting scripts into a per-tab collection,
|
||||||
# just get replaced by new gm scripts like if we were injecting them
|
# rather than just injecting scripts on page load, we need to
|
||||||
# ourselves so we need to remove all gm scripts, while not removing
|
# make sure we replace existing scripts, not just add new ones.
|
||||||
# any other stuff that might have been added. Like the one for
|
# While, taking care not to remove any other scripts that might
|
||||||
# stylesheets.
|
# have been added elsewhere, like the one for stylesheets.
|
||||||
greasemonkey = objreg.get('greasemonkey')
|
greasemonkey = objreg.get('greasemonkey')
|
||||||
scripts = self._widget.page().scripts()
|
scripts = self._widget.page().scripts()
|
||||||
for script in scripts.toList():
|
for script in scripts.toList():
|
||||||
|
Loading…
Reference in New Issue
Block a user