[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

sullivan at apple.com sullivan at apple.com
Wed Dec 22 13:29:49 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit c030ea3b8a861ff305c5f2a6177332bd4843508c
Author: sullivan at apple.com <sullivan at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Sep 17 04:05:37 2010 +0000

    <rdar://problem/8395558>
    https://bugs.webkit.org/show_bug.cgi?id=45938
    _web_makePluginViewsPerformSelector:: mutates subviews array while iterating it
    
    Reviewed by Darin Adler.
    
    * WebView/WebHTMLView.mm:
    (-[WebHTMLView _web_makePluginSubviewsPerformSelector:withObject:]):
    Converted from -[NSArray _web_makePluginViewsPerformSelector:withObject:]. The old method
    was only ever called on the result of -[WebHTMLView subviews]. By moving that knowledge into
    this helper method, it can't be used incorrectly. Now it makes a copy of [WebHTMLView subviews]
    before enumerating it, to ensure that the selector can't mutate the array being enumerated.
    (-[WebHTMLView viewWillMoveToHostWindow:]):
    Updated for _web_makePluginSubviewsPerformSelector:: signature change.
    (-[WebHTMLView viewDidMoveToHostWindow]):
    Ditto.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67691 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 6c1d080..57bd1bb 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,22 @@
+2010-09-16  John Sullivan  <sullivan at apple.com>
+
+        Reviewed by Darin Adler.
+
+        <rdar://problem/8395558>
+        https://bugs.webkit.org/show_bug.cgi?id=45938
+        _web_makePluginViewsPerformSelector:: mutates subviews array while iterating it
+
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView _web_makePluginSubviewsPerformSelector:withObject:]):
+        Converted from -[NSArray _web_makePluginViewsPerformSelector:withObject:]. The old method
+        was only ever called on the result of -[WebHTMLView subviews]. By moving that knowledge into
+        this helper method, it can't be used incorrectly. Now it makes a copy of [WebHTMLView subviews]
+        before enumerating it, to ensure that the selector can't mutate the array being enumerated.
+        (-[WebHTMLView viewWillMoveToHostWindow:]):
+        Updated for _web_makePluginSubviewsPerformSelector:: signature change.
+        (-[WebHTMLView viewDidMoveToHostWindow]):
+        Ditto.
+
 2010-09-16  Darin Adler  <darin at apple.com>
 
         Reviewed by Andreas Kling.
diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm
index 75c16ba..e125d64 100644
--- a/WebKit/mac/WebView/WebHTMLView.mm
+++ b/WebKit/mac/WebView/WebHTMLView.mm
@@ -2377,10 +2377,6 @@ static bool matchesExtensionOrEquivalent(NSString *filename, NSString *extension
 
 #endif
 
- at interface NSArray (WebHTMLView)
-- (void)_web_makePluginViewsPerformSelector:(SEL)selector withObject:(id)object;
- at end
-
 @implementation WebHTMLView
 
 + (void)initialize
@@ -3080,14 +3076,31 @@ WEBCORE_COMMAND(yankAndSelect)
     }
 }
 
+- (void)_web_makePluginSubviewsPerformSelector:(SEL)selector withObject:(id)object
+{
+#if ENABLE(NETSCAPE_PLUGIN_API)
+    // Copy subviews because [self subviews] returns the view's mutable internal array,
+    // and we must avoid mutating the array while enumerating it.
+    NSArray *subviews = [[self subviews] copy];
+    
+    NSEnumerator *enumerator = [subviews objectEnumerator];
+    WebNetscapePluginView *view;
+    while ((view = [enumerator nextObject]) != nil)
+        if ([view isKindOfClass:[WebBaseNetscapePluginView class]])
+            [view performSelector:selector withObject:object];
+    
+    [subviews release];
+#endif
+}
+
 - (void)viewWillMoveToHostWindow:(NSWindow *)hostWindow
 {
-    [[self subviews] _web_makePluginViewsPerformSelector:@selector(viewWillMoveToHostWindow:) withObject:hostWindow];
+    [self _web_makePluginSubviewsPerformSelector:@selector(viewWillMoveToHostWindow:) withObject:hostWindow];
 }
 
 - (void)viewDidMoveToHostWindow
 {
-    [[self subviews] _web_makePluginViewsPerformSelector:@selector(viewDidMoveToHostWindow) withObject:nil];
+    [self _web_makePluginSubviewsPerformSelector:@selector(viewDidMoveToHostWindow) withObject:nil];
 }
 
 
@@ -5082,21 +5095,6 @@ static BOOL writingDirectionKeyBindingsEnabled()
 
 @end
 
- at implementation NSArray (WebHTMLView)
-
-- (void)_web_makePluginViewsPerformSelector:(SEL)selector withObject:(id)object
-{
-#if ENABLE(NETSCAPE_PLUGIN_API)
-    NSEnumerator *enumerator = [self objectEnumerator];
-    WebNetscapePluginView *view;
-    while ((view = [enumerator nextObject]) != nil)
-        if ([view isKindOfClass:[WebBaseNetscapePluginView class]])
-            [view performSelector:selector withObject:object];
-#endif
-}
-
- at end
-
 @implementation WebHTMLView (WebInternal)
 
 - (void)_selectionChanged

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list