Unreviewed, rolling out r247745.
authorrussell_e@apple.com <russell_e@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Jul 2019 00:03:10 +0000 (00:03 +0000)
committerrussell_e@apple.com <russell_e@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Jul 2019 00:03:10 +0000 (00:03 +0000)
This broke API test
TestWebKitAPI.WKProcessPool.JavaScriptConfiguration as
indicated by EWS

Reverted changeset:

"Move javaScriptConfigurationDirectory SPI from
_WKProcessPoolConfiguration to WKProcessPoolPrivate to make it
runtime switchable"
https://bugs.webkit.org/show_bug.cgi?id=200045
https://trac.webkit.org/changeset/247745

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247757 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp
Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h
Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm
Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h
Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h
Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/WebProcessPool.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/WKProcessPoolConfiguration.mm

index 174cf84..49f7f8e 100644 (file)
@@ -1,3 +1,19 @@
+2019-07-23  Russell Epstein  <repstein@apple.com>
+
+        Unreviewed, rolling out r247745.
+
+        This broke API test
+        TestWebKitAPI.WKProcessPool.JavaScriptConfiguration as
+        indicated by EWS
+
+        Reverted changeset:
+
+        "Move javaScriptConfigurationDirectory SPI from
+        _WKProcessPoolConfiguration to WKProcessPoolPrivate to make it
+        runtime switchable"
+        https://bugs.webkit.org/show_bug.cgi?id=200045
+        https://trac.webkit.org/changeset/247745
+
 2019-07-23  Chris Fleizach  <cfleizach@apple.com>
 
         AX: CrashTracer: com.apple.WebKit.WebContent at WebKit: WebKit::WebSpeechSynthesisClient::speak
index 4ca94ea..bad1478 100644 (file)
@@ -99,6 +99,7 @@ Ref<ProcessPoolConfiguration> ProcessPoolConfiguration::copy()
     copy->m_deviceIdHashSaltsStorageDirectory = this->m_deviceIdHashSaltsStorageDirectory;
     copy->m_mediaKeysStorageDirectory = this->m_mediaKeysStorageDirectory;
     copy->m_resourceLoadStatisticsDirectory = this->m_resourceLoadStatisticsDirectory;
+    copy->m_javaScriptConfigurationDirectory = this->m_javaScriptConfigurationDirectory;
     copy->m_webSQLDatabaseDirectory = this->m_webSQLDatabaseDirectory;
     copy->m_cachePartitionedURLSchemes = this->m_cachePartitionedURLSchemes;
     copy->m_alwaysRevalidatedURLSchemes = this->m_alwaysRevalidatedURLSchemes;
index b454131..872ceff 100644 (file)
@@ -114,6 +114,9 @@ public:
     const WTF::String& resourceLoadStatisticsDirectory() const { return m_resourceLoadStatisticsDirectory; }
     void setResourceLoadStatisticsDirectory(const WTF::String& resourceLoadStatisticsDirectory) { m_resourceLoadStatisticsDirectory = resourceLoadStatisticsDirectory; }
 
+    const WTF::String& javaScriptConfigurationDirectory() const { return m_javaScriptConfigurationDirectory; }
+    void setJavaScriptConfigurationDirectory(const WTF::String& javaScriptConfigurationDirectory) { m_javaScriptConfigurationDirectory = javaScriptConfigurationDirectory; }
+
     const Vector<WTF::String>& cachePartitionedURLSchemes() { return m_cachePartitionedURLSchemes; }
     void setCachePartitionedURLSchemes(Vector<WTF::String>&& cachePartitionedURLSchemes) { m_cachePartitionedURLSchemes = WTFMove(cachePartitionedURLSchemes); }
 
@@ -202,6 +205,7 @@ private:
     WTF::String m_webSQLDatabaseDirectory;
     WTF::String m_mediaKeysStorageDirectory;
     WTF::String m_resourceLoadStatisticsDirectory;
+    WTF::String m_javaScriptConfigurationDirectory;
     Vector<WTF::String> m_cachePartitionedURLSchemes;
     Vector<WTF::String> m_alwaysRevalidatedURLSchemes;
     Vector<WTF::CString> m_additionalReadAccessAllowedPaths;
