Title: [172749] trunk/Source
Revision
172749
Author
m...@apple.com
Date
2014-08-19 01:37:09 -0700 (Tue, 19 Aug 2014)

Log Message

Use NSURLFileTypeMappings directly instead of depending on WebKitSystemInterface wrappers for it
https://bugs.webkit.org/show_bug.cgi?id=136035

Reviewed by Dan Bernstein.

Source/WebCore:

* WebCore.exp.in: Remove reference to no longer existent sumbols.
* WebCore.order: ditto
* WebCore.xcodeproj/project.pbxproj: Install new NSURLFileTyeMappings.h header.
* platform/ios/MIMETypeRegistryIOS.mm:
(WebCore::MIMETypeRegistry::getMIMETypeForExtension): Use NSURLFileTypeMappings
directly instead of via WKSI wrapper.
* platform/mac/MIMETypeRegistryMac.mm:
(WebCore::MIMETypeRegistry::getMIMETypeForExtension): ditto
(WebCore::MIMETypeRegistry::getExtensionsForMIMEType): ditto
(WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType): ditto
* platform/mac/WebCoreSystemInterface.h: Remove references to the no-longer-used
WKGetExtensionsForMIMEType, WKGetPreferredExtensionForMIMEType, or WKGetMIMETypeForExtension
* platform/mac/WebCoreSystemInterface.mm: ditto
* platform/spi: Added. This is where headers to declare SPI go.
* platform/spi/cocoa: Added. See above.
* platform/spi/cocoa/NSURLFileTypeMappingsSPI.h: Added. Header to declare
the internal class NSURLFileTypeMappings and some of its methods.

Source/WebKit/mac:

* Misc/WebNSViewExtras.m:
(-[NSView _web_DragImageForElement:rect:event:pasteboard:source:offset:]): Remove comment
reference to obsolete WKSI function.
* WebCoreSupport/WebSystemInterface.mm:
(InitWebCoreSystemInterface): Don't initialize the no-longer-used WKGetExtensionsForMIMEType,
WKGetPreferredExtensionForMIMEType, or WKGetMIMETypeForExtension
* Plugins/WebPluginDatabase.mm:
(-[WebPluginDatabase pluginForExtension:]): Include SPI header from WebCore; use
NSURLFileTypeMappings directly instead of via WKSI wrapper.
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::objectContentType): ditto
* WebView/WebHTMLView.mm:
(-[WebHTMLView _imageExistsAtPaths:]): ditto
* WebView/WebView.mm:
(+[WebView _supportedFileExtensions]): ditto
(+[WebView suggestedFileExtensionForMIMEType:]): ditto
(+[WebView _MIMETypeForFile:]): ditto

Source/WebKit2:

* WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
(InitWebCoreSystemInterface): Don't initialize the no-longer-used WKGetExtensionsForMIMEType,
WKGetPreferredExtensionForMIMEType, or WKGetMIMETypeForExtension
* mac/WebKit2.order: Remove exports related to above.

Source/WTF:

* wtf/Platform.h: Define USE(APPLE_INTERNAL_SDK) by default on platforms that have it.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (172748 => 172749)


--- trunk/Source/WTF/ChangeLog	2014-08-19 08:09:10 UTC (rev 172748)
+++ trunk/Source/WTF/ChangeLog	2014-08-19 08:37:09 UTC (rev 172749)
@@ -1,3 +1,12 @@
+2014-08-18  Maciej Stachowiak  <m...@apple.com>
+
+        Use NSURLFileTypeMappings directly instead of depending on WebKitSystemInterface wrappers for it
+        https://bugs.webkit.org/show_bug.cgi?id=136035
+
+        Reviewed by Dan Bernstein.
+
+        * wtf/Platform.h: Define USE(APPLE_INTERNAL_SDK) by default on platforms that have it.
+
 2014-08-18  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r172736.

Modified: trunk/Source/WTF/wtf/Platform.h (172748 => 172749)


--- trunk/Source/WTF/wtf/Platform.h	2014-08-19 08:09:10 UTC (rev 172748)
+++ trunk/Source/WTF/wtf/Platform.h	2014-08-19 08:37:09 UTC (rev 172749)
@@ -1043,6 +1043,12 @@
 #define WTF_USE_ASYNC_NSTEXTINPUTCLIENT 1
 #endif
 
+#if PLATFORM(COCOA)
+#if defined __has_include && __has_include(<CoreFoundation/CFPriv.h>)
+#define WTF_USE_APPLE_INTERNAL_SDK 1
+#endif
+#endif
+
 #if (OS(DARWIN) && USE(CG)) || USE(FREETYPE) || (PLATFORM(WIN) && (USE(CG) || USE(CAIRO)))
 #undef ENABLE_OPENTYPE_MATH
 #define ENABLE_OPENTYPE_MATH 1

Modified: trunk/Source/WebCore/ChangeLog (172748 => 172749)


--- trunk/Source/WebCore/ChangeLog	2014-08-19 08:09:10 UTC (rev 172748)
+++ trunk/Source/WebCore/ChangeLog	2014-08-19 08:37:09 UTC (rev 172749)
@@ -1,3 +1,28 @@
+2014-08-18  Maciej Stachowiak  <m...@apple.com>
+
+        Use NSURLFileTypeMappings directly instead of depending on WebKitSystemInterface wrappers for it
+        https://bugs.webkit.org/show_bug.cgi?id=136035
+
+        Reviewed by Dan Bernstein.
+
+        * WebCore.exp.in: Remove reference to no longer existent sumbols.
+        * WebCore.order: ditto
+        * WebCore.xcodeproj/project.pbxproj: Install new NSURLFileTyeMappings.h header.
+        * platform/ios/MIMETypeRegistryIOS.mm:
+        (WebCore::MIMETypeRegistry::getMIMETypeForExtension): Use NSURLFileTypeMappings
+        directly instead of via WKSI wrapper.
+        * platform/mac/MIMETypeRegistryMac.mm:
+        (WebCore::MIMETypeRegistry::getMIMETypeForExtension): ditto
+        (WebCore::MIMETypeRegistry::getExtensionsForMIMEType): ditto
+        (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType): ditto
+        * platform/mac/WebCoreSystemInterface.h: Remove references to the no-longer-used
+        WKGetExtensionsForMIMEType, WKGetPreferredExtensionForMIMEType, or WKGetMIMETypeForExtension
+        * platform/mac/WebCoreSystemInterface.mm: ditto
+        * platform/spi: Added. This is where headers to declare SPI go.
+        * platform/spi/cocoa: Added. See above.
+        * platform/spi/cocoa/NSURLFileTypeMappingsSPI.h: Added. Header to declare
+        the internal class NSURLFileTypeMappings and some of its methods.
+
 2014-08-18  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r172736.

Modified: trunk/Source/WebCore/WebCore.exp.in (172748 => 172749)


--- trunk/Source/WebCore/WebCore.exp.in	2014-08-19 08:09:10 UTC (rev 172748)
+++ trunk/Source/WebCore/WebCore.exp.in	2014-08-19 08:37:09 UTC (rev 172749)
@@ -2106,7 +2106,6 @@
 _wkGetCFURLResponseURL
 _wkGetHTTPCookieAcceptPolicy
 _wkGetHTTPRequestPriority
-_wkGetMIMETypeForExtension
 _wkGetNSURLResponseLastModifiedDate
 _wkGetUserToBaseCTM
 _wkGetWebDefaultCFStringEncoding

Modified: trunk/Source/WebCore/WebCore.order (172748 => 172749)


--- trunk/Source/WebCore/WebCore.order	2014-08-19 08:09:10 UTC (rev 172748)
+++ trunk/Source/WebCore/WebCore.order	2014-08-19 08:37:09 UTC (rev 172749)
@@ -30609,7 +30609,6 @@
 _wkGetPreferredExtensionForMIMEType
 _wkSignedPublicKeyAndChallengeString
 _wkGetExtensionsForMIMEType
-_wkGetMIMETypeForExtension
 _wkGetNSURLResponseLastModifiedDate
 _wkGetWheelEventDeltas
 _wkGetNSEventKeyChar

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (172748 => 172749)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-08-19 08:09:10 UTC (rev 172748)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-08-19 08:37:09 UTC (rev 172749)
@@ -2177,6 +2177,7 @@
 		6571DCC81385E6A400702DD0 /* MemoryPressureHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 657EDA071385CB97004E0645 /* MemoryPressureHandler.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		657EDA081385CB97004E0645 /* MemoryPressureHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 657EDA061385CB97004E0645 /* MemoryPressureHandler.cpp */; };
 		658436860AE01B7400E53753 /* FrameLoadRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 658436850AE01B7400E53753 /* FrameLoadRequest.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		658F540319A1C9240088FC92 /* NSURLFileTypeMappingsSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 653EF83819A043AE0052202C /* NSURLFileTypeMappingsSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6593923709AE4346002C531F /* URL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6593923509AE4346002C531F /* URL.cpp */; };
 		6593923809AE4346002C531F /* URL.h in Headers */ = {isa = PBXBuildFile; fileRef = 6593923609AE4346002C531F /* URL.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6593923A09AE435C002C531F /* URLMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6593923909AE435C002C531F /* URLMac.mm */; };
@@ -9271,6 +9272,7 @@
 		6515EC8F0D9723FF0063D49A /* JSSVGAltGlyphElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGAltGlyphElement.cpp; sourceTree = "<group>"; };
 		6515EC900D9723FF0063D49A /* JSSVGAltGlyphElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSVGAltGlyphElement.h; sourceTree = "<group>"; };
 		652FBBBB0DE27CB60001D386 /* JSDOMWindowCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMWindowCustom.h; sourceTree = "<group>"; };
+		653EF83819A043AE0052202C /* NSURLFileTypeMappingsSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSURLFileTypeMappingsSPI.h; sourceTree = "<group>"; };
 		6548E24809E1E04D00AF8020 /* Document.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = Document.idl; sourceTree = "<group>"; };
 		6550B693099DF0270090D781 /* CDATASection.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CDATASection.cpp; sourceTree = "<group>"; };
 		6550B694099DF0270090D781 /* CDATASection.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CDATASection.h; sourceTree = "<group>"; };
@@ -16216,6 +16218,22 @@
 			path = plugins;
 			sourceTree = "<group>";
 		};
+		653EF83619A043AE0052202C /* spi */ = {
+			isa = PBXGroup;
+			children = (
+				653EF83719A043AE0052202C /* cocoa */,
+			);
+			path = spi;
+			sourceTree = "<group>";
+		};
+		653EF83719A043AE0052202C /* cocoa */ = {
+			isa = PBXGroup;
+			children = (
+				653EF83819A043AE0052202C /* NSURLFileTypeMappingsSPI.h */,
+			);
+			path = cocoa;
+			sourceTree = "<group>";
+		};
 		656580EC09D12B20000E61D7 /* Derived Sources */ = {
 			isa = PBXGroup;
 			children = (
@@ -21294,6 +21312,7 @@
 				656B84D70AEA1CE900A095B4 /* network */,
 				516030090CC4245400C8AC25 /* posix */,
 				1A2E6E560CC551E0004A2062 /* sql */,
+				653EF83619A043AE0052202C /* spi */,
 				B2C3D9EC0D006C1D00EF6F26 /* text */,
 				49AE2D94134EE5F90072920A /* CalculationValue.cpp */,
 				49AE2D95134EE5F90072920A /* CalculationValue.h */,
@@ -25276,6 +25295,7 @@
 				F5973DE015CFB2030027F804 /* LocaleMac.h in Headers */,
 				7633A72613D8B33A008501B6 /* LocaleToScriptMapping.h in Headers */,
 				A516E8B7136E04DB0076C3C0 /* LocalizedDateCache.h in Headers */,
+				658F540319A1C9240088FC92 /* NSURLFileTypeMappingsSPI.h in Headers */,
 				935207BE09BD410A00F2038D /* LocalizedStrings.h in Headers */,
 				BCE1C41B0D982980003B02F2 /* Location.h in Headers */,
 				A8239E0109B3CF8A00B60641 /* Logging.h in Headers */,

Modified: trunk/Source/WebCore/platform/ios/MIMETypeRegistryIOS.mm (172748 => 172749)


--- trunk/Source/WebCore/platform/ios/MIMETypeRegistryIOS.mm	2014-08-19 08:09:10 UTC (rev 172748)
+++ trunk/Source/WebCore/platform/ios/MIMETypeRegistryIOS.mm	2014-08-19 08:37:09 UTC (rev 172749)
@@ -26,13 +26,13 @@
 #include "config.h"
 #include "MIMETypeRegistry.h"
 
-#include "WebCoreSystemInterface.h"
+#include "NSURLFileTypeMappingsSPI.h"
 
 namespace WebCore 
 {
-String MIMETypeRegistry::getMIMETypeForExtension(const String &ext)
+String MIMETypeRegistry::getMIMETypeForExtension(const String& extension)
 {
-    return wkGetMIMETypeForExtension(ext);
+    return [[NSURLFileTypeMappings sharedMappings] MIMETypeForExtension:(NSString *)extension];
 }
 
 Vector<String> MIMETypeRegistry::getExtensionsForMIMEType(const String& /*type*/)

Modified: trunk/Source/WebCore/platform/mac/MIMETypeRegistryMac.mm (172748 => 172749)


--- trunk/Source/WebCore/platform/mac/MIMETypeRegistryMac.mm	2014-08-19 08:09:10 UTC (rev 172748)
+++ trunk/Source/WebCore/platform/mac/MIMETypeRegistryMac.mm	2014-08-19 08:37:09 UTC (rev 172749)
@@ -27,22 +27,22 @@
 #include "config.h"
 #include "MIMETypeRegistry.h"
 
-#include "WebCoreSystemInterface.h"
+#include "NSURLFileTypeMappingsSPI.h"
 #include <wtf/Assertions.h>
 #include <wtf/MainThread.h>
 
 namespace WebCore 
 {
 
-String MIMETypeRegistry::getMIMETypeForExtension(const String &ext)
+String MIMETypeRegistry::getMIMETypeForExtension(const String& extension)
 {
     ASSERT(isMainThread());
-    return wkGetMIMETypeForExtension(ext);
+    return [[NSURLFileTypeMappings sharedMappings] MIMETypeForExtension:(NSString *)extension];
 }
 
 Vector<String> MIMETypeRegistry::getExtensionsForMIMEType(const String& type)
 {
-    NSArray *stringsArray = wkGetExtensionsForMIMEType(type);
+    NSArray *stringsArray = [[NSURLFileTypeMappings sharedMappings] extensionsForMIMEType:(NSString *)type];
     Vector<String> stringsVector = Vector<String>();
     unsigned count = [stringsArray count];
     if (count > 0) {
@@ -56,7 +56,7 @@
 
 String MIMETypeRegistry::getPreferredExtensionForMIMEType(const String& type)
 {
-    return wkGetPreferredExtensionForMIMEType(type);
+    return [[NSURLFileTypeMappings sharedMappings] preferredExtensionForMIMEType:(NSString *)type];
 }
 
 bool MIMETypeRegistry::isApplicationPluginMIMEType(const String& MIMEType)

Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h (172748 => 172749)


--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h	2014-08-19 08:09:10 UTC (rev 172748)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h	2014-08-19 08:37:09 UTC (rev 172749)
@@ -171,10 +171,7 @@
     float duration, unsigned state);
 extern void (*wkDrawMediaUIPart)(int part, CGContextRef context, CGRect rect, unsigned state);
 extern CFStringRef (*wkSignedPublicKeyAndChallengeString)(unsigned keySize, CFStringRef challenge, CFStringRef keyDescription);
-extern NSString* (*wkGetPreferredExtensionForMIMEType)(NSString*);
-extern NSArray* (*wkGetExtensionsForMIMEType)(NSString*);
 #endif
-extern NSString* (*wkGetMIMETypeForExtension)(NSString*);
 #if !PLATFORM(IOS)
 extern ATSUFontID (*wkGetNSFontATSUFontId)(NSFont*);
 extern double (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response);

Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm (172748 => 172749)


--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm	2014-08-19 08:09:10 UTC (rev 172748)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm	2014-08-19 08:37:09 UTC (rev 172749)
@@ -63,7 +63,6 @@
 NSString* (*wkGetPreferredExtensionForMIMEType)(NSString*);
 CFStringRef (*wkSignedPublicKeyAndChallengeString)(unsigned keySize, CFStringRef challenge, CFStringRef keyDescription);
 NSArray* (*wkGetExtensionsForMIMEType)(NSString*);
-NSString* (*wkGetMIMETypeForExtension)(NSString*);
 NSTimeInterval (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response);
 NSDate *(*wkGetNSURLResponseLastModifiedDate)(NSURLResponse *response);
 BOOL (*wkGetNSURLResponseMustRevalidate)(NSURLResponse *response);

Added: trunk/Source/WebCore/platform/spi/cocoa/NSURLFileTypeMappingsSPI.h (0 => 172749)


--- trunk/Source/WebCore/platform/spi/cocoa/NSURLFileTypeMappingsSPI.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/spi/cocoa/NSURLFileTypeMappingsSPI.h	2014-08-19 08:37:09 UTC (rev 172749)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2014 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. ``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
+ * 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. 
+ */
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#import <Foundation/NSURLFileTypeMappings.h>
+
+#else
+
+// FIXME: We should use UTI instead, but it's missing some mappings that this old SPI knows.
+// Remove these methods once <rdar://problem/18042184> is fixed.
+@interface NSURLFileTypeMappings
+@end
+@interface NSURLFileTypeMappings (Private)
++ (NSURLFileTypeMappings *)sharedMappings;
+- (NSString *)MIMETypeForExtension:(NSString *)ext;
+- (NSString *)preferredExtensionForMIMEType:(NSString *)type;
+- (NSArray *)extensionsForMIMEType:(NSString *)type;
+@end
+
+#endif

Modified: trunk/Source/WebKit/mac/ChangeLog (172748 => 172749)


--- trunk/Source/WebKit/mac/ChangeLog	2014-08-19 08:09:10 UTC (rev 172748)
+++ trunk/Source/WebKit/mac/ChangeLog	2014-08-19 08:37:09 UTC (rev 172749)
@@ -1,3 +1,28 @@
+2014-08-18  Maciej Stachowiak  <m...@apple.com>
+
+        Use NSURLFileTypeMappings directly instead of depending on WebKitSystemInterface wrappers for it
+        https://bugs.webkit.org/show_bug.cgi?id=136035
+
+        Reviewed by Dan Bernstein.
+
+        * Misc/WebNSViewExtras.m:
+        (-[NSView _web_DragImageForElement:rect:event:pasteboard:source:offset:]): Remove comment
+        reference to obsolete WKSI function.
+        * WebCoreSupport/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface): Don't initialize the no-longer-used WKGetExtensionsForMIMEType,
+        WKGetPreferredExtensionForMIMEType, or WKGetMIMETypeForExtension
+        * Plugins/WebPluginDatabase.mm:
+        (-[WebPluginDatabase pluginForExtension:]): Include SPI header from WebCore; use
+        NSURLFileTypeMappings directly instead of via WKSI wrapper.
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+        (WebFrameLoaderClient::objectContentType): ditto
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView _imageExistsAtPaths:]): ditto
+        * WebView/WebView.mm:
+        (+[WebView _supportedFileExtensions]): ditto
+        (+[WebView suggestedFileExtensionForMIMEType:]): ditto
+        (+[WebView _MIMETypeForFile:]): ditto
+
 2014-08-18  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r172736.

Modified: trunk/Source/WebKit/mac/Misc/WebNSViewExtras.m (172748 => 172749)


--- trunk/Source/WebKit/mac/Misc/WebNSViewExtras.m	2014-08-19 08:09:10 UTC (rev 172748)
+++ trunk/Source/WebKit/mac/Misc/WebNSViewExtras.m	2014-08-19 08:37:09 UTC (rev 172749)
@@ -195,7 +195,7 @@
     } else {
         // FIXME: This has been broken for a while.
         // There's no way to get the MIME type for the image from a DOM element.
-        // The old code used WKGetPreferredExtensionForMIMEType([image MIMEType]);
+        // The old code used [image MIMEType];
         NSString *extension = @"";
         dragImage = [[NSWorkspace sharedWorkspace] iconForFileType:extension];
         NSSize offset = NSMakeSize([dragImage size].width - WebDragIconRightInset, -WebDragIconBottomInset);

Modified: trunk/Source/WebKit/mac/Plugins/WebPluginDatabase.mm (172748 => 172749)


--- trunk/Source/WebKit/mac/Plugins/WebPluginDatabase.mm	2014-08-19 08:09:10 UTC (rev 172748)
+++ trunk/Source/WebKit/mac/Plugins/WebPluginDatabase.mm	2014-08-19 08:37:09 UTC (rev 172749)
@@ -42,6 +42,7 @@
 #import "WebPluginPackage.h"
 #import "WebViewPrivate.h"
 #import "WebViewInternal.h"
+#import <WebCore/NSURLFileTypeMappingsSPI.h>
 #import <WebKitSystemInterface.h>
 #import <wtf/Assertions.h>
 
@@ -175,7 +176,7 @@
         // If no plug-in was found from the extension, attempt to map from the extension to a MIME type
         // and find the a plug-in from the MIME type. This is done in case the plug-in has not fully specified
         // an extension <-> MIME type mapping.
-        NSString *MIMEType = WKGetMIMETypeForExtension(extension);
+        NSString *MIMEType = [[NSURLFileTypeMappings sharedMappings] MIMETypeForExtension:extension];
         if ([MIMEType length] > 0)
             plugin = [self pluginForMIMEType:MIMEType];
     }

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm (172748 => 172749)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2014-08-19 08:09:10 UTC (rev 172748)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2014-08-19 08:37:09 UTC (rev 172749)
@@ -109,6 +109,7 @@
 #import <WebCore/MIMETypeRegistry.h>
 #import <WebCore/MainFrame.h>
 #import <WebCore/MouseEvent.h>
+#import <WebCore/NSURLFileTypeMappingsSPI.h>
 #import <WebCore/Page.h>
 #import <WebCore/PluginViewBase.h>
 #import <WebCore/ProtectionSpace.h>
@@ -1620,7 +1621,7 @@
         NSURL *URL = ""
         NSString *extension = [[URL path] pathExtension];
         if ([extension length] > 0) {
-            type = WKGetMIMETypeForExtension(extension);
+            type = [[NSURLFileTypeMappings sharedMappings] MIMETypeForExtension:extension];
             if (type.isEmpty()) {
                 // If no MIME type is specified, use a plug-in if we have one that can handle the extension.
                 if (WebBasePluginPackage *package = [getWebView(m_webFrame.get()) _pluginForExtension:extension]) {

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm (172748 => 172749)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm	2014-08-19 08:09:10 UTC (rev 172748)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm	2014-08-19 08:37:09 UTC (rev 172749)
@@ -72,18 +72,15 @@
     INIT(DrawMediaUIPart);
     INIT(DrawMediaSliderTrack);
     INIT(DrawTextFieldCellFocusRing);
-    INIT(GetExtensionsForMIMEType);
     INIT(GetFontInLanguageForCharacter);
     INIT(GetFontInLanguageForRange);
     INIT(GetGlyphTransformedAdvances);
 #endif
     INIT(GetHTTPRequestPriority);
-    INIT(GetMIMETypeForExtension);
     INIT(GetNSURLResponseLastModifiedDate);
     INIT(GetWebDefaultCFStringEncoding);
 #if !PLATFORM(IOS)
     INIT(SignedPublicKeyAndChallengeString);
-    INIT(GetPreferredExtensionForMIMEType);
     INIT(GetWheelEventDeltas);
     INIT(GetNSEventKeyChar);
     INIT(HitTestMediaUIPart);

Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (172748 => 172749)


--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm	2014-08-19 08:09:10 UTC (rev 172748)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm	2014-08-19 08:37:09 UTC (rev 172749)
@@ -102,6 +102,7 @@
 #import <WebCore/LegacyWebArchive.h>
 #import <WebCore/MIMETypeRegistry.h>
 #import <WebCore/MainFrame.h>
+#import <WebCore/NSURLFileTypeMappingsSPI.h>
 #import <WebCore/Page.h>
 #import <WebCore/Range.h>
 #import <WebCore/RenderView.h>
@@ -768,7 +769,7 @@
     NSString *path;
     
     while ((path = [enumerator nextObject]) != nil) {
-        NSString *MIMEType = WKGetMIMETypeForExtension([path pathExtension]);
+        NSString *MIMEType = [[NSURLFileTypeMappings sharedMappings] MIMETypeForExtension:[path pathExtension]];
         if (MIMETypeRegistry::isSupportedImageResourceMIMEType(MIMEType))
             return YES;
     }

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (172748 => 172749)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2014-08-19 08:09:10 UTC (rev 172748)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2014-08-19 08:37:09 UTC (rev 172749)
@@ -148,6 +148,7 @@
 #import <WebCore/MIMETypeRegistry.h>
 #import <WebCore/MainFrame.h>
 #import <WebCore/MemoryPressureHandler.h>
+#import <WebCore/NSURLFileTypeMappingsSPI.h>
 #import <WebCore/NodeList.h>
 #import <WebCore/Notification.h>
 #import <WebCore/NotificationController.h>
@@ -1098,7 +1099,7 @@
     NSEnumerator *enumerator = [MIMETypes objectEnumerator];
     NSString *MIMEType;
     while ((MIMEType = [enumerator nextObject]) != nil) {
-        NSArray *extensionsForType = WKGetExtensionsForMIMEType(MIMEType);
+        NSArray *extensionsForType = [[NSURLFileTypeMappings sharedMappings] extensionsForMIMEType:MIMEType];
         if (extensionsForType) {
             [extensions addObjectsFromArray:extensionsForType];
         }
@@ -1495,7 +1496,7 @@
 #if !PLATFORM(IOS)
 + (NSString *)suggestedFileExtensionForMIMEType:(NSString *)type
 {
-    return WKGetPreferredExtensionForMIMEType(type);
+    return [[NSURLFileTypeMappings sharedMappings] preferredExtensionForMIMEType:type];
 }
 #endif
 
@@ -1798,7 +1799,7 @@
 #if !PLATFORM(IOS)
     // Get the MIME type from the extension.
     if ([extension length] != 0) {
-        MIMEType = WKGetMIMETypeForExtension(extension);
+        MIMEType = [[NSURLFileTypeMappings sharedMappings] MIMETypeForExtension:extension];
     }
 #endif
 

Modified: trunk/Source/WebKit2/ChangeLog (172748 => 172749)


--- trunk/Source/WebKit2/ChangeLog	2014-08-19 08:09:10 UTC (rev 172748)
+++ trunk/Source/WebKit2/ChangeLog	2014-08-19 08:37:09 UTC (rev 172749)
@@ -1,3 +1,15 @@
+2014-08-18  Maciej Stachowiak  <m...@apple.com>
+
+        Use NSURLFileTypeMappings directly instead of depending on WebKitSystemInterface wrappers for it
+        https://bugs.webkit.org/show_bug.cgi?id=136035
+
+        Reviewed by Dan Bernstein.
+
+        * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface): Don't initialize the no-longer-used WKGetExtensionsForMIMEType,
+        WKGetPreferredExtensionForMIMEType, or WKGetMIMETypeForExtension
+        * mac/WebKit2.order: Remove exports related to above.
+
 2014-08-18  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r172736.

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm (172748 => 172749)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm	2014-08-19 08:09:10 UTC (rev 172748)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm	2014-08-19 08:37:09 UTC (rev 172749)
@@ -65,7 +65,6 @@
         INIT(DrawMediaSliderTrack);
         INIT(DrawMediaUIPart);
         INIT(DrawTextFieldCellFocusRing);
-        INIT(GetExtensionsForMIMEType);
         INIT(GetFontInLanguageForCharacter);
         INIT(GetFontInLanguageForRange);
         INIT(GetGlyphTransformedAdvances);
@@ -73,11 +72,9 @@
 #endif
         INIT(GetVerticalGlyphsForCharacters);
         INIT(GetHTTPRequestPriority);
-        INIT(GetMIMETypeForExtension);
         INIT(GetNSURLResponseLastModifiedDate);
 #if !PLATFORM(IOS)
         INIT(SignedPublicKeyAndChallengeString);
-        INIT(GetPreferredExtensionForMIMEType);
 #endif
         INIT(GetUserToBaseCTM);
         INIT(GetWebDefaultCFStringEncoding);

Modified: trunk/Source/WebKit2/mac/WebKit2.order (172748 => 172749)


--- trunk/Source/WebKit2/mac/WebKit2.order	2014-08-19 08:09:10 UTC (rev 172748)
+++ trunk/Source/WebKit2/mac/WebKit2.order	2014-08-19 08:37:09 UTC (rev 172749)
@@ -8668,7 +8668,6 @@
 _WKBundleGarbageCollectJavaScriptObjects
 __ZN6WebKit14InjectedBundle31garbageCollectJavaScriptObjectsEv
 __ZNK6WebKit15WebEditorClient10canCopyCutEPN7WebCore5FrameEb
-_WKGetExtensionsForMIMEType
 __ZN6WebKit15WebEditorClient25shouldShowDeleteInterfaceEPN7WebCore11HTMLElementE
 __ZNK6WebKit15WebEditorClient8canPasteEPN7WebCore5FrameEb
 __ZN6WebKit15WebEditorClient22setInsertionPasteboardERKN3WTF6StringE
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to