Skip to content

Commit

Permalink
Deprecate and disconnect all of WKPageGroupRef
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=259324
rdar://112499509

Reviewed by Tim Horton.

It is no longer used anywhere.
Its last use was just an object to get the UserContentController
or preferences object from.

* Source/WebKit/UIProcess/API/C/WKPage.cpp:
(WKPageGetPageGroup):
* Source/WebKit/UIProcess/API/C/WKPage.h:
* Source/WebKit/UIProcess/API/C/WKPageConfigurationRef.cpp:
(WKPageConfigurationGetPageGroup):
(WKPageConfigurationSetPageGroup):
* Source/WebKit/UIProcess/API/C/WKPageConfigurationRef.h:
* Source/WebKit/UIProcess/API/C/WKPageGroup.cpp:
(WKPageGroupGetTypeID):
(WKPageGroupCreateWithIdentifier):
(WKPageGroupSetPreferences):
(WKPageGroupGetPreferences):
(WKPageGroupGetUserContentController):
(WKPageGroupAddUserStyleSheet):
(WKPageGroupRemoveAllUserStyleSheets):
(WKPageGroupAddUserScript):
(WKPageGroupRemoveAllUserScripts):
* Source/WebKit/UIProcess/API/C/WKPageGroup.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _setupPageConfiguration:]):
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration _pageGroup]):
(-[WKWebViewConfiguration _setPageGroup:]):
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
* Tools/TestWebKitAPI/PlatformWebView.h:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKit/DOMWindowExtensionBasic.cpp:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKit/DOMWindowExtensionNoCache.cpp:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKit/DocumentStartUserScriptAlertCrash.cpp:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKit/EnumerateMediaDevices.cpp:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKit/InjectedBundleDisableOverrideBuiltinsBehavior.cpp:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKit/InjectedBundleMakeAllShadowRootsOpen.cpp:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKit/PageGroup.cpp: Removed.
* Tools/TestWebKitAPI/Tests/WebKit/ScrollPinningBehaviors.mm:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKit/SpacebarScrolling.cpp:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKit/UserMedia.cpp:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKit/WKPageConfiguration.cpp:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKit/WKPageIsPlayingAudio.cpp:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKit/mac/AttributedSubstringForProposedRangeWithImage.mm:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKit/mac/ContextMenuDownload.mm:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKit/mac/EditorCommands.mm:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/PictureInPictureDelegate.mm:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/mac/FirstResponderScrollingPosition.mm:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/mac/PlatformWebViewMac.mm:
(TestWebKitAPI::PlatformWebView::initialize):
(TestWebKitAPI::PlatformWebView::PlatformWebView):
* Tools/WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
(WTR::TestController::generatePageConfiguration):
(WTR::TestController::platformAdjustContext):
* Tools/WebKitTestRunner/TestController.h:

Canonical link: https://commits.webkit.org/266167@main
  • Loading branch information
achristensen07 committed Jul 19, 2023
1 parent ac6d297 commit e126b11
Show file tree
Hide file tree
Showing 51 changed files with 125 additions and 362 deletions.
2 changes: 1 addition & 1 deletion Source/WebKit/UIProcess/API/C/WKPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ WKContextRef WKPageGetContext(WKPageRef pageRef)

WKPageGroupRef WKPageGetPageGroup(WKPageRef pageRef)
{
return toAPI(&toImpl(pageRef)->pageGroup());
return nullptr;
}

