Modified: trunk/Source/WebCore/ChangeLog (198039 => 198040)
--- trunk/Source/WebCore/ChangeLog 2016-03-11 20:04:14 UTC (rev 198039)
+++ trunk/Source/WebCore/ChangeLog 2016-03-11 20:26:09 UTC (rev 198040)
@@ -1,3 +1,67 @@
+2016-03-11 Chris Dumez <[email protected]>
+
+ iOS-sim debug: WebCoreNSURLSessionTest.BasicOperation and WebCoreNSURLSessionTest.InvalidateEmpty asserting
+ https://bugs.webkit.org/show_bug.cgi?id=155256
+
+ Reviewed by Alexey Proskuryakov.
+
+ r197628 consolidated the runtime application checking code for iOS and
+ Mac. However, while the new code works fine for WebKit2, it is unsafe
+ on WebKit1 / iOS and hits assertion in debug. The reason is that
+ applicationBundleIdentifier() for getting called from several threads
+ (WebThread, UIThread).
+
+ To address the problem, this patch renames applicationBundleIdentifier()
+ to applicationBundleIdentifierOverride() and only initializes the
+ override upon WebProcess and Network process initialization. We therefore
+ do not initialize the override in WebKit1 or in the WebKit2 UIProcess.
+ When the override is not set, we fall back to using the main bundle
+ identifier (which does the right thing for WebKit1 / WebKit2 UIProcess)
+ but without caching it to avoid thread safety issues.
+
+ No new tests, already covered by API tests currently crashing.
+
+ * platform/RuntimeApplicationChecks.mm:
+ (WebCore::applicationBundleIdentifierOverride):
+ - Renamed applicationBundleIdentifier() to applicationBundleIdentifierOverride()
+ and only initialize upon initialization of the WebProcess or the Network
+ process.
+ - In debug, set a flag to indicate that the override was already queried.
+
+ (WebCore::applicationBundleIdentifier):
+ New utility function that is returns the application bundle override if it is
+ set and fallback to calling [[NSBundle mainBundle] bundleIdentifier] otherwise.
+
+ (WebCore::setApplicationBundleIdentifier):
+ Add assertions to make sure that:
+ 1. This is always called from the main thread.
+ 2. The application bundle identifier has not been queried *before* getting
+ overriden as this would indicate a bug in our code and we would have wrongly
+ returned the main bundle identifier in such case.
+
+ (WebCore::MacApplication::isAppleMail):
+ (WebCore::MacApplication::isIBooks):
+ (WebCore::MacApplication::isITunes):
+ (WebCore::MacApplication::isMicrosoftMessenger):
+ (WebCore::MacApplication::isAdobeInstaller):
+ (WebCore::MacApplication::isMicrosoftOutlook):
+ (WebCore::MacApplication::isQuickenEssentials):
+ (WebCore::MacApplication::isAperture):
+ (WebCore::MacApplication::isVersions):
+ (WebCore::MacApplication::isHRBlock):
+ (WebCore::MacApplication::isHipChat):
+ (WebCore::IOSApplication::isMobileSafari):
+ (WebCore::IOSApplication::isDumpRenderTree):
+ (WebCore::IOSApplication::isMobileStore):
+ (WebCore::IOSApplication::isFacebook):
+ (WebCore::IOSApplication::isDaijisenDictionary):
+ (WebCore::IOSApplication::isNASAHD):
+ (WebCore::IOSApplication::isTheEconomistOnIphone):
+ (WebCore::IOSApplication::isWebProcess):
+ (WebCore::IOSApplication::isIBooks):
+ Drop assertions making sure the cached flag is correct. We now have
+ an assertion to detect this earlier in setApplicationBundleIdentifier().
+
2016-03-10 Jer Noble <[email protected]>
Web Audio becomes distorted after sample rate changes
Modified: trunk/Source/WebCore/platform/RuntimeApplicationChecks.mm (198039 => 198040)
--- trunk/Source/WebCore/platform/RuntimeApplicationChecks.mm 2016-03-11 20:04:14 UTC (rev 198039)
+++ trunk/Source/WebCore/platform/RuntimeApplicationChecks.mm 2016-03-11 20:26:09 UTC (rev 198040)
@@ -33,22 +33,34 @@
namespace WebCore {
+#if !ASSERT_MSG_DISABLED
+static bool applicationBundleIdentifierOverrideWasQueried = false;
+#endif
+
// The application bundle identifier gets set to the UIProcess bundle identifier by the WebProcess and
-// the networking process upon initialization.
-// If not explicitly set, this will return the main bundle identifier which is accurate for WK1 or
-// the WK2 UIProcess.
-static String& applicationBundleIdentifier()
+// the Networking upon initialization. It is unset otherwise.
+static String& applicationBundleIdentifierOverride()
{
- ASSERT(RunLoop::isMain());
-
- static NeverDestroyed<String> identifier([[NSBundle mainBundle] bundleIdentifier]);
-
+ static NeverDestroyed<String> identifier;
+#if !ASSERT_MSG_DISABLED
+ applicationBundleIdentifierOverrideWasQueried = true;
+#endif
return identifier;
}
+static String applicationBundleIdentifier()
+{
+ // The override only gets set in WebKit2's WebProcess and NetworkProcess. If unset, we use the main bundle identifier.
+ const auto& identifier = applicationBundleIdentifierOverride();
+ ASSERT(identifier.isNull() || RunLoop::isMain());
+ return identifier.isNull() ? String([[NSBundle mainBundle] bundleIdentifier]) : identifier;
+}
+
void setApplicationBundleIdentifier(const String& bundleIdentifier)
{
- applicationBundleIdentifier() = bundleIdentifier;
+ ASSERT(RunLoop::isMain());
+ ASSERT_WITH_MESSAGE(!applicationBundleIdentifierOverrideWasQueried, "applicationBundleIsEqualTo() should not be called before setApplicationBundleIdentifier()");
+ applicationBundleIdentifierOverride() = bundleIdentifier;
}
static bool applicationBundleIsEqualTo(const String& bundleIdentifierString)
@@ -61,106 +73,90 @@
bool MacApplication::isSafari()
{
static bool isSafari = applicationBundleIsEqualTo("com.apple.Safari");
- ASSERT_WITH_MESSAGE(isSafari == applicationBundleIsEqualTo("com.apple.Safari"), "Should not be called before setApplicationBundleIdentifier()");
return isSafari;
}
bool MacApplication::isAppleMail()
{
static bool isAppleMail = applicationBundleIsEqualTo("com.apple.mail");
- ASSERT_WITH_MESSAGE(isAppleMail == applicationBundleIsEqualTo("com.apple.mail"), "Should not be called before setApplicationBundleIdentifier()");
return isAppleMail;
}
bool MacApplication::isIBooks()
{
static bool isIBooks = applicationBundleIsEqualTo("com.apple.iBooksX");
- ASSERT_WITH_MESSAGE(isIBooks == applicationBundleIsEqualTo("com.apple.iBooksX"), "Should not be called before setApplicationBundleIdentifier()");
return isIBooks;
}
bool MacApplication::isITunes()
{
static bool isITunes = applicationBundleIsEqualTo("com.apple.iTunes");
- ASSERT_WITH_MESSAGE(isITunes == applicationBundleIsEqualTo("com.apple.iTunes"), "Should not be called before setApplicationBundleIdentifier()");
return isITunes;
}
bool MacApplication::isMicrosoftMessenger()
{
static bool isMicrosoftMessenger = applicationBundleIsEqualTo("com.microsoft.Messenger");
- ASSERT_WITH_MESSAGE(isMicrosoftMessenger == applicationBundleIsEqualTo("com.microsoft.Messenger"), "Should not be called before setApplicationBundleIdentifier()");
return isMicrosoftMessenger;
}
bool MacApplication::isAdobeInstaller()
{
static bool isAdobeInstaller = applicationBundleIsEqualTo("com.adobe.Installers.Setup");
- ASSERT_WITH_MESSAGE(isAdobeInstaller == applicationBundleIsEqualTo("com.adobe.Installers.Setup"), "Should not be called before setApplicationBundleIdentifier()");
return isAdobeInstaller;
}
bool MacApplication::isAOLInstantMessenger()
{
static bool isAOLInstantMessenger = applicationBundleIsEqualTo("com.aol.aim.desktop");
- ASSERT_WITH_MESSAGE(isAOLInstantMessenger == applicationBundleIsEqualTo("com.aol.aim.desktop"), "Should not be called before setApplicationBundleIdentifier()");
return isAOLInstantMessenger;
}
bool MacApplication::isMicrosoftMyDay()
{
static bool isMicrosoftMyDay = applicationBundleIsEqualTo("com.microsoft.myday");
- ASSERT_WITH_MESSAGE(isMicrosoftMyDay == applicationBundleIsEqualTo("com.microsoft.myday"), "Should not be called before setApplicationBundleIdentifier()");
return isMicrosoftMyDay;
}
bool MacApplication::isMicrosoftOutlook()
{
static bool isMicrosoftOutlook = applicationBundleIsEqualTo("com.microsoft.Outlook");
- ASSERT_WITH_MESSAGE(isMicrosoftOutlook == applicationBundleIsEqualTo("com.microsoft.Outlook"), "Should not be called before setApplicationBundleIdentifier()");
return isMicrosoftOutlook;
}
bool MacApplication::isQuickenEssentials()
{
static bool isQuickenEssentials = applicationBundleIsEqualTo("com.intuit.QuickenEssentials");
- ASSERT_WITH_MESSAGE(isQuickenEssentials == applicationBundleIsEqualTo("com.intuit.QuickenEssentials"), "Should not be called before setApplicationBundleIdentifier()");
return isQuickenEssentials;
}
bool MacApplication::isAperture()
{
static bool isAperture = applicationBundleIsEqualTo("com.apple.Aperture");
- ASSERT_WITH_MESSAGE(isAperture == applicationBundleIsEqualTo("com.apple.Aperture"), "Should not be called before setApplicationBundleIdentifier()");
return isAperture;
}
bool MacApplication::isVersions()
{
static bool isVersions = applicationBundleIsEqualTo("com.blackpixel.versions");
- ASSERT_WITH_MESSAGE(isVersions == applicationBundleIsEqualTo("com.blackpixel.versions"), "Should not be called before setApplicationBundleIdentifier()");
return isVersions;
}
bool MacApplication::isHRBlock()
{
static bool isHRBlock = applicationBundleIsEqualTo("com.hrblock.tax.2010");
- ASSERT_WITH_MESSAGE(isHRBlock == applicationBundleIsEqualTo("com.hrblock.tax.2010"), "Should not be called before setApplicationBundleIdentifier()");
return isHRBlock;
}
bool MacApplication::isSolidStateNetworksDownloader()
{
static bool isSolidStateNetworksDownloader = applicationBundleIsEqualTo("com.solidstatenetworks.awkhost");
- ASSERT_WITH_MESSAGE(isSolidStateNetworksDownloader == applicationBundleIsEqualTo("com.solidstatenetworks.awkhost"), "Should not be called before setApplicationBundleIdentifier()");
-
return isSolidStateNetworksDownloader;
}
bool MacApplication::isHipChat()
{
static bool isHipChat = applicationBundleIsEqualTo("com.hipchat.HipChat");
- ASSERT_WITH_MESSAGE(isHipChat == applicationBundleIsEqualTo("com.hipchat.HipChat"), "Should not be called before setApplicationBundleIdentifier()");
return isHipChat;
}
@@ -171,14 +167,12 @@
bool IOSApplication::isMobileMail()
{
static bool isMobileMail = applicationBundleIsEqualTo("com.apple.mobilemail");
- ASSERT_WITH_MESSAGE(isMobileMail == applicationBundleIsEqualTo("com.apple.mobilemail"), "Should not be called before setApplicationBundleIdentifier()");
return isMobileMail;
}
bool IOSApplication::isMobileSafari()
{
static bool isMobileSafari = applicationBundleIsEqualTo("com.apple.mobilesafari");
- ASSERT_WITH_MESSAGE(isMobileSafari == applicationBundleIsEqualTo("com.apple.mobilesafari"), "Should not be called before setApplicationBundleIdentifier()");
return isMobileSafari;
}
@@ -187,56 +181,48 @@
// We use a prefix match instead of strict equality since LayoutTestRelay may launch multiple instances of
// DumpRenderTree where the bundle identifier of each instance has a unique suffix.
static bool isDumpRenderTree = applicationBundleIsEqualTo("org.webkit.DumpRenderTree"); // e.g. org.webkit.DumpRenderTree0
- ASSERT_WITH_MESSAGE(isDumpRenderTree == applicationBundleIsEqualTo("org.webkit.DumpRenderTree"), "Should not be called before setApplicationBundleIdentifier()");
return isDumpRenderTree;
}
bool IOSApplication::isMobileStore()
{
static bool isMobileStore = applicationBundleIsEqualTo("com.apple.MobileStore");
- ASSERT_WITH_MESSAGE(isMobileStore == applicationBundleIsEqualTo("com.apple.MobileStore"), "Should not be called before setApplicationBundleIdentifier()");
return isMobileStore;
}
bool IOSApplication::isWebApp()
{
static bool isWebApp = applicationBundleIsEqualTo("com.apple.webapp");
- ASSERT_WITH_MESSAGE(isWebApp == applicationBundleIsEqualTo("com.apple.webapp"), "Should not be called before setApplicationBundleIdentifier()");
return isWebApp;
}
bool IOSApplication::isOkCupid()
{
static bool isOkCupid = applicationBundleIsEqualTo("com.okcupid.app");
- ASSERT_WITH_MESSAGE(isOkCupid == applicationBundleIsEqualTo("com.okcupid.app"), "Should not be called before setApplicationBundleIdentifier()");
return isOkCupid;
}
bool IOSApplication::isFacebook()
{
static bool isFacebook = applicationBundleIsEqualTo("com.facebook.Facebook");
- ASSERT_WITH_MESSAGE(isFacebook == applicationBundleIsEqualTo("com.facebook.Facebook"), "Should not be called before setApplicationBundleIdentifier()");
return isFacebook;
}
bool IOSApplication::isDaijisenDictionary()
{
static bool isDaijisenDictionary = applicationBundleIsEqualTo("jp.co.shogakukan.daijisen2009i");
- ASSERT_WITH_MESSAGE(isDaijisenDictionary == applicationBundleIsEqualTo("jp.co.shogakukan.daijisen2009i"), "Should not be called before setApplicationBundleIdentifier()");
return isDaijisenDictionary;
}
bool IOSApplication::isNASAHD()
{
static bool isNASAHD = applicationBundleIsEqualTo("gov.nasa.NASAHD");
- ASSERT_WITH_MESSAGE(isNASAHD == applicationBundleIsEqualTo("gov.nasa.NASAHD"), "Should not be called before setApplicationBundleIdentifier()");
return isNASAHD;
}
bool IOSApplication::isTheEconomistOnIphone()
{
static bool isTheEconomistOnIphone = applicationBundleIsEqualTo("com.economist.iphone");
- ASSERT_WITH_MESSAGE(isTheEconomistOnIphone == applicationBundleIsEqualTo("com.economist.iphone"), "Should not be called before setApplicationBundleIdentifier()");
return isTheEconomistOnIphone;
}
@@ -252,7 +238,6 @@
bool IOSApplication::isIBooks()
{
static bool isIBooks = applicationBundleIsEqualTo("com.apple.iBooks");
- ASSERT_WITH_MESSAGE(isIBooks == applicationBundleIsEqualTo("com.apple.iBooks"), "Should not be called before setApplicationBundleIdentifier()");
return isIBooks;
}