mirror of https://github.com/vitalif/phantomjs
Fix possible bug where if CoffeeScript starts with a shebang (hashbang) #!, then // gets put in front of it; but this is not a comment in CoffeeScript, so it causes a problem with the conversion.
parent
91ceec1e9b
commit
3c665681f4
|
@ -82,13 +82,13 @@ class Phantom(QObject):
|
|||
do_action('PhantomInitPost', Bunch(locals()))
|
||||
|
||||
def execute(self):
|
||||
if self.m_script.startswith('#!'):
|
||||
self.m_script = '//' + self.m_script
|
||||
|
||||
if self.m_scriptFile.lower().endswith('.coffee'):
|
||||
coffee = CSConverter(self)
|
||||
self.m_script = coffee.convert(self.m_script)
|
||||
|
||||
if self.m_script.startswith('#!'):
|
||||
self.m_script = '//' + self.m_script
|
||||
|
||||
self.m_page.mainFrame().evaluateJavaScript(self.m_script)
|
||||
return not self.m_terminated
|
||||
|
||||
|
|
|
@ -197,16 +197,16 @@ bool Phantom::execute()
|
|||
m_script = QString::fromUtf8(file.readAll());
|
||||
file.close();
|
||||
|
||||
if (m_script.startsWith("#!")) {
|
||||
m_script.prepend("//");
|
||||
}
|
||||
|
||||
if (m_scriptFile.endsWith(".coffee")) {
|
||||
if (!m_converter)
|
||||
m_converter = new CSConverter(this);
|
||||
m_script = m_converter->convert(m_script);
|
||||
}
|
||||
|
||||
if (m_script.startsWith("#!")) {
|
||||
m_script.prepend("//");
|
||||
}
|
||||
|
||||
m_page->mainFrame()->evaluateJavaScript(m_script);
|
||||
return !m_terminated;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue