Title: [168809] branches/safari-538.34-branch/Source/WebKit2

Diff

Modified: branches/safari-538.34-branch/Source/WebKit2/ChangeLog (168808 => 168809)


--- branches/safari-538.34-branch/Source/WebKit2/ChangeLog	2014-05-14 08:02:13 UTC (rev 168808)
+++ branches/safari-538.34-branch/Source/WebKit2/ChangeLog	2014-05-14 08:04:56 UTC (rev 168809)
@@ -1,5 +1,24 @@
 2014-05-14  Lucas Forschler  <[email protected]>
 
+        Merge r168637
+
+    2014-05-12  Anders Carlsson  <[email protected]>
+
+            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-14  Lucas Forschler  <[email protected]>
+
         Merge r168629
 
     2014-05-12  Anders Carlsson  <[email protected]>

Modified: branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (168808 => 168809)


--- branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2014-05-14 08:02:13 UTC (rev 168808)
+++ branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2014-05-14 08:04:56 UTC (rev 168809)
@@ -152,26 +152,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: branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h (168808 => 168809)


--- branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h	2014-05-14 08:02:13 UTC (rev 168808)
+++ branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h	2014-05-14 08:04:56 UTC (rev 168809)
@@ -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: branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm (168808 => 168809)


--- branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm	2014-05-14 08:02:13 UTC (rev 168808)
+++ branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm	2014-05-14 08:04:56 UTC (rev 168809)
@@ -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: branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationInternal.h (168808 => 168809)


--- branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationInternal.h	2014-05-14 08:02:13 UTC (rev 168808)
+++ branches/safari-538.34-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationInternal.h	2014-05-14 08:04:56 UTC (rev 168809)
@@ -36,6 +36,8 @@
 @property (nonatomic, setter=_setContentProviderRegistry:) WKWebViewContentProviderRegistry *_contentProviderRegistry;
 #endif
 
+- (void)_validate;
+
 @end
 
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to