2011-03-30 Robert Hogan <robert@webkit.org>
authorrobert@webkit.org <robert@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Mar 2011 20:14:13 +0000 (20:14 +0000)
committerrobert@webkit.org <robert@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Mar 2011 20:14:13 +0000 (20:14 +0000)
        Reviewed by Antonio Gomes.

        [Qt] Fix LoadHTMLStringItem::invoke() after r75966

        Unskip http/tests/navigation/go-back-to-error-page.html

        https://bugs.webkit.org/show_bug.cgi?id=52614

        * platform/qt/Skipped:
2011-03-30  Robert Hogan  <robert@webkit.org>

        Reviewed by Antonio Gomes.

        [Qt] Fix LoadHTMLStringItem::invoke() after r75966

        Add DRT support for loading an alternate HTML string
        for error pages. This allows Qt to unskip
        http/tests/navigation/go-back-to-error-page.html.

        https://bugs.webkit.org/show_bug.cgi?id=52614

        * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
        (DumpRenderTreeSupportQt::setAlternateHtml):
        * WebCoreSupport/DumpRenderTreeSupportQt.h:
2011-03-30  Robert Hogan  <robert@webkit.org>

        Reviewed by Antonio Gomes.

        [Qt] Fix LoadHTMLStringItem::invoke() after r75966
        Unskip http/tests/navigation/go-back-to-error-page.html

        Also add the location of DumpRenderTreeSupportQt.h
        to DRT's include paths.

        https://bugs.webkit.org/show_bug.cgi?id=52614

        * DumpRenderTree/qt/DumpRenderTree.pro:
        * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
        * DumpRenderTree/qt/DumpRenderTreeQt.h:
        * DumpRenderTree/qt/GCControllerQt.cpp:
        * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
        (LayoutTestController::queueLoadHTMLString):
        * DumpRenderTree/qt/LayoutTestControllerQt.h:
        * DumpRenderTree/qt/PlainTextControllerQt.cpp:
        * DumpRenderTree/qt/TextInputControllerQt.cpp:
        * DumpRenderTree/qt/WorkQueueItemQt.cpp:
        (LoadAlternateHTMLStringItem::invoke):
        * DumpRenderTree/qt/WorkQueueItemQt.h:
        (LoadAlternateHTMLStringItem::LoadAlternateHTMLStringItem):
        * QtTestBrowser/QtTestBrowser.pro:
        * QtTestBrowser/launcherwindow.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@82489 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/qt/Skipped
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h
Tools/ChangeLog
Tools/DumpRenderTree/qt/DumpRenderTree.pro
Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
Tools/DumpRenderTree/qt/DumpRenderTreeQt.h
Tools/DumpRenderTree/qt/GCControllerQt.cpp
Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
Tools/DumpRenderTree/qt/LayoutTestControllerQt.h
Tools/DumpRenderTree/qt/PlainTextControllerQt.cpp
Tools/DumpRenderTree/qt/TextInputControllerQt.cpp
Tools/DumpRenderTree/qt/WorkQueueItemQt.cpp
Tools/DumpRenderTree/qt/WorkQueueItemQt.h
Tools/QtTestBrowser/QtTestBrowser.pro
Tools/QtTestBrowser/launcherwindow.h

index 3673104..cff4bdf 100644 (file)
@@ -1,3 +1,15 @@
+2011-03-30  Robert Hogan  <robert@webkit.org>
+
+        Reviewed by Antonio Gomes.
+
+        [Qt] Fix LoadHTMLStringItem::invoke() after r75966
+
+        Unskip http/tests/navigation/go-back-to-error-page.html
+
+        https://bugs.webkit.org/show_bug.cgi?id=52614
+
+        * platform/qt/Skipped:
+
 2011-03-30  Mihai Parparita  <mihaip@chromium.org>
 
         Fix editing/deleting for Chromium Snow Leopard.
index 3b3d7d4..3b4cca2 100644 (file)
@@ -3174,10 +3174,6 @@ fast/viewport/viewport-128.html
 fast/xmlhttprequest/null-document-xmlhttprequest-open.html
 fast/xmlhttprequest/xmlhttprequest-nonexistent-file.html
 
-# [Qt] Fix LoadHTMLStringItem::invoke() after r75966
-# https://bugs.webkit.org/show_bug.cgi?id=52614
-http/tests/navigation/go-back-to-error-page.html
-
 # [Qt] LayoutTests/media/video-currentTime-delay.html fails
 # https://bugs.webkit.org/show_bug.cgi?id=52859
 media/video-currentTime-delay.html
index 304a6c9..1a922ad 100644 (file)
@@ -1,3 +1,19 @@
+2011-03-30  Robert Hogan  <robert@webkit.org>
+
+        Reviewed by Antonio Gomes.
+
+        [Qt] Fix LoadHTMLStringItem::invoke() after r75966
+
+        Add DRT support for loading an alternate HTML string
+        for error pages. This allows Qt to unskip
+        http/tests/navigation/go-back-to-error-page.html.
+
+        https://bugs.webkit.org/show_bug.cgi?id=52614
+
+        * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
+        (DumpRenderTreeSupportQt::setAlternateHtml):
+        * WebCoreSupport/DumpRenderTreeSupportQt.h:
+
 2011-03-29  Alexis Menard  <alexis.menard@openbossa.org>
 
         Unreviewed build fix for build-webkit -minimal.
