Changeset 38884 in webkit


Ignore:
Timestamp:
Dec 1, 2008 4:53:35 PM (15 years ago)
Author:
ddkilzer@apple.com
Message:

Bug 22466: REGRESSION (35867): Many resources missing when saving webarchive of webkit.org

<https://bugs.webkit.org/show_bug.cgi?id=22466>
<rdar://problem/6403593>

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.
Location:
trunk
Files:
5 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r38880 r38884  
     12008-12-01  David Kilzer  <ddkilzer@apple.com>
     2
     3        Bug 22466: REGRESSION (35867): Many resources missing when saving webarchive of webkit.org
     4
     5        <https://bugs.webkit.org/show_bug.cgi?id=22466>
     6        <rdar://problem/6403593>
     7
     8        Reviewed by Brady Eidson.
     9
     10        * http/tests/webarchive/resources/test-preload-resources.css: Added.
     11        * http/tests/webarchive/test-preload-resources-expected.webarchive: Added.
     12        * http/tests/webarchive/test-preload-resources.html: Added.
     13        * platform/qt/Skipped: Added http/tests/webarchive and grouped the
     14        skipped list of other webarchive tests together.
     15        * platform/win/Skipped: Added http/tests/webarchive.
     16
    1172008-12-01  Pamela Greene  <pam@chromium.org>
    218
  • trunk/LayoutTests/platform/qt/Skipped

    r37830 r38884  
    875875# ------ web archive support
    876876webarchive
     877svg/webarchive
     878svg/custom/image-with-prefix-in-webarchive.svg
     879http/tests/webarchive
    877880
    878881# ----- XSLT currently not supported
     
    11281131svg/custom/frame-getSVGDocument.html
    11291132svg/custom/image-clipped-hit.svg
    1130 svg/custom/image-with-prefix-in-webarchive.svg
    11311133svg/custom/stroke-width-click.svg
    11321134svg/custom/svg-features.html
     
    11421144svg/hixie/dynamic/002.xml
    11431145svg/hixie/mixed/007.xml
    1144 svg/webarchive/svg-cursor-subresources.svg
    1145 svg/webarchive/svg-feimage-subresources.svg
    1146 svg/webarchive/svg-script-subresouces.svg
    11471146tables/mozilla/bugs/bug51140.html
    11481147tables/mozilla/bugs/bug103533.html
  • trunk/LayoutTests/platform/win/Skipped

    r38526 r38884  
    166166svg/webarchive
    167167svg/custom/image-with-prefix-in-webarchive.svg
     168http/tests/webarchive
    168169
    169170# <rdar://problem/5230396> layoutTestController.addFileToPasteboardOnDrag is unimplemented
  • trunk/WebCore/ChangeLog

    r38881 r38884  
     12008-12-01  David Kilzer  <ddkilzer@apple.com>
     2
     3        Bug 22466: REGRESSION (35867): Many resources missing when saving webarchive of webkit.org
     4
     5        <https://bugs.webkit.org/show_bug.cgi?id=22466>
     6        <rdar://problem/6403593>
     7
     8        Reviewed by Brady Eidson.
     9
     10        Test: http/tests/webarchive/test-preload-resources.html
     11
     12        * loader/archive/cf/LegacyWebArchive.cpp:
     13        (WebCore::LegacyWebArchive::create): Check the WebCore cache for
     14        resources if DocumentLoader::subresource() doesn't return them.
     15        Note that the DocumentLoader::subresource() method returned
     16        preloaded resources before r35867, but this caused a regression in
     17        Mail.
     18
    1192008-12-01  Julien Chaffraix  <jchaffraix@webkit.org>
    220
  • trunk/WebCore/loader/archive/cf/LegacyWebArchive.cpp

    r35006 r38884  
    3131
    3232#include "CString.h"
     33#include "Cache.h"
    3334#include "Document.h"
    3435#include "DocumentLoader.h"
     
    516517                if (uniqueSubresources.contains(subresourceURLs[i].string()))
    517518                    continue;
     519
    518520                uniqueSubresources.add(subresourceURLs[i].string());
     521
    519522                RefPtr<ArchiveResource> resource = documentLoader->subresource(subresourceURLs[i]);
    520                 if (resource)
     523                if (resource) {
    521524                    subresources.append(resource.release());
    522                 else
    523                     // FIXME: should do something better than spew to console here
    524                     LOG_ERROR("Failed to archive subresource for %s", subresourceURLs[i].string().utf8().data());
     525                    continue;
     526                }
     527
     528                CachedResource *cachedResource = cache()->resourceForURL(subresourceURLs[i]);
     529                if (cachedResource) {
     530                    resource = ArchiveResource::create(cachedResource->data(), subresourceURLs[i], cachedResource->response());
     531                    if (resource)
     532                        subresources.append(resource.release());
     533                    continue;
     534                }
     535
     536                // FIXME: should do something better than spew to console here
     537                LOG_ERROR("Failed to archive subresource for %s", subresourceURLs[i].string().utf8().data());
    525538            }
    526539        }
  • trunk/WebKitTools/ChangeLog

    r38864 r38884  
     12008-12-01  David Kilzer  <ddkilzer@apple.com>
     2
     3        Bug 22466: REGRESSION (35867): Many resources missing when saving webarchive of webkit.org
     4
     5        <https://bugs.webkit.org/show_bug.cgi?id=22466>
     6        <rdar://problem/6403593>
     7
     8        Reviewed by Brady Eidson.
     9
     10        * DumpRenderTree/mac/DumpRenderTree.mm:
     11        (normalizeHTTPResponseHeaderFields): Added.  Normalizes Date, Etag,
     12        Keep-Alive, Last-Modified and Server header fields to prevent false
     13        positive test failures.
     14        (convertWebResourceResponseToDictionary): Call
     15        normalizeHTTPResponseHeaderFields() to noramlize HTTP response
     16        header fields.
     17
    1182008-12-01  David D. Kilzer  <ddkilzer@webkit.org>
    219
  • trunk/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm

    r38786 r38884  
    689689}
    690690
     691static void normalizeHTTPResponseHeaderFields(NSMutableDictionary *fields)
     692{
     693    if ([fields objectForKey:@"Date"])
     694        [fields setObject:@"Sun, 16 Nov 2008 17:00:00 GMT" forKey:@"Date"];
     695    if ([fields objectForKey:@"Last-Modified"])
     696        [fields setObject:@"Sun, 16 Nov 2008 16:55:00 GMT" forKey:@"Last-Modified"];
     697    if ([fields objectForKey:@"Keep-Alive"])
     698        [fields setObject:@"timeout=15" forKey:@"Keep-Alive"];
     699    if ([fields objectForKey:@"Etag"])
     700        [fields setObject:@"\"301925-21-45c7d72d3e780\"" forKey:@"Etag"];
     701    if ([fields objectForKey:@"Server"])
     702        [fields setObject:@"Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7l PHP/5.2.6" forKey:@"Server"];
     703}
     704
    691705static void normalizeWebResourceURL(NSMutableString *webResourceURL)
    692706{
     
    710724        [unarchiver release];
    711725    }       
    712    
     726
    713727    NSMutableDictionary *responseDictionary = [[NSMutableDictionary alloc] init];
    714    
     728
    715729    NSMutableString *urlString = [[[response URL] description] mutableCopy];
    716730    normalizeWebResourceURL(urlString);
    717731    [responseDictionary setObject:urlString forKey:@"URL"];
    718732    [urlString release];
    719    
     733
    720734    NSMutableString *mimeTypeString = [[response MIMEType] mutableCopy];
    721735    convertMIMEType(mimeTypeString);
     
    727741        [responseDictionary setObject:textEncodingName forKey:@"textEncodingName"];
    728742    [responseDictionary setObject:[NSNumber numberWithLongLong:[response expectedContentLength]] forKey:@"expectedContentLength"];
    729    
     743
    730744    if ([response isKindOfClass:[NSHTTPURLResponse class]]) {
    731745        NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
    732        
    733         [responseDictionary setObject:[httpResponse allHeaderFields] forKey:@"allHeaderFields"];
     746
     747        NSMutableDictionary *allHeaderFields = [[httpResponse allHeaderFields] mutableCopy];
     748        normalizeHTTPResponseHeaderFields(allHeaderFields);
     749        [responseDictionary setObject:allHeaderFields forKey:@"allHeaderFields"];
     750        [allHeaderFields release];
     751
    734752        [responseDictionary setObject:[NSNumber numberWithInt:[httpResponse statusCode]] forKey:@"statusCode"];
    735753    }
    736    
     754
    737755    [propertyList setObject:responseDictionary forKey:@"WebResourceResponse"];
    738756    [responseDictionary release];
Note: See TracChangeset for help on using the changeset viewer.