Title: [242375] trunk/Source/WebKit
Revision
242375
Author
[email protected]
Date
2019-03-04 12:36:32 -0800 (Mon, 04 Mar 2019)

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

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (242374 => 242375)


--- trunk/Source/WebKit/ChangeLog	2019-03-04 20:35:54 UTC (rev 242374)
+++ trunk/Source/WebKit/ChangeLog	2019-03-04 20:36:32 UTC (rev 242375)
@@ -1,5 +1,30 @@
 2019-03-04  Chris Dumez  <[email protected]>
 
+        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):
+
+2019-03-04  Chris Dumez  <[email protected]>
+
         Do not share WebProcesses between private and regular sessions
         https://bugs.webkit.org/show_bug.cgi?id=195189
         <rdar://problem/48421064>

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h (242374 => 242375)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h	2019-03-04 20:35:54 UTC (rev 242374)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h	2019-03-04 20:36:32 UTC (rev 242375)
@@ -95,7 +95,6 @@
     virtual void featuresUsedInPage(WebKit::WebPage&, const Vector<WTF::String>&) { }
 
     virtual void willDestroyFrame(WebKit::WebPage&, WebKit::WebFrame&) { }
-    virtual WTF::String userAgentForURL(WebKit::WebFrame&, const WTF::URL&) const { return WTF::String(); }
 
     virtual OptionSet<WebCore::LayoutMilestone> layoutMilestones() const { return { }; }
 };

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h (242374 => 242375)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h	2019-03-04 20:35:54 UTC (rev 242374)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h	2019-03-04 20:36:32 UTC (rev 242375)
@@ -64,6 +64,4 @@
 - (void)webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller frame:(WKWebProcessPlugInFrame *)frame didFinishLoadForResource:(uint64_t)resource;
 - (void)webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller frame:(WKWebProcessPlugInFrame *)frame didFailLoadForResource:(uint64_t)resource error:(NSError *)error;
 
-- (NSString *)webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller frame:(WKWebProcessPlugInFrame *)frame userAgentForURL:(NSURL *)url;
-
 @end

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h (242374 => 242375)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h	2019-03-04 20:35:54 UTC (rev 242374)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h	2019-03-04 20:36:32 UTC (rev 242375)
@@ -62,7 +62,6 @@
 typedef void (*WKBundlePageFeaturesUsedInPageCallback)(WKBundlePageRef page, WKArrayRef featureStrings, const void *clientInfo);
 typedef void (*WKBundlePageWillLoadURLRequestCallback)(WKBundlePageRef page, WKURLRequestRef request, WKTypeRef userData, const void *clientInfo);
 typedef void (*WKBundlePageWillLoadDataRequestCallback)(WKBundlePageRef page, WKURLRequestRef request, WKDataRef data, WKStringRef MIMEType, WKStringRef encodingName, WKURLRef unreachableURL, WKTypeRef userData, const void *clientInfo);
-typedef WKStringRef (*WKBundlePageUserAgentForURLCallback)(WKBundleFrameRef frame, WKURLRef url, const void *clientInfo);
 typedef WKLayoutMilestones (*WKBundlePageLayoutMilestonesCallback)(const void* clientInfo);
 
 typedef struct WKBundlePageLoaderClientBase {
@@ -463,7 +462,7 @@
     void *                                                                  willDestroyFrame_unavailable;
     
     // Version 8
-    WKBundlePageUserAgentForURLCallback                                     userAgentForURL;
+    void*                                                                   userAgentForURL_unavailable;
 } WKBundlePageLoaderClientV8;
 
 typedef struct WKBundlePageLoaderClientV9 {
@@ -521,7 +520,7 @@
     void *                                                                  willDestroyFrame_unavailable;
 
     // Version 8
-    WKBundlePageUserAgentForURLCallback                                     userAgentForURL;
+    void*                                                                   userAgentForURL_unavailable;
 
     // Version 9
     WKBundlePageWillInjectUserScriptForFrameCallback                        willInjectUserScriptForFrame;
@@ -582,7 +581,7 @@
     void *                                                                  willDestroyFrame_unavailable;
 
     // Version 8
-    WKBundlePageUserAgentForURLCallback                                     userAgentForURL;
+    void*                                                                   userAgentForURL_unavailable;
 
     // Version 9
     WKBundlePageWillInjectUserScriptForFrameCallback                        willInjectUserScriptForFrame;

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm (242374 => 242375)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm	2019-03-04 20:35:54 UTC (rev 242374)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm	2019-03-04 20:36:32 UTC (rev 242375)
@@ -220,23 +220,6 @@
         [loadDelegate webProcessPlugInBrowserContextController:pluginContextController didHandleOnloadEventsForFrame:wrapper(*WebKit::toImpl(frame))];
 }
 
