userscripts: Don't store a list of runners.
This commit is contained in:
parent
865389bb34
commit
106ad9f4ed
@ -17,11 +17,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
"""Functions to execute an userscript.
|
"""Functions to execute an userscript."""
|
||||||
|
|
||||||
Module attributes:
|
|
||||||
_runners: Active userscript runners from run_userscript.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
@ -36,10 +32,6 @@ from qutebrowser.utils import message, log, utils
|
|||||||
from qutebrowser.commands import runners, cmdexc
|
from qutebrowser.commands import runners, cmdexc
|
||||||
|
|
||||||
|
|
||||||
_runners = []
|
|
||||||
_commandrunners = []
|
|
||||||
|
|
||||||
|
|
||||||
class _BlockingFIFOReader(QObject):
|
class _BlockingFIFOReader(QObject):
|
||||||
|
|
||||||
"""A worker which reads commands from a FIFO endlessly.
|
"""A worker which reads commands from a FIFO endlessly.
|
||||||
@ -333,15 +325,14 @@ else:
|
|||||||
|
|
||||||
def run(cmd, *args, url, win_id):
|
def run(cmd, *args, url, win_id):
|
||||||
"""Convenience method to run an userscript."""
|
"""Convenience method to run an userscript."""
|
||||||
|
tabbed_browser = objreg.get('tabbed-browser', scope='window',
|
||||||
|
window=win_id)
|
||||||
# We don't remove the password in the URL here, as it's probably safe to
|
# We don't remove the password in the URL here, as it's probably safe to
|
||||||
# pass via env variable..
|
# pass via env variable..
|
||||||
urlstr = url.toString(QUrl.FullyEncoded)
|
urlstr = url.toString(QUrl.FullyEncoded)
|
||||||
commandrunner = runners.CommandRunner(win_id)
|
commandrunner = runners.CommandRunner(win_id, tabbed_browser)
|
||||||
runner = UserscriptRunner(win_id)
|
runner = UserscriptRunner(win_id, tabbed_browser)
|
||||||
runner.got_cmd.connect(commandrunner.run_safely)
|
runner.got_cmd.connect(commandrunner.run_safely)
|
||||||
runner.run(cmd, *args, env={'QUTE_URL': urlstr})
|
runner.run(cmd, *args, env={'QUTE_URL': urlstr})
|
||||||
_runners.append(runner)
|
runner.finished.connect(commandrunner.deleteLater)
|
||||||
_commandrunners.append(commandrunner)
|
runner.finished.connect(runner.deleteLater)
|
||||||
runner.finished.connect(functools.partial(_runners.remove, runner))
|
|
||||||
runner.finished.connect(
|
|
||||||
functools.partial(_commandrunners.remove, commandrunner))
|
|
||||||
|
Loading…
Reference in New Issue
Block a user