capybara-webkit 0.14.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -0
- data/.travis.yml +21 -0
- data/Appraisals +4 -4
- data/CONTRIBUTING.md +14 -3
- data/Gemfile +1 -1
- data/Gemfile.lock +27 -19
- data/NEWS.md +15 -0
- data/README.md +126 -76
- data/Vagrantfile +7 -0
- data/capybara-webkit.gemspec +3 -0
- data/gemfiles/2.0.gemfile +7 -0
- data/gemfiles/2.0.gemfile.lock +72 -0
- data/gemfiles/2.1.gemfile +7 -0
- data/gemfiles/2.1.gemfile.lock +71 -0
- data/lib/capybara/webkit/browser.rb +22 -22
- data/lib/capybara/webkit/connection.rb +9 -6
- data/lib/capybara/webkit/driver.rb +22 -6
- data/lib/capybara/webkit/errors.rb +25 -0
- data/lib/capybara/webkit/node.rb +36 -10
- data/lib/capybara/webkit/version.rb +1 -1
- data/spec/browser_spec.rb +16 -1
- data/spec/capybara_webkit_builder_spec.rb +9 -3
- data/spec/connection_spec.rb +19 -3
- data/spec/driver_spec.rb +324 -144
- data/spec/errors_spec.rb +11 -0
- data/spec/integration/session_spec.rb +244 -0
- data/spec/selenium_compatibility_spec.rb +3 -1
- data/spec/spec_helper.rb +1 -9
- data/src/Authenticate.cpp +3 -2
- data/src/ClearCookies.cpp +1 -1
- data/src/ClearPromptText.cpp +1 -1
- data/src/Command.cpp +8 -4
- data/src/Command.h +7 -4
- data/src/CommandFactory.cpp +4 -2
- data/src/CommandParser.cpp +1 -1
- data/src/Connection.cpp +4 -4
- data/src/ConsoleMessages.cpp +1 -1
- data/src/CurrentUrl.cpp +2 -2
- data/src/EnableLogging.cpp +1 -1
- data/src/ErrorMessage.cpp +26 -0
- data/src/ErrorMessage.h +21 -0
- data/src/Evaluate.cpp +1 -1
- data/src/Execute.cpp +3 -2
- data/src/FindCss.cpp +13 -0
- data/src/FindCss.h +11 -0
- data/src/FindXpath.cpp +13 -0
- data/src/FindXpath.h +11 -0
- data/src/FrameFocus.cpp +4 -3
- data/src/GetCookies.cpp +1 -1
- data/src/GetTimeout.cpp +1 -1
- data/src/GetWindowHandle.cpp +1 -1
- data/src/GetWindowHandles.cpp +1 -1
- data/src/Header.cpp +2 -2
- data/src/Headers.cpp +1 -6
- data/src/IgnoreSslErrors.cpp +1 -1
- data/src/InvocationResult.cpp +29 -0
- data/src/InvocationResult.h +16 -0
- data/src/JavascriptAlertMessages.cpp +1 -1
- data/src/JavascriptCommand.cpp +15 -0
- data/src/JavascriptCommand.h +20 -0
- data/src/JavascriptConfirmMessages.cpp +1 -1
- data/src/JavascriptInvocation.cpp +128 -1
- data/src/JavascriptInvocation.h +22 -1
- data/src/JavascriptPromptMessages.cpp +1 -1
- data/src/NetworkAccessManager.cpp +8 -16
- data/src/NetworkAccessManager.h +5 -11
- data/src/NetworkReplyProxy.cpp +91 -0
- data/src/NetworkReplyProxy.h +65 -0
- data/src/Node.cpp +4 -4
- data/src/Node.h +2 -2
- data/src/NullCommand.cpp +2 -1
- data/src/PageLoadingCommand.cpp +2 -1
- data/src/Render.cpp +1 -1
- data/src/Reset.cpp +1 -1
- data/src/ResizeWindow.cpp +1 -1
- data/src/Response.cpp +7 -0
- data/src/Response.h +8 -3
- data/src/SetConfirmAction.cpp +1 -1
- data/src/SetCookie.cpp +2 -2
- data/src/SetPromptAction.cpp +1 -1
- data/src/SetPromptText.cpp +1 -1
- data/src/SetProxy.cpp +2 -2
- data/src/SetSkipImageLoading.cpp +1 -1
- data/src/SetTimeout.cpp +3 -2
- data/src/SetUrlBlacklist.cpp +2 -2
- data/src/Status.cpp +1 -1
- data/src/TimeoutCommand.cpp +4 -2
- data/src/Title.cpp +11 -0
- data/src/Title.h +9 -0
- data/src/Version.cpp +13 -0
- data/src/Version.h +10 -0
- data/src/Visit.cpp +1 -1
- data/src/WebPage.cpp +49 -27
- data/src/WebPage.h +14 -7
- data/src/WebPageManager.cpp +10 -1
- data/src/WebPageManager.h +4 -1
- data/src/WindowFocus.cpp +3 -2
- data/src/body.cpp +3 -6
- data/src/capybara.js +103 -101
- data/src/find_command.h +4 -2
- data/src/main.cpp +1 -1
- data/src/stable.h +39 -0
- data/src/webkit_server.pro +26 -6
- data/vagrant_setup.sh +58 -0
- metadata +51 -78
- data/gemfiles/1.0.gemfile +0 -7
- data/gemfiles/1.0.gemfile.lock +0 -70
- data/gemfiles/1.1.gemfile +0 -7
- data/gemfiles/1.1.gemfile.lock +0 -70
- data/src/Find.cpp +0 -20
- data/src/Find.h +0 -11
data/src/SetConfirmAction.cpp
CHANGED
data/src/SetCookie.cpp
CHANGED
@@ -8,8 +8,8 @@ SetCookie::SetCookie(WebPageManager *manager, QStringList &arguments, QObject *p
|
|
8
8
|
|
9
9
|
void SetCookie::start()
|
10
10
|
{
|
11
|
-
QList<QNetworkCookie> cookies = QNetworkCookie::parseCookies(arguments()[0].
|
11
|
+
QList<QNetworkCookie> cookies = QNetworkCookie::parseCookies(arguments()[0].toLatin1());
|
12
12
|
NetworkCookieJar *jar = manager()->cookieJar();
|
13
13
|
jar->overwriteCookies(cookies);
|
14
|
-
|
14
|
+
finish(true);
|
15
15
|
}
|
data/src/SetPromptAction.cpp
CHANGED
data/src/SetPromptText.cpp
CHANGED
data/src/SetProxy.cpp
CHANGED
data/src/SetSkipImageLoading.cpp
CHANGED
data/src/SetTimeout.cpp
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#include "SetTimeout.h"
|
2
2
|
#include "WebPageManager.h"
|
3
|
+
#include "ErrorMessage.h"
|
3
4
|
|
4
5
|
SetTimeout::SetTimeout(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
5
6
|
}
|
@@ -11,9 +12,9 @@ void SetTimeout::start() {
|
|
11
12
|
|
12
13
|
if (ok) {
|
13
14
|
manager()->setTimeout(timeout);
|
14
|
-
|
15
|
+
finish(true);
|
15
16
|
} else {
|
16
|
-
|
17
|
+
finish(false, new ErrorMessage("Invalid value for timeout"));
|
17
18
|
}
|
18
19
|
}
|
19
20
|
|
data/src/SetUrlBlacklist.cpp
CHANGED
@@ -8,8 +8,8 @@ SetUrlBlacklist::SetUrlBlacklist(WebPageManager *manager, QStringList &arguments
|
|
8
8
|
}
|
9
9
|
|
10
10
|
void SetUrlBlacklist::start() {
|
11
|
-
NetworkAccessManager* networkAccessManager =
|
11
|
+
NetworkAccessManager* networkAccessManager = manager()->networkAccessManager();
|
12
12
|
networkAccessManager->setUrlBlacklist(arguments());
|
13
|
-
|
13
|
+
finish(true);
|
14
14
|
}
|
15
15
|
|
data/src/Status.cpp
CHANGED
data/src/TimeoutCommand.cpp
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
#include "Command.h"
|
3
3
|
#include "WebPageManager.h"
|
4
4
|
#include "WebPage.h"
|
5
|
+
#include "ErrorMessage.h"
|
5
6
|
#include <QTimer>
|
6
7
|
#include <QApplication>
|
7
8
|
|
@@ -45,7 +46,7 @@ void TimeoutCommand::pendingLoadFinished(bool success) {
|
|
45
46
|
} else {
|
46
47
|
disconnect(m_timer, SIGNAL(timeout()), this, SLOT(commandTimeout()));
|
47
48
|
disconnect(m_manager, SIGNAL(loadStarted()), this, SLOT(pageLoadingFromCommand()));
|
48
|
-
|
49
|
+
finish(false, new ErrorMessage(m_manager->currentPage()->failureString()));
|
49
50
|
}
|
50
51
|
}
|
51
52
|
|
@@ -58,7 +59,8 @@ void TimeoutCommand::commandTimeout() {
|
|
58
59
|
disconnect(m_manager, SIGNAL(pageFinished(bool)), this, SLOT(pendingLoadFinished(bool)));
|
59
60
|
disconnect(m_command, SIGNAL(finished(Response *)), this, SLOT(commandFinished(Response *)));
|
60
61
|
m_manager->currentPage()->triggerAction(QWebPage::Stop);
|
61
|
-
|
62
|
+
QString message = QString("Request timed out after %1 second(s)").arg(m_manager->getTimeout());
|
63
|
+
finish(false, new ErrorMessage("TimeoutError", message));
|
62
64
|
}
|
63
65
|
|
64
66
|
void TimeoutCommand::commandFinished(Response *response) {
|
data/src/Title.cpp
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#include "Title.h"
|
2
|
+
#include "WebPage.h"
|
3
|
+
#include "WebPageManager.h"
|
4
|
+
#include "NetworkAccessManager.h"
|
5
|
+
|
6
|
+
Title::Title(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
7
|
+
}
|
8
|
+
|
9
|
+
void Title::start() {
|
10
|
+
finish(true, page()->currentFrame()->title());
|
11
|
+
}
|
data/src/Title.h
ADDED
data/src/Version.cpp
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#include "Version.h"
|
2
|
+
#include "WebPage.h"
|
3
|
+
|
4
|
+
Version::Version(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
5
|
+
}
|
6
|
+
|
7
|
+
void Version::start() {
|
8
|
+
QString result =
|
9
|
+
QString("Qt: ") + QT_VERSION_STR +
|
10
|
+
QString("\nWebKit: ") + qWebKitVersion() +
|
11
|
+
QString("\nQtWebKit: ") + QTWEBKIT_VERSION_STR;
|
12
|
+
finish(true, result);
|
13
|
+
}
|
data/src/Version.h
ADDED
data/src/Visit.cpp
CHANGED
@@ -9,5 +9,5 @@ Visit::Visit(WebPageManager *manager, QStringList &arguments, QObject *parent) :
|
|
9
9
|
void Visit::start() {
|
10
10
|
QUrl requestedUrl = QUrl::fromEncoded(arguments()[0].toUtf8(), QUrl::StrictMode);
|
11
11
|
page()->currentFrame()->load(QUrl(requestedUrl));
|
12
|
-
|
12
|
+
finish(true);
|
13
13
|
}
|
data/src/WebPage.cpp
CHANGED
@@ -4,6 +4,8 @@
|
|
4
4
|
#include "NetworkAccessManager.h"
|
5
5
|
#include "NetworkCookieJar.h"
|
6
6
|
#include "UnsupportedContentHandler.h"
|
7
|
+
#include "InvocationResult.h"
|
8
|
+
#include "NetworkReplyProxy.h"
|
7
9
|
#include <QResource>
|
8
10
|
#include <iostream>
|
9
11
|
#include <QWebSettings>
|
@@ -14,7 +16,6 @@ WebPage::WebPage(WebPageManager *manager, QObject *parent) : QWebPage(parent) {
|
|
14
16
|
m_failed = false;
|
15
17
|
m_manager = manager;
|
16
18
|
m_uuid = QUuid::createUuid().toString();
|
17
|
-
m_unsupportedContentLoaded = false;
|
18
19
|
|
19
20
|
setForwardUnsupportedContent(true);
|
20
21
|
loadJavascript();
|
@@ -41,18 +42,42 @@ void WebPage::resetWindowSize() {
|
|
41
42
|
this->settings()->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true);
|
42
43
|
}
|
43
44
|
|
45
|
+
void WebPage::resetLocalStorage() {
|
46
|
+
this->currentFrame()->evaluateJavaScript("localStorage.clear()");
|
47
|
+
}
|
48
|
+
|
44
49
|
void WebPage::setCustomNetworkAccessManager() {
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
connect(
|
49
|
-
this, SLOT(handleSslErrorsForReply(QNetworkReply *, QList<QSslError>)));
|
50
|
-
connect(manager, SIGNAL(requestCreated(QByteArray &, QNetworkReply *)),
|
50
|
+
setNetworkAccessManager(m_manager->networkAccessManager());
|
51
|
+
connect(networkAccessManager(), SIGNAL(sslErrors(QNetworkReply *, QList<QSslError>)),
|
52
|
+
SLOT(handleSslErrorsForReply(QNetworkReply *, QList<QSslError>)));
|
53
|
+
connect(networkAccessManager(), SIGNAL(requestCreated(QByteArray &, QNetworkReply *)),
|
51
54
|
SIGNAL(requestCreated(QByteArray &, QNetworkReply *)));
|
55
|
+
connect(networkAccessManager(), SIGNAL(finished(QUrl &, QNetworkReply *)),
|
56
|
+
SLOT(replyFinished(QUrl &, QNetworkReply *)));
|
57
|
+
}
|
58
|
+
|
59
|
+
void WebPage::replyFinished(QUrl &requestedUrl, QNetworkReply *reply) {
|
60
|
+
NetworkReplyProxy *proxy = qobject_cast<NetworkReplyProxy *>(reply);
|
61
|
+
setFrameProperties(mainFrame(), requestedUrl, proxy);
|
62
|
+
foreach(QWebFrame *frame, mainFrame()->childFrames())
|
63
|
+
setFrameProperties(frame, requestedUrl, proxy);
|
64
|
+
}
|
65
|
+
|
66
|
+
void WebPage::setFrameProperties(QWebFrame *frame, QUrl &requestedUrl, NetworkReplyProxy *reply) {
|
67
|
+
if (frame->requestedUrl() == requestedUrl) {
|
68
|
+
int statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
69
|
+
frame->setProperty("statusCode", statusCode);
|
70
|
+
QStringList headers;
|
71
|
+
foreach(QNetworkReply::RawHeaderPair header, reply->rawHeaderPairs())
|
72
|
+
headers << header.first+": "+header.second;
|
73
|
+
frame->setProperty("headers", headers);
|
74
|
+
frame->setProperty("body", reply->data());
|
75
|
+
QVariant contentMimeType = reply->header(QNetworkRequest::ContentTypeHeader);
|
76
|
+
frame->setProperty("contentType", contentMimeType);
|
77
|
+
}
|
52
78
|
}
|
53
79
|
|
54
80
|
void WebPage::unsupportedContentFinishedReply(QNetworkReply *reply) {
|
55
|
-
m_unsupportedContentLoaded = true;
|
56
81
|
m_manager->replyFinished(reply);
|
57
82
|
}
|
58
83
|
|
@@ -117,17 +142,14 @@ bool WebPage::shouldInterruptJavaScript() {
|
|
117
142
|
return false;
|
118
143
|
}
|
119
144
|
|
120
|
-
|
145
|
+
InvocationResult WebPage::invokeCapybaraFunction(const char *name, const QStringList &arguments) {
|
121
146
|
QString qname(name);
|
122
|
-
|
123
|
-
|
124
|
-
currentFrame()->addToJavaScriptWindowObject(objectName, &invocation);
|
125
|
-
QString javascript = QString("Capybara.invoke()");
|
126
|
-
return currentFrame()->evaluateJavaScript(javascript);
|
147
|
+
JavascriptInvocation invocation(qname, arguments, this);
|
148
|
+
return invocation.invoke(currentFrame());
|
127
149
|
}
|
128
150
|
|
129
|
-
|
130
|
-
return invokeCapybaraFunction(name.
|
151
|
+
InvocationResult WebPage::invokeCapybaraFunction(QString &name, const QStringList &arguments) {
|
152
|
+
return invokeCapybaraFunction(name.toLatin1().data(), arguments);
|
131
153
|
}
|
132
154
|
|
133
155
|
void WebPage::javaScriptConsoleMessage(const QString &message, int lineNumber, const QString &sourceID) {
|
@@ -171,7 +193,6 @@ bool WebPage::javaScriptPrompt(QWebFrame *frame, const QString &message, const Q
|
|
171
193
|
void WebPage::loadStarted() {
|
172
194
|
m_loading = true;
|
173
195
|
m_errorPageMessage = QString();
|
174
|
-
m_unsupportedContentLoaded = false;
|
175
196
|
}
|
176
197
|
|
177
198
|
void WebPage::loadFinished(bool success) {
|
@@ -247,8 +268,9 @@ QStringList WebPage::getAttachedFileNames() {
|
|
247
268
|
}
|
248
269
|
|
249
270
|
void WebPage::handleSslErrorsForReply(QNetworkReply *reply, const QList<QSslError> &errors) {
|
271
|
+
Q_UNUSED(errors);
|
250
272
|
if (m_manager->ignoreSslErrors())
|
251
|
-
reply->ignoreSslErrors(
|
273
|
+
reply->ignoreSslErrors();
|
252
274
|
}
|
253
275
|
|
254
276
|
void WebPage::setSkipImageLoading(bool skip) {
|
@@ -256,15 +278,19 @@ void WebPage::setSkipImageLoading(bool skip) {
|
|
256
278
|
}
|
257
279
|
|
258
280
|
int WebPage::getLastStatus() {
|
259
|
-
return
|
281
|
+
return currentFrame()->property("statusCode").toInt();
|
260
282
|
}
|
261
283
|
|
262
|
-
|
263
|
-
return
|
284
|
+
QStringList WebPage::pageHeaders() {
|
285
|
+
return currentFrame()->property("headers").toStringList();
|
264
286
|
}
|
265
287
|
|
266
|
-
|
267
|
-
return
|
288
|
+
QByteArray WebPage::body() {
|
289
|
+
return currentFrame()->property("body").toByteArray();
|
290
|
+
}
|
291
|
+
|
292
|
+
QString WebPage::contentType() {
|
293
|
+
return currentFrame()->property("contentType").toString();
|
268
294
|
}
|
269
295
|
|
270
296
|
void WebPage::handleUnsupportedContent(QNetworkReply *reply) {
|
@@ -279,10 +305,6 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) {
|
|
279
305
|
}
|
280
306
|
}
|
281
307
|
|
282
|
-
bool WebPage::unsupportedContentLoaded() {
|
283
|
-
return m_unsupportedContentLoaded;
|
284
|
-
}
|
285
|
-
|
286
308
|
bool WebPage::supportsExtension(Extension extension) const {
|
287
309
|
if (extension == ErrorPageExtension)
|
288
310
|
return true;
|
data/src/WebPage.h
CHANGED
@@ -1,18 +1,23 @@
|
|
1
1
|
#ifndef _WEBPAGE_H
|
2
2
|
#define _WEBPAGE_H
|
3
|
+
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
4
|
+
#include <QtWebKitWidgets>
|
5
|
+
#else
|
3
6
|
#include <QtWebKit>
|
7
|
+
#endif
|
4
8
|
#include <QtNetwork>
|
5
9
|
|
6
10
|
class WebPageManager;
|
7
|
-
class
|
11
|
+
class InvocationResult;
|
12
|
+
class NetworkReplyProxy;
|
8
13
|
|
9
14
|
class WebPage : public QWebPage {
|
10
15
|
Q_OBJECT
|
11
16
|
|
12
17
|
public:
|
13
18
|
WebPage(WebPageManager *, QObject *parent = 0);
|
14
|
-
|
15
|
-
|
19
|
+
InvocationResult invokeCapybaraFunction(const char *name, const QStringList &arguments);
|
20
|
+
InvocationResult invokeCapybaraFunction(QString &name, const QStringList &arguments);
|
16
21
|
QString failureString();
|
17
22
|
QString userAgentForUrl(const QUrl &url ) const;
|
18
23
|
void setUserAgent(QString userAgent);
|
@@ -29,14 +34,16 @@ class WebPage : public QWebPage {
|
|
29
34
|
QVariantList confirmMessages();
|
30
35
|
QVariantList promptMessages();
|
31
36
|
void resetWindowSize();
|
37
|
+
void resetLocalStorage();
|
32
38
|
QWebPage *createWindow(WebWindowType type);
|
33
39
|
QString uuid();
|
34
40
|
QString getWindowName();
|
35
41
|
bool matchesWindowSelector(QString);
|
36
42
|
void setFocus();
|
37
|
-
NetworkAccessManager *networkAccessManager();
|
38
|
-
bool unsupportedContentLoaded();
|
39
43
|
void unsupportedContentFinishedReply(QNetworkReply *reply);
|
44
|
+
QStringList pageHeaders();
|
45
|
+
QByteArray body();
|
46
|
+
QString contentType();
|
40
47
|
|
41
48
|
public slots:
|
42
49
|
bool shouldInterruptJavaScript();
|
@@ -44,10 +51,10 @@ class WebPage : public QWebPage {
|
|
44
51
|
void loadStarted();
|
45
52
|
void loadFinished(bool);
|
46
53
|
bool isLoading() const;
|
47
|
-
const QList<QNetworkReply::RawHeaderPair> &pageHeaders();
|
48
54
|
void frameCreated(QWebFrame *);
|
49
55
|
void handleSslErrorsForReply(QNetworkReply *reply, const QList<QSslError> &);
|
50
56
|
void handleUnsupportedContent(QNetworkReply *reply);
|
57
|
+
void replyFinished(QUrl &, QNetworkReply *);
|
51
58
|
|
52
59
|
signals:
|
53
60
|
void pageFinished(bool);
|
@@ -80,7 +87,7 @@ class WebPage : public QWebPage {
|
|
80
87
|
QString m_uuid;
|
81
88
|
WebPageManager *m_manager;
|
82
89
|
QString m_errorPageMessage;
|
83
|
-
|
90
|
+
void setFrameProperties(QWebFrame *, QUrl &, NetworkReplyProxy *);
|
84
91
|
};
|
85
92
|
|
86
93
|
#endif //_WEBPAGE_H
|
data/src/WebPageManager.cpp
CHANGED
@@ -1,17 +1,24 @@
|
|
1
1
|
#include "WebPageManager.h"
|
2
2
|
#include "WebPage.h"
|
3
3
|
#include "NetworkCookieJar.h"
|
4
|
+
#include "NetworkAccessManager.h"
|
4
5
|
|
5
6
|
WebPageManager::WebPageManager(QObject *parent) : QObject(parent) {
|
6
7
|
m_ignoreSslErrors = false;
|
7
8
|
m_cookieJar = new NetworkCookieJar(this);
|
8
9
|
m_success = true;
|
9
10
|
m_loggingEnabled = false;
|
10
|
-
m_ignoredOutput = new
|
11
|
+
m_ignoredOutput = new QFile(this);
|
11
12
|
m_timeout = -1;
|
13
|
+
m_networkAccessManager = new NetworkAccessManager(this);
|
14
|
+
m_networkAccessManager->setCookieJar(m_cookieJar);
|
12
15
|
createPage(this)->setFocus();
|
13
16
|
}
|
14
17
|
|
18
|
+
NetworkAccessManager *WebPageManager::networkAccessManager() {
|
19
|
+
return m_networkAccessManager;
|
20
|
+
}
|
21
|
+
|
15
22
|
void WebPageManager::append(WebPage *value) {
|
16
23
|
m_pages.append(value);
|
17
24
|
}
|
@@ -102,6 +109,8 @@ void WebPageManager::setTimeout(int timeout) {
|
|
102
109
|
void WebPageManager::reset() {
|
103
110
|
m_timeout = -1;
|
104
111
|
m_cookieJar->clearCookies();
|
112
|
+
m_networkAccessManager->reset();
|
113
|
+
m_pages.first()->resetLocalStorage();
|
105
114
|
m_pages.first()->deleteLater();
|
106
115
|
m_pages.clear();
|
107
116
|
createPage(this)->setFocus();
|
data/src/WebPageManager.h
CHANGED
@@ -9,6 +9,7 @@
|
|
9
9
|
|
10
10
|
class WebPage;
|
11
11
|
class NetworkCookieJar;
|
12
|
+
class NetworkAccessManager;
|
12
13
|
|
13
14
|
class WebPageManager : public QObject {
|
14
15
|
Q_OBJECT
|
@@ -30,6 +31,7 @@ class WebPageManager : public QObject {
|
|
30
31
|
QDebug logger() const;
|
31
32
|
void enableLogging();
|
32
33
|
void replyFinished(QNetworkReply *reply);
|
34
|
+
NetworkAccessManager *networkAccessManager();
|
33
35
|
|
34
36
|
public slots:
|
35
37
|
void emitLoadStarted();
|
@@ -52,8 +54,9 @@ class WebPageManager : public QObject {
|
|
52
54
|
QSet<WebPage *> m_started;
|
53
55
|
bool m_success;
|
54
56
|
bool m_loggingEnabled;
|
55
|
-
|
57
|
+
QFile *m_ignoredOutput;
|
56
58
|
int m_timeout;
|
59
|
+
NetworkAccessManager *m_networkAccessManager;
|
57
60
|
};
|
58
61
|
|
59
62
|
#endif // _WEBPAGEMANAGER_H
|