Permalink
Browse files

Merge in upstream changes for requested URL command and more.

  • Loading branch information...
1 parent 1c8fe9b commit da8aeccd35f99749814fd12ec47159d3307447bd @tristandunn committed Jan 27, 2012
Showing with 37 additions and 5 deletions.
  1. +1 −0 src/CommandFactory.cpp
  2. +15 −0 src/RequestedUrl.cpp
  3. +12 −0 src/RequestedUrl.h
  4. +1 −1 src/Visit.cpp
  5. +2 −1 src/find_command.h
  6. +3 −3 src/webkit_server.js
  7. +3 −0 src/webkit_server.pro
View
@@ -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;
View
@@ -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));
+}
+
View
@@ -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);
+};
+
View
@@ -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));
}
View
@@ -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)
View
@@ -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");
@@ -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 {
View
@@ -2,6 +2,7 @@ TEMPLATE = app
TARGET = webkit_server
DESTDIR = .
HEADERS = \
+ RequestedUrl.h \
ConsoleMessages.h \
WebPage.h \
Server.h \
@@ -34,6 +35,7 @@ HEADERS = \
SetProxy.h \
SOURCES = \
+ RequestedUrl.cpp \
ConsoleMessages.cpp \
main.cpp \
WebPage.cpp \
@@ -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.