WKPageConfigurationRef WKPageCopyPageConfiguration(WKPageRef pageRef)
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit/UIProcess/API/C/WKPage.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ extern "C" {
WK_EXPORT WKTypeID WKPageGetTypeID(void);

WK_EXPORT WKContextRef WKPageGetContext(WKPageRef page);
WK_EXPORT WKPageGroupRef WKPageGetPageGroup(WKPageRef page);
WK_EXPORT WKPageGroupRef WKPageGetPageGroup(WKPageRef page) WK_C_API_DEPRECATED;

WK_EXPORT WKPageConfigurationRef WKPageCopyPageConfiguration(WKPageRef page);

Expand Down
7 changes: 3 additions & 4 deletions Source/WebKit/UIProcess/API/C/WKPageConfigurationRef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,13 @@ void WKPageConfigurationSetContext(WKPageConfigurationRef configuration, WKConte
toImpl(configuration)->setProcessPool(toImpl(context));
}

WKPageGroupRef WKPageConfigurationGetPageGroup(WKPageConfigurationRef configuration)
WKPageGroupRef WKPageConfigurationGetPageGroup(WKPageConfigurationRef)
{
return toAPI(toImpl(configuration)->pageGroup());
return nullptr;
}

void WKPageConfigurationSetPageGroup(WKPageConfigurationRef configuration, WKPageGroupRef pageGroup)
void WKPageConfigurationSetPageGroup(WKPageConfigurationRef, WKPageGroupRef)
{
toImpl(configuration)->setPageGroup(toImpl(pageGroup));
}

WKUserContentControllerRef WKPageConfigurationGetUserContentController(WKPageConfigurationRef configuration)
Expand Down
5 changes: 3 additions & 2 deletions Source/WebKit/UIProcess/API/C/WKPageConfigurationRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#define WKPageConfigurationRef_h

#include <WebKit/WKBase.h>
#include <WebKit/WKDeprecated.h>

#ifdef __cplusplus
extern "C" {
Expand All @@ -39,8 +40,8 @@ WK_EXPORT WKPageConfigurationRef WKPageConfigurationCreate(void);
WK_EXPORT WKContextRef WKPageConfigurationGetContext(WKPageConfigurationRef configuration);
WK_EXPORT void WKPageConfigurationSetContext(WKPageConfigurationRef configuration, WKContextRef context);

WK_EXPORT WKPageGroupRef WKPageConfigurationGetPageGroup(WKPageConfigurationRef configuration);
WK_EXPORT void WKPageConfigurationSetPageGroup(WKPageConfigurationRef configuration, WKPageGroupRef pageGroup);
WK_EXPORT WKPageGroupRef WKPageConfigurationGetPageGroup(WKPageConfigurationRef configuration) WK_C_API_DEPRECATED;
WK_EXPORT void WKPageConfigurationSetPageGroup(WKPageConfigurationRef configuration, WKPageGroupRef pageGroup) WK_C_API_DEPRECATED;

WK_EXPORT WKUserContentControllerRef WKPageConfigurationGetUserContentController(WKPageConfigurationRef configuration);
WK_EXPORT void WKPageConfigurationSetUserContentController(WKPageConfigurationRef configuration, WKUserContentControllerRef userContentController);
Expand Down
64 changes: 11 additions & 53 deletions Source/WebKit/UIProcess/API/C/WKPageGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,84 +26,42 @@
#include "config.h"
#include "WKPageGroup.h"

#include "APIArray.h"
#include "APIContentRuleList.h"
#include "APIContentWorld.h"
#include "APIUserScript.h"
#include "APIUserStyleSheet.h"
#include "InjectUserScriptImmediately.h"
#include "WKAPICast.h"
#include "WebPageGroup.h"
#include "WebPreferences.h"
#include "WebUserContentController.h"
#include "WebUserContentControllerProxy.h"

using namespace WebKit;

WKTypeID WKPageGroupGetTypeID()
{
return toAPI(WebPageGroup::APIType);
return 0;
}

WKPageGroupRef WKPageGroupCreateWithIdentifier(WKStringRef identifier)
WKPageGroupRef WKPageGroupCreateWithIdentifier(WKStringRef)
{
auto pageGroup = WebPageGroup::create(toWTFString(identifier));
return toAPI(&pageGroup.leakRef());
return nullptr;
}

void WKPageGroupSetPreferences(WKPageGroupRef pageGroupRef, WKPreferencesRef preferencesRef)
void WKPageGroupSetPreferences(WKPageGroupRef, WKPreferencesRef)
{
toImpl(pageGroupRef)->setPreferences(toImpl(preferencesRef));
}

WKPreferencesRef WKPageGroupGetPreferences(WKPageGroupRef pageGroupRef)
WKPreferencesRef WKPageGroupGetPreferences(WKPageGroupRef)
{
return toAPI(&toImpl(pageGroupRef)->preferences());
return nullptr;
}

WKUserContentControllerRef WKPageGroupGetUserContentController(WKPageGroupRef pageGroupRef)
{
return toAPI(&toImpl(pageGroupRef)->userContentController());
return nullptr;
}

void WKPageGroupAddUserStyleSheet(WKPageGroupRef pageGroupRef, WKStringRef sourceRef, WKURLRef baseURLRef, WKArrayRef allowedURLPatterns, WKArrayRef blockedURLPatterns, WKUserContentInjectedFrames injectedFrames)
void WKPageGroupAddUserStyleSheet(WKPageGroupRef, WKStringRef, WKURLRef, WKArrayRef, WKArrayRef, WKUserContentInjectedFrames)
{
auto source = toWTFString(sourceRef);

if (source.isEmpty())
return;

auto baseURLString = toWTFString(baseURLRef);
auto allowlist = toImpl(allowedURLPatterns);
auto blocklist = toImpl(blockedURLPatterns);

Ref<API::UserStyleSheet> userStyleSheet = API::UserStyleSheet::create(WebCore::UserStyleSheet { source, baseURLString.isEmpty() ? aboutBlankURL() : URL { baseURLString }, allowlist ? allowlist->toStringVector() : Vector<String>(), blocklist ? blocklist->toStringVector() : Vector<String>(), toUserContentInjectedFrames(injectedFrames), WebCore::UserStyleUserLevel }, API::ContentWorld::pageContentWorld());

toImpl(pageGroupRef)->userContentController().addUserStyleSheet(userStyleSheet.get());
}

void WKPageGroupRemoveAllUserStyleSheets(WKPageGroupRef pageGroup)
void WKPageGroupRemoveAllUserStyleSheets(WKPageGroupRef)
{
toImpl(pageGroup)->userContentController().removeAllUserStyleSheets();
}

void WKPageGroupAddUserScript(WKPageGroupRef pageGroupRef, WKStringRef sourceRef, WKURLRef baseURLRef, WKArrayRef allowedURLPatterns, WKArrayRef blockedURLPatterns, WKUserContentInjectedFrames injectedFrames, _WKUserScriptInjectionTime injectionTime)
void WKPageGroupAddUserScript(WKPageGroupRef, WKStringRef, WKURLRef, WKArrayRef, WKArrayRef, WKUserContentInjectedFrames, _WKUserScriptInjectionTime)
{
auto source = toWTFString(sourceRef);

if (source.isEmpty())
return;

auto baseURLString = toWTFString(baseURLRef);
auto allowlist = toImpl(allowedURLPatterns);
auto blocklist = toImpl(blockedURLPatterns);

auto url = baseURLString.isEmpty() ? aboutBlankURL() : URL { baseURLString };
Ref<API::UserScript> userScript = API::UserScript::create(WebCore::UserScript { WTFMove(source), WTFMove(url), allowlist ? allowlist->toStringVector() : Vector<String>(), blocklist ? blocklist->toStringVector() : Vector<String>(), toUserScriptInjectionTime(injectionTime), toUserContentInjectedFrames(injectedFrames), WebCore::WaitForNotificationBeforeInjecting::No }, API::ContentWorld::pageContentWorld());
toImpl(pageGroupRef)->userContentController().addUserScript(userScript.get(), InjectUserScriptImmediately::No);
}

void WKPageGroupRemoveAllUserScripts(WKPageGroupRef pageGroupRef)
void WKPageGroupRemoveAllUserScripts(WKPageGroupRef)
{
toImpl(pageGroupRef)->userContentController().removeAllUserScripts();
}
21 changes: 11 additions & 10 deletions Source/WebKit/UIProcess/API/C/WKPageGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,28 @@
#define WKPageGroup_h

#include <WebKit/WKBase.h>
#include <WebKit/WKDeprecated.h>
#include <WebKit/WKUserContentInjectedFrames.h>
#include <WebKit/WKUserScriptInjectionTime.h>

#ifdef __cplusplus
extern "C" {
#endif

WK_EXPORT WKTypeID WKPageGroupGetTypeID(void);
WK_EXPORT WKTypeID WKPageGroupGetTypeID(void) WK_C_API_DEPRECATED;

WK_EXPORT WKPageGroupRef WKPageGroupCreateWithIdentifier(WKStringRef identifier);
WK_EXPORT WKPageGroupRef WKPageGroupCreateWithIdentifier(WKStringRef identifier) WK_C_API_DEPRECATED;

WK_EXPORT void WKPageGroupSetPreferences(WKPageGroupRef pageGroup, WKPreferencesRef preferences);
WK_EXPORT WKPreferencesRef WKPageGroupGetPreferences(WKPageGroupRef pageGroup);
WK_EXPORT void WKPageGroupSetPreferences(WKPageGroupRef pageGroup, WKPreferencesRef preferences) WK_C_API_DEPRECATED;
WK_EXPORT WKPreferencesRef WKPageGroupGetPreferences(WKPageGroupRef pageGroup) WK_C_API_DEPRECATED;

WK_EXPORT WKUserContentControllerRef WKPageGroupGetUserContentController(WKPageGroupRef pageGroup);
WK_EXPORT WKUserContentControllerRef WKPageGroupGetUserContentController(WKPageGroupRef pageGroup) WK_C_API_DEPRECATED;

WK_EXPORT void WKPageGroupAddUserStyleSheet(WKPageGroupRef pageGroup, WKStringRef source, WKURLRef baseURL, WKArrayRef allowedURLPatterns, WKArrayRef blockedURLPatterns, WKUserContentInjectedFrames);
WK_EXPORT void WKPageGroupRemoveAllUserStyleSheets(WKPageGroupRef pageGroup);
WK_EXPORT void WKPageGroupAddUserScript(WKPageGroupRef pageGroup, WKStringRef source, WKURLRef baseURL, WKArrayRef allowedURLPatterns, WKArrayRef blockedURLPatterns, WKUserContentInjectedFrames, _WKUserScriptInjectionTime);
WK_EXPORT void WKPageGroupRemoveAllUserScripts(WKPageGroupRef pageGroup);
WK_EXPORT void WKPageGroupAddUserStyleSheet(WKPageGroupRef pageGroup, WKStringRef source, WKURLRef baseURL, WKArrayRef allowedURLPatterns, WKArrayRef blockedURLPatterns, WKUserContentInjectedFrames) WK_C_API_DEPRECATED;
WK_EXPORT void WKPageGroupRemoveAllUserStyleSheets(WKPageGroupRef pageGroup) WK_C_API_DEPRECATED;

WK_EXPORT void WKPageGroupAddUserScript(WKPageGroupRef pageGroup, WKStringRef source, WKURLRef baseURL, WKArrayRef allowedURLPatterns, WKArrayRef blockedURLPatterns, WKUserContentInjectedFrames, _WKUserScriptInjectionTime) WK_C_API_DEPRECATED;
WK_EXPORT void WKPageGroupRemoveAllUserScripts(WKPageGroupRef pageGroup) WK_C_API_DEPRECATED;

#ifdef __cplusplus
}
Expand Down
13 changes: 3 additions & 10 deletions Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -477,16 +477,9 @@ - (void)_setupPageConfiguration:(Ref<API::PageConfiguration>&)pageConfiguration
pageConfiguration->setWeakWebExtensionController(&controller._webExtensionController);
#endif

#if PLATFORM(MAC)
if (auto pageGroup = WebKit::toImpl([_configuration _pageGroup]))
pageConfiguration->setPageGroup(pageGroup);
else
#endif
{
NSString *groupIdentifier = [_configuration _groupIdentifier];
if (groupIdentifier.length)
pageConfiguration->setPageGroup(WebKit::WebPageGroup::create(groupIdentifier).ptr());
}
NSString *groupIdentifier = [_configuration _groupIdentifier];
if (groupIdentifier.length)
pageConfiguration->setPageGroup(WebKit::WebPageGroup::create(groupIdentifier).ptr());

pageConfiguration->setAdditionalSupportedImageTypes(makeVector<String>([_configuration _additionalSupportedImageTypes]));

Expand Down
5 changes: 1 addition & 4 deletions Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ @implementation WKWebViewConfiguration {
BOOL _mainContentUserGestureOverrideEnabled;

#if PLATFORM(MAC)
WKRetainPtr<WKPageGroupRef> _pageGroup;
BOOL _showsURLsInToolTips;
BOOL _serviceControlsEnabled;
BOOL _imageControlsEnabled;
Expand Down Expand Up @@ -459,7 +458,6 @@ - (id)copyWithZone:(NSZone *)zone
configuration->_serviceControlsEnabled = self->_serviceControlsEnabled;
configuration->_imageControlsEnabled = self->_imageControlsEnabled;
configuration->_contextMenuQRCodeDetectionEnabled = self->_contextMenuQRCodeDetectionEnabled;
configuration->_pageGroup = self._pageGroup;
#endif
#if ENABLE(DATA_DETECTION) && PLATFORM(IOS_FAMILY)
configuration->_dataDetectorTypes = self->_dataDetectorTypes;
Expand Down Expand Up @@ -1274,12 +1272,11 @@ - (void)_setRequiresUserActionForEditingControlsManager:(BOOL)requiresUserAction

- (WKPageGroupRef)_pageGroup
{
return _pageGroup.get();
return nullptr;
}

- (void)_setPageGroup:(WKPageGroupRef)pageGroup
{
_pageGroup = pageGroup;
}

- (void)_setCPULimit:(double)cpuLimit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ typedef NS_ENUM(NSUInteger, _WKContentSecurityPolicyModeForExtension) {
@property (nonatomic, setter=_setContextMenuQRCodeDetectionEnabled:) BOOL _contextMenuQRCodeDetectionEnabled WK_API_AVAILABLE(macos(WK_MAC_TBA));
@property (nonatomic, readwrite, setter=_setRequiresUserActionForEditingControlsManager:) BOOL _requiresUserActionForEditingControlsManager WK_API_AVAILABLE(macos(10.12));
@property (nonatomic, readwrite, setter=_setCPULimit:) double _cpuLimit WK_API_AVAILABLE(macos(10.13.4));
@property (nonatomic, readwrite, setter=_setPageGroup:) WKPageGroupRef _pageGroup WK_API_AVAILABLE(macos(10.13.4));
@property (nonatomic, readwrite, setter=_setPageGroup:) WKPageGroupRef _pageGroup WK_API_DEPRECATED_WITH_REPLACEMENT("_groupIdentifier", macos(10.13.4, WK_MAC_TBA));
#endif

@property (nonatomic, setter=_setRequiresUserActionForAudioPlayback:) BOOL _requiresUserActionForAudioPlayback WK_API_DEPRECATED_WITH_REPLACEMENT("mediaTypesRequiringUserActionForPlayback", macos(10.12, 10.12), ios(10.0, 10.0));
Expand Down
1 change: 0 additions & 1 deletion Tools/MiniBrowser/playstation/WebContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ WebContext::WebContext()
WKContextSetUsesSingleWebProcess(m_context.get(), true);

WKRetainPtr<WKStringRef> groupName = adoptWK(WKStringCreateWithUTF8CString("Default"));
m_pageGroup = adoptWK(WKPageGroupCreateWithIdentifier(groupName.get()));

m_preferencesMaster = adoptWK(WKPreferencesCreate());
WKPreferencesSetFullScreenEnabled(m_preferencesMaster.get(), true);
Expand Down
3 changes: 0 additions & 3 deletions Tools/MiniBrowser/playstation/WebContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

#include <WebKit/WKContext.h>
#include <WebKit/WKPageConfigurationRef.h>
#include <WebKit/WKPageGroup.h>
#include <WebKit/WKRetainPtr.h>
#include <list>

Expand All @@ -41,7 +40,6 @@ class WebContext {
static std::shared_ptr<WebContext> singleton();

WKContextRef context() { return m_context.get(); }
WKPageGroupRef pageGroup() { return m_pageGroup.get(); }
WKPreferencesRef preferences() { return m_preferencesMaster.get(); }
WKWebsiteDataStoreRef websiteDataStore() { return m_websiteDataStore.get(); }

Expand All @@ -51,7 +49,6 @@ class WebContext {
private:
static std::weak_ptr<WebContext> s_instance;
WKRetainPtr<WKContextRef> m_context;
WKRetainPtr<WKPageGroupRef> m_pageGroup;
WKRetainPtr<WKPreferencesRef> m_preferencesMaster;
WKRetainPtr<WKWebsiteDataStoreRef> m_websiteDataStore;
std::list<WebViewWindow*> m_windows;
Expand Down
1 change: 0 additions & 1 deletion Tools/MiniBrowser/playstation/WebViewWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ std::unique_ptr<WebViewWindow> WebViewWindow::create(Client&& windowClient, WKPa

WKRetainPtr<WKPageConfigurationRef> configuration = adoptWK(WKPageConfigurationCreate());
WKPageConfigurationSetContext(configuration.get(), context->context());
WKPageConfigurationSetPageGroup(configuration.get(), context->pageGroup());
return std::make_unique<WebViewWindow>(configuration.get(), std::move(windowClient));
}

Expand Down
12 changes: 4 additions & 8 deletions Tools/MiniBrowser/win/WebKitBrowserWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,10 @@ Ref<BrowserWindow> WebKitBrowserWindow::create(BrowserWindowClient& client, HWND
WKPreferencesSetMediaCapabilitiesEnabled(preferences.get(), false);
WKPreferencesSetDeveloperExtrasEnabled(preferences.get(), true);

auto pageGroup = adoptWK(WKPageGroupCreateWithIdentifier(createWKString("WinMiniBrowser").get()));
WKPageGroupSetPreferences(pageGroup.get(), preferences.get());

auto pageConf = adoptWK(WKPageConfigurationCreate());
WKPageConfigurationSetWebsiteDataStore(pageConf.get(), websiteDataStore.get());
WKPageConfigurationSetContext(pageConf.get(), context.get());
WKPageConfigurationSetPreferences(pageConf.get(), preferences.get());
WKPageConfigurationSetPageGroup(pageConf.get(), pageGroup.get());

return adoptRef(*new WebKitBrowserWindow(client, pageConf.get(), mainWnd));
}
Expand Down Expand Up @@ -226,8 +222,8 @@ HRESULT WebKitBrowserWindow::init()
void WebKitBrowserWindow::resetFeatureMenu(FeatureType featureType, HMENU menu, bool resetsSettingsToDefaults)
{
auto page = WKViewGetPage(m_view.get());
auto pgroup = WKPageGetPageGroup(page);
auto pref = WKPageGroupGetPreferences(pgroup);
auto configuration = adoptWK(WKPageCopyPageConfiguration(page));
auto pref = WKPageConfigurationGetPreferences(configuration.get());
switch (featureType) {
case FeatureType::Experimental: {
auto features = adoptWK(WKPreferencesCopyExperimentalFeatures(pref));
Expand Down Expand Up @@ -311,8 +307,8 @@ void WebKitBrowserWindow::navigateToHistory(UINT menuID)
void WebKitBrowserWindow::setPreference(UINT menuID, bool enable)
{
auto page = WKViewGetPage(m_view.get());
auto pgroup = WKPageGetPageGroup(page);
auto pref = WKPageGroupGetPreferences(pgroup);
auto configuration = adoptWK(WKPageCopyPageConfiguration(page));
auto pref = WKPageConfigurationGetPreferences(configuration.get());
if (IDM_EXPERIMENTAL_FEATURES_BEGIN <= menuID && menuID <= IDM_EXPERIMENTAL_FEATURES_END) {
int index = menuID - IDM_EXPERIMENTAL_FEATURES_BEGIN;
WKPreferencesSetExperimentalFeatureForKey(pref, enable, m_experimentalFeatureKeys[index].get());
Expand Down
14 changes: 2 additions & 12 deletions Tools/TestWebKitAPI/PlatformWebView.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef PlatformWebView_h
#define PlatformWebView_h
#pragma once

#include <wtf/FastMalloc.h>
#include <wtf/Noncopyable.h>
Expand Down Expand Up @@ -73,11 +72,8 @@ class PlatformWebView {
WTF_MAKE_NONCOPYABLE(PlatformWebView);
public:
explicit PlatformWebView(WKPageConfigurationRef);
explicit PlatformWebView(WKContextRef, WKPageGroupRef = 0);
explicit PlatformWebView(WKContextRef);
explicit PlatformWebView(WKPageRef relatedPage);
#if PLATFORM(MAC)
explicit PlatformWebView(WKContextRef, WKPageGroupRef, Class wkViewSubclass);
#endif
~PlatformWebView();

WKPageRef page() const;
Expand All @@ -94,11 +90,7 @@ class PlatformWebView {
#endif

private:
#if PLATFORM(MAC)
void initialize(WKPageConfigurationRef, Class wkViewSubclass);
#else
void initialize(WKPageConfigurationRef);
#endif
#if PLATFORM(WIN)
static void registerWindowClass();
static LRESULT CALLBACK wndProc(HWND, UINT message, WPARAM, LPARAM);
Expand All @@ -109,5 +101,3 @@ class PlatformWebView {
};

} // namespace TestWebKitAPI

#endif // PlatformWebView_h
Loading

0 comments on commit e126b11

Please sign in to comment.