Merge branch 'paretje-insert-text-js'

This commit is contained in:
Florian Bruhin 2016-10-30 19:52:00 +01:00
commit f9c35329df
6 changed files with 14 additions and 15 deletions

View File

@ -156,9 +156,9 @@ Contributors, sorted by the number of commits in descending order:
* Felix Van der Jeugt
* Martin Tournoij
* Raphael Pierzina
* Kevin Velghe
* Joel Torstensson
* Patric Schmitz
* Kevin Velghe
* Tarcisio Fedrizzi
* Claude
* Corentin Julé

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