Diff
Modified: trunk/Source/WebCore/ChangeLog (231979 => 231980)
--- trunk/Source/WebCore/ChangeLog 2018-05-18 20:13:34 UTC (rev 231979)
+++ trunk/Source/WebCore/ChangeLog 2018-05-18 20:20:35 UTC (rev 231980)
@@ -1,3 +1,29 @@
+2018-05-18 Brent Fulgham <[email protected]>
+
+ Convert ProcessPrivilege assertions to regular debug-only assertions
+ https://bugs.webkit.org/show_bug.cgi?id=185775
+ <rdar://problem/40372286>
+
+ Reviewed by Geoffrey Garen.
+
+ In Bug 184322 I added a number of RELEASE_ASSERT checks that certain
+ UI-only calls were not being made in the WebContent process.
+
+ Measurements have shown that these RELEASE_ASSERTs have regressed performance
+ by around 1% on some benchmarks, so we should convert them to normal asserts.
+
+ This patch changes the RELEASE_ASSERTs into ASSERTs.
+
+ * platform/mac/PasteboardMac.mm:
+ (WebCore::Pasteboard::setDragImage):
+ * platform/mac/PlatformScreenMac.mm:
+ (WebCore::displayID):
+ (WebCore::firstScreen):
+ (WebCore::window):
+ (WebCore::screen):
+ (WebCore::getScreenProperties):
+ (WebCore::screenIsMonochrome):
+
2018-05-18 Eric Carlson <[email protected]>
Handle failure to extend sandbox gracefully
Modified: trunk/Source/WebCore/platform/mac/PasteboardMac.mm (231979 => 231980)
--- trunk/Source/WebCore/platform/mac/PasteboardMac.mm 2018-05-18 20:13:34 UTC (rev 231979)
+++ trunk/Source/WebCore/platform/mac/PasteboardMac.mm 2018-05-18 20:20:35 UTC (rev 231980)
@@ -676,7 +676,7 @@
// This is only relevant in WK1. Do not execute in the WebContent process, since it is now using
// NSRunLoop, and not the NSApplication run loop.
if ([NSApp isRunning]) {
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
NSEvent* event = [NSEvent mouseEventWithType:NSEventTypeMouseMoved location:NSZeroPoint
modifierFlags:0 timestamp:0 windowNumber:0 context:nil eventNumber:0 clickCount:0 pressure:0];
[NSApp postEvent:event atStart:YES];
Modified: trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm (231979 => 231980)
--- trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm 2018-05-18 20:13:34 UTC (rev 231979)
+++ trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm 2018-05-18 20:20:35 UTC (rev 231980)
@@ -48,7 +48,7 @@
static PlatformDisplayID displayID(NSScreen *screen)
{
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
return [[[screen deviceDescription] objectForKey:@"NSScreenNumber"] intValue];
}
@@ -71,7 +71,7 @@
// Screen containing the menubar.
static NSScreen *firstScreen()
{
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
NSArray *screens = [NSScreen screens];
if (![screens count])
return nil;
@@ -80,7 +80,7 @@
static NSWindow *window(Widget* widget)
{
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
if (!widget)
return nil;
return widget->platformWidget().window;
@@ -88,7 +88,7 @@
static NSScreen *screen(Widget* widget)
{
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
// If the widget is in a window, use that, otherwise use the display ID from the host window.
// First case is for when the NSWindow is in the same process, second case for when it's not.
if (auto screenFromWindow = window(widget).screen)
@@ -110,7 +110,7 @@
std::pair<PlatformDisplayID, HashMap<PlatformDisplayID, ScreenProperties>> getScreenProperties()
{
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
HashMap<PlatformDisplayID, ScreenProperties> screenProperties;
std::optional<PlatformDisplayID> firstScreen;
@@ -171,7 +171,7 @@
return getScreenProperties(widget).screenIsMonochrome;
// This is a system-wide accessibility setting, same on all screens.
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
return CGDisplayUsesForceToGray();
}
@@ -246,13 +246,13 @@
NSScreen *screen(NSWindow *window)
{
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
return [window screen] ?: firstScreen();
}
NSScreen *screen(PlatformDisplayID displayID)
{
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
for (NSScreen *screen in [NSScreen screens]) {
if (WebCore::displayID(screen) == displayID)
return screen;
Modified: trunk/Source/WebKit/ChangeLog (231979 => 231980)
--- trunk/Source/WebKit/ChangeLog 2018-05-18 20:13:34 UTC (rev 231979)
+++ trunk/Source/WebKit/ChangeLog 2018-05-18 20:20:35 UTC (rev 231980)
@@ -1,3 +1,47 @@
+2018-05-18 Brent Fulgham <[email protected]>
+
+ Convert ProcessPrivilege assertions to regular debug-only assertions
+ https://bugs.webkit.org/show_bug.cgi?id=185775
+ <rdar://problem/40372286>
+
+ Reviewed by Geoffrey Garen.
+
+ In Bug 184322 I added a number of RELEASE_ASSERT checks that certain
+ UI-only calls were not being made in the WebContent process.
+
+ Measurements have shown that these RELEASE_ASSERTs have regressed performance
+ by around 1% on some benchmarks, so we should convert them to normal asserts.
+
+ This patch changes the RELEASE_ASSERTs into ASSERTs.
+
+ * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+ (WebKit::WebProcessPool::platformInitializeWebProcess):
+ * UIProcess/Cocoa/WebViewImpl.mm:
+ (WebKit::WebViewImpl::WebViewImpl):
+ (WebKit::WebViewImpl::becomeFirstResponder):
+ (WebKit::WebViewImpl::pluginFocusOrWindowFocusChanged):
+ (WebKit::WebViewImpl::validateUserInterfaceItem):
+ (WebKit::WebViewImpl::startSpeaking):
+ (WebKit::WebViewImpl::stopSpeaking):
+ (WebKit::applicationFlagsForDrag):
+ (WebKit::WebViewImpl::doneWithKeyEvent):
+ * UIProcess/Gamepad/mac/UIGamepadProviderMac.mm:
+ (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput):
+ * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
+ (WebKit::PluginProcessProxy::enterFullscreen):
+ (WebKit::PluginProcessProxy::beginModal):
+ (WebKit::PluginProcessProxy::endModal):
+ * UIProcess/mac/DisplayLink.cpp:
+ (WebKit::DisplayLink::DisplayLink):
+ (WebKit::DisplayLink::~DisplayLink):
+ * UIProcess/mac/WebPageProxyMac.mm:
+ (WebKit::WebPageProxy::getIsSpeaking):
+ (WebKit::WebPageProxy::speak):
+ (WebKit::WebPageProxy::stopSpeaking):
+ (WebKit::WebPageProxy::startDisplayLink):
+ * UIProcess/mac/WebPopupMenuProxyMac.mm:
+ (WebKit::WebPopupMenuProxyMac::showPopupMenu):
+
2018-05-18 Eric Carlson <[email protected]>
Handle failure to extend sandbox gracefully
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (231979 => 231980)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2018-05-18 20:13:34 UTC (rev 231979)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2018-05-18 20:20:35 UTC (rev 231980)
@@ -180,7 +180,7 @@
#if PLATFORM(MAC)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
parameters.accessibilityEnhancedUserInterfaceEnabled = [[NSApp accessibilityAttributeValue:@"AXEnhancedUserInterface"] boolValue];
#pragma clang diagnostic pop
#else
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (231979 => 231980)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm 2018-05-18 20:13:34 UTC (rev 231979)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm 2018-05-18 20:20:35 UTC (rev 231980)
@@ -1295,7 +1295,7 @@
{
static_cast<PageClientImpl&>(*m_pageClient).setImpl(*this);
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
[NSApp registerServicesMenuSendTypes:PasteboardTypes::forSelection() returnTypes:PasteboardTypes::forEditing()];
[view addTrackingArea:m_primaryTrackingArea.get()];
@@ -1429,7 +1429,7 @@
bool WebViewImpl::becomeFirstResponder()
{
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
// If we just became first responder again, there is no need to do anything,
// since resignFirstResponder has correctly detected this situation.
if (m_willBecomeFirstResponderAgain) {
@@ -2386,7 +2386,7 @@
void WebViewImpl::pluginFocusOrWindowFocusChanged(bool pluginHasFocusAndWindowHasFocus, uint64_t pluginComplexTextInputIdentifier)
{
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
BOOL inputSourceChanged = m_pluginComplexTextInputIdentifier;
if (pluginHasFocusAndWindowHasFocus) {
@@ -2696,7 +2696,7 @@
bool WebViewImpl::validateUserInterfaceItem(id <NSValidatedUserInterfaceItem> item)
{
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
SEL action = "" action];
if (action == @selector(showGuessPanel:)) {
@@ -2818,7 +2818,7 @@
void WebViewImpl::startSpeaking()
{
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
m_page->getSelectionOrContentsAsString([](const String& string, WebKit::CallbackBase::Error error) {
if (error != WebKit::CallbackBase::Error::None)
return;
@@ -2831,7 +2831,7 @@
void WebViewImpl::stopSpeaking(id sender)
{
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
[NSApp stopSpeaking:sender];
}
@@ -3639,7 +3639,7 @@
static WebCore::DragApplicationFlags applicationFlagsForDrag(NSView *view, id <NSDraggingInfo> draggingInfo)
{
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
uint32_t flags = 0;
if ([NSApp modalWindow])
flags = WebCore::DragApplicationIsModal;
@@ -4252,7 +4252,7 @@
void WebViewImpl::doneWithKeyEvent(NSEvent *event, bool eventWasHandled)
{
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
if ([event type] != NSEventTypeKeyDown)
return;
Modified: trunk/Source/WebKit/UIProcess/Gamepad/mac/UIGamepadProviderMac.mm (231979 => 231980)
--- trunk/Source/WebKit/UIProcess/Gamepad/mac/UIGamepadProviderMac.mm 2018-05-18 20:13:34 UTC (rev 231979)
+++ trunk/Source/WebKit/UIProcess/Gamepad/mac/UIGamepadProviderMac.mm 2018-05-18 20:20:35 UTC (rev 231980)
@@ -38,7 +38,7 @@
WebPageProxy* UIGamepadProvider::platformWebPageProxyForGamepadInput()
{
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
auto responder = [[NSApp keyWindow] firstResponder];
#if WK_API_ENABLED
Modified: trunk/Source/WebKit/UIProcess/Plugins/mac/PluginProcessProxyMac.mm (231979 => 231980)
--- trunk/Source/WebKit/UIProcess/Plugins/mac/PluginProcessProxyMac.mm 2018-05-18 20:13:34 UTC (rev 231979)
+++ trunk/Source/WebKit/UIProcess/Plugins/mac/PluginProcessProxyMac.mm 2018-05-18 20:20:35 UTC (rev 231980)
@@ -132,7 +132,7 @@
void PluginProcessProxy::enterFullscreen()
{
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
// Get the current presentation options.
m_preFullscreenAppPresentationOptions = [NSApp presentationOptions];
@@ -193,7 +193,7 @@
{
ASSERT(!m_placeholderWindow);
ASSERT(!m_activationObserver);
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
m_placeholderWindow = adoptNS([[WKPlaceholderModalWindow alloc] initWithContentRect:NSMakeRect(0, 0, 1, 1) styleMask:NSWindowStyleMaskBorderless backing:NSBackingStoreBuffered defer:YES]);
[m_placeholderWindow setReleasedWhenClosed:NO];
@@ -215,7 +215,7 @@
{
ASSERT(m_placeholderWindow);
ASSERT(m_activationObserver);
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
[[NSNotificationCenter defaultCenter] removeObserver:m_activationObserver.get()];
m_activationObserver = nullptr;
Modified: trunk/Source/WebKit/UIProcess/mac/DisplayLink.cpp (231979 => 231980)
--- trunk/Source/WebKit/UIProcess/mac/DisplayLink.cpp 2018-05-18 20:13:34 UTC (rev 231979)
+++ trunk/Source/WebKit/UIProcess/mac/DisplayLink.cpp 2018-05-18 20:20:35 UTC (rev 231980)
@@ -37,7 +37,7 @@
DisplayLink::DisplayLink(WebCore::PlatformDisplayID displayID, WebPageProxy& webPageProxy)
{
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
CVReturn error = CVDisplayLinkCreateWithCGDisplay(displayID, &m_displayLink);
if (error) {
WTFLogAlways("Could not create a display link: %d", error);
@@ -57,7 +57,7 @@
DisplayLink::~DisplayLink()
{
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
ASSERT(m_displayLink);
if (!m_displayLink)
return;
Modified: trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm (231979 => 231980)
--- trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm 2018-05-18 20:13:34 UTC (rev 231979)
+++ trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm 2018-05-18 20:20:35 UTC (rev 231980)
@@ -133,19 +133,19 @@
void WebPageProxy::getIsSpeaking(bool& isSpeaking)
{
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
isSpeaking = [NSApp isSpeaking];
}
void WebPageProxy::speak(const String& string)
{
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
[NSApp speakString:nsStringFromWebCoreString(string)];
}
void WebPageProxy::stopSpeaking()
{
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
[NSApp stopSpeaking:nil];
}
@@ -684,7 +684,7 @@
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
void WebPageProxy::startDisplayLink(unsigned observerID)
{
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
if (!m_displayLink) {
uint32_t displayID = [[[[platformWindow() screen] deviceDescription] objectForKey:@"NSScreenNumber"] intValue];
m_displayLink = std::make_unique<DisplayLink>(displayID, *this);
Modified: trunk/Source/WebKit/UIProcess/mac/WebPopupMenuProxyMac.mm (231979 => 231980)
--- trunk/Source/WebKit/UIProcess/mac/WebPopupMenuProxyMac.mm 2018-05-18 20:13:34 UTC (rev 231979)
+++ trunk/Source/WebKit/UIProcess/mac/WebPopupMenuProxyMac.mm 2018-05-18 20:20:35 UTC (rev 231980)
@@ -99,7 +99,7 @@
void WebPopupMenuProxyMac::showPopupMenu(const IntRect& rect, TextDirection textDirection, double pageScaleFactor, const Vector<WebPopupItem>& items, const PlatformPopupMenuData& data, int32_t selectedIndex)
{
- RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
NSFont *font;
if (data.fontInfo.fontAttributeDictionary) {
NSFontDescriptor *fontDescriptor = [NSFontDescriptor fontDescriptorWithFontAttributes:(NSDictionary *)data.fontInfo.fontAttributeDictionary.get()];