Changeset 78817 in webkit


Ignore:
Timestamp:
Feb 17, 2011 5:39:46 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-02-17 Hui Huang <hui.2.huang@nokia.com>

Reviewed by Laszlo Gombos.

The URL of HTML5 Video Element is percent encoded at websites such as youtube.
It is percent encoded again by QUrl constructor QUrl::QUrl(QString). This causes
the HTTP GET request for the video to be rejected by the service provider.
https://bugs.webkit.org/show_bug.cgi?id=53973.

The bug is fixed by constructing QUrl from the encoded URL.

New test function tst_QWebPage::loadHtml5Video() is added in
Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp

  • platform/graphics/qt/MediaPlayerPrivateQt.cpp: (WebCore::MediaPlayerPrivateQt::commitLoad):

2011-02-17 Hui Huang <hui.2.huang@nokia.com>

Reviewed by Laszlo Gombos.

The URL of HTML5 Video Element is percent encoded at websites such as youtube.
It is percent encoded again by QUrl constructor QUrl::QUrl(QString). This causes
the HTTP GET request for the video to be rejected by the service provider.
https://bugs.webkit.org/show_bug.cgi?id=53973.

The bug is fixed by constructing QUrl from the encoded URL in
MediaPlayerPrivateQt::commitLoad.

New test function tst_QWebPage::loadHtml5Video() is added to load HTML content with
HTML5 Video element. A new public method DumpRenderTreeSupportQt::mediaContentUrlByElementId
is added to retrieve the URL of the media content from WebCore MediaPlayerPrivateQt.
A new macro ENABLE_QT_MULTIMEDIA is introduced in tests.pri to make sure that the test
is skipped if Qt Multimedia is not available.

  • WebCoreSupport/DumpRenderTreeSupportQt.cpp: (DumpRenderTreeSupportQt::mediaContentUrlByElementId):
  • WebCoreSupport/DumpRenderTreeSupportQt.h:
  • tests/qwebpage/tst_qwebpage.cpp: (tst_QWebPage::loadHtml5Video):
  • tests/tests.pri:
Location:
trunk/Source
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r78816 r78817  
     12011-02-17  Hui Huang  <hui.2.huang@nokia.com>
     2
     3        Reviewed by Laszlo Gombos.
     4
     5        The URL of HTML5 Video Element is percent encoded at websites such as youtube.
     6        It is percent encoded again by QUrl constructor QUrl::QUrl(QString). This causes
     7        the HTTP GET request for the video to be rejected by the service provider.
     8        https://bugs.webkit.org/show_bug.cgi?id=53973.
     9
     10        The bug is fixed by constructing QUrl from the encoded URL.
     11
     12        New test function tst_QWebPage::loadHtml5Video() is added in
     13        Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
     14
     15        * platform/graphics/qt/MediaPlayerPrivateQt.cpp:
     16        (WebCore::MediaPlayerPrivateQt::commitLoad):
     17
    1182011-02-17  Andreas Kling  <kling@webkit.org>
    219
  • trunk/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp

    r78263 r78817  
    188188    }
    189189
    190     const QUrl rUrl = QUrl(QString(url));
     190    KURL kUrl(ParsedURLString, url);
     191    const QUrl rUrl = kUrl;
    191192    const QString scheme = rUrl.scheme().toLower();
    192193
  • trunk/Source/WebKit/qt/ChangeLog

    r78816 r78817  
     12011-02-17  Hui Huang  <hui.2.huang@nokia.com>
     2
     3        Reviewed by Laszlo Gombos.
     4
     5        The URL of HTML5 Video Element is percent encoded at websites such as youtube.
     6        It is percent encoded again by QUrl constructor QUrl::QUrl(QString). This causes
     7        the HTTP GET request for the video to be rejected by the service provider.
     8        https://bugs.webkit.org/show_bug.cgi?id=53973.
     9
     10        The bug is fixed by constructing QUrl from the encoded URL in
     11        MediaPlayerPrivateQt::commitLoad.
     12
     13        New test function tst_QWebPage::loadHtml5Video() is added to load HTML content with
     14        HTML5 Video element. A new public method DumpRenderTreeSupportQt::mediaContentUrlByElementId
     15        is added to retrieve the URL of the media content from WebCore MediaPlayerPrivateQt.
     16        A new macro ENABLE_QT_MULTIMEDIA is introduced in tests.pri to make sure that the test
     17        is skipped if Qt Multimedia is not available.
     18
     19        * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
     20        (DumpRenderTreeSupportQt::mediaContentUrlByElementId):
     21        * WebCoreSupport/DumpRenderTreeSupportQt.h:
     22        * tests/qwebpage/tst_qwebpage.cpp:
     23        (tst_QWebPage::loadHtml5Video):
     24        * tests/tests.pri:
     25
    1262011-02-17  Andreas Kling  <kling@webkit.org>
    227
  • trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp

    r78620 r78817  
    8181#include "qwebscriptworld.h"
    8282
     83#if ENABLE(VIDEO) && ENABLE(QT_MULTIMEDIA)
     84#include "HTMLVideoElement.h"
     85#include "MediaPlayerPrivateQt.h"
     86#endif
     87
    8388using namespace WebCore;
    8489
     
    958963}
    959964
     965QUrl DumpRenderTreeSupportQt::mediaContentUrlByElementId(QWebFrame* frame, const QString& elementId)
     966{
     967    QUrl res;
     968
     969#if ENABLE(VIDEO) && ENABLE(QT_MULTIMEDIA)
     970    Frame* coreFrame = QWebFramePrivate::core(frame);
     971    if (!coreFrame)
     972        return res;
     973
     974    Document* doc = coreFrame->document();
     975    if (!doc)
     976        return res;
     977
     978    Node* coreNode = doc->getElementById(elementId);
     979    if (!coreNode)
     980        return res;
     981
     982    HTMLVideoElement* videoElement = static_cast<HTMLVideoElement*>(coreNode);
     983    PlatformMedia platformMedia = videoElement->platformMedia();
     984    if (platformMedia.type != PlatformMedia::QtMediaPlayerType)
     985        return res;
     986
     987    MediaPlayerPrivateQt* mediaPlayerQt = static_cast<MediaPlayerPrivateQt*>(platformMedia.media.qtMediaPlayer);
     988    if (mediaPlayerQt && mediaPlayerQt->mediaPlayer())
     989        res = mediaPlayerQt->mediaPlayer()->media().canonicalUrl();
     990#endif
     991
     992    return res;
     993}
     994
    960995// Provide a backward compatibility with previously exported private symbols as of QtWebKit 4.6 release
    961996
  • trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h

    r78620 r78817  
    5252class QWebHistoryItem;
    5353class QWebScriptWorld;
     54class QUrl;
    5455
    5556extern QMap<int, QWebScriptWorld*> m_worldMap;
     
    193194    static double defaultMinimumTimerInterval(); // Not really tied to WebView
    194195    static void setMinimumTimerInterval(QWebPage*, double);
     196
     197    static QUrl mediaContentUrlByElementId(QWebFrame*, const QString& elementId);
    195198};
    196199
  • trunk/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp

    r78490 r78817  
    8686    void acceptNavigationRequestWithNewWindow();
    8787    void userStyleSheet();
     88    void loadHtml5Video();
    8889    void modified();
    8990    void contextMenuCrash();
     
    428429    QVERIFY(networkManager->requestedUrls.count() >= 1);
    429430    QCOMPARE(networkManager->requestedUrls.at(0), QUrl("http://does.not/exist.png"));
     431}
     432
     433void tst_QWebPage::loadHtml5Video()
     434{
     435#if defined(ENABLE_QT_MULTIMEDIA) && ENABLE_QT_MULTIMEDIA
     436    QByteArray url("http://does.not/exist?a=1%2Cb=2");
     437    m_view->setHtml("<p><video id ='video' src='" + url + "' autoplay/></p>");
     438    QTest::qWait(2000);
     439    QUrl mUrl = DumpRenderTreeSupportQt::mediaContentUrlByElementId(m_page->mainFrame(), "video");
     440    QCOMPARE(mUrl.toEncoded(), url);
     441#else
     442    QSKIP("This test requires Qt Multimedia", SkipAll);
     443#endif
    430444}
    431445
  • trunk/Source/WebKit/qt/tests/tests.pri

    r76496 r78817  
    66CONFIG(QTDIR_build) { load(qttest_p4) }
    77ELSE { TARGET = tst_$$TARGET }
     8
     9# Load mobilityconfig if Qt Mobility is available
     10load(mobilityconfig, true)
     11contains(MOBILITY_CONFIG, multimedia) {
     12    # This define is used by tests depending on Qt Multimedia
     13    DEFINES -= ENABLE_QT_MULTIMEDIA=0
     14    DEFINES += ENABLE_QT_MULTIMEDIA=1
     15}
     16
    817SOURCES += $${TARGET}.cpp
    918INCLUDEPATH += \
Note: See TracChangeset for help on using the changeset viewer.