Changeset 255457 in webkit


Ignore:
Timestamp:
Jan 30, 2020 2:13:23 PM (4 years ago)
Author:
pvollan@apple.com
Message:

[iOS] Issue mach sandbox extension to the frontboard and icon service when the attachment element is enabled
https://bugs.webkit.org/show_bug.cgi?id=205443
Source/WebCore:

Reviewed by Brent Fulgham.

Get focus ring color in the UI process since getting this color will communicate with the frontboard daemon.

Test: fast/sandbox/ios/focus-ring-color.html

  • rendering/RenderTheme.h:
  • rendering/RenderThemeIOS.h:
  • rendering/RenderThemeIOS.mm:

(WebCore::cachedFocusRingColor):
(WebCore::RenderThemeIOS::platformFocusRingColor const):
(WebCore::RenderThemeIOS::setFocusRingColor):

  • testing/Internals.cpp:

(WebCore::Internals::focusRingColor):

  • testing/Internals.h:
  • testing/Internals.idl:

Source/WebKit:

<rdar://problem/58074291>

Reviewed by Brent Fulgham.

When support for the html attachment element is enabled, issue a mach lookup extension to the frontboard and icon service
for the WebContent process, since these daemons are being contacted when icons for attachments are being queried. Also,
retrieve the focus ring color in the UI process, since getting this color requires access to the frontboard daemon.

Test: fast/sandbox/ios/sandbox-mach-lookup-attachment-element.html

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

LayoutTests:

Reviewed by Brent Fulgham.

  • fast/sandbox/ios/focus-ring-color-expected.txt: Added.
  • fast/sandbox/ios/focus-ring-color.html: Added.
  • fast/sandbox/ios/sandbox-mach-lookup-attachment-element-expected.txt: Added.
  • fast/sandbox/ios/sandbox-mach-lookup-attachment-element.html: Added.
