[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:18:11 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit c594b671a011ab027f6bd8841d6f7d960d45aa84
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jan 1 19:31:36 2003 +0000

    WebKit:
    
            Reviewed by Trey.
    
    	- fixed 3137287 -- REGRESSION: Java applets don't work when you go back to them (Java 1.4.1 plug-in)
    
    	By attaching the plug-in controller to the frame, we run into trouble.
    	It really needs to be attached to the data source, which has the right lifetime
    	and is kept around in the page cache.
    
            * Plugins.subproj/WebPluginController.h: Keep a reference to a data source, not a frame.
    	Add a new _started variable. Rename addPluginView: to addPlugin:, get rid of didAddPluginView:,
    	replace destroyAllPlugins with dataSourceWillBeDeallocated, add startAllPlugins and stopAllPlugins.
            * Plugins.subproj/WebPluginController.m:
            (-[WebPluginController initWithDataSource:]): Store a data source reference, not a frame reference.
    	Don't bother registering for the window will close notification, WebHTMLView handles that fine.
            (-[WebPluginController startAllPlugins]): Do nothing if they are already started, call pluginStart on each otherwise.
            (-[WebPluginController stopAllPlugins]): Do nothing if they are not started, call pluginStop on each otherwise.
            (-[WebPluginController addPlugin:]): Initialize the plugin if it's not already in our list. Also start
    	it if we are in "started" mode.
            (-[WebPluginController dataSourceWillBeDeallocated]): Stop all the plugins, then destroy them.
    	Also nil out the fields of the object. This is always called before the controller is released so we
    	don't need to override dealloc.
            (-[WebPluginController showURL:inFrame:]): Added error checking and changed now that we start with a data source.
            (-[WebPluginController showStatus:]): Ditto.
    
            * WebCoreSupport.subproj/WebBridge.m: (-[WebBridge pluginViewWithPackage:attributes:baseURL:]):
    	Use the data source, not the view. Don't add the plugin here, wait until we are ready to start.
    
            * WebView.subproj/WebDataSourcePrivate.h: Store a pointer to the plug-in controller here.
            * WebView.subproj/WebDataSourcePrivate.m:
            (-[WebDataSourcePrivate dealloc]): Tell the plug-in controller to go away.
    	(-[WebDataSource _makeHandleDelegates:deferCallbacks:]): Remove unused empty method.
            (-[WebDataSource _pluginController]): Create a plug-in controller if needed.
    
            * WebView.subproj/WebFramePrivate.h: Remove plug-in controller code.
            * WebView.subproj/WebFramePrivate.m:
            (-[WebFramePrivate dealloc]): Remove plug-in controller code.
            (-[WebFrame _detachFromParent]): Remove plug-in controller code.
            (-[WebFrame _transitionToCommitted:]): Remove plug-in controller code.
    
            * WebView.subproj/WebHTMLView.m:
            (-[WebHTMLView viewWillMoveToWindow:]): Stop plug-ins when view moves out of a window.
    	This includes the case when the window is being destroyed.
            (-[WebHTMLView viewDidMoveToWindow]): Start plug-ins when view moves into a window.
            (-[WebHTMLView addSubview:]): Add plug-ins to the controller as they are added to us.
    
            * WebView.subproj/WebController.m: Added now-needed include due to header change.
            * WebView.subproj/WebDefaultContextMenuDelegate.m: Ditto.
    
    WebBrowser:
    
            Reviewed by Don and Ken.
    
    	- worked around 3137387 -- Using Java 1.4.1 plug-in causes world leak (NSDocument close never called)
    
            * BrowserWindow.m:
            (-[BrowserWindow setDelegate:]): If someone tries to set the delegate to something other than the
    	BrowserWindowController, don't let them.
            (-[BrowserWindow setWindowController:]): Same thing for the controller.
    
    	- fixed 3137494 -- loading bad URL with PLT window in "world leak check mode" indicates leak, prevents quit
    
            Filed bug 3137567 about the AppKit part of this.
    
            * Test/PageLoadTestRunner.m: (-[NSWindow closeIfBrowserWindow]): Close the sheet, if any, before
    	closing the window.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3223 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 65d6b52..c33b8f0 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,53 @@
+2002-12-31  Darin Adler  <darin at apple.com>
+
+        Reviewed by Trey.
+
+	- fixed 3137287 -- REGRESSION: Java applets don't work when you go back to them (Java 1.4.1 plug-in)
+
+	By attaching the plug-in controller to the frame, we run into trouble.
+	It really needs to be attached to the data source, which has the right lifetime
+	and is kept around in the page cache.
+
+        * Plugins.subproj/WebPluginController.h: Keep a reference to a data source, not a frame.
+	Add a new _started variable. Rename addPluginView: to addPlugin:, get rid of didAddPluginView:,
+	replace destroyAllPlugins with dataSourceWillBeDeallocated, add startAllPlugins and stopAllPlugins.
+        * Plugins.subproj/WebPluginController.m:
+        (-[WebPluginController initWithDataSource:]): Store a data source reference, not a frame reference.
+	Don't bother registering for the window will close notification, WebHTMLView handles that fine.
+        (-[WebPluginController startAllPlugins]): Do nothing if they are already started, call pluginStart on each otherwise.
+        (-[WebPluginController stopAllPlugins]): Do nothing if they are not started, call pluginStop on each otherwise.
+        (-[WebPluginController addPlugin:]): Initialize the plugin if it's not already in our list. Also start
+	it if we are in "started" mode.
+        (-[WebPluginController dataSourceWillBeDeallocated]): Stop all the plugins, then destroy them.
+	Also nil out the fields of the object. This is always called before the controller is released so we
+	don't need to override dealloc.
+        (-[WebPluginController showURL:inFrame:]): Added error checking and changed now that we start with a data source.
+        (-[WebPluginController showStatus:]): Ditto.
+
+        * WebCoreSupport.subproj/WebBridge.m: (-[WebBridge pluginViewWithPackage:attributes:baseURL:]):
+	Use the data source, not the view. Don't add the plugin here, wait until we are ready to start.
+
+        * WebView.subproj/WebDataSourcePrivate.h: Store a pointer to the plug-in controller here.
+        * WebView.subproj/WebDataSourcePrivate.m:
+        (-[WebDataSourcePrivate dealloc]): Tell the plug-in controller to go away.
+	(-[WebDataSource _makeHandleDelegates:deferCallbacks:]): Remove unused empty method.
+        (-[WebDataSource _pluginController]): Create a plug-in controller if needed.
+
+        * WebView.subproj/WebFramePrivate.h: Remove plug-in controller code.
+        * WebView.subproj/WebFramePrivate.m:
+        (-[WebFramePrivate dealloc]): Remove plug-in controller code.
+        (-[WebFrame _detachFromParent]): Remove plug-in controller code.
+        (-[WebFrame _transitionToCommitted:]): Remove plug-in controller code.
+
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView viewWillMoveToWindow:]): Stop plug-ins when view moves out of a window.
+	This includes the case when the window is being destroyed.
+        (-[WebHTMLView viewDidMoveToWindow]): Start plug-ins when view moves into a window.
+        (-[WebHTMLView addSubview:]): Add plug-ins to the controller as they are added to us.
+
+        * WebView.subproj/WebController.m: Added now-needed include due to header change.
+        * WebView.subproj/WebDefaultContextMenuDelegate.m: Ditto.
+
 === Alexander-47 ===
 
 2002-12-30  Darin Adler  <darin at apple.com>
