Title: [233487] trunk
Revision
233487
Author
[email protected]
Date
2018-07-03 16:54:46 -0700 (Tue, 03 Jul 2018)

Log Message

[Cocoa] Disable vnode guard related simulated crashes for WKTR / DRT and WebSQL
https://bugs.webkit.org/show_bug.cgi?id=187270
<rdar://problem/40674034>

Reviewed by Geoffrey Garen.

Source/WebCore:

Disable vnode guard related simulated crashes for WebSQL by setting the expected
environment variable, if not already set by WKTR / DRT.

* Modules/webdatabase/DatabaseManager.cpp:
(WebCore::DatabaseManager::initialize):
(WebCore::DatabaseManager::platformInitialize):
* Modules/webdatabase/DatabaseManager.h:
* Modules/webdatabase/cocoa/DatabaseManagerCocoa.mm: Added.
(WebCore::DatabaseManager::paltformInitialize):
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/FileSystem.h:
* platform/posix/FileSystemPOSIX.cpp:
(WebCore::FileSystem::realPath):
* platform/win/FileSystemWin.cpp:
(WebCore::FileSystem::realPath):

Tools:

Disable vnode guard related simulated crashes for WKTR / DRT by setting the
expected environment variable in the test driver.

* Scripts/webkitpy/port/driver.py:
(Driver._setup_environ_for_driver):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (233486 => 233487)


--- trunk/Source/WebCore/ChangeLog	2018-07-03 22:57:23 UTC (rev 233486)
+++ trunk/Source/WebCore/ChangeLog	2018-07-03 23:54:46 UTC (rev 233487)
@@ -1,3 +1,28 @@
+2018-07-03  Chris Dumez  <[email protected]>
+
+        [Cocoa] Disable vnode guard related simulated crashes for WKTR / DRT and WebSQL
+        https://bugs.webkit.org/show_bug.cgi?id=187270
+        <rdar://problem/40674034>
+
+        Reviewed by Geoffrey Garen.
+
+        Disable vnode guard related simulated crashes for WebSQL by setting the expected
+        environment variable, if not already set by WKTR / DRT.
+
+        * Modules/webdatabase/DatabaseManager.cpp:
+        (WebCore::DatabaseManager::initialize):
+        (WebCore::DatabaseManager::platformInitialize):
+        * Modules/webdatabase/DatabaseManager.h:
+        * Modules/webdatabase/cocoa/DatabaseManagerCocoa.mm: Added.
+        (WebCore::DatabaseManager::paltformInitialize):
+        * SourcesCocoa.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/FileSystem.h:
+        * platform/posix/FileSystemPOSIX.cpp:
+        (WebCore::FileSystem::realPath):
+        * platform/win/FileSystemWin.cpp:
+        (WebCore::FileSystem::realPath):
+
 2018-07-03  Eric Carlson  <[email protected]>
 
         Don't allow autoplay when the element is suspended

Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp (233486 => 233487)


--- trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp	2018-07-03 22:57:23 UTC (rev 233486)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp	2018-07-03 23:54:46 UTC (rev 233487)
@@ -77,6 +77,7 @@
 
 void DatabaseManager::initialize(const String& databasePath)
 {
+    platformInitialize(databasePath);
     DatabaseTracker::initializeTracker(databasePath);
 }
 
@@ -271,4 +272,11 @@
     context.addConsoleMessage(MessageSource::Storage, MessageLevel::Error, message);
 }
 
+#if !PLATFORM(COCOA)
+void DatabaseManager::platformInitialize(const String& databasePath)
+{
+    UNUSED_PARAM(databasePath);
+}
+#endif
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.h (233486 => 233487)


--- trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.h	2018-07-03 22:57:23 UTC (rev 233486)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.h	2018-07-03 23:54:46 UTC (rev 233487)
@@ -72,6 +72,8 @@
     DatabaseManager() = default;
     ~DatabaseManager() = delete;
 
+    void platformInitialize(const String& databasePath);
+
     enum OpenAttempt { FirstTryToOpenDatabase, RetryOpenDatabase };
     ExceptionOr<Ref<Database>> openDatabaseBackend(ScriptExecutionContext&, const String& name, const String& expectedVersion, const String& displayName, unsigned estimatedSize, bool setVersionInNewDatabase);
     ExceptionOr<Ref<Database>> tryToOpenDatabaseBackend(ScriptExecutionContext&, const String& name, const String& expectedVersion, const String& displayName, unsigned estimatedSize, bool setVersionInNewDatabase, OpenAttempt);

