[iOS] Mapping to UTI from tag and tag class should be performed in the UI process
authorpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 8 Mar 2020 23:52:40 +0000 (23:52 +0000)
committerpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 8 Mar 2020 23:52:40 +0000 (23:52 +0000)
commit7b6166c39231c77e12d2d79241f1496a25551c6c
tree1359b86c90c17e20f0efa13a9efa7c705d79f6e7
parent04179fcb4448da1eb1d05e2a29fb431330f8d4f1
[iOS] Mapping to UTI from tag and tag class should be performed in the UI process
https://bugs.webkit.org/show_bug.cgi?id=208783

Reviewed by Brent Fulgham.

Source/WebCore:

This mapping should be done in the UI process, since it is using a system service that will no longer be available
in the WebContent process. To achieve this, the method +[UTTypeRecord typeRecordWithTagOverride] is swizzled in
the WebContent process, and is using the cached mapping sent from the UI process.

API test: WebKit.UTIFromTag

* WebCore.xcodeproj/project.pbxproj:
* platform/cocoa/UTTypeRecordSwizzler.h: Added.
(WebCore::UTTypeItem::encode const):
(WebCore::UTTypeItem::decode):
* platform/cocoa/UTTypeRecordSwizzler.mm: Added.
(-[WebUTTypeRecord setIdentifier:]):
(WebCore::vectorOfUTTypeRecords):
(WebCore::typeRecordWithTagOverride):
(WebCore::createVectorOfUTTypeItem):
(WebCore::setVectorOfUTTypeItem):
(WebCore::swizzleUTTypeRecord):
* platform/network/mac/UTIUtilities.h:
* platform/network/mac/UTIUtilities.mm:
(WebCore::UTIFromTag):
* testing/Internals.cpp:
(WebCore::Internals::getUTIFromTag):
* testing/Internals.h:
* testing/Internals.idl:
* testing/Internals.mm:
(WebCore::Internals::getUTIFromTag):

Source/WebCore/PAL:

* PAL.xcodeproj/project.pbxproj:
* pal/spi/cocoa/NSUTTypeRecordSPI.h: Added.

Source/WebKit:

Send mapping from tag/tag class to UTI from the UI process to the WebContent process as part of the WebProcess
creation parameters. Also, issue some mach-lookup extensions to the WebContent process if Accessibility is
enabled.

* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
* 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):

Source/WTF:

* wtf/PlatformUse.h:

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@258120 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/PlatformUse.h
Source/WebCore/ChangeLog
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
Source/WebCore/PAL/pal/spi/cocoa/NSUTTypeRecordSPI.h [new file with mode: 0644]
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/cocoa/UTTypeRecordSwizzler.h [new file with mode: 0644]
Source/WebCore/platform/cocoa/UTTypeRecordSwizzler.mm [new file with mode: 0644]
Source/WebCore/platform/network/mac/UTIUtilities.h
Source/WebCore/platform/network/mac/UTIUtilities.mm
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebCore/testing/Internals.mm
Source/WebKit/ChangeLog
Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb
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/UTIFromTag.mm [new file with mode: 0644]