diff --git a/WebKit/Plugins.subproj/WebPluginController.h b/WebKit/Plugins.subproj/WebPluginController.h
index 98bfd08..3cdf821 100644
--- a/WebKit/Plugins.subproj/WebPluginController.h
+++ b/WebKit/Plugins.subproj/WebPluginController.h
@@ -8,22 +8,24 @@
 
 #import <Foundation/Foundation.h>
 
-#import <WebKit/WebPluginContainer.h>
-
- at class WebFrame;
+ at class WebDataSource;
 
 @protocol WebPlugin;
+ at protocol WebPluginContainer;
 
 @interface WebPluginController : NSObject <WebPluginContainer>
 {
-    WebFrame *frame;
-
-    NSMutableArray *views;
+    WebDataSource *_dataSource;
+    NSMutableArray *_views;
+    BOOL _started;
 }
 
-- initWithWebFrame:(WebFrame *)theFrame;
-- (void)addPluginView:(NSView <WebPlugin> *)view;
-- (void)didAddPluginView:(NSView <WebPlugin> *)view;
-- (void)destroyAllPlugins;
+- (id)initWithDataSource:(WebDataSource *)dataSource;
+- (void)dataSourceWillBeDeallocated;
+
+- (void)addPlugin:(NSView <WebPlugin> *)view;
+
+- (void)startAllPlugins;
+- (void)stopAllPlugins;
 
 @end
diff --git a/WebKit/Plugins.subproj/WebPluginController.m b/WebKit/Plugins.subproj/WebPluginController.m
index b882860..2e50464 100644
--- a/WebKit/Plugins.subproj/WebPluginController.m
+++ b/WebKit/Plugins.subproj/WebPluginController.m
@@ -6,114 +6,119 @@
 //  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
 //
 
+#import <WebKit/WebPluginController.h>
+
 #import <WebKit/WebController.h>
 #import <WebKit/WebDataSource.h>
 #import <WebKit/WebFrame.h>
 #import <WebKit/WebKitLogging.h>
 #import <WebKit/WebPlugin.h>
-#import <WebKit/WebPluginController.h>
-#import <WebKit/WebWindowOperationsDelegate.h>
+#import <WebKit/WebPluginContainer.h>
 #import <WebKit/WebView.h>
+#import <WebKit/WebWindowOperationsDelegate.h>
 
-#import <WebFoundation/WebAssertions.h>
 #import <WebFoundation/WebResourceRequest.h>
 
 @implementation WebPluginController
 
-- initWithWebFrame:(WebFrame *)theFrame
+- initWithDataSource:(WebDataSource *)dataSource
 {
     [super init];
-    
-    // Not retained because the frame retains this plug-in controller.
-    frame = theFrame;
-    
-    views = [[NSMutableArray array] retain];
-
-    [[NSNotificationCenter defaultCenter] addObserver:self
-                                             selector:@selector(windowWillClose:)
-                                                 name:NSWindowWillCloseNotification
-                                               object:nil];
-    
+    _dataSource = dataSource;
+    _views = [[NSMutableArray alloc] init];
     return self;
 }
 
-- (void)dealloc
+- (void)startAllPlugins
 {
-    [[NSNotificationCenter defaultCenter] removeObserver:self];
+    if (_started) {
+        return;
+    }
     
-    ASSERT([views count] == 0);
-    [views release];
-    [super dealloc];
-}
+    LOG(Plugins, "starting all plugins");
 
-- (void)addPluginView:(NSView <WebPlugin> *)view
-{
-    LOG(Plugins, "pluginInitialize: %s", [[view className] lossyCString]);
-    
-    [views addObject:view];
-    [view pluginInitialize];
+    [_views makeObjectsPerformSelector:@selector(pluginStart)];
+    _started = YES;
 }
 
-- (void)didAddPluginView:(NSView <WebPlugin> *)view
+- (void)stopAllPlugins
 {
-    LOG(Plugins, "pluginStart: %s", [[view className] lossyCString]);
+    if (!_started) {
+        return;
+    }
     
-    [view pluginStart];
-}
+    LOG(Plugins, "stopping all plugins");
 
-- (void)startAllPlugins
-{
-    LOG(Plugins, "pluginStart");
-    
-    [views makeObjectsPerformSelector:@selector(pluginStart)];
+    [_views makeObjectsPerformSelector:@selector(pluginStop)];
+    _started = NO;
 }
 
-- (void)stopAllPlugins
+- (void)addPlugin:(NSView <WebPlugin> *)view
 {
-    LOG(Plugins, "pluginStop");
+    if (!_dataSource) {
+        ERROR("can't add a plug-in to a defunct WebPluginController");
+        return;
+    }
     
-    [views makeObjectsPerformSelector:@selector(pluginStop)];
+    if (![_views containsObject:view]) {
+        [_views addObject:view];
+
+        LOG(Plugins, "initializing plug-in %@", view);
+        [view pluginInitialize];
+
+        if (_started) {
+            LOG(Plugins, "starting plug-in %@", view);
+            [view pluginStart];
+        }
+    }
 }
 
