[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

hausmann at webkit.org hausmann at webkit.org
Wed Dec 22 15:54:48 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit ed8997b72a1707b0c1d96c4c281f29d33b982da1
Author: hausmann at webkit.org <hausmann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 16 16:28:14 2010 +0000

    [Qt] Remove synchronous QWebPage::checkPermissions signal
    https://bugs.webkit.org/show_bug.cgi?id=46810
    
    Reviewed by Andreas Kling.
    
    WebKit/qt:
    
    As decided in the API review, we remove this signal and replace its only use currently
    with cached credentials.
    
    * Api/qwebpage.cpp:
    (QWebPage::setUserPermission): Pass the WebCore frame instead of the QWebFrame.
    * Api/qwebpage.h:
    * WebCoreSupport/NotificationPresenterClientQt.cpp:
    (WebCore::NotificationPresenterClientQt::checkPermission): Replaced explicit
    signal emission with hash lookup of previously granted permission (or not).
    (WebCore::NotificationPresenterClientQt::cancelRequestsForPermission): Remove
    any previously cached/granted permission for the given script execution context.
    (WebCore::NotificationPresenterClientQt::allowNotificationForFrame): Do not
    only serve pending permission requests but before calling the JS callbacks, remember
    the permission for subsequent synchronous checkPermission() calls.
    * WebCoreSupport/NotificationPresenterClientQt.h: Add cache for permissions.
    
    WebKitTools:
    
    * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
    (WebCore::WebPage::WebPage):
    * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
    (LayoutTestController::grantDesktopNotificationPermission): When granting
    permission, grant it directly on the QWebPage/Frame, that will remember it.
    * QtTestBrowser/webpage.cpp:
    (WebPage::WebPage):
    * QtTestBrowser/webpage.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72101 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp
index 6152660..a29d417 100644
--- a/WebKit/qt/Api/qwebpage.cpp
+++ b/WebKit/qt/Api/qwebpage.cpp
@@ -2123,7 +2123,7 @@ void QWebPage::setUserPermission(QWebFrame* frame, PermissionDomain domain, Perm
     case NotificationsPermissionDomain:
 #if ENABLE(NOTIFICATIONS)
         if (policy == PermissionGranted)
-            NotificationPresenterClientQt::notificationPresenter()->allowNotificationForFrame(frame);
+            NotificationPresenterClientQt::notificationPresenter()->allowNotificationForFrame(frame->d->frame);
 #endif
         break;
     case GeolocationPermissionDomain:
diff --git a/WebKit/qt/Api/qwebpage.h b/WebKit/qt/Api/qwebpage.h
index ec551e5..9fa3518 100644
--- a/WebKit/qt/Api/qwebpage.h
+++ b/WebKit/qt/Api/qwebpage.h
@@ -394,7 +394,6 @@ Q_SIGNALS:
     void viewportChangeRequested();
 
     void requestPermissionFromUser(QWebFrame* frame, QWebPage::PermissionDomain domain);
-    void checkPermissionFromUser(QWebFrame* frame, QWebPage::PermissionDomain domain, QWebPage::PermissionPolicy& policy);
     void cancelRequestsForPermission(QWebFrame* frame, QWebPage::PermissionDomain domain);
 
 protected:
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index 16ebcc3..2f14bb4 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,26 @@
+2010-11-16  Simon Hausmann  <simon.hausmann at nokia.com>
+
+        Reviewed by Andreas Kling.
+
+        [Qt] Remove synchronous QWebPage::checkPermissions signal
+        https://bugs.webkit.org/show_bug.cgi?id=46810
+
+        As decided in the API review, we remove this signal and replace its only use currently
+        with cached credentials.
+
+        * Api/qwebpage.cpp:
+        (QWebPage::setUserPermission): Pass the WebCore frame instead of the QWebFrame.
+        * Api/qwebpage.h:
+        * WebCoreSupport/NotificationPresenterClientQt.cpp:
+        (WebCore::NotificationPresenterClientQt::checkPermission): Replaced explicit
+        signal emission with hash lookup of previously granted permission (or not).
+        (WebCore::NotificationPresenterClientQt::cancelRequestsForPermission): Remove
+        any previously cached/granted permission for the given script execution context.
+        (WebCore::NotificationPresenterClientQt::allowNotificationForFrame): Do not
+        only serve pending permission requests but before calling the JS callbacks, remember
+        the permission for subsequent synchronous checkPermission() calls.
+        * WebCoreSupport/NotificationPresenterClientQt.h: Add cache for permissions.
+
 2010-11-15  Gavin Barraclough  <barraclough at apple.com>
 
         Reviewed by NOBODY build fix.
diff --git a/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp
index 0324c0d..e58829b 100644
--- a/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp
@@ -335,24 +335,13 @@ void NotificationPresenterClientQt::requestPermission(ScriptExecutionContext* co
 
 NotificationPresenter::Permission NotificationPresenterClientQt::checkPermission(ScriptExecutionContext* context)
 {
-    QWebPage::PermissionPolicy policy = QWebPage::PermissionUnknown;
-    if (toPage(context) && toFrame(context))
-        emit toPage(context)->checkPermissionFromUser(toFrame(context), QWebPage::NotificationsPermissionDomain, policy);
-
-    switch (policy) {
-    case QWebPage::PermissionGranted:
-        return NotificationPresenter::PermissionAllowed;
-    case QWebPage::PermissionUnknown:
-        return NotificationPresenter::PermissionNotAllowed;
-    case QWebPage::PermissionDenied:
-        return NotificationPresenter::PermissionDenied;
-    }
-    ASSERT_NOT_REACHED();
-    return NotificationPresenter::PermissionNotAllowed;
+    return m_cachedPermissions.value(context, NotificationPresenter::PermissionNotAllowed);
 }
 
 void NotificationPresenterClientQt::cancelRequestsForPermission(ScriptExecutionContext* context)
 {
+    m_cachedPermissions.remove(context);
+
     QHash<ScriptExecutionContext*, CallbacksInfo >::iterator iter = m_pendingPermissionRequests.find(context);
     if (iter == m_pendingPermissionRequests.end())
         return;
@@ -372,11 +361,13 @@ void NotificationPresenterClientQt::cancelRequestsForPermission(ScriptExecutionC
     emit page->cancelRequestsForPermission(frame, QWebPage::NotificationsPermissionDomain);
 }
 
-void NotificationPresenterClientQt::allowNotificationForFrame(QWebFrame* frame)
+void NotificationPresenterClientQt::allowNotificationForFrame(Frame* frame)
 {
+    m_cachedPermissions.insert(frame->document(), NotificationPresenter::PermissionAllowed);
+
     QHash<ScriptExecutionContext*,  CallbacksInfo>::iterator iter = m_pendingPermissionRequests.begin();
     while (iter != m_pendingPermissionRequests.end()) {
-        if (toFrame(iter.key()) == frame)
+        if (iter.key() == frame->document())
             break;
     }
 
diff --git a/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h
index 2520f6c..a501247 100644
--- a/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h
+++ b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h
@@ -48,6 +48,7 @@ class QWebPage;
 namespace WebCore {
 
 class Document;
+class Frame;
 class ScriptExecutionContext;
 
 class NotificationWrapper : public QObject, public QWebNotificationData {
@@ -95,7 +96,7 @@ public:
 
     void cancel(NotificationWrapper*);
 
-    void allowNotificationForFrame(QWebFrame*);
+    void allowNotificationForFrame(Frame*);
 
     static bool dumpNotification;
 
@@ -123,6 +124,7 @@ private:
         QList<RefPtr<VoidCallback> > m_callbacks;
     };
     QHash<ScriptExecutionContext*,  CallbacksInfo > m_pendingPermissionRequests;
+    QHash<ScriptExecutionContext*, NotificationPresenter::Permission> m_cachedPermissions;
 
     NotificationsQueue m_notifications;
     QtPlatformPlugin m_platformPlugin;
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index b182e1f..1ef978b 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,20 @@
+2010-11-16  Simon Hausmann  <simon.hausmann at nokia.com>
+
+        Reviewed by Andreas Kling.
+
+        [Qt] Remove synchronous QWebPage::checkPermissions signal
+        https://bugs.webkit.org/show_bug.cgi?id=46810
+
+        * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
+        (WebCore::WebPage::WebPage):
+        * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
+        (LayoutTestController::grantDesktopNotificationPermission): When granting
+        permission, grant it directly on the QWebPage/Frame, that will remember it.
+        * QtTestBrowser/webpage.cpp:
+        (WebPage::WebPage):
+        * QtTestBrowser/webpage.h:
+
+
 2010-11-16  Andras Becsi  <abecsi at inf.u-szeged.hu>
 
         Reviewed by Csaba Osztrogonác.
diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
index 50ae605..eadcc43 100644
--- a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
+++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
@@ -159,7 +159,6 @@ WebPage::WebPage(QObject* parent, DumpRenderTree* drt)
     setPluginFactory(new TestPlugin(this));
 
     connect(this, SIGNAL(requestPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain)), this, SLOT(requestPermission(QWebFrame*, QWebPage::PermissionDomain)));
-    connect(this, SIGNAL(checkPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain, QWebPage::PermissionPolicy&)), this, SLOT(checkPermission(QWebFrame*, QWebPage::PermissionDomain, QWebPage::PermissionPolicy&)));
     connect(this, SIGNAL(cancelRequestsForPermission(QWebFrame*, QWebPage::PermissionDomain)), this, SLOT(cancelPermission(QWebFrame*, QWebPage::PermissionDomain)));
 }
 
@@ -241,20 +240,6 @@ void WebPage::requestPermission(QWebFrame* frame, QWebPage::PermissionDomain dom
     }
 }
 
-void WebPage::checkPermission(QWebFrame* frame, QWebPage::PermissionDomain domain, QWebPage::PermissionPolicy& policy)
-{
-    switch (domain) {
-    case NotificationsPermissionDomain:
-        {
-        QUrl url = frame->url();
-        policy = m_drt->layoutTestController()->checkDesktopNotificationPermission(url.scheme() + "://" + url.host()) ? PermissionGranted : PermissionDenied;
-        break;
-        }
-    default:
-        break;
-    }
-}
-
 void WebPage::cancelPermission(QWebFrame* frame, QWebPage::PermissionDomain domain)
 {
     switch (domain) {
diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h
index b3e4e32..0382f96 100644
--- a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h
+++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h
@@ -199,7 +199,6 @@ public:
 public slots:
     bool shouldInterruptJavaScript() { return false; }
     void requestPermission(QWebFrame* frame, QWebPage::PermissionDomain domain);
-    void checkPermission(QWebFrame* frame, QWebPage::PermissionDomain domain, QWebPage::PermissionPolicy& policy);
     void cancelPermission(QWebFrame* frame, QWebPage::PermissionDomain domain);
 
 protected:
diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
index 78ed591..7135a1a 100644
--- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
+++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
@@ -197,6 +197,8 @@ int LayoutTestController::windowCount()
 
 void LayoutTestController::grantDesktopNotificationPermission(const QString& origin)
 {
+    QWebFrame* frame = m_drt->webPage()->mainFrame();
+    m_drt->webPage()->setUserPermission(frame, QWebPage::NotificationsPermissionDomain, QWebPage::PermissionGranted);
     m_desktopNotificationAllowedOrigins.append(origin);
 }
 
diff --git a/WebKitTools/QtTestBrowser/webpage.cpp b/WebKitTools/QtTestBrowser/webpage.cpp
index 137c65c..114ed6c 100644
--- a/WebKitTools/QtTestBrowser/webpage.cpp
+++ b/WebKitTools/QtTestBrowser/webpage.cpp
@@ -51,7 +51,6 @@ WebPage::WebPage(QObject* parent)
     connect(networkAccessManager(), SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)),
             this, SLOT(authenticationRequired(QNetworkReply*, QAuthenticator*)));
     connect(this, SIGNAL(requestPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain)), this, SLOT(requestPermission(QWebFrame*, QWebPage::PermissionDomain)));
-    connect(this, SIGNAL(checkPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain, QWebPage::PermissionPolicy&)), this, SLOT(checkPermission(QWebFrame*, QWebPage::PermissionDomain, QWebPage::PermissionPolicy&)));
     connect(this, SIGNAL(cancelRequestsForPermission(QWebFrame*, QWebPage::PermissionDomain)), this, SLOT(cancelRequestsForPermission(QWebFrame*, QWebPage::PermissionDomain)));
 }
 