index f44a82d..ba712d1 100644 (file)
@@ -950,6 +950,7 @@ QVariantList DumpRenderTreeSupportQt::nodesFromRect(const QWebElement& document,
     return res;
 }
 
+// API Candidate?
 QString DumpRenderTreeSupportQt::responseMimeType(QWebFrame* frame)
 {
     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
@@ -1039,6 +1040,18 @@ QUrl DumpRenderTreeSupportQt::mediaContentUrlByElementId(QWebFrame* frame, const
     return res;
 }
 
+// API Candidate?
+void DumpRenderTreeSupportQt::setAlternateHtml(QWebFrame* frame, const QString& html, const QUrl& baseUrl, const QUrl& failingUrl)
+{
+    KURL kurl(baseUrl);
+    WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
+    WebCore::ResourceRequest request(kurl);
+    const QByteArray utf8 = html.toUtf8();
+    WTF::RefPtr<WebCore::SharedBuffer> data = WebCore::SharedBuffer::create(utf8.constData(), utf8.length());
+    WebCore::SubstituteData substituteData(data, WTF::String("text/html"), WTF::String("utf-8"), failingUrl);
+    coreFrame->loader()->load(request, substituteData, false);
+}
+
 // Provide a backward compatibility with previously exported private symbols as of QtWebKit 4.6 release
 
 void QWEBKIT_EXPORT qt_resumeActiveDOMObjects(QWebFrame* frame)
index 1e7b275..78752d8 100644 (file)
@@ -198,6 +198,7 @@ public:
     static void setMinimumTimerInterval(QWebPage*, double);
 
     static QUrl mediaContentUrlByElementId(QWebFrame*, const QString& elementId);
+    static void setAlternateHtml(QWebFrame*, const QString& html, const QUrl& baseUrl, const QUrl& failingUrl);
 };
 
 #endif
index 8964d0c..c332114 100644 (file)
@@ -1,3 +1,31 @@
+2011-03-30  Robert Hogan  <robert@webkit.org>
+
+        Reviewed by Antonio Gomes.
+
+        [Qt] Fix LoadHTMLStringItem::invoke() after r75966
+        Unskip http/tests/navigation/go-back-to-error-page.html
+
+        Also add the location of DumpRenderTreeSupportQt.h
+        to DRT's include paths.
+
+        https://bugs.webkit.org/show_bug.cgi?id=52614
+
+        * DumpRenderTree/qt/DumpRenderTree.pro:
+        * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
+        * DumpRenderTree/qt/DumpRenderTreeQt.h:
+        * DumpRenderTree/qt/GCControllerQt.cpp:
+        * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
+        (LayoutTestController::queueLoadHTMLString):
+        * DumpRenderTree/qt/LayoutTestControllerQt.h:
+        * DumpRenderTree/qt/PlainTextControllerQt.cpp:
+        * DumpRenderTree/qt/TextInputControllerQt.cpp:
+        * DumpRenderTree/qt/WorkQueueItemQt.cpp:
+        (LoadAlternateHTMLStringItem::invoke):
+        * DumpRenderTree/qt/WorkQueueItemQt.h:
+        (LoadAlternateHTMLStringItem::LoadAlternateHTMLStringItem):
+        * QtTestBrowser/QtTestBrowser.pro:
+        * QtTestBrowser/launcherwindow.h:
+
 2011-03-30  Adam Barth  <abarth@webkit.org>
 
         Reviewed by Adam Roben.
index ee1f511..a76b886 100644 (file)
@@ -9,6 +9,7 @@ include(../../../Source/WebKit.pri)
 INCLUDEPATH += ../../../Source
 INCLUDEPATH += ../../../Source/JavaScriptCore
 INCLUDEPATH += ../../../Source/JavaScriptCore/ForwardingHeaders
+INCLUDEPATH += ../../../Source/WebKit/qt/WebCoreSupport
 INCLUDEPATH += $$BASEDIR
 DESTDIR = ../../bin
 
index e77ba19..97d9f20 100644 (file)
@@ -32,7 +32,7 @@
 #include "config.h"
 
 #include "DumpRenderTreeQt.h"
-#include "../../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h"
+#include "DumpRenderTreeSupportQt.h"
 #include "EventSenderQt.h"
 #include "GCControllerQt.h"
 #include "LayoutTestControllerQt.h"
index e31547e..858856f 100644 (file)
@@ -40,7 +40,7 @@
 #include <QSslError>
 #endif
 
-#include "../../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h"
+#include "DumpRenderTreeSupportQt.h"
 #include <qgraphicsview.h>
 #include <qgraphicswebview.h>
 #include <qwebframe.h>
index 2a30ba8..a2e5e0c 100644 (file)
@@ -29,7 +29,7 @@
 
 #include "config.h"
 #include "GCControllerQt.h"
-#include "../../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h"
+#include "DumpRenderTreeSupportQt.h"
 
 #include <qwebpage.h>
 
