Add logging when SpringBoard enables WebThread
<https://webkit.org/b/185100>
<rdar://problem/39746542>
Reviewed by Daniel Bates.
Source/WebCore:
* platform/RuntimeApplicationChecks.h:
(WebCore::IOSApplication::isSpringBoard): Add declaration.
* platform/cocoa/RuntimeApplicationChecksCocoa.mm:
(WebCore::IOSApplication::isSpringBoard): Add implementation.
* platform/ios/wak/WebCoreThread.mm:
(WebThreadEnable): Call RELEASE_LOG_FAULT() if this is called by
SpringBoard.
Source/WTF:
* wtf/Assertions.h:
(RELEASE_LOG_FAULT): Add macro to call os_log_fault().
* wtf/Platform.h: Drive-by fix to enable USE(OS_LOG) on
public iOS SDKs since <rdar://problem/27758343> was
fixed in iOS 11.0.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@231130 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog
index 6cb0c0e..a05d6d4 100644
--- a/Source/WTF/ChangeLog
+++ b/Source/WTF/ChangeLog
@@ -1,3 +1,17 @@
+2018-04-27 David Kilzer <ddkilzer@apple.com>
+
+ Add logging when SpringBoard enables WebThread
+ <https://webkit.org/b/185100>
+ <rdar://problem/39746542>
+
+ Reviewed by Daniel Bates.
+
+ * wtf/Assertions.h:
+ (RELEASE_LOG_FAULT): Add macro to call os_log_fault().
+ * wtf/Platform.h: Drive-by fix to enable USE(OS_LOG) on
+ public iOS SDKs since <rdar://problem/27758343> was
+ fixed in iOS 11.0.
+
2018-04-26 Mark Lam <mark.lam@apple.com>
Gardening: Speculative build fix for Windows.
diff --git a/Source/WTF/wtf/Assertions.h b/Source/WTF/wtf/Assertions.h
index ea0024b..d823f7c 100644
--- a/Source/WTF/wtf/Assertions.h
+++ b/Source/WTF/wtf/Assertions.h
@@ -445,6 +445,7 @@
#if RELEASE_LOG_DISABLED
#define RELEASE_LOG(channel, ...) ((void)0)
#define RELEASE_LOG_ERROR(channel, ...) LOG_ERROR(__VA_ARGS__)
+#define RELEASE_LOG_FAULT(channel, ...) LOG_ERROR(__VA_ARGS__)
#define RELEASE_LOG_IF(isAllowed, channel, ...) ((void)0)
#define RELEASE_LOG_ERROR_IF(isAllowed, channel, ...) do { if (isAllowed) RELEASE_LOG_ERROR(channel, __VA_ARGS__); } while (0)
@@ -454,6 +455,7 @@
#else
#define RELEASE_LOG(channel, ...) os_log(LOG_CHANNEL(channel).osLogChannel, __VA_ARGS__)
#define RELEASE_LOG_ERROR(channel, ...) os_log_error(LOG_CHANNEL(channel).osLogChannel, __VA_ARGS__)
+#define RELEASE_LOG_FAULT(channel, ...) os_log_fault(LOG_CHANNEL(channel).osLogChannel, __VA_ARGS__)
#define RELEASE_LOG_INFO(channel, ...) os_log_info(LOG_CHANNEL(channel).osLogChannel, __VA_ARGS__)
#define RELEASE_LOG_IF(isAllowed, channel, ...) do { if (isAllowed) RELEASE_LOG( channel, __VA_ARGS__); } while (0)
diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h
index d9ba176..5ea719b 100644
--- a/Source/WTF/wtf/Platform.h
+++ b/Source/WTF/wtf/Platform.h
@@ -1263,8 +1263,7 @@
#define USE_MEDIATOOLBOX 1
#endif
-/* FIXME: Enable USE_OS_LOG when building with the public iOS 10 SDK once we fix <rdar://problem/27758343>. */
-#if PLATFORM(MAC) || (PLATFORM(IOS) && USE(APPLE_INTERNAL_SDK))
+#if PLATFORM(MAC) || PLATFORM(IOS)
#define USE_OS_LOG 1
#if USE(APPLE_INTERNAL_SDK)
#define USE_OS_STATE 1
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 0cd1acf..3ee1a38 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2018-04-27 David Kilzer <ddkilzer@apple.com>
+
+ Add logging when SpringBoard enables WebThread
+ <https://webkit.org/b/185100>
+ <rdar://problem/39746542>
+
+ Reviewed by Daniel Bates.
+
+ * platform/RuntimeApplicationChecks.h:
+ (WebCore::IOSApplication::isSpringBoard): Add declaration.
+ * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
+ (WebCore::IOSApplication::isSpringBoard): Add implementation.
+ * platform/ios/wak/WebCoreThread.mm:
+ (WebThreadEnable): Call RELEASE_LOG_FAULT() if this is called by
+ SpringBoard.
+
2018-04-27 Keith Rollin <krollin@apple.com>
Fix crash in DocumentLoader::startLoadingMainResource
diff --git a/Source/WebCore/platform/RuntimeApplicationChecks.h b/Source/WebCore/platform/RuntimeApplicationChecks.h
index af4890d..94e28f8 100644
--- a/Source/WebCore/platform/RuntimeApplicationChecks.h
+++ b/Source/WebCore/platform/RuntimeApplicationChecks.h
@@ -78,6 +78,7 @@
WEBCORE_EXPORT bool isWebBookmarksD();
bool isDumpRenderTree();
bool isMobileStore();
+bool isSpringBoard();
WEBCORE_EXPORT bool isWebApp();
WEBCORE_EXPORT bool isWebProcess();
bool isIBooks();
diff --git a/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm b/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm
index 58626ee..377dcaa 100644
--- a/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm
+++ b/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm
@@ -206,6 +206,12 @@
return isMobileStore;
}
+bool IOSApplication::isSpringBoard()
+{
+ static bool isSpringBoard = applicationBundleIsEqualTo("com.apple.springboard");
+ return isSpringBoard;
+}
+
bool IOSApplication::isWebApp()
{
static bool isWebApp = applicationBundleIsEqualTo("com.apple.webapp");
diff --git a/Source/WebCore/platform/ios/wak/WebCoreThread.mm b/Source/WebCore/platform/ios/wak/WebCoreThread.mm
index b281ecd..4a92bc6 100644
--- a/Source/WebCore/platform/ios/wak/WebCoreThread.mm
+++ b/Source/WebCore/platform/ios/wak/WebCoreThread.mm
@@ -30,6 +30,7 @@
#import "CommonVM.h"
#import "FloatingPointEnvironment.h"
+#import "Logging.h"
#import "RuntimeApplicationChecks.h"
#import "ThreadGlobalData.h"
#import "WAKWindow.h"
@@ -876,6 +877,8 @@
void WebThreadEnable(void)
{
RELEASE_ASSERT_WITH_MESSAGE(!WebCore::IOSApplication::isWebProcess(), "The WebProcess should never run a Web Thread");
+ if (WebCore::IOSApplication::isSpringBoard())
+ RELEASE_LOG_FAULT(Threading, "SpringBoard enabled WebThread.");
static std::once_flag flag;
std::call_once(flag, StartWebThread);