This repository has been archived by the owner on Mar 3, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add command to retrieve URL modified by Javascript
If I use pushState to change the URL Browser#current_url still returns the URL as it was after the original request. This commit adds a command for RequestedUrl, which is the QtWebkit method for retrieving a URL modified by Javascript or a redirect.
- Loading branch information
1 parent
6ba9dcb
commit 89f2cf0
Showing
8 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters