Title: [168603] trunk
Revision
168603
Author
[email protected]
Date
2014-05-11 15:12:17 -0700 (Sun, 11 May 2014)

Log Message

Add a WKContextConfigurationRef object and make the injected bundle path part of the configuration
https://bugs.webkit.org/show_bug.cgi?id=132806

Source/WebKit2:
<rdar://problem/16830143>

Reviewed by Beth Dakin.

Many setters on WKContextRef really only make sense to set early on, so move to a pattern where we create a
configuration object, a WKContextConfiguration which WKContexts can be created from. Add the injected bundle path
as a configuration property. More setters will follow.

* Shared/API/c/WKBase.h:
Add WKContextConfigurationRef.

* Shared/APIObject.h:
Add ContextConfiguration enum declaration.

* UIProcess/API/C/WKAPICast.h:
Handle WKContextConfigurationRef.

* UIProcess/API/C/WKContext.cpp:
(WKContextCreate):
Create an empty WKContextConfigurationRef object and pass it to WKContextCreateWithConfiguration.

(WKContextCreateWithInjectedBundlePath):
Create a WKContextConfigurationRef object, set its bundle path and pass the configuration to WKContextCreateWithConfiguration.

(WKContextCreateWithConfiguration):
Convert the WKContextConfigurationRef object to a WebContextConfiguration and pass it to WebContext::create.

* UIProcess/API/C/WKContext.h:
Add WKContextCreateWithConfiguration.

* UIProcess/API/C/WKContextConfigurationRef.cpp: Added.
(WKContextConfigurationCreate):
Create an API::ContextConfiguration object.

(WKContextConfigurationCopyInjectedBundlePath):
Return the injected bundle path.

(WKContextConfigurationSetInjectedBundlePath):
Set the injected bundle path.

* UIProcess/API/C/WKContextConfigurationRef.h: Added.
New C SPI header.

* UIProcess/API/Cocoa/WKProcessGroup.mm:
(-[WKProcessGroup initWithInjectedBundleURL:]):
Construct a WebContextConfiguration object and pass it to WebContext::Create.

* UIProcess/API/Cocoa/WKProcessPool.mm:
(-[WKProcessPool _initWithConfiguration:]):
Construct a WebContextConfiguration object and pass it to WebContext::Create.

* UIProcess/APIContextConfiguration.cpp: Added.
New API::ContextConfiguration object.

(API::ContextConfiguration::webContextConfiguration):
Construct a WebContextConfiguration struct from our current configuration.

* UIProcess/APIContextConfiguration.h: Added.

* UIProcess/WebContext.cpp:
(WebKit::WebContext::create):
Pass the WebContextConfiguration to the constructor.

(WebKit::WebContext::WebContext):
Set the injected bundle path from the WebContextConfiguration object.

* UIProcess/WebContext.h:
Change the WebContext constructor and create function to take a WebContextConfiguration object.

* WebKit2.xcodeproj/project.pbxproj:
Add new files.

Tools:

Reviewed by Beth Dakin.

Migrate to WKContextConfiguration.

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (168602 => 168603)


--- trunk/Source/WebKit2/ChangeLog	2014-05-11 21:02:52 UTC (rev 168602)
+++ trunk/Source/WebKit2/ChangeLog	2014-05-11 22:12:17 UTC (rev 168603)
@@ -1,3 +1,79 @@
+2014-05-11  Anders Carlsson  <[email protected]>
+
+        Add a WKContextConfigurationRef object and make the injected bundle path part of the configuration
+        https://bugs.webkit.org/show_bug.cgi?id=132806
+        <rdar://problem/16830143>
+
+        Reviewed by Beth Dakin.
+
+        Many setters on WKContextRef really only make sense to set early on, so move to a pattern where we create a
+        configuration object, a WKContextConfiguration which WKContexts can be created from. Add the injected bundle path
+        as a configuration property. More setters will follow.
+
+        * Shared/API/c/WKBase.h:
+        Add WKContextConfigurationRef.
+
+        * Shared/APIObject.h:
+        Add ContextConfiguration enum declaration.
+
+        * UIProcess/API/C/WKAPICast.h:
+        Handle WKContextConfigurationRef.
+
+        * UIProcess/API/C/WKContext.cpp:
+        (WKContextCreate):
+        Create an empty WKContextConfigurationRef object and pass it to WKContextCreateWithConfiguration.
+
+        (WKContextCreateWithInjectedBundlePath):
+        Create a WKContextConfigurationRef object, set its bundle path and pass the configuration to WKContextCreateWithConfiguration.
+
+        (WKContextCreateWithConfiguration):
+        Convert the WKContextConfigurationRef object to a WebContextConfiguration and pass it to WebContext::create.
+
+        * UIProcess/API/C/WKContext.h:
+        Add WKContextCreateWithConfiguration.
+
+        * UIProcess/API/C/WKContextConfigurationRef.cpp: Added.
+        (WKContextConfigurationCreate):
+        Create an API::ContextConfiguration object.
+
+        (WKContextConfigurationCopyInjectedBundlePath):
+        Return the injected bundle path.
+
+        (WKContextConfigurationSetInjectedBundlePath):
+        Set the injected bundle path.
+
+        * UIProcess/API/C/WKContextConfigurationRef.h: Added.
+        New C SPI header.
+        
+        * UIProcess/API/Cocoa/WKProcessGroup.mm:
+        (-[WKProcessGroup initWithInjectedBundleURL:]):
+        Construct a WebContextConfiguration object and pass it to WebContext::Create.
+    
+        * UIProcess/API/Cocoa/WKProcessPool.mm:
+        (-[WKProcessPool _initWithConfiguration:]):
+        Construct a WebContextConfiguration object and pass it to WebContext::Create.
+
+        * UIProcess/APIContextConfiguration.cpp: Added.
+        New API::ContextConfiguration object.
+
+        (API::ContextConfiguration::webContextConfiguration):
+        Construct a WebContextConfiguration struct from our current configuration.
+
+        * UIProcess/APIContextConfiguration.h: Added.
+        
+        * UIProcess/WebContext.cpp:
+        (WebKit::WebContext::create):
+        Pass the WebContextConfiguration to the constructor.
+
+        (WebKit::WebContext::WebContext):
+        Set the injected bundle path from the WebContextConfiguration object.
+
+        * UIProcess/WebContext.h:
+        Change the WebContext constructor and create function to take a WebContextConfiguration object.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        Add new files.
+
 2014-05-10  Csaba Osztrogonác  <[email protected]>
 
         [WK2] URTBF after r168585.

Modified: trunk/Source/WebKit2/Shared/API/c/WKBase.h (168602 => 168603)


--- trunk/Source/WebKit2/Shared/API/c/WKBase.h	2014-05-11 21:02:52 UTC (rev 168602)
+++ trunk/Source/WebKit2/Shared/API/c/WKBase.h	2014-05-11 22:12:17 UTC (rev 168603)
@@ -94,6 +94,7 @@
 typedef const struct OpaqueWKResourceCacheManager* WKResourceCacheManagerRef;
 typedef const struct OpaqueWKColorPickerResultListener* WKColorPickerResultListenerRef;
 typedef const struct OpaqueWKContext* WKContextRef;
+typedef const struct OpaqueWKContextConfiguration* WKContextConfigurationRef;
 typedef const struct OpaqueWKCookieManager* WKCookieManagerRef;
 typedef const struct OpaqueWKCredential* WKCredentialRef;
 typedef const struct OpaqueWKDatabaseManager* WKDatabaseManagerRef;

Modified: trunk/Source/WebKit2/Shared/APIObject.h (168602 => 168603)


--- trunk/Source/WebKit2/Shared/APIObject.h	2014-05-11 21:02:52 UTC (rev 168602)
+++ trunk/Source/WebKit2/Shared/APIObject.h	2014-05-11 22:12:17 UTC (rev 168603)
@@ -101,6 +101,7 @@
         CacheManager,
         ColorPickerResultListener,
         Context,
+        ContextConfiguration,
         CookieManager,
         DatabaseManager,
         Download,

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h (168602 => 168603)


--- trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h	2014-05-11 21:02:52 UTC (rev 168602)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h	2014-05-11 22:12:17 UTC (rev 168603)
@@ -51,6 +51,7 @@
 #include <WebCore/Settings.h>
 
 namespace API {
+class ContextConfiguration;
 class NavigationData;
 }
 
@@ -111,6 +112,7 @@
 WK_ADD_API_MAPPING(WKResourceCacheManagerRef, WebResourceCacheManagerProxy)
 WK_ADD_API_MAPPING(WKColorPickerResultListenerRef, WebColorPickerResultListenerProxy)
 WK_ADD_API_MAPPING(WKContextRef, WebContext)
