Diff
Modified: trunk/Source/WebCore/ChangeLog (239757 => 239758)
--- trunk/Source/WebCore/ChangeLog 2019-01-09 01:11:08 UTC (rev 239757)
+++ trunk/Source/WebCore/ChangeLog 2019-01-09 01:17:41 UTC (rev 239758)
@@ -1,3 +1,28 @@
+2019-01-08 Dean Jackson <d...@apple.com>
+
+ Blob references for System Previews don't get a correct file extension
+ https://bugs.webkit.org/show_bug.cgi?id=193268
+ <rdar://problem/47133037>
+
+ Reviewed by Tim Horton.
+
+ Apple platforms don't yet have a mapping from the USD MIME type to
+ file extensions (and we support some non-standard MIME types), which
+ means that downloads from Blob references don't get correctly named.
+
+ Fix this by adding an explicit mapping between System Preview types
+ and ".usdz".
+
+ WebKit API test: _WKDownload.SystemPreviewUSDZBlobNaming
+
+ * platform/MIMETypeRegistry.cpp:
+ (WebCore::MIMETypeRegistry::isSystemPreviewMIMEType): Remove USE(SYSTEM_PREVIEW) since
+ this applies to macOS and iOS now.
+ * platform/MIMETypeRegistry.h:
+ * platform/cocoa/MIMETypeRegistryCocoa.mm:
+ (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType): Add a mapping
+ for USDZ.
+
2019-01-08 Tim Horton <timothy_hor...@apple.com>
Editable images sometimes don't become focused when tapped
Modified: trunk/Source/WebCore/platform/MIMETypeRegistry.cpp (239757 => 239758)
--- trunk/Source/WebCore/platform/MIMETypeRegistry.cpp 2019-01-09 01:11:08 UTC (rev 239757)
+++ trunk/Source/WebCore/platform/MIMETypeRegistry.cpp 2019-01-09 01:17:41 UTC (rev 239758)
@@ -651,7 +651,6 @@
return defaultMIMEType;
}
-#if USE(SYSTEM_PREVIEW)
const HashSet<String, ASCIICaseInsensitiveHash>& MIMETypeRegistry::systemPreviewMIMETypes()
{
static NeverDestroyed<HashSet<String, ASCIICaseInsensitiveHash>> systemPreviewMIMETypes = std::initializer_list<String> {
@@ -670,7 +669,6 @@
return false;
return systemPreviewMIMETypes().contains(mimeType);
}
-#endif
#if !USE(CURL)
Modified: trunk/Source/WebCore/platform/MIMETypeRegistry.h (239757 => 239758)
--- trunk/Source/WebCore/platform/MIMETypeRegistry.h 2019-01-09 01:11:08 UTC (rev 239757)
+++ trunk/Source/WebCore/platform/MIMETypeRegistry.h 2019-01-09 01:17:41 UTC (rev 239758)
@@ -87,9 +87,7 @@
static bool isPostScriptMIMEType(const String& mimeType);
WEBCORE_EXPORT static bool isPDFOrPostScriptMIMEType(const String& mimeType);
-#if USE(SYSTEM_PREVIEW)
WEBCORE_EXPORT static bool isSystemPreviewMIMEType(const String& mimeType);
-#endif
// Check to see if a MIME type is suitable for being shown inside a page.
// Returns true if any of isSupportedImageMIMEType(), isSupportedNonImageMIMEType(),
@@ -114,11 +112,8 @@
WEBCORE_EXPORT static const HashSet<String, ASCIICaseInsensitiveHash>& supportedMediaMIMETypes();
WEBCORE_EXPORT static const HashSet<String, ASCIICaseInsensitiveHash>& pdfMIMETypes();
WEBCORE_EXPORT static const HashSet<String, ASCIICaseInsensitiveHash>& unsupportedTextMIMETypes();
+ WEBCORE_EXPORT static const HashSet<String, ASCIICaseInsensitiveHash>& systemPreviewMIMETypes();
-#if USE(SYSTEM_PREVIEW)
- WEBCORE_EXPORT const static HashSet<String, ASCIICaseInsensitiveHash>& systemPreviewMIMETypes();
-#endif
-
// FIXME: WebKit coding style says we should not have the word "get" in the name of this function.
// FIXME: Unclear what the concept of a normalized MIME type is; currently it's a platform-specific notion.
static String getNormalizedMIMEType(const String&);
Modified: trunk/Source/WebCore/platform/cocoa/MIMETypeRegistryCocoa.mm (239757 => 239758)
--- trunk/Source/WebCore/platform/cocoa/MIMETypeRegistryCocoa.mm 2019-01-09 01:11:08 UTC (rev 239757)
+++ trunk/Source/WebCore/platform/cocoa/MIMETypeRegistryCocoa.mm 2019-01-09 01:17:41 UTC (rev 239758)
@@ -52,6 +52,11 @@
String MIMETypeRegistry::getPreferredExtensionForMIMEType(const String& type)
{
+ // System Previews accept some non-standard MIMETypes, so we can't rely on
+ // the file type mappings.
+ if (isSystemPreviewMIMEType(type))
+ return "usdz"_s;
+
return [[NSURLFileTypeMappings sharedMappings] preferredExtensionForMIMEType:(NSString *)type];
}
Modified: trunk/Tools/ChangeLog (239757 => 239758)
--- trunk/Tools/ChangeLog 2019-01-09 01:11:08 UTC (rev 239757)
+++ trunk/Tools/ChangeLog 2019-01-09 01:17:41 UTC (rev 239758)
@@ -1,3 +1,20 @@
+2019-01-08 Dean Jackson <d...@apple.com>
+
+ Blob references for System Previews don't get a correct file extension
+ https://bugs.webkit.org/show_bug.cgi?id=193268
+ <rdar://problem/47133037>
+
+ Reviewed by Tim Horton.
+
+ New test that a Blob download of a USDZ file gets named correctly.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKitCocoa/Download.mm:
+ (-[BlobWithUSDZExtensionDownloadDelegate _download:decideDestinationWithSuggestedFilename:completionHandler:]):
+ (-[BlobWithUSDZExtensionDownloadDelegate _downloadDidFinish:]):
+ (TEST):
+ * TestWebKitAPI/Tests/WebKitCocoa/SystemPreviewBlobNaming.html: Added.
+
2019-01-08 Jiewen Tan <jiewen_...@apple.com>
[WebAuthN] Support U2F HID Authenticators on macOS
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (239757 => 239758)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2019-01-09 01:11:08 UTC (rev 239757)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2019-01-09 01:17:41 UTC (rev 239758)
@@ -128,6 +128,7 @@
2EFF06CD1D8A429A0004BB30 /* input-field-in-scrollable-document.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2EFF06CC1D8A42910004BB30 /* input-field-in-scrollable-document.html */; };
2EFF06D41D8AEDBB0004BB30 /* TestWKWebView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2EFF06D31D8AEDBB0004BB30 /* TestWKWebView.mm */; };
2EFF06D71D8AF34A0004BB30 /* WKWebViewCandidateTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2EFF06D61D8AF34A0004BB30 /* WKWebViewCandidateTests.mm */; };
+ 313C3A0221E567C300DBA86E /* SystemPreviewBlobNaming.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 313C3A0121E5677A00DBA86E /* SystemPreviewBlobNaming.html */; };
315118101DB1AE4000176304 /* ExtendedColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3151180F1DB1ADD500176304 /* ExtendedColor.cpp */; };
315231CA1EB3B3C700A22A16 /* GPULegacyCommandQueue.mm in Sources */ = {isa = PBXBuildFile; fileRef = 315231C91EB3B3C700A22A16 /* GPULegacyCommandQueue.mm */; };
3162AE9C1E6F2FF5000E4DBC /* GPULegacyDevice.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3162AE9B1E6F2FCE000E4DBC /* GPULegacyDevice.mm */; };
@@ -982,8 +983,6 @@
dstPath = TestWebKitAPI.resources;
dstSubfolderSpec = 7;
files = (
- C9C9A91D21DED7A000FDE96E /* video-with-play-button.html in Copy Resources */,
- C9C9A91B21DED28700FDE96E /* audio-with-play-button.html in Copy Resources */,
55A817FF2181021A0004A39A /* 100x100-red.tga in Copy Resources */,
1A9E52C913E65EF4006917F5 /* 18-characters.html in Copy Resources */,
55A81800218102210004A39A /* 400x400-green.png in Copy Resources */,
@@ -1003,6 +1002,7 @@
37137E4B21124D01002BEEA4 /* AttrStyle.html in Copy Resources */,
CD9E292E1C90C33F000BB800 /* audio-only.html in Copy Resources */,
C944160021430E8900B1EDDA /* audio-with-controls.html in Copy Resources */,
+ C9C9A91B21DED28700FDE96E /* audio-with-play-button.html in Copy Resources */,
CD57779C211CE91F001B371E /* audio-with-web-audio.html in Copy Resources */,
76E182DF154767E600F1FADD /* auto-submitting-form.html in Copy Resources */,
F41AB99F1EF4696B0083FA08 /* autofocus-contenteditable.html in Copy Resources */,
@@ -1243,6 +1243,7 @@
9BD6D3A31F7B218300BD4962 /* sunset-in-cupertino-200px.png in Copy Resources */,
9BD6D3A41F7B218300BD4962 /* sunset-in-cupertino-400px.gif in Copy Resources */,
9BD6D3A51F7B218300BD4962 /* sunset-in-cupertino-600px.jpg in Copy Resources */,
+ 313C3A0221E567C300DBA86E /* SystemPreviewBlobNaming.html in Copy Resources */,
CD59F53519E9110D00CF1835 /* test-mse.mp4 in Copy Resources */,
C95984F71E36BCEF002C0D45 /* test-without-audio-track.mp4 in Copy Resources */,
524BBCA119E30C77002F1AF1 /* test.mp4 in Copy Resources */,
@@ -1259,6 +1260,7 @@
CD321B041E3A85FA00EB21C8 /* video-with-muted-audio-and-webaudio.html in Copy Resources */,
CDB4115A1E0B00DB00EAD352 /* video-with-muted-audio.html in Copy Resources */,
CD758A6F20572EA00071834A /* video-with-paused-audio-and-playing-muted.html in Copy Resources */,
+ C9C9A91D21DED7A000FDE96E /* video-with-play-button.html in Copy Resources */,
CDC8E4961BC6F10800594FEC /* video-without-audio.html in Copy Resources */,
CDC8E4971BC6F10800594FEC /* video-without-audio.mp4 in Copy Resources */,
2EBD9D0A2134730D002DA758 /* video.html in Copy Resources */,
@@ -1438,6 +1440,7 @@
2EFF06D21D8AEDBB0004BB30 /* TestWKWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TestWKWebView.h; path = cocoa/TestWKWebView.h; sourceTree = "<group>"; };
2EFF06D31D8AEDBB0004BB30 /* TestWKWebView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TestWKWebView.mm; path = cocoa/TestWKWebView.mm; sourceTree = "<group>"; };
2EFF06D61D8AF34A0004BB30 /* WKWebViewCandidateTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewCandidateTests.mm; sourceTree = "<group>"; };
+ 313C3A0121E5677A00DBA86E /* SystemPreviewBlobNaming.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = SystemPreviewBlobNaming.html; sourceTree = "<group>"; };
3151180F1DB1ADD500176304 /* ExtendedColor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExtendedColor.cpp; sourceTree = "<group>"; };
315231C91EB3B3C700A22A16 /* GPULegacyCommandQueue.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPULegacyCommandQueue.mm; sourceTree = "<group>"; };
3162AE9B1E6F2FCE000E4DBC /* GPULegacyDevice.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPULegacyDevice.mm; sourceTree = "<group>"; };
@@ -2931,6 +2934,7 @@
9BD6D3A01F7B202000BD4962 /* sunset-in-cupertino-200px.png */,
9BD6D39F1F7B202000BD4962 /* sunset-in-cupertino-400px.gif */,
9BD6D39E1F7B201E00BD4962 /* sunset-in-cupertino-600px.jpg */,
+ 313C3A0121E5677A00DBA86E /* SystemPreviewBlobNaming.html */,
2E9896141D8F092B00739892 /* text-and-password-inputs.html */,
F4CD74C520FDACF500DE3794 /* text-with-async-script.html */,
F44C7A0420FAAE320014478C /* text-with-deferred-script.html */,
@@ -3317,8 +3321,8 @@
C95984F61E36BCD7002C0D45 /* test-without-audio-track.mp4 */,
524BBCA019E30C63002F1AF1 /* test.mp4 */,
7AE9E5081AE5AE8B00CF874B /* test.pdf */,
+ C9C9A91C21DED79400FDE96E /* video-with-play-button.html */,
07CD32F72065B72A0064A4BE /* video.html */,
- C9C9A91C21DED79400FDE96E /* video-with-play-button.html */,
1C2B81841C8924A200A5529F /* webfont.html */,
);
name = Resources;
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Download.mm (239757 => 239758)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Download.mm 2019-01-09 01:11:08 UTC (rev 239757)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Download.mm 2019-01-09 01:17:41 UTC (rev 239758)
@@ -621,5 +621,38 @@
[TestProtocol unregister];
}
+@interface BlobWithUSDZExtensionDownloadDelegate : NSObject <_WKDownloadDelegate>
+@end
+
+@implementation BlobWithUSDZExtensionDownloadDelegate {
+ String _destinationPath;
+}
+
+- (void)_download:(_WKDownload *)download decideDestinationWithSuggestedFilename:(NSString *)filename completionHandler:(void (^)(BOOL allowOverwrite, NSString *destination))completionHandler
+{
+ EXPECT_TRUE([filename hasSuffix:@".usdz"]);
+
+ WebCore::FileSystem::PlatformFileHandle fileHandle;
+ _destinationPath = WebCore::FileSystem::openTemporaryFile(filename, fileHandle);
+ EXPECT_TRUE(fileHandle != WebCore::FileSystem::invalidPlatformFileHandle);
+ WebCore::FileSystem::closeFile(fileHandle);
+
+ completionHandler(YES, _destinationPath);
+}
+
+- (void)_downloadDidFinish:(_WKDownload *)download
+{
+ WebCore::FileSystem::deleteFile(_destinationPath);
+ isDone = true;
+}
+
+@end
+
+TEST(_WKDownload, SystemPreviewUSDZBlobNaming)
+{
+ NSURL *originalURL = [[NSBundle mainBundle] URLForResource:@"SystemPreviewBlobNaming" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"];
+ runTest(adoptNS([[DownloadBlobURLNavigationDelegate alloc] init]).get(), adoptNS([[BlobWithUSDZExtensionDownloadDelegate alloc] init]).get(), originalURL);
+}
+
#endif
#endif
Added: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/SystemPreviewBlobNaming.html (0 => 239758)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/SystemPreviewBlobNaming.html (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/SystemPreviewBlobNaming.html 2019-01-09 01:17:41 UTC (rev 239758)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<body>
+<a id="href" href=""
+<script>
+ var element = document.getElementById("href");
+ var data = "" data";
+ var blob = new Blob([data], {type: "model/vnd.usdz+zip"});
+ var url = ""
+
+ element.href = ""
+ element.click();
+</script>
+</body>
+</html>
Property changes on: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/SystemPreviewBlobNaming.html
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Revision
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property