Changeset 66597 in webkit


Ignore:
Timestamp:
Sep 1, 2010 5:31:19 AM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-09-01 Mahesh Kulkarni <mahesh.kulkarni@nokia.com>

Reviewed by Laszlo Gombos.

[Qt] QWebPage::allowGeolocationRequest should be async API
https://bugs.webkit.org/show_bug.cgi?id=41364

Enable all geolocation delayed permission layout test for Qt port

  • platform/qt/Skipped:

2010-09-01 Mahesh Kulkarni <mahesh.kulkarni@nokia.com>

Reviewed by Laszlo Gombos.

[Qt] QWebPage::allowGeolocationRequest should be async API
https://bugs.webkit.org/show_bug.cgi?id=41364

Adding GeolocationPermissionClientQt.cpp/h to build script

  • WebCore.pro:

2010-09-01 Mahesh Kulkarni <mahesh.kulkarni@nokia.com>

Reviewed by Laszlo Gombos.

[Qt] QWebPage::allowGeolocationRequest should be async API
https://bugs.webkit.org/show_bug.cgi?id=41364

Provides a new async API for geolocation permission. Using
Notification API approach from qtwebkit. GeolocationPermissionClientQt
maintains list of pending requests from WebCore and intimates them
when client either allowes/denies the request. Also implements
ChromeClientQt::cancelGeolocationPermissionRequestForFrame.

  • Api/qwebpage.cpp: (QWebPage::setUserPermission):
  • Api/qwebpage.h:
  • WebCoreSupport/ChromeClientQt.cpp: (WebCore::ChromeClientQt::requestGeolocationPermissionForFrame): (WebCore::ChromeClientQt::cancelGeolocationPermissionRequestForFrame):
  • WebCoreSupport/ChromeClientQt.h:
  • WebCoreSupport/GeolocationPermissionClientQt.cpp: Added. (WebCore::GeolocationPermissionClientQt::geolocationPermissionClient): (WebCore::GeolocationPermissionClientQt::GeolocationPermissionClientQt): (WebCore::GeolocationPermissionClientQt::~GeolocationPermissionClientQt): (WebCore::GeolocationPermissionClientQt::requestGeolocationPermissionForFrame): (WebCore::GeolocationPermissionClientQt::cancelGeolocationPermissionRequestForFrame): (WebCore::GeolocationPermissionClientQt::setPermission):
  • WebCoreSupport/GeolocationPermissionClientQt.h: Added.
  • tests/qwebpage/tst_qwebpage.cpp: (JSTestPage::requestPermission): (tst_QWebPage::geolocationRequestJS):

2010-09-01 Mahesh Kulkarni <mahesh.kulkarni@nokia.com>

Reviewed by Laszlo Gombos.

[Qt] QWebPage::allowGeolocationRequest should be async API
https://bugs.webkit.org/show_bug.cgi?id=41364

Implements new async API for geolocation permission similar to
Notification. WebPage maintains list of geolocation permission request
QtWebkit and set's when LayoutTestController gets the access from test JS

  • DumpRenderTree/qt/DumpRenderTreeQt.cpp: (WebCore::WebPage::WebPage): (WebCore::WebPage::resetSettings): (WebCore::WebPage::requestPermission): (WebCore::WebPage::cancelPermission): (WebCore::WebPage::permissionSet): (WebCore::DumpRenderTree::DumpRenderTree): (WebCore::DumpRenderTree::processLine): (WebCore::DumpRenderTree::geolocationPermissionSet):
  • DumpRenderTree/qt/DumpRenderTreeQt.h:
  • DumpRenderTree/qt/LayoutTestControllerQt.cpp: (LayoutTestController::reset): (LayoutTestController::setGeolocationPermission): (LayoutTestController::setGeolocationPermissionCommon):
  • DumpRenderTree/qt/LayoutTestControllerQt.h:
Location:
trunk
Files:
2 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r66596 r66597  
     12010-09-01  Mahesh Kulkarni  <mahesh.kulkarni@nokia.com>
     2
     3        Reviewed by Laszlo Gombos.
     4
     5        [Qt] QWebPage::allowGeolocationRequest should be async API
     6        https://bugs.webkit.org/show_bug.cgi?id=41364
     7
     8        Enable all geolocation delayed permission layout test for Qt port
     9
     10        * platform/qt/Skipped:
     11
    1122010-09-01  Pavel Podivilov  <podivilov@chromium.org>
    213
  • trunk/LayoutTests/platform/qt/Skipped

    r66470 r66597  
    54365436fast/events/special-key-events-in-input-text.html
    54375437
    5438 # [Qt] DumpRenderTree lacks functionality for new Geolocation delayed permission tests
    5439 # https://bugs.webkit.org/show_bug.cgi?id=41364
    5440 fast/dom/Geolocation/delayed-permission-allowed.html
    5441 fast/dom/Geolocation/delayed-permission-denied.html
    5442 fast/dom/Geolocation/delayed-permission-allowed-for-multiple-requests.html
    5443 fast/dom/Geolocation/delayed-permission-denied-for-multiple-requests.html
    5444 
    54455438# Still working out flakiness issues with the perf tests.
    54465439# https://bugs.webkit.org/show_bug.cgi?id=44199
  • trunk/WebCore/ChangeLog

    r66590 r66597  
     12010-09-01  Mahesh Kulkarni  <mahesh.kulkarni@nokia.com>
     2
     3        Reviewed by Laszlo Gombos.
     4
     5        [Qt] QWebPage::allowGeolocationRequest should be async API
     6        https://bugs.webkit.org/show_bug.cgi?id=41364
     7
     8        Adding GeolocationPermissionClientQt.cpp/h to build script
     9
     10        * WebCore.pro:
     11
    1122010-09-01  Andreas Kling  <andreas.kling@nokia.com>
    213
  • trunk/WebCore/WebCore.pro

    r66586 r66597  
    22202220    $$PWD/../WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h \
    22212221    $$PWD/../WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.h \
     2222    $$PWD/../WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.h \
    22222223    $$PWD/../WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h \
    22232224    $$PWD/../WebKit/qt/WebCoreSupport/PageClientQt.h \
     
    23122313    ../WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp \
    23132314    ../WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp \
     2315    ../WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.cpp \
    23142316    ../WebKit/qt/WebCoreSupport/InspectorClientQt.cpp \
    23152317    ../WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp \
  • trunk/WebKit/qt/Api/qwebpage.cpp

    r66221 r66597  
    8282#include "runtime/InitializeThreading.h"
    8383#include "PageGroup.h"
     84#include "GeolocationPermissionClientQt.h"
    8485#include "NotificationPresenterClientQt.h"
    8586#include "PageClientQt.h"
     
    20832084}
    20842085
    2085 /*!
    2086     \fn bool QWebPage::allowGeolocationRequest()
    2087     \since 4.7
    2088 
    2089     This function is called whenever a JavaScript program running inside \a frame tries to access user location through navigator.geolocation.
    2090 
    2091     If the user wants to allow access to location then it should return true; otherwise false.
    2092 
    2093     The default implementation executes the query using QMessageBox::information with QMessageBox::Yes and QMessageBox::No buttons.
    2094 
    2095     \warning Because of binary compatibility constraints, this function is not virtual. If you want to
    2096     provide your own implementation in a QWebPage subclass, reimplement the allowGeolocationRequest()
    2097     slot in your subclass instead. QtWebKit will dynamically detect the slot and call it.
    2098 */
    2099 bool QWebPage::allowGeolocationRequest(QWebFrame *frame)
    2100 {
    2101 #ifdef QT_NO_MESSAGEBOX
    2102     return false;
    2103 #else
    2104     QWidget* parent = (d->client) ? d->client->ownerWidget() : 0;
    2105     return QMessageBox::Yes == QMessageBox::information(parent, tr("Location Request by- %1").arg(frame->url().host()), tr("The page wants to access your location information. Do you want to allow the request?"), QMessageBox::Yes, QMessageBox::No);
    2106 #endif
    2107 }
    2108 
    21092086void QWebPage::setUserPermission(QWebFrame* frame, PermissionDomain domain, PermissionPolicy policy)
    21102087{
     
    21162093#endif
    21172094        break;
     2095    case GeolocationPermissionDomain:
     2096#if ENABLE(GEOLOCATION)
     2097        GeolocationPermissionClientQt::geolocationPermissionClient()->setPermission(frame, policy);
     2098#endif
     2099        break;
     2100
    21182101    default:
    21192102        break;
  • trunk/WebKit/qt/Api/qwebpage.h

    r64825 r66597  
    5858    class InspectorFrontendClientQt;
    5959    class NotificationPresenterClientQt;
     60    class GeolocationPermissionClientQt;
    6061    class ResourceHandle;
    6162    class HitTestResult;
     
    203204
    204205    enum PermissionDomain {
    205         NotificationsPermissionDomain
     206        NotificationsPermissionDomain,
     207        GeolocationPermissionDomain
    206208    };
    207209
     
    352354public Q_SLOTS:
    353355    bool shouldInterruptJavaScript();
    354     bool allowGeolocationRequest(QWebFrame *frame);
    355356
    356357Q_SIGNALS:
     
    425426    friend class WebCore::InspectorFrontendClientQt;
    426427    friend class WebCore::NotificationPresenterClientQt;
     428    friend class WebCore::GeolocationPermissionClientQt;
    427429    friend class WebCore::ResourceHandle;
    428430    friend class WebCore::QNetworkReplyHandler;
  • trunk/WebKit/qt/ChangeLog

    r66577 r66597  
     12010-09-01  Mahesh Kulkarni  <mahesh.kulkarni@nokia.com>
     2
     3        Reviewed by Laszlo Gombos.
     4
     5        [Qt] QWebPage::allowGeolocationRequest should be async API
     6        https://bugs.webkit.org/show_bug.cgi?id=41364
     7
     8        Provides a new async API for geolocation permission. Using
     9        Notification API approach from qtwebkit. GeolocationPermissionClientQt
     10        maintains list of pending requests from WebCore and intimates them
     11        when client either allowes/denies the request. Also implements
     12        ChromeClientQt::cancelGeolocationPermissionRequestForFrame. 
     13
     14        * Api/qwebpage.cpp:
     15        (QWebPage::setUserPermission):
     16        * Api/qwebpage.h:
     17        * WebCoreSupport/ChromeClientQt.cpp:
     18        (WebCore::ChromeClientQt::requestGeolocationPermissionForFrame):
     19        (WebCore::ChromeClientQt::cancelGeolocationPermissionRequestForFrame):
     20        * WebCoreSupport/ChromeClientQt.h:
     21        * WebCoreSupport/GeolocationPermissionClientQt.cpp: Added.
     22        (WebCore::GeolocationPermissionClientQt::geolocationPermissionClient):
     23        (WebCore::GeolocationPermissionClientQt::GeolocationPermissionClientQt):
     24        (WebCore::GeolocationPermissionClientQt::~GeolocationPermissionClientQt):
     25        (WebCore::GeolocationPermissionClientQt::requestGeolocationPermissionForFrame):
     26        (WebCore::GeolocationPermissionClientQt::cancelGeolocationPermissionRequestForFrame):
     27        (WebCore::GeolocationPermissionClientQt::setPermission):
     28        * WebCoreSupport/GeolocationPermissionClientQt.h: Added.
     29        * tests/qwebpage/tst_qwebpage.cpp:
     30        (JSTestPage::requestPermission):
     31        (tst_QWebPage::geolocationRequestJS):
     32
    1332010-08-31  Dave Hyatt  <hyatt@apple.com>
    234
  • trunk/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp

    r66182 r66597  
    4242#include "GraphicsLayerQt.h"
    4343#endif
     44#include "GeolocationPermissionClientQt.h"
    4445#include "HitTestResult.h"
    4546#include "Icon.h"
     
    568569void ChromeClientQt::requestGeolocationPermissionForFrame(Frame* frame, Geolocation* geolocation)
    569570{
    570     bool allow = false;
     571#if ENABLE(GEOLOCATION)
    571572    QWebFrame* webFrame = QWebFramePrivate::kit(frame);
    572     QMetaObject::invokeMethod(m_webPage, "allowGeolocationRequest", Qt::DirectConnection, Q_RETURN_ARG(bool, allow), Q_ARG(QWebFrame*, webFrame));
    573     geolocation->setIsAllowed(allow);
     573    GeolocationPermissionClientQt::geolocationPermissionClient()->requestGeolocationPermissionForFrame(webFrame, geolocation);
     574#endif
     575}
     576
     577void ChromeClientQt::cancelGeolocationPermissionRequestForFrame(Frame* frame, Geolocation* geolocation)
     578{
     579#if ENABLE(GEOLOCATION)
     580    QWebFrame* webFrame = QWebFramePrivate::kit(frame);
     581    GeolocationPermissionClientQt::geolocationPermissionClient()->cancelGeolocationPermissionRequestForFrame(webFrame, geolocation);
     582#endif
    574583}
    575584
  • trunk/WebKit/qt/WebCoreSupport/ChromeClientQt.h

    r65021 r66597  
    169169
    170170        virtual void requestGeolocationPermissionForFrame(Frame*, Geolocation*);
    171         virtual void cancelGeolocationPermissionRequestForFrame(Frame*, Geolocation*) { }
     171        virtual void cancelGeolocationPermissionRequestForFrame(Frame*, Geolocation*);
    172172
    173173        virtual bool selectItemWritingDirectionIsNatural();
  • trunk/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp

    r66565 r66597  
    218218        return true;
    219219    }
    220     bool allowGeolocationRequest(QWebFrame *frame)
    221     {
    222         return m_allowGeolocation;
     220    void requestPermission(QWebFrame* frame, QWebPage::PermissionDomain domain)
     221    {
     222        if (m_allowGeolocation)
     223            setUserPermission(frame, domain, PermissionGranted);
     224        else
     225            setUserPermission(frame, domain, PermissionDenied);
    223226    }
    224227
     
    245248{
    246249    JSTestPage* newPage = new JSTestPage(m_view);
     250    connect(newPage, SIGNAL(requestPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain)),
     251            newPage, SLOT(requestPermission(QWebFrame*, QWebPage::PermissionDomain)));
     252
    247253    newPage->setGeolocationPermission(false);
    248254    m_view->setPage(newPage);
  • trunk/WebKitTools/ChangeLog

    r66592 r66597  
     12010-09-01  Mahesh Kulkarni  <mahesh.kulkarni@nokia.com>
     2
     3        Reviewed by Laszlo Gombos.
     4
     5        [Qt] QWebPage::allowGeolocationRequest should be async API
     6        https://bugs.webkit.org/show_bug.cgi?id=41364
     7
     8        Implements new async API for geolocation permission similar to
     9        Notification. WebPage maintains list of geolocation permission request
     10        QtWebkit and set's when LayoutTestController gets the access from test JS
     11
     12        * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
     13        (WebCore::WebPage::WebPage):
     14        (WebCore::WebPage::resetSettings):
     15        (WebCore::WebPage::requestPermission):
     16        (WebCore::WebPage::cancelPermission):
     17        (WebCore::WebPage::permissionSet):
     18        (WebCore::DumpRenderTree::DumpRenderTree):
     19        (WebCore::DumpRenderTree::processLine):
     20        (WebCore::DumpRenderTree::geolocationPermissionSet):
     21        * DumpRenderTree/qt/DumpRenderTreeQt.h:
     22        * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
     23        (LayoutTestController::reset):
     24        (LayoutTestController::setGeolocationPermission):
     25        (LayoutTestController::setGeolocationPermissionCommon):
     26        * DumpRenderTree/qt/LayoutTestControllerQt.h:
     27
    1282010-09-01  Andras Becsi  <abecsi@webkit.org>
    229
  • trunk/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp

    r66092 r66597  
    160160    connect(this, SIGNAL(requestPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain)), this, SLOT(requestPermission(QWebFrame*, QWebPage::PermissionDomain)));
    161161    connect(this, SIGNAL(checkPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain, QWebPage::PermissionPolicy&)), this, SLOT(checkPermission(QWebFrame*, QWebPage::PermissionDomain, QWebPage::PermissionPolicy&)));
    162     connect(this, SIGNAL(cancelRequestsForPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain)), this, SLOT(cancelRequestsForPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain)));
     162    connect(this, SIGNAL(cancelRequestsForPermission(QWebFrame*, QWebPage::PermissionDomain)), this, SLOT(cancelPermission(QWebFrame*, QWebPage::PermissionDomain)));
    163163}
    164164
     
    203203    QWebSettings::setMaximumPagesInCache(0); // reset to default
    204204    settings()->setUserStyleSheetUrl(QUrl()); // reset to default
     205
     206    m_pendingGeolocationRequests.clear();
    205207}
    206208
     
    224226        if (!m_drt->layoutTestController()->ignoreReqestForPermission())
    225227            setUserPermission(frame, domain, PermissionGranted);
     228        break;
     229    case GeolocationPermissionDomain:
     230        if (m_drt->layoutTestController()->isGeolocationPermissionSet())
     231            if (m_drt->layoutTestController()->geolocationPermission())
     232                setUserPermission(frame, domain, PermissionGranted);
     233            else
     234                setUserPermission(frame, domain, PermissionDenied);
     235        else
     236            m_pendingGeolocationRequests.append(frame);
    226237        break;
    227238    default:
     
    244255}
    245256
    246 void WebPage::cancelRequestsForPermission(QWebFrame*, QWebPage::PermissionDomain)
    247 {
     257void WebPage::cancelPermission(QWebFrame* frame, QWebPage::PermissionDomain domain)
     258{
     259    switch (domain) {
     260    case GeolocationPermissionDomain:
     261        m_pendingGeolocationRequests.removeOne(frame);
     262        break;
     263    default:
     264        break;
     265    }
     266}
     267
     268void WebPage::permissionSet(QWebPage::PermissionDomain domain)
     269{
     270    switch (domain) {
     271    case GeolocationPermissionDomain:
     272        {
     273        Q_ASSERT(m_drt->layoutTestController()->isGeolocationPermissionSet());
     274        foreach (QWebFrame* frame, m_pendingGeolocationRequests)
     275            if (m_drt->layoutTestController()->geolocationPermission())
     276                setUserPermission(frame, domain, PermissionGranted);
     277            else
     278                setUserPermission(frame, domain, PermissionDenied);
     279
     280        m_pendingGeolocationRequests.clear();
     281        break;
     282        }
     283    default:
     284        break;
     285    }
    248286}
    249287
     
    368406}
    369407
    370 bool WebPage::allowGeolocationRequest(QWebFrame *)
    371 {
    372     return m_drt->layoutTestController()->geolocationPermission();
    373 }
    374 
    375408void WebPage::setViewGeometry(const QRect& rect)
    376409{
     
    432465    connect(m_controller, SIGNAL(hidePage()), this, SLOT(hidePage()));
    433466
     467    // async geolocation permission set by controller
     468    connect(m_controller, SIGNAL(geolocationPermissionSet()), this, SLOT(geolocationPermissionSet()));
     469
    434470    connect(m_controller, SIGNAL(done()), this, SLOT(dump()));
    435471    m_eventSender = new EventSender(m_page);
     
    674710                return;
    675711            }
    676 
    677712        }
    678713
     
    10271062}
    10281063
     1064void DumpRenderTree::geolocationPermissionSet()
     1065{
     1066    m_page->permissionSet(QWebPage::GeolocationPermissionDomain);
     1067}
     1068
    10291069void DumpRenderTree::switchFocus(bool focused)
    10301070{
  • trunk/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h

    r66092 r66597  
    128128    void dryRunPrint(QWebFrame*);
    129129    void loadNextTestInStandAloneMode();
     130    void geolocationPermissionSet();
    130131
    131132private:
     
    192193    QObject* createPlugin(const QString&, const QUrl&, const QStringList&, const QStringList&);
    193194
     195    void permissionSet(QWebPage::PermissionDomain domain);
     196
    194197public slots:
    195198    bool shouldInterruptJavaScript() { return false; }
    196     bool allowGeolocationRequest(QWebFrame *frame);
    197199    void requestPermission(QWebFrame* frame, QWebPage::PermissionDomain domain);
    198200    void checkPermission(QWebFrame* frame, QWebPage::PermissionDomain domain, QWebPage::PermissionPolicy& policy);
    199     void cancelRequestsForPermission(QWebFrame* frame, QWebPage::PermissionDomain domain);
     201    void cancelPermission(QWebFrame* frame, QWebPage::PermissionDomain domain);
    200202
    201203protected:
     
    208210private:
    209211    QWebInspector* m_webInspector;
     212    QList<QWebFrame*> m_pendingGeolocationRequests;
    210213    DumpRenderTree *m_drt;
    211214};
  • trunk/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp

    r65107 r66597  
    6969    m_desktopNotificationAllowedOrigins.clear();
    7070    m_ignoreDesktopNotification = false;
     71    m_isGeolocationPermissionSet = false;
     72    m_geolocationPermission = false;
    7173
    7274    DumpRenderTreeSupportQt::dumpEditingCallbacks(false);
     
    716718void LayoutTestController::setGeolocationPermission(bool allow)
    717719{
     720    setGeolocationPermissionCommon(allow);
     721    emit geolocationPermissionSet();
     722}
     723
     724void LayoutTestController::setGeolocationPermissionCommon(bool allow)
     725{
    718726     m_isGeolocationPermissionSet = true;
    719727     m_geolocationPermission = allow;
  • trunk/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h

    r65107 r66597  
    8686    void showPage();
    8787    void hidePage();
     88    void geolocationPermissionSet();
    8889
    8990public slots:
     
    240241
    241242private:
     243    void setGeolocationPermissionCommon(bool allow);
     244
     245private:
    242246    bool m_hasDumped;
    243247    bool m_textDump;
Note: See TracChangeset for help on using the changeset viewer.