TEST(WebKit2, PrivateBrowsingPushStateNoHistoryCallback) { WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate()); WKContextHistoryClient historyClient; memset(&historyClient, 0, sizeof(historyClient)); historyClient.version = 0; historyClient.clientInfo = 0; historyClient.didNavigateWithNavigationData = didNavigateWithNavigationData; WKContextSetHistoryClient(context.get(), &historyClient); PlatformWebView webView(context.get()); WKPageLoaderClient pageLoaderClient; memset(&pageLoaderClient, 0, sizeof(pageLoaderClient)); pageLoaderClient.version = 0; pageLoaderClient.clientInfo = 0; pageLoaderClient.didSameDocumentNavigationForFrame = didSameDocumentNavigationForFrame; WKPageSetPageLoaderClient(webView.page(), &pageLoaderClient); WKRetainPtr<WKPreferencesRef> preferences(AdoptWK, WKPreferencesCreate()); WKPreferencesSetPrivateBrowsingEnabled(preferences.get(), true); WKPageGroupRef pageGroup = WKPageGetPageGroup(webView.page()); WKPageGroupSetPreferences(pageGroup, preferences.get()); WKRetainPtr<WKURLRef> url(AdoptWK, Util::createURLForResource("push-state", "html")); WKPageLoadURL(webView.page(), url.get()); Util::run(&testDone); }
ContextHistoryClientEfl::ContextHistoryClientEfl(WKContextRef context) : m_context(context) , m_userData(0) , m_navigate(0) , m_clientRedirect(0) , m_serverRedirect(0) , m_titleUpdated(0) , m_populateVisitedLinks(0) { ASSERT(m_context); WKContextHistoryClientV0 wkHistoryClient; memset(&wkHistoryClient, 0, sizeof(WKContextHistoryClientV0)); wkHistoryClient.base.version = 0; wkHistoryClient.base.clientInfo = this; wkHistoryClient.didNavigateWithNavigationData = didNavigateWithNavigationData; wkHistoryClient.didPerformClientRedirect = didPerformClientRedirect; wkHistoryClient.didPerformServerRedirect = didPerformServerRedirect; wkHistoryClient.didUpdateHistoryTitle = didUpdateHistoryTitle; wkHistoryClient.populateVisitedLinks = populateVisitedLinks; WKContextSetHistoryClient(m_context.get(), &wkHistoryClient.base); }
ContextHistoryClientEfl::~ContextHistoryClientEfl() { WKContextSetHistoryClient(m_context.get(), 0); }