mirror of https://github.com/vitalif/phantomjs
Stop potential crash by guarding the access to the page.
Based on the work from Shawn Krisman (krisman.shawn@gmail.com). http://code.google.com/p/phantomjs/issues/detail?id=7191.8
parent
63e06cbcbf
commit
8ba3c52d50
|
@ -315,6 +315,9 @@ QObject* Phantom::createCallback()
|
|||
|
||||
void Phantom::loadModule(const QString &moduleSource, const QString &filename)
|
||||
{
|
||||
if (m_terminated)
|
||||
return;
|
||||
|
||||
QString scriptSource =
|
||||
"(function(require, exports, module) {" +
|
||||
moduleSource +
|
||||
|
@ -328,6 +331,9 @@ void Phantom::loadModule(const QString &moduleSource, const QString &filename)
|
|||
|
||||
bool Phantom::injectJs(const QString &jsFilePath)
|
||||
{
|
||||
if (m_terminated)
|
||||
return false;
|
||||
|
||||
return Utils::injectJsInFrame(jsFilePath, libraryPath(), m_page->mainFrame());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue