Diff
Modified: trunk/Source/WebCore/ChangeLog (210466 => 210467)
--- trunk/Source/WebCore/ChangeLog 2017-01-07 02:59:12 UTC (rev 210466)
+++ trunk/Source/WebCore/ChangeLog 2017-01-07 03:49:04 UTC (rev 210467)
@@ -1,3 +1,22 @@
+2017-01-06 Andy Estes <[email protected]>
+
+ [Cocoa] Consolidate duplicate copies of WebArchiveDumpSupport in DRT and WKTR into WebCoreTestSupport
+ https://bugs.webkit.org/show_bug.cgi?id=166789
+
+ Reviewed by Alex Christensen.
+
+ There were duplicate implementations of WebArchiveDumpSupport in DumpRenderTree and
+ WebKitTestRunner. This change consolidates these into a single implementation in
+ WebCoreTestSupport.
+
+ * PlatformMac.cmake: Added WebArchiveDumpSupport.mm to WebCoreTestSupport.
+ * WebCore.xcodeproj/project.pbxproj: Ditto. Also made WebArchiveDumpSupport.h a Private header.
+ * platform/spi/cf/CFNetworkSPI.h: Moved CFNetwork forward declarations from
+ WebArchiveDumpSupport to here.
+ * testing/cocoa/WebArchiveDumpSupport.h: Added.
+ * testing/cocoa/WebArchiveDumpSupport.mm: Merged WebArchiveDumpSupport.cpp and
+ WebArchiveDumpSupport{Cocoa,Mac}.mm into a single file.
+
2017-01-06 Tim Horton <[email protected]>
Minor cleanups to IndentOutdentCommand and related code
Modified: trunk/Source/WebCore/PlatformMac.cmake (210466 => 210467)
--- trunk/Source/WebCore/PlatformMac.cmake 2017-01-07 02:59:12 UTC (rev 210466)
+++ trunk/Source/WebCore/PlatformMac.cmake 2017-01-07 03:49:04 UTC (rev 210467)
@@ -749,6 +749,8 @@
testing/Internals.mm
testing/MockContentFilter.cpp
testing/MockContentFilterSettings.cpp
+
+ testing/cocoa/WebArchiveDumpSupport.mm
)
set(CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} "-compatibility_version 1 -current_version ${WEBKIT_MAC_VERSION}")
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (210466 => 210467)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-01-07 02:59:12 UTC (rev 210466)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-01-07 03:49:04 UTC (rev 210467)
@@ -3927,6 +3927,9 @@
A14978711ABAF3A500CEF7E4 /* PlatformContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A14978701ABAF3A500CEF7E4 /* PlatformContentFilter.h */; };
A15E31F31E0CB0B2004B371C /* QuickLook.mm in Sources */ = {isa = PBXBuildFile; fileRef = A15E31F21E0CB0AA004B371C /* QuickLook.mm */; };
A15E31F41E0CB0B5004B371C /* QuickLook.h in Headers */ = {isa = PBXBuildFile; fileRef = A15E31F11E0CB0AA004B371C /* QuickLook.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A1763F3E1E205234001D58DE /* WebArchiveDumpSupport.mm in Sources */ = {isa = PBXBuildFile; fileRef = A1763F3C1E205234001D58DE /* WebArchiveDumpSupport.mm */; };
+ A1763F3F1E205234001D58DE /* WebArchiveDumpSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = A1763F3D1E205234001D58DE /* WebArchiveDumpSupport.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A1763F411E20586E001D58DE /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A1763F401E20586E001D58DE /* CFNetwork.framework */; };
A17C81220F2A5CF7005DAAEB /* HTMLElementFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */; };
A17C81230F2A5CF7005DAAEB /* HTMLElementFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */; };
A182D5B71BE722670087A7CC /* SettingsCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = A182D5B61BE722620087A7CC /* SettingsCocoa.mm */; };
@@ -11588,6 +11591,9 @@
A14978701ABAF3A500CEF7E4 /* PlatformContentFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformContentFilter.h; sourceTree = "<group>"; };
A15E31F11E0CB0AA004B371C /* QuickLook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuickLook.h; sourceTree = "<group>"; };
A15E31F21E0CB0AA004B371C /* QuickLook.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = QuickLook.mm; sourceTree = "<group>"; };
+ A1763F3C1E205234001D58DE /* WebArchiveDumpSupport.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebArchiveDumpSupport.mm; sourceTree = "<group>"; };
+ A1763F3D1E205234001D58DE /* WebArchiveDumpSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebArchiveDumpSupport.h; sourceTree = "<group>"; };
+ A1763F401E20586E001D58DE /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };
A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLElementFactory.cpp; sourceTree = "<group>"; };
A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLElementFactory.h; sourceTree = "<group>"; };
A182D5B61BE722620087A7CC /* SettingsCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SettingsCocoa.mm; sourceTree = "<group>"; };
@@ -14958,6 +14964,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ A1763F411E20586E001D58DE /* CFNetwork.framework in Frameworks */,
AA5F3B9116CC5BEB00455EB0 /* CoreFoundation.framework in Frameworks */,
41230913138C42FF00BCCFCA /* _javascript_Core.framework in Frameworks */,
4123081B138C429700BCCFCA /* WebCore.framework in Frameworks */,
@@ -15426,6 +15433,7 @@
0867D69AFE84028FC02AAC07 /* Frameworks */ = {
isa = PBXGroup;
children = (
+ A1763F401E20586E001D58DE /* CFNetwork.framework */,
FD2DBF0E12B048A300ED98C6 /* Accelerate.framework */,
FD2DBF0F12B048A300ED98C6 /* AudioToolbox.framework */,
AA5F3B9016CC5BEB00455EB0 /* CoreFoundation.framework */,
@@ -16564,6 +16572,7 @@
417DA4CD13734204007C57FB /* testing */ = {
isa = PBXGroup;
children = (
+ A1763F3B1E2051AB001D58DE /* cocoa */,
41815C1B138319630057AAA4 /* js */,
51714EA91CF65899004723C4 /* GCObservation.cpp */,
51714EAA1CF65899004723C4 /* GCObservation.h */,
@@ -19660,6 +19669,15 @@
path = ios;
sourceTree = "<group>";
};
+ A1763F3B1E2051AB001D58DE /* cocoa */ = {
+ isa = PBXGroup;
+ children = (
+ A1763F3D1E205234001D58DE /* WebArchiveDumpSupport.h */,
+ A1763F3C1E205234001D58DE /* WebArchiveDumpSupport.mm */,
+ );
+ path = cocoa;
+ sourceTree = "<group>";
+ };
A516E8B2136E04C00076C3C0 /* ios */ = {
isa = PBXGroup;
children = (
@@ -24806,6 +24824,7 @@
2D6F3E911C1ECB2F0061DBD4 /* MockPageOverlay.h in Headers */,
2D97F04819DD4140001EE9C3 /* MockPageOverlayClient.h in Headers */,
AA5F3B8D16CC33D100455EB0 /* PlatformSpeechSynthesizerMock.h in Headers */,
+ A1763F3F1E205234001D58DE /* WebArchiveDumpSupport.h in Headers */,
41815C1F138319830057AAA4 /* WebCoreTestSupport.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -28695,6 +28714,7 @@
53E29E5E167A8A1900586D3D /* InternalSettingsGenerated.cpp in Sources */,
51714EB01CF665CE004723C4 /* JSGCObservation.cpp in Sources */,
417DA71D13735DFA007C57FB /* JSInternals.cpp in Sources */,
+ A1763F3E1E205234001D58DE /* WebArchiveDumpSupport.mm in Sources */,
A740B5A714C935AF00A77FA4 /* JSInternalSettings.cpp in Sources */,
53ED3FDE167A88E7006762E6 /* JSInternalSettingsGenerated.cpp in Sources */,
A740B59714C935AF00A77FA4 /* JSMallocStatistics.cpp in Sources */,
Modified: trunk/Source/WebCore/platform/spi/cf/CFNetworkSPI.h (210466 => 210467)
--- trunk/Source/WebCore/platform/spi/cf/CFNetworkSPI.h 2017-01-07 02:59:12 UTC (rev 210466)
+++ trunk/Source/WebCore/platform/spi/cf/CFNetworkSPI.h 2017-01-07 03:49:04 UTC (rev 210467)
@@ -55,6 +55,13 @@
_TimingDataOptionsEnableW3CNavigationTiming = (1 << 0)
};
+enum CFURLCacheStoragePolicy {
+ kCFURLCacheStorageAllowed = 0,
+ kCFURLCacheStorageAllowedInMemoryOnly = 1,
+ kCFURLCacheStorageNotAllowed = 2
+};
+typedef enum CFURLCacheStoragePolicy CFURLCacheStoragePolicy;
+
typedef const struct _CFCachedURLResponse* CFCachedURLResponseRef;
typedef const struct _CFURLCache* CFURLCacheRef;
typedef const struct _CFURLCredential* CFURLCredentialRef;
@@ -151,8 +158,8 @@
void CFURLConnectionInvalidateConnectionCache();
extern CFStringRef const kCFHTTPCookieLocalFileDomain;
+extern const CFStringRef kCFHTTPVersion1_1;
extern const CFStringRef kCFURLRequestAllowAllPOSTCaching;
-
extern const CFStringRef _kCFURLConnectionPropertyShouldSniff;
CFHTTPCookieStorageRef _CFHTTPCookieStorageGetDefault(CFAllocatorRef);
@@ -174,6 +181,13 @@
void CFURLResponseSetMIMEType(CFURLResponseRef, CFStringRef);
CFHTTPCookieStorageRef _CFURLStorageSessionCopyCookieStorage(CFAllocatorRef, CFURLStorageSessionRef);
CFArrayRef _CFHTTPCookieStorageCopyCookiesForURLWithMainDocumentURL(CFHTTPCookieStorageRef inCookieStorage, CFURLRef inURL, CFURLRef inMainDocumentURL, Boolean sendSecureCookies);
+CFStringRef CFURLResponseGetTextEncodingName(CFURLResponseRef);
+SInt64 CFURLResponseGetExpectedContentLength(CFURLResponseRef);
+CFTypeID CFURLResponseGetTypeID();
+CFURLResponseRef CFURLResponseCreate(CFAllocatorRef, CFURLRef, CFStringRef mimeType, SInt64 expectedContentLength, CFStringRef textEncodingName, CFURLCacheStoragePolicy);
+void CFURLResponseSetExpectedContentLength(CFURLResponseRef, SInt64 length);
+CFURLResponseRef CFURLResponseCreateWithHTTPResponse(CFAllocatorRef, CFURLRef, CFHTTPMessageRef, CFURLCacheStoragePolicy);
+
#endif // !PLATFORM(WIN)
WTF_EXTERN_C_END
Added: trunk/Source/WebCore/testing/cocoa/WebArchiveDumpSupport.h (0 => 210467)
--- trunk/Source/WebCore/testing/cocoa/WebArchiveDumpSupport.h (rev 0)
+++ trunk/Source/WebCore/testing/cocoa/WebArchiveDumpSupport.h 2017-01-07 03:49:04 UTC (rev 210467)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2007-2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "WebCoreTestSupport.h"
+#include <CoreFoundation/CoreFoundation.h>
+
+namespace WebCoreTestSupport {
+
+CFStringRef createXMLStringFromWebArchiveData(CFDataRef webArchiveData) TEST_SUPPORT_EXPORT;
+
+} // namespace WebCoreTestSupport
Copied: trunk/Source/WebCore/testing/cocoa/WebArchiveDumpSupport.mm (from rev 210466, trunk/Tools/WebKitTestRunner/cf/WebArchiveDumpSupport.cpp) (0 => 210467)
--- trunk/Source/WebCore/testing/cocoa/WebArchiveDumpSupport.mm (rev 0)
+++ trunk/Source/WebCore/testing/cocoa/WebArchiveDumpSupport.mm 2017-01-07 03:49:04 UTC (rev 210467)
@@ -0,0 +1,237 @@
+/*
+ * Copyright (C) 2007-2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "WebArchiveDumpSupport.h"
+
+#import "CFNetworkSPI.h"
+#import "MIMETypeRegistry.h"
+#import <CFNetwork/CFHTTPMessage.h>
+#import <CFNetwork/CFNetwork.h>
+#import <wtf/RetainPtr.h>
+
+using namespace WebCore;
+
+namespace WebCoreTestSupport {
+
+static CFURLResponseRef createCFURLResponseFromResponseData(CFDataRef responseData)
+{
+ RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)responseData]);
+ NSURLResponse *response = [unarchiver decodeObjectForKey:@"WebResourceResponse"]; // WebResourceResponseKey in WebResource.m
+ [unarchiver finishDecoding];
+
+ if (![response isKindOfClass:[NSHTTPURLResponse class]])
+ return CFURLResponseCreate(kCFAllocatorDefault, (CFURLRef)response.URL, (CFStringRef)response.MIMEType, response.expectedContentLength, (CFStringRef)response.textEncodingName, kCFURLCacheStorageAllowed);
+
+ NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
+
+ // NSURLResponse is not toll-free bridged to CFURLResponse.
+ RetainPtr<CFHTTPMessageRef> httpMessage = adoptCF(CFHTTPMessageCreateResponse(kCFAllocatorDefault, httpResponse.statusCode, nullptr, kCFHTTPVersion1_1));
+
+ NSDictionary *headerFields = httpResponse.allHeaderFields;
+ for (NSString *headerField in [headerFields keyEnumerator])
+ CFHTTPMessageSetHeaderFieldValue(httpMessage.get(), (CFStringRef)headerField, (CFStringRef)[headerFields objectForKey:headerField]);
+
+ return CFURLResponseCreateWithHTTPResponse(kCFAllocatorDefault, (CFURLRef)response.URL, httpMessage.get(), kCFURLCacheStorageAllowed);
+}
+
+static CFArrayRef supportedNonImageMIMETypes()
+{
+ auto array = adoptNS([[NSMutableArray alloc] init]);
+ for (auto& mimeType : MIMETypeRegistry::getSupportedNonImageMIMETypes())
+ [array addObject:mimeType];
+ return (CFArrayRef)array.autorelease();
+}
+
+static void convertMIMEType(CFMutableStringRef mimeType)
+{
+ // Workaround for <rdar://problem/6234318> with Dashcode 2.0
+ if (CFStringCompare(mimeType, CFSTR("application/x-_javascript_"), kCFCompareAnchored | kCFCompareCaseInsensitive) == kCFCompareEqualTo)
+ CFStringReplaceAll(mimeType, CFSTR("text/_javascript_"));
+}
+
+static void convertWebResourceDataToString(CFMutableDictionaryRef resource)
+{
+ CFMutableStringRef mimeType = (CFMutableStringRef)CFDictionaryGetValue(resource, CFSTR("WebResourceMIMEType"));
+ CFStringLowercase(mimeType, CFLocaleGetSystem());
+ convertMIMEType(mimeType);
+
+ CFArrayRef supportedMIMETypes = supportedNonImageMIMETypes();
+ if (CFStringHasPrefix(mimeType, CFSTR("text/")) || CFArrayContainsValue(supportedMIMETypes, CFRangeMake(0, CFArrayGetCount(supportedMIMETypes)), mimeType)) {
+ CFStringRef textEncodingName = static_cast<CFStringRef>(CFDictionaryGetValue(resource, CFSTR("WebResourceTextEncodingName")));
+ CFStringEncoding stringEncoding;
+ if (textEncodingName && CFStringGetLength(textEncodingName))
+ stringEncoding = CFStringConvertIANACharSetNameToEncoding(textEncodingName);
+ else
+ stringEncoding = kCFStringEncodingUTF8;
+
+ CFDataRef data = "" CFSTR("WebResourceData")));
+ RetainPtr<CFStringRef> dataAsString = adoptCF(CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, data, stringEncoding));
+ if (dataAsString)
+ CFDictionarySetValue(resource, CFSTR("WebResourceData"), dataAsString.get());
+ }
+}
+
+static void normalizeHTTPResponseHeaderFields(CFMutableDictionaryRef fields)
+{
+ // Normalize headers
+ if (CFDictionaryContainsKey(fields, CFSTR("Date")))
+ CFDictionarySetValue(fields, CFSTR("Date"), CFSTR("Sun, 16 Nov 2008 17:00:00 GMT"));
+ if (CFDictionaryContainsKey(fields, CFSTR("Last-Modified")))
+ CFDictionarySetValue(fields, CFSTR("Last-Modified"), CFSTR("Sun, 16 Nov 2008 16:55:00 GMT"));
+ if (CFDictionaryContainsKey(fields, CFSTR("Etag")))
+ CFDictionarySetValue(fields, CFSTR("Etag"), CFSTR("\"301925-21-45c7d72d3e780\""));
+ if (CFDictionaryContainsKey(fields, CFSTR("Server")))
+ CFDictionarySetValue(fields, CFSTR("Server"), CFSTR("Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7l PHP/5.2.6"));
+
+ // Remove headers
+ CFDictionaryRemoveValue(fields, CFSTR("Connection"));
+ CFDictionaryRemoveValue(fields, CFSTR("Keep-Alive"));
+}
+
+static void normalizeWebResourceURL(CFMutableStringRef webResourceURL)
+{
+ static CFIndex fileUrlLength = CFStringGetLength(CFSTR("file://"));
+ CFRange layoutTestsWebArchivePathRange = CFStringFind(webResourceURL, CFSTR("/LayoutTests/"), kCFCompareBackwards);
+ if (layoutTestsWebArchivePathRange.location == kCFNotFound)
+ return;
+ CFRange currentWorkingDirectoryRange = CFRangeMake(fileUrlLength, layoutTestsWebArchivePathRange.location - fileUrlLength);
+ CFStringReplace(webResourceURL, currentWorkingDirectoryRange, CFSTR(""));
+}
+
+static void convertWebResourceResponseToDictionary(CFMutableDictionaryRef propertyList)
+{
+ CFDataRef responseData = static_cast<CFDataRef>(CFDictionaryGetValue(propertyList, CFSTR("WebResourceResponse"))); // WebResourceResponseKey in WebResource.m
+ if (CFGetTypeID(responseData) != CFDataGetTypeID())
+ return;
+
+ RetainPtr<CFURLResponseRef> response = adoptCF(createCFURLResponseFromResponseData(responseData));
+ if (!response)
+ return;
+
+ RetainPtr<CFMutableDictionaryRef> responseDictionary = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+
+ RetainPtr<CFMutableStringRef> urlString = adoptCF(CFStringCreateMutableCopy(kCFAllocatorDefault, 0, CFURLGetString(CFURLResponseGetURL(response.get()))));
+ normalizeWebResourceURL(urlString.get());
+ CFDictionarySetValue(responseDictionary.get(), CFSTR("URL"), urlString.get());
+
+ RetainPtr<CFMutableStringRef> mimeTypeString = adoptCF(CFStringCreateMutableCopy(kCFAllocatorDefault, 0, CFURLResponseGetMIMEType(response.get())));
+ convertMIMEType(mimeTypeString.get());
+ CFDictionarySetValue(responseDictionary.get(), CFSTR("MIMEType"), mimeTypeString.get());
+
+ CFStringRef textEncodingName = CFURLResponseGetTextEncodingName(response.get());
+ if (textEncodingName)
+ CFDictionarySetValue(responseDictionary.get(), CFSTR("textEncodingName"), textEncodingName);
+
+ SInt64 expectedContentLength = CFURLResponseGetExpectedContentLength(response.get());
+ RetainPtr<CFNumberRef> expectedContentLengthNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &expectedContentLength));
+ CFDictionarySetValue(responseDictionary.get(), CFSTR("expectedContentLength"), expectedContentLengthNumber.get());
+
+ if (CFHTTPMessageRef httpMessage = CFURLResponseGetHTTPResponse(response.get())) {
+ RetainPtr<CFDictionaryRef> allHeaders = adoptCF(CFHTTPMessageCopyAllHeaderFields(httpMessage));
+ RetainPtr<CFMutableDictionaryRef> allHeaderFields = adoptCF(CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, allHeaders.get()));
+ normalizeHTTPResponseHeaderFields(allHeaderFields.get());
+ CFDictionarySetValue(responseDictionary.get(), CFSTR("allHeaderFields"), allHeaderFields.get());
+
+ CFIndex statusCode = CFHTTPMessageGetResponseStatusCode(httpMessage);
+ RetainPtr<CFNumberRef> statusCodeNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberCFIndexType, &statusCode));
+ CFDictionarySetValue(responseDictionary.get(), CFSTR("statusCode"), statusCodeNumber.get());
+ }
+
+ CFDictionarySetValue(propertyList, CFSTR("WebResourceResponse"), responseDictionary.get());
+}
+
+static CFComparisonResult compareResourceURLs(const void *val1, const void *val2, void *)
+{
+ CFStringRef url1 = static_cast<CFStringRef>(CFDictionaryGetValue(static_cast<CFDictionaryRef>(val1), CFSTR("WebResourceURL")));
+ CFStringRef url2 = static_cast<CFStringRef>(CFDictionaryGetValue(static_cast<CFDictionaryRef>(val2), CFSTR("WebResourceURL")));
+
+ return CFStringCompare(url1, url2, kCFCompareAnchored);
+}
+
+CFStringRef createXMLStringFromWebArchiveData(CFDataRef webArchiveData)
+{
+ CFErrorRef error = 0;
+ CFPropertyListFormat format = kCFPropertyListBinaryFormat_v1_0;
+ RetainPtr<CFMutableDictionaryRef> propertyList = adoptCF((CFMutableDictionaryRef)CFPropertyListCreateWithData(kCFAllocatorDefault, webArchiveData, kCFPropertyListMutableContainersAndLeaves, &format, &error));
+
+ if (!propertyList) {
+ if (error)
+ return CFErrorCopyDescription(error);
+ return static_cast<CFStringRef>(CFRetain(CFSTR("An unknown error occurred converting data to property list.")));
+ }
+
+ RetainPtr<CFMutableArrayRef> resources = adoptCF(CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks));
+ CFArrayAppendValue(resources.get(), propertyList.get());
+
+ while (CFArrayGetCount(resources.get())) {
+ RetainPtr<CFMutableDictionaryRef> resourcePropertyList = (CFMutableDictionaryRef)CFArrayGetValueAtIndex(resources.get(), 0);
+ CFArrayRemoveValueAtIndex(resources.get(), 0);
+
+ CFMutableDictionaryRef mainResource = (CFMutableDictionaryRef)CFDictionaryGetValue(resourcePropertyList.get(), CFSTR("WebMainResource"));
+ normalizeWebResourceURL((CFMutableStringRef)CFDictionaryGetValue(mainResource, CFSTR("WebResourceURL")));
+ convertWebResourceDataToString(mainResource);
+
+ // Add subframeArchives to list for processing
+ CFMutableArrayRef subframeArchives = (CFMutableArrayRef)CFDictionaryGetValue(resourcePropertyList.get(), CFSTR("WebSubframeArchives")); // WebSubframeArchivesKey in WebArchive.m
+ if (subframeArchives)
+ CFArrayAppendArray(resources.get(), subframeArchives, CFRangeMake(0, CFArrayGetCount(subframeArchives)));
+
+ CFMutableArrayRef subresources = (CFMutableArrayRef)CFDictionaryGetValue(resourcePropertyList.get(), CFSTR("WebSubresources")); // WebSubresourcesKey in WebArchive.m
+ if (!subresources)
+ continue;
+
+ CFIndex subresourcesCount = CFArrayGetCount(subresources);
+ for (CFIndex i = 0; i < subresourcesCount; ++i) {
+ CFMutableDictionaryRef subresourcePropertyList = (CFMutableDictionaryRef)CFArrayGetValueAtIndex(subresources, i);
+ normalizeWebResourceURL((CFMutableStringRef)CFDictionaryGetValue(subresourcePropertyList, CFSTR("WebResourceURL")));
+ convertWebResourceResponseToDictionary(subresourcePropertyList);
+ convertWebResourceDataToString(subresourcePropertyList);
+ }
+
+ // Sort the subresources so they're always in a predictable order for the dump
+ CFArraySortValues(subresources, CFRangeMake(0, CFArrayGetCount(subresources)), compareResourceURLs, 0);
+ }
+
+ error = 0;
+
+ RetainPtr<CFDataRef> xmlData = adoptCF(CFPropertyListCreateData(kCFAllocatorDefault, propertyList.get(), kCFPropertyListXMLFormat_v1_0, 0, &error));
+
+ if (!xmlData) {
+ if (error)
+ return CFErrorCopyDescription(error);
+ return static_cast<CFStringRef>(CFRetain(CFSTR("An unknown error occurred converting property list to data.")));
+ }
+
+ RetainPtr<CFStringRef> xmlString = adoptCF(CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, xmlData.get(), kCFStringEncodingUTF8));
+ RetainPtr<CFMutableStringRef> string = adoptCF(CFStringCreateMutableCopy(kCFAllocatorDefault, 0, xmlString.get()));
+
+ // Replace "Apple Computer" with "Apple" in the DTD declaration.
+ CFStringFindAndReplace(string.get(), CFSTR("-//Apple Computer//"), CFSTR("-//Apple//"), CFRangeMake(0, CFStringGetLength(string.get())), 0);
+
+ return string.leakRef();
+}
+
+} // namespace WebCoreTestSupport
Modified: trunk/Tools/ChangeLog (210466 => 210467)
--- trunk/Tools/ChangeLog 2017-01-07 02:59:12 UTC (rev 210466)
+++ trunk/Tools/ChangeLog 2017-01-07 03:49:04 UTC (rev 210467)
@@ -1,3 +1,29 @@
+2017-01-06 Andy Estes <[email protected]>
+
+ [Cocoa] Consolidate duplicate copies of WebArchiveDumpSupport in DRT and WKTR into WebCoreTestSupport
+ https://bugs.webkit.org/show_bug.cgi?id=166789
+
+ Reviewed by Alex Christensen.
+
+ * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
+ * DumpRenderTree/PlatformMac.cmake:
+ * DumpRenderTree/cf/WebArchiveDumpSupport.cpp: Removed.
+ * DumpRenderTree/cf/WebArchiveDumpSupport.h: Removed.
+ * DumpRenderTree/mac/DumpRenderTree.mm:
+ Called WebCoreTestSupport::createXMLStringFromWebArchiveData() instead of
+ createXMLStringFromWebArchiveData().
+ * DumpRenderTree/mac/WebArchiveDumpSupportMac.mm: Removed.
+ * WebKitTestRunner/Configurations/Base.xcconfig:
+ Added $(BUILT_PRODUCTS_DIR)/WebCoreTestSupport to HEADER_SEARCH_PATHS.
+ * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+ (WTR::InjectedBundlePage::dumpDOMAsWebArchive):
+ Called WebCoreTestSupport::createXMLStringFromWebArchiveData() instead of
+ createXMLStringFromWebArchiveData().
+ * WebKitTestRunner/InjectedBundle/cocoa/WebArchiveDumpSupportCocoa.mm: Removed.
+ * WebKitTestRunner/PlatformMac.cmake:
+ * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
+ * WebKitTestRunner/cf/WebArchiveDumpSupport.h: Removed.
+
2017-01-06 Tim Horton <[email protected]>
Minor cleanups to IndentOutdentCommand and related code
Modified: trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj (210466 => 210467)
--- trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj 2017-01-07 02:59:12 UTC (rev 210466)
+++ trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj 2017-01-07 03:49:04 UTC (rev 210467)
@@ -80,8 +80,6 @@
2D403F1B15087209005358D2 /* LayoutTestHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D403EA215087142005358D2 /* LayoutTestHelper.m */; };
2DA2E3A51E1BA54100A3BBD0 /* DumpRenderTreeSpellChecker.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA2E3A41E1BA54100A3BBD0 /* DumpRenderTreeSpellChecker.mm */; };
31117B3D15D9A56A00163BC8 /* MockWebNotificationProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = 31117B3B15D9A56A00163BC8 /* MockWebNotificationProvider.mm */; };
- 440590711268453800CFD48D /* WebArchiveDumpSupportMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 440590701268453800CFD48D /* WebArchiveDumpSupportMac.mm */; };
- 4437730E125CBC3600AAE02C /* WebArchiveDumpSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 44A997830FCDE86400580F10 /* WebArchiveDumpSupport.cpp */; };
4464CABE1C20A08B00E5BB55 /* DumpRenderTreeAppMain.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4464CABD1C20A07000E5BB55 /* DumpRenderTreeAppMain.mm */; };
4AD6A11413C8124000EA9737 /* FormValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AD6A11313C8124000EA9737 /* FormValue.cpp */; };
5106803E15CC7B10001A8A23 /* SlowNPPNew.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5106803D15CC7B10001A8A23 /* SlowNPPNew.cpp */; };
@@ -307,10 +305,7 @@
375F09780DAC3CB600C8B4E5 /* WebKitWeightWatcher800.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher800.ttf; path = fonts/WebKitWeightWatcher800.ttf; sourceTree = "<group>"; };
375F09790DAC3CB600C8B4E5 /* WebKitWeightWatcher900.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher900.ttf; path = fonts/WebKitWeightWatcher900.ttf; sourceTree = "<group>"; };
417DAA1C137B3E24007C57FB /* WebCoreTestSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebCoreTestSupport.h; path = WebCoreTestSupport/WebCoreTestSupport.h; sourceTree = BUILT_PRODUCTS_DIR; };
- 440590701268453800CFD48D /* WebArchiveDumpSupportMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebArchiveDumpSupportMac.mm; path = mac/WebArchiveDumpSupportMac.mm; sourceTree = "<group>"; };
4464CABD1C20A07000E5BB55 /* DumpRenderTreeAppMain.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DumpRenderTreeAppMain.mm; path = ios/DumpRenderTreeAppMain.mm; sourceTree = "<group>"; };
- 44A997820FCDE86400580F10 /* WebArchiveDumpSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebArchiveDumpSupport.h; path = cf/WebArchiveDumpSupport.h; sourceTree = "<group>"; };
- 44A997830FCDE86400580F10 /* WebArchiveDumpSupport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebArchiveDumpSupport.cpp; path = cf/WebArchiveDumpSupport.cpp; sourceTree = "<group>"; };
4AD6A11313C8124000EA9737 /* FormValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormValue.cpp; sourceTree = "<group>"; };
5106803D15CC7B10001A8A23 /* SlowNPPNew.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SlowNPPNew.cpp; path = TestNetscapePlugIn/Tests/SlowNPPNew.cpp; sourceTree = SOURCE_ROOT; };
51134C9816014FDB001AA513 /* InvokeDestroysPluginWithinNPP_New.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InvokeDestroysPluginWithinNPP_New.cpp; sourceTree = "<group>"; };
@@ -499,9 +494,6 @@
A8D79CE80FC28B2C004AC8FE /* DumpRenderTreeFileDraggingSource.h */,
A8D79CE90FC28B2C004AC8FE /* DumpRenderTreeFileDraggingSource.m */,
2CE88FA117124CEE00734FC0 /* _javascript_Threading.cpp */,
- 44A997820FCDE86400580F10 /* WebArchiveDumpSupport.h */,
- 44A997830FCDE86400580F10 /* WebArchiveDumpSupport.cpp */,
- 440590701268453800CFD48D /* WebArchiveDumpSupportMac.mm */,
BC9D90210C97472D0099A4A3 /* WorkQueue.cpp */,
BC9D90220C97472E0099A4A3 /* WorkQueue.h */,
BC9D90230C97472E0099A4A3 /* WorkQueueItem.h */,
@@ -1152,8 +1144,6 @@
0F18E70D1D6BAC8C0027E547 /* UIScriptControllerIOS.mm in Sources */,
7CBBC3231DDFCF9A00786B9D /* TestOptions.mm in Sources */,
0F18E70F1D6BACB60027E547 /* UIScriptControllerMac.mm in Sources */,
- 4437730E125CBC3600AAE02C /* WebArchiveDumpSupport.cpp in Sources */,
- 440590711268453800CFD48D /* WebArchiveDumpSupportMac.mm in Sources */,
BC9D90240C97472E0099A4A3 /* WorkQueue.cpp in Sources */,
BCA18B260C9B015C00114369 /* WorkQueueItemMac.mm in Sources */,
);
Modified: trunk/Tools/DumpRenderTree/PlatformMac.cmake (210466 => 210467)
--- trunk/Tools/DumpRenderTree/PlatformMac.cmake 2017-01-07 02:59:12 UTC (rev 210466)
+++ trunk/Tools/DumpRenderTree/PlatformMac.cmake 2017-01-07 03:49:04 UTC (rev 210467)
@@ -81,8 +81,6 @@
)
list(APPEND DumpRenderTree_Cpp_SOURCES
- cf/WebArchiveDumpSupport.cpp
-
cg/PixelDumpSupportCG.cpp
)
@@ -112,7 +110,6 @@
mac/TestRunnerMac.mm
mac/UIDelegate.mm
mac/UIScriptControllerMac.mm
- mac/WebArchiveDumpSupportMac.mm
mac/WorkQueueItemMac.mm
)
Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (210466 => 210467)
--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2017-01-07 02:59:12 UTC (rev 210466)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2017-01-07 03:49:04 UTC (rev 210467)
@@ -1743,11 +1743,11 @@
resultMimeType = @"application/pdf";
} else if (gTestRunner->dumpDOMAsWebArchive()) {
WebArchive *webArchive = [[mainFrame DOMDocument] webArchive];
- resultString = CFBridgingRelease(createXMLStringFromWebArchiveData((CFDataRef)[webArchive data]));
+ resultString = CFBridgingRelease(WebCoreTestSupport::createXMLStringFromWebArchiveData((CFDataRef)[webArchive data]));
resultMimeType = @"application/x-webarchive";
} else if (gTestRunner->dumpSourceAsWebArchive()) {
WebArchive *webArchive = [[mainFrame dataSource] webArchive];
- resultString = CFBridgingRelease(createXMLStringFromWebArchiveData((CFDataRef)[webArchive data]));
+ resultString = CFBridgingRelease(WebCoreTestSupport::createXMLStringFromWebArchiveData((CFDataRef)[webArchive data]));
resultMimeType = @"application/x-webarchive";
} else
resultString = [mainFrame renderTreeAsExternalRepresentationForPrinting:gTestRunner->isPrinting()];
Deleted: trunk/Tools/DumpRenderTree/mac/WebArchiveDumpSupportMac.mm (210466 => 210467)
--- trunk/Tools/DumpRenderTree/mac/WebArchiveDumpSupportMac.mm 2017-01-07 02:59:12 UTC (rev 210466)
+++ trunk/Tools/DumpRenderTree/mac/WebArchiveDumpSupportMac.mm 2017-01-07 03:49:04 UTC (rev 210467)
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "WebArchiveDumpSupport.h"
-
-#import <CFNetwork/CFHTTPMessage.h>
-#import <Foundation/Foundation.h>
-#import <WebKit/WebHTMLRepresentation.h>
-#import <wtf/RetainPtr.h>
-
-extern "C" {
-
-enum CFURLCacheStoragePolicy {
- kCFURLCacheStorageAllowed = 0,
- kCFURLCacheStorageAllowedInMemoryOnly = 1,
- kCFURLCacheStorageNotAllowed = 2
-};
-typedef enum CFURLCacheStoragePolicy CFURLCacheStoragePolicy;
-
-extern const CFStringRef kCFHTTPVersion1_1;
-
-CFURLResponseRef CFURLResponseCreate(CFAllocatorRef alloc, CFURLRef URL, CFStringRef mimeType, SInt64 expectedContentLength, CFStringRef textEncodingName, CFURLCacheStoragePolicy recommendedPolicy);
-CFURLResponseRef CFURLResponseCreateWithHTTPResponse(CFAllocatorRef alloc, CFURLRef URL, CFHTTPMessageRef httpResponse, CFURLCacheStoragePolicy recommendedPolicy);
-void CFURLResponseSetExpectedContentLength(CFURLResponseRef response, SInt64 length);
-void CFURLResponseSetMIMEType(CFURLResponseRef response, CFStringRef mimeType);
-
-}
-
-CFURLResponseRef createCFURLResponseFromResponseData(CFDataRef responseData)
-{
- // Decode NSURLResponse
- RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)responseData]);
- NSURLResponse *response = [unarchiver.get() decodeObjectForKey:@"WebResourceResponse"]; // WebResourceResponseKey in WebResource.m
- [unarchiver.get() finishDecoding];
-
- if (![response isKindOfClass:[NSHTTPURLResponse class]])
- return CFURLResponseCreate(kCFAllocatorDefault, (CFURLRef)[response URL], (CFStringRef)[response MIMEType], [response expectedContentLength], (CFStringRef)[response textEncodingName], kCFURLCacheStorageAllowed);
-
- NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
-
- // NSURLResponse is not toll-free bridged to CFURLResponse.
- RetainPtr<CFHTTPMessageRef> httpMessage = adoptCF(CFHTTPMessageCreateResponse(kCFAllocatorDefault, [httpResponse statusCode], 0, kCFHTTPVersion1_1));
-
- NSDictionary *headerFields = [httpResponse allHeaderFields];
- for (NSString *headerField in [headerFields keyEnumerator])
- CFHTTPMessageSetHeaderFieldValue(httpMessage.get(), (CFStringRef)headerField, (CFStringRef)[headerFields objectForKey:headerField]);
-
- return CFURLResponseCreateWithHTTPResponse(kCFAllocatorDefault, (CFURLRef)[response URL], httpMessage.get(), kCFURLCacheStorageAllowed);
-}
-
-CFArrayRef supportedNonImageMIMETypes()
-{
- return (CFArrayRef)[WebHTMLRepresentation supportedNonImageMIMETypes];
-}
Modified: trunk/Tools/WebKitTestRunner/Configurations/Base.xcconfig (210466 => 210467)
--- trunk/Tools/WebKitTestRunner/Configurations/Base.xcconfig 2017-01-07 02:59:12 UTC (rev 210466)
+++ trunk/Tools/WebKitTestRunner/Configurations/Base.xcconfig 2017-01-07 03:49:04 UTC (rev 210467)
@@ -33,7 +33,7 @@
CLANG_WARN_CXX0X_EXTENSIONS = NO;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
-HEADER_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR)/usr/local/include $(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders $(SRCROOT)/../../Source/_javascript_Core/icu $(NEXT_ROOT)/usr/local/include/WebCoreTestSupport;
+HEADER_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR)/usr/local/include $(BUILT_PRODUCTS_DIR)/WebCoreTestSupport $(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders $(SRCROOT)/../../Source/_javascript_Core/icu $(NEXT_ROOT)/usr/local/include/WebCoreTestSupport;
GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) ENABLE_DASHBOARD_SUPPORT;
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym;
PREBINDING = NO
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (210466 => 210467)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp 2017-01-07 02:59:12 UTC (rev 210466)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp 2017-01-07 03:49:04 UTC (rev 210467)
@@ -846,7 +846,7 @@
#if USE(CF)
WKRetainPtr<WKDataRef> wkData = adoptWK(WKBundleFrameCopyWebArchive(frame));
RetainPtr<CFDataRef> cfData = adoptCF(CFDataCreate(0, WKDataGetBytes(wkData.get()), WKDataGetSize(wkData.get())));
- RetainPtr<CFStringRef> cfString = adoptCF(createXMLStringFromWebArchiveData(cfData.get()));
+ RetainPtr<CFStringRef> cfString = adoptCF(WebCoreTestSupport::createXMLStringFromWebArchiveData(cfData.get()));
stringBuilder.append(cfString.get());
#endif
}
Deleted: trunk/Tools/WebKitTestRunner/InjectedBundle/cocoa/WebArchiveDumpSupportCocoa.mm (210466 => 210467)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/cocoa/WebArchiveDumpSupportCocoa.mm 2017-01-07 02:59:12 UTC (rev 210466)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/cocoa/WebArchiveDumpSupportCocoa.mm 2017-01-07 03:49:04 UTC (rev 210467)
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "WebArchiveDumpSupport.h"
-
-#import <CFNetwork/CFHTTPMessage.h>
-#import <Foundation/Foundation.h>
-#import <WebKit/WebHTMLRepresentation.h>
-#import <wtf/RetainPtr.h>
-
-extern "C" {
-
-enum CFURLCacheStoragePolicy {
- kCFURLCacheStorageAllowed = 0,
- kCFURLCacheStorageAllowedInMemoryOnly = 1,
- kCFURLCacheStorageNotAllowed = 2
-};
-typedef enum CFURLCacheStoragePolicy CFURLCacheStoragePolicy;
-
-extern const CFStringRef kCFHTTPVersion1_1;
-
-CFURLResponseRef CFURLResponseCreate(CFAllocatorRef, CFURLRef, CFStringRef mimeType, SInt64 expectedContentLength, CFStringRef textEncodingName, CFURLCacheStoragePolicy recommendedPolicy);
-CFURLResponseRef CFURLResponseCreateWithHTTPResponse(CFAllocatorRef, CFURLRef, CFHTTPMessageRef httpResponse, CFURLCacheStoragePolicy recommendedPolicy);
-void CFURLResponseSetExpectedContentLength(CFURLResponseRef, SInt64 length);
-void CFURLResponseSetMIMEType(CFURLResponseRef, CFStringRef mimeType);
-
-}
-
-CFURLResponseRef createCFURLResponseFromResponseData(CFDataRef responseData)
-{
- RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)responseData]);
- NSURLResponse *response = [unarchiver decodeObjectForKey:@"WebResourceResponse"]; // WebResourceResponseKey in WebResource.m
- [unarchiver finishDecoding];
-
- if (![response isKindOfClass:[NSHTTPURLResponse class]])
- return CFURLResponseCreate(kCFAllocatorDefault, (CFURLRef)response.URL, (CFStringRef)response.MIMEType, response.expectedContentLength, (CFStringRef)response.textEncodingName, kCFURLCacheStorageAllowed);
-
- NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
-
- // NSURLResponse is not toll-free bridged to CFURLResponse.
- RetainPtr<CFHTTPMessageRef> httpMessage = adoptCF(CFHTTPMessageCreateResponse(kCFAllocatorDefault, httpResponse.statusCode, nullptr, kCFHTTPVersion1_1));
-
- NSDictionary *headerFields = httpResponse.allHeaderFields;
- for (NSString *headerField in [headerFields keyEnumerator])
- CFHTTPMessageSetHeaderFieldValue(httpMessage.get(), (CFStringRef)headerField, (CFStringRef)[headerFields objectForKey:headerField]);
-
- return CFURLResponseCreateWithHTTPResponse(kCFAllocatorDefault, (CFURLRef)response.URL, httpMessage.get(), kCFURLCacheStorageAllowed);
-}
-
-CFArrayRef supportedNonImageMIMETypes()
-{
- return (CFArrayRef)[WebHTMLRepresentation supportedNonImageMIMETypes];
-}
Modified: trunk/Tools/WebKitTestRunner/PlatformMac.cmake (210466 => 210467)
--- trunk/Tools/WebKitTestRunner/PlatformMac.cmake 2017-01-07 02:59:12 UTC (rev 210466)
+++ trunk/Tools/WebKitTestRunner/PlatformMac.cmake 2017-01-07 03:49:04 UTC (rev 210467)
@@ -33,11 +33,9 @@
list(APPEND WebKitTestRunnerInjectedBundle_SOURCES
${WEBKIT_TESTRUNNER_DIR}/cocoa/CrashReporterInfo.mm
- ${WEBKIT_TESTRUNNER_DIR}/cf/WebArchiveDumpSupport.cpp
${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/cocoa/ActivateFontsCocoa.mm
${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/cocoa/InjectedBundlePageCocoa.mm
- ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/cocoa/WebArchiveDumpSupportCocoa.mm
${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/mac/AccessibilityControllerMac.mm
${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/mac/AccessibilityNotificationHandler.mm
Modified: trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj (210466 => 210467)
--- trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj 2017-01-07 02:59:12 UTC (rev 210466)
+++ trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj 2017-01-07 03:49:04 UTC (rev 210467)
@@ -78,8 +78,6 @@
5641E2D014335E95008307E5 /* JSTextInputController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5641E2CE14335E95008307E5 /* JSTextInputController.cpp */; };
5664A49A14326384008881BE /* TextInputController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5664A49814326384008881BE /* TextInputController.cpp */; };
5670B8281386FCA5002EB355 /* EventSenderProxy.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5670B8271386FCA5002EB355 /* EventSenderProxy.mm */; };
- 5C45C30F17398E290079714E /* WebArchiveDumpSupportCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C45C30E17398E290079714E /* WebArchiveDumpSupportCocoa.mm */; };
- 5C45C31317398E480079714E /* WebArchiveDumpSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C45C31117398E480079714E /* WebArchiveDumpSupport.cpp */; };
6510A78211EC643800410867 /* AHEM____.TTF in Resources */ = {isa = PBXBuildFile; fileRef = 6510A77711EC643800410867 /* AHEM____.TTF */; };
6510A78411EC643800410867 /* WebKitWeightWatcher100.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6510A77911EC643800410867 /* WebKitWeightWatcher100.ttf */; };
6510A78511EC643800410867 /* WebKitWeightWatcher200.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6510A77A11EC643800410867 /* WebKitWeightWatcher200.ttf */; };
@@ -272,9 +270,6 @@
5670B8271386FCA5002EB355 /* EventSenderProxy.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EventSenderProxy.mm; sourceTree = "<group>"; };
583913D014335E95008307E5 /* JSAccessibilityController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAccessibilityController.cpp; sourceTree = "<group>"; };
583913D114335E95008307E5 /* JSAccessibilityController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAccessibilityController.h; sourceTree = "<group>"; };
- 5C45C30E17398E290079714E /* WebArchiveDumpSupportCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebArchiveDumpSupportCocoa.mm; sourceTree = "<group>"; };
- 5C45C31117398E480079714E /* WebArchiveDumpSupport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebArchiveDumpSupport.cpp; path = cf/WebArchiveDumpSupport.cpp; sourceTree = SOURCE_ROOT; };
- 5C45C31217398E480079714E /* WebArchiveDumpSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebArchiveDumpSupport.h; path = cf/WebArchiveDumpSupport.h; sourceTree = SOURCE_ROOT; };
6510A77711EC643800410867 /* AHEM____.TTF */ = {isa = PBXFileReference; lastKnownFileType = file; name = "AHEM____.TTF"; path = "fonts/AHEM____.TTF"; sourceTree = "<group>"; };
6510A77911EC643800410867 /* WebKitWeightWatcher100.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher100.ttf; path = fonts/WebKitWeightWatcher100.ttf; sourceTree = "<group>"; };
6510A77A11EC643800410867 /* WebKitWeightWatcher200.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher200.ttf; path = fonts/WebKitWeightWatcher200.ttf; sourceTree = "<group>"; };
@@ -506,7 +501,6 @@
children = (
65EB859F11EC67CC0034D300 /* ActivateFontsCocoa.mm */,
0FEB909E1905A776000FDBF3 /* InjectedBundlePageCocoa.mm */,
- 5C45C30E17398E290079714E /* WebArchiveDumpSupportCocoa.mm */,
);
path = cocoa;
sourceTree = "<group>";
@@ -598,15 +592,6 @@
path = ios;
sourceTree = "<group>";
};
- 5C45C31017398E370079714E /* cf */ = {
- isa = PBXGroup;
- children = (
- 5C45C31117398E480079714E /* WebArchiveDumpSupport.cpp */,
- 5C45C31217398E480079714E /* WebArchiveDumpSupport.h */,
- );
- name = cf;
- sourceTree = "<group>";
- };
65EB859E11EC67CC0034D300 /* mac */ = {
isa = PBXGroup;
children = (
@@ -640,7 +625,6 @@
isa = PBXGroup;
children = (
BC952C0A11F3B939003398B4 /* Bindings */,
- 5C45C31017398E370079714E /* cf */,
0FEB909D1905A75D000FDBF3 /* cocoa */,
BC14E4E0120E02F900826C0C /* Controllers */,
BC952D3A11F3BF1F003398B4 /* Derived Sources */,
@@ -1036,8 +1020,6 @@
2E63EDA61891BDC0002A7AFC /* TestRunner.cpp in Sources */,
C0CE720B1247C93300BC0EC4 /* TestRunnerMac.mm in Sources */,
5664A49A14326384008881BE /* TextInputController.cpp in Sources */,
- 5C45C31317398E480079714E /* WebArchiveDumpSupport.cpp in Sources */,
- 5C45C30F17398E290079714E /* WebArchiveDumpSupportCocoa.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};