1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-18 23:09:42 +01:00

Pull basic JS functionality out of JSResolver into JSPlugin

This commit is contained in:
Dominik Schmidt 2014-11-29 16:46:56 +01:00 committed by Dominik Schmidt
parent 683f9229f6
commit fb26cc5dd4
14 changed files with 155 additions and 97 deletions

View File

@ -89,6 +89,7 @@ set( libGuiSources
resolvers/JSResolver.cpp
resolvers/JSResolverHelper.cpp
resolvers/ScriptEngine.cpp
resolvers/JSPlugin.cpp
utils/DpiScaler.cpp
utils/ImageRegistry.cpp

View File

@ -26,7 +26,7 @@
using namespace Tomahawk;
JSInfoPlugin::JSInfoPlugin( int id, JSResolver *resolver )
JSInfoPlugin::JSInfoPlugin( int id, JSPlugin *resolver )
: d_ptr( new JSInfoPluginPrivate( this, id, resolver ) )
{
Q_ASSERT( resolver );
@ -35,7 +35,7 @@ JSInfoPlugin::JSInfoPlugin( int id, JSResolver *resolver )
m_supportedGetTypes = parseSupportedTypes( callMethodOnInfoPluginWithResult( "supportedGetTypes" ) );
m_supportedPushTypes = parseSupportedTypes( callMethodOnInfoPluginWithResult( "supportedPushTypes" ) );
setFriendlyName( QString( "JSInfoPlugin: %1" ).arg( resolver->name() ) );
setFriendlyName( QString( "JSInfoPlugin: %1" ) ); // TODO: .arg( resolver->name() )
}
@ -70,8 +70,6 @@ JSInfoPlugin::getInfo( Tomahawk::InfoSystem::InfoRequestData requestData )
void
JSInfoPlugin::pushInfo( Tomahawk::InfoSystem::InfoPushData pushData )
{
Q_D( JSInfoPlugin );
QString eval = QString( "pushInfo({ type: %1, pushFlags: %2, input: %3, additionalInput: %4})" )
.arg( pushData.type )
.arg( pushData.pushFlags )
@ -239,7 +237,7 @@ JSInfoPlugin::serializeQVariantMap( const QVariantMap& map )
QByteArray serialized = TomahawkUtils::toJson( localMap );
return QString( "JSON.parse('%1')" ).arg( JSResolver::escape( QString::fromUtf8( serialized ) ) );
return QString( "JSON.parse('%1')" ).arg( JSPlugin::escape( QString::fromUtf8( serialized ) ) );
}

View File

@ -27,7 +27,7 @@
namespace Tomahawk
{
class JSResolver;
class JSPlugin;
class JSInfoPluginPrivate;
@ -39,7 +39,7 @@ public:
/**
* @param id unique identifier to identify an infoplugin in its scope
*/
JSInfoPlugin( int id, JSResolver* resolver );
JSInfoPlugin( int id, JSPlugin* resolver );
virtual ~JSInfoPlugin();

View File

@ -28,7 +28,7 @@ class JSInfoPluginPrivate
{
friend class JSInfoPlugin;
public:
JSInfoPluginPrivate( JSInfoPlugin* q, int id, JSResolver* resolver )
JSInfoPluginPrivate( JSInfoPlugin* q, int id, JSPlugin* resolver )
: q_ptr ( q )
, id( id )
, resolver( resolver )
@ -39,7 +39,8 @@ public:
private:
int id;
JSResolver* resolver;
// HACK: JSInfoPlugin needs to be refactored to track a ScriptObject
JSPlugin* resolver;
QMap< int, Tomahawk::InfoSystem::InfoRequestData > requestDataCache;
QMap< int, Tomahawk::InfoSystem::InfoStringHash > criteriaCache;

View File

@ -23,7 +23,7 @@
using namespace Tomahawk;
JSInfoSystemHelper::JSInfoSystemHelper( JSResolver* parent )
JSInfoSystemHelper::JSInfoSystemHelper( JSPlugin* parent )
: QObject( parent )
, d_ptr( new JSInfoSystemHelperPrivate( this, parent ) )
{
@ -48,7 +48,7 @@ JSInfoSystemHelper::nativeAddInfoPlugin( int id )
Q_D( JSInfoSystemHelper );
// create infoplugin instance
JSInfoPlugin* jsInfoPlugin = new JSInfoPlugin( id, d->resolver );
JSInfoPlugin* jsInfoPlugin = new JSInfoPlugin( id, d->scriptPlugin );
Tomahawk::InfoSystem::InfoPluginPtr infoPlugin( jsInfoPlugin );
// move it to infosystem thread

View File

@ -24,7 +24,7 @@
namespace Tomahawk
{
class JSResolver;
class JSPlugin;
class JSInfoSystemHelperPrivate;
class JSInfoSystemHelper : public QObject
@ -32,7 +32,7 @@ class JSInfoSystemHelper : public QObject
Q_OBJECT
public:
JSInfoSystemHelper( JSResolver* parent );
JSInfoSystemHelper( JSPlugin* parent );
~JSInfoSystemHelper();
QStringList requiredScriptPaths() const;

View File

@ -29,9 +29,9 @@ class JSInfoSystemHelperPrivate
{
friend class JSInfoSystemHelper;
public:
JSInfoSystemHelperPrivate( JSInfoSystemHelper* q, JSResolver* resolver )
JSInfoSystemHelperPrivate( JSInfoSystemHelper* q, JSPlugin* scriptPlugin )
: q_ptr ( q )
, resolver ( resolver )
, scriptPlugin ( scriptPlugin )
{
}
@ -39,7 +39,7 @@ public:
Q_DECLARE_PUBLIC ( JSInfoSystemHelper )
private:
JSResolver* resolver;
JSPlugin* scriptPlugin;
QMap<int,JSInfoPlugin*> infoPlugins;
};

View File

@ -0,0 +1,29 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2014, Dominik Schmidt <domme@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#include "JSResolver.h"
#include <QWebFrame>
using namespace Tomahawk;
void
JSPlugin::addToJavaScriptWindowObject( const QString& name, QObject* object )
{
m_engine->mainFrame()->addToJavaScriptWindowObject( name, object );
};

View File

@ -63,7 +63,7 @@ JSResolver::JSResolver( const QString& accountId, const QString& scriptPath, con
Q_D( JSResolver );
tLog() << Q_FUNC_INFO << "Loading JS resolver:" << scriptPath;
d->engine = new ScriptEngine( this );
d->scriptPlugin = new JSPlugin();
d->name = QFileInfo( filePath() ).baseName();
// set the icon, if we launch properly we'll get the icon the resolver reports
@ -87,7 +87,7 @@ JSResolver::~JSResolver()
if ( !d->stopped )
stop();
delete d->engine;
delete d->scriptPlugin;
}
@ -205,20 +205,17 @@ JSResolver::init()
}
const QByteArray scriptContents = scriptFile.readAll();
d->engine->mainFrame()->setHtml( "<html><body></body></html>", QUrl( "file:///invalid/file/for/security/policy" ) );
// tomahawk.js
{
// add c++ part of tomahawk javascript library
d->engine->mainFrame()->addToJavaScriptWindowObject( "Tomahawk", d->resolverHelper );
d->scriptPlugin->addToJavaScriptWindowObject( "Tomahawk", d->resolverHelper );
// load es6-promises shim
loadScript( RESPATH "js/es6-promise-2.0.0.min.js" );
d->scriptPlugin->loadScript( RESPATH "js/es6-promise-2.0.0.min.js" );
// Load CrytoJS core
loadScript( RESPATH "js/cryptojs-core.js" );
d->scriptPlugin->loadScript( RESPATH "js/cryptojs-core.js" );
// Load CryptoJS modules
QStringList jsfiles;
@ -226,29 +223,30 @@ JSResolver::init()
QDir cryptojs( RESPATH "js/cryptojs" );
foreach ( QString jsfile, cryptojs.entryList( jsfiles ) )
{
loadScript( RESPATH "js/cryptojs/" + jsfile );
d->scriptPlugin->loadScript( RESPATH "js/cryptojs/" + jsfile );
}
// Load tomahawk.js
loadScript( RESPATH "js/tomahawk.js" );
d->scriptPlugin->loadScript( RESPATH "js/tomahawk.js" );
}
// tomahawk-infosystem.js
{
// add c++ part of tomahawk infosystem bindings as Tomahawk.InfoSystem
d->engine->mainFrame()->addToJavaScriptWindowObject( "_TomahawkInfoSystem", d->infoSystemHelper );
d->engine->mainFrame()->evaluateJavaScript( "Tomahawk.InfoSystem = _TomahawkInfoSystem;" );
d->infoSystemHelper = new JSInfoSystemHelper( d->scriptPlugin );
d->scriptPlugin->addToJavaScriptWindowObject( "_TomahawkInfoSystem", d->infoSystemHelper );
d->scriptPlugin->evaluateJavaScript( "Tomahawk.InfoSystem = _TomahawkInfoSystem;" );
// add deps
loadScripts( d->infoSystemHelper->requiredScriptPaths() );
d->scriptPlugin->loadScripts( d->infoSystemHelper->requiredScriptPaths() );
}
// add resolver dependencies, if any
loadScripts( d->requiredScriptPaths );
d->scriptPlugin->loadScripts( d->requiredScriptPaths );
// add resolver
loadScript( filePath() );
d->scriptPlugin->loadScript( filePath() );
// init resolver
resolverInit();
@ -327,7 +325,7 @@ JSResolver::artists( const Tomahawk::collection_ptr& collection )
}
QString eval = QString( "artists( '%1' )" )
.arg( escape( collection->name() ) );
.arg( JSPlugin::escape( collection->name() ) );
QVariantMap m = callOnResolver( eval ).toMap();
if ( m.isEmpty() )
@ -363,8 +361,8 @@ JSResolver::albums( const Tomahawk::collection_ptr& collection, const Tomahawk::
}
QString eval = QString( "albums( '%1', '%2' )" )
.arg( escape( collection->name() ) )
.arg( escape( artist->name() ) );
.arg( JSPlugin::escape( collection->name() ) )
.arg( JSPlugin::escape( artist->name() ) );
QVariantMap m = callOnResolver( eval ).toMap();
if ( m.isEmpty() )
@ -400,9 +398,9 @@ JSResolver::tracks( const Tomahawk::collection_ptr& collection, const Tomahawk::
}
QString eval = QString( "tracks( '%1', '%2', '%3' )" )
.arg( escape( collection->name() ) )
.arg( escape( album->artist()->name() ) )
.arg( escape( album->name() ) );
.arg( JSPlugin::escape( collection->name() ) )
.arg( JSPlugin::escape( album->artist()->name() ) )
.arg( JSPlugin::escape( album->name() ) );
QVariantMap m = callOnResolver( eval ).toMap();
if ( m.isEmpty() )
@ -433,7 +431,7 @@ JSResolver::canParseUrl( const QString& url, UrlType type )
if ( d->capabilities.testFlag( UrlLookup ) )
{
QString eval = QString( "canParseUrl( '%1', %2 )" )
.arg( escape( QString( url ) ) )
.arg( JSPlugin::escape( QString( url ) ) )
.arg( (int) type );
return callOnResolver( eval ).toBool();
}
@ -464,7 +462,7 @@ JSResolver::lookupUrl( const QString& url )
}
QString eval = QString( "lookupUrl( '%1' )" )
.arg( escape( QString( url ) ) );
.arg( JSPlugin::escape( QString( url ) ) );
QVariantMap m = callOnResolver( eval ).toMap();
if ( m.isEmpty() )
@ -480,16 +478,14 @@ JSResolver::lookupUrl( const QString& url )
QVariant
JSResolver::evaluateJavaScriptInternal(const QString& scriptSource)
JSPlugin::evaluateJavaScriptInternal( const QString& scriptSource )
{
Q_D( JSResolver );
return d->engine->mainFrame()->evaluateJavaScript( scriptSource );
return m_engine->mainFrame()->evaluateJavaScript( scriptSource );
}
void
JSResolver::evaluateJavaScript( const QString& scriptSource )
JSPlugin::evaluateJavaScript( const QString& scriptSource )
{
if ( QThread::currentThread() != thread() )
{
@ -502,7 +498,7 @@ JSResolver::evaluateJavaScript( const QString& scriptSource )
QVariant
JSResolver::evaluateJavaScriptWithResult( const QString& scriptSource )
JSPlugin::evaluateJavaScriptWithResult( const QString& scriptSource )
{
Q_ASSERT( QThread::currentThread() == thread() );
@ -532,16 +528,16 @@ JSResolver::resolve( const Tomahawk::query_ptr& query )
if ( !query->isFullTextQuery() )
{
eval = QString( "resolve( '%1', '%2', '%3', '%4' )" )
.arg( escape( query->id() ) )
.arg( escape( query->queryTrack()->artist() ) )
.arg( escape( query->queryTrack()->album() ) )
.arg( escape( query->queryTrack()->track() ) );
.arg( JSPlugin::escape( query->id() ) )
.arg( JSPlugin::escape( query->queryTrack()->artist() ) )
.arg( JSPlugin::escape( query->queryTrack()->album() ) )
.arg( JSPlugin::escape( query->queryTrack()->track() ) );
}
else
{
eval = QString( "search( '%1', '%2' )" )
.arg( escape( query->id() ) )
.arg( escape( query->fullTextQuery() ) );
.arg( JSPlugin::escape( query->id() ) )
.arg( JSPlugin::escape( query->fullTextQuery() ) );
}
QVariantMap m = callOnResolver( eval ).toMap();
@ -964,10 +960,8 @@ JSResolver::resolverCollections()
void
JSResolver::loadScript( const QString& path )
JSPlugin::loadScript( const QString& path )
{
Q_D( JSResolver );
QFile file( path );
if ( !file.open( QIODevice::ReadOnly ) )
@ -979,15 +973,15 @@ JSResolver::loadScript( const QString& path )
const QByteArray contents = file.readAll();
d->engine->setScriptPath( path );
d->engine->mainFrame()->evaluateJavaScript( contents );
m_engine->setScriptPath( path );
m_engine->mainFrame()->evaluateJavaScript( contents );
file.close();
}
void
JSResolver::loadScripts( const QStringList& paths )
JSPlugin::loadScripts( const QStringList& paths )
{
foreach ( const QString& path, paths )
{
@ -1003,7 +997,9 @@ JSResolver::callOnResolver( const QString& scriptSource )
QString propertyName = scriptSource.split('(').first();
return d->engine->mainFrame()->evaluateJavaScript( QString(
tLog() << "JAVASCRIPT: run: " << scriptSource;
return d->scriptPlugin->evaluateJavaScriptWithResult( QString(
"if(Tomahawk.resolver.instance['_adapter_%1']) {"
" Tomahawk.resolver.instance._adapter_%2;"
"} else {"
@ -1014,7 +1010,7 @@ JSResolver::callOnResolver( const QString& scriptSource )
QString
JSResolver::escape( const QString& source )
JSPlugin::JSPlugin::escape( const QString& source )
{
QString copy = source;
return copy.replace( "\\", "\\\\" ).replace( "'", "\\'" );

View File

@ -27,6 +27,10 @@
#include "ExternalResolverGui.h"
#include "Typedefs.h"
#include <memory> // unique_ptr
#include "ScriptEngine.h" // hack, also should be renamed to JSEngine
namespace Tomahawk
{
@ -34,6 +38,54 @@ class JSInfoPlugin;
class JSResolverHelper;
class JSResolverPrivate;
class ScriptEngine;
class ScriptJob;
class ScriptObject;
class ScriptPlugin;
class DLLEXPORT ScriptPlugin
{
public:
virtual ~ScriptPlugin() {}
};
class DLLEXPORT JSPlugin : public QObject, public ScriptPlugin
{
Q_OBJECT
public:
JSPlugin()
: m_engine( new ScriptEngine( this ) )
{
}
/**
* Evaluate JavaScript on the WebKit thread
*/
Q_INVOKABLE void evaluateJavaScript( const QString& scriptSource );
/**
* This method must be called from the WebKit thread
*/
QVariant evaluateJavaScriptWithResult( const QString& scriptSource );
/**
* Escape \ and ' in strings so they are safe to use in JavaScript
*/
static QString escape( const QString& source );
void loadScript( const QString& path );
void loadScripts( const QStringList& paths );
void addToJavaScriptWindowObject( const QString& name, QObject* object );
private:
/**
* Wrap the pure evaluateJavaScript call in here, while the threadings guards are in public methods
*/
QVariant evaluateJavaScriptInternal( const QString& scriptSource );
std::unique_ptr<ScriptEngine> m_engine;
};
class DLLEXPORT JSResolver : public Tomahawk::ExternalResolverGui
{
@ -64,20 +116,6 @@ public:
bool canParseUrl( const QString& url, UrlType type ) override;
/**
* Evaluate JavaScript on the WebKit thread
*/
Q_INVOKABLE void evaluateJavaScript( const QString& scriptSource );
/**
* This method must be called from the WebKit thread
*/
QVariant evaluateJavaScriptWithResult( const QString& scriptSource );
/**
* Escape \ and ' in strings so they are safe to use in JavaScript
*/
static QString escape( const QString& source );
public slots:
void resolve( const Tomahawk::query_ptr& query ) override;
@ -110,13 +148,6 @@ private:
void fillDataInWidgets( const QVariantMap& data );
void onCapabilitiesChanged( Capabilities capabilities );
void loadCollections();
void loadScript( const QString& path );
void loadScripts( const QStringList& paths );
/**
* Wrap the pure evaluateJavaScript call in here, while the threadings guards are in public methods
*/
QVariant evaluateJavaScriptInternal( const QString& scriptSource );
// encapsulate javascript calls
QVariantMap resolverSettings();

View File

@ -484,14 +484,14 @@ JSResolverHelper::customIODeviceFactory( const Tomahawk::result_ptr&, const QStr
.arg( url );
m_streamCallbacks.insert( qid, callback );
m_resolver->d_func()->engine->mainFrame()->evaluateJavaScript( getUrl );
m_resolver->d_func()->scriptPlugin->evaluateJavaScript( getUrl );
}
else
{
QString getUrl = QString( "Tomahawk.resolver.instance.%1( '%2' );" ).arg( m_urlCallback )
.arg( url );
QString urlStr = m_resolver->d_func()->engine->mainFrame()->evaluateJavaScript( getUrl ).toString();
QString urlStr = m_resolver->d_func()->scriptPlugin->evaluateJavaScriptWithResult( getUrl ).toString();
returnStreamUrl( urlStr, QMap<QString, QString>(), callback );
}
@ -528,7 +528,7 @@ JSResolverHelper::nativeRetrieveMetadata( int metadataId, const QString& url,
{
QString javascript = QString( "Tomahawk.retrievedMetadata( %1, null, 'Supplied size is not (yet) supported');" )
.arg( metadataId );
m_resolver->d_func()->engine->mainFrame()->evaluateJavaScript( javascript );
m_resolver->d_func()->scriptPlugin->evaluateJavaScript( javascript );
return;
}
@ -595,7 +595,7 @@ JSResolverHelper::nativeRetrieveMetadata( int metadataId, const QString& url,
{
QString javascript = QString( "Tomahawk.retrievedMetadata( %1, null, 'Unknown mime type for tagging: %2');" )
.arg( metadataId ).arg( mime_type );
m_resolver->d_func()->engine->mainFrame()->evaluateJavaScript( javascript );
m_resolver->d_func()->scriptPlugin->evaluateJavaScript( javascript );
return;
}
@ -610,7 +610,7 @@ JSResolverHelper::nativeRetrieveMetadata( int metadataId, const QString& url,
{
QString javascript = QString( "Tomahawk.retrievedMetadata( %1, null, 'Could not read tag information.');" )
.arg( metadataId );
m_resolver->d_func()->engine->mainFrame()->evaluateJavaScript( javascript );
m_resolver->d_func()->scriptPlugin->evaluateJavaScript( javascript );
return;
}
@ -624,7 +624,7 @@ JSResolverHelper::nativeRetrieveMetadata( int metadataId, const QString& url,
{
QString javascript = QString( "Tomahawk.retrievedMetadata( %1, null, 'Empty track returnd');" )
.arg( metadataId );
m_resolver->d_func()->engine->mainFrame()->evaluateJavaScript( javascript );
m_resolver->d_func()->scriptPlugin->evaluateJavaScript( javascript );
return;
}
@ -632,7 +632,7 @@ JSResolverHelper::nativeRetrieveMetadata( int metadataId, const QString& url,
{
QString javascript = QString( "Tomahawk.retrievedMetadata( %1, null, 'Empty artist returnd');" )
.arg( metadataId );
m_resolver->d_func()->engine->mainFrame()->evaluateJavaScript( javascript );
m_resolver->d_func()->scriptPlugin->evaluateJavaScript( javascript );
return;
}
@ -647,13 +647,13 @@ JSResolverHelper::nativeRetrieveMetadata( int metadataId, const QString& url,
QString javascript = QString( "Tomahawk.retrievedMetadata( %1, %2 );" )
.arg( metadataId )
.arg( QString::fromLatin1( TomahawkUtils::toJson( m ) ) );
m_resolver->d_func()->engine->mainFrame()->evaluateJavaScript( javascript );
m_resolver->d_func()->scriptPlugin->evaluateJavaScript( javascript );
}
else
{
QString javascript = QString( "Tomahawk.retrievedMetadata( %1, null, 'Protocol not supported');" )
.arg( metadataId );
m_resolver->d_func()->engine->mainFrame()->evaluateJavaScript( javascript );
m_resolver->d_func()->scriptPlugin->evaluateJavaScript( javascript );
}
}
@ -717,7 +717,7 @@ JSResolverHelper::nativeAsyncRequestDone( int requestId, NetworkReply* reply )
QString javascript = QString( "Tomahawk.nativeAsyncRequestDone( %1, %2 );" )
.arg( QString::number( requestId ) )
.arg( json );
m_resolver->d_func()->engine->mainFrame()->evaluateJavaScript( javascript );
m_resolver->d_func()->scriptPlugin->evaluateJavaScript( javascript );
}

View File

@ -43,7 +43,7 @@ public:
, error( Tomahawk::ExternalResolver::NoError )
, resolverHelper( new JSResolverHelper( scriptPath, q ) )
// TODO: be smarter about this, only instantiate this if the resolver supports infoplugins
, infoSystemHelper( new JSInfoSystemHelper( q ) )
, infoSystemHelper( nullptr )
, requiredScriptPaths( additionalScriptPaths )
{
}
@ -51,8 +51,6 @@ public:
Q_DECLARE_PUBLIC ( JSResolver )
private:
ScriptEngine* engine;
QString accountId;
QString name;
QPixmap icon;
@ -69,6 +67,8 @@ private:
QPointer< AccountConfigWidget > configWidget;
QList< QVariant > dataWidgets;
QStringList requiredScriptPaths;
JSPlugin* scriptPlugin;
};
} // ns: Tomahawk

View File

@ -35,7 +35,7 @@
using namespace Tomahawk;
ScriptEngine::ScriptEngine( JSResolver* parent )
ScriptEngine::ScriptEngine( JSPlugin* parent )
: QWebPage( (QObject*) parent )
, m_parent( parent )
{
@ -54,6 +54,8 @@ ScriptEngine::ScriptEngine( JSResolver* parent )
, "" );
tLog( LOGVERBOSE ) << "JSResolver Using header" << m_header;
mainFrame()->setHtml( "<html><body></body></html>", QUrl( "file:///invalid/file/for/security/policy" ) );
connect( networkAccessManager(), SIGNAL( sslErrors( QNetworkReply*, QList<QSslError> ) ),
SLOT( sslErrorHandler( QNetworkReply*, QList<QSslError> ) ) );
}

View File

@ -32,14 +32,14 @@ class QNetworkReply;
namespace Tomahawk
{
class JSResolver;
class JSPlugin;
class DLLEXPORT ScriptEngine : public QWebPage
{
Q_OBJECT
public:
explicit ScriptEngine( JSResolver* parent );
explicit ScriptEngine( JSPlugin* parent );
QString userAgentForUrl( const QUrl& url ) const;
void setScriptPath( const QString& scriptPath );
@ -54,7 +54,7 @@ private slots:
void sslErrorHandler( QNetworkReply* qnr, const QList<QSslError>& errlist );
private:
JSResolver* m_parent;
JSPlugin* m_parent;
QString m_scriptPath;
QString m_header;
};