mirror of
https://github.com/thoughtbot/capybara-webkit
synced 2023-03-27 23:22:28 -04:00
Remove Qt 4.7 compatibility code from CurrentUrl
This commit is contained in:
parent
2ceab4e525
commit
c3eb16b87e
3 changed files with 0 additions and 22 deletions
|
@ -6,24 +6,9 @@ CurrentUrl::CurrentUrl(WebPageManager *manager, QStringList &arguments, QObject
|
|||
}
|
||||
|
||||
void CurrentUrl::start() {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)
|
||||
QStringList arguments;
|
||||
QVariant result = page()->invokeCapybaraFunction("currentUrl", arguments);
|
||||
QString url = result.toString();
|
||||
emit finished(new Response(true, url));
|
||||
#else
|
||||
QUrl humanUrl = wasRedirectedAndNotModifiedByJavascript() ?
|
||||
page()->currentFrame()->url() : page()->currentFrame()->requestedUrl();
|
||||
QByteArray encodedBytes = humanUrl.toEncoded();
|
||||
emit finished(new Response(true, encodedBytes));
|
||||
}
|
||||
|
||||
bool CurrentUrl::wasRegularLoad() {
|
||||
return page()->currentFrame()->url() == page()->currentFrame()->requestedUrl();
|
||||
}
|
||||
|
||||
bool CurrentUrl::wasRedirectedAndNotModifiedByJavascript() {
|
||||
return !wasRegularLoad() && page()->currentFrame()->url() == page()->history()->currentItem().url();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -6,11 +6,5 @@ class CurrentUrl : public SocketCommand {
|
|||
public:
|
||||
CurrentUrl(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
#if QT_VERSION < QT_VERSION_CHECK(4, 8, 0)
|
||||
|
||||
private:
|
||||
bool wasRegularLoad();
|
||||
bool wasRedirectedAndNotModifiedByJavascript();
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ WebPage::WebPage(WebPageManager *manager, QObject *parent) : QWebPage(parent) {
|
|||
resetWindowSize();
|
||||
|
||||
settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
|
||||
currentFrame()->setUrl(QUrl("about:blank"));
|
||||
}
|
||||
|
||||
void WebPage::resetWindowSize() {
|
||||
|
|
Loading…
Reference in a new issue