Changeset 242807 in webkit
- Timestamp:
- Mar 12, 2019 11:51:13 AM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r242806 r242807 1 2019-03-12 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-12 Tim Horton <timothy_horton@apple.com> 2 30 -
trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h
r242775 r242807 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
r242803 r242807 450 450 (global-name "com.apple.coremedia.decompressionsession") 451 451 (global-name "com.apple.coremedia.videoqueue")) 452 453 ;; FIXME: remove the send-signal when this rule is no longer generating crashes. 454 (deny mach-lookup (with send-signal SIGKILL) 455 (global-name "com.apple.backboard.hid.services")) 452 456 453 457 ;; These services have been identified as unused during living-on. -
trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
r242775 r242807 78 78 #endif 79 79 80 #if PLATFORM(IOS) 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) 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 { … … 428 446 setApplicationIsActive(false); 429 447 }]; 430 448 #elif PLATFORM(IOS) 449 CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), this, backlightLevelDidChangeCallback, static_cast<CFStringRef>(UIBacklightLevelChangedNotification), nullptr, CFNotificationSuspensionBehaviorCoalesce); 431 450 #endif // !PLATFORM(IOS_FAMILY) 432 451 } … … 435 454 { 436 455 #if !PLATFORM(IOS_FAMILY) 437 [[NSNotificationCenter defaultCenter] removeObserver:m_enhancedAccessibilityObserver.get()]; 456 [[NSNotificationCenter defaultCenter] removeObserver:m_enhancedAccessibilityObserver.get()]; 438 457 [[NSNotificationCenter defaultCenter] removeObserver:m_automaticTextReplacementNotificationObserver.get()]; 439 458 [[NSNotificationCenter defaultCenter] removeObserver:m_automaticSpellingCorrectionNotificationObserver.get()]; … … 446 465 [[NSNotificationCenter defaultCenter] removeObserver:m_activationObserver.get()]; 447 466 [[NSNotificationCenter defaultCenter] removeObserver:m_deactivationObserver.get()]; 467 #elif PLATFORM(IOS) 468 CFNotificationCenterRemoveObserver(CFNotificationCenterGetDarwinNotifyCenter(), this, static_cast<CFStringRef>(UIBacklightLevelChangedNotification) , nullptr); 448 469 #endif // !PLATFORM(IOS_FAMILY) 449 470 } -
trunk/Source/WebKit/UIProcess/WebProcessPool.cpp
r242775 r242807 998 998 } 999 999 1000 #if PLATFORM(IOS) 1001 process.send(Messages::WebProcess::BacklightLevelDidChange(displayBrightness()), 0); 1002 #endif 1003 1000 1004 #if ENABLE(REMOTE_INSPECTOR) 1001 1005 // 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
r242775 r242807 573 573 void updateMaxSuspendedPageCount(); 574 574 575 #if PLATFORM(IOS) 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
r242775 r242807 247 247 #endif 248 248 249 #if PLATFORM(IOS) 250 float backlightLevel() const { return m_backlightLevel; } 251 #endif 252 249 253 #if PLATFORM(COCOA) 250 254 void setMediaMIMETypes(const Vector<String>); … … 410 414 #endif 411 415 416 #if PLATFORM(IOS) 417 void backlightLevelDidChange(float backlightLevel); 418 #endif 419 412 420 #if ENABLE(VIDEO) 413 421 void suspendAllMediaBuffering(); … … 507 515 HashMap<String, RefPtr<SandboxExtension>> m_mediaCaptureSandboxExtensions; 508 516 #endif 517 518 #if PLATFORM(IOS) 519 float m_backlightLevel { 0 }; 520 #endif 509 521 }; 510 522 -
trunk/Source/WebKit/WebProcess/WebProcess.messages.in
r242775 r242807 135 135 #endif 136 136 137 #if PLATFORM(IOS) 138 BacklightLevelDidChange(float backlightLevel) 139 #endif 140 137 141 IsJITEnabled() -> (bool enabled) Async 138 142 -
trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
r242775 r242807 75 75 #import <wtf/cocoa/NSURLExtras.h> 76 76 77 #if PLATFORM(IOS) 78 #import "UIKitSPI.h" 79 #endif 80 77 81 #if PLATFORM(IOS_FAMILY) 78 82 #import "WKAccessibilityWebPageObjectIOS.h" … … 699 703 #endif 700 704 705 #if PLATFORM(IOS) 706 static float currentBacklightLevel() 707 { 708 return WebProcess::singleton().backlightLevel(); 709 } 710 711 void WebProcess::backlightLevelDidChange(float backlightLevel) 712 { 713 m_backlightLevel = backlightLevel; 714 715 static std::once_flag onceFlag; 716 std::call_once( 717 onceFlag, 718 [] { 719 Method methodToPatch = class_getInstanceMethod([UIDevice class], @selector(_backlightLevel)); 720 method_setImplementation(methodToPatch, reinterpret_cast<IMP>(currentBacklightLevel)); 721 }); 722 } 723 #endif 724 701 725 void WebProcess::setMediaMIMETypes(const Vector<String> types) 702 726 {
Note: See TracChangeset
for help on using the changeset viewer.