mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-15 10:33:59 +02:00
Make debug output more readable and assert on javascript failures
This commit is contained in:
@@ -116,12 +116,14 @@ QtScriptResolver::QtScriptResolver( const QString& scriptPath )
|
|||||||
m_engine->mainFrame()->addToJavaScriptWindowObject( "Tomahawk", m_resolverHelper );
|
m_engine->mainFrame()->addToJavaScriptWindowObject( "Tomahawk", m_resolverHelper );
|
||||||
|
|
||||||
// add rest of it
|
// add rest of it
|
||||||
|
m_engine->setScriptPath( "tomahawk.js" );
|
||||||
QFile jslib( RESPATH "js/tomahawk.js" );
|
QFile jslib( RESPATH "js/tomahawk.js" );
|
||||||
jslib.open( QIODevice::ReadOnly );
|
jslib.open( QIODevice::ReadOnly );
|
||||||
m_engine->mainFrame()->evaluateJavaScript( jslib.readAll() );
|
m_engine->mainFrame()->evaluateJavaScript( jslib.readAll() );
|
||||||
jslib.close();
|
jslib.close();
|
||||||
|
|
||||||
// execute resolver
|
// execute resolver
|
||||||
|
m_engine->setScriptPath( scriptPath );
|
||||||
m_engine->mainFrame()->evaluateJavaScript( scriptFile.readAll() );
|
m_engine->mainFrame()->evaluateJavaScript( scriptFile.readAll() );
|
||||||
scriptFile.close();
|
scriptFile.close();
|
||||||
|
|
||||||
|
@@ -70,6 +70,11 @@ public:
|
|||||||
settings()->setAttribute( QWebSettings::LocalStorageDatabaseEnabled, true );
|
settings()->setAttribute( QWebSettings::LocalStorageDatabaseEnabled, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setScriptPath( const QString& scriptPath )
|
||||||
|
{
|
||||||
|
m_scriptPath = scriptPath;
|
||||||
|
}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
bool shouldInterruptJavaScript()
|
bool shouldInterruptJavaScript()
|
||||||
{
|
{
|
||||||
@@ -78,10 +83,11 @@ public slots:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void javaScriptConsoleMessage( const QString & message, int lineNumber, const QString & sourceID )
|
virtual void javaScriptConsoleMessage( const QString & message, int lineNumber, const QString & sourceID )
|
||||||
{ qDebug() << "JAVASCRIPT:" << message << lineNumber << sourceID; }
|
{ qDebug() << "JAVASCRIPT:" << m_scriptPath << message << lineNumber << sourceID; Q_ASSERT(false);}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QtScriptResolver* m_parent;
|
QtScriptResolver* m_parent;
|
||||||
|
QString m_scriptPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user