Skip to content

Commit

Permalink
Fix js profiles when the js_source parameter is unset
Browse files Browse the repository at this point in the history
Before js profiles would not run if you didn't have a js_source
parameter.
  • Loading branch information
dvdbng committed Jan 18, 2016
1 parent d17b65c commit 9f5c45b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions splash/qtrender.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,19 +152,22 @@ def _loadFinishedOK(self):

def _runjs(self, js_source, js_profile):
js_output, js_console_output = None, None
if js_source:

if js_source or js_profile:
if self.console:
self.tab._jsconsole_enable()

if js_profile:
# XXX: shouldn't we keep injecting scripts after redirects?
self.tab.run_js_files(js_profile, handle_errors=False)

js_output = self.tab.evaljs(js_source, handle_errors=False)
if js_source:
js_output = self.tab.evaljs(js_source, handle_errors=False)

if self.console:
js_console_output = self.tab._jsconsole_messages()

self.tab.store_har_timing('_onCustomJsExecuted')
self.tab.store_har_timing('_onCustomJsExecuted')
return js_output, js_console_output

def _prepare_render(self):
Expand Down

0 comments on commit 9f5c45b

Please sign in to comment.