Added: trunk/Source/WebCore/Modules/webdatabase/cocoa/DatabaseManagerCocoa.mm (0 => 233487)


--- trunk/Source/WebCore/Modules/webdatabase/cocoa/DatabaseManagerCocoa.mm	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webdatabase/cocoa/DatabaseManagerCocoa.mm	2018-07-03 23:54:46 UTC (rev 233487)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2018 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.
+ * 3.  Neither the name of Apple Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
+ */
+
+#import "config.h"
+#import "DatabaseManager.h"
+
+#import "FileSystem.h"
+
+namespace WebCore {
+
+void DatabaseManager::platformInitialize(const String& databasePath)
+{
+    // The path needs to exist so that we can resolve it via realPath().
+    if (!FileSystem::fileExists(databasePath))
+        FileSystem::makeAllDirectories(databasePath);
+
+    // Disable vnode-guard related simulated crashes for WebSQL (rdar://problem/40674034). We do not overwrite the value here as it may have already been set by WKTR / DRT.
+    int overwrite = 0;
+    setenv("SQLITE_EXEMPT_PATH_FROM_VNODE_GUARDS", FileSystem::realPath(databasePath).utf8().data(), overwrite);
+}
+
+} // namespace WebCore

Modified: trunk/Source/WebCore/SourcesCocoa.txt (233486 => 233487)


--- trunk/Source/WebCore/SourcesCocoa.txt	2018-07-03 22:57:23 UTC (rev 233486)
+++ trunk/Source/WebCore/SourcesCocoa.txt	2018-07-03 23:54:46 UTC (rev 233487)
@@ -26,6 +26,7 @@
 Modules/plugins/QuickTimePluginReplacement.mm
 Modules/plugins/YouTubePluginReplacement.cpp
 Modules/webauthn/cocoa/LocalAuthenticator.mm
+Modules/webdatabase/cocoa/DatabaseManagerCocoa.mm
 
 accessibility/ios/AccessibilityObjectIOS.mm
 accessibility/ios/AXObjectCacheIOS.mm

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (233486 => 233487)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-07-03 22:57:23 UTC (rev 233486)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-07-03 23:54:46 UTC (rev 233487)
@@ -7530,6 +7530,7 @@
 		463521AC2081090E00C28922 /* WindowProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WindowProxy.cpp; sourceTree = "<group>"; };
 		463EB6201B8789CB0096ED51 /* TagCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TagCollection.cpp; sourceTree = "<group>"; };
 		463EB6211B8789CB0096ED51 /* TagCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TagCollection.h; sourceTree = "<group>"; };
+		4642404520EAF0ED00B29FD2 /* DatabaseManagerCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DatabaseManagerCocoa.mm; sourceTree = "<group>"; };
 		465A8E781C8A24CE00E7D3E4 /* RuntimeApplicationChecksCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RuntimeApplicationChecksCocoa.mm; sourceTree = "<group>"; };
 		466DC6AB1EDE021D00746224 /* JSDOMRectList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMRectList.cpp; sourceTree = "<group>"; };
 		466ED8D21EDE0135005E43F6 /* JSDOMRectList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMRectList.h; sourceTree = "<group>"; };
@@ -17201,6 +17202,14 @@
 			path = ios;
 			sourceTree = "<group>";
 		};
+		4642404420EAF0BD00B29FD2 /* cocoa */ = {
+			isa = PBXGroup;
+			children = (
+				4642404520EAF0ED00B29FD2 /* DatabaseManagerCocoa.mm */,
+			);
+			path = cocoa;
+			sourceTree = "<group>";
+		};
 		49484FAE102CF01E00187DD3 /* canvas */ = {
 			isa = PBXGroup;
 			children = (
@@ -21062,6 +21071,7 @@
 		97BC69D51505F054001B74AC /* webdatabase */ = {
 			isa = PBXGroup;
 			children = (
+				4642404420EAF0BD00B29FD2 /* cocoa */,
 				FE36FD1116C7826400F887C1 /* ChangeVersionData.h */,
 				97BC69D81505F076001B74AC /* ChangeVersionWrapper.cpp */,
 				97BC69D91505F076001B74AC /* ChangeVersionWrapper.h */,

Modified: trunk/Source/WebCore/platform/FileSystem.h (233486 => 233487)


--- trunk/Source/WebCore/platform/FileSystem.h	2018-07-03 22:57:23 UTC (rev 233486)
+++ trunk/Source/WebCore/platform/FileSystem.h	2018-07-03 23:54:46 UTC (rev 233487)
@@ -186,6 +186,8 @@
 WEBCORE_EXPORT NSString *createTemporaryDirectory(NSString *directoryPrefix);
 #endif
 
+WEBCORE_EXPORT String realPath(const String&);
+
 class MappedFileData {
 public:
     MappedFileData() { }

Modified: trunk/Source/WebCore/platform/posix/FileSystemPOSIX.cpp (233486 => 233487)


--- trunk/Source/WebCore/platform/posix/FileSystemPOSIX.cpp	2018-07-03 22:57:23 UTC (rev 233486)
+++ trunk/Source/WebCore/platform/posix/FileSystemPOSIX.cpp	2018-07-03 23:54:46 UTC (rev 233487)
@@ -445,5 +445,13 @@
     return fileStat.st_dev;
 }
 
+String realPath(const String& filePath)
+{
+    CString fsRep = fileSystemRepresentation(filePath);
+    char resolvedName[PATH_MAX];
+    const char* result = realpath(fsRep.data(), resolvedName);
+    return result ? String::fromUTF8(result) : filePath;
+}
+
 } // namespace FileSystem
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/win/FileSystemWin.cpp (233486 => 233487)


--- trunk/Source/WebCore/platform/win/FileSystemWin.cpp	2018-07-03 22:57:23 UTC (rev 233486)
+++ trunk/Source/WebCore/platform/win/FileSystemWin.cpp	2018-07-03 23:54:46 UTC (rev 233487)
@@ -546,5 +546,10 @@
     return fileInformation.dwVolumeSerialNumber;
 }
 
+String realPath(const String& filePath)
+{
+    return getFinalPathName(filePath);
+}
+
 } // namespace FileSystem
 } // namespace WebCore

