Merge branch 'jseval-2' of https://github.com/paretje/qutebrowser into paretje-jseval-2

This commit is contained in:
Florian Bruhin 2016-10-30 18:48:14 +01:00
commit 620b952bb2
2 changed files with 7 additions and 1 deletions

View File

@ -624,7 +624,8 @@ class WebKitTab(browsertab.AbstractTab):
def run_js_async(self, code, callback=None, *, world=None):
if world is not None and world != usertypes.JsWorld.jseval:
log.webview.warning("Ignoring world ID {}".format(world))
result = self._widget.page().mainFrame().evaluateJavaScript(code)
result = self._widget.page().mainFrame().documentElement() \
.evaluateJavaScript(code)
if callback is not None:
callback(result)

View File

@ -71,3 +71,8 @@ Feature: Javascript stuff
And I run :tab-only
And I run :jseval if (window.open('about:blank')) { console.log('window opened'); } else { console.log('error while opening window'); }
Then the javascript message "error while opening window" should be logged
Scenario: Executing jseval when javascript is disabled
When I set content -> allow-javascript to false
And I run :jseval console.log('jseval executed')
Then the javascript message "jseval executed" should be logged