+WK_ADD_API_MAPPING(WKContextConfigurationRef, API::ContextConfiguration)
 WK_ADD_API_MAPPING(WKCookieManagerRef, WebCookieManagerProxy)
 WK_ADD_API_MAPPING(WKCredentialRef, WebCredential)
 WK_ADD_API_MAPPING(WKDatabaseManagerRef, WebDatabaseManagerProxy)

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp (168602 => 168603)


--- trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp	2014-05-11 21:02:52 UTC (rev 168602)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp	2014-05-11 22:12:17 UTC (rev 168603)
@@ -27,11 +27,13 @@
 #include "WKContextPrivate.h"
 
 #include "APIClient.h"
+#include "APIContextConfiguration.h"
 #include "APIDownloadClient.h"
 #include "APIHistoryClient.h"
 #include "APINavigationData.h"
 #include "APIURLRequest.h"
 #include "WKAPICast.h"
+#include "WKContextConfigurationRef.h"
 #include "WKRetainPtr.h"
 #include "WebContext.h"
 #include <wtf/PassRefPtr.h>
@@ -75,16 +77,22 @@
 
 WKContextRef WKContextCreate()
 {
-    RefPtr<WebContext> context = WebContext::create(String());
-    return toAPI(context.release().leakRef());
+    return WKContextCreateWithConfiguration(adoptWK(WKContextConfigurationCreate()).get());
 }
 
 WKContextRef WKContextCreateWithInjectedBundlePath(WKStringRef pathRef)
 {
-    RefPtr<WebContext> context = WebContext::create(toImpl(pathRef)->string());
-    return toAPI(context.release().leakRef());
+    auto configuration = adoptWK(WKContextConfigurationCreate());
+    WKContextConfigurationSetInjectedBundlePath(configuration.get(), pathRef);
+
+    return WKContextCreateWithConfiguration(configuration.get());
 }
 
+WKContextRef WKContextCreateWithConfiguration(WKContextConfigurationRef configuration)
+{
+    return toAPI(WebContext::create(toImpl(configuration)->webContextConfiguration()).leakRef());
+}
+
 void WKContextSetClient(WKContextRef contextRef, const WKContextClientBase* wkClient)
 {
     toImpl(contextRef)->initializeClient(wkClient);

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKContext.h (168602 => 168603)


--- trunk/Source/WebKit2/UIProcess/API/C/WKContext.h	2014-05-11 21:02:52 UTC (rev 168602)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKContext.h	2014-05-11 22:12:17 UTC (rev 168603)
@@ -102,6 +102,7 @@
 
 WK_EXPORT WKContextRef WKContextCreate();
 WK_EXPORT WKContextRef WKContextCreateWithInjectedBundlePath(WKStringRef path);
+WK_EXPORT WKContextRef WKContextCreateWithConfiguration(WKContextConfigurationRef configuration);
 
 WK_EXPORT void WKContextSetClient(WKContextRef context, const WKContextClientBase* client);
 WK_EXPORT void WKContextSetInjectedBundleClient(WKContextRef context, const WKContextInjectedBundleClientBase* client);

Added: trunk/Source/WebKit2/UIProcess/API/C/WKContextConfigurationRef.cpp (0 => 168603)


--- trunk/Source/WebKit2/UIProcess/API/C/WKContextConfigurationRef.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKContextConfigurationRef.cpp	2014-05-11 22:12:17 UTC (rev 168603)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WKContextConfigurationRef.h"
+
+#include "APIContextConfiguration.h"
+#include "WKAPICast.h"
+
+using namespace WebKit;
+
+WKContextConfigurationRef WKContextConfigurationCreate()
+{
+    return toAPI(API::ContextConfiguration::create().leakRef());
+}
+
+WKStringRef WKContextConfigurationCopyInjectedBundlePath(WKContextConfigurationRef configuration)
+{
+    return toCopiedAPI(toImpl(configuration)->injectedBundlePath());
+}
+
+void WKContextConfigurationSetInjectedBundlePath(WKContextConfigurationRef configuration, WKStringRef injectedBundlePath)
+{
+    toImpl(configuration)->setInjectedBundlePath(toImpl(injectedBundlePath)->string());
+}

Added: trunk/Source/WebKit2/UIProcess/API/C/WKContextConfigurationRef.h (0 => 168603)


--- trunk/Source/WebKit2/UIProcess/API/C/WKContextConfigurationRef.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKContextConfigurationRef.h	2014-05-11 22:12:17 UTC (rev 168603)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WKContextConfigurationRef_h
+#define WKContextConfigurationRef_h
+
+#include <WebKit/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKContextConfigurationRef WKContextConfigurationCreate();
+
+WK_EXPORT WKStringRef WKContextConfigurationCopyInjectedBundlePath(WKContextConfigurationRef configuration);
+WK_EXPORT void WKContextConfigurationSetInjectedBundlePath(WKContextConfigurationRef configuration, WKStringRef injectedBundlePath);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif // WKContextConfigurationRef_h

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessGroup.mm (168602 => 168603)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessGroup.mm	2014-05-11 21:02:52 UTC (rev 168602)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessGroup.mm	2014-05-11 22:12:17 UTC (rev 168603)
@@ -189,8 +189,11 @@
     InitWebCoreThreadSystemInterface();
 #endif
 
-    _context = WebContext::create(bundleURL ? String([bundleURL path]) : String());
+    WebContextConfiguration webContextConfiguration;
+    webContextConfiguration.injectedBundlePath = bundleURL ? String(bundleURL.path) : String();
 
+    _context = WebContext::create(std::move(webContextConfiguration));
+
     setUpConnectionClient(self, toAPI(_context.get()));
     setUpInectedBundleClient(self, toAPI(_context.get()));
     setUpHistoryClient(self, toAPI(_context.get()));

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm (168602 => 168603)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm	2014-05-11 21:02:52 UTC (rev 168602)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm	2014-05-11 22:12:17 UTC (rev 168603)
@@ -116,15 +116,16 @@
     InitWebCoreThreadSystemInterface();
 #endif
 
-    String bundlePath;
+    WebKit::WebContextConfiguration webContextConfiguration;
+
     if (NSURL *bundleURL = [_configuration injectedBundleURL]) {
         if (!bundleURL.isFileURL)
             [NSException raise:NSInvalidArgumentException format:@"Injected Bundle URL must be a file URL"];
 
-        bundlePath = bundleURL.path;
+        webContextConfiguration.injectedBundlePath = bundleURL.path;
     }
 
-    API::Object::constructInWrapper<WebKit::WebContext>(self, bundlePath);
+    API::Object::constructInWrapper<WebKit::WebContext>(self, std::move(webContextConfiguration));
     _context->setHistoryClient(std::make_unique<WebKit::HistoryClient>());
     _context->setUsesNetworkProcess(true);
     _context->setProcessModel(WebKit::ProcessModelMultipleSecondaryProcesses);

Added: trunk/Source/WebKit2/UIProcess/APIContextConfiguration.cpp (0 => 168603)


--- trunk/Source/WebKit2/UIProcess/APIContextConfiguration.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/APIContextConfiguration.cpp	2014-05-11 22:12:17 UTC (rev 168603)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "APIContextConfiguration.h"
+
+#include "WebContext.h"
+namespace API {
+
+ContextConfiguration::ContextConfiguration()
+{
+}
+
+ContextConfiguration::~ContextConfiguration()
+{
+}
+
+WebKit::WebContextConfiguration ContextConfiguration::webContextConfiguration() const
+{
+    WebKit::WebContextConfiguration configuration;
+
+    configuration.injectedBundlePath = m_injectedBundlePath;
+
+    return configuration;
+}
+
+} // namespace API

Added: trunk/Source/WebKit2/UIProcess/APIContextConfiguration.h (0 => 168603)


--- trunk/Source/WebKit2/UIProcess/APIContextConfiguration.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/APIContextConfiguration.h	2014-05-11 22:12:17 UTC (rev 168603)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef APIContextConfiguration_h
+#define APIContextConfiguration_h
+
+#include "APIObject.h"
+#include <wtf/text/WTFString.h>
+
+namespace WebKit {
+struct WebContextConfiguration;
+}
+
+namespace API {
+
+class ContextConfiguration : public ObjectImpl<Object::Type::ContextConfiguration> {
+public:
+    static PassRefPtr<ContextConfiguration> create()
+    {
+        return adoptRef(new ContextConfiguration);
+    }
+    virtual ~ContextConfiguration();
+
+    String injectedBundlePath() { return m_injectedBundlePath; }
+    void setInjectedBundlePath(const String& injectedBundlePath) { m_injectedBundlePath = injectedBundlePath; }
+
+    WebKit::WebContextConfiguration webContextConfiguration() const;
+
+private:
+    ContextConfiguration();
+
+    String m_injectedBundlePath;
+};
+
+} // namespace API
+
+#endif // APIContextConfiguration_h

Modified: trunk/Source/WebKit2/UIProcess/WebContext.cpp (168602 => 168603)


--- trunk/Source/WebKit2/UIProcess/WebContext.cpp	2014-05-11 21:02:52 UTC (rev 168602)
+++ trunk/Source/WebKit2/UIProcess/WebContext.cpp	2014-05-11 22:12:17 UTC (rev 168603)
@@ -117,10 +117,10 @@
 
 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, webContextCounter, ("WebContext"));
 
