[Cocoa] After r258891, r255119 can be reverted
authorpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Apr 2020 20:01:53 +0000 (20:01 +0000)
committerpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Apr 2020 20:01:53 +0000 (20:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=211083
Source/WebCore:

<rdar://problem/60714318>

Unreviewed revert of r255119.

Copying a MIME type map from the UI process to the WebContent process on startup is not needed anymore,
since r258891 will map the Launch Services database in the WebContent process.

* platform/MIMETypeRegistry.cpp:
(WebCore::commonMimeTypesMap):
(WebCore::typesForCommonExtension):
(WebCore::overriddenMimeTypesMap): Deleted.
* platform/MIMETypeRegistry.h:
* testing/Internals.cpp:
(WebCore::Internals::mediaMIMETypeForExtension): Deleted.
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit:

Unreviewed revert of r255119.

* 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):

Tools:

Unreviewed revert of r255119.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit/MimeTypes.mm: Removed.

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

14 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/MIMETypeRegistry.cpp
Source/WebCore/platform/MIMETypeRegistry.h
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebProcessCreationParameters.cpp
Source/WebKit/Shared/WebProcessCreationParameters.h
Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit/MimeTypes.mm [deleted file]

index 77ad154..ee72ec1 100644 (file)
@@ -1,3 +1,24 @@
+2020-04-27  Per Arne Vollan  <pvollan@apple.com>
+
+        [Cocoa] After r258891, r255119 can be reverted
+        https://bugs.webkit.org/show_bug.cgi?id=211083
+        <rdar://problem/60714318>
+
+        Unreviewed revert of r255119.
+
+        Copying a MIME type map from the UI process to the WebContent process on startup is not needed anymore,
+        since r258891 will map the Launch Services database in the WebContent process.
+
+        * platform/MIMETypeRegistry.cpp:
+        (WebCore::commonMimeTypesMap):
+        (WebCore::typesForCommonExtension):
+        (WebCore::overriddenMimeTypesMap): Deleted.
+        * platform/MIMETypeRegistry.h:
+        * testing/Internals.cpp:
+        (WebCore::Internals::mediaMIMETypeForExtension): Deleted.
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2020-04-27  Darin Adler  <darin@apple.com>
 
         Improve performance of commonInclusiveAncestor for deeply nested nodes
index 470fe54..095e50a 100644 (file)
@@ -270,12 +270,6 @@ const HashSet<String, ASCIICaseInsensitiveHash>& MIMETypeRegistry::unsupportedTe
     return unsupportedTextMIMETypes;
 }
 
-Optional<HashMap<String, Vector<String>, ASCIICaseInsensitiveHash>>& overriddenMimeTypesMap()
-{
-    static NeverDestroyed<Optional<HashMap<String, Vector<String>, ASCIICaseInsensitiveHash>>> map;
-    return map;
-}
-
 const std::initializer_list<TypeExtensionPair>& commonMediaTypes()
 {
     // A table of common media MIME types and file extensions used when a platform's
@@ -362,7 +356,7 @@ const std::initializer_list<TypeExtensionPair>& commonMediaTypes()
     return commonMediaTypes;
 }
 
