Commit 8dbbe83a authored by andersca@apple.com's avatar andersca@apple.com

WKPageLoaderClient should be versioned

https://bugs.webkit.org/show_bug.cgi?id=125104

Reviewed by Sam Weinig.

Add multiple versions of the WKPageLoaderClient struct. In a subsequent patch,
WKPageLoaderClient and kWKPageLoaderClientCurrentVersion will be deprecated. Instead,
users of the API are supposed to explicitly choose a version and a versioned struct.

* Shared/APIClient.h:
Add a new API::Client class with a new ClientTraits template that uses std::tuple for versions.

* Shared/APIClientTraits.cpp:
* Shared/APIClientTraits.h:
Remove WKPageLoaderClient interface sizes.

* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageLoaderClient):
Add an explicit cast to WKPageLoaderClientBase. In an upcoming patch, WKPageSetPageLoaderClient
will be changed to take a WKPageLoaderClientBase instead.

* UIProcess/API/C/WKPageLoaderClient.h:
Add new versions.

* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
(setUpPageLoaderClient):
Use an explicit version.

* UIProcess/WebLoaderClient.cpp:
(WebKit::WebLoaderClient::didStartProvisionalLoadForFrame):
(WebKit::WebLoaderClient::didReceiveServerRedirectForProvisionalLoadForFrame):
(WebKit::WebLoaderClient::didFailProvisionalLoadWithErrorForFrame):
(WebKit::WebLoaderClient::didCommitLoadForFrame):
(WebKit::WebLoaderClient::didFinishDocumentLoadForFrame):
(WebKit::WebLoaderClient::didFinishLoadForFrame):
(WebKit::WebLoaderClient::didFailLoadWithErrorForFrame):
(WebKit::WebLoaderClient::didSameDocumentNavigationForFrame):
(WebKit::WebLoaderClient::didReceiveTitleForFrame):
(WebKit::WebLoaderClient::didFirstLayoutForFrame):
(WebKit::WebLoaderClient::didFirstVisuallyNonEmptyLayoutForFrame):
(WebKit::WebLoaderClient::didLayout):
(WebKit::WebLoaderClient::didRemoveFrameFromHierarchy):
(WebKit::WebLoaderClient::didDisplayInsecureContentForFrame):
(WebKit::WebLoaderClient::didRunInsecureContentForFrame):
(WebKit::WebLoaderClient::didDetectXSSForFrame):
(WebKit::WebLoaderClient::canAuthenticateAgainstProtectionSpaceInFrame):
(WebKit::WebLoaderClient::didReceiveAuthenticationChallengeInFrame):
(WebKit::WebLoaderClient::didStartProgress):
(WebKit::WebLoaderClient::didChangeProgress):
(WebKit::WebLoaderClient::didFinishProgress):
(WebKit::WebLoaderClient::processDidBecomeUnresponsive):
(WebKit::WebLoaderClient::interactionOccurredWhileProcessUnresponsive):
(WebKit::WebLoaderClient::processDidBecomeResponsive):
(WebKit::WebLoaderClient::processDidCrash):
(WebKit::WebLoaderClient::didChangeBackForwardList):
(WebKit::WebLoaderClient::shouldGoToBackForwardListItem):
(WebKit::WebLoaderClient::willGoToBackForwardListItem):
(WebKit::WebLoaderClient::didFailToInitializePlugin):
(WebKit::WebLoaderClient::didBlockInsecurePluginVersion):
(WebKit::WebLoaderClient::pluginLoadPolicy):
Go through client.base everywhere.

