1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-13 17:43:59 +02:00

Make debug output more readable and assert on javascript failures

This commit is contained in:
Dominik Schmidt
2011-06-27 21:07:22 +02:00
parent 75ec478cae
commit d35fbd5048
2 changed files with 9 additions and 1 deletions

View File

@@ -116,12 +116,14 @@ QtScriptResolver::QtScriptResolver( const QString& scriptPath )
m_engine->mainFrame()->addToJavaScriptWindowObject( "Tomahawk", m_resolverHelper );
// add rest of it
m_engine->setScriptPath( "tomahawk.js" );
QFile jslib( RESPATH "js/tomahawk.js" );
jslib.open( QIODevice::ReadOnly );
m_engine->mainFrame()->evaluateJavaScript( jslib.readAll() );
jslib.close();
// execute resolver
m_engine->setScriptPath( scriptPath );
m_engine->mainFrame()->evaluateJavaScript( scriptFile.readAll() );
scriptFile.close();

View File

@@ -70,6 +70,11 @@ public:
settings()->setAttribute( QWebSettings::LocalStorageDatabaseEnabled, true );
}
void setScriptPath( const QString& scriptPath )
{
m_scriptPath = scriptPath;
}
public slots:
bool shouldInterruptJavaScript()
{
@@ -78,10 +83,11 @@ public slots:
protected:
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:
QtScriptResolver* m_parent;
QString m_scriptPath;
};