capybara-webkit 1.1.0 → 1.2.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.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/.travis.yml +18 -16
- data/Appraisals +8 -4
- data/Gemfile.lock +29 -14
- data/NEWS.md +7 -0
- data/README.md +16 -10
- data/Rakefile +1 -1
- data/capybara-webkit.gemspec +2 -1
- data/gemfiles/2.0.gemfile.lock +23 -19
- data/gemfiles/2.1.gemfile.lock +33 -20
- data/gemfiles/2.2.gemfile +7 -0
- data/gemfiles/2.2.gemfile.lock +77 -0
- data/gemfiles/2.3.gemfile +7 -0
- data/gemfiles/2.3.gemfile.lock +77 -0
- data/lib/capybara/webkit/browser.rb +28 -4
- data/lib/capybara/webkit/connection.rb +9 -24
- data/lib/capybara/webkit/driver.rb +40 -4
- data/lib/capybara/webkit/errors.rb +3 -0
- data/lib/capybara/webkit/version.rb +1 -1
- data/spec/browser_spec.rb +1 -1
- data/spec/connection_spec.rb +27 -5
- data/spec/driver_rendering_spec.rb +10 -0
- data/spec/driver_resize_window_spec.rb +22 -0
- data/spec/driver_spec.rb +117 -9
- data/spec/selenium_compatibility_spec.rb +3 -0
- data/spec/spec_helper.rb +22 -3
- data/spec/support/matchers/include_response.rb +24 -0
- data/src/CommandFactory.cpp +7 -1
- data/src/GoBack.cpp +12 -0
- data/src/GoBack.h +10 -0
- data/src/GoForward.cpp +12 -0
- data/src/GoForward.h +10 -0
- data/src/IgnoreDebugOutput.cpp +1 -0
- data/src/Render.cpp +10 -1
- data/src/Reset.cpp +0 -2
- data/src/SocketCommand.cpp +6 -0
- data/src/SocketCommand.h +1 -0
- data/src/StdinNotifier.cpp +16 -0
- data/src/StdinNotifier.h +20 -0
- data/src/WebPage.cpp +20 -5
- data/src/WebPage.h +4 -1
- data/src/WebPageManager.cpp +18 -7
- data/src/WebPageManager.h +2 -1
- data/src/WindowClose.cpp +10 -0
- data/src/WindowClose.h +12 -0
- data/src/WindowCommand.cpp +27 -0
- data/src/WindowCommand.h +21 -0
- data/src/WindowFocus.cpp +2 -25
- data/src/WindowFocus.h +4 -7
- data/src/WindowMaximize.cpp +14 -0
- data/src/WindowMaximize.h +12 -0
- data/src/WindowOpen.cpp +12 -0
- data/src/WindowOpen.h +10 -0
- data/src/WindowResize.cpp +16 -0
- data/src/WindowResize.h +12 -0
- data/src/WindowSize.cpp +17 -0
- data/src/WindowSize.h +12 -0
- data/src/capybara.js +19 -3
- data/src/find_command.h +7 -1
- data/src/main.cpp +4 -0
- data/src/webkit_server.pro +25 -4
- data/templates/Command.cpp +2 -0
- data/templates/Command.h +1 -3
- metadata +68 -32
- data/src/ResizeWindow.cpp +0 -17
- data/src/ResizeWindow.h +0 -10
data/src/Reset.cpp
CHANGED
data/src/SocketCommand.cpp
CHANGED
|
@@ -19,3 +19,9 @@ WebPageManager *SocketCommand::manager() const {
|
|
|
19
19
|
return m_manager;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
QString SocketCommand::toString() const {
|
|
23
|
+
QString result;
|
|
24
|
+
QTextStream(&result) << metaObject()->className() << QString("(") << m_arguments.join(", ") << QString(")");
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
|
data/src/SocketCommand.h
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#include "StdinNotifier.h"
|
|
2
|
+
|
|
3
|
+
#include <QTcpServer>
|
|
4
|
+
|
|
5
|
+
StdinNotifier::StdinNotifier(QObject *parent) : QObject(parent) {
|
|
6
|
+
m_notifier = new QSocketNotifier(fileno(stdin), QSocketNotifier::Read, this);
|
|
7
|
+
connect(m_notifier, SIGNAL(activated(int)), this, SLOT(notifierActivated()));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
void StdinNotifier::notifierActivated() {
|
|
11
|
+
std::string line;
|
|
12
|
+
std::getline(std::cin, line);
|
|
13
|
+
if (std::cin.eof()) {
|
|
14
|
+
emit eof();
|
|
15
|
+
}
|
|
16
|
+
}
|
data/src/StdinNotifier.h
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#include <QObject>
|
|
2
|
+
|
|
3
|
+
class QSocketNotifier;
|
|
4
|
+
|
|
5
|
+
class StdinNotifier : public QObject {
|
|
6
|
+
Q_OBJECT
|
|
7
|
+
|
|
8
|
+
public:
|
|
9
|
+
StdinNotifier(QObject *parent = 0);
|
|
10
|
+
|
|
11
|
+
public slots:
|
|
12
|
+
void notifierActivated();
|
|
13
|
+
|
|
14
|
+
signals:
|
|
15
|
+
void eof();
|
|
16
|
+
|
|
17
|
+
private:
|
|
18
|
+
QSocketNotifier *m_notifier;
|
|
19
|
+
};
|
|
20
|
+
|
data/src/WebPage.cpp
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
#include <QWebSettings>
|
|
12
12
|
#include <QUuid>
|
|
13
13
|
#include <QApplication>
|
|
14
|
+
#include <QWebView>
|
|
15
|
+
#include <QMainWindow>
|
|
14
16
|
|
|
15
17
|
WebPage::WebPage(WebPageManager *manager, QObject *parent) : QWebPage(parent) {
|
|
16
18
|
m_loading = false;
|
|
@@ -33,14 +35,23 @@ WebPage::WebPage(WebPageManager *manager, QObject *parent) : QWebPage(parent) {
|
|
|
33
35
|
this, SLOT(frameCreated(QWebFrame *)));
|
|
34
36
|
connect(this, SIGNAL(unsupportedContent(QNetworkReply*)),
|
|
35
37
|
this, SLOT(handleUnsupportedContent(QNetworkReply*)));
|
|
36
|
-
|
|
38
|
+
connect(this, SIGNAL(windowCloseRequested()), this, SLOT(remove()));
|
|
37
39
|
|
|
38
40
|
settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
|
|
41
|
+
settings()->setAttribute(QWebSettings::JavascriptCanCloseWindows, true);
|
|
42
|
+
settings()->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true);
|
|
43
|
+
|
|
44
|
+
createWindow();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
void WebPage::createWindow() {
|
|
48
|
+
QSize size(1680, 1050);
|
|
49
|
+
setViewportSize(size);
|
|
39
50
|
}
|
|
40
51
|
|
|
41
|
-
void WebPage::
|
|
42
|
-
|
|
43
|
-
|
|
52
|
+
void WebPage::resize(int width, int height) {
|
|
53
|
+
QSize size(width, height);
|
|
54
|
+
setViewportSize(size);
|
|
44
55
|
}
|
|
45
56
|
|
|
46
57
|
void WebPage::resetLocalStorage() {
|
|
@@ -334,7 +345,7 @@ bool WebPage::supportsExtension(Extension extension) const {
|
|
|
334
345
|
|
|
335
346
|
QWebPage *WebPage::createWindow(WebWindowType type) {
|
|
336
347
|
Q_UNUSED(type);
|
|
337
|
-
return m_manager->createPage(
|
|
348
|
+
return m_manager->createPage();
|
|
338
349
|
}
|
|
339
350
|
|
|
340
351
|
QString WebPage::uuid() {
|
|
@@ -361,6 +372,10 @@ void WebPage::setFocus() {
|
|
|
361
372
|
m_manager->setCurrentPage(this);
|
|
362
373
|
}
|
|
363
374
|
|
|
375
|
+
void WebPage::remove() {
|
|
376
|
+
m_manager->removePage(this);
|
|
377
|
+
}
|
|
378
|
+
|
|
364
379
|
void WebPage::setConfirmAction(QString action) {
|
|
365
380
|
m_confirm = (action == "Yes");
|
|
366
381
|
}
|
data/src/WebPage.h
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
class WebPageManager;
|
|
11
11
|
class InvocationResult;
|
|
12
12
|
class NetworkReplyProxy;
|
|
13
|
+
class QWebView;
|
|
13
14
|
|
|
14
15
|
class WebPage : public QWebPage {
|
|
15
16
|
Q_OBJECT
|
|
@@ -33,7 +34,7 @@ class WebPage : public QWebPage {
|
|
|
33
34
|
QVariantList alertMessages();
|
|
34
35
|
QVariantList confirmMessages();
|
|
35
36
|
QVariantList promptMessages();
|
|
36
|
-
void
|
|
37
|
+
void createWindow();
|
|
37
38
|
void resetLocalStorage();
|
|
38
39
|
QWebPage *createWindow(WebWindowType type);
|
|
39
40
|
QString uuid();
|
|
@@ -46,6 +47,7 @@ class WebPage : public QWebPage {
|
|
|
46
47
|
QString contentType();
|
|
47
48
|
void mouseEvent(QEvent::Type type, const QPoint &position, Qt::MouseButton button);
|
|
48
49
|
bool clickTest(QWebElement element, int absoluteX, int absoluteY);
|
|
50
|
+
void resize(int, int);
|
|
49
51
|
|
|
50
52
|
public slots:
|
|
51
53
|
bool shouldInterruptJavaScript();
|
|
@@ -57,6 +59,7 @@ class WebPage : public QWebPage {
|
|
|
57
59
|
void handleSslErrorsForReply(QNetworkReply *reply, const QList<QSslError> &);
|
|
58
60
|
void handleUnsupportedContent(QNetworkReply *reply);
|
|
59
61
|
void replyFinished(QUrl &, QNetworkReply *);
|
|
62
|
+
void remove();
|
|
60
63
|
|
|
61
64
|
signals:
|
|
62
65
|
void pageFinished(bool);
|
data/src/WebPageManager.cpp
CHANGED
|
@@ -12,7 +12,7 @@ WebPageManager::WebPageManager(QObject *parent) : QObject(parent) {
|
|
|
12
12
|
m_timeout = -1;
|
|
13
13
|
m_networkAccessManager = new NetworkAccessManager(this);
|
|
14
14
|
m_networkAccessManager->setCookieJar(m_cookieJar);
|
|
15
|
-
createPage(
|
|
15
|
+
createPage()->setFocus();
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
NetworkAccessManager *WebPageManager::networkAccessManager() {
|
|
@@ -35,8 +35,8 @@ WebPage *WebPageManager::currentPage() const {
|
|
|
35
35
|
return m_currentPage;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
WebPage *WebPageManager::createPage(
|
|
39
|
-
WebPage *page = new WebPage(this
|
|
38
|
+
WebPage *WebPageManager::createPage() {
|
|
39
|
+
WebPage *page = new WebPage(this);
|
|
40
40
|
connect(page, SIGNAL(loadStarted()),
|
|
41
41
|
this, SLOT(emitLoadStarted()));
|
|
42
42
|
connect(page, SIGNAL(pageFinished(bool)),
|
|
@@ -47,6 +47,15 @@ WebPage *WebPageManager::createPage(QObject *parent) {
|
|
|
47
47
|
return page;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
void WebPageManager::removePage(WebPage *page) {
|
|
51
|
+
m_pages.removeOne(page);
|
|
52
|
+
page->deleteLater();
|
|
53
|
+
if (m_pages.isEmpty())
|
|
54
|
+
createPage()->setFocus();
|
|
55
|
+
else if (page == m_currentPage)
|
|
56
|
+
m_pages.first()->setFocus();
|
|
57
|
+
}
|
|
58
|
+
|
|
50
59
|
void WebPageManager::emitLoadStarted() {
|
|
51
60
|
if (m_started.empty()) {
|
|
52
61
|
logger() << "Load started";
|
|
@@ -110,10 +119,12 @@ void WebPageManager::reset() {
|
|
|
110
119
|
m_timeout = -1;
|
|
111
120
|
m_cookieJar->clearCookies();
|
|
112
121
|
m_networkAccessManager->reset();
|
|
113
|
-
|
|
114
|
-
m_pages.
|
|
115
|
-
|
|
116
|
-
|
|
122
|
+
m_currentPage->resetLocalStorage();
|
|
123
|
+
while (!m_pages.isEmpty()) {
|
|
124
|
+
WebPage *page = m_pages.takeFirst();
|
|
125
|
+
page->deleteLater();
|
|
126
|
+
}
|
|
127
|
+
createPage()->setFocus();
|
|
117
128
|
}
|
|
118
129
|
|
|
119
130
|
NetworkCookieJar *WebPageManager::cookieJar() {
|
data/src/WebPageManager.h
CHANGED
|
@@ -20,7 +20,8 @@ class WebPageManager : public QObject {
|
|
|
20
20
|
QList<WebPage *> pages() const;
|
|
21
21
|
void setCurrentPage(WebPage *);
|
|
22
22
|
WebPage *currentPage() const;
|
|
23
|
-
WebPage *createPage(
|
|
23
|
+
WebPage *createPage();
|
|
24
|
+
void removePage(WebPage *);
|
|
24
25
|
void setIgnoreSslErrors(bool);
|
|
25
26
|
bool ignoreSslErrors();
|
|
26
27
|
void setTimeout(int);
|
data/src/WindowClose.cpp
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#include "WindowClose.h"
|
|
2
|
+
#include "WebPage.h"
|
|
3
|
+
|
|
4
|
+
WindowClose::WindowClose(WebPageManager *manager, QStringList &arguments, QObject *parent) : WindowCommand(manager, arguments, parent) {
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
void WindowClose::windowFound(WebPage *page) {
|
|
8
|
+
page->remove();
|
|
9
|
+
finish(true);
|
|
10
|
+
}
|
data/src/WindowClose.h
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#include "WindowCommand.h"
|
|
2
|
+
#include "WebPage.h"
|
|
3
|
+
#include "WebPageManager.h"
|
|
4
|
+
#include "ErrorMessage.h"
|
|
5
|
+
|
|
6
|
+
WindowCommand::WindowCommand(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
void WindowCommand::start() {
|
|
10
|
+
findWindow(arguments()[0]);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
void WindowCommand::findWindow(QString selector) {
|
|
14
|
+
foreach(WebPage *page, manager()->pages()) {
|
|
15
|
+
if (page->matchesWindowSelector(selector)) {
|
|
16
|
+
windowFound(page);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
windowNotFound();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
void WindowCommand::windowNotFound() {
|
|
25
|
+
finish(false,
|
|
26
|
+
new ErrorMessage("NoSuchWindowError", "Unable to locate window."));
|
|
27
|
+
}
|
data/src/WindowCommand.h
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#ifndef WINDOW_COMMAND_H
|
|
2
|
+
#define WINDOW_COMMAND_H
|
|
3
|
+
|
|
4
|
+
#include "SocketCommand.h"
|
|
5
|
+
|
|
6
|
+
class WindowCommand : public SocketCommand {
|
|
7
|
+
Q_OBJECT
|
|
8
|
+
|
|
9
|
+
public:
|
|
10
|
+
WindowCommand(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
|
11
|
+
virtual void start();
|
|
12
|
+
|
|
13
|
+
protected:
|
|
14
|
+
virtual void windowFound(WebPage *) = 0;
|
|
15
|
+
|
|
16
|
+
private:
|
|
17
|
+
void findWindow(QString);
|
|
18
|
+
void windowNotFound();
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
#endif
|
data/src/WindowFocus.cpp
CHANGED
|
@@ -1,33 +1,10 @@
|
|
|
1
1
|
#include "WindowFocus.h"
|
|
2
|
-
#include "SocketCommand.h"
|
|
3
2
|
#include "WebPage.h"
|
|
4
|
-
#include "CommandFactory.h"
|
|
5
|
-
#include "WebPageManager.h"
|
|
6
|
-
#include "ErrorMessage.h"
|
|
7
3
|
|
|
8
|
-
WindowFocus::WindowFocus(WebPageManager *manager, QStringList &arguments, QObject *parent) :
|
|
4
|
+
WindowFocus::WindowFocus(WebPageManager *manager, QStringList &arguments, QObject *parent) : WindowCommand(manager, arguments, parent) {
|
|
9
5
|
}
|
|
10
6
|
|
|
11
|
-
void WindowFocus::
|
|
12
|
-
focusWindow(arguments()[0]);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
void WindowFocus::windowNotFound() {
|
|
16
|
-
finish(false, new ErrorMessage("Unable to locate window."));
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
void WindowFocus::success(WebPage *page) {
|
|
7
|
+
void WindowFocus::windowFound(WebPage *page) {
|
|
20
8
|
page->setFocus();
|
|
21
9
|
finish(true);
|
|
22
10
|
}
|
|
23
|
-
|
|
24
|
-
void WindowFocus::focusWindow(QString selector) {
|
|
25
|
-
foreach(WebPage *page, manager()->pages()) {
|
|
26
|
-
if (page->matchesWindowSelector(selector)) {
|
|
27
|
-
success(page);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
windowNotFound();
|
|
33
|
-
}
|
data/src/WindowFocus.h
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
#include "
|
|
1
|
+
#include "WindowCommand.h"
|
|
2
2
|
|
|
3
|
-
class WindowFocus : public
|
|
3
|
+
class WindowFocus : public WindowCommand {
|
|
4
4
|
Q_OBJECT
|
|
5
5
|
|
|
6
6
|
public:
|
|
7
7
|
WindowFocus(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
|
8
|
-
virtual void start();
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
void
|
|
12
|
-
void windowNotFound();
|
|
13
|
-
void focusWindow(QString);
|
|
9
|
+
protected:
|
|
10
|
+
virtual void windowFound(WebPage *);
|
|
14
11
|
};
|
|
15
12
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#include <QDesktopWidget>
|
|
2
|
+
#include "WindowMaximize.h"
|
|
3
|
+
#include "WebPage.h"
|
|
4
|
+
#include "WebPageManager.h"
|
|
5
|
+
|
|
6
|
+
WindowMaximize::WindowMaximize(WebPageManager *manager, QStringList &arguments, QObject *parent) : WindowCommand(manager, arguments, parent) {
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
void WindowMaximize::windowFound(WebPage *page) {
|
|
10
|
+
QDesktopWidget *desktop = QApplication::desktop();
|
|
11
|
+
QRect area = desktop->availableGeometry();
|
|
12
|
+
page->resize(area.width(), area.height());
|
|
13
|
+
finish(true);
|
|
14
|
+
}
|
data/src/WindowOpen.cpp
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#include "WindowOpen.h"
|
|
2
|
+
#include "SocketCommand.h"
|
|
3
|
+
#include "WebPage.h"
|
|
4
|
+
#include "WebPageManager.h"
|
|
5
|
+
|
|
6
|
+
WindowOpen::WindowOpen(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
void WindowOpen::start() {
|
|
10
|
+
manager()->createPage();
|
|
11
|
+
finish(true);
|
|
12
|
+
}
|
data/src/WindowOpen.h
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#include "WindowResize.h"
|
|
2
|
+
#include "WebPage.h"
|
|
3
|
+
#include "WebPageManager.h"
|
|
4
|
+
|
|
5
|
+
WindowResize::WindowResize(WebPageManager *manager, QStringList &arguments, QObject *parent) : WindowCommand(manager, arguments, parent) {
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
void WindowResize::windowFound(WebPage *page) {
|
|
9
|
+
int width = arguments()[1].toInt();
|
|
10
|
+
int height = arguments()[2].toInt();
|
|
11
|
+
|
|
12
|
+
page->resize(width, height);
|
|
13
|
+
|
|
14
|
+
finish(true);
|
|
15
|
+
}
|
|
16
|
+
|
data/src/WindowResize.h
ADDED
data/src/WindowSize.cpp
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#include "WindowSize.h"
|
|
2
|
+
#include "WebPage.h"
|
|
3
|
+
#include "WebPageManager.h"
|
|
4
|
+
#include "JsonSerializer.h"
|
|
5
|
+
|
|
6
|
+
WindowSize::WindowSize(WebPageManager *manager, QStringList &arguments, QObject *parent) : WindowCommand(manager, arguments, parent) {
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
void WindowSize::windowFound(WebPage *page) {
|
|
10
|
+
QSize size = page->viewportSize();
|
|
11
|
+
QVariantList elements;
|
|
12
|
+
elements << size.width();
|
|
13
|
+
elements << size.height();
|
|
14
|
+
JsonSerializer serializer;
|
|
15
|
+
QByteArray json = serializer.serialize(elements);
|
|
16
|
+
finish(true, json);
|
|
17
|
+
}
|
data/src/WindowSize.h
ADDED
data/src/capybara.js
CHANGED
|
@@ -66,7 +66,9 @@ Capybara = {
|
|
|
66
66
|
text: function (index) {
|
|
67
67
|
var node = this.getNode(index);
|
|
68
68
|
var type = (node.type || node.tagName).toLowerCase();
|
|
69
|
-
if (
|
|
69
|
+
if (!this.isNodeVisible(node)) {
|
|
70
|
+
return '';
|
|
71
|
+
} else if (type == "textarea") {
|
|
70
72
|
return node.innerHTML;
|
|
71
73
|
} else {
|
|
72
74
|
return node.innerText || node.textContent;
|
|
@@ -286,20 +288,34 @@ Capybara = {
|
|
|
286
288
|
CapybaraInvocation.keypress(value[strindex]);
|
|
287
289
|
}
|
|
288
290
|
|
|
291
|
+
if (value == '')
|
|
292
|
+
this.trigger(index, "change");
|
|
289
293
|
} else if (type === "checkbox" || type === "radio") {
|
|
290
294
|
if (node.checked != (value === "true")) {
|
|
291
295
|
this.leftClick(index);
|
|
292
296
|
}
|
|
293
|
-
|
|
294
297
|
} else if (type === "file") {
|
|
295
298
|
this.attachedFiles = Array.prototype.slice.call(arguments, 1);
|
|
296
299
|
this.leftClick(index);
|
|
297
|
-
|
|
300
|
+
} else if (this.isContentEditable(node)) {
|
|
301
|
+
var content = document.createTextNode(value);
|
|
302
|
+
node.innerHTML = '';
|
|
303
|
+
node.appendChild(content);
|
|
298
304
|
} else {
|
|
299
305
|
node.value = value;
|
|
300
306
|
}
|
|
301
307
|
},
|
|
302
308
|
|
|
309
|
+
isContentEditable: function(node) {
|
|
310
|
+
if (node.contentEditable == 'true') {
|
|
311
|
+
return true;
|
|
312
|
+
} else if (node.contentEditable == 'false') {
|
|
313
|
+
return false;
|
|
314
|
+
} else if (node.contentEditable == 'inherit') {
|
|
315
|
+
return this.isContentEditable(node.parentNode);
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
|
|
303
319
|
focus: function(index) {
|
|
304
320
|
this.getNode(index).focus();
|
|
305
321
|
},
|
data/src/find_command.h
CHANGED
|
@@ -21,7 +21,7 @@ CHECK_COMMAND(GetCookies)
|
|
|
21
21
|
CHECK_COMMAND(SetProxy)
|
|
22
22
|
CHECK_COMMAND(ConsoleMessages)
|
|
23
23
|
CHECK_COMMAND(CurrentUrl)
|
|
24
|
-
CHECK_COMMAND(
|
|
24
|
+
CHECK_COMMAND(WindowResize)
|
|
25
25
|
CHECK_COMMAND(IgnoreSslErrors)
|
|
26
26
|
CHECK_COMMAND(SetSkipImageLoading)
|
|
27
27
|
CHECK_COMMAND(WindowFocus)
|
|
@@ -42,3 +42,9 @@ CHECK_COMMAND(SetUrlBlacklist)
|
|
|
42
42
|
CHECK_COMMAND(Title)
|
|
43
43
|
CHECK_COMMAND(Version)
|
|
44
44
|
CHECK_COMMAND(FindCss)
|
|
45
|
+
CHECK_COMMAND(WindowClose)
|
|
46
|
+
CHECK_COMMAND(WindowOpen)
|
|
47
|
+
CHECK_COMMAND(WindowSize)
|
|
48
|
+
CHECK_COMMAND(WindowMaximize)
|
|
49
|
+
CHECK_COMMAND(GoBack)
|
|
50
|
+
CHECK_COMMAND(GoForward)
|
data/src/main.cpp
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#include "Server.h"
|
|
2
2
|
#include "IgnoreDebugOutput.h"
|
|
3
|
+
#include "StdinNotifier.h"
|
|
3
4
|
#include <QApplication>
|
|
4
5
|
#include <iostream>
|
|
5
6
|
#ifdef Q_OS_UNIX
|
|
@@ -19,6 +20,9 @@ int main(int argc, char **argv) {
|
|
|
19
20
|
app.setOrganizationName("thoughtbot, inc");
|
|
20
21
|
app.setOrganizationDomain("thoughtbot.com");
|
|
21
22
|
|
|
23
|
+
StdinNotifier notifier;
|
|
24
|
+
QObject::connect(¬ifier, SIGNAL(eof()), &app, SLOT(quit()));
|
|
25
|
+
|
|
22
26
|
ignoreDebugOutput();
|
|
23
27
|
Server server(0);
|
|
24
28
|
|
data/src/webkit_server.pro
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
TEMPLATE = app
|
|
2
2
|
TARGET = webkit_server
|
|
3
3
|
DESTDIR = .
|
|
4
|
+
PROJECT_DIR = $$_PRO_FILE_PWD_
|
|
5
|
+
BUILD_DIR = $${PROJECT_DIR}/build
|
|
6
|
+
PRECOMPILED_DIR = $${BUILD_DIR}
|
|
7
|
+
OBJECTS_DIR = $${BUILD_DIR}
|
|
8
|
+
MOC_DIR = $${BUILD_DIR}
|
|
4
9
|
HEADERS = \
|
|
10
|
+
GoForward.h \
|
|
11
|
+
GoBack.h \
|
|
12
|
+
WindowMaximize.h \
|
|
13
|
+
WindowSize.h \
|
|
14
|
+
WindowCommand.h \
|
|
15
|
+
WindowOpen.h \
|
|
16
|
+
WindowClose.h \
|
|
5
17
|
Version.h \
|
|
6
18
|
EnableLogging.h \
|
|
7
19
|
Authenticate.h \
|
|
@@ -13,7 +25,7 @@ HEADERS = \
|
|
|
13
25
|
JavascriptConfirmMessages.h \
|
|
14
26
|
JavascriptPromptMessages.h \
|
|
15
27
|
IgnoreSslErrors.h \
|
|
16
|
-
|
|
28
|
+
WindowResize.h \
|
|
17
29
|
CurrentUrl.h \
|
|
18
30
|
ConsoleMessages.h \
|
|
19
31
|
WebPage.h \
|
|
@@ -63,9 +75,17 @@ HEADERS = \
|
|
|
63
75
|
JavascriptCommand.h \
|
|
64
76
|
FindXpath.h \
|
|
65
77
|
NetworkReplyProxy.h \
|
|
66
|
-
IgnoreDebugOutput.h
|
|
78
|
+
IgnoreDebugOutput.h \
|
|
79
|
+
StdinNotifier.h
|
|
67
80
|
|
|
68
81
|
SOURCES = \
|
|
82
|
+
GoForward.cpp \
|
|
83
|
+
GoBack.cpp \
|
|
84
|
+
WindowMaximize.cpp \
|
|
85
|
+
WindowSize.cpp \
|
|
86
|
+
WindowCommand.cpp \
|
|
87
|
+
WindowOpen.cpp \
|
|
88
|
+
WindowClose.cpp \
|
|
69
89
|
Version.cpp \
|
|
70
90
|
EnableLogging.cpp \
|
|
71
91
|
Authenticate.cpp \
|
|
@@ -77,7 +97,7 @@ SOURCES = \
|
|
|
77
97
|
JavascriptConfirmMessages.cpp \
|
|
78
98
|
JavascriptPromptMessages.cpp \
|
|
79
99
|
IgnoreSslErrors.cpp \
|
|
80
|
-
|
|
100
|
+
WindowResize.cpp \
|
|
81
101
|
CurrentUrl.cpp \
|
|
82
102
|
ConsoleMessages.cpp \
|
|
83
103
|
main.cpp \
|
|
@@ -128,7 +148,8 @@ SOURCES = \
|
|
|
128
148
|
JavascriptCommand.cpp \
|
|
129
149
|
FindXpath.cpp \
|
|
130
150
|
NetworkReplyProxy.cpp \
|
|
131
|
-
IgnoreDebugOutput.cpp
|
|
151
|
+
IgnoreDebugOutput.cpp \
|
|
152
|
+
StdinNotifier.cpp
|
|
132
153
|
|
|
133
154
|
RESOURCES = webkit_server.qrc
|
|
134
155
|
QT += network
|
data/templates/Command.cpp
CHANGED