Title: [261354] branches/safari-610.1.12-branch
Revision
261354
Author
alanc...@apple.com
Date
2020-05-07 16:50:48 -0700 (Thu, 07 May 2020)

Log Message

Cherry-pick r261296. rdar://problem/62995467

    Unreviewed, reverting r260769.
    https://bugs.webkit.org/show_bug.cgi?id=211578

    Introduced regressions related to sharing (Requested by
    perarne on #webkit).

    Reverted changeset:

    "[Cocoa] After r258891, r255119 can be reverted"
    https://bugs.webkit.org/show_bug.cgi?id=211083
    https://trac.webkit.org/changeset/260769

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-610.1.12-branch/Source/WebCore/ChangeLog (261353 => 261354)


--- branches/safari-610.1.12-branch/Source/WebCore/ChangeLog	2020-05-07 23:50:44 UTC (rev 261353)
+++ branches/safari-610.1.12-branch/Source/WebCore/ChangeLog	2020-05-07 23:50:48 UTC (rev 261354)
@@ -1,5 +1,37 @@
 2020-05-07  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r261296. rdar://problem/62995467
+
+    Unreviewed, reverting r260769.
+    https://bugs.webkit.org/show_bug.cgi?id=211578
+    
+    Introduced regressions related to sharing (Requested by
+    perarne on #webkit).
+    
+    Reverted changeset:
+    
+    "[Cocoa] After r258891, r255119 can be reverted"
+    https://bugs.webkit.org/show_bug.cgi?id=211083
+    https://trac.webkit.org/changeset/260769
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261296 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-05-07  Commit Queue  <commit-qu...@webkit.org>
+
+            Unreviewed, reverting r260769.
+            https://bugs.webkit.org/show_bug.cgi?id=211578
+
+            Introduced regressions related to sharing (Requested by
+            perarne on #webkit).
+
+            Reverted changeset:
+
+            "[Cocoa] After r258891, r255119 can be reverted"
+            https://bugs.webkit.org/show_bug.cgi?id=211083
+            https://trac.webkit.org/changeset/260769
+
+2020-05-07  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r261252. rdar://problem/62995461
 
     REGRESSION (r260684): Reader background is lost after multitasking

Modified: branches/safari-610.1.12-branch/Source/WebCore/platform/MIMETypeRegistry.cpp (261353 => 261354)


--- branches/safari-610.1.12-branch/Source/WebCore/platform/MIMETypeRegistry.cpp	2020-05-07 23:50:44 UTC (rev 261353)
+++ branches/safari-610.1.12-branch/Source/WebCore/platform/MIMETypeRegistry.cpp	2020-05-07 23:50:48 UTC (rev 261354)
@@ -270,6 +270,12 @@
     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
@@ -356,7 +362,7 @@
     return commonMediaTypes;
 }
 
-static const HashMap<String, Vector<String>, ASCIICaseInsensitiveHash>& commonMimeTypesMap()
+const HashMap<String, Vector<String>, ASCIICaseInsensitiveHash>& commonMimeTypesMap()
 {
     ASSERT(isMainThread());
     static NeverDestroyed<HashMap<String, Vector<String>, ASCIICaseInsensitiveHash>> mimeTypesMap = [] {
@@ -381,6 +387,12 @@
 
 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;

Modified: branches/safari-610.1.12-branch/Source/WebCore/platform/MIMETypeRegistry.h (261353 => 261354)


--- branches/safari-610.1.12-branch/Source/WebCore/platform/MIMETypeRegistry.h	2020-05-07 23:50:44 UTC (rev 261353)
+++ branches/safari-610.1.12-branch/Source/WebCore/platform/MIMETypeRegistry.h	2020-05-07 23:50:48 UTC (rev 261354)
@@ -31,6 +31,9 @@
 
 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;

Modified: branches/safari-610.1.12-branch/Source/WebCore/testing/Internals.cpp (261353 => 261354)


--- branches/safari-610.1.12-branch/Source/WebCore/testing/Internals.cpp	2020-05-07 23:50:44 UTC (rev 261353)
+++ branches/safari-610.1.12-branch/Source/WebCore/testing/Internals.cpp	2020-05-07 23:50:48 UTC (rev 261354)
@@ -119,6 +119,7 @@
 #include "LibWebRTCProvider.h"
 #include "LoaderStrategy.h"
 #include "Location.h"
+#include "MIMETypeRegistry.h"
 #include "MallocStatistics.h"
 #include "MediaDevices.h"
 #include "MediaEngineConfigurationFactory.h"
@@ -5647,6 +5648,11 @@
 }
 #endif
 
+String Internals::mediaMIMETypeForExtension(const String& extension)
+{
+    return MIMETypeRegistry::getMediaMIMETypeForExtension(extension);
+}
+
 bool Internals::supportsPictureInPicture()
 {
     return WebCore::supportsPictureInPicture();

Modified: branches/safari-610.1.12-branch/Source/WebCore/testing/Internals.h (261353 => 261354)


--- branches/safari-610.1.12-branch/Source/WebCore/testing/Internals.h	2020-05-07 23:50:44 UTC (rev 261353)
+++ branches/safari-610.1.12-branch/Source/WebCore/testing/Internals.h	2020-05-07 23:50:48 UTC (rev 261354)
@@ -997,6 +997,8 @@
     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();

Modified: branches/safari-610.1.12-branch/Source/WebCore/testing/Internals.idl (261353 => 261354)


--- branches/safari-610.1.12-branch/Source/WebCore/testing/Internals.idl	2020-05-07 23:50:44 UTC (rev 261353)
+++ branches/safari-610.1.12-branch/Source/WebCore/testing/Internals.idl	2020-05-07 23:50:48 UTC (rev 261354)
@@ -898,6 +898,8 @@
     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();

Modified: branches/safari-610.1.12-branch/Source/WebKit/ChangeLog (261353 => 261354)


--- branches/safari-610.1.12-branch/Source/WebKit/ChangeLog	2020-05-07 23:50:44 UTC (rev 261353)
+++ branches/safari-610.1.12-branch/Source/WebKit/ChangeLog	2020-05-07 23:50:48 UTC (rev 261354)
@@ -1,5 +1,37 @@
 2020-05-07  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r261296. rdar://problem/62995467
+
+    Unreviewed, reverting r260769.
+    https://bugs.webkit.org/show_bug.cgi?id=211578
+    
+    Introduced regressions related to sharing (Requested by
+    perarne on #webkit).
+    
+    Reverted changeset:
+    
+    "[Cocoa] After r258891, r255119 can be reverted"
+    https://bugs.webkit.org/show_bug.cgi?id=211083
+    https://trac.webkit.org/changeset/260769
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261296 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-05-07  Commit Queue  <commit-qu...@webkit.org>
+
+            Unreviewed, reverting r260769.
+            https://bugs.webkit.org/show_bug.cgi?id=211578
+
+            Introduced regressions related to sharing (Requested by
+            perarne on #webkit).
+
+            Reverted changeset:
+
+            "[Cocoa] After r258891, r255119 can be reverted"
+            https://bugs.webkit.org/show_bug.cgi?id=211083
+            https://trac.webkit.org/changeset/260769
+
+2020-05-07  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r261263. rdar://problem/62995496
 
     Unreviewed, reverting r260689.

Modified: branches/safari-610.1.12-branch/Source/WebKit/Shared/WebProcessCreationParameters.cpp (261353 => 261354)


--- branches/safari-610.1.12-branch/Source/WebKit/Shared/WebProcessCreationParameters.cpp	2020-05-07 23:50:44 UTC (rev 261353)
+++ branches/safari-610.1.12-branch/Source/WebKit/Shared/WebProcessCreationParameters.cpp	2020-05-07 23:50:48 UTC (rev 261354)
@@ -174,6 +174,7 @@
     encoder << neSessionManagerExtensionHandle;
     encoder << mapDBExtensionHandle;
     encoder << systemHasBattery;
+    encoder << mimeTypesMap;
 #endif
 
 #if PLATFORM(IOS_FAMILY)
@@ -490,6 +491,12 @@
     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)

Modified: branches/safari-610.1.12-branch/Source/WebKit/Shared/WebProcessCreationParameters.h (261353 => 261354)


--- branches/safari-610.1.12-branch/Source/WebKit/Shared/WebProcessCreationParameters.h	2020-05-07 23:50:44 UTC (rev 261353)
+++ branches/safari-610.1.12-branch/Source/WebKit/Shared/WebProcessCreationParameters.h	2020-05-07 23:50:48 UTC (rev 261354)
@@ -214,6 +214,7 @@
     Optional<SandboxExtension::Handle> neSessionManagerExtensionHandle;
     Optional<SandboxExtension::Handle> mapDBExtensionHandle;
     bool systemHasBattery { false };
+    Optional<HashMap<String, Vector<String>, ASCIICaseInsensitiveHash>> mimeTypesMap;
 #endif
 
 #if PLATFORM(IOS_FAMILY)

Modified: branches/safari-610.1.12-branch/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (261353 => 261354)


--- branches/safari-610.1.12-branch/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2020-05-07 23:50:44 UTC (rev 261353)
+++ branches/safari-610.1.12-branch/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2020-05-07 23:50:48 UTC (rev 261354)
@@ -51,6 +51,7 @@
 #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>
@@ -415,6 +416,7 @@
         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))

Modified: branches/safari-610.1.12-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (261353 => 261354)


--- branches/safari-610.1.12-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2020-05-07 23:50:44 UTC (rev 261353)
+++ branches/safari-610.1.12-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2020-05-07 23:50:48 UTC (rev 261354)
@@ -61,6 +61,7 @@
 #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>
@@ -335,6 +336,9 @@
 
     setSystemHasBattery(parameters.systemHasBattery);
 
+    if (parameters.mimeTypesMap)
+        overriddenMimeTypesMap() = WTFMove(parameters.mimeTypesMap);
+
 #if PLATFORM(IOS_FAMILY)
     RenderThemeIOS::setCSSValueToSystemColorMap(WTFMove(parameters.cssValueToSystemColorMap));
     RenderThemeIOS::setFocusRingColor(parameters.focusRingColor);

Modified: branches/safari-610.1.12-branch/Tools/ChangeLog (261353 => 261354)


--- branches/safari-610.1.12-branch/Tools/ChangeLog	2020-05-07 23:50:44 UTC (rev 261353)
+++ branches/safari-610.1.12-branch/Tools/ChangeLog	2020-05-07 23:50:48 UTC (rev 261354)
@@ -1,3 +1,35 @@
+2020-05-07  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r261296. rdar://problem/62995467
+
+    Unreviewed, reverting r260769.
+    https://bugs.webkit.org/show_bug.cgi?id=211578
+    
+    Introduced regressions related to sharing (Requested by
+    perarne on #webkit).
+    
+    Reverted changeset:
+    
+    "[Cocoa] After r258891, r255119 can be reverted"
+    https://bugs.webkit.org/show_bug.cgi?id=211083
+    https://trac.webkit.org/changeset/260769
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261296 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-05-07  Commit Queue  <commit-qu...@webkit.org>
+
+            Unreviewed, reverting r260769.
+            https://bugs.webkit.org/show_bug.cgi?id=211578
+
+            Introduced regressions related to sharing (Requested by
+            perarne on #webkit).
+
+            Reverted changeset:
+
+            "[Cocoa] After r258891, r255119 can be reverted"
+            https://bugs.webkit.org/show_bug.cgi?id=211083
+            https://trac.webkit.org/changeset/260769
+
 2020-05-02  Daniel Bates  <daba...@apple.com>
 
         Page::editableElementsInRect() should return root editable elements

Modified: branches/safari-610.1.12-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (261353 => 261354)


--- branches/safari-610.1.12-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2020-05-07 23:50:44 UTC (rev 261353)
+++ branches/safari-610.1.12-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2020-05-07 23:50:48 UTC (rev 261354)
@@ -894,6 +894,7 @@
 		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 */; };
@@ -2497,6 +2498,7 @@
 		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>"; };
@@ -2967,6 +2969,7 @@
 				E394AE6E23F2303E005B4936 /* GrantAccessToMobileAssets.mm */,
 				E34A6D182412DE390012AB6E /* GrantAccessToPreferencesService.mm */,
 				E35B908123F60DD0000011FF /* LocalizedDeviceModel.mm */,
+				C145CC0B23DA5A0F003A5EEB /* MimeTypes.mm */,
 				E325C90623E3870200BC7D3B /* PictureInPictureSupport.mm */,
 				C15CBB3E23FB177A00300CC7 /* PreferenceChanges.mm */,
 				C149D54F242E9844003EBB12 /* SleepDisabler.mm */,
@@ -5006,6 +5009,7 @@
 				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 */,

Added: branches/safari-610.1.12-branch/Tools/TestWebKitAPI/Tests/WebKit/MimeTypes.mm (0 => 261354)


--- branches/safari-610.1.12-branch/Tools/TestWebKitAPI/Tests/WebKit/MimeTypes.mm	                        (rev 0)
+++ branches/safari-610.1.12-branch/Tools/TestWebKitAPI/Tests/WebKit/MimeTypes.mm	2020-05-07 23:50:48 UTC (rev 261354)
@@ -0,0 +1,52 @@
+/*
+ * 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
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to