WebKitTools:
2008-04-08 Brady Eidson <beidson@apple.com>
Reviewed by Mitzpettel
Fixed http://bugs.webkit.org/show_bug.cgi?id=18302
-WebArchive subresources dump in random order, intermittent failures
* DumpRenderTree/mac/DumpRenderTree.mm:
(compareResourceURLs): Sorting function based on the resource URLs
(serializeWebArchiveToXML): Sort the subresource array
LayoutTests:
2008-04-08 Brady Eidson <beidson@apple.com>
Reviewed by Mitzpettel
Fixed http://bugs.webkit.org/show_bug.cgi?id=18302
-WebArchive subresources dump in random order, intermittent failures
Now that a DRT fix has set the order, these 3 tests needed new results
* webarchive/test-css-import-expected.txt:
* webarchive/test-duplicate-resources-expected.txt:
* webarchive/test-frameset-expected.txt:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@31722 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 2a7519e..18ec2a8 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2008-04-08 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Mitzpettel
+
+ Fixed http://bugs.webkit.org/show_bug.cgi?id=18302
+ -WebArchive subresources dump in random order, intermittent failures
+
+ Now that a DRT fix has set the order, these 3 tests needed new results
+
+ * webarchive/test-css-import-expected.txt:
+ * webarchive/test-duplicate-resources-expected.txt:
+ * webarchive/test-frameset-expected.txt:
+
2008-04-07 Brady Eidson <beidson@apple.com>
Rubberstamped by Geoff Garen
diff --git a/LayoutTests/webarchive/test-css-import-expected.txt b/LayoutTests/webarchive/test-css-import-expected.txt
index 03fafd4..0509fa2b 100644
--- a/LayoutTests/webarchive/test-css-import-expected.txt
+++ b/LayoutTests/webarchive/test-css-import-expected.txt
@@ -35,44 +35,6 @@
<array>
<dict>
<key>WebResourceData</key>
- <string>@import url('test-css-link-recurse.css');
-.red { color: red; }
-</string>
- <key>WebResourceMIMEType</key>
- <string>text/css</string>
- <key>WebResourceResponse</key>
- <dict>
- <key>MIMEType</key>
- <string>text/css</string>
- <key>URL</key>
- <string>file:///LayoutTests/webarchive/resources/test-css-link.css</string>
- <key>expectedContentLength</key>
- <integer>63</integer>
- </dict>
- <key>WebResourceURL</key>
- <string>file:///LayoutTests/webarchive/resources/test-css-link.css</string>
- </dict>
- <dict>
- <key>WebResourceData</key>
- <string>@import url('test-css-link-recurse.css');
-.purple { color: purple; }
-</string>
- <key>WebResourceMIMEType</key>
- <string>text/css</string>
- <key>WebResourceResponse</key>
- <dict>
- <key>MIMEType</key>
- <string>text/css</string>
- <key>URL</key>
- <string>file:///LayoutTests/webarchive/resources/test-css-link-recurse.css</string>
- <key>expectedContentLength</key>
- <integer>69</integer>
- </dict>
- <key>WebResourceURL</key>
- <string>file:///LayoutTests/webarchive/resources/test-css-link-recurse.css</string>
- </dict>
- <dict>
- <key>WebResourceData</key>
<string>@import url('test-css-import.css');
.green { color: green; }
</string>
@@ -109,6 +71,44 @@
<key>WebResourceURL</key>
<string>file:///LayoutTests/webarchive/resources/test-css-import.css</string>
</dict>
+ <dict>
+ <key>WebResourceData</key>
+ <string>@import url('test-css-link-recurse.css');
+.purple { color: purple; }
+</string>
+ <key>WebResourceMIMEType</key>
+ <string>text/css</string>
+ <key>WebResourceResponse</key>
+ <dict>
+ <key>MIMEType</key>
+ <string>text/css</string>
+ <key>URL</key>
+ <string>file:///LayoutTests/webarchive/resources/test-css-link-recurse.css</string>
+ <key>expectedContentLength</key>
+ <integer>69</integer>
+ </dict>
+ <key>WebResourceURL</key>
+ <string>file:///LayoutTests/webarchive/resources/test-css-link-recurse.css</string>
+ </dict>
+ <dict>
+ <key>WebResourceData</key>
+ <string>@import url('test-css-link-recurse.css');
+.red { color: red; }
+</string>
+ <key>WebResourceMIMEType</key>
+ <string>text/css</string>
+ <key>WebResourceResponse</key>
+ <dict>
+ <key>MIMEType</key>
+ <string>text/css</string>
+ <key>URL</key>
+ <string>file:///LayoutTests/webarchive/resources/test-css-link.css</string>
+ <key>expectedContentLength</key>
+ <integer>63</integer>
+ </dict>
+ <key>WebResourceURL</key>
+ <string>file:///LayoutTests/webarchive/resources/test-css-link.css</string>
+ </dict>
</array>
</dict>
</plist>
diff --git a/LayoutTests/webarchive/test-duplicate-resources-expected.txt b/LayoutTests/webarchive/test-duplicate-resources-expected.txt
index dc00022..103785a 100644
--- a/LayoutTests/webarchive/test-duplicate-resources-expected.txt
+++ b/LayoutTests/webarchive/test-duplicate-resources-expected.txt
@@ -67,24 +67,6 @@
<array>
<dict>
<key>WebResourceData</key>
- <string>div { font-family: Arial, Helvetica, sans-serif; color: red; }
-</string>
- <key>WebResourceMIMEType</key>
- <string>text/css</string>
- <key>WebResourceResponse</key>
- <dict>
- <key>MIMEType</key>
- <string>text/css</string>
- <key>URL</key>
- <string>file:///LayoutTests/webarchive/resources/test-style.css</string>
- <key>expectedContentLength</key>
- <integer>63</integer>
- </dict>
- <key>WebResourceURL</key>
- <string>file:///LayoutTests/webarchive/resources/test-style.css</string>
- </dict>
- <dict>
- <key>WebResourceData</key>
<data>
R0lGODlhNABAAMQfAGJiYvLz9ImKitvb2/39
/cnJyaSkpOPj49TU1MHBwbW1terq7Lu7u/X1
@@ -156,6 +138,24 @@
<key>WebResourceURL</key>
<string>file:///LayoutTests/webarchive/resources/apple.gif</string>
</dict>
+ <dict>
+ <key>WebResourceData</key>
+ <string>div { font-family: Arial, Helvetica, sans-serif; color: red; }
+</string>
+ <key>WebResourceMIMEType</key>
+ <string>text/css</string>
+ <key>WebResourceResponse</key>
+ <dict>
+ <key>MIMEType</key>
+ <string>text/css</string>
+ <key>URL</key>
+ <string>file:///LayoutTests/webarchive/resources/test-style.css</string>
+ <key>expectedContentLength</key>
+ <integer>63</integer>
+ </dict>
+ <key>WebResourceURL</key>
+ <string>file:///LayoutTests/webarchive/resources/test-style.css</string>
+ </dict>
</array>
</dict>
</array>
@@ -163,43 +163,6 @@
<array>
<dict>
<key>WebResourceData</key>
- <string>if (window.layoutTestController)
- layoutTestController.dumpDOMAsWebArchive();
-</string>
- <key>WebResourceMIMEType</key>
- <string>text/javascript</string>
- <key>WebResourceResponse</key>
- <dict>
- <key>MIMEType</key>
- <string>text/javascript</string>
- <key>URL</key>
- <string>file:///LayoutTests/webarchive/resources/dump-webarchive.js</string>
- <key>expectedContentLength</key>
- <integer>81</integer>
- </dict>
- <key>WebResourceURL</key>
- <string>file:///LayoutTests/webarchive/resources/dump-webarchive.js</string>
- </dict>
- <dict>
- <key>WebResourceData</key>
- <string>div { font-family: Arial, Helvetica, sans-serif; color: red; }
-</string>
- <key>WebResourceMIMEType</key>
- <string>text/css</string>
- <key>WebResourceResponse</key>
- <dict>
- <key>MIMEType</key>
- <string>text/css</string>
- <key>URL</key>
- <string>file:///LayoutTests/webarchive/resources/test-style.css</string>
- <key>expectedContentLength</key>
- <integer>63</integer>
- </dict>
- <key>WebResourceURL</key>
- <string>file:///LayoutTests/webarchive/resources/test-style.css</string>
- </dict>
- <dict>
- <key>WebResourceData</key>
<data>
R0lGODlhNABAAMQfAGJiYvLz9ImKitvb2/39/cnJyaSkpOPj49TU
1MHBwbW1terq7Lu7u/X19uXm5+3u7+fo6eDg4e/w8t7e3/n5+RcX
@@ -254,6 +217,43 @@
<key>WebResourceURL</key>
<string>file:///LayoutTests/webarchive/resources/apple.gif</string>
</dict>
+ <dict>
+ <key>WebResourceData</key>
+ <string>if (window.layoutTestController)
+ layoutTestController.dumpDOMAsWebArchive();
+</string>
+ <key>WebResourceMIMEType</key>
+ <string>text/javascript</string>
+ <key>WebResourceResponse</key>
+ <dict>
+ <key>MIMEType</key>
+ <string>text/javascript</string>
+ <key>URL</key>
+ <string>file:///LayoutTests/webarchive/resources/dump-webarchive.js</string>
+ <key>expectedContentLength</key>
+ <integer>81</integer>
+ </dict>
+ <key>WebResourceURL</key>
+ <string>file:///LayoutTests/webarchive/resources/dump-webarchive.js</string>
+ </dict>
+ <dict>
+ <key>WebResourceData</key>
+ <string>div { font-family: Arial, Helvetica, sans-serif; color: red; }
+</string>
+ <key>WebResourceMIMEType</key>
+ <string>text/css</string>
+ <key>WebResourceResponse</key>
+ <dict>
+ <key>MIMEType</key>
+ <string>text/css</string>
+ <key>URL</key>
+ <string>file:///LayoutTests/webarchive/resources/test-style.css</string>
+ <key>expectedContentLength</key>
+ <integer>63</integer>
+ </dict>
+ <key>WebResourceURL</key>
+ <string>file:///LayoutTests/webarchive/resources/test-style.css</string>
+ </dict>
</array>
</dict>
</plist>
diff --git a/LayoutTests/webarchive/test-frameset-expected.txt b/LayoutTests/webarchive/test-frameset-expected.txt
index 7f796a1..3491a88 100644
--- a/LayoutTests/webarchive/test-frameset-expected.txt
+++ b/LayoutTests/webarchive/test-frameset-expected.txt
@@ -56,24 +56,6 @@
<array>
<dict>
<key>WebResourceData</key>
- <string>div { font-family: Arial, Helvetica, sans-serif; color: red; }
-</string>
- <key>WebResourceMIMEType</key>
- <string>text/css</string>
- <key>WebResourceResponse</key>
- <dict>
- <key>MIMEType</key>
- <string>text/css</string>
- <key>URL</key>
- <string>file:///LayoutTests/webarchive/resources/test-style.css</string>
- <key>expectedContentLength</key>
- <integer>63</integer>
- </dict>
- <key>WebResourceURL</key>
- <string>file:///LayoutTests/webarchive/resources/test-style.css</string>
- </dict>
- <dict>
- <key>WebResourceData</key>
<data>
R0lGODlhNABAAMQfAGJiYvLz9ImKitvb2/39
/cnJyaSkpOPj49TU1MHBwbW1terq7Lu7u/X1
@@ -145,6 +127,24 @@
<key>WebResourceURL</key>
<string>file:///LayoutTests/webarchive/resources/apple.gif</string>
</dict>
+ <dict>
+ <key>WebResourceData</key>
+ <string>div { font-family: Arial, Helvetica, sans-serif; color: red; }
+</string>
+ <key>WebResourceMIMEType</key>
+ <string>text/css</string>
+ <key>WebResourceResponse</key>
+ <dict>
+ <key>MIMEType</key>
+ <string>text/css</string>
+ <key>URL</key>
+ <string>file:///LayoutTests/webarchive/resources/test-style.css</string>
+ <key>expectedContentLength</key>
+ <integer>63</integer>
+ </dict>
+ <key>WebResourceURL</key>
+ <string>file:///LayoutTests/webarchive/resources/test-style.css</string>
+ </dict>
</array>
</dict>
</array>
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index f7befc7..d49eb2e 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,14 @@
+2008-04-08 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Mitzpettel
+
+ Fixed http://bugs.webkit.org/show_bug.cgi?id=18302
+ -WebArchive subresources dump in random order, intermittent failures
+
+ * DumpRenderTree/mac/DumpRenderTree.mm:
+ (compareResourceURLs): Sorting function based on the resource URLs
+ (serializeWebArchiveToXML): Sort the subresource array
+
2008-04-07 Brady Eidson <beidson@apple.com>
OMG, BUILD - please!
diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
index b8c45af..705a548 100644
--- a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
+++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
@@ -608,6 +608,14 @@
[responseDictionary release];
}
+static NSInteger compareResourceURLs(id resource1, id resource2, void *context)
+{
+ NSString *url1 = [resource1 objectForKey:@"WebResourceURL"];
+ NSString *url2 = [resource2 objectForKey:@"WebResourceURL"];
+
+ return [url1 compare:url2];
+}
+
static NSString *serializeWebArchiveToXML(WebArchive *webArchive)
{
NSString *errorString;
@@ -642,6 +650,10 @@
convertWebResourceResponseToDictionary(subresourcePropertyList);
convertWebResourceDataToString(subresourcePropertyList);
}
+
+ // Sort the subresources so they're always in a predictable order for the dump
+ if (NSArray *sortedSubresources = [subresources sortedArrayUsingFunction:compareResourceURLs context:nil])
+ [resourcePropertyList setObject:sortedSubresources forKey:@"WebSubresources"];
}
NSData *xmlData = [NSPropertyListSerialization dataFromPropertyList:propertyList