-PassRefPtr<WebContext> WebContext::create(const String& injectedBundlePath)
+PassRefPtr<WebContext> WebContext::create(WebContextConfiguration configuration)
 {
     InitializeWebKit2();
-    return adoptRef(new WebContext(injectedBundlePath));
+    return adoptRef(new WebContext(std::move(configuration)));
 }
 
 static Vector<WebContext*>& contexts()
@@ -134,13 +134,13 @@
     return contexts();
 }
 
-WebContext::WebContext(const String& injectedBundlePath)
+WebContext::WebContext(WebContextConfiguration configuration)
     : m_processModel(ProcessModelSharedSecondaryProcess)
     , m_webProcessCountLimit(UINT_MAX)
     , m_haveInitialEmptyProcess(false)
     , m_processWithPageCache(0)
     , m_defaultPageGroup(WebPageGroup::createNonNull())
-    , m_injectedBundlePath(injectedBundlePath)
+    , m_injectedBundlePath(configuration.injectedBundlePath)
     , m_downloadClient(std::make_unique<API::DownloadClient>())
     , m_historyClient(std::make_unique<API::HistoryClient>())
     , m_visitedLinkProvider(VisitedLinkProvider::create())

Modified: trunk/Source/WebKit2/UIProcess/WebContext.h (168602 => 168603)


--- trunk/Source/WebKit2/UIProcess/WebContext.h	2014-05-11 21:02:52 UTC (rev 168602)
+++ trunk/Source/WebKit2/UIProcess/WebContext.h	2014-05-11 22:12:17 UTC (rev 168603)
@@ -95,15 +95,19 @@
 int webProcessThroughputQOS();
 #endif
 
+struct WebContextConfiguration {
+    String injectedBundlePath;
+};
+
 class WebContext : public API::ObjectImpl<API::Object::Type::Context>, private IPC::MessageReceiver
 #if ENABLE(NETSCAPE_PLUGIN_API)
     , private PluginInfoStoreClient
 #endif
     {
 public:
-    WebContext(const String& injectedBundlePath);
-
-    static PassRefPtr<WebContext> create(const String& injectedBundlePath);
+    WebContext(WebContextConfiguration);
+        
+    static PassRefPtr<WebContext> create(WebContextConfiguration);
     virtual ~WebContext();
 
     static const Vector<WebContext*>& allContexts();

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (168602 => 168603)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2014-05-11 21:02:52 UTC (rev 168602)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2014-05-11 22:12:17 UTC (rev 168603)
@@ -418,6 +418,10 @@
 		1AE4987911FF7FAA0048B464 /* JSNPObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE4987711FF7FAA0048B464 /* JSNPObject.cpp */; };
 		1AE49A4911FFA8CE0048B464 /* JSNPMethod.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE49A4711FFA8CE0048B464 /* JSNPMethod.h */; };
 		1AE49A4A11FFA8CE0048B464 /* JSNPMethod.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE49A4811FFA8CE0048B464 /* JSNPMethod.cpp */; };