-- (void)destroyAllPlugins
+- (void)dataSourceWillBeDeallocated
 {
-    LOG(Plugins, "pluginDestroy");
+    LOG(Plugins, "destroying all plug-ins");
     
     [self stopAllPlugins];
-    [views makeObjectsPerformSelector:@selector(removeFromSuperviewWithoutNeedingDisplay)];
-    [views makeObjectsPerformSelector:@selector(pluginDestroy)];
-    [views removeAllObjects];
-
-    // after this point, do not try to do anything with the frame, even if we get some
-    // late arriving messages from the plugin
-    frame = nil;
-}
+    [_views makeObjectsPerformSelector:@selector(removeFromSuperviewWithoutNeedingDisplay)];
+    [_views makeObjectsPerformSelector:@selector(pluginDestroy)];
+    [_views release];
+    _views = nil;
 
-- (void)windowWillClose:(NSNotification *)notification
-{
-    if([notification object] == [[frame webView] window]){
-        [self destroyAllPlugins];
-    }
+    _dataSource = nil;
 }
 
 - (void)showURL:(NSURL *)URL inFrame:(NSString *)target
 {
-    if ( !URL || !frame ){
+    if (!URL) {
+        ERROR("nil URL passed");
         return;
     }
-
-    WebFrame *otherFrame = [frame findOrCreateFramedNamed:target];
-
-    [otherFrame loadRequest:[WebResourceRequest requestWithURL:URL]];
+    if (!_dataSource) {
+        ERROR("could not load URL %@ because plug-in has already been destroyed", URL);
+        return;
+    }
+    WebFrame *frame = [_dataSource webFrame];
+    if (!frame) {
+        ERROR("could not load URL %@ because plug-in has already been stopped", URL);
+        return;
+    }
+    WebResourceRequest *request = [WebResourceRequest requestWithURL:URL];
+    if (!request) {
+        ERROR("could not load URL %@", URL);
+        return;
+    }
+    [[frame findOrCreateFramedNamed:target] loadRequest:request];
 }
 
 - (void)showStatus:(NSString *)message
 {
-    if(!message || !frame){
+    if (!message) {
+        message = @"";
+    }
+    if (!_dataSource) {
+        ERROR("could not show status message (%@) because plug-in has already been destroyed", message);
         return;
     }
-
-    [[[frame controller] windowOperationsDelegate] setStatusText:message];
+    [[[_dataSource controller] windowOperationsDelegate] setStatusText:message];
 }
 
 @end
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index ae425b5..b0df127 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -386,19 +386,17 @@
                                    attributes:(NSDictionary *)attributes
                                       baseURL:(NSURL *)baseURL
 {
-    WebPluginController *pluginController = [frame _pluginController];
+    WebPluginController *pluginController = [[self dataSource] _pluginController];
     
     NSDictionary *arguments = [NSDictionary dictionaryWithObjectsAndKeys:
         baseURL, WebPluginBaseURLKey,
         attributes, WebPluginAttributesKey,
-        pluginController, WebPluginContainerKey, nil];
+        pluginController, WebPluginContainerKey,
+        nil];
 
-    LOG(Plugins, "arguments:\n%s", [[arguments description] lossyCString]);
+    LOG(Plugins, "arguments:\n%@", arguments);
     
-    NSView<WebPlugin> *view = [[pluginPackage viewFactory] pluginViewWithArguments:arguments];
-    [pluginController addPluginView:view];
-
-    return view;
+    return [[pluginPackage viewFactory] pluginViewWithArguments:arguments];
 }
 
 - (NSView *)viewForPluginWithURL:(NSString *)URL
diff --git a/WebKit/WebView.subproj/WebController.m b/WebKit/WebView.subproj/WebController.m
index 174b5ae..9cc87b8 100644
--- a/WebKit/WebView.subproj/WebController.m
+++ b/WebKit/WebView.subproj/WebController.m
@@ -6,6 +6,7 @@
 #import <WebKit/WebController.h>
 
 #import <WebKit/WebBackForwardList.h>
+#import <WebKit/WebBridge.h>
 #import <WebKit/WebContextMenuDelegate.h>
 #import <WebKit/WebController.h>
 #import <WebKit/WebControllerSets.h>
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.h b/WebKit/WebView.subproj/WebDataSourcePrivate.h
index ae96258..c36df2a 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.h
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.h
@@ -7,16 +7,15 @@
 */
 
 #import <WebKit/WebDataSource.h>
-#import <WebKit/WebBridge.h>
 
+ at class WebBridge;
+ at class WebHistoryItem;
 @class WebIconLoader;
 @class WebMainResourceClient;
- at class WebNetscapePluginStream;
- at class WebResourceHandle;
+ at class WebPluginController;
 @class WebResourceRequest;
 @class WebResourceResponse;
 @class WebSubresourceClient;
- at class WebHistoryItem;
 
 @protocol WebDocumentRepresentation;
 
@@ -88,6 +87,8 @@
 
     BOOL storedInPageCache;
     BOOL loadingFromPageCache;
+
+    WebPluginController *pluginController;
 }
 
 @end
