Commit a9fd077f authored by andersca's avatar andersca

LayoutTests:

        Reviewed by Brady.

        * plugins/open-and-close-window-with-plugin.html:
        Manage open windows manually for this test.

WebKitTools:

        Reviewed by Brady.

        By default, close any windows that have been opened during a test. This can be overridden by
        calling setCloseRemainingWindowsWhenComplete(false).
        
        Change the windows set to an array so we can gurantee the enumeration order.
        
        * DumpRenderTree/DumpRenderTree.m:
        (+[LayoutTestController isSelectorExcludedFromWebScript:]):
        (+[LayoutTestController webScriptNameForSelector:]):
        (-[LayoutTestController setCloseRemainingWindowsWhenComplete:]):
        (runTest):
        (-[DumpRenderTreeWindow initWithContentRect:styleMask:backing:defer:]):
        (-[DumpRenderTreeWindow dealloc]):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20876 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7f5bb514
2007-04-13 Anders Carlsson <andersca@apple.com>
Reviewed by Brady.
* plugins/open-and-close-window-with-plugin.html:
Manage open windows manually for this test.
2007-04-12 Deneb Meketa <dmeketa@adobe.com>
Reviewed by Darin Adler.
......@@ -9,7 +9,7 @@ layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
layoutTestController.setCallCloseOnWebViews(false);
layoutTestController.setCanOpenWindows();
layoutTestController.setCloseRemainingWindowsWhenComplete(false);
window.open('resources/open-and-close-window-with-plugin.html');
</script>
This tests that opening a window with a WebView that contains a plugin, and then closing the window without calling -[WebView close] does not leak the window or the web view.
......
2007-04-13 Anders Carlsson <andersca@apple.com>
Reviewed by Brady.
By default, close any windows that have been opened during a test. This can be overridden by
calling setCloseRemainingWindowsWhenComplete(false).
Change the windows set to an array so we can gurantee the enumeration order.
* DumpRenderTree/DumpRenderTree.m:
(+[LayoutTestController isSelectorExcludedFromWebScript:]):
(+[LayoutTestController webScriptNameForSelector:]):
(-[LayoutTestController setCloseRemainingWindowsWhenComplete:]):
(runTest):
(-[DumpRenderTreeWindow initWithContentRect:styleMask:backing:defer:]):
(-[DumpRenderTreeWindow dealloc]):
2007-04-13 Geoffrey Garen <ggaren@apple.com>
Build fix.
......
......@@ -107,6 +107,7 @@ @interface LocalPasteboard : NSPasteboard
BOOL waitToDump; // TRUE if waitUntilDone() has been called, but notifyDone() has not yet been called
BOOL canOpenWindows;
BOOL closeWebViews;
BOOL closeRemainingWindowsWhenComplete = YES;
static void runTest(const char *pathOrURL);
static NSString *md5HashStringForBitmap(CGImageRef bitmap);
......@@ -166,7 +167,7 @@ @interface LocalPasteboard : NSPasteboard
const unsigned maxViewHeight = 600;
const unsigned maxViewWidth = 800;
static CFMutableSetRef allWindowsRef;
static CFMutableArrayRef allWindowsRef;
static pthread_mutex_t javaScriptThreadsMutex = PTHREAD_MUTEX_INITIALIZER;
static BOOL javaScriptThreadsShouldTerminate;
......@@ -1030,7 +1031,8 @@ + (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector
|| aSelector == @selector(objCClassNameOf:)
|| aSelector == @selector(addDisallowedURL:)
|| aSelector == @selector(setCanOpenWindows)
|| aSelector == @selector(setCallCloseOnWebViews:))
|| aSelector == @selector(setCallCloseOnWebViews:)
|| aSelector == @selector(setCloseRemainingWindowsWhenComplete:))
return NO;
return YES;
}
......@@ -1065,6 +1067,8 @@ + (NSString *)webScriptNameForSelector:(SEL)aSelector
return @"addDisallowedURL";
if (aSelector == @selector(setCallCloseOnWebViews:))
return @"setCallCloseOnWebViews";
if (aSelector == @selector(setCloseRemainingWindowsWhenComplete:))
return @"setCloseRemainingWindowsWhenComplete";
return nil;
}
......@@ -1084,6 +1088,11 @@ - (void)clearBackForwardList
[item release];
}
- (void)setCloseRemainingWindowsWhenComplete:(BOOL)closeWindows
{
closeRemainingWindowsWhenComplete = closeWindows;
}
- (void)keepWebHistory
{
if (![WebHistory optionalSharedHistory]) {
......@@ -1401,11 +1410,31 @@ static void runTest(const char *pathOrURL)
}
pool = [[NSAutoreleasePool alloc] init];
[[frame webView] setSelectedDOMRange:nil affinity:NSSelectionAffinityDownstream];
if (closeRemainingWindowsWhenComplete) {
NSArray* array = [(NSArray *)allWindowsRef copy];
unsigned count = [array count];
for (unsigned i = 0; i < count; i++) {
NSWindow *window = [array objectAtIndex:i];
// Don't try to close the main window
if (window == [[frame webView] window])
continue;
WebView *webView = [[[window contentView] subviews] objectAtIndex:0];
[webView close];
[window close];
}
[array release];
}
[pool release];
// We should only have our main window left when we're done
assert(CFSetGetCount(allWindowsRef) == 1);
assert(CFSetContainsValue(allWindowsRef, [[frame webView] window]));
assert(CFArrayGetCount(allWindowsRef) == 1);
assert(CFArrayGetValueAtIndex(allWindowsRef, 0) == [[frame webView] window]);
if (_shouldIgnoreWebCoreNodeLeaks)
[WebCoreStatistics stopIgnoringWebCoreNodeLeaks];
......@@ -1604,13 +1633,12 @@ - (BOOL)setString:(NSString *)string forType:(NSString *)dataType
@end
static CFSetCallBacks NonRetainingSetCallbacks = {
static CFArrayCallBacks NonRetainingArrayCallbacks = {
0,
NULL,
NULL,
CFCopyDescription,
CFEqual,
CFHash
CFEqual
};
@implementation DumpRenderTreeWindow
......@@ -1618,18 +1646,20 @@ @implementation DumpRenderTreeWindow
- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation
{
if (!allWindowsRef)
allWindowsRef = CFSetCreateMutable(NULL, 0, &NonRetainingSetCallbacks);
allWindowsRef = CFArrayCreateMutable(NULL, 0, &NonRetainingArrayCallbacks);
CFSetSetValue(allWindowsRef, self);
CFArrayAppendValue(allWindowsRef, self);
return [super initWithContentRect:contentRect styleMask:styleMask backing:bufferingType defer:deferCreation];
}
- (void)dealloc
{
assert(CFSetContainsValue(allWindowsRef, self));
CFSetRemoveValue(allWindowsRef, self);
CFRange arrayRange = CFRangeMake(0, CFArrayGetCount(allWindowsRef));
CFIndex i = CFArrayGetFirstIndexOfValue(allWindowsRef, arrayRange, self);
assert(i != -1);
CFArrayRemoveValueAtIndex(allWindowsRef, i);
[super dealloc];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment