https://bugs.webkit.org/show_bug.cgi?id=180674
<rdar://problem/
35920392>
Reviewed by Brady Eidson.
There is a Mac app trying to transition to WKWebView, and it uses WKPageGroupRef extensively.
To help it transition, we are temporarily giving it an ObjC way to use this organization for
its UserContentControllers to be united per PageGroup before it transitions away from SPIs like
WKBundleAddUserScript. Make it Mac-only to indicate that this should be transitioned away from,
rather than adopted on iOS.
No change in behavior for apps not using the new WKWebViewConfiguration._pageGroup SPI.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration _pageGroup]):
(-[WKWebViewConfiguration _setPageGroup:]):
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225765
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2017-12-11 Alex Christensen <achristensen@webkit.org>
+
+ Add a WKPageGroupRef setter in WKWebViewConfiguration
+ https://bugs.webkit.org/show_bug.cgi?id=180674
+ <rdar://problem/35920392>
+
+ Reviewed by Brady Eidson.
+
+ There is a Mac app trying to transition to WKWebView, and it uses WKPageGroupRef extensively.
+ To help it transition, we are temporarily giving it an ObjC way to use this organization for
+ its UserContentControllers to be united per PageGroup before it transitions away from SPIs like
+ WKBundleAddUserScript. Make it Mac-only to indicate that this should be transitioned away from,
+ rather than adopted on iOS.
+
+ No change in behavior for apps not using the new WKWebViewConfiguration._pageGroup SPI.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _initializeWithConfiguration:]):
+ * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+ (-[WKWebViewConfiguration copyWithZone:]):
+ (-[WKWebViewConfiguration _pageGroup]):
+ (-[WKWebViewConfiguration _setPageGroup:]):
+ * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
+
2017-12-11 Brent Fulgham <bfulgham@apple.com>
[iOS] Remove unused services from WebContent Process sandbox
if (NSString *overrideContentSecurityPolicy = configuration._overrideContentSecurityPolicy)
pageConfiguration->setOverrideContentSecurityPolicy(overrideContentSecurityPolicy);
- RefPtr<WebKit::WebPageGroup> pageGroup;
- NSString *groupIdentifier = configuration._groupIdentifier;
- if (groupIdentifier.length) {
- pageGroup = WebKit::WebPageGroup::create(configuration._groupIdentifier);
- pageConfiguration->setPageGroup(pageGroup.get());
+#if PLATFORM(MAC)
+ if (auto pageGroup = WebKit::toImpl([configuration _pageGroup])) {
+ pageConfiguration->setPageGroup(pageGroup);
+ pageConfiguration->setUserContentController(&pageGroup->userContentController());
+ } else
+#endif
+ {
+ NSString *groupIdentifier = configuration._groupIdentifier;
+ if (groupIdentifier.length)
+ pageConfiguration->setPageGroup(WebKit::WebPageGroup::create(configuration._groupIdentifier).ptr());
}
pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::suppressesIncrementalRenderingKey(), WebKit::WebPreferencesStore::Value(!![_configuration suppressesIncrementalRendering]));
#import "VersionChecks.h"
#import "WKPreferences.h"
#import "WKProcessPool.h"
+#import "WKRetainPtr.h"
#import "WKUserContentController.h"
#import "WKWebView.h"
#import "WKWebViewContentProviderRegistry.h"
BOOL _mainContentUserGestureOverrideEnabled;
#if PLATFORM(MAC)
+ WKRetainPtr<WKPageGroupRef> _pageGroup;
double _cpuLimit;
BOOL _showsURLsInToolTips;
BOOL _serviceControlsEnabled;
configuration->_serviceControlsEnabled = self->_serviceControlsEnabled;
configuration->_imageControlsEnabled = self->_imageControlsEnabled;
configuration->_requiresUserActionForEditingControlsManager = self->_requiresUserActionForEditingControlsManager;
+ configuration->_pageGroup = self._pageGroup;
#endif
#if ENABLE(DATA_DETECTION) && PLATFORM(IOS)
configuration->_dataDetectorTypes = self->_dataDetectorTypes;
_requiresUserActionForEditingControlsManager = requiresUserAction;
}
+- (WKPageGroupRef)_pageGroup
+{
+ return _pageGroup.get();
+}
+
+- (void)_setPageGroup:(WKPageGroupRef)pageGroup
+{
+ _pageGroup = pageGroup;
+}
+
- (void)_setCPULimit:(double)cpuLimit
{
_cpuLimit = cpuLimit;
#if WK_API_ENABLED
+#import <WebKit/WKBase.h>
+
#if TARGET_OS_IPHONE
typedef NS_ENUM(NSUInteger, _WKDragLiftDelay) {
_WKDragLiftDelayShort = 0,
@property (nonatomic, setter=_setImageControlsEnabled:) BOOL _imageControlsEnabled WK_API_AVAILABLE(macosx(10.12));
@property (nonatomic, readwrite, setter=_setRequiresUserActionForEditingControlsManager:) BOOL _requiresUserActionForEditingControlsManager WK_API_AVAILABLE(macosx(10.12));
@property (nonatomic, readwrite, setter=_setCPULimit:) double _cpuLimit WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+@property (nonatomic, readwrite, setter=_setPageGroup:) WKPageGroupRef _pageGroup WK_API_AVAILABLE(macosx(WK_MAC_TBA));
#endif
@property (nonatomic, strong, setter=_setWebsiteDataStore:) _WKWebsiteDataStore *_websiteDataStore WK_API_DEPRECATED_WITH_REPLACEMENT("websiteDataStore", macosx(10.10, 10.11), ios(8.0, 9.0));