Merge branch 'paretje-jseval-2'

This commit is contained in:
Florian Bruhin 2016-10-30 18:53:03 +01:00
commit 7aa587d317
4 changed files with 9 additions and 2 deletions

View File

@ -139,6 +139,7 @@ Changed
- The `qute:settings` page now also shows option descriptions. - The `qute:settings` page now also shows option descriptions.
- `qute:version` and `qutebrowser --version` now show various important paths - `qute:version` and `qutebrowser --version` now show various important paths
- `:spawn`/userscripts now show a nicer error when a script wasn't found - `:spawn`/userscripts now show a nicer error when a script wasn't found
- Various functionality now works when javascript is disabled with QtWebKit
Deprecated Deprecated
~~~~~~~~~~ ~~~~~~~~~~

View File

@ -158,8 +158,8 @@ Contributors, sorted by the number of commits in descending order:
* Raphael Pierzina * Raphael Pierzina
* Joel Torstensson * Joel Torstensson
* Patric Schmitz * Patric Schmitz
* Tarcisio Fedrizzi
* Kevin Velghe * Kevin Velghe
* Tarcisio Fedrizzi
* Claude * Claude
* Corentin Julé * Corentin Julé
* meles5 * meles5

View File

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

View File

@ -71,3 +71,8 @@ Feature: Javascript stuff
And I run :tab-only 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'); } 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 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