⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 274228 in webkit


Ignore:
Timestamp:
Mar 10, 2021, 12:09:30 PM (6 years ago)
Author:
Brent Fulgham
Message:

[Cocoa] Add additional bundle ID property to WKWebViewConfiguration
https://bugs.webkit.org/show_bug.cgi?id=222919
<rdar://problem/75013854>

Reviewed by Alex Christensen.

Source/WebKit:

Add an additional property to _WKWebsiteDataStoreConfiguration to help thread the correct bundle
ID of the driving application to lower levels of WebKit so that we can provide better messaging
when a remote service (e.g., Safari View Controller or ASWebAuthenticationSession) is used. Currently
we often lack context and have to report a generic "web content" message that doesn't help a user
understand which app is actually requesting the load.

We cannot use either of the existing bundle ID's for this purpose since we always indicate 'com.apple.Safari'
as the source application to ensure proper handling of web traffic in lower levels of the system Network stack,
and sourceApplicationSecondaryIdentifier is used for Apple Pay purposes and cannot be repurposed for this task.

This first patch adds the property. A follow-up patch will flesh out the implementation.

  • NetworkProcess/NetworkSessionCreationParameters.cpp:

(WebKit::NetworkSessionCreationParameters::encode const):
(WebKit::NetworkSessionCreationParameters::decode):

  • NetworkProcess/NetworkSessionCreationParameters.h:
  • NetworkProcess/cocoa/NetworkSessionCocoa.h:
  • NetworkProcess/cocoa/NetworkSessionCocoa.mm:

(WebKit::NetworkSessionCocoa::attributedBundleIdentifier const):
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa):

  • UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
  • UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:

(-[_WKWebsiteDataStoreConfiguration setAttributedBundleIdentifier:]):
(-[_WKWebsiteDataStoreConfiguration attributedBundleIdentifier]):

  • UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:

(WebKit::WebsiteDataStore::platformSetNetworkParameters):

  • UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:

(WebKit::WebsiteDataStoreConfiguration::copy):

  • UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:

(WebKit::WebsiteDataStoreConfiguration::attributedBundleIdentifier const):
(WebKit::WebsiteDataStoreConfiguration::setAttributedBundleIdentifier):

Tools:

Update existing SettingNonPersistentDataStorePathsThrowsException test with new property.

  • TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm:

