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
Baffo32 2012-02-13 12:47:09 -05:00 committed by Ariya Hidayat
parent 9d1c2e90ac
commit 5a53b7ad55
3 changed files with 4 additions and 4 deletions

View File

@ -76,7 +76,7 @@ Phantom::Phantom(QObject *parent)
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);
if (m_config.scriptFile().isEmpty()) {

View File

@ -103,13 +103,13 @@ private:
friend class WebPage;
};
WebPage::WebPage(QObject *parent, const Config *config)
WebPage::WebPage(QObject *parent, const Config *config, const QUrl &baseUrl)
: QObject(parent)
{
setObjectName("WebPage");
m_webPage = new CustomPage(this);
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_webPage, SIGNAL(loadStarted()), SIGNAL(loadStarted()), Qt::QueuedConnection);

View File

@ -53,7 +53,7 @@ class WebPage: public QObject
Q_PROPERTY(QVariantMap scrollPosition READ scrollPosition WRITE setScrollPosition)
public:
WebPage(QObject *parent, const Config *config);
WebPage(QObject *parent, const Config *config, const QUrl &baseUrl = QUrl());
QWebFrame *mainFrame();