Location:
trunk
Files:
4 added
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r255452 r255457  
     12020-01-30  Per Arne Vollan  <pvollan@apple.com>
     2
     3        [iOS] Issue mach sandbox extension to the frontboard and icon service when the attachment element is enabled
     4        https://bugs.webkit.org/show_bug.cgi?id=205443
     5
     6        Reviewed by Brent Fulgham.
     7
     8        * fast/sandbox/ios/focus-ring-color-expected.txt: Added.
     9        * fast/sandbox/ios/focus-ring-color.html: Added.
     10        * fast/sandbox/ios/sandbox-mach-lookup-attachment-element-expected.txt: Added.
     11        * fast/sandbox/ios/sandbox-mach-lookup-attachment-element.html: Added.
     12
    1132020-01-30  Alexey Shvayka  <shvaikalesh@gmail.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r255455 r255457  
     12020-01-30  Per Arne Vollan  <pvollan@apple.com>
     2
     3        [iOS] Issue mach sandbox extension to the frontboard and icon service when the attachment element is enabled
     4        https://bugs.webkit.org/show_bug.cgi?id=205443
     5
     6        Reviewed by Brent Fulgham.
     7
     8        Get focus ring color in the UI process since getting this color will communicate with the frontboard daemon.
     9
     10        Test: fast/sandbox/ios/focus-ring-color.html
     11
     12        * rendering/RenderTheme.h:
     13        * rendering/RenderThemeIOS.h:
     14        * rendering/RenderThemeIOS.mm:
     15        (WebCore::cachedFocusRingColor):
     16        (WebCore::RenderThemeIOS::platformFocusRingColor const):
     17        (WebCore::RenderThemeIOS::setFocusRingColor):
     18        * testing/Internals.cpp:
     19        (WebCore::Internals::focusRingColor):
     20        * testing/Internals.h:
     21        * testing/Internals.idl:
     22
    1232020-01-30  Jonathan Bedard  <jbedard@apple.com>
    224
  • trunk/Source/WebCore/rendering/RenderTheme.h

    r252546 r255457  
    161161    virtual Color disabledTextColor(const Color& textColor, const Color& backgroundColor) const;
    162162
    163     Color focusRingColor(OptionSet<StyleColor::Options>) const;
     163    WTF_EXPORT Color focusRingColor(OptionSet<StyleColor::Options>) const;
    164164    virtual Color platformFocusRingColor(OptionSet<StyleColor::Options>) const { return Color(0, 0, 0); }
    165165    static void setCustomFocusRingColor(const Color&);
  • trunk/Source/WebCore/rendering/RenderThemeIOS.h

    r254373 r255457  
    6565    WEBCORE_EXPORT static const CSSValueToSystemColorMap& cssValueToSystemColorMap();
    6666    WEBCORE_EXPORT static void setCSSValueToSystemColorMap(CSSValueToSystemColorMap&&);
    67    
     67
     68    WEBCORE_EXPORT static void setFocusRingColor(const Color&);
     69
    6870protected:
    6971    LengthBox popupInternalPaddingBox(const RenderStyle&) const override;
  • trunk/Source/WebCore/rendering/RenderThemeIOS.mm

    r255219 r255457  
    11311131}
    11321132
     1133static Optional<Color>& cachedFocusRingColor()
     1134{
     1135    static NeverDestroyed<Optional<Color>> color;
     1136    return color;
     1137}
     1138
    11331139#if ENABLE(FULL_KEYBOARD_ACCESS)
    11341140Color RenderThemeIOS::platformFocusRingColor(OptionSet<StyleColor::Options>) const
    11351141{
     1142    if (cachedFocusRingColor().hasValue())
     1143        return *cachedFocusRingColor();
     1144
    11361145    // FIXME: Should be using -keyboardFocusIndicatorColor. For now, work around <rdar://problem/50838886>.
    11371146    return colorFromUIColor([PAL::getUIColorClass() systemBlueColor]);
     
    15391548}
    15401549
     1550void RenderThemeIOS::setFocusRingColor(const Color& color)
     1551{
     1552    cachedFocusRingColor() = color;
     1553}
     1554
    15411555Color RenderThemeIOS::systemColor(CSSValueID cssValueID, OptionSet<StyleColor::Options> options) const
    15421556{
  • trunk/Source/WebCore/testing/Internals.cpp

    r255221 r255457  
    54565456}
    54575457
     5458String Internals::focusRingColor()
     5459{
     5460    OptionSet<StyleColor::Options> options;
     5461    return RenderTheme::singleton().focusRingColor(options).cssText();
     5462}
     5463
    54585464} // namespace WebCore
  • trunk/Source/WebCore/testing/Internals.h

    r255191 r255457  
    934934    String mediaMIMETypeForExtension(const String& extension);
    935935
     936    String focusRingColor();
     937
    936938private:
    937939    explicit Internals(Document&);
  • trunk/Source/WebCore/testing/Internals.idl

    r255191 r255457  
    837837   
    838838    DOMString systemColorForCSSValue(DOMString cssValue, boolean useDarkModeAppearance, boolean useElevatedUserInterfaceLevel);
     839    DOMString focusRingColor();
    839840
    840841    boolean systemHasBattery();
  • trunk/Source/WebKit/ChangeLog

    r255456 r255457  
     12020-01-30  Per Arne Vollan  <pvollan@apple.com>
     2
     3        [iOS] Issue mach sandbox extension to the frontboard and icon service when the attachment element is enabled
     4        https://bugs.webkit.org/show_bug.cgi?id=205443
     5        <rdar://problem/58074291>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        When support for the html attachment element is enabled, issue a mach lookup extension to the frontboard and icon service
     10        for the WebContent process, since these daemons are being contacted when icons for attachments are being queried. Also,
     11        retrieve the focus ring color in the UI process, since getting this color requires access to the frontboard daemon.
     12
     13        Test: fast/sandbox/ios/sandbox-mach-lookup-attachment-element.html
     14
     15        * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
     16        * Shared/WebProcessCreationParameters.cpp:
     17        (WebKit::WebProcessCreationParameters::encode const):
     18        (WebKit::WebProcessCreationParameters::decode):
     19        * Shared/WebProcessCreationParameters.h:
     20        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
     21        (WebKit::WebProcessPool::platformInitializeWebProcess):
     22        * WebProcess/cocoa/WebProcessCocoa.mm:
     23        (WebKit::WebProcess::platformInitializeWebProcess):
     24
    1252020-01-30  Tim Horton  <timothy_horton@apple.com>
    226
  • trunk/Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb

    r255387 r255457  
    920920    (require-all
    921921        (extension "com.apple.webkit.extension.mach")
    922         (global-name "com.apple.iphone.axserver-systemwide" "com.apple.tccd" "com.apple.nehelper" "com.apple.nesessionmanager.content-filter" "com.apple.uikit.viewservice.com.apple.WebContentFilter.remoteUI" "com.apple.diagnosticd" "com.apple.lsd.open" "com.apple.mobileassetd" "com.apple.mobileassetd.v2")))
     922        (global-name "com.apple.iphone.axserver-systemwide" "com.apple.tccd" "com.apple.nehelper" "com.apple.nesessionmanager.content-filter" "com.apple.uikit.viewservice.com.apple.WebContentFilter.remoteUI" "com.apple.diagnosticd" "com.apple.lsd.open" "com.apple.mobileassetd" "com.apple.mobileassetd.v2" "com.apple.frontboard.systemappservices" "com.apple.iconservices")))
    923923
    924924(allow mach-lookup
  • trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp

    r255342 r255457  
    9393    encoder << viewportConfigurationViewSize;
    9494    encoder << overrideViewportArguments;
     95    encoder << frontboardExtensionHandle;
     96    encoder << iconServicesExtensionHandle;
    9597#endif
    9698
     
    300302        return WTF::nullopt;
    301303    parameters.overrideViewportArguments = WTFMove(*overrideViewportArguments);
     304
     305    Optional<Optional<SandboxExtension::Handle>> frontboardExtensionHandle;
     306    decoder >> frontboardExtensionHandle;
     307    if (!frontboardExtensionHandle)
     308        return WTF::nullopt;
     309    parameters.frontboardExtensionHandle = WTFMove(*frontboardExtensionHandle);
     310
     311    Optional<Optional<SandboxExtension::Handle>> iconServicesExtensionHandle;
     312    decoder >> iconServicesExtensionHandle;
     313    if (!iconServicesExtensionHandle)
     314        return WTF::nullopt;
     315    parameters.iconServicesExtensionHandle = WTFMove(*iconServicesExtensionHandle);
    302316#endif
    303317
  • trunk/Source/WebKit/Shared/WebPageCreationParameters.h

    r255342 r255457  
    153153    WebCore::FloatSize viewportConfigurationViewSize;
    154154    Optional<WebCore::ViewportArguments> overrideViewportArguments;
     155    Optional<SandboxExtension::Handle> frontboardExtensionHandle;
     156    Optional<SandboxExtension::Handle> iconServicesExtensionHandle;
    155157#endif
    156158#if PLATFORM(IOS_FAMILY)
  • trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp

    r255119 r255457  
    174174    encoder << currentUserInterfaceIdiomIsPad;
    175175    encoder << cssValueToSystemColorMap;
     176    encoder << focusRingColor;
    176177#endif
    177178}
     
    459460        return false;
    460461    parameters.cssValueToSystemColorMap = WTFMove(*cssValueToSystemColorMap);
     462
     463    Optional<WebCore::Color> focusRingColor;
     464    decoder >> focusRingColor;
     465    if (!focusRingColor)
     466        return false;
     467    parameters.focusRingColor = WTFMove(*focusRingColor);
    461468#endif
    462469
  • trunk/Source/WebKit/Shared/WebProcessCreationParameters.h

    r255119 r255457  
    216216    bool currentUserInterfaceIdiomIsPad { false };
    217217    WebCore::RenderThemeIOS::CSSValueToSystemColorMap cssValueToSystemColorMap;
     218    WebCore::Color focusRingColor;
    218219#endif
    219220};
  • trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm

    r255119 r255457  
    361361    parameters.currentUserInterfaceIdiomIsPad = currentUserInterfaceIdiomIsPad();
    362362    parameters.cssValueToSystemColorMap = RenderThemeIOS::cssValueToSystemColorMap();
     363    parameters.focusRingColor = RenderTheme::singleton().focusRingColor(OptionSet<StyleColor::Options>());
    363364#endif
    364365}
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r255385 r255457  
    76527652#endif
    76537653
     7654#if ENABLE(ATTACHMENT_ELEMENT) && PLATFORM(IOS_FAMILY)
     7655    if (m_preferences->attachmentElementEnabled() && !m_process->hasIssuedAttachmentElementRelatedSandboxExtensions()) {
     7656        SandboxExtension::Handle handle;
     7657        SandboxExtension::createHandleForMachLookup("com.apple.frontboard.systemappservices", WTF::nullopt, handle);
     7658        parameters.frontboardExtensionHandle = WTFMove(handle);
     7659        SandboxExtension::createHandleForMachLookup("com.apple.iconservices", WTF::nullopt, handle);
     7660        parameters.iconServicesExtensionHandle = WTFMove(handle);
     7661        m_process->setHasIssuedAttachmentElementRelatedSandboxExtensions();
     7662    }
     7663#endif
     7664
    76547665    return parameters;
    76557666}
  • trunk/Source/WebKit/UIProcess/WebProcessProxy.h

    r255189 r255457  
    355355#endif
    356356
     357#if ENABLE(ATTACHMENT_ELEMENT) && PLATFORM(IOS_FAMILY)
     358    bool hasIssuedAttachmentElementRelatedSandboxExtensions() const { return m_hasIssuedAttachmentElementRelatedSandboxExtensions; }
     359    void setHasIssuedAttachmentElementRelatedSandboxExtensions() { m_hasIssuedAttachmentElementRelatedSandboxExtensions = true; }
     360#endif
     361
    357362protected:
    358363    WebProcessProxy(WebProcessPool&, WebsiteDataStore*, IsPrewarmed);
     
    533538    bool m_isPrewarmed;
    534539    bool m_hasAudibleWebPage { false };
     540#if ENABLE(ATTACHMENT_ELEMENT) && PLATFORM(IOS_FAMILY)
     541    bool m_hasIssuedAttachmentElementRelatedSandboxExtensions { false };
     542#endif
    535543
    536544#if PLATFORM(WATCHOS)
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r255342 r255457  
    527527    pageConfiguration.corsDisablingPatterns = WTFMove(parameters.corsDisablingPatterns);
    528528
     529#if ENABLE(ATTACHMENT_ELEMENT) && PLATFORM(IOS_FAMILY)
     530    if (parameters.frontboardExtensionHandle)
     531        SandboxExtension::consumePermanently(*parameters.frontboardExtensionHandle);
     532    if (parameters.iconServicesExtensionHandle)
     533        SandboxExtension::consumePermanently(*parameters.iconServicesExtensionHandle);
     534#endif
     535
    529536    m_page = makeUnique<Page>(WTFMove(pageConfiguration));
    530537
  • trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm

    r255189 r255457  
    268268#if PLATFORM(IOS_FAMILY)
    269269    RenderThemeIOS::setCSSValueToSystemColorMap(WTFMove(parameters.cssValueToSystemColorMap));
     270    RenderThemeIOS::setFocusRingColor(parameters.focusRingColor);
    270271#endif
    271272}
Note: See TracChangeset for help on using the changeset viewer.