Don't change the URL of the main execution context on exit.

We shouldn't change the URL of the main execution context.
Because this will change security policy of our main frame which leads to the following message: `Unsafe JavaScript attempt to access frame with URL about:blank from frame with URL file://bla.js. Domains, protocols and ports must match.`

We can fix it by isolating main frame of PhantomJS execution context. We can destroy it separately.

https://github.com/ariya/phantomjs/issues/12697
1.9
Vitaly Slobodin 2014-11-06 20:19:24 +03:00 committed by Ariya Hidayat
parent 41f9463d5a
commit 016ae98b2b
1 changed files with 1 additions and 1 deletions

View File

@ -100,7 +100,6 @@ void Phantom::init()
CookieJar::instance(m_config.cookiesFile());
m_page = new WebPage(this, QUrl::fromLocalFile(m_config.scriptFile()));
m_pages.append(m_page);
QString proxyType = m_config.proxyType();
if (proxyType != "none") {
@ -478,6 +477,7 @@ void Phantom::doExit(int code)
page->deleteLater();
}
m_pages.clear();
delete m_page;
m_page = 0;
QApplication::instance()->exit(code);
}