2009-05-14 Darin Adler <darin@apple.com>
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 May 2009 16:39:48 +0000 (16:39 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 May 2009 16:39:48 +0000 (16:39 +0000)
        Reviewed by Adam Roben.

        <rdar://problem/6879999> Automator actions that use WebKit on a background thread fail when run outside of Automator

        * WebView/WebView.mm:
        (clientNeedsWebViewInitThreadWorkaround): Added. Contains new broader rule.
        (needsWebViewInitThreadWorkaround): Changed to call clientNeedsWebViewInitThreadWorkaround.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@43708 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/mac/ChangeLog
WebKit/mac/WebView/WebView.mm

index 0aed4c7..8bf12c8 100644 (file)
@@ -1,5 +1,15 @@
 2009-05-14  Darin Adler  <darin@apple.com>
 
+        Reviewed by Adam Roben.
+
+        <rdar://problem/6879999> Automator actions that use WebKit on a background thread fail when run outside of Automator
+
+        * WebView/WebView.mm:
+        (clientNeedsWebViewInitThreadWorkaround): Added. Contains new broader rule.
+        (needsWebViewInitThreadWorkaround): Changed to call clientNeedsWebViewInitThreadWorkaround.
+
+2009-05-14  Darin Adler  <darin@apple.com>
+
         Reviewed by John Sullivan.
 
         Bug 24049: Second right-click crashes safari when alert invoked
index 87973d3..d2eb5ed 100644 (file)
@@ -2512,11 +2512,35 @@ WebScriptDebugDelegateImplementationCache* WebViewGetScriptDebugDelegateImplemen
     return self;
 }
 
+static bool clientNeedsWebViewInitThreadWorkaround()
+{
+    if (WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_WEBVIEW_INIT_THREAD_WORKAROUND))
+        return false;
+
+    NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];
+
+    // Installer.
+    if ([bundleIdentifier _webkit_isCaseInsensitiveEqualToString:@"com.apple.installer"])
+        return true;
+
+    // Automator.
+    if ([bundleIdentifier _webkit_isCaseInsensitiveEqualToString:@"com.apple.Automator"])
+        return true;
+
+    // Automator Runner.
+    if ([bundleIdentifier _webkit_isCaseInsensitiveEqualToString:@"com.apple.AutomatorRunner"])
+        return true;
+
+    // Automator workflows.
+    if ([bundleIdentifier _webkit_hasCaseInsensitivePrefix:@"com.apple.Automator."])
+        return true;
+
+    return false;
+}
+
 static bool needsWebViewInitThreadWorkaround()
 {
-    static BOOL isOldClient = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_WEBVIEW_INIT_THREAD_WORKAROUND)
-        && ([[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.installer"] ||
-            [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.Automator"]);
+    static bool isOldClient = clientNeedsWebViewInitThreadWorkaround();
     return isOldClient && !pthread_main_np();
 }