From: ddkilzer@apple.com Date: Tue, 2 Dec 2008 00:53:35 +0000 (+0000) Subject: Bug 22466: REGRESSION (35867): Many resources missing when saving webarchive... X-Git-Url: http://git.webkit.org/?p=WebKit-https.git;a=commitdiff_plain;h=855253773d41c53eaca684a26472202c6c1c4d0c Bug 22466: REGRESSION (35867): Many resources missing when saving webarchive of webkit.org Reviewed by Brady Eidson. WebCore: Test: http/tests/webarchive/test-preload-resources.html * loader/archive/cf/LegacyWebArchive.cpp: (WebCore::LegacyWebArchive::create): Check the WebCore cache for resources if DocumentLoader::subresource() doesn't return them. Note that the DocumentLoader::subresource() method returned preloaded resources before r35867, but this caused a regression in Mail. WebKitTools: * DumpRenderTree/mac/DumpRenderTree.mm: (normalizeHTTPResponseHeaderFields): Added. Normalizes Date, Etag, Keep-Alive, Last-Modified and Server header fields to prevent false positive test failures. (convertWebResourceResponseToDictionary): Call normalizeHTTPResponseHeaderFields() to noramlize HTTP response header fields. LayoutTests: * http/tests/webarchive/resources/test-preload-resources.css: Added. * http/tests/webarchive/test-preload-resources-expected.webarchive: Added. * http/tests/webarchive/test-preload-resources.html: Added. * platform/qt/Skipped: Added http/tests/webarchive and grouped the skipped list of other webarchive tests together. * platform/win/Skipped: Added http/tests/webarchive. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@38884 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index 44a0f45..e99e568 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,19 @@ +2008-12-01 David Kilzer + + Bug 22466: REGRESSION (35867): Many resources missing when saving webarchive of webkit.org + + + + + Reviewed by Brady Eidson. + + * http/tests/webarchive/resources/test-preload-resources.css: Added. + * http/tests/webarchive/test-preload-resources-expected.webarchive: Added. + * http/tests/webarchive/test-preload-resources.html: Added. + * platform/qt/Skipped: Added http/tests/webarchive and grouped the + skipped list of other webarchive tests together. + * platform/win/Skipped: Added http/tests/webarchive. + 2008-12-01 Pamela Greene Reviewed by Darin Adler. diff --git a/LayoutTests/http/tests/webarchive/resources/test-preload-resources.css b/LayoutTests/http/tests/webarchive/resources/test-preload-resources.css new file mode 100644 index 0000000..153df6f --- /dev/null +++ b/LayoutTests/http/tests/webarchive/resources/test-preload-resources.css @@ -0,0 +1 @@ +/* test-preload-resources.css */ diff --git a/LayoutTests/http/tests/webarchive/test-preload-resources-expected.webarchive b/LayoutTests/http/tests/webarchive/test-preload-resources-expected.webarchive new file mode 100644 index 0000000..6520465 --- /dev/null +++ b/LayoutTests/http/tests/webarchive/test-preload-resources-expected.webarchive @@ -0,0 +1,331 @@ + + + + + WebMainResource + + WebResourceData + <html><head> + +<link rel="stylesheet" type="text/css" href="resources/test-preload-resources.css"> +<link rel="alternate stylesheet" type="text/css" href="resources/test-preload-resources.css?1" title="green"> +<link rel="alternate stylesheet" type="text/css" href="resources/test-preload-resources.css?2" title="blue"> +<link rel="alternate stylesheet" type="text/css" href="resources/test-preload-resources.css?3" title="yellow"> +<link rel="alternate stylesheet" type="text/css" href="resources/test-preload-resources.css?4" title="pink"> +<link rel="alternate stylesheet" type="text/css" href="resources/test-preload-resources.css?5" title="purple"> +<link rel="alternate stylesheet" type="text/css" href="resources/test-preload-resources.css?6" title="gray"> + +<script> +if (window.layoutTestController) + layoutTestController.dumpDOMAsWebArchive(); +</script> + +</head><body> +<div> +Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=22466">Bug 22466: +REGRESSION (35867): Many resources missing when saving webarchive of webkit.org</a> +</div> +<p>Some resources are missing when saving this page as a webarchive.</p> + +</body></html> + WebResourceFrameName + + WebResourceMIMEType + text/html + WebResourceTextEncodingName + UTF-8 + WebResourceURL + http://127.0.0.1:8000/webarchive/test-preload-resources.html + + WebSubresources + + + WebResourceData + /* test-preload-resources.css */ + + WebResourceMIMEType + text/css + WebResourceResponse + + MIMEType + text/css + URL + http://127.0.0.1:8000/webarchive/resources/test-preload-resources.css + allHeaderFields + + Accept-Ranges + bytes + Connection + Keep-Alive + Content-Length + 33 + Content-Type + text/css + Date + Sun, 16 Nov 2008 17:00:00 GMT + Etag + "301925-21-45c7d72d3e780" + Keep-Alive + timeout=15 + Last-Modified + Sun, 16 Nov 2008 16:55:00 GMT + Server + Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7l PHP/5.2.6 + + expectedContentLength + 33 + statusCode + 200 + + WebResourceURL + http://127.0.0.1:8000/webarchive/resources/test-preload-resources.css + + + WebResourceData + /* test-preload-resources.css */ + + WebResourceMIMEType + text/css + WebResourceResponse + + MIMEType + text/css + URL + http://127.0.0.1:8000/webarchive/resources/test-preload-resources.css?1 + allHeaderFields + + Accept-Ranges + bytes + Connection + Keep-Alive + Content-Length + 33 + Content-Type + text/css + Date + Sun, 16 Nov 2008 17:00:00 GMT + Etag + "301925-21-45c7d72d3e780" + Keep-Alive + timeout=15 + Last-Modified + Sun, 16 Nov 2008 16:55:00 GMT + Server + Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7l PHP/5.2.6 + + expectedContentLength + 33 + statusCode + 200 + + WebResourceURL + http://127.0.0.1:8000/webarchive/resources/test-preload-resources.css?1 + + + WebResourceData + /* test-preload-resources.css */ + + WebResourceMIMEType + text/css + WebResourceResponse + + MIMEType + text/css + URL + http://127.0.0.1:8000/webarchive/resources/test-preload-resources.css?2 + allHeaderFields + + Accept-Ranges + bytes + Connection + Keep-Alive + Content-Length + 33 + Content-Type + text/css + Date + Sun, 16 Nov 2008 17:00:00 GMT + Etag + "301925-21-45c7d72d3e780" + Keep-Alive + timeout=15 + Last-Modified + Sun, 16 Nov 2008 16:55:00 GMT + Server + Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7l PHP/5.2.6 + + expectedContentLength + 33 + statusCode + 200 + + WebResourceURL + http://127.0.0.1:8000/webarchive/resources/test-preload-resources.css?2 + + + WebResourceData + /* test-preload-resources.css */ + + WebResourceMIMEType + text/css + WebResourceResponse + + MIMEType + text/css + URL + http://127.0.0.1:8000/webarchive/resources/test-preload-resources.css?3 + allHeaderFields + + Accept-Ranges + bytes + Connection + Keep-Alive + Content-Length + 33 + Content-Type + text/css + Date + Sun, 16 Nov 2008 17:00:00 GMT + Etag + "301925-21-45c7d72d3e780" + Keep-Alive + timeout=15 + Last-Modified + Sun, 16 Nov 2008 16:55:00 GMT + Server + Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7l PHP/5.2.6 + + expectedContentLength + 33 + statusCode + 200 + + WebResourceURL + http://127.0.0.1:8000/webarchive/resources/test-preload-resources.css?3 + + + WebResourceData + /* test-preload-resources.css */ + + WebResourceMIMEType + text/css + WebResourceResponse + + MIMEType + text/css + URL + http://127.0.0.1:8000/webarchive/resources/test-preload-resources.css?4 + allHeaderFields + + Accept-Ranges + bytes + Connection + Keep-Alive + Content-Length + 33 + Content-Type + text/css + Date + Sun, 16 Nov 2008 17:00:00 GMT + Etag + "301925-21-45c7d72d3e780" + Keep-Alive + timeout=15 + Last-Modified + Sun, 16 Nov 2008 16:55:00 GMT + Server + Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7l PHP/5.2.6 + + expectedContentLength + 33 + statusCode + 200 + + WebResourceURL + http://127.0.0.1:8000/webarchive/resources/test-preload-resources.css?4 + + + WebResourceData + /* test-preload-resources.css */ + + WebResourceMIMEType + text/css + WebResourceResponse + + MIMEType + text/css + URL + http://127.0.0.1:8000/webarchive/resources/test-preload-resources.css?5 + allHeaderFields + + Accept-Ranges + bytes + Connection + Keep-Alive + Content-Length + 33 + Content-Type + text/css + Date + Sun, 16 Nov 2008 17:00:00 GMT + Etag + "301925-21-45c7d72d3e780" + Keep-Alive + timeout=15 + Last-Modified + Sun, 16 Nov 2008 16:55:00 GMT + Server + Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7l PHP/5.2.6 + + expectedContentLength + 33 + statusCode + 200 + + WebResourceURL + http://127.0.0.1:8000/webarchive/resources/test-preload-resources.css?5 + + + WebResourceData + /* test-preload-resources.css */ + + WebResourceMIMEType + text/css + WebResourceResponse + + MIMEType + text/css + URL + http://127.0.0.1:8000/webarchive/resources/test-preload-resources.css?6 + allHeaderFields + + Accept-Ranges + bytes + Connection + Keep-Alive + Content-Length + 33 + Content-Type + text/css + Date + Sun, 16 Nov 2008 17:00:00 GMT + Etag + "301925-21-45c7d72d3e780" + Keep-Alive + timeout=15 + Last-Modified + Sun, 16 Nov 2008 16:55:00 GMT + Server + Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7l PHP/5.2.6 + + expectedContentLength + 33 + statusCode + 200 + + WebResourceURL + http://127.0.0.1:8000/webarchive/resources/test-preload-resources.css?6 + + + + diff --git a/LayoutTests/http/tests/webarchive/test-preload-resources.html b/LayoutTests/http/tests/webarchive/test-preload-resources.html new file mode 100644 index 0000000..03afb73 --- /dev/null +++ b/LayoutTests/http/tests/webarchive/test-preload-resources.html @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + +

Some resources are missing when saving this page as a webarchive.

+ diff --git a/LayoutTests/platform/qt/Skipped b/LayoutTests/platform/qt/Skipped index 9c84e43..4ae7a5c 100644 --- a/LayoutTests/platform/qt/Skipped +++ b/LayoutTests/platform/qt/Skipped @@ -874,6 +874,9 @@ storage # ------ web archive support webarchive +svg/webarchive +svg/custom/image-with-prefix-in-webarchive.svg +http/tests/webarchive # ----- XSLT currently not supported fast/xsl @@ -1127,7 +1130,6 @@ svg/custom/acid3-test-77.html svg/custom/baseval-animval-equality.svg svg/custom/frame-getSVGDocument.html svg/custom/image-clipped-hit.svg -svg/custom/image-with-prefix-in-webarchive.svg svg/custom/stroke-width-click.svg svg/custom/svg-features.html svg/custom/text-ctm.svg @@ -1141,9 +1143,6 @@ svg/dom/font-face-elements.html svg/dom/SVGRectElement/rect-modify-rx.svg svg/hixie/dynamic/002.xml svg/hixie/mixed/007.xml -svg/webarchive/svg-cursor-subresources.svg -svg/webarchive/svg-feimage-subresources.svg -svg/webarchive/svg-script-subresouces.svg tables/mozilla/bugs/bug51140.html tables/mozilla/bugs/bug103533.html tables/mozilla/marvin/backgr_index.html diff --git a/LayoutTests/platform/win/Skipped b/LayoutTests/platform/win/Skipped index 42a9be0..d69cd29 100644 --- a/LayoutTests/platform/win/Skipped +++ b/LayoutTests/platform/win/Skipped @@ -165,6 +165,7 @@ svg/W3C-SVG-1.1/fonts-elem-07-b.svg webarchive svg/webarchive svg/custom/image-with-prefix-in-webarchive.svg +http/tests/webarchive # layoutTestController.addFileToPasteboardOnDrag is unimplemented fast/forms/dragging-to-file-input.html diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 4697b36..e2e8549 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,21 @@ +2008-12-01 David Kilzer + + Bug 22466: REGRESSION (35867): Many resources missing when saving webarchive of webkit.org + + + + + Reviewed by Brady Eidson. + + Test: http/tests/webarchive/test-preload-resources.html + + * loader/archive/cf/LegacyWebArchive.cpp: + (WebCore::LegacyWebArchive::create): Check the WebCore cache for + resources if DocumentLoader::subresource() doesn't return them. + Note that the DocumentLoader::subresource() method returned + preloaded resources before r35867, but this caused a regression in + Mail. + 2008-12-01 Julien Chaffraix Reviewed by Eric Seidel. diff --git a/WebCore/loader/archive/cf/LegacyWebArchive.cpp b/WebCore/loader/archive/cf/LegacyWebArchive.cpp index 9d99588..2f01a56 100644 --- a/WebCore/loader/archive/cf/LegacyWebArchive.cpp +++ b/WebCore/loader/archive/cf/LegacyWebArchive.cpp @@ -30,6 +30,7 @@ #include "LegacyWebArchive.h" #include "CString.h" +#include "Cache.h" #include "Document.h" #include "DocumentLoader.h" #include "Frame.h" @@ -515,13 +516,25 @@ PassRefPtr LegacyWebArchive::create(const String& markupString for (unsigned i = 0; i < subresourceURLs.size(); ++i) { if (uniqueSubresources.contains(subresourceURLs[i].string())) continue; + uniqueSubresources.add(subresourceURLs[i].string()); + RefPtr resource = documentLoader->subresource(subresourceURLs[i]); - if (resource) + if (resource) { subresources.append(resource.release()); - else - // FIXME: should do something better than spew to console here - LOG_ERROR("Failed to archive subresource for %s", subresourceURLs[i].string().utf8().data()); + continue; + } + + CachedResource *cachedResource = cache()->resourceForURL(subresourceURLs[i]); + if (cachedResource) { + resource = ArchiveResource::create(cachedResource->data(), subresourceURLs[i], cachedResource->response()); + if (resource) + subresources.append(resource.release()); + continue; + } + + // FIXME: should do something better than spew to console here + LOG_ERROR("Failed to archive subresource for %s", subresourceURLs[i].string().utf8().data()); } } } diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog index 1c14f9a..e6acb30 100644 --- a/WebKitTools/ChangeLog +++ b/WebKitTools/ChangeLog @@ -1,3 +1,20 @@ +2008-12-01 David Kilzer + + Bug 22466: REGRESSION (35867): Many resources missing when saving webarchive of webkit.org + + + + + Reviewed by Brady Eidson. + + * DumpRenderTree/mac/DumpRenderTree.mm: + (normalizeHTTPResponseHeaderFields): Added. Normalizes Date, Etag, + Keep-Alive, Last-Modified and Server header fields to prevent false + positive test failures. + (convertWebResourceResponseToDictionary): Call + normalizeHTTPResponseHeaderFields() to noramlize HTTP response + header fields. + 2008-12-01 David D. Kilzer Bug 22559: Report builds left to test in bisect-builds (like git-bisect) diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm index c170108..afb2b0d 100644 --- a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm +++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm @@ -688,6 +688,20 @@ static void convertWebResourceDataToString(NSMutableDictionary *resource) } } +static void normalizeHTTPResponseHeaderFields(NSMutableDictionary *fields) +{ + if ([fields objectForKey:@"Date"]) + [fields setObject:@"Sun, 16 Nov 2008 17:00:00 GMT" forKey:@"Date"]; + if ([fields objectForKey:@"Last-Modified"]) + [fields setObject:@"Sun, 16 Nov 2008 16:55:00 GMT" forKey:@"Last-Modified"]; + if ([fields objectForKey:@"Keep-Alive"]) + [fields setObject:@"timeout=15" forKey:@"Keep-Alive"]; + if ([fields objectForKey:@"Etag"]) + [fields setObject:@"\"301925-21-45c7d72d3e780\"" forKey:@"Etag"]; + if ([fields objectForKey:@"Server"]) + [fields setObject:@"Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7l PHP/5.2.6" forKey:@"Server"]; +} + static void normalizeWebResourceURL(NSMutableString *webResourceURL) { static int fileUrlLength = [(NSString *)@"file://" length]; @@ -709,14 +723,14 @@ static void convertWebResourceResponseToDictionary(NSMutableDictionary *property [unarchiver finishDecoding]; [unarchiver release]; } - + NSMutableDictionary *responseDictionary = [[NSMutableDictionary alloc] init]; - + NSMutableString *urlString = [[[response URL] description] mutableCopy]; normalizeWebResourceURL(urlString); [responseDictionary setObject:urlString forKey:@"URL"]; [urlString release]; - + NSMutableString *mimeTypeString = [[response MIMEType] mutableCopy]; convertMIMEType(mimeTypeString); [responseDictionary setObject:mimeTypeString forKey:@"MIMEType"]; @@ -726,14 +740,18 @@ static void convertWebResourceResponseToDictionary(NSMutableDictionary *property if (textEncodingName) [responseDictionary setObject:textEncodingName forKey:@"textEncodingName"]; [responseDictionary setObject:[NSNumber numberWithLongLong:[response expectedContentLength]] forKey:@"expectedContentLength"]; - + if ([response isKindOfClass:[NSHTTPURLResponse class]]) { NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response; - - [responseDictionary setObject:[httpResponse allHeaderFields] forKey:@"allHeaderFields"]; + + NSMutableDictionary *allHeaderFields = [[httpResponse allHeaderFields] mutableCopy]; + normalizeHTTPResponseHeaderFields(allHeaderFields); + [responseDictionary setObject:allHeaderFields forKey:@"allHeaderFields"]; + [allHeaderFields release]; + [responseDictionary setObject:[NSNumber numberWithInt:[httpResponse statusCode]] forKey:@"statusCode"]; } - + [propertyList setObject:responseDictionary forKey:@"WebResourceResponse"]; [responseDictionary release]; }