Changeset 243533 in webkit
- Timestamp:
- Mar 27, 2019, 2:36:29 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp (modified) (2 diffs)
-
Source/WebKit/UIProcess/WebGeolocationManagerProxy.h (modified) (3 diffs)
-
Source/WebKit/WebProcess/WebCoreSupport/WebGeolocationClient.cpp (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKit/Geolocation.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r243531 r243533 1 2019-03-27 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 Geolocation request not complete when watch request was started in a different web process 4 https://bugs.webkit.org/show_bug.cgi?id=195996 5 6 Reviewed by Alex Christensen. 7 8 In WebGeolocationManagerProxy::startUpdating() we do nothing when the provider is already updating. We should 9 reply with a DidChangePosition using the last known position, if available. If we are updating, but we still 10 don't have a known position, the request will be completed when 11 WebGeolocationManagerProxy::providerDidChangePosition() is called since it always notifies all web 12 processes. 13 14 * UIProcess/WebGeolocationManagerProxy.cpp: 15 (WebKit::WebGeolocationManagerProxy::providerDidChangePosition): Cache the position. 16 (WebKit::WebGeolocationManagerProxy::startUpdating): Reply using cached position if already known. 17 * UIProcess/WebGeolocationManagerProxy.h: 18 (WebKit::WebGeolocationManagerProxy::lastPosition const): Return cached position. 19 * WebProcess/WebCoreSupport/WebGeolocationClient.cpp: 20 (WebKit::WebGeolocationClient::lastPosition): Remove the FIXME since we don't want this feature. 21 1 22 2019-03-26 Brent Fulgham <bfulgham@apple.com> 2 23 -
trunk/Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp
r237266 r243533 89 89 void WebGeolocationManagerProxy::providerDidChangePosition(WebGeolocationPosition* position) 90 90 { 91 m_lastPosition = position->corePosition(); 92 91 93 if (!processPool()) 92 94 return; 93 95 94 processPool()->sendToAllProcesses(Messages::WebGeolocationManager::DidChangePosition( position->corePosition()));96 processPool()->sendToAllProcesses(Messages::WebGeolocationManager::DidChangePosition(m_lastPosition.value())); 95 97 } 96 98 … … 117 119 m_provider->setEnableHighAccuracy(*this, isHighAccuracyEnabled()); 118 120 m_provider->startUpdating(*this); 119 } 121 } else if (m_lastPosition) 122 connection.send(Messages::WebGeolocationManager::DidChangePosition(m_lastPosition.value()), 0); 120 123 } 121 124 -
trunk/Source/WebKit/UIProcess/WebGeolocationManagerProxy.h
r237266 r243533 30 30 #include "MessageReceiver.h" 31 31 #include "WebContextSupplement.h" 32 #include <WebCore/GeolocationPosition.h> 32 33 #include <wtf/HashSet.h> 33 34 #include <wtf/text/WTFString.h> … … 55 56 void resetPermissions(); 56 57 #endif 58 const Optional<WebCore::GeolocationPosition>& lastPosition() const { return m_lastPosition; } 57 59 58 60 using API::Object::ref; … … 83 85 84 86 std::unique_ptr<API::GeolocationProvider> m_provider; 87 Optional<WebCore::GeolocationPosition> m_lastPosition; 85 88 }; 86 89 -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebGeolocationClient.cpp
r239427 r243533 66 66 Optional<GeolocationPosition> WebGeolocationClient::lastPosition() 67 67 { 68 // FIXME: Implement this.69 68 return WTF::nullopt; 70 69 } -
trunk/Tools/ChangeLog
r243527 r243533 1 2019-03-27 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 Geolocation request not complete when watch request was started in a different web process 4 https://bugs.webkit.org/show_bug.cgi?id=195996 5 6 Reviewed by Alex Christensen. 7 8 Add a test case. 9 10 * TestWebKitAPI/Tests/WebKit/Geolocation.cpp: 11 (TestWebKitAPI::runJavaScriptAlert): 12 (TestWebKitAPI::TEST): 13 1 14 2019-03-26 Keith Rollin <krollin@apple.com> 2 15 -
trunk/Tools/TestWebKitAPI/Tests/WebKit/Geolocation.cpp
r239631 r243533 316 316 }; 317 317 318 struct JavaScriptAlertContext { 319 bool didRun { false }; 320 std::string alertText; 321 }; 322 318 323 static void runJavaScriptAlert(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo) 319 324 { 320 *static_cast<bool*>(const_cast<void*>(clientInfo)) = true; 325 auto* context = static_cast<JavaScriptAlertContext*>(const_cast<void*>(clientInfo)); 326 context->didRun = true; 327 context->alertText = Util::toSTD(alertText); 321 328 } 322 329 … … 337 344 setupView(lowAccuracyWebView); 338 345 339 bool finishedSecondStep = false;346 JavaScriptAlertContext secondStepContext; 340 347 341 348 WKPageUIClientV2 uiClient; 342 349 memset(&uiClient, 0, sizeof(uiClient)); 343 350 uiClient.base.version = 2; 344 uiClient.base.clientInfo = & finishedSecondStep;351 uiClient.base.clientInfo = &secondStepContext; 345 352 uiClient.decidePolicyForGeolocationPermissionRequest = decidePolicyForGeolocationPermissionRequestCallBack; 346 353 uiClient.runJavaScriptAlert = runJavaScriptAlert; … … 349 356 WKRetainPtr<WKURLRef> lowAccuracyURL(AdoptWK, Util::createURLForResource("geolocationWatchPosition", "html")); 350 357 WKPageLoadURL(lowAccuracyWebView.page(), lowAccuracyURL.get()); 351 Util::run(&finishedSecondStep); 358 Util::run(&secondStepContext.didRun); 359 EXPECT_EQ(secondStepContext.alertText, "SUCCESS"); 352 360 353 361 WKRetainPtr<WKURLRef> resetUrl = adoptWK(WKURLCreateWithUTF8CString("about:blank")); … … 362 370 } 363 371 372 TEST(WebKit, GeolocationWatchMultiprocess) 373 { 374 WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreateWithConfiguration(nullptr)); 375 376 GeolocationStateTracker stateTracker; 377 setupGeolocationProvider(context.get(), &stateTracker); 378 379 JavaScriptAlertContext testContext; 380 381 WKPageUIClientV2 uiClient; 382 memset(&uiClient, 0, sizeof(uiClient)); 383 uiClient.base.version = 2; 384 uiClient.base.clientInfo = &testContext; 385 uiClient.decidePolicyForGeolocationPermissionRequest = decidePolicyForGeolocationPermissionRequestCallBack; 386 uiClient.runJavaScriptAlert = runJavaScriptAlert; 387 388 PlatformWebView view1(context.get()); 389 WKPageSetPageUIClient(view1.page(), &uiClient.base); 390 WKRetainPtr<WKURLRef> url(AdoptWK, Util::createURLForResource("geolocationWatchPosition", "html")); 391 WKPageLoadURL(view1.page(), url.get()); 392 Util::run(&testContext.didRun); 393 EXPECT_EQ(testContext.alertText, "SUCCESS"); 394 WKPageSetPageUIClient(view1.page(), nullptr); 395 396 testContext.didRun = false; 397 testContext.alertText = { }; 398 399 PlatformWebView view2(context.get()); 400 WKPageSetPageUIClient(view2.page(), &uiClient.base); 401 WKPageLoadURL(view2.page(), url.get()); 402 Util::run(&testContext.didRun); 403 EXPECT_EQ(testContext.alertText, "SUCCESS"); 404 405 clearGeolocationProvider(context.get()); 406 } 407 364 408 } // namespace TestWebKitAPI 365 409
Note:
See TracChangeset
for help on using the changeset viewer.