Merge branch 'insert-text-js' of https://github.com/paretje/qutebrowser into paretje-insert-text-js

This commit is contained in:
Florian Bruhin 2016-10-30 19:51:25 +01:00
commit 428637746a
5 changed files with 13 additions and 14 deletions

View File

@ -761,10 +761,6 @@ class AbstractTab(QWidget):
"""
raise NotImplementedError
def has_js(self):
"""Check if qutebrowser can run javascript in this tab."""
raise NotImplementedError
def shutdown(self):
raise NotImplementedError

View File

@ -1539,8 +1539,6 @@ class CommandDispatcher:
text: The text to insert.
"""
tab = self._current_widget()
if not tab.has_js():
raise cmdexc.CommandError("This command needs javascript enabled.")
def _insert_text_cb(elem):
if elem is None:

View File

@ -528,10 +528,6 @@ class WebEngineTab(browsertab.AbstractTab):
else:
self._widget.page().runJavaScript(code, callback)
def has_js(self):
# QtWebEngine can run JS even if the page can't
return True
def shutdown(self):
log.stub()

View File

@ -629,10 +629,6 @@ class WebKitTab(browsertab.AbstractTab):
if callback is not None:
callback(result)
def has_js(self):
settings = QWebSettings.globalSettings()
return settings.testAttribute(QWebSettings.JavascriptEnabled)
def icon(self):
return self._widget.icon()

View File

@ -256,6 +256,19 @@ Feature: Yanking and pasting.
# Compare
Then the javascript message "textarea contents: Hello world" should be logged
Scenario: Inserting text into an empty text field with javascript disabled
When I set general -> log-javascript-console to info
And I set content -> allow-javascript to false
And I open data/paste_primary.html
And I run :click-element id qute-textarea
And I wait for "Clicked editable element!" in the log
And I run :insert-text Hello world
And I press the keys "<Ctrl+a>"
And I run :yank selection
And I set content -> allow-javascript to true
# Compare
Then the clipboard should contain "Hello world"
Scenario: Inserting text into a text field at specific position
When I set general -> log-javascript-console to info
And I open data/paste_primary.html