Changeset 66597 in webkit
- Timestamp:
- Sep 1, 2010 5:31:19 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r66596 r66597 1 2010-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 1 12 2010-09-01 Pavel Podivilov <podivilov@chromium.org> 2 13 -
trunk/LayoutTests/platform/qt/Skipped
r66470 r66597 5436 5436 fast/events/special-key-events-in-input-text.html 5437 5437 5438 # [Qt] DumpRenderTree lacks functionality for new Geolocation delayed permission tests5439 # https://bugs.webkit.org/show_bug.cgi?id=413645440 fast/dom/Geolocation/delayed-permission-allowed.html5441 fast/dom/Geolocation/delayed-permission-denied.html5442 fast/dom/Geolocation/delayed-permission-allowed-for-multiple-requests.html5443 fast/dom/Geolocation/delayed-permission-denied-for-multiple-requests.html5444 5445 5438 # Still working out flakiness issues with the perf tests. 5446 5439 # https://bugs.webkit.org/show_bug.cgi?id=44199 -
trunk/WebCore/ChangeLog
r66590 r66597 1 2010-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 1 12 2010-09-01 Andreas Kling <andreas.kling@nokia.com> 2 13 -
trunk/WebCore/WebCore.pro
r66586 r66597 2220 2220 $$PWD/../WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h \ 2221 2221 $$PWD/../WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.h \ 2222 $$PWD/../WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.h \ 2222 2223 $$PWD/../WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h \ 2223 2224 $$PWD/../WebKit/qt/WebCoreSupport/PageClientQt.h \ … … 2312 2313 ../WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp \ 2313 2314 ../WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp \ 2315 ../WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.cpp \ 2314 2316 ../WebKit/qt/WebCoreSupport/InspectorClientQt.cpp \ 2315 2317 ../WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp \ -
trunk/WebKit/qt/Api/qwebpage.cpp
r66221 r66597 82 82 #include "runtime/InitializeThreading.h" 83 83 #include "PageGroup.h" 84 #include "GeolocationPermissionClientQt.h" 84 85 #include "NotificationPresenterClientQt.h" 85 86 #include "PageClientQt.h" … … 2083 2084 } 2084 2085 2085 /*!2086 \fn bool QWebPage::allowGeolocationRequest()2087 \since 4.72088 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 to2096 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_MESSAGEBOX2102 return false;2103 #else2104 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 #endif2107 }2108 2109 2086 void QWebPage::setUserPermission(QWebFrame* frame, PermissionDomain domain, PermissionPolicy policy) 2110 2087 { … … 2116 2093 #endif 2117 2094 break; 2095 case GeolocationPermissionDomain: 2096 #if ENABLE(GEOLOCATION) 2097 GeolocationPermissionClientQt::geolocationPermissionClient()->setPermission(frame, policy); 2098 #endif 2099 break; 2100 2118 2101 default: 2119 2102 break; -
trunk/WebKit/qt/Api/qwebpage.h
r64825 r66597 58 58 class InspectorFrontendClientQt; 59 59 class NotificationPresenterClientQt; 60 class GeolocationPermissionClientQt; 60 61 class ResourceHandle; 61 62 class HitTestResult; … … 203 204 204 205 enum PermissionDomain { 205 NotificationsPermissionDomain 206 NotificationsPermissionDomain, 207 GeolocationPermissionDomain 206 208 }; 207 209 … … 352 354 public Q_SLOTS: 353 355 bool shouldInterruptJavaScript(); 354 bool allowGeolocationRequest(QWebFrame *frame);355 356 356 357 Q_SIGNALS: … … 425 426 friend class WebCore::InspectorFrontendClientQt; 426 427 friend class WebCore::NotificationPresenterClientQt; 428 friend class WebCore::GeolocationPermissionClientQt; 427 429 friend class WebCore::ResourceHandle; 428 430 friend class WebCore::QNetworkReplyHandler; -
trunk/WebKit/qt/ChangeLog
r66577 r66597 1 2010-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 1 33 2010-08-31 Dave Hyatt <hyatt@apple.com> 2 34 -
trunk/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
r66182 r66597 42 42 #include "GraphicsLayerQt.h" 43 43 #endif 44 #include "GeolocationPermissionClientQt.h" 44 45 #include "HitTestResult.h" 45 46 #include "Icon.h" … … 568 569 void ChromeClientQt::requestGeolocationPermissionForFrame(Frame* frame, Geolocation* geolocation) 569 570 { 570 bool allow = false; 571 #if ENABLE(GEOLOCATION) 571 572 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 577 void 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 574 583 } 575 584 -
trunk/WebKit/qt/WebCoreSupport/ChromeClientQt.h
r65021 r66597 169 169 170 170 virtual void requestGeolocationPermissionForFrame(Frame*, Geolocation*); 171 virtual void cancelGeolocationPermissionRequestForFrame(Frame*, Geolocation*) { }171 virtual void cancelGeolocationPermissionRequestForFrame(Frame*, Geolocation*); 172 172 173 173 virtual bool selectItemWritingDirectionIsNatural(); -
trunk/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
r66565 r66597 218 218 return true; 219 219 } 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); 223 226 } 224 227 … … 245 248 { 246 249 JSTestPage* newPage = new JSTestPage(m_view); 250 connect(newPage, SIGNAL(requestPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain)), 251 newPage, SLOT(requestPermission(QWebFrame*, QWebPage::PermissionDomain))); 252 247 253 newPage->setGeolocationPermission(false); 248 254 m_view->setPage(newPage); -
trunk/WebKitTools/ChangeLog
r66592 r66597 1 2010-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 1 28 2010-09-01 Andras Becsi <abecsi@webkit.org> 2 29 -
trunk/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
r66092 r66597 160 160 connect(this, SIGNAL(requestPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain)), this, SLOT(requestPermission(QWebFrame*, QWebPage::PermissionDomain))); 161 161 connect(this, SIGNAL(checkPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain, QWebPage::PermissionPolicy&)), this, SLOT(checkPermission(QWebFrame*, QWebPage::PermissionDomain, QWebPage::PermissionPolicy&))); 162 connect(this, SIGNAL(cancelRequestsForPermission FromUser(QWebFrame*, QWebPage::PermissionDomain)), this, SLOT(cancelRequestsForPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain)));162 connect(this, SIGNAL(cancelRequestsForPermission(QWebFrame*, QWebPage::PermissionDomain)), this, SLOT(cancelPermission(QWebFrame*, QWebPage::PermissionDomain))); 163 163 } 164 164 … … 203 203 QWebSettings::setMaximumPagesInCache(0); // reset to default 204 204 settings()->setUserStyleSheetUrl(QUrl()); // reset to default 205 206 m_pendingGeolocationRequests.clear(); 205 207 } 206 208 … … 224 226 if (!m_drt->layoutTestController()->ignoreReqestForPermission()) 225 227 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); 226 237 break; 227 238 default: … … 244 255 } 245 256 246 void WebPage::cancelRequestsForPermission(QWebFrame*, QWebPage::PermissionDomain) 247 { 257 void 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 268 void 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 } 248 286 } 249 287 … … 368 406 } 369 407 370 bool WebPage::allowGeolocationRequest(QWebFrame *)371 {372 return m_drt->layoutTestController()->geolocationPermission();373 }374 375 408 void WebPage::setViewGeometry(const QRect& rect) 376 409 { … … 432 465 connect(m_controller, SIGNAL(hidePage()), this, SLOT(hidePage())); 433 466 467 // async geolocation permission set by controller 468 connect(m_controller, SIGNAL(geolocationPermissionSet()), this, SLOT(geolocationPermissionSet())); 469 434 470 connect(m_controller, SIGNAL(done()), this, SLOT(dump())); 435 471 m_eventSender = new EventSender(m_page); … … 674 710 return; 675 711 } 676 677 712 } 678 713 … … 1027 1062 } 1028 1063 1064 void DumpRenderTree::geolocationPermissionSet() 1065 { 1066 m_page->permissionSet(QWebPage::GeolocationPermissionDomain); 1067 } 1068 1029 1069 void DumpRenderTree::switchFocus(bool focused) 1030 1070 { -
trunk/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h
r66092 r66597 128 128 void dryRunPrint(QWebFrame*); 129 129 void loadNextTestInStandAloneMode(); 130 void geolocationPermissionSet(); 130 131 131 132 private: … … 192 193 QObject* createPlugin(const QString&, const QUrl&, const QStringList&, const QStringList&); 193 194 195 void permissionSet(QWebPage::PermissionDomain domain); 196 194 197 public slots: 195 198 bool shouldInterruptJavaScript() { return false; } 196 bool allowGeolocationRequest(QWebFrame *frame);197 199 void requestPermission(QWebFrame* frame, QWebPage::PermissionDomain domain); 198 200 void checkPermission(QWebFrame* frame, QWebPage::PermissionDomain domain, QWebPage::PermissionPolicy& policy); 199 void cancel RequestsForPermission(QWebFrame* frame, QWebPage::PermissionDomain domain);201 void cancelPermission(QWebFrame* frame, QWebPage::PermissionDomain domain); 200 202 201 203 protected: … … 208 210 private: 209 211 QWebInspector* m_webInspector; 212 QList<QWebFrame*> m_pendingGeolocationRequests; 210 213 DumpRenderTree *m_drt; 211 214 }; -
trunk/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
r65107 r66597 69 69 m_desktopNotificationAllowedOrigins.clear(); 70 70 m_ignoreDesktopNotification = false; 71 m_isGeolocationPermissionSet = false; 72 m_geolocationPermission = false; 71 73 72 74 DumpRenderTreeSupportQt::dumpEditingCallbacks(false); … … 716 718 void LayoutTestController::setGeolocationPermission(bool allow) 717 719 { 720 setGeolocationPermissionCommon(allow); 721 emit geolocationPermissionSet(); 722 } 723 724 void LayoutTestController::setGeolocationPermissionCommon(bool allow) 725 { 718 726 m_isGeolocationPermissionSet = true; 719 727 m_geolocationPermission = allow; -
trunk/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
r65107 r66597 86 86 void showPage(); 87 87 void hidePage(); 88 void geolocationPermissionSet(); 88 89 89 90 public slots: … … 240 241 241 242 private: 243 void setGeolocationPermissionCommon(bool allow); 244 245 private: 242 246 bool m_hasDumped; 243 247 bool m_textDump;
Note: See TracChangeset
for help on using the changeset viewer.