+		1AE52F9119201DA700A1FA37 /* APIContextConfiguration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE52F8F19201DA700A1FA37 /* APIContextConfiguration.cpp */; };
+		1AE52F9219201DA700A1FA37 /* APIContextConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE52F9019201DA700A1FA37 /* APIContextConfiguration.h */; };
+		1AE52F971920263300A1FA37 /* WKContextConfigurationRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE52F9319201F6B00A1FA37 /* WKContextConfigurationRef.cpp */; };
+		1AE52F981920267200A1FA37 /* WKContextConfigurationRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE52F9419201F6B00A1FA37 /* WKContextConfigurationRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1AE5B7FB11E7AED200BA6767 /* NetscapePluginMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AE5B7F911E7AED200BA6767 /* NetscapePluginMac.mm */; settings = {COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; };
 		1AEFCC1211D01F96008219D3 /* PluginInfoStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AEFCC1011D01F96008219D3 /* PluginInfoStore.h */; };
 		1AEFCC1311D01F96008219D3 /* PluginInfoStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AEFCC1111D01F96008219D3 /* PluginInfoStore.cpp */; };
@@ -2320,6 +2324,10 @@
 		1AE4987711FF7FAA0048B464 /* JSNPObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNPObject.cpp; sourceTree = "<group>"; };
 		1AE49A4711FFA8CE0048B464 /* JSNPMethod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNPMethod.h; sourceTree = "<group>"; };
 		1AE49A4811FFA8CE0048B464 /* JSNPMethod.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNPMethod.cpp; sourceTree = "<group>"; };
+		1AE52F8F19201DA700A1FA37 /* APIContextConfiguration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIContextConfiguration.cpp; sourceTree = "<group>"; };
+		1AE52F9019201DA700A1FA37 /* APIContextConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIContextConfiguration.h; sourceTree = "<group>"; };
+		1AE52F9319201F6B00A1FA37 /* WKContextConfigurationRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKContextConfigurationRef.cpp; sourceTree = "<group>"; };
+		1AE52F9419201F6B00A1FA37 /* WKContextConfigurationRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContextConfigurationRef.h; sourceTree = "<group>"; };
 		1AE5B7F911E7AED200BA6767 /* NetscapePluginMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetscapePluginMac.mm; sourceTree = "<group>"; };
 		1AEFCC1011D01F96008219D3 /* PluginInfoStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginInfoStore.h; sourceTree = "<group>"; };
 		1AEFCC1111D01F96008219D3 /* PluginInfoStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginInfoStore.cpp; sourceTree = "<group>"; };
@@ -5543,6 +5551,8 @@
 				1AEFCC0511D01F34008219D3 /* Plugins */,
 				0F594793187B3B4C00437857 /* Scrolling */,
 				1A44B95816B73F8C00B7BBD8 /* Storage */,
+				1AE52F8F19201DA700A1FA37 /* APIContextConfiguration.cpp */,
+				1AE52F9019201DA700A1FA37 /* APIContextConfiguration.h */,
 				BCF69FA11176D01400471A52 /* APINavigationData.cpp */,
 				BCF69FA01176D01400471A52 /* APINavigationData.h */,
 				75A8D2DD187DE87400C39C9E /* APISession.cpp */,
@@ -5786,6 +5796,8 @@
 				33367639130C99DC006C9DE2 /* WKResourceCacheManager.h */,
 				75A8D2D0187D17BF00C39C9E /* WKSessionRef.cpp */,
 				75A8D2D1187D17BF00C39C9E /* WKSessionRef.h */,
+				1AE52F9319201F6B00A1FA37 /* WKContextConfigurationRef.cpp */,
+				1AE52F9419201F6B00A1FA37 /* WKContextConfigurationRef.h */,
 			);
 			path = C;
 			sourceTree = "<group>";
@@ -6910,6 +6922,7 @@
 				515E7728183DD6F60007203F /* AsyncRequest.h in Headers */,
 				BCE81D8D1319F7EF00241910 /* FontInfo.h in Headers */,
 				1ABC3DFC1899F51C004F0626 /* WKNavigationDelegate.h in Headers */,
+				1AE52F9219201DA700A1FA37 /* APIContextConfiguration.h in Headers */,
 				E105FE5418D7B9DE008F57A8 /* EditingRange.h in Headers */,
 				2D140EB018F37BE0005E75A0 /* PageOverlayController.h in Headers */,
 				BC17753F118BABF0007D9E9A /* GenericCallback.h in Headers */,
@@ -7176,6 +7189,7 @@
 				75E749EC180DBB9800088BA6 /* WebOriginDataManagerProxyMessages.h in Headers */,
 				512935D81288D19400A4B695 /* WebContextMenuItem.h in Headers */,
 				00B9661618E24CBA00CE1F88 /* APIFindClient.h in Headers */,
