Reviewed by Maciej.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4625
DumpRenderTree --pixel-tests crash
- landed some other small changes I had sitting in my tree
* DumpRenderTree/DumpRenderTree.m:
(main): Don't bother saving and restoring the preferences. Not sure
why this was ever done since the preferences are specific to DumpRenderTree.
Clear delegates before releasing the WebView, because you can't count on the
order of object deallocation.
(dumpRenderTree): Fix code that releases a string before storing it in a
global variable.
* Scripts/run-webkit-tests: Use "-s" rather than a function to get the size
of a file. Fix lots of cases that were using tabs for indenting to use spaces instead.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@10315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 215a0fe..dda5127 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,22 @@
+2005-08-24 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4625
+ DumpRenderTree --pixel-tests crash
+ - landed some other small changes I had sitting in my tree
+
+ * DumpRenderTree/DumpRenderTree.m:
+ (main): Don't bother saving and restoring the preferences. Not sure
+ why this was ever done since the preferences are specific to DumpRenderTree.
+ Clear delegates before releasing the WebView, because you can't count on the
+ order of object deallocation.
+ (dumpRenderTree): Fix code that releases a string before storing it in a
+ global variable.
+
+ * Scripts/run-webkit-tests: Use "-s" rather than a function to get the size
+ of a file. Fix lots of cases that were using tabs for indenting to use spaces instead.
+
2005-08-23 Eric Seidel <eseidel@apple.com>
Reviewed by mjs.
diff --git a/WebKitTools/DumpRenderTree/DumpRenderTree.m b/WebKitTools/DumpRenderTree/DumpRenderTree.m
index 69c199b..da86332 100644
--- a/WebKitTools/DumpRenderTree/DumpRenderTree.m
+++ b/WebKitTools/DumpRenderTree/DumpRenderTree.m
@@ -54,8 +54,7 @@
@end
static void dumpRenderTree(const char *filename);
-NSString *md5HashStringForBitmap(NSBitmapImageRep *bitmap);
-
+static NSString *md5HashStringForBitmap(NSBitmapImageRep *bitmap);
static volatile BOOL done;
static WebFrame *frame;
@@ -72,17 +71,6 @@
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- WebPreferences *preferences = [WebPreferences standardPreferences];
-
- NSString *standardFontFamily = [preferences standardFontFamily];
- NSString *fixedFontFamily = [preferences fixedFontFamily];
- NSString *serifFontFamily = [preferences serifFontFamily];
- NSString *sansSerifFontFamily = [preferences sansSerifFontFamily];
- NSString *cursiveFontFamily = [preferences cursiveFontFamily];
- NSString *fantasyFontFamily = [preferences fantasyFontFamily];
- int defaultFontSize = [preferences defaultFontSize];
- int defaultFixedFontSize = [preferences defaultFixedFontSize];
- int minimumFontSize = [preferences minimumFontSize];
int width = 800;
int height = 600;
@@ -94,8 +82,9 @@
{"notree", no_argument, &dumpTree, NO},
{NULL, 0, NULL, 0}
};
- int option;
+ WebPreferences *preferences = [WebPreferences standardPreferences];
+
[preferences setStandardFontFamily:@"Times"];
[preferences setFixedFontFamily:@"Courier"];
[preferences setSerifFontFamily:@"Times"];
@@ -106,6 +95,7 @@
[preferences setDefaultFixedFontSize:13];
[preferences setMinimumFontSize:9];
+ int option;
while ((option = getopt_long(argc, (char * const *)argv, "", options, NULL)) != -1)
switch (option) {
case 'w':
@@ -162,16 +152,10 @@
}
}
- [preferences setStandardFontFamily:standardFontFamily];
- [preferences setFixedFontFamily:fixedFontFamily];
- [preferences setSerifFontFamily:serifFontFamily];
- [preferences setSansSerifFontFamily:sansSerifFontFamily];
- [preferences setCursiveFontFamily:cursiveFontFamily];
- [preferences setFantasyFontFamily:fantasyFontFamily];
- [preferences setDefaultFontSize:defaultFontSize];
- [preferences setDefaultFixedFontSize:defaultFixedFontSize];
- [preferences setMinimumFontSize:minimumFontSize];
-
+ [webView setFrameLoadDelegate:nil];
+ [webView setEditingDelegate:nil];
+ [webView setUIDelegate:nil];
+
[webView release];
[delegate release];
[editingDelegate release];
@@ -457,7 +441,6 @@
}
CFURLRef URL = CFURLCreateWithFileSystemPath(NULL, filenameString, kCFURLPOSIXPathStyle, FALSE);
- CFRelease(filenameString);
if (URL == NULL) {
fprintf(stderr, "can't turn %s into a CFURL\n", filename);
return;
@@ -468,7 +451,9 @@
waitToDump = NO;
dumpAsText = NO;
dumpTitleChanges = NO;
- currentTest = (NSString *) filenameString;
+ if (currentTest != nil)
+ CFRelease(currentTest);
+ currentTest = (NSString *)filenameString;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[frame loadRequest:[NSURLRequest requestWithURL:(NSURL *)URL]];
@@ -499,4 +484,3 @@
return [NSString stringWithUTF8String:hex];
}
-
diff --git a/WebKitTools/Scripts/run-webkit-tests b/WebKitTools/Scripts/run-webkit-tests
index 2c76f79..c21ccc2 100755
--- a/WebKitTools/Scripts/run-webkit-tests
+++ b/WebKitTools/Scripts/run-webkit-tests
@@ -245,7 +245,7 @@
}
if (!$hashMatches && -f "$testDirectory/$base-expected.png" && $textDumpMatches) {
- $expectedPNGSize = getFilesize("$testDirectory/$base-expected.png");
+ $expectedPNGSize = -s "$testDirectory/$base-expected.png";
open EXPECTEDPNG, "$testDirectory/$base-expected.png";
read(EXPECTEDPNG, $expectedPNG, $expectedPNGSize);
@@ -256,7 +256,7 @@
print DIFFOUT $expectedPNG;
while (<DIFFIN>) {
- last if /^error/ || /^diff:/;
+ last if /^error/ || /^diff:/;
if (/Content-length: (\d+)\s*/) {
read(DIFFIN, $diffPNG, $1);
}
@@ -386,10 +386,10 @@
}
if ($checkLeaks) {
- print "\n";
- printLeaks($toolname, $toolPID);
+ print "\n";
+ printLeaks($toolname, $toolPID);
if ($pixelTests) {
- printLeaks("ImageDiff", $imageDiffToolPID);
+ printLeaks("ImageDiff", $imageDiffToolPID);
}
}
@@ -501,33 +501,23 @@
sub printLeaks
{
- my $toolName = shift;
- my $toolPID = shift;
- my $leaksFilePath = "";
-
- print "\nChecking for leaks in $toolName...\n";
- my $leaksOutput = `leaks $toolPID`;
+ my $toolName = shift;
+ my $toolPID = shift;
+ my $leaksFilePath = "";
+
+ print "\nChecking for leaks in $toolName...\n";
+ my $leaksOutput = `leaks $toolPID`;
$leaksOutput =~ m/Process $toolPID: (\d+) leaks for (\d+) total leaked bytes./;
if ($1) {
- $leaksFilePath = "$testResultsDirectory/$toolName-leaks.txt";
- print "$1 leaks ($2 bytes) were found in $toolName, full results: $leaksFilePath\n";
- if (open LEAKS, ">", $leaksFilePath) {
- print LEAKS $leaksOutput;
- close LEAKS;
- } else {
- print "ERROR: Failed to write leaks to file: $leaksFilePath";
- }
+ $leaksFilePath = "$testResultsDirectory/$toolName-leaks.txt";
+ print "$1 leaks ($2 bytes) were found in $toolName, full results: $leaksFilePath\n";
+ if (open LEAKS, ">", $leaksFilePath) {
+ print LEAKS $leaksOutput;
+ close LEAKS;
+ } else {
+ print "ERROR: Failed to write leaks to file: $leaksFilePath";
+ }
}
- $leaksFilePath;
-}
-
-sub getFilesize
-{
- my $filename = shift;
- my @fileStats;
-
- @fileStats = stat($filename);
-
- $fileStats[7];
+ return $leaksFilePath;
}