Skip to content

Commit

Permalink
Merge in upstream changes for requested URL command and more.
Browse files Browse the repository at this point in the history
  • Loading branch information
tristandunn committed Jan 27, 2012
1 parent 1c8fe9b commit da8aecc
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/CommandFactory.cpp
Expand Up @@ -19,6 +19,7 @@
#include "GetCookies.h"
#include "SetProxy.h"
#include "ConsoleMessages.h"
#include "RequestedUrl.h"

CommandFactory::CommandFactory(WebPage *page, QObject *parent) : QObject(parent) {
m_page = page;
Expand Down
15 changes: 15 additions & 0 deletions src/RequestedUrl.cpp
@@ -0,0 +1,15 @@
#include "RequestedUrl.h"
#include "WebPage.h"

RequestedUrl::RequestedUrl(WebPage *page, QObject *parent) : Command(page, parent) {
}

void RequestedUrl::start(QStringList &arguments) {
Q_UNUSED(arguments);

QUrl humanUrl = page()->currentFrame()->requestedUrl();
QByteArray encodedBytes = humanUrl.toEncoded();
QString urlString = QString(encodedBytes);
emit finished(new Response(true, urlString));
}

12 changes: 12 additions & 0 deletions src/RequestedUrl.h
@@ -0,0 +1,12 @@
#include "Command.h"

class WebPage;

class RequestedUrl : public Command {
Q_OBJECT

public:
RequestedUrl(WebPage *page, QObject *parent = 0);
virtual void start(QStringList &arguments);
};

2 changes: 1 addition & 1 deletion src/Visit.cpp
Expand Up @@ -7,7 +7,7 @@ Visit::Visit(WebPage *page, QObject *parent) : Command(page, parent) {
}

void Visit::start(QStringList &arguments) {
QUrl requestedUrl = QUrl(arguments[0]);
QUrl requestedUrl = QUrl::fromEncoded(arguments[0].toUtf8(), QUrl::StrictMode);
page()->currentFrame()->load(QUrl(requestedUrl));
}

Expand Down
3 changes: 2 additions & 1 deletion src/find_command.h
Expand Up @@ -22,4 +22,5 @@ CHECK_COMMAND(ClearCookies)
CHECK_COMMAND(GetCookies)
CHECK_COMMAND(Headers)
CHECK_COMMAND(SetProxy)
CHECK_COMMAND(ConsoleMessages)
CHECK_COMMAND(ConsoleMessages)
CHECK_COMMAND(RequestedUrl)
6 changes: 3 additions & 3 deletions src/webkit_server.js
Expand Up @@ -103,7 +103,7 @@ window.WebKitServer = {
set: function(index, value) {
var node = this.nodes[index],
type = (node.type || node.tagName).toLowerCase(),
textTypes = ["email", "password", "search", "text", "textarea", "url"];
textTypes = ["email", "number", "password", "search", "tel", "text", "textarea", "url"];

if (textTypes.indexOf(type) !== -1) {
this.trigger(index, "focus");
Expand All @@ -127,12 +127,12 @@ window.WebKitServer = {

this.trigger(index, "change");
this.trigger(index, "blur");
} else if (type == "checkbox" || type == "radio") {
} else if (type === "checkbox" || type === "radio") {
node.checked = (value == "true");

this.trigger(index, "click");
this.trigger(index, "change");
} else if (type == "file") {
} else if (type === "file") {
this.lastAttachedFile = value;
this.trigger(index, "click");
} else {
Expand Down
3 changes: 3 additions & 0 deletions src/webkit_server.pro
Expand Up @@ -2,6 +2,7 @@ TEMPLATE = app
TARGET = webkit_server
DESTDIR = .
HEADERS = \
RequestedUrl.h \
ConsoleMessages.h \
WebPage.h \
Server.h \
Expand Down Expand Up @@ -34,6 +35,7 @@ HEADERS = \
SetProxy.h \

SOURCES = \
RequestedUrl.cpp \
ConsoleMessages.cpp \
main.cpp \
WebPage.cpp \
Expand Down Expand Up @@ -70,3 +72,4 @@ RESOURCES = webkit_server.qrc
QT += network webkit
CONFIG += console
CONFIG -= app_bundle

0 comments on commit da8aecc

Please sign in to comment.