WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
patch
patch.txt (text/plain), 15.03 KB, created by
Grant Kennell
on 2014-06-10 17:52:17 PDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Grant Kennell
Created:
2014-06-10 17:52:17 PDT
Size:
15.03 KB
patch
obsolete
>commit 515fbb4194668142be67a826fcb423241147ae1c >Author: Grant Kennell <gkennell@apple.com> >Date: Thu Jun 5 15:59:45 2014 -0700 > > Add SPI for Injected Bundle to provide user agent for a given URL > > https://bugs.webkit.org/show_bug.cgi?id=133562 > > Reviewed by NOBODY (OOPS!). > > * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h: > Added delegate method to WebProcess PluIn protocol to provide UserAgent per URL. > * WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h: > Added new typedef for function pointer for this new delegate call > and added a function pointer of that type to the struct. > * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: > (userAgentForURL): Makes delegate call with the new method. > (setUpPageLoaderClient): Sets the struct's new function pointer to the new method. > * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: > (WebKit::InjectedBundlePageLoaderClient::userAgentForURL): > * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: > * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: > (WebKit::WebFrameLoaderClient::userAgent): > * WebProcess/WebPage/WebPage.cpp: > (WebKit::WebPage::userAgent): Began using the new API to ask for user agent > instead of simply returning what had been stored. > * WebProcess/WebPage/WebPage.h: > (WebKit::WebPage::userAgent): Deleted. > >diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog >index 48bf75c..fee8677 100644 >--- a/Source/WebKit2/ChangeLog >+++ b/Source/WebKit2/ChangeLog >@@ -432,6 +432,32 @@ > * Resources/PlugInSandboxProfiles/com.apple.ist.ds.appleconnect.webplugin.sb: > * Resources/PlugInSandboxProfiles/com.microsoft.SilverlightPlugin.sb: > >+2014-06-05 Grant Kennell <gkennell@apple.com> >+ >+ Add SPI for Injected Bundle to provide user agent for a given URL. >+ https://bugs.webkit.org/show_bug.cgi?id=133562 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h: >+ Added delegate method to WebProcess PluIn protocol to provide UserAgent per URL. >+ * WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h: >+ Added new typedef for function pointer for this new delegate call >+ and added a function pointer of that type to the struct. >+ * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: >+ (userAgentForURL): Makes delegate call with the new method. >+ (setUpPageLoaderClient): Sets the struct's new function pointer to the new method. >+ * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: >+ (WebKit::InjectedBundlePageLoaderClient::userAgentForURL): >+ * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: >+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: >+ (WebKit::WebFrameLoaderClient::userAgent): >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::WebPage::userAgent): Began using the new API to ask for user agent >+ instead of simply returning what had been stored. >+ * WebProcess/WebPage/WebPage.h: >+ (WebKit::WebPage::userAgent): Deleted. >+ > 2014-06-05 Tanay C <tanay.c@samsung.com> > > Resolve compiler error (call of overloaded 'schedule' function is ambiguous) >diff --git a/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm b/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm >index 21da98c..ae73fde 100644 >--- a/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm >+++ b/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm >@@ -439,7 +439,7 @@ static int32_t deviceOrientation() > { > uint64_t navigationID = _page->reload(false); > ASSERT(navigationID); >- >+ > auto navigation = _navigationState->createReloadNavigation(navigationID); > return [navigation.leakRef() autorelease]; > } >diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h >index 44b7166..bf811e6 100644 >--- a/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h >+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h >@@ -57,4 +57,7 @@ > - (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 >diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h >index 63cc69c..541d6b6 100644 >--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h >+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h >@@ -62,6 +62,7 @@ typedef void (*WKBundlePageFeaturesUsedInPageCallback)(WKBundlePageRef page, WKA > 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 void (*WKBundlePageWillDestroyFrame)(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo); >+typedef WKStringRef (*WKBundlePageUserAgentForURLCallback)(WKBundleFrameRef frame, WKURLRef url, const void *clientInfo); > > typedef struct WKBundlePageLoaderClientBase { > int version; >@@ -404,6 +405,7 @@ typedef struct WKBundlePageLoaderClientV7 { > > // Version 7 > WKBundlePageWillDestroyFrame willDestroyFrame; >+ WKBundlePageUserAgentForURLCallback userAgentForURL; > } WKBundlePageLoaderClientV7; > > enum { kWKBundlePageLoaderClientCurrentVersion WK_ENUM_DEPRECATED("Use an explicit version number instead") = 7 }; >@@ -461,6 +463,7 @@ typedef struct WKBundlePageLoaderClient { > > // Version 7 > WKBundlePageWillDestroyFrame willDestroyFrame; >+ WKBundlePageUserAgentForURLCallback userAgentForURL; > } WKBundlePageLoaderClient WK_DEPRECATED("Use an explicit versioned struct instead"); > > #endif // WKBundlePageLoaderClient_h >diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm >index 4e732b0..0d02837 100644 >--- a/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm >+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm >@@ -38,8 +38,11 @@ > #import "WKDOMInternals.h" > #import "WKNSDictionary.h" > #import "WKNSError.h" >+#import "WKNSString.h" >+#import "WKNSURL.h" > #import "WKRenderingProgressEventsInternal.h" > #import "WKRetainPtr.h" >+#import "WKStringCF.h" > #import "WKURLRequestNS.h" > #import "WKWebProcessPluginFrameInternal.h" > #import "WKWebProcessPlugInInternal.h" >@@ -175,6 +178,22 @@ static void didHandleOnloadEventsForFrame(WKBundlePageRef page, WKBundleFrameRef > if ([loadDelegate respondsToSelector:@selector(webProcessPlugInBrowserContextController:didHandleOnloadEventsForFrame:)]) > [loadDelegate webProcessPlugInBrowserContextController:pluginContextController didHandleOnloadEventsForFrame:wrapper(*toImpl(frame))]; > } >+ >+static WKStringRef userAgentForURL(WKBundleFrameRef frame, WKURLRef url, const void* clientInfo) >+{ >+ WKWebProcessPlugInBrowserContextController *pluginContextController = (WKWebProcessPlugInBrowserContextController *)clientInfo; >+ auto loadDelegate = pluginContextController->_loadDelegate.get(); >+ >+ if ([loadDelegate respondsToSelector:@selector(webProcessPlugInBrowserContextController:frame:userAgentForURL:)]) { >+ WKWebProcessPlugInFrame *newFrame = wrapper(*toImpl(frame)); >+ NSString *string = [loadDelegate webProcessPlugInBrowserContextController:pluginContextController frame:newFrame userAgentForURL:wrapper(*toImpl(url))]; >+ WKStringRef wkString = WKStringCreateWithCFString((CFStringRef)string); >+ return wkString; >+ } >+ >+ return nullptr; >+} >+ > static void setUpPageLoaderClient(WKWebProcessPlugInBrowserContextController *contextController, WebPage& page) > { > WKBundlePageLoaderClientV7 client; >@@ -192,7 +211,8 @@ static void setUpPageLoaderClient(WKWebProcessPlugInBrowserContextController *co > client.didRemoveFrameFromHierarchy = didRemoveFrameFromHierarchy; > client.didHandleOnloadEventsForFrame = didHandleOnloadEventsForFrame; > client.didFirstVisuallyNonEmptyLayoutForFrame = didFirstVisuallyNonEmptyLayoutForFrame; >- >+ client.userAgentForURL = userAgentForURL; >+ > client.didLayoutForFrame = didLayoutForFrame; > client.didLayout = didLayout; > >diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp >index 47f3264..2112419 100644 >--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp >+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp >@@ -29,14 +29,18 @@ > #include "APIArray.h" > #include "APIData.h" > #include "APIError.h" >+#include "APIURL.h" > #include "APIURLRequest.h" > #include "InjectedBundleDOMWindowExtension.h" > #include "InjectedBundleScriptWorld.h" > #include "WKAPICast.h" > #include "WKBundleAPICast.h" >+#include "WKSharedAPICast.h" > #include <WebCore/SharedBuffer.h> >+#include <WebCore/FileSystem.h> > #include <wtf/text/WTFString.h> > >+ > using namespace WebCore; > > namespace WebKit { >@@ -351,5 +355,14 @@ void InjectedBundlePageLoaderClient::willDestroyFrame(WebPage* page, WebFrame* f > > m_client.willDestroyFrame(toAPI(page), toAPI(frame), m_client.base.clientInfo); > } >- >+ >+API::String* InjectedBundlePageLoaderClient::userAgentForURL(WebFrame* frame, API::String* urlString) >+{ >+ if (!m_client.userAgentForURL) >+ return nullptr; >+ RefPtr<API::URL> url = API::URL::create(urlString->string()); >+ WKStringRef userAgent = m_client.userAgentForURL(toAPI(frame), toAPI(url.get()), m_client.base.clientInfo); >+ return toImpl(userAgent); >+} >+ > } // namespace WebKit >diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h >index ae2b950..5185109 100644 >--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h >+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h >@@ -27,6 +27,7 @@ > #define InjectedBundlePageLoaderClient_h > > #include "APIClient.h" >+#include "APIString.h" > #include "SameDocumentNavigationType.h" > #include "WKBundlePage.h" > #include <JavaScriptCore/JSBase.h> >@@ -99,6 +100,8 @@ public: > void featuresUsedInPage(WebPage*, const Vector<String>&); > > void willDestroyFrame(WebPage*, WebFrame*); >+ API::String* userAgentForURL(WebFrame*, API::String*); >+ > }; > > } // namespace WebKit >diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp >index 0c36f95..8c094f0 100644 >--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp >+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp >@@ -51,6 +51,7 @@ > #include "WebPageProxyMessages.h" > #include "WebProcess.h" > #include "WebProcessProxyMessages.h" >+#include "WKBundleAPICast.h" > #include <JavaScriptCore/APICast.h> > #include <JavaScriptCore/JSObject.h> > #include <WebCore/CertificateInfo.h> >@@ -1181,13 +1182,13 @@ void WebFrameLoaderClient::setTitle(const StringWithDirection& title, const URL& > title.string(), url.string(), m_frame->frameID()), 0); > } > >-String WebFrameLoaderClient::userAgent(const URL&) >+String WebFrameLoaderClient::userAgent(const URL& url) > { > WebPage* webPage = m_frame->page(); > if (!webPage) > return String(); > >- return webPage->userAgent(); >+ return webPage->userAgent(m_frame, url); > } > > void WebFrameLoaderClient::savePlatformDataToCachedFrame(CachedFrame*) >diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp >index 666f52c..cc03e3b 100644 >--- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp >@@ -55,7 +55,10 @@ > #include "ShareableBitmap.h" > #include "TelephoneNumberOverlayController.h" > #include "VisitedLinkTableController.h" >+#include "WKBundleAPICast.h" >+#include "WKRetainPtr.h" > #include "WKSharedAPICast.h" >+#include "WKStringCF.h" > #include "WebAlternativeTextClient.h" > #include "WebBackForwardListItem.h" > #include "WebBackForwardListProxy.h" >@@ -2278,6 +2281,18 @@ void WebPage::show() > send(Messages::WebPageProxy::ShowPage()); > } > >+String WebPage::userAgent(WebFrame *frame, const URL& webcoreURL) const >+{ >+ if (m_loaderClient.client().userAgentForURL) { >+ RefPtr<API::URL> url = API::URL::create(webcoreURL); >+ WKRetainPtr<WKStringRef> string = adoptWK(m_loaderClient.client().userAgentForURL(toAPI(frame), toAPI(url.get()), m_loaderClient.client().base.clientInfo)); >+ API::String *apiString = toImpl(string.get()); >+ return apiString->string(); >+ } >+ >+ return m_userAgent; >+} >+ > void WebPage::setUserAgent(const String& userAgent) > { > m_userAgent = userAgent; >diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h >index 0ba7901..bd0f831d 100644 >--- a/Source/WebKit2/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h >@@ -252,7 +252,9 @@ public: > void didFinishDocumentLoad(WebFrame*); > void didFinishLoad(WebFrame*); > void show(); >- String userAgent() const { return m_userAgent; } >+ >+ String userAgent(WebFrame*, const WebCore::URL&) const; >+ > WebCore::IntRect windowResizerRect() const; > WebCore::KeyboardUIMode keyboardUIMode(); > >diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp >index dbfcc0c..3ef422b 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp >+++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp >@@ -305,6 +305,7 @@ InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page) > 0, // willLoadURLRequest > 0, // willLoadDataRequest > 0, // willDestroyFrame >+ 0, // userAgentForURL > }; > WKBundlePageSetPageLoaderClient(m_page, &loaderClient.base); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 133562
:
232594
|
232622
|
232835
|
232869
|
233063
|
233078
|
233272
|
233467
|
233480
|
233641