* UIProcess/WebLoaderClient.h:
Add API::ClientTraits specialization. Change WebLoaderClient to derive from API::Client<WKPageLoaderClientBase>.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::initializeLoaderClient):
This now takes a WKPageLoaderClientBase*.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159965 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a2b6359f
2013-12-02 Anders Carlsson <andersca@apple.com>
WKPageLoaderClient should be versioned
https://bugs.webkit.org/show_bug.cgi?id=125104
Reviewed by Sam Weinig.
Add multiple versions of the WKPageLoaderClient struct. In a subsequent patch,
WKPageLoaderClient and kWKPageLoaderClientCurrentVersion will be deprecated. Instead,
users of the API are supposed to explicitly choose a version and a versioned struct.
* Shared/APIClient.h:
Add a new API::Client class with a new ClientTraits template that uses std::tuple for versions.
* Shared/APIClientTraits.cpp:
* Shared/APIClientTraits.h:
Remove WKPageLoaderClient interface sizes.
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageLoaderClient):
Add an explicit cast to WKPageLoaderClientBase. In an upcoming patch, WKPageSetPageLoaderClient
will be changed to take a WKPageLoaderClientBase instead.
* UIProcess/API/C/WKPageLoaderClient.h:
Add new versions.
* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
(setUpPageLoaderClient):
Use an explicit version.
* UIProcess/WebLoaderClient.cpp:
(WebKit::WebLoaderClient::didStartProvisionalLoadForFrame):
(WebKit::WebLoaderClient::didReceiveServerRedirectForProvisionalLoadForFrame):
(WebKit::WebLoaderClient::didFailProvisionalLoadWithErrorForFrame):
(WebKit::WebLoaderClient::didCommitLoadForFrame):
(WebKit::WebLoaderClient::didFinishDocumentLoadForFrame):
(WebKit::WebLoaderClient::didFinishLoadForFrame):
(WebKit::WebLoaderClient::didFailLoadWithErrorForFrame):
(WebKit::WebLoaderClient::didSameDocumentNavigationForFrame):
(WebKit::WebLoaderClient::didReceiveTitleForFrame):
(WebKit::WebLoaderClient::didFirstLayoutForFrame):
(WebKit::WebLoaderClient::didFirstVisuallyNonEmptyLayoutForFrame):
(WebKit::WebLoaderClient::didLayout):
(WebKit::WebLoaderClient::didRemoveFrameFromHierarchy):
(WebKit::WebLoaderClient::didDisplayInsecureContentForFrame):
(WebKit::WebLoaderClient::didRunInsecureContentForFrame):
(WebKit::WebLoaderClient::didDetectXSSForFrame):
(WebKit::WebLoaderClient::canAuthenticateAgainstProtectionSpaceInFrame):
(WebKit::WebLoaderClient::didReceiveAuthenticationChallengeInFrame):
(WebKit::WebLoaderClient::didStartProgress):
(WebKit::WebLoaderClient::didChangeProgress):
(WebKit::WebLoaderClient::didFinishProgress):
(WebKit::WebLoaderClient::processDidBecomeUnresponsive):
(WebKit::WebLoaderClient::interactionOccurredWhileProcessUnresponsive):
(WebKit::WebLoaderClient::processDidBecomeResponsive):
(WebKit::WebLoaderClient::processDidCrash):
(WebKit::WebLoaderClient::didChangeBackForwardList):
(WebKit::WebLoaderClient::shouldGoToBackForwardListItem):
(WebKit::WebLoaderClient::willGoToBackForwardListItem):
(WebKit::WebLoaderClient::didFailToInitializePlugin):
(WebKit::WebLoaderClient::didBlockInsecurePluginVersion):
(WebKit::WebLoaderClient::pluginLoadPolicy):
Go through client.base everywhere.
* UIProcess/WebLoaderClient.h:
Add API::ClientTraits specialization. Change WebLoaderClient to derive from API::Client<WKPageLoaderClientBase>.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::initializeLoaderClient):
This now takes a WKPageLoaderClientBase*.
2013-12-02 Beth Dakin <bdakin@apple.com>
Add a setting to opt into a mode where the background extends and fixed elements
......
......@@ -27,6 +27,69 @@
#define APIClient_h
#include "APIClientTraits.h"
#include <array>
// FIXME: Transition all clients from WebKit::APIClient to API::Client.
namespace API {
template<typename ClientInterface> struct ClientTraits;
template<typename ClientInterface> class Client {
typedef typename ClientTraits<ClientInterface>::Versions ClientVersions;
static const int latestClientVersion = std::tuple_size<ClientVersions>::value - 1;
typedef typename std::tuple_element<latestClientVersion, ClientVersions>::type LatestClientInterface;
// Helper class that can return an std::array of element sizes in a tuple.
template<typename> struct InterfaceSizes;
template<typename... Interfaces> struct InterfaceSizes<std::tuple<Interfaces...>> {
static std::array<size_t, sizeof...(Interfaces)> sizes()
{
#if COMPILER(CLANG)
// Workaround for http://llvm.org/bugs/show_bug.cgi?id=18117
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-braces"
#endif
return { sizeof(Interfaces)... };
#if COMPILER(CLANG)
#pragma clang diagnostic pop
#endif
}
};
public:
Client()
{
#if !ASSERT_DISABLED
auto interfaceSizes = InterfaceSizes<ClientVersions>::sizes();
ASSERT(std::is_sorted(interfaceSizes.begin(), interfaceSizes.end()));
#endif
initialize(nullptr);
}
void initialize(const ClientInterface* client)
{
if (client && client->version == latestClientVersion) {
m_client = *reinterpret_cast<const LatestClientInterface*>(client);
return;
}
memset(&m_client, 0, sizeof(m_client));
if (client && client->version < latestClientVersion) {
auto interfaceSizes = InterfaceSizes<ClientVersions>::sizes();
memcpy(&m_client, client, interfaceSizes[client->version]);
}
}
const LatestClientInterface& client() const { return m_client; }
protected:
LatestClientInterface m_client;
};
} // namespace API
namespace WebKit {
......
......@@ -64,13 +64,6 @@ const size_t APIClientTraits<WKPageContextMenuClient>::interfaceSizesByVersion[]
sizeof(WKPageContextMenuClient)
};
const size_t APIClientTraits<WKPageLoaderClient>::interfaceSizesByVersion[] = {
offsetof(WKPageLoaderClient, didDetectXSSForFrame),
offsetof(WKPageLoaderClient, didReceiveIntentForFrame_unavailable),
offsetof(WKPageLoaderClient, pluginLoadPolicy),
sizeof(WKPageLoaderClient)
};
const size_t APIClientTraits<WKPagePolicyClient>::interfaceSizesByVersion[] = {
offsetof(WKPagePolicyClient, decidePolicyForNavigationAction),
sizeof(WKPagePolicyClient)
......
......@@ -64,10 +64,6 @@ template<> struct APIClientTraits<WKPageContextMenuClient> {
static const size_t interfaceSizesByVersion[4];
};
template<> struct APIClientTraits<WKPageLoaderClient> {
static const size_t interfaceSizesByVersion[4];
};
template<> struct APIClientTraits<WKPagePolicyClient> {
static const size_t interfaceSizesByVersion[2];
};
......
......@@ -653,7 +653,7 @@ void WKPageSetPageFormClient(WKPageRef pageRef, const WKPageFormClient* wkClient
void WKPageSetPageLoaderClient(WKPageRef pageRef, const WKPageLoaderClient* wkClient)
{
toImpl(pageRef)->initializeLoaderClient(wkClient);
toImpl(pageRef)->initializeLoaderClient(reinterpret_cast<const WKPageLoaderClientBase*>(wkClient));
}
void WKPageSetPagePolicyClient(WKPageRef pageRef, const WKPagePolicyClient* wkClient)
......
......@@ -72,9 +72,140 @@ typedef void (*WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0)(W
typedef void (*WKPagePluginDidFailCallback_deprecatedForUseWithV1)(WKPageRef page, WKErrorCode errorCode, WKStringRef mimeType, WKStringRef pluginIdentifier, WKStringRef pluginVersion, const void* clientInfo);
typedef WKPluginLoadPolicy (*WKPagePluginLoadPolicyCallback_deprecatedForUseWithV2)(WKPageRef page, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInfoDictionary, const void* clientInfo);
struct WKPageLoaderClient {
typedef struct WKPageLoaderClientBase {
int version;
const void * clientInfo;
} WKPageLoaderClientBase;
typedef struct WKPageLoaderClientV0 {
WKPageLoaderClientBase base;
WKPageDidStartProvisionalLoadForFrameCallback didStartProvisionalLoadForFrame;
WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback didReceiveServerRedirectForProvisionalLoadForFrame;
WKPageDidFailProvisionalLoadWithErrorForFrameCallback didFailProvisionalLoadWithErrorForFrame;
WKPageDidCommitLoadForFrameCallback didCommitLoadForFrame;
WKPageDidFinishDocumentLoadForFrameCallback didFinishDocumentLoadForFrame;
WKPageDidFinishLoadForFrameCallback didFinishLoadForFrame;
WKPageDidFailLoadWithErrorForFrameCallback didFailLoadWithErrorForFrame;
WKPageDidSameDocumentNavigationForFrameCallback didSameDocumentNavigationForFrame;
WKPageDidReceiveTitleForFrameCallback didReceiveTitleForFrame;
WKPageDidFirstLayoutForFrameCallback didFirstLayoutForFrame;
WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback didFirstVisuallyNonEmptyLayoutForFrame;
WKPageDidRemoveFrameFromHierarchyCallback didRemoveFrameFromHierarchy;
WKPageDidDisplayInsecureContentForFrameCallback didDisplayInsecureContentForFrame;
WKPageDidRunInsecureContentForFrameCallback didRunInsecureContentForFrame;
WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback canAuthenticateAgainstProtectionSpaceInFrame;
WKPageDidReceiveAuthenticationChallengeInFrameCallback didReceiveAuthenticationChallengeInFrame;
// FIXME: Move to progress client.
WKPageLoaderClientCallback didStartProgress;
WKPageLoaderClientCallback didChangeProgress;
WKPageLoaderClientCallback didFinishProgress;
// FIXME: These three functions should not be part of this client.
WKPageLoaderClientCallback processDidBecomeUnresponsive;
WKPageLoaderClientCallback processDidBecomeResponsive;
WKPageLoaderClientCallback processDidCrash;
WKPageDidChangeBackForwardListCallback didChangeBackForwardList;
WKPageShouldGoToBackForwardListItemCallback shouldGoToBackForwardListItem;
WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0 didFailToInitializePlugin_deprecatedForUseWithV0;
} WKPageLoaderClientV0;
typedef struct WKPageLoaderClientV1 {
WKPageLoaderClientBase base;
WKPageDidStartProvisionalLoadForFrameCallback didStartProvisionalLoadForFrame;
WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback didReceiveServerRedirectForProvisionalLoadForFrame;
WKPageDidFailProvisionalLoadWithErrorForFrameCallback didFailProvisionalLoadWithErrorForFrame;
WKPageDidCommitLoadForFrameCallback didCommitLoadForFrame;
WKPageDidFinishDocumentLoadForFrameCallback didFinishDocumentLoadForFrame;
WKPageDidFinishLoadForFrameCallback didFinishLoadForFrame;
WKPageDidFailLoadWithErrorForFrameCallback didFailLoadWithErrorForFrame;
WKPageDidSameDocumentNavigationForFrameCallback didSameDocumentNavigationForFrame;
WKPageDidReceiveTitleForFrameCallback didReceiveTitleForFrame;
WKPageDidFirstLayoutForFrameCallback didFirstLayoutForFrame;
WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback didFirstVisuallyNonEmptyLayoutForFrame;
WKPageDidRemoveFrameFromHierarchyCallback didRemoveFrameFromHierarchy;
WKPageDidDisplayInsecureContentForFrameCallback didDisplayInsecureContentForFrame;
WKPageDidRunInsecureContentForFrameCallback didRunInsecureContentForFrame;
WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback canAuthenticateAgainstProtectionSpaceInFrame;
WKPageDidReceiveAuthenticationChallengeInFrameCallback didReceiveAuthenticationChallengeInFrame;
// FIXME: Move to progress client.
WKPageLoaderClientCallback didStartProgress;
WKPageLoaderClientCallback didChangeProgress;
WKPageLoaderClientCallback didFinishProgress;
// FIXME: These three functions should not be part of this client.
WKPageLoaderClientCallback processDidBecomeUnresponsive;
WKPageLoaderClientCallback processDidBecomeResponsive;
WKPageLoaderClientCallback processDidCrash;
WKPageDidChangeBackForwardListCallback didChangeBackForwardList;
WKPageShouldGoToBackForwardListItemCallback shouldGoToBackForwardListItem;
WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0 didFailToInitializePlugin_deprecatedForUseWithV0;
// Version 1
WKPageDidDetectXSSForFrameCallback didDetectXSSForFrame;
void* didNewFirstVisuallyNonEmptyLayout_unavailable;
WKPageWillGoToBackForwardListItemCallback willGoToBackForwardListItem;
WKPageLoaderClientCallback interactionOccurredWhileProcessUnresponsive;
WKPagePluginDidFailCallback_deprecatedForUseWithV1 pluginDidFail_deprecatedForUseWithV1;
} WKPageLoaderClientV1;
typedef struct WKPageLoaderClientV2 {
WKPageLoaderClientBase base;
WKPageDidStartProvisionalLoadForFrameCallback didStartProvisionalLoadForFrame;
WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback didReceiveServerRedirectForProvisionalLoadForFrame;
WKPageDidFailProvisionalLoadWithErrorForFrameCallback didFailProvisionalLoadWithErrorForFrame;
WKPageDidCommitLoadForFrameCallback didCommitLoadForFrame;
WKPageDidFinishDocumentLoadForFrameCallback didFinishDocumentLoadForFrame;
WKPageDidFinishLoadForFrameCallback didFinishLoadForFrame;
WKPageDidFailLoadWithErrorForFrameCallback didFailLoadWithErrorForFrame;
WKPageDidSameDocumentNavigationForFrameCallback didSameDocumentNavigationForFrame;
WKPageDidReceiveTitleForFrameCallback didReceiveTitleForFrame;
WKPageDidFirstLayoutForFrameCallback didFirstLayoutForFrame;
WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback didFirstVisuallyNonEmptyLayoutForFrame;
WKPageDidRemoveFrameFromHierarchyCallback didRemoveFrameFromHierarchy;
WKPageDidDisplayInsecureContentForFrameCallback didDisplayInsecureContentForFrame;
WKPageDidRunInsecureContentForFrameCallback didRunInsecureContentForFrame;
WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback canAuthenticateAgainstProtectionSpaceInFrame;
WKPageDidReceiveAuthenticationChallengeInFrameCallback didReceiveAuthenticationChallengeInFrame;
// FIXME: Move to progress client.
WKPageLoaderClientCallback didStartProgress;
WKPageLoaderClientCallback didChangeProgress;
WKPageLoaderClientCallback didFinishProgress;
// FIXME: These three functions should not be part of this client.
WKPageLoaderClientCallback processDidBecomeUnresponsive;
WKPageLoaderClientCallback processDidBecomeResponsive;
WKPageLoaderClientCallback processDidCrash;
WKPageDidChangeBackForwardListCallback didChangeBackForwardList;
WKPageShouldGoToBackForwardListItemCallback shouldGoToBackForwardListItem;
WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0 didFailToInitializePlugin_deprecatedForUseWithV0;
// Version 1
WKPageDidDetectXSSForFrameCallback didDetectXSSForFrame;
void* didNewFirstVisuallyNonEmptyLayout_unavailable;
WKPageWillGoToBackForwardListItemCallback willGoToBackForwardListItem;
WKPageLoaderClientCallback interactionOccurredWhileProcessUnresponsive;
WKPagePluginDidFailCallback_deprecatedForUseWithV1 pluginDidFail_deprecatedForUseWithV1;
// Version 2
void (*didReceiveIntentForFrame_unavailable)(void);
void (*registerIntentServiceForFrame_unavailable)(void);
WKPageDidLayoutCallback didLayout;
WKPagePluginLoadPolicyCallback_deprecatedForUseWithV2 pluginLoadPolicy_deprecatedForUseWithV2;
WKPagePluginDidFailCallback pluginDidFail;
} WKPageLoaderClientV2;
typedef struct WKPageLoaderClientV3 {
WKPageLoaderClientBase base;
WKPageDidStartProvisionalLoadForFrameCallback didStartProvisionalLoadForFrame;
WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback didReceiveServerRedirectForProvisionalLoadForFrame;
WKPageDidFailProvisionalLoadWithErrorForFrameCallback didFailProvisionalLoadWithErrorForFrame;
......@@ -125,11 +256,64 @@ struct WKPageLoaderClient {
// Version 3
WKPagePluginLoadPolicyCallback pluginLoadPolicy;
};
typedef struct WKPageLoaderClient WKPageLoaderClient;
} WKPageLoaderClientV3;
// FIXME: These should be deprecated.
enum { kWKPageLoaderClientCurrentVersion = 3 };
typedef struct WKPageLoaderClient {
int version;
const void * clientInfo;
WKPageDidStartProvisionalLoadForFrameCallback didStartProvisionalLoadForFrame;
WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback didReceiveServerRedirectForProvisionalLoadForFrame;
WKPageDidFailProvisionalLoadWithErrorForFrameCallback didFailProvisionalLoadWithErrorForFrame;
WKPageDidCommitLoadForFrameCallback didCommitLoadForFrame;
WKPageDidFinishDocumentLoadForFrameCallback didFinishDocumentLoadForFrame;
WKPageDidFinishLoadForFrameCallback didFinishLoadForFrame;
WKPageDidFailLoadWithErrorForFrameCallback didFailLoadWithErrorForFrame;
WKPageDidSameDocumentNavigationForFrameCallback didSameDocumentNavigationForFrame;
WKPageDidReceiveTitleForFrameCallback didReceiveTitleForFrame;
WKPageDidFirstLayoutForFrameCallback didFirstLayoutForFrame;
WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback didFirstVisuallyNonEmptyLayoutForFrame;
WKPageDidRemoveFrameFromHierarchyCallback didRemoveFrameFromHierarchy;
WKPageDidDisplayInsecureContentForFrameCallback didDisplayInsecureContentForFrame;
WKPageDidRunInsecureContentForFrameCallback didRunInsecureContentForFrame;
WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback canAuthenticateAgainstProtectionSpaceInFrame;
WKPageDidReceiveAuthenticationChallengeInFrameCallback didReceiveAuthenticationChallengeInFrame;
// FIXME: Move to progress client.
WKPageLoaderClientCallback didStartProgress;
WKPageLoaderClientCallback didChangeProgress;
WKPageLoaderClientCallback didFinishProgress;
// FIXME: These three functions should not be part of this client.
WKPageLoaderClientCallback processDidBecomeUnresponsive;
WKPageLoaderClientCallback processDidBecomeResponsive;
WKPageLoaderClientCallback processDidCrash;
WKPageDidChangeBackForwardListCallback didChangeBackForwardList;
WKPageShouldGoToBackForwardListItemCallback shouldGoToBackForwardListItem;
WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0 didFailToInitializePlugin_deprecatedForUseWithV0;
// Version 1
WKPageDidDetectXSSForFrameCallback didDetectXSSForFrame;
void* didNewFirstVisuallyNonEmptyLayout_unavailable;
WKPageWillGoToBackForwardListItemCallback willGoToBackForwardListItem;
WKPageLoaderClientCallback interactionOccurredWhileProcessUnresponsive;
WKPagePluginDidFailCallback_deprecatedForUseWithV1 pluginDidFail_deprecatedForUseWithV1;
// Version 2
void (*didReceiveIntentForFrame_unavailable)(void);
void (*registerIntentServiceForFrame_unavailable)(void);
WKPageDidLayoutCallback didLayout;
WKPagePluginLoadPolicyCallback_deprecatedForUseWithV2 pluginLoadPolicy_deprecatedForUseWithV2;
WKPagePluginDidFailCallback pluginDidFail;
// Version 3
WKPagePluginLoadPolicyCallback pluginLoadPolicy;
} WKPageLoaderClient;
#ifdef __cplusplus
}
......
......@@ -435,11 +435,11 @@ static void didChangeBackForwardList(WKPageRef page, WKBackForwardListItemRef ad
static void setUpPageLoaderClient(WKBrowsingContextController *browsingContext, WebPageProxy& page)
{
WKPageLoaderClient loaderClient;
WKPageLoaderClientV3 loaderClient;
memset(&loaderClient, 0, sizeof(loaderClient));
loaderClient.version = kWKPageLoaderClientCurrentVersion;
loaderClient.clientInfo = browsingContext;
loaderClient.base.version = 3;
loaderClient.base.clientInfo = browsingContext;
loaderClient.didStartProvisionalLoadForFrame = didStartProvisionalLoadForFrame;
loaderClient.didReceiveServerRedirectForProvisionalLoadForFrame = didReceiveServerRedirectForProvisionalLoadForFrame;
loaderClient.didFailProvisionalLoadWithErrorForFrame = didFailProvisionalLoadWithErrorForFrame;
......@@ -452,7 +452,7 @@ static void setUpPageLoaderClient(WKBrowsingContextController *browsingContext,
loaderClient.didFinishProgress = didFinishProgress;
loaderClient.didChangeBackForwardList = didChangeBackForwardList;
page.initializeLoaderClient(&loaderClient);
page.initializeLoaderClient(&loaderClient.base);
}
static WKPolicyDecisionHandler makePolicyDecisionBlock(WKFramePolicyListenerRef listener)
......
......@@ -43,7 +43,7 @@ void WebLoaderClient::didStartProvisionalLoadForFrame(WebPageProxy* page, WebFra
if (!m_client.didStartProvisionalLoadForFrame)
return;
m_client.didStartProvisionalLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
m_client.didStartProvisionalLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.base.clientInfo);
}
void WebLoaderClient::didReceiveServerRedirectForProvisionalLoadForFrame(WebPageProxy* page, WebFrameProxy* frame, API::Object* userData)
......@@ -51,7 +51,7 @@ void WebLoaderClient::didReceiveServerRedirectForProvisionalLoadForFrame(WebPage
if (!m_client.didReceiveServerRedirectForProvisionalLoadForFrame)
return;
m_client.didReceiveServerRedirectForProvisionalLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
m_client.didReceiveServerRedirectForProvisionalLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.base.clientInfo);
}
void WebLoaderClient::didFailProvisionalLoadWithErrorForFrame(WebPageProxy* page, WebFrameProxy* frame, const ResourceError& error, API::Object* userData)
......@@ -59,7 +59,7 @@ void WebLoaderClient::didFailProvisionalLoadWithErrorForFrame(WebPageProxy* page
if (!m_client.didFailProvisionalLoadWithErrorForFrame)
return;
m_client.didFailProvisionalLoadWithErrorForFrame(toAPI(page), toAPI(frame), toAPI(error), toAPI(userData), m_client.clientInfo);
m_client.didFailProvisionalLoadWithErrorForFrame(toAPI(page), toAPI(frame), toAPI(error), toAPI(userData), m_client.base.clientInfo);
}
void WebLoaderClient::didCommitLoadForFrame(WebPageProxy* page, WebFrameProxy* frame, API::Object* userData)
......@@ -67,7 +67,7 @@ void WebLoaderClient::didCommitLoadForFrame(WebPageProxy* page, WebFrameProxy* f
if (!m_client.didCommitLoadForFrame)
return;
m_client.didCommitLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
m_client.didCommitLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.base.clientInfo);
}
void WebLoaderClient::didFinishDocumentLoadForFrame(WebPageProxy* page, WebFrameProxy* frame, API::Object* userData)
......@@ -75,7 +75,7 @@ void WebLoaderClient::didFinishDocumentLoadForFrame(WebPageProxy* page, WebFrame
if (!m_client.didFinishDocumentLoadForFrame)
return;
m_client.didFinishDocumentLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
m_client.didFinishDocumentLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.base.clientInfo);
}
void WebLoaderClient::didFinishLoadForFrame(WebPageProxy* page, WebFrameProxy* frame, API::Object* userData)
......@@ -83,7 +83,7 @@ void WebLoaderClient::didFinishLoadForFrame(WebPageProxy* page, WebFrameProxy* f
if (!m_client.didFinishLoadForFrame)
return;
m_client.didFinishLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
m_client.didFinishLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.base.clientInfo);
}
void WebLoaderClient::didFailLoadWithErrorForFrame(WebPageProxy* page, WebFrameProxy* frame, const ResourceError& error, API::Object* userData)
......@@ -91,7 +91,7 @@ void WebLoaderClient::didFailLoadWithErrorForFrame(WebPageProxy* page, WebFrameP
if (!m_client.didFailLoadWithErrorForFrame)
return;
m_client.didFailLoadWithErrorForFrame(toAPI(page), toAPI(frame), toAPI(error), toAPI(userData), m_client.clientInfo);
m_client.didFailLoadWithErrorForFrame(toAPI(page), toAPI(frame), toAPI(error), toAPI(userData), m_client.base.clientInfo);
}
void WebLoaderClient::didSameDocumentNavigationForFrame(WebPageProxy* page, WebFrameProxy* frame, SameDocumentNavigationType type, API::Object* userData)
......@@ -99,7 +99,7 @@ void WebLoaderClient::didSameDocumentNavigationForFrame(WebPageProxy* page, WebF
if (!m_client.didSameDocumentNavigationForFrame)
return;
m_client.didSameDocumentNavigationForFrame(toAPI(page), toAPI(frame), toAPI(type), toAPI(userData), m_client.clientInfo);
m_client.didSameDocumentNavigationForFrame(toAPI(page), toAPI(frame), toAPI(type), toAPI(userData), m_client.base.clientInfo);
}
void WebLoaderClient::didReceiveTitleForFrame(WebPageProxy* page, const String& title, WebFrameProxy* frame, API::Object* userData)
......@@ -107,7 +107,7 @@ void WebLoaderClient::didReceiveTitleForFrame(WebPageProxy* page, const String&
if (!m_client.didReceiveTitleForFrame)
return;
m_client.didReceiveTitleForFrame(toAPI(page), toAPI(title.impl()), toAPI(frame), toAPI(userData), m_client.clientInfo);
m_client.didReceiveTitleForFrame(toAPI(page), toAPI(title.impl()), toAPI(frame), toAPI(userData), m_client.base.clientInfo);
}
void WebLoaderClient::didFirstLayoutForFrame(WebPageProxy* page, WebFrameProxy* frame, API::Object* userData)
......@@ -115,7 +115,7 @@ void WebLoaderClient::didFirstLayoutForFrame(WebPageProxy* page, WebFrameProxy*
if (!m_client.didFirstLayoutForFrame)
return;
m_client.didFirstLayoutForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
m_client.didFirstLayoutForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.base.clientInfo);
}
void WebLoaderClient::didFirstVisuallyNonEmptyLayoutForFrame(WebPageProxy* page, WebFrameProxy* frame, API::Object* userData)
......@@ -123,7 +123,7 @@ void WebLoaderClient::didFirstVisuallyNonEmptyLayoutForFrame(WebPageProxy* page,
if (!m_client.didFirstVisuallyNonEmptyLayoutForFrame)
return;
m_client.didFirstVisuallyNonEmptyLayoutForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
m_client.didFirstVisuallyNonEmptyLayoutForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.base.clientInfo);
}
void WebLoaderClient::didLayout(WebPageProxy* page, LayoutMilestones milestones, API::Object* userData)
......@@ -131,7 +131,7 @@ void WebLoaderClient::didLayout(WebPageProxy* page, LayoutMilestones milestones,
if (!m_client.didLayout)
return;
m_client.didLayout(toAPI(page), toWKLayoutMilestones(milestones), toAPI(userData), m_client.clientInfo);
m_client.didLayout(toAPI(page), toWKLayoutMilestones(milestones), toAPI(userData), m_client.base.clientInfo);
}
void WebLoaderClient::didRemoveFrameFromHierarchy(WebPageProxy* page, WebFrameProxy* frame, API::Object* userData)
......@@ -139,7 +139,7 @@ void WebLoaderClient::didRemoveFrameFromHierarchy(WebPageProxy* page, WebFramePr
if (!m_client.didRemoveFrameFromHierarchy)
return;
m_client.didRemoveFrameFromHierarchy(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
m_client.didRemoveFrameFromHierarchy(toAPI(page), toAPI(frame), toAPI(userData), m_client.base.clientInfo);
}
void WebLoaderClient::didDisplayInsecureContentForFrame(WebPageProxy* page, WebFrameProxy* frame, API::Object* userData)
......@@ -147,7 +147,7 @@ void WebLoaderClient::didDisplayInsecureContentForFrame(WebPageProxy* page, WebF
if (!m_client.didDisplayInsecureContentForFrame)
return;
m_client.didDisplayInsecureContentForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
m_client.didDisplayInsecureContentForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.base.clientInfo);
}
void WebLoaderClient::didRunInsecureContentForFrame(WebPageProxy* page, WebFrameProxy* frame, API::Object* userData)
......@@ -155,7 +155,7 @@ void WebLoaderClient::didRunInsecureContentForFrame(WebPageProxy* page, WebFrame
if (!m_client.didRunInsecureContentForFrame)
return;
m_client.didRunInsecureContentForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
m_client.didRunInsecureContentForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.base.clientInfo);
}
void WebLoaderClient::didDetectXSSForFrame(WebPageProxy* page, WebFrameProxy* frame, API::Object* userData)
......@@ -163,7 +163,7 @@ void WebLoaderClient::didDetectXSSForFrame(WebPageProxy* page, WebFrameProxy* fr
if (!m_client.didDetectXSSForFrame)
return;
m_client.didDetectXSSForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
m_client.didDetectXSSForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.base.clientInfo);
}
bool WebLoaderClient::canAuthenticateAgainstProtectionSpaceInFrame(WebPageProxy* page, WebFrameProxy* frame, WebProtectionSpace* protectionSpace)
......@@ -171,7 +171,7 @@ bool WebLoaderClient::canAuthenticateAgainstProtectionSpaceInFrame(WebPageProxy*
if (!m_client.canAuthenticateAgainstProtectionSpaceInFrame)
return false;
return m_client.canAuthenticateAgainstProtectionSpaceInFrame(toAPI(page), toAPI(frame), toAPI(protectionSpace), m_client.clientInfo);
return m_client.canAuthenticateAgainstProtectionSpaceInFrame(toAPI(page), toAPI(frame), toAPI(protectionSpace), m_client.base.clientInfo);
}
void WebLoaderClient::didReceiveAuthenticationChallengeInFrame(WebPageProxy* page, WebFrameProxy* frame, AuthenticationChallengeProxy* authenticationChallenge)
......@@ -179,7 +179,7 @@ void WebLoaderClient::didReceiveAuthenticationChallengeInFrame(WebPageProxy* pag
if (!m_client.didReceiveAuthenticationChallengeInFrame)
return;
m_client.didReceiveAuthenticationChallengeInFrame(toAPI(page), toAPI(frame), toAPI(authenticationChallenge), m_client.clientInfo);
m_client.didReceiveAuthenticationChallengeInFrame(toAPI(page), toAPI(frame), toAPI(authenticationChallenge), m_client.base.clientInfo);
}
void WebLoaderClient::didStartProgress(WebPageProxy* page)
......@@ -187,7 +187,7 @@ void WebLoaderClient::didStartProgress(WebPageProxy* page)
if (!m_client.didStartProgress)
return;
m_client.didStartProgress(toAPI(page), m_client.clientInfo);
m_client.didStartProgress(toAPI(page), m_client.base.clientInfo);
}
void WebLoaderClient::didChangeProgress(WebPageProxy* page)
......@@ -195,7 +195,7 @@ void WebLoaderClient::didChangeProgress(WebPageProxy* page)
if (!m_client.didChangeProgress)
return;
m_client.didChangeProgress(toAPI(page), m_client.clientInfo);
m_client.didChangeProgress(toAPI(page), m_client.base.clientInfo);
}
void WebLoaderClient::didFinishProgress(WebPageProxy* page)
......@@ -203,7 +203,7 @@ void WebLoaderClient::didFinishProgress(WebPageProxy* page)
if (!m_client.didFinishProgress)
return;
m_client.didFinishProgress(toAPI(page), m_client.clientInfo);
m_client.didFinishProgress(toAPI(page), m_client.base.clientInfo);
}
void WebLoaderClient::processDidBecomeUnresponsive(WebPageProxy* page)
......@@ -211,7 +211,7 @@ void WebLoaderClient::processDidBecomeUnresponsive(WebPageProxy* page)
if (!m_client.processDidBecomeUnresponsive)
return;
m_client.processDidBecomeUnresponsive(toAPI(page), m_client.clientInfo);
m_client.processDidBecomeUnresponsive(toAPI(page), m_client.base.clientInfo);
}
void WebLoaderClient::interactionOccurredWhileProcessUnresponsive(WebPageProxy* page)
......@@ -219,7 +219,7 @@ void WebLoaderClient::interactionOccurredWhileProcessUnresponsive(WebPageProxy*
if (!m_client.interactionOccurredWhileProcessUnresponsive)
return;
m_client.interactionOccurredWhileProcessUnresponsive(toAPI(page), m_client.clientInfo);
m_client.interactionOccurredWhileProcessUnresponsive(toAPI(page), m_client.base.clientInfo);
}
void WebLoaderClient::processDidBecomeResponsive(WebPageProxy* page)
......@@ -227,7 +227,7 @@ void WebLoaderClient::processDidBecomeResponsive(WebPageProxy* page)
if (!m_client.processDidBecomeResponsive)
return;
m_client.processDidBecomeResponsive(toAPI(page), m_client.clientInfo);
m_client.processDidBecomeResponsive(toAPI(page), m_client.base.clientInfo);