Fix :fake-key with no focused webview.

This commit is contained in:
Florian Bruhin 2015-11-24 16:28:56 +01:00
parent 4c1eff625f
commit 922fdc0526
2 changed files with 12 additions and 1 deletions

View File

@ -1779,7 +1779,7 @@ class CommandDispatcher:
try:
receiver = objreg.get('webview', scope='tab',
tab='current')
except KeyError:
except objreg.RegistryUnavailableError:
raise cmdexc.CommandError("No focused webview!")
QApplication.postEvent(receiver, press_event)

View File

@ -130,6 +130,17 @@ Feature: Various utility commands.
Then the javascript message "key press: 88" should be logged
And the javascript message "key release: 88" should be logged
@not_xvfb
Scenario: :fake-key sending key to the website with other window focused
When I open data/misc/fakekey.html
And I set general -> developer-extras to true
And I run :inspector
And I wait for "Focus object changed: <PyQt5.QtWebKitWidgets.QWebView object at *>" in the log
And I run :fake-key x
And I run :inspector
And I wait for "Focus object changed: <qutebrowser.browser.webview.WebView *>" in the log
Then the error "No focused webview!" should be shown.
Scenario: :fake-key sending special key to the website
When I set general -> log-javascript-console to true
And I open data/misc/fakekey.html