+				1AE52F981920267200A1FA37 /* WKContextConfigurationRef.h in Headers */,
 				510FBB9B1288C95E00AFFDF4 /* WebContextMenuItemData.h in Headers */,
 				51ACBB82127A8BAD00D203B9 /* WebContextMenuProxy.h in Headers */,
 				1AB8A1F418400B8F00E9AE69 /* WKPageFindClient.h in Headers */,
@@ -8631,6 +8645,7 @@
 				1A2161B111F37664008AD0F5 /* NPRuntimeObjectMap.cpp in Sources */,
 				1A2162B011F38971008AD0F5 /* NPRuntimeUtilities.cpp in Sources */,
 				1A9E329E1822FEDD00F5D04C /* WKRemoteObjectCoder.mm in Sources */,
+				1AE52F971920263300A1FA37 /* WKContextConfigurationRef.cpp in Sources */,
 				1A2D84A4127F6AD1001EB962 /* NPVariantData.cpp in Sources */,
 				BC8ACA1416670D89004C1941 /* ObjCObjectGraph.mm in Sources */,
 				BC8ACA1616670D89004C1941 /* ObjCObjectGraphCoders.mm in Sources */,
@@ -9043,6 +9058,7 @@
 				BCB9E24C1120E15C00A137E0 /* WKContext.cpp in Sources */,
 				51A555F5128C6C47009ABCEC /* WKContextMenuItem.cpp in Sources */,
 				9FB5F394169E6A80002C25BF /* WKContextPrivateMac.mm in Sources */,
+				1AE52F9119201DA700A1FA37 /* APIContextConfiguration.cpp in Sources */,
 				3309345A1315B9980097A7BC /* WKCookieManager.cpp in Sources */,
 				512F58F912A88A5400629530 /* WKCredential.cpp in Sources */,
 				759CCD581808F1640078E8A8 /* WebOriginDataManagerProxyChangeClient.cpp in Sources */,

Modified: trunk/Tools/ChangeLog (168602 => 168603)


--- trunk/Tools/ChangeLog	2014-05-11 21:02:52 UTC (rev 168602)
+++ trunk/Tools/ChangeLog	2014-05-11 22:12:17 UTC (rev 168603)
@@ -1,3 +1,15 @@
+2014-05-11  Anders Carlsson  <[email protected]>
+
+        Add a WKContextConfigurationRef object and make the injected bundle path part of the configuration
+        https://bugs.webkit.org/show_bug.cgi?id=132806
+
+        Reviewed by Beth Dakin.
+
+        Migrate to WKContextConfiguration.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::initialize):
+
 2014-05-10  Carlos Garcia Campos  <[email protected]>
 
         REGRESSION(CMAKE): [GTK] WebKit2 C API tests are not longer built in the same binary

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (168602 => 168603)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2014-05-11 21:02:52 UTC (rev 168602)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2014-05-11 22:12:17 UTC (rev 168603)
@@ -33,6 +33,7 @@
 #include "TestInvocation.h"
 #include <WebKit2/WKAuthenticationChallenge.h>
 #include <WebKit2/WKAuthenticationDecisionListener.h>
+#include <WebKit2/WKContextConfigurationRef.h>
 #include <WebKit2/WKContextPrivate.h>
 #include <WebKit2/WKCredential.h>
 #include <WebKit2/WKIconDatabase.h>
@@ -326,7 +327,10 @@
     WKRetainPtr<WKStringRef> pageGroupIdentifier(AdoptWK, WKStringCreateWithUTF8CString("WebKitTestRunnerPageGroup"));
     m_pageGroup.adopt(WKPageGroupCreateWithIdentifier(pageGroupIdentifier.get()));
 
-    m_context.adopt(WKContextCreateWithInjectedBundlePath(injectedBundlePath()));
+    auto configuration = adoptWK(WKContextConfigurationCreate());
+    WKContextConfigurationSetInjectedBundlePath(configuration.get(), injectedBundlePath());
+
+    m_context = adoptWK(WKContextCreateWithConfiguration(configuration.get()));
     m_geolocationProvider = adoptPtr(new GeolocationProviderMock(m_context.get()));
 
 #if PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED > 1080)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to