(TestWebKitAPI::TEST):

Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r274227 r274228  
     12021-03-10  Brent Fulgham  <bfulgham@apple.com>
     2
     3        [Cocoa] Add additional bundle ID property to WKWebViewConfiguration
     4        https://bugs.webkit.org/show_bug.cgi?id=222919
     5        <rdar://problem/75013854>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Add an additional property to _WKWebsiteDataStoreConfiguration to help thread the correct bundle
     10        ID of the driving application to lower levels of WebKit so that we can provide better messaging
     11        when a remote service (e.g., Safari View Controller or ASWebAuthenticationSession) is used. Currently
     12        we often lack context and have to report a generic "web content" message that doesn't help a user
     13        understand which app is actually requesting the load.
     14
     15        We cannot use either of the existing bundle ID's for this purpose since we always indicate 'com.apple.Safari'
     16        as the source application to ensure proper handling of web traffic in lower levels of the system Network stack,
     17        and sourceApplicationSecondaryIdentifier is used for Apple Pay purposes and cannot be repurposed for this task.
     18
     19        This first patch adds the property. A follow-up patch will flesh out the implementation.
     20
     21        * NetworkProcess/NetworkSessionCreationParameters.cpp:
     22        (WebKit::NetworkSessionCreationParameters::encode const):
     23        (WebKit::NetworkSessionCreationParameters::decode):
     24        * NetworkProcess/NetworkSessionCreationParameters.h:
     25        * NetworkProcess/cocoa/NetworkSessionCocoa.h:
     26        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
     27        (WebKit::NetworkSessionCocoa::attributedBundleIdentifier const):
     28        (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
     29        * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
     30        * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
     31        (-[_WKWebsiteDataStoreConfiguration setAttributedBundleIdentifier:]):
     32        (-[_WKWebsiteDataStoreConfiguration attributedBundleIdentifier]):
     33        * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
     34        (WebKit::WebsiteDataStore::platformSetNetworkParameters):
     35        * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
     36        (WebKit::WebsiteDataStoreConfiguration::copy):
     37        * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
     38        (WebKit::WebsiteDataStoreConfiguration::attributedBundleIdentifier const):
     39        (WebKit::WebsiteDataStoreConfiguration::setAttributedBundleIdentifier):
     40
    1412021-03-09  Darin Adler  <darin@apple.com>
    242
  • trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp

    r271714 r274228  
    11/*
    2  * Copyright (C) 2018-2020 Apple Inc. All rights reserved.
     2 * Copyright (C) 2018-2021 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4848    encoder << sourceApplicationBundleIdentifier;
    4949    encoder << sourceApplicationSecondaryIdentifier;
     50    encoder << attributedBundleIdentifier;
    5051    encoder << shouldLogCookieInformation;
    5152    encoder << httpProxy;
     
    121122        return WTF::nullopt;
    122123
     124    Optional<String> attributedBundleIdentifier;
     125    decoder >> attributedBundleIdentifier;
     126    if (!attributedBundleIdentifier)
     127        return WTF::nullopt;
     128   
    123129    Optional<bool> shouldLogCookieInformation;
    124130    decoder >> shouldLogCookieInformation;
     
    296302        , WTFMove(*sourceApplicationBundleIdentifier)
    297303        , WTFMove(*sourceApplicationSecondaryIdentifier)
     304        , WTFMove(*attributedBundleIdentifier)
    298305        , WTFMove(*shouldLogCookieInformation)
    299306        , WTFMove(*httpProxy)
  • trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h

    r271714 r274228  
    11/*
    2  * Copyright (C) 2017-2020 Apple Inc. All rights reserved.
     2 * Copyright (C) 2017-2021 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    6161    String sourceApplicationBundleIdentifier;
    6262    String sourceApplicationSecondaryIdentifier;
     63    String attributedBundleIdentifier;
    6364    bool shouldLogCookieInformation { false };
    6465    URL httpProxy;
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h

    r270249 r274228  
    11/*
    2  * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016-2021 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    7676    const String& sourceApplicationBundleIdentifier() const;
    7777    const String& sourceApplicationSecondaryIdentifier() const;
     78    const String& attributedBundleIdentifier() const;
    7879#if PLATFORM(IOS_FAMILY)
    7980    const String& dataConnectionServiceType() const;
     
    148149    String m_sourceApplicationBundleIdentifier;
    149150    String m_sourceApplicationSecondaryIdentifier;
     151    String m_attributedBundleIdentifier;
    150152    RetainPtr<CFDictionaryRef> m_proxyConfiguration;
    151153    RetainPtr<DMFWebsitePolicyMonitor> m_deviceManagementPolicyMonitor;
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm

    r274161 r274228  
    11/*
    2  * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2021 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    11491149}
    11501150
     1151const String& NetworkSessionCocoa::attributedBundleIdentifier() const
     1152{
     1153    return m_attributedBundleIdentifier;
     1154}
     1155
    11511156#if PLATFORM(IOS_FAMILY)
    11521157const String& NetworkSessionCocoa::dataConnectionServiceType() const
     
    12231228    , m_sourceApplicationBundleIdentifier(parameters.sourceApplicationBundleIdentifier)
    12241229    , m_sourceApplicationSecondaryIdentifier(parameters.sourceApplicationSecondaryIdentifier)
     1230    , m_attributedBundleIdentifier(parameters.attributedBundleIdentifier)
    12251231    , m_proxyConfiguration(parameters.proxyConfiguration)
    12261232    , m_shouldLogCookieInformation(parameters.shouldLogCookieInformation)
  • trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h

    r271813 r274228  
    11/*
    2  * Copyright (C) 2017-2020 Apple Inc. All rights reserved.
     2 * Copyright (C) 2017-2021 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4040@property (nonatomic, nullable, copy) NSString *sourceApplicationBundleIdentifier WK_API_AVAILABLE(macos(10.14.4), ios(12.2));
    4141@property (nonatomic, nullable, copy) NSString *sourceApplicationSecondaryIdentifier WK_API_AVAILABLE(macos(10.14.4), ios(12.2));
     42@property (nonatomic, nullable, copy) NSString *attributedBundleIdentifier WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
    4243@property (nonatomic, nullable, copy, setter=setHTTPProxy:) NSURL *httpProxy WK_API_AVAILABLE(macos(10.14.4), ios(12.2));
    4344@property (nonatomic, nullable, copy, setter=setHTTPSProxy:) NSURL *httpsProxy WK_API_AVAILABLE(macos(10.14.4), ios(12.2));
  • trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm

    r274227 r274228  
    11/*
    2  * Copyright (C) 2017 Apple Inc. All rights reserved.
     2 * Copyright (C) 2017-2021 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    243243}
    244244
     245- (void)setAttributedBundleIdentifier:(NSString *)identifier
     246{
     247    _configuration->setAttributedBundleIdentifier(identifier);
     248}
     249
     250- (NSString *)attributedBundleIdentifier
     251{
     252    return _configuration->attributedBundleIdentifier();
     253}
     254
    245255- (NSURL *)applicationCacheDirectory
    246256{
  • trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm

    r273610 r274228  
    11/*
    2  * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2021 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    168168    parameters.networkSessionParameters.sourceApplicationBundleIdentifier = configuration().sourceApplicationBundleIdentifier();
    169169    parameters.networkSessionParameters.sourceApplicationSecondaryIdentifier = configuration().sourceApplicationSecondaryIdentifier();
     170    parameters.networkSessionParameters.attributedBundleIdentifier = configuration().attributedBundleIdentifier();
    170171    parameters.networkSessionParameters.shouldLogCookieInformation = shouldLogCookieInformation;
    171172    parameters.networkSessionParameters.httpProxy = WTFMove(httpProxy);
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp

    r268214 r274228  
    11/*
    2  * Copyright (C) 2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2018-2021 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    7878    copy->m_sourceApplicationBundleIdentifier = this->m_sourceApplicationBundleIdentifier;
    7979    copy->m_sourceApplicationSecondaryIdentifier = this->m_sourceApplicationSecondaryIdentifier;
     80    copy->m_attributedBundleIdentifier = this->m_attributedBundleIdentifier;
    8081    copy->m_httpProxy = this->m_httpProxy;
    8182    copy->m_httpsProxy = this->m_httpsProxy;
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h

    r268214 r274228  
    11/*
    2  * Copyright (C) 2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2018-2021 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    134134    void setSourceApplicationSecondaryIdentifier(String&& identifier) { m_sourceApplicationSecondaryIdentifier = WTFMove(identifier); }
    135135
     136    const String& attributedBundleIdentifier() const { return m_attributedBundleIdentifier; }
     137    void setAttributedBundleIdentifier(String&& identifier) { m_attributedBundleIdentifier = WTFMove(identifier); }
     138   
    136139    const URL& httpProxy() const { return m_httpProxy; }
    137140    void setHTTPProxy(URL&& proxy) { m_httpProxy = WTFMove(proxy); }
     
    195198    String m_sourceApplicationBundleIdentifier;
    196199    String m_sourceApplicationSecondaryIdentifier;
     200    String m_attributedBundleIdentifier;
    197201    String m_boundInterfaceIdentifier;
    198202    String m_dataConnectionServiceType;
  • trunk/Tools/ChangeLog

    r274220 r274228  
     12021-03-10  Brent Fulgham  <bfulgham@apple.com>
     2
     3        [Cocoa] Add additional bundle ID property to WKWebViewConfiguration
     4        https://bugs.webkit.org/show_bug.cgi?id=222919
     5        <rdar://problem/75013854>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Update existing SettingNonPersistentDataStorePathsThrowsException test with new property.
     10
     11        * TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm:
     12        (TestWebKitAPI::TEST):
     13
    1142021-03-10  Sam Sneddon  <gsnedders@apple.com>
    215
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm

    r273062 r274228  
    11/*
    2  * Copyright (C) 2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2019-2021 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    268268    [configuration setSourceApplicationBundleIdentifier:@"com.apple.Safari"];
    269269    [configuration setSourceApplicationSecondaryIdentifier:@"com.apple.Safari"];
     270    [configuration setAttributedBundleIdentifier:@"com.apple.Safari"];
    270271}
    271272
Note: See TracChangeset for help on using the changeset viewer.