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:
@@ -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();
|
||||
|
||||
|
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user