index 4e42f8b..4e3087e 100644 (file)
@@ -28,7 +28,7 @@
  */
 #include "config.h"
 #include "LayoutTestControllerQt.h"
-#include "../../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h"
+#include "DumpRenderTreeSupportQt.h"
 
 #include "DumpRenderTreeQt.h"
 #include "WorkQueue.h"
@@ -315,9 +315,12 @@ void LayoutTestController::queueLoad(const QString& url, const QString& target)
     WorkQueue::shared()->queue(new LoadItem(absoluteUrl, target, m_drt->webPage()));
 }
 
-void LayoutTestController::queueLoadHTMLString(const QString& content, const QString& baseURL)
+void LayoutTestController::queueLoadHTMLString(const QString& content, const QString& baseURL, const QString& failingURL)
 {
-    WorkQueue::shared()->queue(new LoadHTMLStringItem(content, baseURL, m_drt->webPage()));
+    if (failingURL.isEmpty())
+        WorkQueue::shared()->queue(new LoadHTMLStringItem(content, baseURL, m_drt->webPage()));
+    else
+        WorkQueue::shared()->queue(new LoadAlternateHTMLStringItem(content, baseURL, failingURL, m_drt->webPage()));
 }
 
 void LayoutTestController::queueReload()
index e34352f..f29233a 100644 (file)
@@ -121,7 +121,7 @@ public slots:
     void queueBackNavigation(int howFarBackward);
     void queueForwardNavigation(int howFarForward);
     void queueLoad(const QString& url, const QString& target = QString());
-    void queueLoadHTMLString(const QString& content, const QString& baseURL = QString());
+    void queueLoadHTMLString(const QString& content, const QString& baseURL = QString(), const QString& failingURL = QString());
     void queueReload();
     void queueLoadingScript(const QString& script);
     void queueNonLoadingScript(const QString& script);
index 729ccd0..dd63fea 100644 (file)
@@ -28,7 +28,7 @@
 #include "config.h"
 #include "PlainTextControllerQt.h"
 
-#include "../../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h"
+#include "DumpRenderTreeSupportQt.h"
 #include <QApplication>
 #include <QInputMethodEvent>
 #include <QKeyEvent>
index 9112674..8cf2e4e 100644 (file)
@@ -28,7 +28,7 @@
  */
 #include "config.h"
 #include "TextInputControllerQt.h"
-#include "../../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h"
+#include "DumpRenderTreeSupportQt.h"
 
 #include <QApplication>
 #include <QInputMethodEvent>
index d1baf08..b093366 100644 (file)
@@ -28,6 +28,7 @@
  */
 #include "config.h"
 #include "WorkQueueItemQt.h"
+#include "DumpRenderTreeSupportQt.h"
 
 QWebFrame* findFrameNamed(const QString& frameName, QWebFrame* frame)
 {
@@ -72,6 +73,18 @@ bool LoadHTMLStringItem::invoke() const
     return true;
 }
 
+bool LoadAlternateHTMLStringItem::invoke() const
+{
+    Q_ASSERT(m_webPage);
+
+    QWebFrame* frame = m_webPage->mainFrame();
+    if (!frame)
+        return false;
+
+    DumpRenderTreeSupportQt::setAlternateHtml(frame, m_content, QUrl(m_baseURL), QUrl(m_failingURL));
+    return true;
+}
+
 bool ReloadItem::invoke() const
 {
     //qDebug() << ">>>ReloadItem::invoke";
index 97c9b04..ac7d1b3 100644 (file)
@@ -80,6 +80,24 @@ private:
     QString m_baseURL;
 };
 
+class LoadAlternateHTMLStringItem : public WorkQueueItem {
+public:
+    LoadAlternateHTMLStringItem(const QString& content, const QString& baseURL,  const QString &failingURL, QWebPage *page)
+        : WorkQueueItem(page)
+        , m_content(content)
+        , m_baseURL(baseURL)
+        , m_failingURL(failingURL)
+    {
+    }
+
+private:
+    virtual bool invoke() const;
+
+    QString m_content;
+    QString m_baseURL;
+    QString m_failingURL;
+};
+
 class ReloadItem : public WorkQueueItem {
 public:
     ReloadItem(QWebPage *page)
index b9ae247..4cd7ecb 100644 (file)
@@ -26,6 +26,7 @@ CONFIG += uitools
 
 isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../..
 include(../../Source/WebKit.pri)
+INCLUDEPATH += ../../Source/WebKit/qt/WebCoreSupport
 
 DESTDIR = $$OUTPUT_DIR/bin
 !CONFIG(standalone_package): CONFIG -= app_bundle
index 24180e2..8bdad4d 100644 (file)
 #include <qx11info_x11.h>
 #endif
 
+#include "DumpRenderTreeSupportQt.h"
 #include "mainwindow.h"
 #include "urlloader.h"
 #include "utils.h"
 #include "webinspector.h"
 #include "webpage.h"
 #include "webview.h"
-#include "../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h"
 
 #ifdef Q_WS_MAEMO_5
 #include <X11/Xatom.h>