Modified: trunk/Tools/ChangeLog (233486 => 233487)


--- trunk/Tools/ChangeLog	2018-07-03 22:57:23 UTC (rev 233486)
+++ trunk/Tools/ChangeLog	2018-07-03 23:54:46 UTC (rev 233487)
@@ -1,3 +1,17 @@
+2018-07-03  Chris Dumez  <[email protected]>
+
+        [Cocoa] Disable vnode guard related simulated crashes for WKTR / DRT and WebSQL
+        https://bugs.webkit.org/show_bug.cgi?id=187270
+        <rdar://problem/40674034>
+
+        Reviewed by Geoffrey Garen.
+
+        Disable vnode guard related simulated crashes for WKTR / DRT by setting the
+        expected environment variable in the test driver.
+
+        * Scripts/webkitpy/port/driver.py:
+        (Driver._setup_environ_for_driver):
+
 2018-07-03  Eric Carlson  <[email protected]>
 
         Video sometimes flickers when playing to AppleTV

Modified: trunk/Tools/Scripts/webkitpy/port/driver.py (233486 => 233487)


--- trunk/Tools/Scripts/webkitpy/port/driver.py	2018-07-03 22:57:23 UTC (rev 233486)
+++ trunk/Tools/Scripts/webkitpy/port/driver.py	2018-07-03 23:54:46 UTC (rev 233487)
@@ -367,6 +367,11 @@
         environment['LOCAL_RESOURCE_ROOT'] = str(self._port.layout_tests_dir())
         environment['ASAN_OPTIONS'] = "allocator_may_return_null=1"
         environment['__XPC_ASAN_OPTIONS'] = environment['ASAN_OPTIONS']
+
+        # Disable vnode-guard related simulated crashes for WKTR / DRT (rdar://problem/40674034).
+        environment['SQLITE_EXEMPT_PATH_FROM_VNODE_GUARDS'] = os.path.realpath(environment['DUMPRENDERTREE_TEMP'])
+        environment['__XPC_SQLITE_EXEMPT_PATH_FROM_VNODE_GUARDS'] = environment['SQLITE_EXEMPT_PATH_FROM_VNODE_GUARDS']
+
         if self._profiler:
             environment = self._profiler.adjusted_environment(environment)
         return environment
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to