-static WKStringRef userAgentForURL(WKBundleFrameRef frame, WKURLRef url, const void* clientInfo)
-{
-    auto pluginContextController = (__bridge WKWebProcessPlugInBrowserContextController *)clientInfo;
-    auto loadDelegate = pluginContextController->_loadDelegate.get();
-    
-    if ([loadDelegate respondsToSelector:@selector(webProcessPlugInBrowserContextController:frame:userAgentForURL:)]) {
-        WKWebProcessPlugInFrame *newFrame = wrapper(*WebKit::toImpl(frame));
-        NSString *string = [loadDelegate webProcessPlugInBrowserContextController:pluginContextController frame:newFrame userAgentForURL:wrapper(*WebKit::toImpl(url))];
-        if (!string)
-            return nullptr;
-
-        return WKStringCreateWithCFString((__bridge CFStringRef)string);
-    }
-    
-    return nullptr;
-}
-
 static void setUpPageLoaderClient(WKWebProcessPlugInBrowserContextController *contextController, WebKit::WebPage& page)
 {
     WKBundlePageLoaderClientV10 client;
@@ -256,7 +239,6 @@
     client.didRemoveFrameFromHierarchy = didRemoveFrameFromHierarchy;
     client.didHandleOnloadEventsForFrame = didHandleOnloadEventsForFrame;
     client.didFirstVisuallyNonEmptyLayoutForFrame = didFirstVisuallyNonEmptyLayoutForFrame;
-    client.userAgentForURL = userAgentForURL;
 
     client.didLayoutForFrame = didLayoutForFrame;
     client.didLayout = didReachLayoutMilestone;

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp (242374 => 242375)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp	2019-03-04 20:35:54 UTC (rev 242374)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp	2019-03-04 20:36:32 UTC (rev 242375)
@@ -353,16 +353,6 @@
     return m_client.featuresUsedInPage(toAPI(&page), toAPI(API::Array::createStringArray(features).ptr()), m_client.base.clientInfo);
 }
 
-String InjectedBundlePageLoaderClient::userAgentForURL(WebFrame& frame, const URL& url) const
-{
-    if (!m_client.userAgentForURL)
-        return String();
-    WKStringRef userAgent = m_client.userAgentForURL(toAPI(&frame), toAPI(API::URL::create(url).ptr()), m_client.base.clientInfo);
-    if (!userAgent)
-        return String();
-    return toImpl(userAgent)->string();
-}
-
 OptionSet<WebCore::LayoutMilestone> InjectedBundlePageLoaderClient::layoutMilestones() const
 {
     if (m_client.layoutMilestones) {

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h (242374 => 242375)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h	2019-03-04 20:35:54 UTC (rev 242374)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h	2019-03-04 20:36:32 UTC (rev 242375)
@@ -85,8 +85,6 @@
 
     void featuresUsedInPage(WebPage&, const Vector<WTF::String>&) override;
 
-    WTF::String userAgentForURL(WebFrame&, const URL&) const override;
-
     OptionSet<WebCore::LayoutMilestone> layoutMilestones() const override;
 };
 

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (242374 => 242375)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2019-03-04 20:35:54 UTC (rev 242374)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2019-03-04 20:36:32 UTC (rev 242375)
@@ -1370,11 +1370,11 @@
 
 String WebFrameLoaderClient::userAgent(const URL& url)
 {
-    WebPage* webPage = m_frame->page();
+    auto* webPage = m_frame->page();
     if (!webPage)
         return String();
 
-    return webPage->userAgent(m_frame, url);
+    return webPage->userAgent(url);
 }
 
 String WebFrameLoaderClient::overrideContentSecurityPolicy() const

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (242374 => 242375)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-03-04 20:35:54 UTC (rev 242374)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-03-04 20:36:32 UTC (rev 242375)
@@ -3164,23 +3164,12 @@
 
 String WebPage::userAgent(const URL& webCoreURL) const
 {
-    return userAgent(nullptr, webCoreURL);
-}
-
-String WebPage::userAgent(WebFrame* frame, const URL& webcoreURL) const
-{
-    if (frame) {
-        String userAgent = m_loaderClient->userAgentForURL(*frame, webcoreURL);
-        if (!userAgent.isEmpty())
-            return userAgent;
-    }
-
-    String userAgent = platformUserAgent(webcoreURL);
+    String userAgent = platformUserAgent(webCoreURL);
     if (!userAgent.isEmpty())
         return userAgent;
     return m_userAgent;
 }
-    
+
 void WebPage::setUserAgent(const String& userAgent)
 {
     if (m_userAgent == userAgent)

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (242374 => 242375)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2019-03-04 20:35:54 UTC (rev 242374)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2019-03-04 20:36:32 UTC (rev 242375)
@@ -347,7 +347,6 @@
     void didFinishLoad(WebFrame*);
     void show();
     String userAgent(const URL&) const;
-    String userAgent(WebFrame*, const URL&) const;
     String platformUserAgent(const URL&) const;
     WebCore::KeyboardUIMode keyboardUIMode();
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to