index 72aef9c..cae9d78 100644 (file)
@@ -403,18 +403,6 @@ static NSDictionary *policiesHashMapToDictionary(const HashMap<String, HashMap<S
     _processPool->setAutomationSession(automationSession ? automationSession->_session.get() : nullptr);
 }
 
-- (NSURL *)_javaScriptConfigurationDirectory
-{
-    return [NSURL fileURLWithPath:_processPool->javaScriptConfigurationDirectory() isDirectory:YES];
-}
-
-- (void)_setJavaScriptConfigurationDirectory:(NSURL *)directory
-{
-    if (directory && ![directory isFileURL])
-        [NSException raise:NSInvalidArgumentException format:@"%@ is not a file URL", directory];
-    _processPool->setJavaScriptConfigurationDirectory(directory.path);
-}
-
 - (void)_addSupportedPlugin:(NSString *) domain named:(NSString *) name withMimeTypes: (NSSet<NSString *> *) nsMimeTypes withExtensions: (NSSet<NSString *> *) nsExtensions
 {
     HashSet<String> mimeTypes;
index 806cbc4..cb15a3e 100644 (file)
@@ -74,8 +74,6 @@
 - (void)_automationCapabilitiesDidChange WK_API_AVAILABLE(macos(10.12), ios(10.0));
 - (void)_setAutomationSession:(_WKAutomationSession *)automationSession WK_API_AVAILABLE(macos(10.12), ios(10.0));
 
-@property (nonatomic, copy, setter=_setJavaScriptConfigurationDirectory:) NSURL *_javaScriptConfigurationDirectory WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
-
 - (void)_addSupportedPlugin:(NSString *) domain named:(NSString *) name withMimeTypes: (NSSet<NSString *> *) mimeTypes withExtensions: (NSSet<NSString *> *) extensions WK_API_AVAILABLE(macos(10.14), ios(12.0));
 - (void)_clearSupportedPlugins WK_API_AVAILABLE(macos(10.14), ios(12.0));
 
index fdd411f..eea4297 100644 (file)
@@ -45,6 +45,8 @@ WK_CLASS_AVAILABLE(macos(10.10), ios(8.0))
 @property (nonatomic) NSUInteger wirelessContextIdentifier WK_API_DEPRECATED("Use of this API is no longer necessary and can be removed", ios(10.12, WK_IOS_TBA));
 #endif
 
+@property (nonatomic, nullable, copy) NSURL *javaScriptConfigurationDirectory WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+
 // Network Process properties
 // FIXME: These should be be per-session/data store when we support multiple non-persistent sessions/data stores.
 
index dec574c..2192d87 100644 (file)
     return _processPoolConfiguration->setAttrStyleEnabled(enabled);
 }
 
