[iOS] NSFileManager and QuickLook SPI not available in public SDK
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Nov 2014 23:31:48 +0000 (23:31 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Nov 2014 23:31:48 +0000 (23:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=138742

Reviewed by Pratik Solanki.

Source/WebCore:

Add a SPI wrapper headers {NSFileManager, QuickLook}SPI.h that forward declares
NSFileManager and QuickLook SPI, respectively, and use these header instead of
including private headers of Foundation and QuickLook directly.

* WebCore.xcodeproj/project.pbxproj: Add project and private header QuickLookSPI.h
and NSFileManagerSPI.h, respectively.
* platform/network/ios/QuickLook.mm: Include headers QuickLookSPI.h and NSFileManagerSPI.h
instead of including headers of QuickLook and Foundation directly.
* platform/spi/cocoa/NSFileManagerSPI.h: Added.
* platform/spi/ios/QuickLookSPI.h: Added.

Source/WebKit/mac:

Include header NSFileManagerSPI.h instead of the private header NSFileManager_NSURLExtras.h.

* WebCoreSupport/WebFrameLoaderClient.mm:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@176142 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/network/ios/QuickLook.mm
Source/WebCore/platform/spi/cocoa/NSFileManagerSPI.h [new file with mode: 0644]
Source/WebCore/platform/spi/ios/QuickLookSPI.h [new file with mode: 0644]
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm

index 9060f34..2e57cf4 100644 (file)
@@ -1,5 +1,23 @@
 2014-11-14  Daniel Bates  <dabates@apple.com>
 
+        [iOS] NSFileManager and QuickLook SPI not available in public SDK
+        https://bugs.webkit.org/show_bug.cgi?id=138742
+
+        Reviewed by Pratik Solanki.
+
+        Add a SPI wrapper headers {NSFileManager, QuickLook}SPI.h that forward declares
+        NSFileManager and QuickLook SPI, respectively, and use these header instead of
+        including private headers of Foundation and QuickLook directly.
+
+        * WebCore.xcodeproj/project.pbxproj: Add project and private header QuickLookSPI.h
+        and NSFileManagerSPI.h, respectively.
+        * platform/network/ios/QuickLook.mm: Include headers QuickLookSPI.h and NSFileManagerSPI.h
+        instead of including headers of QuickLook and Foundation directly. 
+        * platform/spi/cocoa/NSFileManagerSPI.h: Added.
+        * platform/spi/ios/QuickLookSPI.h: Added.
+
+2014-11-14  Daniel Bates  <dabates@apple.com>
+
         [iOS] CoreGraphics SPI not available in public SDK
         https://bugs.webkit.org/show_bug.cgi?id=138709
 
index 6de024e..554d0c6 100644 (file)
                CE08C3D1152B599A0021B8C2 /* AlternativeTextController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE08C3CF152B599A0021B8C2 /* AlternativeTextController.cpp */; };
                CE08C3D2152B599A0021B8C2 /* AlternativeTextController.h in Headers */ = {isa = PBXBuildFile; fileRef = CE08C3D0152B599A0021B8C2 /* AlternativeTextController.h */; settings = {ATTRIBUTES = (); }; };
                CE1252371A15BDBE00864480 /* CoreGraphicsSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = C24685131A148E1800811792 /* CoreGraphicsSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               CE1252391A166FA000864480 /* QuickLookSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE1252381A166FA000864480 /* QuickLookSPI.h */; };
+               CE12523B1A16711000864480 /* NSFileManagerSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE12523A1A16711000864480 /* NSFileManagerSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
                CE7B2DB31586ABAD0098B3FA /* AlternativeTextUIController.h in Headers */ = {isa = PBXBuildFile; fileRef = CE7B2DAF1586ABAD0098B3FA /* AlternativeTextUIController.h */; settings = {ATTRIBUTES = (Private, ); }; };
                CE7B2DB41586ABAD0098B3FA /* AlternativeTextUIController.mm in Sources */ = {isa = PBXBuildFile; fileRef = CE7B2DB01586ABAD0098B3FA /* AlternativeTextUIController.mm */; };
                CE7B2DB51586ABAD0098B3FA /* TextAlternativeWithRange.h in Headers */ = {isa = PBXBuildFile; fileRef = CE7B2DB11586ABAD0098B3FA /* TextAlternativeWithRange.h */; settings = {ATTRIBUTES = (Private, ); }; };
                CE057FA41220731100A476D5 /* DocumentMarkerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentMarkerController.h; sourceTree = "<group>"; };
                CE08C3CF152B599A0021B8C2 /* AlternativeTextController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AlternativeTextController.cpp; sourceTree = "<group>"; };
                CE08C3D0152B599A0021B8C2 /* AlternativeTextController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AlternativeTextController.h; sourceTree = "<group>"; };
+               CE1252381A166FA000864480 /* QuickLookSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QuickLookSPI.h; path = ios/QuickLookSPI.h; sourceTree = "<group>"; };
+               CE12523A1A16711000864480 /* NSFileManagerSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSFileManagerSPI.h; sourceTree = "<group>"; };
                CE5CB1B314EDAB6F00BB2795 /* EventSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventSender.h; sourceTree = "<group>"; };
                CE6D89294C7AACE0AD89B3DD /* MathMLMencloseElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLMencloseElement.h; sourceTree = "<group>"; };
                CE7B2DAF1586ABAD0098B3FA /* AlternativeTextUIController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AlternativeTextUIController.h; sourceTree = "<group>"; };
                                1C5E980F1A02CEFA002DB55F /* CoreTextSPI.h */,
                                2DDB97F319F9AECA002025D8 /* NSExtensionSPI.h */,
                                653EF83819A043AE0052202C /* NSURLFileTypeMappingsSPI.h */,
+                               CE12523A1A16711000864480 /* NSFileManagerSPI.h */,
                        );
                        path = cocoa;
                        sourceTree = "<group>";
                        isa = PBXGroup;
                        children = (
                                A172182519DE183F00464D17 /* _UIHighlightViewSPI.h */,
+                               CE1252381A166FA000864480 /* QuickLookSPI.h */,
                        );
                        name = ios;
                        sourceTree = "<group>";
                                1A569D110D7E2B82007C3983 /* npruntime_priv.h in Headers */,
                                1A927FD41416A15B003A83C8 /* nptypes.h in Headers */,
                                2DDB97F419F9AECA002025D8 /* NSExtensionSPI.h in Headers */,
+                               CE12523B1A16711000864480 /* NSFileManagerSPI.h in Headers */,
                                1C6466281A12C4200094603C /* NSFontSPI.h in Headers */,
                                93500F3213FDE3BE0099EC24 /* NSScrollerImpDetails.h in Headers */,
                                2DCB837919F99BBA00A7FBE4 /* NSSharingServicePickerSPI.h in Headers */,
                                10FB084B14E15C7E00A3DB98 /* PublicURLManager.h in Headers */,
                                550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */,
                                442AF7A9102CDDEA008FD4D3 /* QuickLook.h in Headers */,
+                               CE1252391A166FA000864480 /* QuickLookSPI.h in Headers */,
                                A10DBF4718F92317000D70C6 /* QuickLookHandleClient.h in Headers */,
                                4643783119F720EF001E38B3 /* QuickLookMac.h in Headers */,
                                072AE1E8183C0741000A5988 /* QuickTimePluginReplacement.h in Headers */,
index dc60401..21ac686 100644 (file)
@@ -31,6 +31,8 @@
 #import "DocumentLoader.h"
 #import "FileSystemIOS.h"
 #import "Logging.h"
+#import "NSFileManagerSPI.h"
+#import "QuickLookSPI.h"
 #import "ResourceError.h"
 #import "ResourceHandle.h"
 #import "ResourceLoader.h"
@@ -39,9 +41,6 @@
 #import "SynchronousResourceHandleCFURLConnectionDelegate.h"
 #import "WebCoreURLResponseIOS.h"
 #import <Foundation/Foundation.h>
-#import <Foundation/NSFileManager_NSURLExtras.h>
-#import <QuickLook/QLPreviewConverter.h>
-#import <QuickLook/QuickLookPrivate.h>
 #import <wtf/NeverDestroyed.h>
 #import <wtf/StdLibExtras.h>
 #import <wtf/Threading.h>
diff --git a/Source/WebCore/platform/spi/cocoa/NSFileManagerSPI.h b/Source/WebCore/platform/spi/cocoa/NSFileManagerSPI.h
new file mode 100644 (file)
index 0000000..d437672
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * 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. 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 <Foundation/NSFileManager.h>
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#import <Foundation/NSFileManager_NSURLExtras.h>
+
+#else
+
+#define WEB_UREAD (00400)
+#define WEB_UWRITE (00200)
+#define WEB_UEXEC (00100)
+
+@interface NSFileManager (Details)
+- (BOOL)_web_createFileAtPathWithIntermediateDirectories:(NSString *)path contents:(NSData *)contents attributes:(NSDictionary *)attributes directoryAttributes:(NSDictionary *)directoryAttributes;
+- (NSString *)_web_pathWithUniqueFilenameForPath:(NSString *)path;
+- (BOOL)_web_removeFileOnlyAtPath:(NSString *)path;
+@end
+
+#endif
diff --git a/Source/WebCore/platform/spi/ios/QuickLookSPI.h b/Source/WebCore/platform/spi/ios/QuickLookSPI.h
new file mode 100644 (file)
index 0000000..8be6b62
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * 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. 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 <Foundation/Foundation.h>
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#import <QuickLook/QuickLookPrivate.h>
+
+#else
+
+@interface QLPreviewConverter : NSObject
+@end
+
+@interface QLPreviewConverter (Details)
+- (NSURLRequest *)safeRequestForRequest:(NSURLRequest *)request;
+- (id)initWithConnection:(NSURLConnection *)connection delegate:(id)delegate response:(NSURLResponse *)response options:(NSDictionary *)options;
+- (id)initWithData:(NSData *)data name:(NSString *)name uti:(NSString *)uti options:(NSDictionary *)options;
+- (void)appendDataArray:(NSArray *)dataArray;
+- (void)finishConverting;
+- (void)finishedAppendingData;
+@property (readonly, nonatomic) NSString *previewFileName;
+@property (readonly, nonatomic) NSString *previewUTI;
+@property (readonly, nonatomic) NSURLRequest *previewRequest;
+@property (readonly, nonatomic) NSURLResponse *previewResponse;
+@end
+
+#endif
+
+EXTERN_C NSSet *QLPreviewGetSupportedMIMETypes();
+EXTERN_C NSString *QLTypeCopyBestMimeTypeForFileNameAndMimeType(NSString *fileName, NSString *mimeType);
+EXTERN_C NSString *QLTypeCopyBestMimeTypeForURLAndMimeType(NSURL *, NSString *mimeType);
+EXTERN_C NSString *QLTypeCopyUTIForURLAndMimeType(NSURL *, NSString *mimeType);
index e14a673..a91d303 100644 (file)
@@ -1,3 +1,14 @@
+2014-11-14  Daniel Bates  <dabates@apple.com>
+
+        [iOS] NSFileManager and QuickLook SPI not available in public SDK
+        https://bugs.webkit.org/show_bug.cgi?id=138742
+
+        Reviewed by Pratik Solanki.
+
+        Include header NSFileManagerSPI.h instead of the private header NSFileManager_NSURLExtras.h.
+
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+
 2014-11-14  Beth Dakin  <bdakin@apple.com>
 
         WK1: Webpage preview can come up in wrong location
index 893a550..0823d19 100644 (file)
 #endif
 
 #if USE(QUICK_LOOK)
-#import <Foundation/NSFileManager_NSURLExtras.h>
 #import <WebCore/FileSystemIOS.h>
+#import <WebCore/NSFileManagerSPI.h>
 #import <WebCore/QuickLook.h>
 #import <WebCore/RuntimeApplicationChecksIOS.h>
 #endif