2009-02-12 Anders Carlsson <andersca@apple.com>
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Feb 2009 22:43:14 +0000 (22:43 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Feb 2009 22:43:14 +0000 (22:43 +0000)
        Reviewed by Kevin Decker.

        <rdar://problem/6579412>
        REGRESSION (3.2.1-ToT): Crash in Silverlight viewing streaming lecture

        * Plugins/WebNetscapePluginView.h:
        * Plugins/WebNetscapePluginView.mm:
        (-[WebNetscapePluginView userAgent]):
        Apply workaround for Silverlight workaround.

        (-[WebNetscapePluginView _createPlugin]):
        Check if the plug-in that we're creating is the silverlight plug-in.

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

WebKit/mac/ChangeLog
WebKit/mac/Plugins/WebNetscapePluginView.h
WebKit/mac/Plugins/WebNetscapePluginView.mm

index 96370f0f849f451bd407d4ee34ad886149558207..e5a354aecaaa3d9f72c818a6e7d6b3f444300b29 100644 (file)
@@ -1,3 +1,18 @@
+2009-02-12  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Kevin Decker.
+
+        <rdar://problem/6579412> 
+        REGRESSION (3.2.1-ToT): Crash in Silverlight viewing streaming lecture
+        
+        * Plugins/WebNetscapePluginView.h:
+        * Plugins/WebNetscapePluginView.mm:
+        (-[WebNetscapePluginView userAgent]):
+        Apply workaround for Silverlight workaround.
+        
+        (-[WebNetscapePluginView _createPlugin]):
+        Check if the plug-in that we're creating is the silverlight plug-in.
+
 2009-02-12  Brady Eidson  <beidson@apple.com>
 
         Reviewed by Darin Adler
index 126e078db33d1832f27dd36bf8040bbfc4e4125a..eec6c9b6fb9d4d72dc08aa4cba341e748dfabc1d 100644 (file)
@@ -101,6 +101,8 @@ typedef struct _NPPluginTextInputFuncs NPPluginTextInputFuncs;
     HashSet<RefPtr<WebNetscapePluginStream> > streams;
     RetainPtr<NSMutableDictionary> _pendingFrameLoads;
     
+    BOOL _isSilverlight;
+    
     NPPluginTextInputFuncs *textInputFuncs;
 }
 
index ce54f69f2814515be9e69b57dadb0839c2890782..fd54ef3e9cdb3a33917ea1c27c02cde1be37fc87 100644 (file)
@@ -1928,7 +1928,16 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
 
 - (const char *)userAgent
 {
-    return [[[self webView] userAgentForURL:_baseURL.get()] UTF8String];
+    NSString *userAgent = [[self webView] userAgentForURL:_baseURL.get()];
+    
+    if (_isSilverlight) {
+        // Silverlight has a workaround for a leak in Safari 2. This workaround is 
+        // applied when the user agent does not contain "Version/3" so we append it
+        // at the end of the user agent.
+        userAgent = [userAgent stringByAppendingString:@" Version/3.2.1"];
+    }        
+        
+    return [userAgent UTF8String];
 }
 
 -(void)status:(const char *)message
@@ -2237,6 +2246,8 @@ static NPBrowserTextInputFuncs *browserTextInputFuncs()
 
     PluginMainThreadScheduler::scheduler().registerPlugin(plugin);
     
+    _isSilverlight = [[[_pluginPackage.get() bundle] bundleIdentifier] isEqualToString:@"com.microsoft.SilverlightPlugin"];
+
     [[self class] setCurrentPluginView:self];
     NPError npErr = [_pluginPackage.get() pluginFuncs]->newp((char *)[_MIMEType.get() cString], plugin, _mode, argsCount, cAttributes, cValues, NULL);
     [[self class] setCurrentPluginView:nil];