Make sure scripts are removed correctly

This commit is contained in:
Florian Bruhin 2017-12-06 19:56:44 +01:00
parent a37ecc353c
commit 6aafe02320
2 changed files with 7 additions and 5 deletions

View File

@ -262,9 +262,10 @@ def inject_userscripts():
scripts = profile.scripts()
for script in scripts.toList():
if script.name().startswith("GM-"):
log.greasemonkey.debug('removing script: {}'
log.greasemonkey.debug('Removing script: {}'
.format(script.name()))
scripts.remove(script)
removed = scripts.remove(script)
assert removed, script.name()
# Then add the new scripts.
for script in greasemonkey.all_scripts():

View File

@ -319,9 +319,10 @@ class WebEnginePage(QWebEnginePage):
scripts = self.scripts()
for script in scripts.toList():
if script.name().startswith("GM-"):
really_removed = scripts.remove(script)
log.greasemonkey.debug("Removing ({}) script: {}"
.format(really_removed, script.name()))
log.greasemonkey.debug("Removing script: {}"
.format(script.name()))
removed = scripts.remove(script)
assert removed, script.name()
def _add_script(script, injection_point):
new_script = QWebEngineScript()