-const HashMap<String, Vector<String>, ASCIICaseInsensitiveHash>& commonMimeTypesMap()
+static const HashMap<String, Vector<String>, ASCIICaseInsensitiveHash>& commonMimeTypesMap()
 {
     ASSERT(isMainThread());
     static NeverDestroyed<HashMap<String, Vector<String>, ASCIICaseInsensitiveHash>> mimeTypesMap = [] {
@@ -387,12 +381,6 @@ const HashMap<String, Vector<String>, ASCIICaseInsensitiveHash>& commonMimeTypes
 
 static const Vector<String>* typesForCommonExtension(const String& extension)
 {
-    if (overriddenMimeTypesMap().hasValue()) {
-        auto mapEntry = overriddenMimeTypesMap()->find(extension);
-        if (mapEntry == overriddenMimeTypesMap()->end())
-            return nullptr;
-        return &mapEntry->value;
-    }
     auto mapEntry = commonMimeTypesMap().find(extension);
     if (mapEntry == commonMimeTypesMap().end())
         return nullptr;
index af626bd..996ee78 100644 (file)
@@ -31,9 +31,6 @@
 
 namespace WebCore {
 
-WEBCORE_EXPORT Optional<HashMap<String, Vector<String>, ASCIICaseInsensitiveHash>>& overriddenMimeTypesMap();
-WEBCORE_EXPORT const HashMap<String, Vector<String>, ASCIICaseInsensitiveHash>& commonMimeTypesMap();
-
 struct TypeExtensionPair {
     ASCIILiteral type;
     ASCIILiteral extension;
index 01fcfd5..bcb6924 100644 (file)
 #include "LibWebRTCProvider.h"
 #include "LoaderStrategy.h"
 #include "Location.h"
-#include "MIMETypeRegistry.h"
 #include "MallocStatistics.h"
 #include "MediaDevices.h"
 #include "MediaEngineConfigurationFactory.h"
@@ -5633,11 +5632,6 @@ bool Internals::hasSandboxIOKitOpenAccessToClass(const String& process, const St
 }
 #endif
 
-String Internals::mediaMIMETypeForExtension(const String& extension)
-{
-    return MIMETypeRegistry::getMediaMIMETypeForExtension(extension);
-}
-
 bool Internals::supportsPictureInPicture()
 {
     return WebCore::supportsPictureInPicture();
index 79c759c..23c4fc0 100644 (file)
@@ -993,8 +993,6 @@ public:
     int readPreferenceInteger(const String& domain, const String& key);
     String encodedPreferenceValue(const String& domain, const String& key);
 
-    String mediaMIMETypeForExtension(const String& extension);
-
     String getUTIFromTag(const String& tagClass, const String& tag, const String& conformingToUTI);
 
     bool supportsPictureInPicture();
index b9ea80f..c150ecb 100644 (file)
@@ -896,8 +896,6 @@ enum CompositingPolicy {
     long readPreferenceInteger(DOMString domain, DOMString key);
     DOMString encodedPreferenceValue(DOMString domain, DOMString key);
 
-    DOMString mediaMIMETypeForExtension(DOMString extension);
-
     DOMString getUTIFromTag(DOMString tagClass, DOMString tag, DOMString conformingToUTI);
 
     boolean supportsPictureInPicture();
index b0f9de1..caa42b2 100644 (file)
@@ -1,3 +1,19 @@
+2020-04-27  Per Arne Vollan  <pvollan@apple.com>
+
+        [Cocoa] After r258891, r255119 can be reverted
+        https://bugs.webkit.org/show_bug.cgi?id=211083
+
+        Unreviewed revert of r255119.
+
+        * 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-27  Brent Fulgham  <bfulgham@apple.com>
 
         Unreviewed MacCatalyst build fix after r260739.
index 1e97853..58e6a61 100644 (file)
@@ -179,7 +179,6 @@ void WebProcessCreationParameters::encode(IPC::Encoder& encoder) const
     encoder << neSessionManagerExtensionHandle;
     encoder << mapDBExtensionHandle;
     encoder << systemHasBattery;
-    encoder << mimeTypesMap;
 #endif
 
 #if PLATFORM(IOS_FAMILY)
@@ -503,12 +502,6 @@ bool WebProcessCreationParameters::decode(IPC::Decoder& decoder, WebProcessCreat
     if (!systemHasBattery)
         return false;
     parameters.systemHasBattery = WTFMove(*systemHasBattery);
-
-    Optional<Optional<HashMap<String, Vector<String>, ASCIICaseInsensitiveHash>>> mimeTypesMap;
-    decoder >> mimeTypesMap;
-    if (!mimeTypesMap)
-        return false;
-    parameters.mimeTypesMap = WTFMove(*mimeTypesMap);
 #endif
 
 #if PLATFORM(IOS_FAMILY)
index f864abc..383ad05 100644 (file)
@@ -217,7 +217,6 @@ struct WebProcessCreationParameters {
     Optional<SandboxExtension::Handle> neSessionManagerExtensionHandle;
     Optional<SandboxExtension::Handle> mapDBExtensionHandle;
     bool systemHasBattery { false };
-    Optional<HashMap<String, Vector<String>, ASCIICaseInsensitiveHash>> mimeTypesMap;
 #endif
 
 #if PLATFORM(IOS_FAMILY)
index 0c85f82..c5ee5e2 100644 (file)
@@ -51,7 +51,6 @@
 #import <WebCore/AGXCompilerService.h>
 #import <WebCore/Color.h>
 #import <WebCore/LocalizedDeviceModel.h>
-#import <WebCore/MIMETypeRegistry.h>
 #import <WebCore/NetworkStorageSession.h>
 #import <WebCore/NotImplemented.h>
 #import <WebCore/PictureInPictureSupport.h>
@@ -414,7 +413,6 @@ void WebProcessPool::platformInitializeWebProcess(const WebProcessProxy& process
         parameters.neSessionManagerExtensionHandle = WTFMove(managerHandle);
     }
     parameters.systemHasBattery = systemHasBattery();
-    parameters.mimeTypesMap = commonMimeTypesMap();
 
     SandboxExtension::Handle mapDBHandle;
     if (SandboxExtension::createHandleForMachLookup("com.apple.lsd.mapdb", WTF::nullopt, mapDBHandle, SandboxExtension::Flags::NoReport))
index 4feea5d..2ba84d9 100644 (file)
@@ -61,7 +61,6 @@
 #import <WebCore/LocalizedDeviceModel.h>
 #import <WebCore/LocalizedStrings.h>
 #import <WebCore/LogInitialization.h>
-#import <WebCore/MIMETypeRegistry.h>
 #import <WebCore/MemoryRelease.h>
 #import <WebCore/NSScrollerImpDetails.h>
 #import <WebCore/NetworkExtensionContentFilter.h>
@@ -327,9 +326,6 @@ void WebProcess::platformInitializeWebProcess(WebProcessCreationParameters& para
 
     setSystemHasBattery(parameters.systemHasBattery);
 
-    if (parameters.mimeTypesMap)
-        overriddenMimeTypesMap() = WTFMove(parameters.mimeTypesMap);
-
 #if PLATFORM(IOS_FAMILY)
     RenderThemeIOS::setCSSValueToSystemColorMap(WTFMove(parameters.cssValueToSystemColorMap));
     RenderThemeIOS::setFocusRingColor(parameters.focusRingColor);
index 955a23e..3408132 100644 (file)
@@ -1,3 +1,13 @@
+2020-04-27  Per Arne Vollan  <pvollan@apple.com>
+
+        [Cocoa] After r258891, r255119 can be reverted
+        https://bugs.webkit.org/show_bug.cgi?id=211083
+
+        Unreviewed revert of r255119.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKit/MimeTypes.mm: Removed.
+
 2020-04-27  Daniel Bates  <dabates@apple.com>
 
         Caret may be placed in the wrong spot for text input context that is a form control
index f4e389c..420686b 100644 (file)
                C0BD669F131D3CFF00E18F2A /* ResponsivenessTimerDoesntFireEarly_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0BD669E131D3CFF00E18F2A /* ResponsivenessTimerDoesntFireEarly_Bundle.cpp */; };
                C0C5D3C61459912900A802A6 /* GetBackingScaleFactor_Bundle.mm in Sources */ = {isa = PBXBuildFile; fileRef = C0C5D3BD14598B6F00A802A6 /* GetBackingScaleFactor_Bundle.mm */; };
                C13D82D92416F13200A62793 /* EnableAccessibility.mm in Sources */ = {isa = PBXBuildFile; fileRef = C13D82D82416F13200A62793 /* EnableAccessibility.mm */; };
-               C145CC0C23DA5A1F003A5EEB /* MimeTypes.mm in Sources */ = {isa = PBXBuildFile; fileRef = C145CC0B23DA5A0F003A5EEB /* MimeTypes.mm */; };
                C149D550242E98DF003EBB12 /* SleepDisabler.mm in Sources */ = {isa = PBXBuildFile; fileRef = C149D54F242E9844003EBB12 /* SleepDisabler.mm */; };
                C15CBB3023F1FF1A00300CC7 /* BacklightLevelNotification.mm in Sources */ = {isa = PBXBuildFile; fileRef = C15CBB2F23F1FF1A00300CC7 /* BacklightLevelNotification.mm */; };
                C15CBB3F23FB177A00300CC7 /* PreferenceChanges.mm in Sources */ = {isa = PBXBuildFile; fileRef = C15CBB3E23FB177A00300CC7 /* PreferenceChanges.mm */; };
                C0C5D3BC14598B6F00A802A6 /* GetBackingScaleFactor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GetBackingScaleFactor.mm; sourceTree = "<group>"; };
                C0C5D3BD14598B6F00A802A6 /* GetBackingScaleFactor_Bundle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GetBackingScaleFactor_Bundle.mm; sourceTree = "<group>"; };
                C13D82D82416F13200A62793 /* EnableAccessibility.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = EnableAccessibility.mm; sourceTree = "<group>"; };
-               C145CC0B23DA5A0F003A5EEB /* MimeTypes.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MimeTypes.mm; sourceTree = "<group>"; };
                C149D54F242E9844003EBB12 /* SleepDisabler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SleepDisabler.mm; sourceTree = "<group>"; };
                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>"; };
                                E394AE6E23F2303E005B4936 /* GrantAccessToMobileAssets.mm */,
                                E34A6D182412DE390012AB6E /* GrantAccessToPreferencesService.mm */,
                                E35B908123F60DD0000011FF /* LocalizedDeviceModel.mm */,
-                               C145CC0B23DA5A0F003A5EEB /* MimeTypes.mm */,
                                E325C90623E3870200BC7D3B /* PictureInPictureSupport.mm */,
                                C15CBB3E23FB177A00300CC7 /* PreferenceChanges.mm */,
                                C149D54F242E9844003EBB12 /* SleepDisabler.mm */,
                                5C0BF8941DD599C900B00328 /* MenuTypesForMouseEvents.mm in Sources */,
                                5165FE04201EE620009F7EC3 /* MessagePortProviders.mm in Sources */,
                                A5B149DE1F5A19EA00C6DAFF /* MIMETypeRegistry.cpp in Sources */,
-                               C145CC0C23DA5A1F003A5EEB /* MimeTypes.mm in Sources */,
                                51CD1C6C1B38CE4300142CA5 /* ModalAlerts.mm in Sources */,
                                7C83E0B61D0A64B300FEBCF3 /* ModalAlertsSPI.cpp in Sources */,
                                7CCE7F011A411AE600447C4C /* MouseMoveAfterCrash.cpp in Sources */,
diff --git a/Tools/TestWebKitAPI/Tests/WebKit/MimeTypes.mm b/Tools/TestWebKitAPI/Tests/WebKit/MimeTypes.mm
deleted file mode 100644 (file)
index 30080e2..0000000
+++ /dev/null
@@ -1,52 +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.
- */
-
-#import "config.h"
-
-#if WK_HAVE_C_SPI
-
-#import "PlatformUtilities.h"
-#import "TestWKWebView.h"
-#import <WebCore/MIMETypeRegistry.h>
-
-TEST(WebKit, MimeTypes)
-{
-    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& pair : WebCore::commonMediaTypes()) {
-        ASCIILiteral extension = pair.extension;
-
-        auto js = [NSString stringWithFormat:@"window.internals.mediaMIMETypeForExtension(\"%s\")", extension.characters()];
-
-        auto mimeType = [webView stringByEvaluatingJavaScript:js];
-
-        ASSERT_TRUE(WebCore::MIMETypeRegistry::getMediaMIMETypeForExtension(extension) == String(mimeType));
-    }
-}
-
-#endif // WK_HAVE_C_SPI