Reviewed by John.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Aug 2006 22:58:11 +0000 (22:58 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Aug 2006 22:58:11 +0000 (22:58 +0000)
        - fixed problem that could cause assertion failures in Safari

        * Plugins/WebBaseNetscapePluginView.m:
        (-[WebBaseNetscapePluginView loadRequest:inTarget:withNotifyData:sendNotification:]): Don't
        allow a plugin to start new loads once its document is no longer the one actively loading.

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

WebKit/ChangeLog
WebKit/Plugins/WebBaseNetscapePluginView.m

index c995baaca92ea72e318131ab45ed741fdaa4013b..927327501f7ca58da734cfd153fcabf97e5b82f2 100644 (file)
@@ -1,3 +1,13 @@
+2006-08-03  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by John.
+
+        - fixed problem that could cause assertion failures in Safari
+        
+        * Plugins/WebBaseNetscapePluginView.m:
+        (-[WebBaseNetscapePluginView loadRequest:inTarget:withNotifyData:sendNotification:]): Don't
+        allow a plugin to start new loads once its document is no longer the one actively loading.
+
 2006-08-03  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by John.
index 789754df266f5f653bf3ebcf096a2ec3b8a3241a..23b12d85aeca64798b8b0868df30a8ceb248db97 100644 (file)
@@ -35,6 +35,7 @@
 #import <WebKit/WebDataSource.h>
 #import <WebKit/WebDefaultUIDelegate.h>
 #import <WebKit/WebFrameInternal.h> 
+#import <WebKit/WebFrameLoader.h> 
 #import <WebKit/WebFrameView.h>
 #import <WebKit/WebKitLogging.h>
 #import <WebKit/WebKitNSStringExtras.h>
@@ -1886,9 +1887,13 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
 {
     NSURL *URL = [request URL];
 
-    if (!URL) {
+    if (!URL) 
         return NPERR_INVALID_URL;
-    }
+
+    // don't let a plugin start any loads if it is no longer part of a document that is being
+    // displayed
+    if ([self dataSource] !=  [[[self webFrame] _frameLoader] activeDataSource])
+        return NPERR_GENERIC_ERROR;
     
     NSString *JSString = [URL _webkit_scriptIfJavaScriptURL];
     if (JSString != nil) {
@@ -1921,17 +1926,16 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
         WebPluginRequest *pluginRequest = [[WebPluginRequest alloc] initWithRequest:request frameName:target notifyData:notifyData sendNotification:sendNotification didStartFromUserGesture:currentEventIsUserGesture];
         [self performSelector:@selector(loadPluginRequest:) withObject:pluginRequest afterDelay:0];
         [pluginRequest release];
-        if (target) {
+        if (target)
             CFRelease(target);
-        }
     } else {
         WebNetscapePluginStream *stream = [[WebNetscapePluginStream alloc] initWithRequest:request 
                                                                              pluginPointer:instance 
                                                                                 notifyData:notifyData 
                                                                           sendNotification:sendNotification];
-        if (!stream) {
+        if (!stream)
             return NPERR_INVALID_URL;
-        }
+
         [streams addObject:stream];
         [stream start];
         [stream release];