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

Changeset 242375 in webkit


Ignore:
Timestamp:
Mar 4, 2019, 12:36:32 PM (7 years ago)
Author:
Chris Dumez
Message:

Drop legacy userAgentForURL injected bundle SPI
https://bugs.webkit.org/show_bug.cgi?id=195222
<rdar://problem/46734147>

Reviewed by Darin Adler.

Drop legacy userAgentForURL injected bundle SPI. There are no longer any clients, and using
WebsitePolicies.customUserAgent is the way to go nowadays.

  • WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h:

(API::InjectedBundle::PageLoaderClient::willDestroyFrame):
(API::InjectedBundle::PageLoaderClient::userAgentForURL const): Deleted.

  • WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h:
  • WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h:
  • WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:

(setUpPageLoaderClient):
(userAgentForURL): Deleted.

  • WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:

(WebKit::InjectedBundlePageLoaderClient::userAgentForURL const): Deleted.

  • WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::userAgent const):

Location:
trunk/Source/WebKit
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r242371 r242375  
     12019-03-04  Chris Dumez  <cdumez@apple.com>
     2
     3        Drop legacy userAgentForURL injected bundle SPI
     4        https://bugs.webkit.org/show_bug.cgi?id=195222
     5        <rdar://problem/46734147>
     6
     7        Reviewed by Darin Adler.
     8
     9        Drop legacy userAgentForURL injected bundle SPI. There are no longer any clients, and using
     10        WebsitePolicies.customUserAgent is the way to go nowadays.
     11
     12        * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h:
     13        (API::InjectedBundle::PageLoaderClient::willDestroyFrame):
     14        (API::InjectedBundle::PageLoaderClient::userAgentForURL const): Deleted.
     15        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h:
     16        * WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h:
     17        * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
     18        (setUpPageLoaderClient):
     19        (userAgentForURL): Deleted.
     20        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
     21        (WebKit::InjectedBundlePageLoaderClient::userAgentForURL const): Deleted.
     22        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
     23        * WebProcess/WebPage/WebPage.cpp:
     24        (WebKit::WebPage::userAgent const):
     25
    1262019-03-04  Chris Dumez  <cdumez@apple.com>
    227
  • trunk/Source/WebKit/WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h

    r241183 r242375  
    9696
    9797    virtual void willDestroyFrame(WebKit::WebPage&, WebKit::WebFrame&) { }
    98     virtual WTF::String userAgentForURL(WebKit::WebFrame&, const WTF::URL&) const { return WTF::String(); }
    9998
    10099    virtual OptionSet<WebCore::LayoutMilestone> layoutMilestones() const { return { }; }
  • trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h

    r240808 r242375  
    6565- (void)webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller frame:(WKWebProcessPlugInFrame *)frame didFailLoadForResource:(uint64_t)resource error:(NSError *)error;
    6666
    67 - (NSString *)webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller frame:(WKWebProcessPlugInFrame *)frame userAgentForURL:(NSURL *)url;
    68 
    6967@end
  • trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h

    r241128 r242375  
    6363typedef void (*WKBundlePageWillLoadURLRequestCallback)(WKBundlePageRef page, WKURLRequestRef request, WKTypeRef userData, const void *clientInfo);
    6464typedef void (*WKBundlePageWillLoadDataRequestCallback)(WKBundlePageRef page, WKURLRequestRef request, WKDataRef data, WKStringRef MIMEType, WKStringRef encodingName, WKURLRef unreachableURL, WKTypeRef userData, const void *clientInfo);
    65 typedef WKStringRef (*WKBundlePageUserAgentForURLCallback)(WKBundleFrameRef frame, WKURLRef url, const void *clientInfo);
    6665typedef WKLayoutMilestones (*WKBundlePageLayoutMilestonesCallback)(const void* clientInfo);
    6766
     
    464463   
    465464    // Version 8
    466     WKBundlePageUserAgentForURLCallback                                     userAgentForURL;
     465    void*                                                                   userAgentForURL_unavailable;
    467466} WKBundlePageLoaderClientV8;
    468467
     
    522521
    523522    // Version 8
    524     WKBundlePageUserAgentForURLCallback                                     userAgentForURL;
     523    void*                                                                   userAgentForURL_unavailable;
    525524
    526525    // Version 9
     
    583582
    584583    // Version 8
    585     WKBundlePageUserAgentForURLCallback                                     userAgentForURL;
     584    void*                                                                   userAgentForURL_unavailable;
    586585
    587586    // Version 9
  • trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm

    r242339 r242375  
    221221}
    222222
    223 static WKStringRef userAgentForURL(WKBundleFrameRef frame, WKURLRef url, const void* clientInfo)
    224 {
    225     auto pluginContextController = (__bridge WKWebProcessPlugInBrowserContextController *)clientInfo;
    226     auto loadDelegate = pluginContextController->_loadDelegate.get();
    227    
    228     if ([loadDelegate respondsToSelector:@selector(webProcessPlugInBrowserContextController:frame:userAgentForURL:)]) {
    229         WKWebProcessPlugInFrame *newFrame = wrapper(*WebKit::toImpl(frame));
    230         NSString *string = [loadDelegate webProcessPlugInBrowserContextController:pluginContextController frame:newFrame userAgentForURL:wrapper(*WebKit::toImpl(url))];
    231         if (!string)
    232             return nullptr;
    233 
    234         return WKStringCreateWithCFString((__bridge CFStringRef)string);
    235     }
    236    
    237     return nullptr;
    238 }
    239 
    240223static void setUpPageLoaderClient(WKWebProcessPlugInBrowserContextController *contextController, WebKit::WebPage& page)
    241224{
     
    257240    client.didHandleOnloadEventsForFrame = didHandleOnloadEventsForFrame;
    258241    client.didFirstVisuallyNonEmptyLayoutForFrame = didFirstVisuallyNonEmptyLayoutForFrame;
    259     client.userAgentForURL = userAgentForURL;
    260242
    261243    client.didLayoutForFrame = didLayoutForFrame;
  • trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp

    r241128 r242375  
    354354}
    355355
    356 String InjectedBundlePageLoaderClient::userAgentForURL(WebFrame& frame, const URL& url) const
    357 {
    358     if (!m_client.userAgentForURL)
    359         return String();
    360     WKStringRef userAgent = m_client.userAgentForURL(toAPI(&frame), toAPI(API::URL::create(url).ptr()), m_client.base.clientInfo);
    361     if (!userAgent)
    362         return String();
    363     return toImpl(userAgent)->string();
    364 }
    365 
    366356OptionSet<WebCore::LayoutMilestone> InjectedBundlePageLoaderClient::layoutMilestones() const
    367357{
  • trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h

    r241128 r242375  
    8686    void featuresUsedInPage(WebPage&, const Vector<WTF::String>&) override;
    8787
    88     WTF::String userAgentForURL(WebFrame&, const URL&) const override;
    89 
    9088    OptionSet<WebCore::LayoutMilestone> layoutMilestones() const override;
    9189};
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r242082 r242375  
    13711371String WebFrameLoaderClient::userAgent(const URL& url)
    13721372{
    1373     WebPage* webPage = m_frame->page();
     1373    auto* webPage = m_frame->page();
    13741374    if (!webPage)
    13751375        return String();
    13761376
    1377     return webPage->userAgent(m_frame, url);
     1377    return webPage->userAgent(url);
    13781378}
    13791379
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r242320 r242375  
    31653165String WebPage::userAgent(const URL& webCoreURL) const
    31663166{
    3167     return userAgent(nullptr, webCoreURL);
    3168 }
    3169 
    3170 String WebPage::userAgent(WebFrame* frame, const URL& webcoreURL) const
    3171 {
    3172     if (frame) {
    3173         String userAgent = m_loaderClient->userAgentForURL(*frame, webcoreURL);
    3174         if (!userAgent.isEmpty())
    3175             return userAgent;
    3176     }
    3177 
    3178     String userAgent = platformUserAgent(webcoreURL);
     3167    String userAgent = platformUserAgent(webCoreURL);
    31793168    if (!userAgent.isEmpty())
    31803169        return userAgent;
    31813170    return m_userAgent;
    31823171}
    3183    
     3172
    31843173void WebPage::setUserAgent(const String& userAgent)
    31853174{
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r242340 r242375  
    348348    void show();
    349349    String userAgent(const URL&) const;
    350     String userAgent(WebFrame*, const URL&) const;
    351350    String platformUserAgent(const URL&) const;
    352351    WebCore::KeyboardUIMode keyboardUIMode();
Note: See TracChangeset for help on using the changeset viewer.