Changeset 271229 in webkit
- Timestamp:
- Jan 7, 2021, 12:31:21 AM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
UIProcess/Cocoa/MediaPermissionUtilities.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r271228 r271229 1 2021-01-07 Youenn Fablet <youenn@apple.com> 2 3 WKWebView should expose navigator.mediaDevices when content is loaded from app bundle 4 https://bugs.webkit.org/show_bug.cgi?id=220184 5 <rdar://problem/72792032> 6 7 Reviewed by Eric Carlson. 8 9 In case of non HTTP or HTTPS origins, getUserMedia was always denied. 10 This patch updates the code by allowing getUserMedia prompts for other protocols. 11 In that case, the user is presented the prompt with the application name since the origin domain does not mean anything. 12 Manually tested. 13 14 * UIProcess/Cocoa/MediaPermissionUtilities.mm: 15 (WebKit::alertMessageText): 16 1 17 2021-01-07 Jiewen Tan <jiewen_tan@apple.com> 2 18 -
trunk/Source/WebKit/UIProcess/Cocoa/MediaPermissionUtilities.mm
r271031 r271229 37 37 #import <wtf/SoftLinking.h> 38 38 #import <wtf/URLHelpers.h> 39 #import <wtf/spi/cf/CFBundleSPI.h> 39 40 #import <wtf/spi/darwin/SandboxSPI.h> 40 41 … … 119 120 static NSString *alertMessageText(MediaPermissionReason reason, OptionSet<MediaPermissionType> types, const WebCore::SecurityOrigin& origin) 120 121 { 121 if (origin.protocol() != "http" && origin.protocol() != "https") 122 return nil; 122 NSString *visibleOrigin; 123 if (origin.protocol() != "http" && origin.protocol() != "https") { 124 NSBundle *appBundle = [NSBundle mainBundle]; 125 NSString *displayName = appBundle.infoDictionary[(__bridge NSString *)_kCFBundleDisplayNameKey]; 126 NSString *readableName = appBundle.infoDictionary[(__bridge NSString *)kCFBundleNameKey]; 127 visibleOrigin = displayName ?: readableName; 128 } else 129 visibleOrigin = visibleDomain(origin.host()); 123 130 124 131 switch (reason) { 125 132 case MediaPermissionReason::UserMedia: 126 133 if (types.contains(MediaPermissionType::Audio) && types.contains(MediaPermissionType::Video)) 127 return [NSString stringWithFormat:WEB_UI_NSSTRING(@"Allow “%@” to use your camera and microphone?", @"Message for user media prompt"), visible Domain(origin.host())];134 return [NSString stringWithFormat:WEB_UI_NSSTRING(@"Allow “%@” to use your camera and microphone?", @"Message for user media prompt"), visibleOrigin]; 128 135 if (types.contains(MediaPermissionType::Audio)) 129 return [NSString stringWithFormat:WEB_UI_NSSTRING(@"Allow “%@” to use your microphone?", @"Message for user microphone access prompt"), visible Domain(origin.host())];136 return [NSString stringWithFormat:WEB_UI_NSSTRING(@"Allow “%@” to use your microphone?", @"Message for user microphone access prompt"), visibleOrigin]; 130 137 if (types.contains(MediaPermissionType::Video)) 131 return [NSString stringWithFormat:WEB_UI_NSSTRING(@"Allow “%@” to use your camera?", @"Message for user camera access prompt"), visible Domain(origin.host())];138 return [NSString stringWithFormat:WEB_UI_NSSTRING(@"Allow “%@” to use your camera?", @"Message for user camera access prompt"), visibleOrigin]; 132 139 return nil; 133 140 case MediaPermissionReason::SpeechRecognition:
Note:
See TracChangeset
for help on using the changeset viewer.