capybara-webkit 0.12.1 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/GOALS +9 -0
- data/Gemfile.lock +15 -12
- data/LICENSE +1 -1
- data/NEWS.md +18 -0
- data/README.md +81 -2
- data/capybara-webkit.gemspec +1 -1
- data/lib/capybara/webkit.rb +11 -6
- data/lib/capybara/{driver/webkit → webkit}/browser.rb +90 -4
- data/lib/capybara/{driver/webkit → webkit}/connection.rb +48 -47
- data/lib/capybara/{driver/webkit → webkit}/cookie_jar.rb +1 -1
- data/lib/capybara/webkit/driver.rb +186 -0
- data/lib/capybara/webkit/errors.rb +10 -0
- data/lib/capybara/{driver/webkit → webkit}/node.rb +12 -4
- data/lib/capybara/{driver/webkit → webkit}/socket_debugger.rb +4 -1
- data/lib/capybara/{driver/webkit → webkit}/version.rb +1 -1
- data/lib/capybara_webkit_builder.rb +17 -3
- data/spec/browser_spec.rb +95 -7
- data/spec/connection_spec.rb +16 -5
- data/spec/cookie_jar_spec.rb +3 -3
- data/spec/driver_rendering_spec.rb +19 -26
- data/spec/driver_resize_window_spec.rb +3 -3
- data/spec/driver_spec.rb +1200 -822
- data/spec/integration/driver_spec.rb +4 -3
- data/spec/selenium_compatibility_spec.rb +49 -0
- data/spec/spec_helper.rb +14 -6
- data/spec/support/app_runner.rb +94 -0
- data/src/Authenticate.cpp +18 -0
- data/src/Authenticate.h +12 -0
- data/src/Body.h +3 -5
- data/src/ClearCookies.cpp +3 -5
- data/src/ClearCookies.h +3 -5
- data/src/ClearPromptText.cpp +11 -0
- data/src/ClearPromptText.h +9 -0
- data/src/Command.cpp +4 -15
- data/src/Command.h +3 -14
- data/src/CommandFactory.cpp +20 -6
- data/src/CommandFactory.h +3 -2
- data/src/CommandParser.cpp +1 -1
- data/src/Connection.cpp +22 -21
- data/src/Connection.h +5 -6
- data/src/ConsoleMessages.cpp +2 -1
- data/src/ConsoleMessages.h +3 -5
- data/src/CurrentUrl.cpp +9 -48
- data/src/CurrentUrl.h +8 -8
- data/src/EnableLogging.cpp +10 -0
- data/src/EnableLogging.h +12 -0
- data/src/Evaluate.cpp +2 -1
- data/src/Evaluate.h +3 -5
- data/src/Execute.cpp +2 -1
- data/src/Execute.h +3 -5
- data/src/Find.cpp +3 -2
- data/src/Find.h +3 -5
- data/src/FrameFocus.cpp +3 -2
- data/src/FrameFocus.h +3 -4
- data/src/GetCookies.cpp +3 -4
- data/src/GetCookies.h +3 -5
- data/src/GetTimeout.cpp +9 -0
- data/src/GetTimeout.h +11 -0
- data/src/GetWindowHandle.cpp +11 -0
- data/src/GetWindowHandle.h +10 -0
- data/src/GetWindowHandles.cpp +20 -0
- data/src/GetWindowHandles.h +10 -0
- data/src/Header.cpp +2 -1
- data/src/Header.h +3 -5
- data/src/Headers.cpp +8 -2
- data/src/Headers.h +3 -5
- data/src/IgnoreSslErrors.cpp +4 -3
- data/src/IgnoreSslErrors.h +3 -5
- data/src/JavascriptAlertMessages.cpp +10 -0
- data/src/JavascriptAlertMessages.h +9 -0
- data/src/JavascriptConfirmMessages.cpp +10 -0
- data/src/JavascriptConfirmMessages.h +9 -0
- data/src/JavascriptInvocation.cpp +1 -1
- data/src/JavascriptInvocation.h +1 -1
- data/src/JavascriptPromptMessages.cpp +10 -0
- data/src/JavascriptPromptMessages.h +9 -0
- data/src/NetworkAccessManager.cpp +38 -5
- data/src/NetworkAccessManager.h +20 -0
- data/src/Node.cpp +6 -1
- data/src/Node.h +4 -5
- data/src/NullCommand.cpp +5 -2
- data/src/NullCommand.h +4 -3
- data/src/PageLoadingCommand.cpp +12 -7
- data/src/PageLoadingCommand.h +6 -9
- data/src/Render.cpp +2 -1
- data/src/Render.h +3 -5
- data/src/RequestedUrl.cpp +2 -1
- data/src/RequestedUrl.h +3 -5
- data/src/Reset.cpp +3 -17
- data/src/Reset.h +3 -8
- data/src/ResizeWindow.cpp +2 -1
- data/src/ResizeWindow.h +3 -5
- data/src/Response.cpp +4 -0
- data/src/Response.h +1 -0
- data/src/Server.cpp +2 -3
- data/src/Server.h +0 -2
- data/src/SetConfirmAction.cpp +11 -0
- data/src/SetConfirmAction.h +9 -0
- data/src/SetCookie.cpp +3 -4
- data/src/SetCookie.h +3 -5
- data/src/SetPromptAction.cpp +11 -0
- data/src/SetPromptAction.h +9 -0
- data/src/SetPromptText.cpp +11 -0
- data/src/SetPromptText.h +9 -0
- data/src/SetProxy.cpp +2 -1
- data/src/SetProxy.h +3 -5
- data/src/SetSkipImageLoading.cpp +12 -0
- data/src/SetSkipImageLoading.h +9 -0
- data/src/SetTimeout.cpp +19 -0
- data/src/SetTimeout.h +9 -0
- data/src/SocketCommand.cpp +21 -0
- data/src/SocketCommand.h +29 -0
- data/src/Source.cpp +3 -2
- data/src/Source.h +3 -4
- data/src/Status.cpp +2 -1
- data/src/Status.h +3 -5
- data/src/TimeoutCommand.cpp +69 -0
- data/src/TimeoutCommand.h +41 -0
- data/src/UnsupportedContentHandler.cpp +11 -17
- data/src/UnsupportedContentHandler.h +5 -3
- data/src/Url.cpp +2 -1
- data/src/Url.h +3 -5
- data/src/Visit.cpp +3 -2
- data/src/Visit.h +3 -5
- data/src/WebPage.cpp +129 -44
- data/src/WebPage.h +37 -11
- data/src/WebPageManager.cpp +127 -0
- data/src/WebPageManager.h +59 -0
- data/src/WindowFocus.cpp +32 -0
- data/src/WindowFocus.h +15 -0
- data/src/body.cpp +2 -1
- data/src/capybara.js +38 -10
- data/src/find_command.h +17 -2
- data/src/main.cpp +0 -2
- data/src/webkit_server.pro +36 -0
- data/templates/Command.cpp +2 -4
- data/templates/Command.h +3 -3
- metadata +106 -27
- data/ChangeLog +0 -70
- data/lib/capybara/driver/webkit.rb +0 -136
data/src/Headers.cpp
CHANGED
@@ -1,10 +1,16 @@
|
|
1
1
|
#include "Headers.h"
|
2
2
|
#include "WebPage.h"
|
3
|
+
#include "WebPageManager.h"
|
3
4
|
|
4
|
-
Headers::Headers(
|
5
|
+
Headers::Headers(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
5
6
|
}
|
6
7
|
|
7
8
|
void Headers::start() {
|
8
|
-
|
9
|
+
QStringList headers;
|
10
|
+
|
11
|
+
foreach(QNetworkReply::RawHeaderPair header, page()->pageHeaders())
|
12
|
+
headers << header.first+": "+header.second;
|
13
|
+
|
14
|
+
emit finished(new Response(true, headers.join("\n")));
|
9
15
|
}
|
10
16
|
|
data/src/Headers.h
CHANGED
@@ -1,12 +1,10 @@
|
|
1
|
-
#include "
|
1
|
+
#include "SocketCommand.h"
|
2
2
|
|
3
|
-
class
|
4
|
-
|
5
|
-
class Headers : public Command {
|
3
|
+
class Headers : public SocketCommand {
|
6
4
|
Q_OBJECT
|
7
5
|
|
8
6
|
public:
|
9
|
-
Headers(
|
7
|
+
Headers(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
10
8
|
virtual void start();
|
11
9
|
};
|
12
10
|
|
data/src/IgnoreSslErrors.cpp
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
#include "IgnoreSslErrors.h"
|
2
2
|
#include "WebPage.h"
|
3
|
+
#include "WebPageManager.h"
|
3
4
|
|
4
|
-
IgnoreSslErrors::IgnoreSslErrors(
|
5
|
-
|
5
|
+
IgnoreSslErrors::IgnoreSslErrors(WebPageManager *manager, QStringList &arguments, QObject *parent) :
|
6
|
+
SocketCommand(manager, arguments, parent) {
|
6
7
|
}
|
7
8
|
|
8
9
|
void IgnoreSslErrors::start() {
|
9
|
-
|
10
|
+
manager()->setIgnoreSslErrors(true);
|
10
11
|
emit finished(new Response(true));
|
11
12
|
}
|
12
13
|
|
data/src/IgnoreSslErrors.h
CHANGED
@@ -1,12 +1,10 @@
|
|
1
|
-
#include "
|
1
|
+
#include "SocketCommand.h"
|
2
2
|
|
3
|
-
class
|
4
|
-
|
5
|
-
class IgnoreSslErrors : public Command {
|
3
|
+
class IgnoreSslErrors : public SocketCommand {
|
6
4
|
Q_OBJECT
|
7
5
|
|
8
6
|
public:
|
9
|
-
IgnoreSslErrors(
|
7
|
+
IgnoreSslErrors(WebPageManager *manager, QStringList &arguments, QObject *parent = 0);
|
10
8
|
virtual void start();
|
11
9
|
};
|
12
10
|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#include "JavascriptAlertMessages.h"
|
2
|
+
#include "WebPage.h"
|
3
|
+
#include "WebPageManager.h"
|
4
|
+
|
5
|
+
JavascriptAlertMessages::JavascriptAlertMessages(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {}
|
6
|
+
|
7
|
+
void JavascriptAlertMessages::start()
|
8
|
+
{
|
9
|
+
emit finished(new Response(true, page()->alertMessages()));
|
10
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#include "JavascriptConfirmMessages.h"
|
2
|
+
#include "WebPage.h"
|
3
|
+
#include "WebPageManager.h"
|
4
|
+
|
5
|
+
JavascriptConfirmMessages::JavascriptConfirmMessages(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {}
|
6
|
+
|
7
|
+
void JavascriptConfirmMessages::start()
|
8
|
+
{
|
9
|
+
emit finished(new Response(true, page()->confirmMessages()));
|
10
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#include "JavascriptInvocation.h"
|
2
2
|
|
3
|
-
JavascriptInvocation::JavascriptInvocation(QString &functionName, QStringList &arguments, QObject *parent) : QObject(parent) {
|
3
|
+
JavascriptInvocation::JavascriptInvocation(const QString &functionName, const QStringList &arguments, QObject *parent) : QObject(parent) {
|
4
4
|
m_functionName = functionName;
|
5
5
|
m_arguments = arguments;
|
6
6
|
}
|
data/src/JavascriptInvocation.h
CHANGED
@@ -8,7 +8,7 @@ class JavascriptInvocation : public QObject {
|
|
8
8
|
Q_PROPERTY(QStringList arguments READ arguments)
|
9
9
|
|
10
10
|
public:
|
11
|
-
JavascriptInvocation(QString &functionName, QStringList &arguments, QObject *parent = 0);
|
11
|
+
JavascriptInvocation(const QString &functionName, const QStringList &arguments, QObject *parent = 0);
|
12
12
|
QString &functionName();
|
13
13
|
QStringList &arguments();
|
14
14
|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#include "JavascriptPromptMessages.h"
|
2
|
+
#include "WebPage.h"
|
3
|
+
#include "WebPageManager.h"
|
4
|
+
|
5
|
+
JavascriptPromptMessages::JavascriptPromptMessages(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {}
|
6
|
+
|
7
|
+
void JavascriptPromptMessages::start()
|
8
|
+
{
|
9
|
+
emit finished(new Response(true, page()->promptMessages()));
|
10
|
+
}
|
@@ -1,13 +1,16 @@
|
|
1
1
|
#include "NetworkAccessManager.h"
|
2
2
|
#include "WebPage.h"
|
3
3
|
#include <iostream>
|
4
|
-
|
4
|
+
#include <fstream>
|
5
5
|
|
6
6
|
NetworkAccessManager::NetworkAccessManager(QObject *parent):QNetworkAccessManager(parent) {
|
7
|
+
connect(this, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), SLOT(provideAuthentication(QNetworkReply*,QAuthenticator*)));
|
8
|
+
connect(this, SIGNAL(finished(QNetworkReply *)), this, SLOT(finished(QNetworkReply *)));
|
7
9
|
}
|
8
10
|
|
9
11
|
QNetworkReply* NetworkAccessManager::createRequest(QNetworkAccessManager::Operation operation, const QNetworkRequest &request, QIODevice * outgoingData = 0) {
|
10
12
|
QNetworkRequest new_request(request);
|
13
|
+
QByteArray url = new_request.url().toEncoded();
|
11
14
|
if (operation != QNetworkAccessManager::PostOperation && operation != QNetworkAccessManager::PutOperation) {
|
12
15
|
new_request.setHeader(QNetworkRequest::ContentTypeHeader, QVariant());
|
13
16
|
}
|
@@ -16,14 +19,44 @@ QNetworkReply* NetworkAccessManager::createRequest(QNetworkAccessManager::Operat
|
|
16
19
|
item.next();
|
17
20
|
new_request.setRawHeader(item.key().toAscii(), item.value().toAscii());
|
18
21
|
}
|
19
|
-
|
20
|
-
|
22
|
+
QNetworkReply *reply = QNetworkAccessManager::createRequest(operation, new_request, outgoingData);
|
23
|
+
emit requestCreated(url, reply);
|
24
|
+
return reply;
|
25
|
+
}
|
26
|
+
|
27
|
+
void NetworkAccessManager::finished(QNetworkReply *reply) {
|
28
|
+
NetworkResponse response;
|
29
|
+
response.statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
30
|
+
response.headers = reply->rawHeaderPairs();
|
31
|
+
m_responses[reply->url()] = response;
|
32
|
+
}
|
21
33
|
|
22
34
|
void NetworkAccessManager::addHeader(QString key, QString value) {
|
23
35
|
m_headers.insert(key, value);
|
24
|
-
}
|
36
|
+
}
|
25
37
|
|
26
38
|
void NetworkAccessManager::resetHeaders() {
|
27
39
|
m_headers.clear();
|
28
|
-
}
|
40
|
+
}
|
41
|
+
|
42
|
+
void NetworkAccessManager::setUserName(const QString &userName) {
|
43
|
+
m_userName = userName;
|
44
|
+
}
|
29
45
|
|
46
|
+
void NetworkAccessManager::setPassword(const QString &password) {
|
47
|
+
m_password = password;
|
48
|
+
}
|
49
|
+
|
50
|
+
void NetworkAccessManager::provideAuthentication(QNetworkReply *reply, QAuthenticator *authenticator) {
|
51
|
+
Q_UNUSED(reply);
|
52
|
+
authenticator->setUser(m_userName);
|
53
|
+
authenticator->setPassword(m_password);
|
54
|
+
}
|
55
|
+
|
56
|
+
int NetworkAccessManager::statusFor(QUrl url) {
|
57
|
+
return m_responses[url].statusCode;
|
58
|
+
}
|
59
|
+
|
60
|
+
const QList<QNetworkReply::RawHeaderPair> &NetworkAccessManager::headersFor(QUrl url) {
|
61
|
+
return m_responses[url].headers;
|
62
|
+
}
|
data/src/NetworkAccessManager.h
CHANGED
@@ -6,14 +6,34 @@ class NetworkAccessManager : public QNetworkAccessManager {
|
|
6
6
|
|
7
7
|
Q_OBJECT
|
8
8
|
|
9
|
+
struct NetworkResponse {
|
10
|
+
int statusCode;
|
11
|
+
QList<QNetworkReply::RawHeaderPair> headers;
|
12
|
+
NetworkResponse() : statusCode(0) { }
|
13
|
+
};
|
14
|
+
|
9
15
|
public:
|
10
16
|
NetworkAccessManager(QObject *parent = 0);
|
11
17
|
void addHeader(QString key, QString value);
|
12
18
|
void resetHeaders();
|
19
|
+
void setUserName(const QString &userName);
|
20
|
+
void setPassword(const QString &password);
|
21
|
+
int statusFor(QUrl url);
|
22
|
+
const QList<QNetworkReply::RawHeaderPair> &headersFor(QUrl url);
|
13
23
|
|
14
24
|
protected:
|
15
25
|
QNetworkReply* createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &req, QIODevice * outgoingData);
|
26
|
+
QString m_userName;
|
27
|
+
QString m_password;
|
16
28
|
|
17
29
|
private:
|
18
30
|
QHash<QString, QString> m_headers;
|
31
|
+
QHash<QUrl, NetworkResponse> m_responses;
|
32
|
+
|
33
|
+
private slots:
|
34
|
+
void provideAuthentication(QNetworkReply *reply, QAuthenticator *authenticator);
|
35
|
+
void finished(QNetworkReply *);
|
36
|
+
|
37
|
+
signals:
|
38
|
+
void requestCreated(QByteArray &url, QNetworkReply *reply);
|
19
39
|
};
|
data/src/Node.cpp
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
#include "Node.h"
|
2
2
|
#include "WebPage.h"
|
3
|
+
#include "WebPageManager.h"
|
3
4
|
|
4
|
-
Node::Node(
|
5
|
+
Node::Node(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
5
6
|
}
|
6
7
|
|
7
8
|
void Node::start() {
|
@@ -12,3 +13,7 @@ void Node::start() {
|
|
12
13
|
emit finished(new Response(true, attributeValue));
|
13
14
|
}
|
14
15
|
|
16
|
+
QString Node::toString() const {
|
17
|
+
QStringList functionArguments(arguments());
|
18
|
+
return QString("Node.") + functionArguments.takeFirst();
|
19
|
+
}
|
data/src/Node.h
CHANGED
@@ -1,13 +1,12 @@
|
|
1
|
-
#include "
|
1
|
+
#include "SocketCommand.h"
|
2
2
|
#include <QStringList>
|
3
3
|
|
4
|
-
class
|
5
|
-
|
6
|
-
class Node : public Command {
|
4
|
+
class Node : public SocketCommand {
|
7
5
|
Q_OBJECT
|
8
6
|
|
9
7
|
public:
|
10
|
-
Node(
|
8
|
+
Node(WebPageManager *manager, QStringList &arguments, QObject *parent = 0);
|
11
9
|
virtual void start();
|
10
|
+
virtual QString toString() const;
|
12
11
|
};
|
13
12
|
|
data/src/NullCommand.cpp
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
#include "NullCommand.h"
|
2
2
|
#include "WebPage.h"
|
3
|
+
#include "WebPageManager.h"
|
3
4
|
|
4
|
-
NullCommand::NullCommand(
|
5
|
+
NullCommand::NullCommand(QString name, QObject *parent) : Command(parent) {
|
6
|
+
m_name = name;
|
7
|
+
}
|
5
8
|
|
6
9
|
void NullCommand::start() {
|
7
|
-
QString failure = QString("[Capybara WebKit] Unknown command: ") +
|
10
|
+
QString failure = QString("[Capybara WebKit] Unknown command: ") + m_name + "\n";
|
8
11
|
emit finished(new Response(false, failure));
|
9
12
|
}
|
10
13
|
|
data/src/NullCommand.h
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
#include "Command.h"
|
2
2
|
|
3
|
-
class WebPage;
|
4
|
-
|
5
3
|
class NullCommand : public Command {
|
6
4
|
Q_OBJECT
|
7
5
|
|
8
6
|
public:
|
9
|
-
NullCommand(
|
7
|
+
NullCommand(QString name, QObject *parent = 0);
|
10
8
|
virtual void start();
|
9
|
+
|
10
|
+
private:
|
11
|
+
QString m_name;
|
11
12
|
};
|
data/src/PageLoadingCommand.cpp
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
#include "PageLoadingCommand.h"
|
2
|
-
#include "
|
2
|
+
#include "SocketCommand.h"
|
3
3
|
#include "WebPage.h"
|
4
|
+
#include "WebPageManager.h"
|
4
5
|
|
5
|
-
PageLoadingCommand::PageLoadingCommand(Command *command,
|
6
|
-
|
6
|
+
PageLoadingCommand::PageLoadingCommand(Command *command, WebPageManager *manager, QObject *parent) : Command(parent) {
|
7
|
+
m_manager = manager;
|
7
8
|
m_command = command;
|
8
9
|
m_pageLoadingFromCommand = false;
|
9
10
|
m_pageSuccess = true;
|
10
11
|
m_pendingResponse = NULL;
|
11
|
-
connect(
|
12
|
-
connect(
|
12
|
+
connect(m_manager, SIGNAL(loadStarted()), this, SLOT(pageLoadingFromCommand()));
|
13
|
+
connect(m_manager, SIGNAL(pageFinished(bool)), this, SLOT(pendingLoadFinished(bool)));
|
13
14
|
}
|
14
15
|
|
15
16
|
void PageLoadingCommand::start() {
|
17
|
+
m_manager->logger() << "Started" << m_command->toString();
|
16
18
|
connect(m_command, SIGNAL(finished(Response *)), this, SLOT(commandFinished(Response *)));
|
17
19
|
m_command->start();
|
18
20
|
};
|
@@ -22,10 +24,11 @@ void PageLoadingCommand::pendingLoadFinished(bool success) {
|
|
22
24
|
if (m_pageLoadingFromCommand) {
|
23
25
|
m_pageLoadingFromCommand = false;
|
24
26
|
if (m_pendingResponse) {
|
27
|
+
m_manager->logger() << "Page load from command finished";
|
25
28
|
if (m_pageSuccess) {
|
26
29
|
emit finished(m_pendingResponse);
|
27
30
|
} else {
|
28
|
-
QString message =
|
31
|
+
QString message = m_manager->currentPage()->failureString();
|
29
32
|
emit finished(new Response(false, message));
|
30
33
|
}
|
31
34
|
}
|
@@ -33,11 +36,13 @@ void PageLoadingCommand::pendingLoadFinished(bool success) {
|
|
33
36
|
}
|
34
37
|
|
35
38
|
void PageLoadingCommand::pageLoadingFromCommand() {
|
39
|
+
m_manager->logger() << m_command->toString() << "started page load";
|
36
40
|
m_pageLoadingFromCommand = true;
|
37
41
|
}
|
38
42
|
|
39
43
|
void PageLoadingCommand::commandFinished(Response *response) {
|
40
|
-
disconnect(
|
44
|
+
disconnect(m_manager, SIGNAL(loadStarted()), this, SLOT(pageLoadingFromCommand()));
|
45
|
+
m_manager->logger() << "Finished" << m_command->toString() << "with response" << response->toString();
|
41
46
|
m_command->deleteLater();
|
42
47
|
if (m_pageLoadingFromCommand)
|
43
48
|
m_pendingResponse = response;
|
data/src/PageLoadingCommand.h
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
#include <QObject>
|
2
2
|
#include <QStringList>
|
3
|
+
#include "Command.h"
|
3
4
|
|
4
|
-
class Command;
|
5
5
|
class Response;
|
6
|
-
class
|
6
|
+
class WebPageManager;
|
7
7
|
|
8
8
|
/*
|
9
9
|
* Decorates a Command by deferring the finished() signal until any pending
|
@@ -15,23 +15,20 @@ class WebPage;
|
|
15
15
|
* If a pending page load fails, the command's response will be discarded and a
|
16
16
|
* failure response will be emitted instead.
|
17
17
|
*/
|
18
|
-
class PageLoadingCommand : public
|
18
|
+
class PageLoadingCommand : public Command {
|
19
19
|
Q_OBJECT
|
20
20
|
|
21
21
|
public:
|
22
|
-
PageLoadingCommand(Command *command,
|
23
|
-
void start();
|
22
|
+
PageLoadingCommand(Command *command, WebPageManager *page, QObject *parent = 0);
|
23
|
+
virtual void start();
|
24
24
|
|
25
25
|
public slots:
|
26
26
|
void pageLoadingFromCommand();
|
27
27
|
void pendingLoadFinished(bool success);
|
28
28
|
void commandFinished(Response *response);
|
29
29
|
|
30
|
-
signals:
|
31
|
-
void finished(Response *response);
|
32
|
-
|
33
30
|
private:
|
34
|
-
|
31
|
+
WebPageManager *m_manager;
|
35
32
|
Command *m_command;
|
36
33
|
Response *m_pendingResponse;
|
37
34
|
bool m_pageSuccess;
|
data/src/Render.cpp
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
#include "Render.h"
|
2
2
|
#include "WebPage.h"
|
3
|
+
#include "WebPageManager.h"
|
3
4
|
|
4
|
-
Render::Render(
|
5
|
+
Render::Render(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
5
6
|
}
|
6
7
|
|
7
8
|
void Render::start() {
|
data/src/Render.h
CHANGED
@@ -1,12 +1,10 @@
|
|
1
|
-
#include "
|
1
|
+
#include "SocketCommand.h"
|
2
2
|
#include <QStringList>
|
3
3
|
|
4
|
-
class
|
5
|
-
|
6
|
-
class Render : public Command {
|
4
|
+
class Render : public SocketCommand {
|
7
5
|
Q_OBJECT
|
8
6
|
|
9
7
|
public:
|
10
|
-
Render(
|
8
|
+
Render(WebPageManager *page, QStringList &arguments, QObject *parent = 0);
|
11
9
|
virtual void start();
|
12
10
|
};
|