Title: [168637] trunk/Source/WebKit2
Revision
168637
Author
ander...@apple.com
Date
2014-05-12 12:53:28 -0700 (Mon, 12 May 2014)

Log Message

WKWebViewConfiguration should fill in the blanks
https://bugs.webkit.org/show_bug.cgi?id=132832
<rdar://problem/16886408>

Reviewed by Dan Bernstein.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView initWithFrame:configuration:]):
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):
(-[WKWebViewConfiguration _validate]):
* UIProcess/API/Cocoa/WKWebViewConfigurationInternal.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (168636 => 168637)


--- trunk/Source/WebKit2/ChangeLog	2014-05-12 19:47:12 UTC (rev 168636)
+++ trunk/Source/WebKit2/ChangeLog	2014-05-12 19:53:28 UTC (rev 168637)
@@ -1,5 +1,20 @@
 2014-05-12  Anders Carlsson  <ander...@apple.com>
 
+        WKWebViewConfiguration should fill in the blanks
+        https://bugs.webkit.org/show_bug.cgi?id=132832
+        <rdar://problem/16886408>
+
+        Reviewed by Dan Bernstein.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView initWithFrame:configuration:]):
+        * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+        (-[WKWebViewConfiguration init]):
+        (-[WKWebViewConfiguration _validate]):
+        * UIProcess/API/Cocoa/WKWebViewConfigurationInternal.h:
+
+2014-05-12  Anders Carlsson  <ander...@apple.com>
+
         WKWebView should default to _backgroundExtendsBeyondPage = YES
         https://bugs.webkit.org/show_bug.cgi?id=132829
         <rdar://problem/16886364>

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (168636 => 168637)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2014-05-12 19:47:12 UTC (rev 168636)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2014-05-12 19:53:28 UTC (rev 168637)
@@ -154,26 +154,8 @@
         [_configuration setProcessPool:relatedWebViewProcessPool];
     }
 
-    if (![_configuration processPool])
-        [_configuration setProcessPool:adoptNS([[WKProcessPool alloc] init]).get()];
+    [_configuration _validate];
 
-    if (![_configuration preferences])
-        [_configuration setPreferences:adoptNS([[WKPreferences alloc] init]).get()];
-
-    if (![_configuration userContentController])
-        [_configuration setUserContentController:adoptNS([[WKUserContentController alloc] init]).get()];
-
-    if (![_configuration _visitedLinkProvider])
-        [_configuration _setVisitedLinkProvider:adoptNS([[_WKVisitedLinkProvider alloc] init]).get()];
-    
-    if (![_configuration _websiteDataStore])
-        [_configuration _setWebsiteDataStore:[_WKWebsiteDataStore defaultDataStore]];
-    
-#if PLATFORM(IOS)
-    if (![_configuration _contentProviderRegistry])
-        [_configuration _setContentProviderRegistry:adoptNS([[WKWebViewContentProviderRegistry alloc] init]).get()];
-#endif
-
     CGRect bounds = self.bounds;
 
     WebKit::WebContext& context = *[_configuration processPool]->_context;

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h (168636 => 168637)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h	2014-05-12 19:47:12 UTC (rev 168636)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h	2014-05-12 19:53:28 UTC (rev 168637)
@@ -44,20 +44,14 @@
  @discussion When the @link WKWebView @/link is initialized with the configuration, a new Web
  Content process from the specified pool will be created for it, or an existing process in
  that pool will be used.
- When this property is set to nil, a unique process pool will be created for each
- @link WKWebView @/link initialized with the configuration.
 */
 @property (nonatomic, strong) WKProcessPool *processPool;
 
 /*! @abstract The preferences that should be used by web views created with this configuration.
- @discussion When this property is set to nil, a unique preferences object will be created for each
- @link WKWebView @/link initialized with the configuration.
 */
 @property (nonatomic, strong) WKPreferences *preferences;
 
 /*! @abstract The user content controller that should be used by web views created with this configuration.
- @discussion When this property is set to nil, a unique user content controller object will be created for each
- @link WKWebView @/link initialized with the configuration.
 */
 @property (nonatomic, strong) WKUserContentController *userContentController;
 

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm (168636 => 168637)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm	2014-05-12 19:47:12 UTC (rev 168636)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm	2014-05-12 19:53:28 UTC (rev 168637)
@@ -28,9 +28,12 @@
 
 #if WK_API_ENABLED
 
+#import "WKPreferences.h"
+#import "WKProcessPool.h"
 #import "WKUserContentController.h"
 #import "WKWebViewContentProviderRegistry.h"
 #import "WeakObjCPtr.h"
+#import "_WKVisitedLinkProvider.h"
 #import "_WKWebsiteDataStore.h"
 #import <wtf/RetainPtr.h>
 
@@ -47,6 +50,24 @@
 #endif
 }
 
+- (instancetype)init
+{
+    if (!(self = [super init]))
+        return nil;
+
+    _processPool = adoptNS([[WKProcessPool alloc] init]);
+    _preferences = adoptNS([[WKPreferences alloc] init]);
+    _userContentController = adoptNS([[WKUserContentController alloc] init]);
+    _visitedLinkProvider = adoptNS([[_WKVisitedLinkProvider alloc] init]);
+    _websiteDataStore = [_WKWebsiteDataStore defaultDataStore];
+
+#if PLATFORM(IOS)
+    _contentProviderRegistry = adoptNS([[WKWebViewContentProviderRegistry alloc] init]);
+#endif
+
+    return self;
+}
+
 - (NSString *)description
 {
     return [NSString stringWithFormat:@"<%@: %p; processPool = %@; preferences = %@>", NSStringFromClass(self.class), self, _processPool.get(), _preferences.get()];
@@ -131,6 +152,29 @@
 }
 #endif
 
+- (void)_validate
+{
+    if (!_processPool)
+        [NSException raise:NSInvalidArgumentException format:@"configuration.processPool is nil"];
+
+    if (!_preferences)
+        [NSException raise:NSInvalidArgumentException format:@"configuration.preferences is nil"];
+
+    if (!_userContentController)
+        [NSException raise:NSInvalidArgumentException format:@"configuration.userContentController is nil"];
+
+    if (!_visitedLinkProvider)
+        [NSException raise:NSInvalidArgumentException format:@"configuration._visitedLinkProvider is nil"];
+
+    if (!_websiteDataStore)
+        [NSException raise:NSInvalidArgumentException format:@"configuration._websiteDataStore is nil"];
+
+#if PLATFORM(IOS)
+    if (!_contentProviderRegistry)
+        [NSException raise:NSInvalidArgumentException format:@"configuration._contentProviderRegistry is nil"];
+#endif
+}
+
 @end
 
 @implementation WKWebViewConfiguration (WKPrivate)

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationInternal.h (168636 => 168637)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationInternal.h	2014-05-12 19:47:12 UTC (rev 168636)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationInternal.h	2014-05-12 19:53:28 UTC (rev 168637)
@@ -36,6 +36,8 @@
 @property (nonatomic, setter=_setContentProviderRegistry:) WKWebViewContentProviderRegistry *_contentProviderRegistry;
 #endif
 
+- (void)_validate;
+
 @end
 
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to