+- (NSURL *)javaScriptConfigurationDirectory
+{
+    return [NSURL fileURLWithPath:_processPoolConfiguration->javaScriptConfigurationDirectory() isDirectory:YES];
+}
+
+- (void)setJavaScriptConfigurationDirectory:(NSURL *)directory
+{
+    if (directory && ![directory isFileURL])
+        [NSException raise:NSInvalidArgumentException format:@"%@ is not a file URL", directory];
+    _processPoolConfiguration->setJavaScriptConfigurationDirectory(directory.path);
+}
+
 - (NSArray<NSURL *> *)additionalReadAccessAllowedURLs
 {
     auto paths = _processPoolConfiguration->additionalReadAccessAllowedPaths();
index ee84ace..ca2d209 100644 (file)
@@ -220,6 +220,7 @@ static Ref<WebsiteDataStoreConfiguration> legacyWebsiteDataStoreConfiguration(AP
     configuration->setIndexedDBDatabaseDirectory(String(processPoolConfiguration.indexedDBDatabaseDirectory()));
     configuration->setResourceLoadStatisticsDirectory(String(processPoolConfiguration.resourceLoadStatisticsDirectory()));
     configuration->setNetworkCacheDirectory(String(processPoolConfiguration.diskCacheDirectory()));
+    configuration->setJavaScriptConfigurationDirectory(String(processPoolConfiguration.javaScriptConfigurationDirectory()));
 
     return configuration;
 }
@@ -892,9 +893,9 @@ void WebProcessPool::sendWebProcessDataStoreParameters(WebProcessProxy& process,
         SandboxExtension::createHandleWithoutResolvingPath(parameters.mediaKeyStorageDirectory, SandboxExtension::Type::ReadWrite, parameters.mediaKeyStorageDirectoryExtensionHandle);
 
     
-    if (!m_javaScriptConfigurationDirectory.isEmpty())
-        parameters.javaScriptConfigurationDirectory = m_javaScriptConfigurationDirectory;
-    else if (javaScriptConfigurationFileEnabled())
+    if (auto& directory = configuration().javaScriptConfigurationDirectory(); !directory.isEmpty())
+        parameters.javaScriptConfigurationDirectory = directory;
+    if (javaScriptConfigurationFileEnabled())
         parameters.javaScriptConfigurationDirectory = websiteDataStore.resolvedJavaScriptConfigurationDirectory();
     if (!parameters.javaScriptConfigurationDirectory.isEmpty())
         SandboxExtension::createHandleWithoutResolvingPath(parameters.javaScriptConfigurationDirectory, SandboxExtension::Type::ReadWrite, parameters.javaScriptConfigurationDirectoryExtensionHandle);
index dae2591..06027b6 100644 (file)
@@ -529,9 +529,6 @@ public:
 
     void disableDelayedWebProcessLaunch() { m_isDelayedWebProcessLaunchDisabled = true; }
 
-    void setJavaScriptConfigurationDirectory(String&& directory) { m_javaScriptConfigurationDirectory = directory; }
-    const String& javaScriptConfigurationDirectory() const { return m_javaScriptConfigurationDirectory; }
-    
 private:
     void platformInitialize();
 
@@ -729,7 +726,6 @@ private:
 
     bool m_memoryCacheDisabled { false };
     bool m_javaScriptConfigurationFileEnabled { false };
-    String m_javaScriptConfigurationDirectory;
     bool m_alwaysRunsAtBackgroundPriority;
     bool m_shouldTakeUIBackgroundAssertion;
     bool m_shouldMakeNextWebProcessLaunchFailForTesting { false };
index 1dc9d11..5a8c309 100644 (file)
@@ -1,3 +1,19 @@
+2019-07-23  Russell Epstein  <repstein@apple.com>
+
+        Unreviewed, rolling out r247745.
+
+        This broke API test
+        TestWebKitAPI.WKProcessPool.JavaScriptConfiguration as
+        indicated by EWS
+
+        Reverted changeset:
+
+        "Move javaScriptConfigurationDirectory SPI from
+        _WKProcessPoolConfiguration to WKProcessPoolPrivate to make it
+        runtime switchable"
+        https://bugs.webkit.org/show_bug.cgi?id=200045
+        https://trac.webkit.org/changeset/247745
+
 2019-07-23  Alex Christensen  <achristensen@webkit.org>
 
         Move javaScriptConfigurationDirectory SPI from _WKProcessPoolConfiguration to WKProcessPoolPrivate to make it runtime switchable
index be43a73..d6143af 100644 (file)
@@ -84,7 +84,7 @@ TEST(WKProcessPoolConfiguration, Copy)
     EXPECT_EQ([configuration suppressesConnectionTerminationOnSystemChange], [copy suppressesConnectionTerminationOnSystemChange]);
 }
 
-TEST(WKProcessPool, JavaScriptConfiguration)
+TEST(WKProcessPoolConfiguration, JavaScriptConfiguration)
 {
     NSFileManager *fileManager = [NSFileManager defaultManager];
     NSURL *tempDir = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"CustomPathsTest"] isDirectory:YES];
@@ -105,8 +105,12 @@ TEST(WKProcessPool, JavaScriptConfiguration)
     BOOL result = [contents writeToURL:[tempDir URLByAppendingPathComponent:@"JSC.config"] atomically:YES];
     EXPECT_TRUE(result);
 
-    auto webView = adoptNS([[WKWebView alloc] init]);
-    [webView configuration].processPool._javaScriptConfigurationDirectory = tempDir;
+    auto poolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]);
+    [poolConfiguration setJavaScriptConfigurationDirectory:tempDir];
+    auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
+    [webViewConfiguration setProcessPool:[[[WKProcessPool alloc] _initWithConfiguration:poolConfiguration.get()] autorelease]];
+
+    auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
     [webView loadHTMLString:@"<html>hello</html>" baseURL:[NSURL URLWithString:@"https://webkit.org/"]];
 
     NSString *path = [tempDir URLByAppendingPathComponent:@"Log.txt"].path;