Assert that NSApp is not running in the WebProcess.
authorpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Feb 2018 22:33:10 +0000 (22:33 +0000)
committerpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Feb 2018 22:33:10 +0000 (22:33 +0000)
commit29569cb856f0953598d06838d8dd119de8c4e6dc
treeba8b54b9357afb8b51ca93ccfa49403eaaef9ea9
parent28f885e20135de44b02409d7c48298190ba7f311
Assert that NSApp is not running in the WebProcess.
https://bugs.webkit.org/show_bug.cgi?id=182553
<rdar://problem/37316144>

Reviewed by Simon Fraser.

In WebCore, there are a few places where NSApp is referenced. Since the WebContent process
is no longer using the NSApplication run loop, and NSApp is no longer guaranteed to be
valid, we should make sure that the NSApp is not referenced by the WebContent process or
the Network process, by asserting that the NSApplication event loop is running when NSApp
is referenced. It is still ok for the UIProcess to reference NSApp. Adding these assert
will help catch references to NSApp when the NSApplication run loop is not used.
Also, do not post a fake mouse event in PasteBoard::setDragImage when the NSApplication
run loop is not running, since this is only relevant in WK1.

No new tests, covered by existing tests.

* page/mac/EventHandlerMac.mm:
(WebCore::lastEventIsMouseUp):
(WebCore::EventHandler::sendFakeEventsAfterWidgetTracking):
* platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::setDragImage):
* platform/mac/WebVideoFullscreenController.mm:
(-[WebVideoFullscreenController windowDidLoad]):
(-[WebVideoFullscreenController updateMenuAndDockForFullscreen]):
* platform/mac/WebWindowAnimation.mm:
(WebCore::WebWindowAnimationDurationFromDuration):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228243 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/page/mac/EventHandlerMac.mm
Source/WebCore/platform/mac/EventLoopMac.mm
Source/WebCore/platform/mac/PasteboardMac.mm
Source/WebCore/platform/mac/WebVideoFullscreenController.mm
Source/WebCore/platform/mac/WebWindowAnimation.mm