browser(webkit): override global permissions (#1315)

For #652
This commit is contained in:
Pavel Feldman 2020-03-10 10:42:29 -07:00 committed by GitHub
parent 92aa4f375a
commit e2616e4866
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -1 +1 @@
1171 1172

View File

@ -9798,7 +9798,7 @@ index 0000000000000000000000000000000000000000..76290475097e756e3d932d22be4d8c79
+ +
+} // namespace WebKit +} // namespace WebKit
diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp
index f971f96f4df83ebf505b2ddc4ae27e6ca7d5cc75..7478490cc0a8234569b01ae578a68cff982aa457 100644 index f971f96f4df83ebf505b2ddc4ae27e6ca7d5cc75..c9b85dd2fdd274efd594938924e3df27347358bd 100644
--- a/Source/WebKit/UIProcess/WebPageProxy.cpp --- a/Source/WebKit/UIProcess/WebPageProxy.cpp
+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp +++ b/Source/WebKit/UIProcess/WebPageProxy.cpp
@@ -917,6 +917,7 @@ void WebPageProxy::finishAttachingToWebProcess(ProcessLaunchReason reason) @@ -917,6 +917,7 @@ void WebPageProxy::finishAttachingToWebProcess(ProcessLaunchReason reason)
@ -10093,18 +10093,21 @@ index f971f96f4df83ebf505b2ddc4ae27e6ca7d5cc75..7478490cc0a8234569b01ae578a68cff
auto request = m_geolocationPermissionRequestManager.createRequest(geolocationID); auto request = m_geolocationPermissionRequestManager.createRequest(geolocationID);
Function<void(bool)> completionHandler = [request = WTFMove(request)](bool allowed) { Function<void(bool)> completionHandler = [request = WTFMove(request)](bool allowed) {
if (allowed) if (allowed)
@@ -7871,6 +7971,11 @@ void WebPageProxy::requestGeolocationPermissionForFrame(uint64_t geolocationID, @@ -7872,6 +7972,14 @@ void WebPageProxy::requestGeolocationPermissionForFrame(uint64_t geolocationID,
else
request->deny(); request->deny();
}; };
+ auto permissions = m_permissionsForAutomation.find(securityOrigin->toString()); + auto permissions = m_permissionsForAutomation.find(securityOrigin->toString());
+ if (permissions == m_permissionsForAutomation.end())
+ permissions = m_permissionsForAutomation.find("*");
+ if (permissions != m_permissionsForAutomation.end()) { + if (permissions != m_permissionsForAutomation.end()) {
+ completionHandler(permissions->value.contains("geolocation")); + completionHandler(permissions->value.contains("geolocation"));
+ return; + return;
+ } + }
+
// FIXME: Once iOS migrates to the new WKUIDelegate SPI, clean this up // FIXME: Once iOS migrates to the new WKUIDelegate SPI, clean this up
// and make it one UIClient call that calls the completionHandler with false // and make it one UIClient call that calls the completionHandler with false
// if there is no delegate instead of returning the completionHandler
diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h
index b3154548a08b588dfb346261bc7de3dbb754f6cf..4fc0e0fb6e7805d04b86bca46d5098fc69fe32e4 100644 index b3154548a08b588dfb346261bc7de3dbb754f6cf..4fc0e0fb6e7805d04b86bca46d5098fc69fe32e4 100644
--- a/Source/WebKit/UIProcess/WebPageProxy.h --- a/Source/WebKit/UIProcess/WebPageProxy.h