@@ -173,17 +172,6 @@ void WebPage::requestPermission(QWebFrame* frame, QWebPage::PermissionDomain dom
     setUserPermission(frame, domain, PermissionGranted);
 }
 
-void WebPage::checkPermission(QWebFrame* frame, QWebPage::PermissionDomain domain, QWebPage::PermissionPolicy& policy)
-{
-    switch (domain) {
-    case NotificationsPermissionDomain:
-        policy = PermissionGranted;
-        break;
-    default:
-        break;
-    }
-}
-
 void WebPage::cancelRequestsForPermission(QWebFrame*, QWebPage::PermissionDomain)
 {
 }
diff --git a/WebKitTools/QtTestBrowser/webpage.h b/WebKitTools/QtTestBrowser/webpage.h
index 15ae369..27198e5 100644
--- a/WebKitTools/QtTestBrowser/webpage.h
+++ b/WebKitTools/QtTestBrowser/webpage.h
@@ -58,7 +58,6 @@ public slots:
     bool shouldInterruptJavaScript();
     void authenticationRequired(QNetworkReply*, QAuthenticator*);
     void requestPermission(QWebFrame* frame, QWebPage::PermissionDomain domain);
-    void checkPermission(QWebFrame* frame, QWebPage::PermissionDomain domain, QWebPage::PermissionPolicy& policy);
     void cancelRequestsForPermission(QWebFrame* frame, QWebPage::PermissionDomain domain);
 
 private:

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list