Changeset 242745 in webkit
- Timestamp:
- Mar 11, 2019, 3:15:51 PM (7 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 9 edited
-
ChangeLog (modified) (1 diff)
-
Platform/spi/ios/UIKitSPI.h (modified) (2 diffs)
-
Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb (modified) (1 diff)
-
UIProcess/Cocoa/WebProcessPoolCocoa.mm (modified) (3 diffs)
-
UIProcess/WebProcessPool.cpp (modified) (1 diff)
-
UIProcess/WebProcessPool.h (modified) (1 diff)
-
WebProcess/WebProcess.h (modified) (3 diffs)
-
WebProcess/WebProcess.messages.in (modified) (1 diff)
-
WebProcess/cocoa/WebProcessCocoa.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r242738 r242745 1 2019-03-11 Per Arne Vollan <pvollan@apple.com> 2 3 [iOS] Block access to backboardd service 4 https://bugs.webkit.org/show_bug.cgi?id=195484 5 6 Reviewed by Brent Fulgham. 7 8 This patch is addressing blocking the backboardd service "com.apple.backboard.hid.services". Getting the 9 backlight level in the WebContent process will initiate a connection with this service. To be able to 10 block the service, the backlight level is queried in the UI process and sent to the WebContent process 11 when the WebContent process is started, and when the backlight level is changed. On the WebContent side, 12 the method getting the backlight level is swizzled to return the value sent from the UI process. 13 14 * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 15 * UIProcess/Cocoa/WebProcessPoolCocoa.mm: 16 (WebKit::WebProcessPool::displayBrightness): 17 (WebKit::WebProcessPool::backlightLevelDidChangeCallback): 18 (WebKit::WebProcessPool::registerNotificationObservers): 19 (WebKit::WebProcessPool::unregisterNotificationObservers): 20 * UIProcess/WebProcessPool.cpp: 21 (WebKit::WebProcessPool::initializeNewWebProcess): 22 * UIProcess/WebProcessPool.h: 23 * WebProcess/WebProcess.h: 24 * WebProcess/WebProcess.messages.in: 25 * WebProcess/cocoa/WebProcessCocoa.mm: 26 (WebKit::currentBacklightLevel): 27 (WebKit::WebProcess::backlightLevelDidChange): 28 1 29 2019-03-11 Brent Fulgham <bfulgham@apple.com> 2 30 -
trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h
r241971 r242745 1125 1125 #endif 1126 1126 1127 @interface UIDevice () 1128 @property (nonatomic, setter=_setBacklightLevel:) float _backlightLevel; 1129 @end 1130 1127 1131 static inline bool currentUserInterfaceIdiomIsPad() 1128 1132 { … … 1188 1192 UIEdgeInsets UIEdgeInsetsAdd(UIEdgeInsets lhs, UIEdgeInsets rhs, UIRectEdge); 1189 1193 1194 extern NSString *const UIBacklightLevelChangedNotification; 1195 1190 1196 WTF_EXTERN_C_END -
trunk/Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb
r242600 r242745 450 450 (global-name "com.apple.coremedia.decompressionsession") 451 451 (global-name "com.apple.coremedia.videoqueue")) 452 453 454 ;; FIXME: remove the send-signal when this rule is no longer generating crashes. 455 (deny mach-lookup (with send-signal SIGKILL) 456 (global-name "com.apple.backboard.hid.services")) 452 457 453 458 ;; These services have been identified as unused during living-on. -
trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
r242406 r242745 78 78 #endif 79 79 80 #if PLATFORM(IOS_FAMILY) 81 SOFT_LINK_PRIVATE_FRAMEWORK(BackBoardServices) 82 SOFT_LINK(BackBoardServices, BKSDisplayBrightnessGetCurrent, float, (), ()); 83 #endif 84 80 85 namespace WebKit { 81 86 using namespace WebCore; … … 382 387 } 383 388 389 #if PLATFORM(IOS_FAMILY) 390 float WebProcessPool::displayBrightness() 391 { 392 return BKSDisplayBrightnessGetCurrent(); 393 } 394 395 void WebProcessPool::backlightLevelDidChangeCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) 396 { 397 WebProcessPool* pool = reinterpret_cast<WebProcessPool*>(observer); 398 pool->sendToAllProcesses(Messages::WebProcess::BacklightLevelDidChange(BKSDisplayBrightnessGetCurrent())); 399 } 400 #endif 401 384 402 void WebProcessPool::registerNotificationObservers() 385 403 { 386 #if !PLATFORM(IOS_FAMILY) 404 #if PLATFORM(IOS_FAMILY) 405 CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), this, backlightLevelDidChangeCallback, (CFStringRef)UIBacklightLevelChangedNotification, nullptr, CFNotificationSuspensionBehaviorCoalesce); 406 #else 387 407 // Listen for enhanced accessibility changes and propagate them to the WebProcess. 388 408 m_enhancedAccessibilityObserver = [[NSNotificationCenter defaultCenter] addObserverForName:WebKitApplicationDidChangeAccessibilityEnhancedUserInterfaceNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *note) { … … 434 454 void WebProcessPool::unregisterNotificationObservers() 435 455 { 436 #if !PLATFORM(IOS_FAMILY) 456 #if PLATFORM(IOS_FAMILY) 457 CFNotificationCenterRemoveObserver(CFNotificationCenterGetDarwinNotifyCenter(), this, (CFStringRef)UIBacklightLevelChangedNotification, nullptr); 458 #else 437 459 [[NSNotificationCenter defaultCenter] removeObserver:m_enhancedAccessibilityObserver.get()]; 438 460 [[NSNotificationCenter defaultCenter] removeObserver:m_automaticTextReplacementNotificationObserver.get()]; -
trunk/Source/WebKit/UIProcess/WebProcessPool.cpp
r242726 r242745 984 984 } 985 985 986 #if PLATFORM(IOS_FAMILY) 987 process.send(Messages::WebProcess::BacklightLevelDidChange(displayBrightness()), 0); 988 #endif 989 986 990 #if ENABLE(REMOTE_INSPECTOR) 987 991 // Initialize remote inspector connection now that we have a sub-process that is hosting one of our web views. -
trunk/Source/WebKit/UIProcess/WebProcessPool.h
r242603 r242745 573 573 void updateMaxSuspendedPageCount(); 574 574 575 #if PLATFORM(IOS_FAMILY) 576 static float displayBrightness(); 577 static void backlightLevelDidChangeCallback(CFNotificationCenterRef, void *observer, CFStringRef name, const void *, CFDictionaryRef userInfo); 578 #endif 579 575 580 Ref<API::ProcessPoolConfiguration> m_configuration; 576 581 -
trunk/Source/WebKit/WebProcess/WebProcess.h
r242230 r242745 245 245 #if PLATFORM(IOS_FAMILY) 246 246 void accessibilityProcessSuspendedNotification(bool); 247 float backlightLevel() const { return m_backlightLevel; } 247 248 #endif 248 249 … … 410 411 #endif 411 412 413 #if PLATFORM(IOS_FAMILY) 414 void backlightLevelDidChange(float backlightLevel); 415 #endif 416 412 417 #if ENABLE(VIDEO) 413 418 void suspendAllMediaBuffering(); … … 507 512 HashMap<String, RefPtr<SandboxExtension>> m_mediaCaptureSandboxExtensions; 508 513 #endif 514 515 #if PLATFORM(IOS_FAMILY) 516 float m_backlightLevel { 0 }; 517 #endif 509 518 }; 510 519 -
trunk/Source/WebKit/WebProcess/WebProcess.messages.in
r242142 r242745 135 135 #endif 136 136 137 #if PLATFORM(IOS_FAMILY) 138 BacklightLevelDidChange(float backlightLevel) 139 #endif 140 137 141 IsJITEnabled() -> (bool enabled) Async 138 142 -
trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
r242339 r242745 76 76 77 77 #if PLATFORM(IOS_FAMILY) 78 #import "UIKitSPI.h" 78 79 #import "WKAccessibilityWebPageObjectIOS.h" 79 80 #import <UIKit/UIAccessibility.h> … … 699 700 #endif 700 701 702 #if PLATFORM(IOS_FAMILY) 703 static float currentBacklightLevel() 704 { 705 return WebProcess::singleton().backlightLevel(); 706 } 707 708 void WebProcess::backlightLevelDidChange(float backlightLevel) 709 { 710 m_backlightLevel = backlightLevel; 711 712 // Swizzle -[UIDevice _backlightLevel] 713 // FIXME: remove the swizzling and related code once <rdar://problem/47603552> is fixed. 714 static std::once_flag onceFlag; 715 std::call_once( 716 onceFlag, 717 [] { 718 Method methodToPatch = class_getInstanceMethod([UIDevice class], @selector(_backlightLevel)); 719 method_setImplementation(methodToPatch, reinterpret_cast<IMP>(currentBacklightLevel)); 720 }); 721 } 722 #endif 723 701 724 void WebProcess::setMediaMIMETypes(const Vector<String> types) 702 725 {
Note:
See TracChangeset
for help on using the changeset viewer.