mirror of https://github.com/vitalif/phantomjs
Provide an initial base URL for the root webpage so it is not sandboxed.
This resolves for me http://code.google.com/p/phantomjs/issues/detail?id=257.1.5
parent
9d1c2e90ac
commit
5a53b7ad55
|
@ -76,7 +76,7 @@ Phantom::Phantom(QObject *parent)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_page = new WebPage(this, &m_config);
|
m_page = new WebPage(this, &m_config, QUrl::fromLocalFile(m_config.scriptFile()));
|
||||||
m_pages.append(m_page);
|
m_pages.append(m_page);
|
||||||
|
|
||||||
if (m_config.scriptFile().isEmpty()) {
|
if (m_config.scriptFile().isEmpty()) {
|
||||||
|
|
|
@ -103,13 +103,13 @@ private:
|
||||||
friend class WebPage;
|
friend class WebPage;
|
||||||
};
|
};
|
||||||
|
|
||||||
WebPage::WebPage(QObject *parent, const Config *config)
|
WebPage::WebPage(QObject *parent, const Config *config, const QUrl &baseUrl)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
setObjectName("WebPage");
|
setObjectName("WebPage");
|
||||||
m_webPage = new CustomPage(this);
|
m_webPage = new CustomPage(this);
|
||||||
m_mainFrame = m_webPage->mainFrame();
|
m_mainFrame = m_webPage->mainFrame();
|
||||||
m_mainFrame->setHtml(BLANK_HTML);
|
m_mainFrame->setHtml(BLANK_HTML, baseUrl);
|
||||||
|
|
||||||
connect(m_mainFrame, SIGNAL(javaScriptWindowObjectCleared()), SIGNAL(initialized()));
|
connect(m_mainFrame, SIGNAL(javaScriptWindowObjectCleared()), SIGNAL(initialized()));
|
||||||
connect(m_webPage, SIGNAL(loadStarted()), SIGNAL(loadStarted()), Qt::QueuedConnection);
|
connect(m_webPage, SIGNAL(loadStarted()), SIGNAL(loadStarted()), Qt::QueuedConnection);
|
||||||
|
|
|
@ -53,7 +53,7 @@ class WebPage: public QObject
|
||||||
Q_PROPERTY(QVariantMap scrollPosition READ scrollPosition WRITE setScrollPosition)
|
Q_PROPERTY(QVariantMap scrollPosition READ scrollPosition WRITE setScrollPosition)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WebPage(QObject *parent, const Config *config);
|
WebPage(QObject *parent, const Config *config, const QUrl &baseUrl = QUrl());
|
||||||
|
|
||||||
QWebFrame *mainFrame();
|
QWebFrame *mainFrame();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue