Diff
Modified: trunk/Source/WebCore/ChangeLog (259373 => 259374)
--- trunk/Source/WebCore/ChangeLog 2020-04-02 00:16:26 UTC (rev 259373)
+++ trunk/Source/WebCore/ChangeLog 2020-04-02 00:19:56 UTC (rev 259374)
@@ -1,3 +1,28 @@
+2020-04-01 Per Arne Vollan <pvol...@apple.com>
+
+ [Cocoa] UTI from MIME type cache can be removed after r258915
+ https://bugs.webkit.org/show_bug.cgi?id=209787
+
+ Unreviewed rollout of r257828.
+
+ In r257828, a UTI from MIME type cache was added to avoid connecting to a launch services daemon in the
+ WebContent process, but after <https://trac.webkit.org/changeset/258915> this cache is not strictly needed
+ anymore, since r258915 solves the problem of avoiding to connect to the daemon in a general way.
+
+ * platform/network/mac/UTIUtilities.h:
+ * platform/network/mac/UTIUtilities.mm:
+ (WebCore::UTIFromMIMETypeCachePolicy::createValueForKey):
+ (WebCore::mapUTIFromMIMEType): Deleted.
+ (WebCore::additionalMIMETypes): Deleted.
+ (WebCore::createUTIFromMIMETypeMap): Deleted.
+ (WebCore::setUTIFromMIMETypeMap): Deleted.
+ * testing/Internals.cpp:
+ (WebCore::Internals::getUTIFromMIMEType): Deleted.
+ * testing/Internals.h:
+ * testing/Internals.idl:
+ * testing/Internals.mm:
+ (WebCore::Internals::getUTIFromMIMEType): Deleted.
+
2020-04-01 Chris Dumez <cdu...@apple.com>
http/tests/navigation/page-cache-fontfaceset.html is flaky crashing
Modified: trunk/Source/WebCore/platform/network/mac/UTIUtilities.h (259373 => 259374)
--- trunk/Source/WebCore/platform/network/mac/UTIUtilities.h 2020-04-02 00:16:26 UTC (rev 259373)
+++ trunk/Source/WebCore/platform/network/mac/UTIUtilities.h 2020-04-02 00:19:56 UTC (rev 259374)
@@ -25,7 +25,7 @@
#pragma once
-#include <wtf/text/WTFString.h>
+#import <wtf/Forward.h>
namespace WebCore {
@@ -34,7 +34,4 @@
WEBCORE_EXPORT String UTIFromMIMEType(const String&);
bool isDeclaredUTI(const String&);
WEBCORE_EXPORT String UTIFromTag(const String& tagClass, const String& tag, const String& conformingToUTI);
-
-WEBCORE_EXPORT void setUTIFromMIMETypeMap(HashMap<String, String>&&);
-WEBCORE_EXPORT const HashMap<String, String>& createUTIFromMIMETypeMap();
}
Modified: trunk/Source/WebCore/platform/network/mac/UTIUtilities.mm (259373 => 259374)
--- trunk/Source/WebCore/platform/network/mac/UTIUtilities.mm 2020-04-02 00:16:26 UTC (rev 259373)
+++ trunk/Source/WebCore/platform/network/mac/UTIUtilities.mm 2020-04-02 00:19:56 UTC (rev 259374)
@@ -26,7 +26,6 @@
#import "config.h"
#import "UTIUtilities.h"
-#import "MIMETypeRegistry.h"
#import <wtf/MainThread.h>
#import <wtf/TinyLRUCache.h>
#import <wtf/text/StringHash.h>
@@ -42,8 +41,6 @@
#define ADDITIONAL_UTI_MAPPINGS
#endif
-#define EMPTY_MIME_TYPE_STRING "emptyMimeType"_s
-
namespace WebCore {
String MIMETypeFromUTI(const String& uti)
@@ -117,30 +114,14 @@
return mapEntry->value;
}
-static Optional<HashMap<String, String>>& mapUTIFromMIMEType()
-{
- static NeverDestroyed<Optional<HashMap<String, String>>> map;
- return map;
-}
-
struct UTIFromMIMETypeCachePolicy : TinyLRUCachePolicy<String, String> {
public:
static String createValueForKey(const String& mimeType)
{
- String key = mimeType;
- if (mapUTIFromMIMEType().hasValue()) {
- if (key.isEmpty())
- key = EMPTY_MIME_TYPE_STRING;
- const auto& it = mapUTIFromMIMEType()->find(key);
- if (it != mapUTIFromMIMEType()->end())
- return it->value;
- WTFLogAlways("UTI for MIME type %s not found.", key.utf8().data());
- return UTIFromUnknownMIMEType(key);
- }
- auto type = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, key.createCFString().get(), 0));
+ auto type = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, mimeType.createCFString().get(), 0));
if (type)
return type.get();
- return UTIFromUnknownMIMEType(key);
+ return UTIFromUnknownMIMEType(mimeType);
}
};
@@ -167,39 +148,4 @@
return String(u.get());
}
-static const Vector<String>& additionalMIMETypes()
-{
- static NeverDestroyed<Vector<String>> mimeTypes = std::initializer_list<String> {
- "application/zip"_s,
- };
- return mimeTypes;
}
-
-const HashMap<String, String>& createUTIFromMIMETypeMap()
-{
- static NeverDestroyed<HashMap<String, String>> map = [] {
- HashMap<String, String> cache;
- for (auto mimeType : MIMETypeRegistry::supportedImageMIMETypes())
- cache.add(mimeType, UTIFromMIMEType(mimeType));
- for (auto mimeType : MIMETypeRegistry::supportedNonImageMIMETypes())
- cache.add(mimeType, UTIFromMIMEType(mimeType));
- for (auto mimeType : MIMETypeRegistry::unsupportedTextMIMETypes())
- cache.add(mimeType, UTIFromMIMEType(mimeType));
- for (auto mimeType : MIMETypeRegistry::supportedMediaMIMETypes())
- cache.add(mimeType, UTIFromMIMEType(mimeType));
- for (auto mimeType : MIMETypeRegistry::pdfMIMETypes())
- cache.add(mimeType, UTIFromMIMEType(mimeType));
- for (auto mimeType : additionalMIMETypes())
- cache.add(mimeType, UTIFromMIMEType(mimeType));
- cache.add(EMPTY_MIME_TYPE_STRING, UTIFromMIMEType(emptyString()));
- return cache;
- }();
- return map;
-}
-
-void setUTIFromMIMETypeMap(HashMap<String, String>&& map)
-{
- mapUTIFromMIMEType() = WTFMove(map);
-}
-
-}
Modified: trunk/Source/WebCore/testing/Internals.cpp (259373 => 259374)
--- trunk/Source/WebCore/testing/Internals.cpp 2020-04-02 00:16:26 UTC (rev 259373)
+++ trunk/Source/WebCore/testing/Internals.cpp 2020-04-02 00:19:56 UTC (rev 259374)
@@ -5532,11 +5532,6 @@
return emptyString();
}
-String Internals::getUTIFromMIMEType(const String&)
-{
- return emptyString();
-}
-
String Internals::getUTIFromTag(const String&, const String&, const String&)
{
return emptyString();
Modified: trunk/Source/WebCore/testing/Internals.h (259373 => 259374)
--- trunk/Source/WebCore/testing/Internals.h 2020-04-02 00:16:26 UTC (rev 259373)
+++ trunk/Source/WebCore/testing/Internals.h 2020-04-02 00:19:56 UTC (rev 259374)
@@ -952,7 +952,6 @@
String mediaMIMETypeForExtension(const String& extension);
- String getUTIFromMIMEType(const String& mimeType);
String getUTIFromTag(const String& tagClass, const String& tag, const String& conformingToUTI);
bool supportsPictureInPicture();
Modified: trunk/Source/WebCore/testing/Internals.idl (259373 => 259374)
--- trunk/Source/WebCore/testing/Internals.idl 2020-04-02 00:16:26 UTC (rev 259373)
+++ trunk/Source/WebCore/testing/Internals.idl 2020-04-02 00:19:56 UTC (rev 259374)
@@ -856,7 +856,6 @@
DOMString mediaMIMETypeForExtension(DOMString extension);
- DOMString getUTIFromMIMEType(DOMString mimeType);
DOMString getUTIFromTag(DOMString tagClass, DOMString tag, DOMString conformingToUTI);
boolean supportsPictureInPicture();
Modified: trunk/Source/WebCore/testing/Internals.mm (259373 => 259374)
--- trunk/Source/WebCore/testing/Internals.mm 2020-04-02 00:16:26 UTC (rev 259373)
+++ trunk/Source/WebCore/testing/Internals.mm 2020-04-02 00:19:56 UTC (rev 259374)
@@ -102,11 +102,6 @@
return encodedString;
}
-String Internals::getUTIFromMIMEType(const String& mimeType)
-{
- return UTIFromMIMEType(mimeType);
-}
-
String Internals::getUTIFromTag(const String& tagClass, const String& tag, const String& conformingToUTI)
{
return UTIFromTag(tagClass, tag, conformingToUTI);
Modified: trunk/Source/WebKit/ChangeLog (259373 => 259374)
--- trunk/Source/WebKit/ChangeLog 2020-04-02 00:16:26 UTC (rev 259373)
+++ trunk/Source/WebKit/ChangeLog 2020-04-02 00:19:56 UTC (rev 259374)
@@ -1,5 +1,21 @@
2020-04-01 Per Arne Vollan <pvol...@apple.com>
+ [Cocoa] UTI from MIME type cache can be removed after r258915
+ https://bugs.webkit.org/show_bug.cgi?id=209787
+
+ Unreviewed rollout of r257828.
+
+ * Shared/WebProcessCreationParameters.cpp:
+ (WebKit::WebProcessCreationParameters::encode const):
+ (WebKit::WebProcessCreationParameters::decode):
+ * Shared/WebProcessCreationParameters.h:
+ * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+ (WebKit::WebProcessPool::platformInitializeWebProcess):
+ * WebProcess/cocoa/WebProcessCocoa.mm:
+ (WebKit::WebProcess::platformInitializeWebProcess):
+
+2020-04-01 Per Arne Vollan <pvol...@apple.com>
+
[macOS] Deny mach-lookup access to "com.apple.lsd.mapdb" in sandbox
https://bugs.webkit.org/show_bug.cgi?id=209814
Modified: trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp (259373 => 259374)
--- trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp 2020-04-02 00:16:26 UTC (rev 259373)
+++ trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp 2020-04-02 00:19:56 UTC (rev 259374)
@@ -172,7 +172,6 @@
encoder << mapDBExtensionHandle;
encoder << systemHasBattery;
encoder << mimeTypesMap;
- encoder << mapUTIFromMIMEType;
#endif
#if PLATFORM(IOS_FAMILY)
@@ -475,12 +474,6 @@
if (!mimeTypesMap)
return false;
parameters.mimeTypesMap = WTFMove(*mimeTypesMap);
-
- Optional<HashMap<String, String>> mapUTIFromMIMEType;
- decoder >> mapUTIFromMIMEType;
- if (!mapUTIFromMIMEType)
- return false;
- parameters.mapUTIFromMIMEType = WTFMove(*mapUTIFromMIMEType);
#endif
#if PLATFORM(IOS_FAMILY)
Modified: trunk/Source/WebKit/Shared/WebProcessCreationParameters.h (259373 => 259374)
--- trunk/Source/WebKit/Shared/WebProcessCreationParameters.h 2020-04-02 00:16:26 UTC (rev 259373)
+++ trunk/Source/WebKit/Shared/WebProcessCreationParameters.h 2020-04-02 00:19:56 UTC (rev 259374)
@@ -213,7 +213,6 @@
Optional<SandboxExtension::Handle> mapDBExtensionHandle;
bool systemHasBattery { false };
Optional<HashMap<String, Vector<String>, ASCIICaseInsensitiveHash>> mimeTypesMap;
- HashMap<String, String> mapUTIFromMIMEType;
#endif
#if PLATFORM(IOS_FAMILY)
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (259373 => 259374)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2020-04-02 00:16:26 UTC (rev 259373)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2020-04-02 00:19:56 UTC (rev 259374)
@@ -405,7 +405,6 @@
}
parameters.systemHasBattery = systemHasBattery();
parameters.mimeTypesMap = commonMimeTypesMap();
- parameters.mapUTIFromMIMEType = createUTIFromMIMETypeMap();
SandboxExtension::Handle mapDBHandle;
SandboxExtension::createHandleForMachLookup("com.apple.lsd.mapdb", WTF::nullopt, mapDBHandle, SandboxExtension::Flags::NoReport);
Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (259373 => 259374)
--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2020-04-02 00:16:26 UTC (rev 259373)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2020-04-02 00:19:56 UTC (rev 259374)
@@ -285,8 +285,6 @@
if (parameters.mimeTypesMap)
overriddenMimeTypesMap() = WTFMove(parameters.mimeTypesMap);
-
- setUTIFromMIMETypeMap(WTFMove(parameters.mapUTIFromMIMEType));
#endif
#if PLATFORM(IOS_FAMILY)
Modified: trunk/Tools/ChangeLog (259373 => 259374)
--- trunk/Tools/ChangeLog 2020-04-02 00:16:26 UTC (rev 259373)
+++ trunk/Tools/ChangeLog 2020-04-02 00:19:56 UTC (rev 259374)
@@ -1,3 +1,13 @@
+2020-04-01 Per Arne Vollan <pvol...@apple.com>
+
+ [Cocoa] UTI from MIME type cache can be removed after r258915
+ https://bugs.webkit.org/show_bug.cgi?id=209787
+
+ Unreviewed rollout of r257828.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit/UTIFromMIMEType.mm: Removed.
+
2020-04-01 Jonathan Bedard <jbed...@apple.com>
run-_javascript_core-tests: runJSCStressTests shouldn't exit the program
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (259373 => 259374)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-04-02 00:16:26 UTC (rev 259373)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-04-02 00:19:56 UTC (rev 259374)
@@ -887,7 +887,6 @@
C15CBB3023F1FF1A00300CC7 /* BacklightLevelNotification.mm in Sources */ = {isa = PBXBuildFile; fileRef = C15CBB2F23F1FF1A00300CC7 /* BacklightLevelNotification.mm */; };
C15CBB3F23FB177A00300CC7 /* PreferenceChanges.mm in Sources */ = {isa = PBXBuildFile; fileRef = C15CBB3E23FB177A00300CC7 /* PreferenceChanges.mm */; };
C1692DCA23D10DAE006E88F7 /* Battery.mm in Sources */ = {isa = PBXBuildFile; fileRef = C1692DC923D10DAE006E88F7 /* Battery.mm */; };
- C194E31D2409DF43002939ED /* UTIFromMIMEType.mm in Sources */ = {isa = PBXBuildFile; fileRef = C194E31C2409DF43002939ED /* UTIFromMIMEType.mm */; };
C20F88A72295B96700D610FA /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C20F88A62295B96700D610FA /* CoreText.framework */; };
C22FA32B228F8708009D7988 /* TextWidth.mm in Sources */ = {isa = PBXBuildFile; fileRef = C22FA32A228F8708009D7988 /* TextWidth.mm */; };
C22FA32D228F8AEB009D7988 /* TextWidth.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = C22FA32C228F877A009D7988 /* TextWidth.html */; };
@@ -2465,7 +2464,6 @@
C15CBB2F23F1FF1A00300CC7 /* BacklightLevelNotification.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = BacklightLevelNotification.mm; sourceTree = "<group>"; };
C15CBB3E23FB177A00300CC7 /* PreferenceChanges.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PreferenceChanges.mm; sourceTree = "<group>"; };
C1692DC923D10DAE006E88F7 /* Battery.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = Battery.mm; sourceTree = "<group>"; };
- C194E31C2409DF43002939ED /* UTIFromMIMEType.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = UTIFromMIMEType.mm; sourceTree = "<group>"; };
C1D8EE212028E8E3008EB141 /* WebProcessTerminate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessTerminate.mm; sourceTree = "<group>"; };
C20F88A62295B96700D610FA /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = System/Library/Frameworks/CoreText.framework; sourceTree = SDKROOT; };
C22FA32A228F8708009D7988 /* TextWidth.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = TextWidth.mm; sourceTree = "<group>"; };
@@ -2928,7 +2926,6 @@
E325C90623E3870200BC7D3B /* PictureInPictureSupport.mm */,
C15CBB3E23FB177A00300CC7 /* PreferenceChanges.mm */,
C149D54F242E9844003EBB12 /* SleepDisabler.mm */,
- C194E31C2409DF43002939ED /* UTIFromMIMEType.mm */,
E3CAAA4B2415505100CED2E2 /* UTIFromTag.mm */,
0F139E751A423A5300F590F5 /* WeakObjCPtr.mm */,
);
@@ -5134,7 +5131,6 @@
07F4E92E20AF59E2002E3803 /* UserMediaSimulateFailedSandbox.mm in Sources */,
7CCE7F181A411AE600447C4C /* UserMessage.cpp in Sources */,
2EB242B821D4140B0055C1C0 /* UseSelectionAsFindString.mm in Sources */,
- C194E31D2409DF43002939ED /* UTIFromMIMEType.mm in Sources */,
E3CAAA4C2415505100CED2E2 /* UTIFromTag.mm in Sources */,
7C83E03A1D0A602700FEBCF3 /* UtilitiesCocoa.mm in Sources */,
7C83E0C61D0A654E00FEBCF3 /* VideoControlsManager.mm in Sources */,
Deleted: trunk/Tools/TestWebKitAPI/Tests/WebKit/UTIFromMIMEType.mm (259373 => 259374)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit/UTIFromMIMEType.mm 2020-04-02 00:16:26 UTC (rev 259373)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit/UTIFromMIMEType.mm 2020-04-02 00:19:56 UTC (rev 259374)
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#include "config.h"
-
-#if WK_HAVE_C_SPI
-
-#import "PlatformUtilities.h"
-#import "TestWKWebView.h"
-#import <WebCore/MIMETypeRegistry.h>
-#import <WebCore/UTIUtilities.h>
-
-TEST(WebKit, UTIFromMIMEType)
-{
- auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
- WKRetainPtr<WKContextRef> context = adoptWK(TestWebKitAPI::Util::createContextForInjectedBundleTest("InternalsInjectedBundleTest"));
- configuration.get().processPool = (WKProcessPool *)context.get();
- auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 300, 300) configuration:configuration.get() addToWindow:YES]);
-
- for (auto& mimeType : WebCore::MIMETypeRegistry::supportedImageMIMETypes()) {
- auto js = [NSString stringWithFormat:@"window.internals.getUTIFromMIMEType(\"%s\")", mimeType.utf8().data()];
-
- auto uti = [webView stringByEvaluatingJavaScript:js];
-
- ASSERT_TRUE(WebCore::UTIFromMIMEType(mimeType) == String(uti));
- }
-}
-
-#endif // WK_HAVE_C_SPI