@@ -148,5 +149,6 @@
 - (void)_setStoredInPageCache:(BOOL)f;
 - (BOOL)_storedInPageCache;
 - (BOOL)_loadingFromPageCache;
+- (WebPluginController *)_pluginController;
 
 @end
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index 0a21092..15922ba 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -24,6 +24,7 @@
 #import <WebKit/WebLocationChangeDelegate.h>
 #import <WebKit/WebMainResourceClient.h>
 #import <WebKit/WebNetscapePluginStream.h>
+#import <WebKit/WebPluginController.h>
 #import <WebKit/WebSubresourceClient.h>
 #import <WebKit/WebTextRepresentation.h>
 #import <WebKit/WebViewPrivate.h>
@@ -46,6 +47,8 @@
     // retained while loading, so no need to release here
     ASSERT(!loading);
     
+    [pluginController dataSourceWillBeDeallocated];
+    
     [resourceData release];
     [representation release];
     [request release];
@@ -62,6 +65,7 @@
     [triggeringAction release];
     [lastCheckedRequest release];
     [downloadPath release];
+    [pluginController release];
 
     [super dealloc];
 }
@@ -575,12 +579,6 @@
     _private->iconURL = [URL retain];
 }
 
-
-- (void)_makeHandleDelegates:(NSArray *)handleDelegates deferCallbacks:(BOOL)deferCallbacks
-{
-
-}
-
 - (void)_defersCallbacksChanged
 {
     BOOL defers = [_private->controller _defersCallbacks];
@@ -671,5 +669,12 @@
     return _private->loadingFromPageCache;
 }
 
- at end
+- (WebPluginController *)_pluginController
+{
+    if (!_private->pluginController) {
+        _private->pluginController = [[WebPluginController alloc] initWithDataSource:self];
+    }
+    return _private->pluginController;
+}
 
+ at end
diff --git a/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m b/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
index fa92ed7..d1e0229 100644
--- a/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
+++ b/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
@@ -4,6 +4,8 @@
 */
 
 #import <WebKit/WebContextMenuDelegate.h>
+
+#import <WebKit/WebBridge.h>
 #import <WebKit/WebControllerPolicyDelegate.h>
 #import <WebKit/WebControllerPrivate.h>
 #import <WebKit/WebDataSourcePrivate.h>
diff --git a/WebKit/WebView.subproj/WebFramePrivate.h b/WebKit/WebView.subproj/WebFramePrivate.h
index 051ad21..2eb8fb7 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.h
+++ b/WebKit/WebView.subproj/WebFramePrivate.h
@@ -12,7 +12,6 @@
 @class WebBridge;
 @class WebFrameBridge;
 @class WebHistoryItem;
- at class WebPluginController;
 @class WebView;
 @class WebResourceRequest;
 
@@ -62,7 +61,6 @@ typedef enum {
     WebFrameLoadType loadType;
     WebFrame *parent;
     NSMutableArray *children;
-    WebPluginController *pluginController;
     WebHistoryItem *currentItem;	// BF item for our current content
     WebHistoryItem *provisionalItem;	// BF item for where we're trying to go
                                         // (only known when navigating to a pre-existing BF item)
@@ -141,8 +139,6 @@ typedef enum {
 
 - (NSString *)_generateFrameName;
 
-- (WebPluginController *)_pluginController;
-
 - (NSDictionary *)_actionInformationForNavigationType:(WebNavigationType)navigationType event:(NSEvent *)event originalURL:(NSURL *)URL;
 
 - (WebHistoryItem *)_itemForSavingDocState;
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index dee053d..ad32bdc 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -24,7 +24,6 @@
 #import <WebKit/WebKitLogging.h>
 #import <WebKit/WebKitErrors.h>
 #import <WebKit/WebLocationChangeDelegate.h>
-#import <WebKit/WebPluginController.h>
 #import <WebKit/WebPreferencesPrivate.h>
 #import <WebKit/WebViewPrivate.h>
 
@@ -101,8 +100,6 @@ Repeat load of the same URL (by any other means of navigation other than the rel
 - (WebHistoryItem *)_createItemTreeWithTargetFrame:(WebFrame *)targetFrame clippedAtTarget:(BOOL)doClip;
 
 - (void)_resetBackForwardListToCurrent;
-
-- (void)_destroyPluginController;
 @end
 
 @implementation WebFramePrivate
@@ -133,7 +130,6 @@ Repeat load of the same URL (by any other means of navigation other than the rel
     [bridge release];
     [scheduledLayoutTimer release];
     [children release];
-    [pluginController release];
 
     [currentItem release];
     [provisionalItem release];
@@ -338,9 +334,6 @@ Repeat load of the same URL (by any other means of navigation other than the rel
     WebBridge *bridge = _private->bridge;
     _private->bridge = nil;
 
-    // Destroy plug-ins before blowing away the view.
-    [self _destroyPluginController];
-
     [self stopLoading];
     [self _saveScrollPositionToItem:[_private currentItem]];
 
@@ -508,9 +501,6 @@ Repeat load of the same URL (by any other means of navigation other than the rel
 {
     ASSERT([self controller] != nil);
 
-    // Destroy plug-ins before blowing away the view.
-    [self _destroyPluginController];
-        
     switch ([self _state]) {
         case WebFrameStateProvisional:
         {
@@ -1618,27 +1608,6 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
     [[child dataSource] _setOverrideEncoding:[[self dataSource] _overrideEncoding]];   
 }
 
-- (void)_destroyPluginController
-{
-    [_private->pluginController destroyAllPlugins];
-    // We flush this PluginController, so if a later page requests one we will make a new one
-    // instead of reusing the old one.  Plugin views retain their PluginController, so a
-    // wayward view might try to message an old controller even after we call destroyAllPlugins.
-    // We don't want to have a controller that has to both ignore requests from stale views
-    // and honor those from current views, so it's easiest to make a new controller.
-    [_private->pluginController release];
-    _private->pluginController = nil;
-}
-
-- (WebPluginController *)_pluginController
-{
-    if(!_private->pluginController){
-        _private->pluginController = [[WebPluginController alloc] initWithWebFrame:self];
-    }
-
-    return _private->pluginController;
-}
-
 - (void)_addFramePathToString:(NSMutableString *)path
 {
     if ([_private->name hasPrefix:@"<!--framePath "]) {
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 73b55c8..76c6137 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -240,6 +240,8 @@
     [self removeWindowObservers];
     [self removeSuperviewObservers];
     [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(_updateMouseoverWithFakeEvent) object:nil];
+
+    [[[[self _frame] dataSource] _pluginController] stopAllPlugins];
 }
 
 - (void)viewDidMoveToWindow
@@ -248,6 +250,9 @@
         [self addWindowObservers];
         [self addSuperviewObservers];
         [self addMouseMovedObserver];
+
+        [[[[self _frame] dataSource] _pluginController] startAllPlugins];
+
         _private->inWindow = YES;
     } else {
         // Reset when we are moved out of a window after being moved into one.
@@ -263,11 +268,11 @@
 
 - (void)addSubview:(NSView *)view
 {
-    [super addSubview:view];
-
     if ([view conformsToProtocol:@protocol(WebPlugin)]) {
-        [[[self _frame] _pluginController] didAddPluginView:view];
+        [[[[self _frame] dataSource] _pluginController] addPlugin:view];
     }
+
+    [super addSubview:view];
 }
 
 - (void)reapplyStyles
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index 174b5ae..9cc87b8 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -6,6 +6,7 @@
 #import <WebKit/WebController.h>
 
 #import <WebKit/WebBackForwardList.h>
+#import <WebKit/WebBridge.h>
 #import <WebKit/WebContextMenuDelegate.h>
 #import <WebKit/WebController.h>
 #import <WebKit/WebControllerSets.h>

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list