Title: [224885] trunk/Source/WebKit
Revision
224885
Author
achristen...@apple.com
Date
2017-11-15 10:36:57 -0800 (Wed, 15 Nov 2017)

Log Message

Move a compiled WKContentRuleList to its destination before calling mmap
https://bugs.webkit.org/show_bug.cgi?id=179719

Reviewed by Brady Eidson.

Right now we compile a WKContentRuleList to a temporary file, call mmap, close the file, then move it.
Sometimes, especially on bots running tests, the move fails because the temporary file doesn't exist
any more.  Moving the file before mmaping and closing the file might prevent this failure.

* UIProcess/API/APIContentRuleListStore.cpp:
(API::compiledToFile):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (224884 => 224885)


--- trunk/Source/WebKit/ChangeLog	2017-11-15 18:31:04 UTC (rev 224884)
+++ trunk/Source/WebKit/ChangeLog	2017-11-15 18:36:57 UTC (rev 224885)
@@ -1,3 +1,17 @@
+2017-11-15  Alex Christensen  <achristen...@webkit.org>
+
+        Move a compiled WKContentRuleList to its destination before calling mmap
+        https://bugs.webkit.org/show_bug.cgi?id=179719
+
+        Reviewed by Brady Eidson.
+
+        Right now we compile a WKContentRuleList to a temporary file, call mmap, close the file, then move it.
+        Sometimes, especially on bots running tests, the move fails because the temporary file doesn't exist
+        any more.  Moving the file before mmaping and closing the file might prevent this failure.
+
+        * UIProcess/API/APIContentRuleListStore.cpp:
+        (API::compiledToFile):
+
 2017-11-15  Chris Dumez  <cdu...@apple.com>
 
         [Service Workers] Implement Client API

Modified: trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp (224884 => 224885)


--- trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp	2017-11-15 18:31:04 UTC (rev 224884)
+++ trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp	2017-11-15 18:36:57 UTC (rev 224885)
@@ -349,18 +349,19 @@
         closeFile(temporaryFileHandle);
         return ContentRuleListStore::Error::CompileFailed;
     }
-    
+
+    if (!moveFile(temporaryFilePath, finalFilePath)) {
+        WTFLogAlways("Content Rule List compiling failed: Moving file failed.");
+        return ContentRuleListStore::Error::CompileFailed;
+    }
+
     mappedData = adoptAndMapFile(temporaryFileHandle, 0, metaData.fileSize());
     if (mappedData.isNull()) {
         WTFLogAlways("Content Rule List compiling failed: Mapping file failed.");
+        deleteFile(finalFilePath);
         return ContentRuleListStore::Error::CompileFailed;
     }
 
-    if (!moveFile(temporaryFilePath, finalFilePath)) {
-        WTFLogAlways("Content Rule List compiling failed: Moving file failed.");
-        return ContentRuleListStore::Error::CompileFailed;
-    }
-
     return { };
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to