prompter: Override locked mode for questions.

This fixes a crash ([1], "ValueError: Mode KeyMode.yesno not on mode stack!")
when a website asks a second javascript question (prompt/alert/confirm) while
another one is still running.

[1] http://paste.the-compiler.org/view/8c39f5ea
This commit is contained in:
Florian Bruhin 2014-09-30 07:11:54 +02:00
parent 8864c042c8
commit 52ea924cbe

View File

@ -287,7 +287,7 @@ class Prompter:
question.aborted.connect(lambda: modeman.maybe_leave(mode, 'aborted'))
mode_manager = objreg.get('mode-manager')
try:
modeman.enter(mode, 'question asked')
modeman.enter(mode, 'question asked', override=True)
except modeman.ModeLockedError:
if mode_manager.mode() != usertypes.KeyMode.prompt:
question.abort()