Title: [242710] trunk
Revision
242710
Author
[email protected]
Date
2019-03-11 09:50:32 -0700 (Mon, 11 Mar 2019)

Log Message

Unreviewed, rolling out r242698.

API test crashes on bots.

Reverted changeset:

"Add a WKContentRuleList variant that uses copied memory
instead of mmap'd shared memory for class A containerized
apps"
https://bugs.webkit.org/show_bug.cgi?id=195511
https://trac.webkit.org/changeset/242698

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (242709 => 242710)


--- trunk/Source/WebKit/ChangeLog	2019-03-11 16:47:21 UTC (rev 242709)
+++ trunk/Source/WebKit/ChangeLog	2019-03-11 16:50:32 UTC (rev 242710)
@@ -1,3 +1,17 @@
+2019-03-11  Alex Christensen  <[email protected]>
+
+        Unreviewed, rolling out r242698.
+
+        API test crashes on bots.
+
+        Reverted changeset:
+
+        "Add a WKContentRuleList variant that uses copied memory
+        instead of mmap'd shared memory for class A containerized
+        apps"
+        https://bugs.webkit.org/show_bug.cgi?id=195511
+        https://trac.webkit.org/changeset/242698
+
 2019-03-11  Michael Catanzaro  <[email protected]>
 
         [WPE] Enable web process sandbox

Modified: trunk/Source/WebKit/NetworkProcess/NetworkContentRuleListManager.cpp (242709 => 242710)


--- trunk/Source/WebKit/NetworkProcess/NetworkContentRuleListManager.cpp	2019-03-11 16:47:21 UTC (rev 242709)
+++ trunk/Source/WebKit/NetworkProcess/NetworkContentRuleListManager.cpp	2019-03-11 16:50:32 UTC (rev 242710)
@@ -66,14 +66,15 @@
     m_networkProcess.parentProcessConnection()->send(Messages::NetworkProcessProxy::ContentExtensionRules { identifier }, 0);
 }
 
-void NetworkContentRuleListManager::addContentRuleLists(UserContentControllerIdentifier identifier, Vector<std::pair<String, WebCompiledContentRuleListData>>&& contentRuleLists)
+void NetworkContentRuleListManager::addContentRuleLists(UserContentControllerIdentifier identifier, const Vector<std::pair<String, WebCompiledContentRuleListData>>& contentRuleLists)
 {
     auto& backend = *m_contentExtensionBackends.ensure(identifier, [] {
         return std::make_unique<WebCore::ContentExtensions::ContentExtensionsBackend>();
     }).iterator->value;
 
-    for (auto&& contentRuleList : contentRuleLists) {
-        auto compiledContentRuleList = WebCompiledContentRuleList::create(WTFMove(contentRuleList.second));
+    for (const auto& contentRuleList : contentRuleLists) {
+        WebCompiledContentRuleListData contentRuleListData = contentRuleList.second;
+        auto compiledContentRuleList = WebCompiledContentRuleList::create(WTFMove(contentRuleListData));
         backend.addContentExtension(contentRuleList.first, WTFMove(compiledContentRuleList), ContentExtensions::ContentExtension::ShouldCompileCSS::No);
     }
 

Modified: trunk/Source/WebKit/NetworkProcess/NetworkContentRuleListManager.h (242709 => 242710)


--- trunk/Source/WebKit/NetworkProcess/NetworkContentRuleListManager.h	2019-03-11 16:47:21 UTC (rev 242709)
+++ trunk/Source/WebKit/NetworkProcess/NetworkContentRuleListManager.h	2019-03-11 16:50:32 UTC (rev 242710)
@@ -51,7 +51,7 @@
     void contentExtensionsBackend(UserContentControllerIdentifier, BackendCallback&&);
 
 private:
-    void addContentRuleLists(UserContentControllerIdentifier, Vector<std::pair<String, WebCompiledContentRuleListData>>&&);
+    void addContentRuleLists(UserContentControllerIdentifier, const Vector<std::pair<String, WebCompiledContentRuleListData>>&);
     void removeContentRuleList(UserContentControllerIdentifier, const String& name);
     void removeAllContentRuleLists(UserContentControllerIdentifier);
     void remove(UserContentControllerIdentifier);

Modified: trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheFileSystem.cpp (242709 => 242710)


--- trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheFileSystem.cpp	2019-03-11 16:47:21 UTC (rev 242709)
+++ trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheFileSystem.cpp	2019-03-11 16:50:32 UTC (rev 242710)
@@ -145,23 +145,8 @@
 #endif
 }
 
-static String& pathRegisteredAsUnsafeToMemoryMapForTesting()
-{
-    static NeverDestroyed<String> path;
-    return path.get();
-}
-
-void registerPathAsUnsafeToMemoryMapForTesting(const String& path)
-{
-    pathRegisteredAsUnsafeToMemoryMapForTesting() = path;
-}
-
-    
 bool isSafeToUseMemoryMapForPath(const String& path)
 {
-    if (path == pathRegisteredAsUnsafeToMemoryMapForTesting())
-        return false;
-
 #if PLATFORM(IOS_FAMILY) && !PLATFORM(IOS_FAMILY_SIMULATOR)
     struct {
         uint32_t length;

Modified: trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheFileSystem.h (242709 => 242710)


--- trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheFileSystem.h	2019-03-11 16:47:21 UTC (rev 242709)
+++ trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheFileSystem.h	2019-03-11 16:50:32 UTC (rev 242710)
@@ -43,7 +43,6 @@
 void updateFileModificationTimeIfNeeded(const String& path);
 
 bool isSafeToUseMemoryMapForPath(const String& path);
-void registerPathAsUnsafeToMemoryMapForTesting(const String&);
 
 }
 }

Modified: trunk/Source/WebKit/Shared/WebCompiledContentRuleList.cpp (242709 => 242710)


--- trunk/Source/WebKit/Shared/WebCompiledContentRuleList.cpp	2019-03-11 16:47:21 UTC (rev 242709)
+++ trunk/Source/WebKit/Shared/WebCompiledContentRuleList.cpp	2019-03-11 16:50:32 UTC (rev 242710)
@@ -44,19 +44,14 @@
 {
 }
 
-bool WebCompiledContentRuleList::usesCopiedMemory() const
-{
-    return WTF::holds_alternative<RefPtr<WebCore::SharedBuffer>>(m_data.data);
-}
-
 bool WebCompiledContentRuleList::conditionsApplyOnlyToDomain() const
 {
-    return *reinterpret_cast<const uint32_t*>(reinterpret_cast<const uint8_t*>(m_data.dataPointer()) + m_data.conditionsApplyOnlyToDomainOffset);
+    return *reinterpret_cast<uint32_t*>(reinterpret_cast<uint8_t*>(m_data.data->data()) + m_data.conditionsApplyOnlyToDomainOffset);
 }
 
 const WebCore::ContentExtensions::DFABytecode* WebCompiledContentRuleList::filtersWithoutConditionsBytecode() const
 {
-    return static_cast<const WebCore::ContentExtensions::DFABytecode*>(m_data.dataPointer()) + m_data.filtersWithoutConditionsBytecodeOffset;
+    return static_cast<const WebCore::ContentExtensions::DFABytecode*>(m_data.data->data()) + m_data.filtersWithoutConditionsBytecodeOffset;
 }
 
 unsigned WebCompiledContentRuleList::filtersWithoutConditionsBytecodeLength() const
@@ -66,7 +61,7 @@
 
 const WebCore::ContentExtensions::DFABytecode* WebCompiledContentRuleList::filtersWithConditionsBytecode() const
 {
-    return static_cast<const WebCore::ContentExtensions::DFABytecode*>(m_data.dataPointer()) + m_data.filtersWithConditionsBytecodeOffset;
+    return static_cast<const WebCore::ContentExtensions::DFABytecode*>(m_data.data->data()) + m_data.filtersWithConditionsBytecodeOffset;
 }
 
 unsigned WebCompiledContentRuleList::filtersWithConditionsBytecodeLength() const
@@ -76,7 +71,7 @@
 
 const WebCore::ContentExtensions::DFABytecode* WebCompiledContentRuleList::topURLFiltersBytecode() const
 {
-    return static_cast<const WebCore::ContentExtensions::DFABytecode*>(m_data.dataPointer()) + m_data.topURLFiltersBytecodeOffset;
+    return static_cast<const WebCore::ContentExtensions::DFABytecode*>(m_data.data->data()) + m_data.topURLFiltersBytecodeOffset;
 }
 
 unsigned WebCompiledContentRuleList::topURLFiltersBytecodeLength() const
@@ -86,7 +81,7 @@
 
 const WebCore::ContentExtensions::SerializedActionByte* WebCompiledContentRuleList::actions() const
 {
-    return static_cast<const WebCore::ContentExtensions::SerializedActionByte*>(m_data.dataPointer()) + m_data.actionsOffset;
+    return static_cast<const WebCore::ContentExtensions::SerializedActionByte*>(m_data.data->data()) + m_data.actionsOffset;
 }
 
 unsigned WebCompiledContentRuleList::actionsLength() const

Modified: trunk/Source/WebKit/Shared/WebCompiledContentRuleList.h (242709 => 242710)


--- trunk/Source/WebKit/Shared/WebCompiledContentRuleList.h	2019-03-11 16:47:21 UTC (rev 242709)
+++ trunk/Source/WebKit/Shared/WebCompiledContentRuleList.h	2019-03-11 16:50:32 UTC (rev 242710)
@@ -38,10 +38,8 @@
     static Ref<WebCompiledContentRuleList> create(WebCompiledContentRuleListData&&);
     virtual ~WebCompiledContentRuleList();
 
-    const WebCompiledContentRuleListData& data() const { return m_data; }
+    WebCompiledContentRuleListData data() const { return m_data; }
 
-    bool usesCopiedMemory() const;
-    
 private:
     WebCompiledContentRuleList(WebCompiledContentRuleListData&&);
 

Modified: trunk/Source/WebKit/Shared/WebCompiledContentRuleListData.cpp (242709 => 242710)


--- trunk/Source/WebKit/Shared/WebCompiledContentRuleListData.cpp	2019-03-11 16:47:21 UTC (rev 242709)
+++ trunk/Source/WebKit/Shared/WebCompiledContentRuleListData.cpp	2019-03-11 16:50:32 UTC (rev 242710)
@@ -29,39 +29,15 @@
 #if ENABLE(CONTENT_EXTENSIONS)
 
 #include "ArgumentCoders.h"
-#include "SharedBufferDataReference.h"
 
 namespace WebKit {
 
-size_t WebCompiledContentRuleListData::size() const
-{
-    return WTF::switchOn(data, [] (const auto& sharedMemoryOrBuffer) {
-        return sharedMemoryOrBuffer->size();
-    });
-}
-
-const void* WebCompiledContentRuleListData::dataPointer() const
-{
-    return WTF::switchOn(data, [] (const auto& sharedMemoryOrBuffer) -> const void* {
-        return sharedMemoryOrBuffer->data();
-    });
-}
-
 void WebCompiledContentRuleListData::encode(IPC::Encoder& encoder) const
 {
-    if (auto sharedMemory = WTF::get_if<RefPtr<SharedMemory>>(data)) {
-        encoder << true;
-        SharedMemory::Handle handle;
-        sharedMemory->get()->createHandle(handle, SharedMemory::Protection::ReadOnly);
-        encoder << handle;
-    } else {
-        encoder << false;
-        encoder << IPC::SharedBufferDataReference { *WTF::get<RefPtr<WebCore::SharedBuffer>>(data) };
-    }
+    SharedMemory::Handle handle;
+    data->createHandle(handle, SharedMemory::Protection::ReadOnly);
+    encoder << handle;
 
-    // fileData needs to be kept in the UIProcess, but it does not need to be serialized.
-    // FIXME: Move it to API::ContentRuleList
-
     encoder << conditionsApplyOnlyToDomainOffset;
     encoder << actionsOffset;
     encoder << actionsSize;
@@ -76,22 +52,10 @@
 Optional<WebCompiledContentRuleListData> WebCompiledContentRuleListData::decode(IPC::Decoder& decoder)
 {
     WebCompiledContentRuleListData compiledContentRuleListData;
-
-    Optional<bool> hasSharedMemory;
-    decoder >> hasSharedMemory;
-    if (!hasSharedMemory)
+    SharedMemory::Handle handle;
+    if (!decoder.decode(handle))
         return WTF::nullopt;
-    if (*hasSharedMemory) {
-        SharedMemory::Handle handle;
-        if (!decoder.decode(handle))
-            return WTF::nullopt;
-        compiledContentRuleListData.data = { SharedMemory::map(handle, SharedMemory::Protection::ReadOnly) };
-    } else {
-        IPC::DataReference dataReference;
-        if (!decoder.decode(dataReference))
-            return WTF::nullopt;
-        compiledContentRuleListData.data = { RefPtr<WebCore::SharedBuffer>(WebCore::SharedBuffer::create(dataReference.data(), dataReference.size())) };
-    }
+    compiledContentRuleListData.data = "" SharedMemory::Protection::ReadOnly);
 
     if (!decoder.decode(compiledContentRuleListData.conditionsApplyOnlyToDomainOffset))
         return WTF::nullopt;

Modified: trunk/Source/WebKit/Shared/WebCompiledContentRuleListData.h (242709 => 242710)


--- trunk/Source/WebKit/Shared/WebCompiledContentRuleListData.h	2019-03-11 16:47:21 UTC (rev 242709)
+++ trunk/Source/WebKit/Shared/WebCompiledContentRuleListData.h	2019-03-11 16:50:32 UTC (rev 242710)
@@ -29,9 +29,7 @@
 
 #include "NetworkCacheData.h"
 #include "SharedMemory.h"
-#include <WebCore/SharedBuffer.h>
 #include <wtf/RefPtr.h>
-#include <wtf/Variant.h>
 
 namespace IPC {
 class Decoder;
@@ -44,7 +42,7 @@
 public:
     WebCompiledContentRuleListData() = default;
 
-    WebCompiledContentRuleListData(Variant<RefPtr<SharedMemory>, RefPtr<WebCore::SharedBuffer>>&& data, NetworkCache::Data fileData, unsigned conditionsApplyOnlyToDomainOffset, unsigned actionsOffset, unsigned actionsSize, unsigned filtersWithoutConditionsBytecodeOffset, unsigned filtersWithoutConditionsBytecodeSize, unsigned filtersWithConditionsBytecodeOffset, unsigned filtersWithConditionsBytecodeSize, unsigned topURLFiltersBytecodeOffset, unsigned topURLFiltersBytecodeSize)
+    WebCompiledContentRuleListData(RefPtr<SharedMemory>&& data, NetworkCache::Data fileData, unsigned conditionsApplyOnlyToDomainOffset, unsigned actionsOffset, unsigned actionsSize, unsigned filtersWithoutConditionsBytecodeOffset, unsigned filtersWithoutConditionsBytecodeSize, unsigned filtersWithConditionsBytecodeOffset, unsigned filtersWithConditionsBytecodeSize, unsigned topURLFiltersBytecodeOffset, unsigned topURLFiltersBytecodeSize)
         : data(WTFMove(data))
         , fileData(fileData)
         , conditionsApplyOnlyToDomainOffset(conditionsApplyOnlyToDomainOffset)
@@ -62,10 +60,7 @@
     void encode(IPC::Encoder&) const;
     static Optional<WebCompiledContentRuleListData> decode(IPC::Decoder&);
 
-    size_t size() const;
-    const void* dataPointer() const;
-    
-    Variant<RefPtr<SharedMemory>, RefPtr<WebCore::SharedBuffer>> data;
+    RefPtr<SharedMemory> data;
     NetworkCache::Data fileData;
     unsigned conditionsApplyOnlyToDomainOffset { 0 };
     unsigned actionsOffset { 0 };

Modified: trunk/Source/WebKit/UIProcess/API/APIContentRuleList.cpp (242709 => 242710)


--- trunk/Source/WebKit/UIProcess/API/APIContentRuleList.cpp	2019-03-11 16:47:21 UTC (rev 242709)
+++ trunk/Source/WebKit/UIProcess/API/APIContentRuleList.cpp	2019-03-11 16:50:32 UTC (rev 242710)
@@ -42,11 +42,6 @@
 {
 }
 
-bool ContentRuleList::usesCopiedMemory() const
-{
-    return m_compiledRuleList->usesCopiedMemory();
-}
-
 } // namespace API
 
 #endif // ENABLE(CONTENT_EXTENSIONS)

Modified: trunk/Source/WebKit/UIProcess/API/APIContentRuleList.h (242709 => 242710)


--- trunk/Source/WebKit/UIProcess/API/APIContentRuleList.h	2019-03-11 16:47:21 UTC (rev 242709)
+++ trunk/Source/WebKit/UIProcess/API/APIContentRuleList.h	2019-03-11 16:50:32 UTC (rev 242710)
@@ -48,8 +48,6 @@
     const WTF::String& name() const { return m_name; }
     const WebKit::WebCompiledContentRuleList& compiledRuleList() const { return m_compiledRuleList.get(); }
 
-    bool usesCopiedMemory() const;
-
 private:
     WTF::String m_name;
     Ref<WebKit::WebCompiledContentRuleList> m_compiledRuleList;

Modified: trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp (242709 => 242710)


--- trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp	2019-03-11 16:47:21 UTC (rev 242709)
+++ trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp	2019-03-11 16:50:32 UTC (rev 242710)
@@ -37,7 +37,6 @@
 #include <WebCore/ContentExtensionError.h>
 #include <WebCore/ContentExtensionParser.h>
 #include <WebCore/QualifiedName.h>
-#include <WebCore/SharedBuffer.h>
 #include <string>
 #include <wtf/CompletionHandler.h>
 #include <wtf/FileSystem.h>
@@ -157,22 +156,10 @@
     return WebKit::NetworkCache::Data(encoder.buffer(), encoder.bufferSize());
 }
 
-template<typename T> void getData(const T&, const Function<bool(const uint8_t*, size_t)>&);
-template<> void getData(const WebKit::NetworkCache::Data& data, const Function<bool(const uint8_t*, size_t)>& function)
+static bool decodeContentRuleListMetaData(ContentRuleListMetaData& metaData, const WebKit::NetworkCache::Data& fileData)
 {
-    data.apply(function);
-}
-template<> void getData(const WebCore::SharedBuffer& data, const Function<bool(const uint8_t*, size_t)>& function)
-{
-    function(reinterpret_cast<const uint8_t*>(data.data()), data.size());
-}
-
-template<typename T>
-static Optional<ContentRuleListMetaData> decodeContentRuleListMetaData(const T& fileData)
-{
     bool success = false;
-    ContentRuleListMetaData metaData;
-    getData(fileData, [&metaData, &success, &fileData](const uint8_t* data, size_t size) {
+    fileData.apply([&metaData, &success, &fileData](const uint8_t* data, size_t size) {
         // The file data should be mapped into one continuous memory segment so the size
         // passed to the applier should always equal the data size.
         if (size != fileData.size())
@@ -196,52 +183,19 @@
         success = true;
         return false;
     });
-    if (!success)
-        return WTF::nullopt;
-    return WTFMove(metaData);
+    return success;
 }
 
-#if !PLATFORM(COCOA)
-RefPtr<WebCore::SharedBuffer> ContentRuleListStore::readContentsOfFile(const WTF::String& filePath)
+static bool openAndMapContentRuleList(const WTF::String& path, ContentRuleListMetaData& metaData, WebKit::NetworkCache::Data& fileData)
 {
-    ASSERT_NOT_REACHED();
-    return nullptr;
-}
-#endif
+    fileData = mapFile(fileSystemRepresentation(path).data());
+    if (fileData.isNull())
+        return false;
 
-struct MappedOrCopiedData {
-    ContentRuleListMetaData metaData;
-    Variant<WebKit::NetworkCache::Data, RefPtr<WebCore::SharedBuffer>> data;
-    
-    const uint8_t* dataPointer() const
-    {
-        return WTF::switchOn(data, [] (const WebKit::NetworkCache::Data& data) {
-            return data.data();
-        }, [] (const RefPtr<WebCore::SharedBuffer>& sharedBuffer) {
-            return reinterpret_cast<const uint8_t*>(sharedBuffer->data());
-        });
-    }
-};
+    if (!decodeContentRuleListMetaData(metaData, fileData))
+        return false;
 
-static Optional<MappedOrCopiedData> openAndMapOrCopyContentRuleList(const WTF::String& path)
-{
-    if (!WebKit::NetworkCache::isSafeToUseMemoryMapForPath(path)) {
-        RefPtr<WebCore::SharedBuffer> buffer = ContentRuleListStore::readContentsOfFile(path);
-        if (!buffer)
-            return WTF::nullopt;
-        auto metaData = decodeContentRuleListMetaData(*buffer);
-        if (!metaData)
-            return WTF::nullopt;
-        return {{ WTFMove(*metaData), { buffer.releaseNonNull() }}};
-    }
-
-    WebKit::NetworkCache::Data fileData = mapFile(fileSystemRepresentation(path).data());
-    if (fileData.isNull())
-        return WTF::nullopt;
-    auto metaData = decodeContentRuleListMetaData(fileData);
-    if (!metaData)
-        return WTF::nullopt;
-    return {{ WTFMove(*metaData), { WTFMove(fileData) }}};
+    return true;
 }
 
 static bool writeDataToFile(const WebKit::NetworkCache::Data& fileData, PlatformFileHandle fd)
@@ -258,7 +212,7 @@
     return success;
 }
 
-static Expected<MappedOrCopiedData, std::error_code> compiledToFile(WTF::String&& json, Vector<WebCore::ContentExtensions::ContentExtensionRule>&& parsedRules, const WTF::String& finalFilePath)
+static std::error_code compiledToFile(WTF::String&& json, Vector<WebCore::ContentExtensions::ContentExtensionRule>&& parsedRules, const WTF::String& finalFilePath, ContentRuleListMetaData& metaData, WebKit::NetworkCache::Data& mappedData)
 {
     using namespace WebCore::ContentExtensions;
 
@@ -375,7 +329,7 @@
     WTF::String temporaryFilePath = openTemporaryFile("ContentRuleList", temporaryFileHandle);
     if (temporaryFileHandle == invalidPlatformFileHandle) {
         WTFLogAlways("Content Rule List compiling failed: Opening temporary file failed.");
-        return makeUnexpected(ContentRuleListStore::Error::CompileFailed);
+        return ContentRuleListStore::Error::CompileFailed;
     }
     
     char invalidHeader[ContentRuleListFileHeaderSize];
@@ -384,77 +338,62 @@
     if (writeToFile(temporaryFileHandle, invalidHeader, sizeof(invalidHeader)) == -1) {
         WTFLogAlways("Content Rule List compiling failed: Writing header to file failed.");
         closeFile(temporaryFileHandle);
-        return makeUnexpected(ContentRuleListStore::Error::CompileFailed);
+        return ContentRuleListStore::Error::CompileFailed;
     }
 
-    ContentRuleListMetaData metaData;
     CompilationClient compilationClient(temporaryFileHandle, metaData);
     
     if (auto compilerError = compileRuleList(compilationClient, WTFMove(json), WTFMove(parsedRules))) {
         WTFLogAlways("Content Rule List compiling failed: Compiling failed.");
         closeFile(temporaryFileHandle);
-        return makeUnexpected(compilerError);
+        return compilerError;
     }
     if (compilationClient.hadErrorWhileWritingToFile()) {
         WTFLogAlways("Content Rule List compiling failed: Writing to file failed.");
         closeFile(temporaryFileHandle);
-        return makeUnexpected(ContentRuleListStore::Error::CompileFailed);
+        return ContentRuleListStore::Error::CompileFailed;
     }
 
-    auto mappedData = adoptAndMapFile(temporaryFileHandle, 0, metaData.fileSize());
+    mappedData = adoptAndMapFile(temporaryFileHandle, 0, metaData.fileSize());
     if (mappedData.isNull()) {
         WTFLogAlways("Content Rule List compiling failed: Mapping file failed.");
-        return makeUnexpected(ContentRuleListStore::Error::CompileFailed);
+        return ContentRuleListStore::Error::CompileFailed;
     }
 
     if (!moveFile(temporaryFilePath, finalFilePath)) {
         WTFLogAlways("Content Rule List compiling failed: Moving file failed.");
-        return makeUnexpected(ContentRuleListStore::Error::CompileFailed);
+        return ContentRuleListStore::Error::CompileFailed;
     }
 
-    if (!isSafeToUseMemoryMapForPath(finalFilePath)) {
-        auto contents = ContentRuleListStore::readContentsOfFile(finalFilePath);
-        if (!contents)
-            return makeUnexpected(ContentRuleListStore::Error::CompileFailed);
-        return {{ WTFMove(metaData), WTFMove(contents) }};
-    }
-    
-    return {{ WTFMove(metaData), WTFMove(mappedData) }};
+    return { };
 }
 
-static Ref<API::ContentRuleList> createExtension(const WTF::String& identifier, MappedOrCopiedData&& data)
+static Ref<API::ContentRuleList> createExtension(const WTF::String& identifier, const ContentRuleListMetaData& metaData, const WebKit::NetworkCache::Data& fileData)
 {
-    RefPtr<WebKit::SharedMemory> sharedMemory;
-    if (auto mappedFileData = WTF::get_if<WebKit::NetworkCache::Data>(data.data)) {
-        sharedMemory = mappedFileData->tryCreateSharedMemory();
+    // Content extensions are always compiled to files, and at this point the file
+    // has been already mapped, therefore tryCreateSharedMemory() cannot fail.
+    auto sharedMemory = fileData.tryCreateSharedMemory();
+    ASSERT(sharedMemory);
 
-        // Content extensions are always compiled to files, and at this point the file
-        // has been already mapped, therefore tryCreateSharedMemory() cannot fail.
-        ASSERT(sharedMemory);
-    }
-    auto mappedOrCopiedFileData = sharedMemory ?
-        Variant<RefPtr<WebKit::SharedMemory>, RefPtr<WebCore::SharedBuffer>> { sharedMemory }
-        : Variant<RefPtr<WebKit::SharedMemory>, RefPtr<WebCore::SharedBuffer>> { WTFMove(WTF::get<RefPtr<WebCore::SharedBuffer>>(data.data)) };
-
-    const size_t headerAndSourceSize = ContentRuleListFileHeaderSize + data.metaData.sourceSize;
+    const size_t headerAndSourceSize = ContentRuleListFileHeaderSize + metaData.sourceSize;
     auto compiledContentRuleListData = WebKit::WebCompiledContentRuleListData(
-        WTFMove(mappedOrCopiedFileData),
-        WTF::holds_alternative<WebKit::NetworkCache::Data>(data.data) ? WTF::get<WebKit::NetworkCache::Data>(data.data) : WebKit::NetworkCache::Data { },
+        WTFMove(sharedMemory),
+        fileData,
         ConditionsApplyOnlyToDomainOffset,
         headerAndSourceSize,
-        data.metaData.actionsSize,
+        metaData.actionsSize,
         headerAndSourceSize
-            + data.metaData.actionsSize,
-        data.metaData.filtersWithoutConditionsBytecodeSize,
+            + metaData.actionsSize,
+        metaData.filtersWithoutConditionsBytecodeSize,
         headerAndSourceSize
-            + data.metaData.actionsSize
-            + data.metaData.filtersWithoutConditionsBytecodeSize,
-        data.metaData.filtersWithConditionsBytecodeSize,
+            + metaData.actionsSize
+            + metaData.filtersWithoutConditionsBytecodeSize,
+        metaData.filtersWithConditionsBytecodeSize,
         headerAndSourceSize
-            + data.metaData.actionsSize
-            + data.metaData.filtersWithoutConditionsBytecodeSize
-            + data.metaData.filtersWithConditionsBytecodeSize,
-        data.metaData.conditionedFiltersBytecodeSize
+            + metaData.actionsSize
+            + metaData.filtersWithoutConditionsBytecodeSize
+            + metaData.filtersWithConditionsBytecodeSize,
+        metaData.conditionedFiltersBytecodeSize
     );
     auto compiledContentRuleList = WebKit::WebCompiledContentRuleList::create(WTFMove(compiledContentRuleListData));
     return API::ContentRuleList::create(identifier, WTFMove(compiledContentRuleList));
@@ -465,8 +404,9 @@
     m_readQueue->dispatch([protectedThis = makeRef(*this), identifier = identifier.isolatedCopy(), storePath = m_storePath.isolatedCopy(), legacyFilename = m_legacyFilename, completionHandler = WTFMove(completionHandler)]() mutable {
         auto path = constructedPath(storePath, identifier, legacyFilename);
         
-        auto contentRuleList = openAndMapOrCopyContentRuleList(path);
-        if (!contentRuleList) {
+        ContentRuleListMetaData metaData;
+        WebKit::NetworkCache::Data fileData;
+        if (!openAndMapContentRuleList(path, metaData, fileData)) {
             RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler)] () mutable {
                 completionHandler(nullptr, Error::LookupFailed);
             });
@@ -473,7 +413,7 @@
             return;
         }
         
-        if (contentRuleList->metaData.version != ContentRuleListStore::CurrentContentRuleListFileVersion) {
+        if (metaData.version != ContentRuleListStore::CurrentContentRuleListFileVersion) {
             RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler)] () mutable {
                 completionHandler(nullptr, Error::VersionMismatch);
             });
@@ -480,8 +420,8 @@
             return;
         }
         
-        RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), identifier = identifier.isolatedCopy(), contentRuleList = WTFMove(*contentRuleList), completionHandler = WTFMove(completionHandler)] () mutable {
-            completionHandler(createExtension(identifier, WTFMove(contentRuleList)), { });
+        RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), identifier = identifier.isolatedCopy(), fileData = WTFMove(fileData), metaData = WTFMove(metaData), completionHandler = WTFMove(completionHandler)] () mutable {
+            completionHandler(createExtension(identifier, metaData, fileData), { });
         });
     });
 }
@@ -515,17 +455,19 @@
     m_compileQueue->dispatch([protectedThis = makeRef(*this), identifier = identifier.isolatedCopy(), legacyFilename = m_legacyFilename, json = json.isolatedCopy(), parsedRules = parsedRules.value().isolatedCopy(), storePath = m_storePath.isolatedCopy(), completionHandler = WTFMove(completionHandler)] () mutable {
         auto path = constructedPath(storePath, identifier, legacyFilename);
 
-        auto result = compiledToFile(WTFMove(json), WTFMove(parsedRules), path);
-        if (!result.has_value()) {
-            RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), error = WTFMove(result.error()), completionHandler = WTFMove(completionHandler)] () mutable {
+        ContentRuleListMetaData metaData;
+        WebKit::NetworkCache::Data fileData;
+        auto error = compiledToFile(WTFMove(json), WTFMove(parsedRules), path, metaData, fileData);
+        if (error) {
+            RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), error = WTFMove(error), completionHandler = WTFMove(completionHandler)] () mutable {
                 completionHandler(nullptr, error);
             });
             return;
         }
 
-        RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), identifier = WTFMove(identifier), data = "" completionHandler = WTFMove(completionHandler)] () mutable {
-            auto contentRuleList = createExtension(identifier, WTFMove(data));
-            completionHandler(contentRuleList.ptr(), { });
+        RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), identifier = WTFMove(identifier), fileData = WTFMove(fileData), metaData = WTFMove(metaData), completionHandler = WTFMove(completionHandler)] () mutable {
+            RefPtr<API::ContentRuleList> contentRuleList = createExtension(identifier, metaData, fileData);
+            completionHandler(contentRuleList, { });
         });
     });
 }
@@ -575,28 +517,29 @@
                 completionHandler(source);
             });
         };
-
-        auto contentRuleList = openAndMapOrCopyContentRuleList(path);
-        if (!contentRuleList) {
+        
+        ContentRuleListMetaData metaData;
+        WebKit::NetworkCache::Data fileData;
+        if (!openAndMapContentRuleList(path, metaData, fileData)) {
             complete({ });
             return;
         }
         
-        switch (contentRuleList->metaData.version) {
+        switch (metaData.version) {
         case 9:
         case 10:
-            if (!contentRuleList->metaData.sourceSize) {
+            if (!metaData.sourceSize) {
                 complete({ });
                 return;
             }
-            bool is8Bit = contentRuleList->dataPointer()[ContentRuleListFileHeaderSize];
+            bool is8Bit = fileData.data()[ContentRuleListFileHeaderSize];
             size_t start = ContentRuleListFileHeaderSize + sizeof(bool);
-            size_t length = contentRuleList->metaData.sourceSize - sizeof(bool);
+            size_t length = metaData.sourceSize - sizeof(bool);
             if (is8Bit)
-                complete(WTF::String(contentRuleList->dataPointer() + start, length));
+                complete(WTF::String(fileData.data() + start, length));
             else {
                 ASSERT(!(length % sizeof(UChar)));
-                complete(WTF::String(reinterpret_cast<const UChar*>(contentRuleList->dataPointer() + start), length / sizeof(UChar)));
+                complete(WTF::String(reinterpret_cast<const UChar*>(fileData.data() + start), length / sizeof(UChar)));
             }
             return;
         }

Modified: trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.h (242709 => 242710)


--- trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.h	2019-03-11 16:47:21 UTC (rev 242709)
+++ trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.h	2019-03-11 16:50:32 UTC (rev 242710)
@@ -31,10 +31,6 @@
 #include <system_error>
 #include <wtf/text/WTFString.h>
 
-namespace WebCore {
-class SharedBuffer;
-}
-
 namespace WTF {
 class WorkQueue;
 }
@@ -76,8 +72,6 @@
     void invalidateContentRuleListVersion(const WTF::String& identifier);
     void getContentRuleListSource(const WTF::String& identifier, CompletionHandler<void(WTF::String)>);
 
-    static RefPtr<WebCore::SharedBuffer> readContentsOfFile(const WTF::String& path);
-
 private:
     WTF::String defaultStorePath(bool legacyFilename);
     static ContentRuleListStore& legacyDefaultStore();

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm (242709 => 242710)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm	2019-03-11 16:47:21 UTC (rev 242709)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm	2019-03-11 16:50:32 UTC (rev 242710)
@@ -29,7 +29,6 @@
 #if ENABLE(CONTENT_EXTENSIONS)
 
 #include "SandboxUtilities.h"
-#include <WebCore/SharedBuffer.h>
 
 namespace API {
 
@@ -64,15 +63,6 @@
     return contentRuleListStoreURL.absoluteURL.path.fileSystemRepresentation;
 }
 
-RefPtr<WebCore::SharedBuffer> ContentRuleListStore::readContentsOfFile(const String& filePath)
-{
-    ASSERT(!isMainThread());
-    NSData *data = "" dataWithContentsOfURL:[NSURL fileURLWithPath:filePath isDirectory:NO]];
-    if (!data)
-        return nullptr;
-    return WebCore::SharedBuffer::create(data);
-}
-
 } // namespace API
 
 #endif // ENABLE(CONTENT_EXTENSIONS)

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStore.mm (242709 => 242710)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStore.mm	2019-03-11 16:47:21 UTC (rev 242709)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStore.mm	2019-03-11 16:50:32 UTC (rev 242710)
@@ -28,7 +28,6 @@
 #import "WKContentRuleListStoreInternal.h"
 
 #import "APIContentRuleListStore.h"
-#import "NetworkCacheFilesystem.h"
 #import "WKErrorInternal.h"
 #import <wtf/BlockPtr.h>
 #import <wtf/CompletionHandler.h>
@@ -126,11 +125,6 @@
 
 // For testing only.
 
-+ (void)_registerPathAsUnsafeToMemoryMapForTesting:(NSString *)filename
-{
-    WebKit::NetworkCache::registerPathAsUnsafeToMemoryMapForTesting(filename);
-}
-
 - (void)_removeAllContentRuleLists
 {
     _contentRuleListStore->synchronousRemoveAllContentRuleLists();

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h (242709 => 242710)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h	2019-03-11 16:47:21 UTC (rev 242709)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h	2019-03-11 16:50:32 UTC (rev 242710)
@@ -31,7 +31,6 @@
 - (void)_removeAllContentRuleLists;
 - (void)_invalidateContentRuleListVersionForIdentifier:(NSString *)identifier;
 - (void)_getContentRuleListSourceForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSString*))completionHandler;
-+ (void)_registerPathAsUnsafeToMemoryMapForTesting:(NSString *)filename;
 
 // NS_RELEASES_ARGUMENT to keep peak memory usage low.
 - (void)_compileContentRuleListForIdentifier:(NSString *)identifier encodedContentRuleList:(NSString *) NS_RELEASES_ARGUMENT encodedContentRuleList completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler;

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKUserContentFilter.mm (242709 => 242710)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKUserContentFilter.mm	2019-03-11 16:47:21 UTC (rev 242709)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKUserContentFilter.mm	2019-03-11 16:50:32 UTC (rev 242710)
@@ -56,9 +56,4 @@
     return self;
 }
 
-- (BOOL)usesCopiedMemory
-{
-    return _contentRuleList->_contentRuleList->usesCopiedMemory();
-}
-
 @end

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h (242709 => 242710)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h	2019-03-11 16:47:21 UTC (rev 242709)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h	2019-03-11 16:50:32 UTC (rev 242710)
@@ -30,6 +30,5 @@
 @interface _WKUserContentFilter (WKPrivate)
 
 - (id)_initWithWKContentRuleList:(WKContentRuleList*)contentRuleList WK_API_AVAILABLE(macosx(10.13), ios(11.0));
-@property (nonatomic, readonly) BOOL usesCopiedMemory;
 
 @end

Modified: trunk/Source/WebKit/WebProcess/UserContent/WebUserContentController.cpp (242709 => 242710)


--- trunk/Source/WebKit/WebProcess/UserContent/WebUserContentController.cpp	2019-03-11 16:47:21 UTC (rev 242709)
+++ trunk/Source/WebKit/WebProcess/UserContent/WebUserContentController.cpp	2019-03-11 16:50:32 UTC (rev 242710)
@@ -348,10 +348,11 @@
 #endif
 
 #if ENABLE(CONTENT_EXTENSIONS)
-void WebUserContentController::addContentRuleLists(Vector<std::pair<String, WebCompiledContentRuleListData>>&& contentRuleLists)
+void WebUserContentController::addContentRuleLists(const Vector<std::pair<String, WebCompiledContentRuleListData>>& contentRuleLists)
 {
-    for (auto&& contentRuleList : contentRuleLists) {
-        auto compiledContentRuleList = WebCompiledContentRuleList::create(WTFMove(contentRuleList.second));
+    for (const auto& contentRuleList : contentRuleLists) {
+        WebCompiledContentRuleListData contentRuleListData = contentRuleList.second;
+        auto compiledContentRuleList = WebCompiledContentRuleList::create(WTFMove(contentRuleListData));
 
         m_contentExtensionBackend.addContentExtension(contentRuleList.first, WTFMove(compiledContentRuleList));
     }

Modified: trunk/Source/WebKit/WebProcess/UserContent/WebUserContentController.h (242709 => 242710)


--- trunk/Source/WebKit/WebProcess/UserContent/WebUserContentController.h	2019-03-11 16:47:21 UTC (rev 242709)
+++ trunk/Source/WebKit/WebProcess/UserContent/WebUserContentController.h	2019-03-11 16:50:32 UTC (rev 242710)
@@ -69,7 +69,7 @@
     void addUserStyleSheets(const Vector<WebUserStyleSheetData>&);
     void addUserScriptMessageHandlers(const Vector<WebScriptMessageHandlerData>&);
 #if ENABLE(CONTENT_EXTENSIONS)
-    void addContentRuleLists(Vector<std::pair<String, WebCompiledContentRuleListData>>&&);
+    void addContentRuleLists(const Vector<std::pair<String, WebCompiledContentRuleListData>>&);
 #endif
 
 private:

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (242709 => 242710)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-03-11 16:47:21 UTC (rev 242709)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-03-11 16:50:32 UTC (rev 242710)
@@ -637,7 +637,7 @@
     m_userContentController->addUserStyleSheets(parameters.userStyleSheets);
     m_userContentController->addUserScriptMessageHandlers(parameters.messageHandlers);
 #if ENABLE(CONTENT_EXTENSIONS)
-    m_userContentController->addContentRuleLists(WTFMove(parameters.contentRuleLists));
+    m_userContentController->addContentRuleLists(parameters.contentRuleLists);
 #endif
 
 #if PLATFORM(IOS_FAMILY)

Modified: trunk/Tools/ChangeLog (242709 => 242710)


--- trunk/Tools/ChangeLog	2019-03-11 16:47:21 UTC (rev 242709)
+++ trunk/Tools/ChangeLog	2019-03-11 16:50:32 UTC (rev 242710)
@@ -1,3 +1,17 @@
+2019-03-11  Alex Christensen  <[email protected]>
+
+        Unreviewed, rolling out r242698.
+
+        API test crashes on bots.
+
+        Reverted changeset:
+
+        "Add a WKContentRuleList variant that uses copied memory
+        instead of mmap'd shared memory for class A containerized
+        apps"
+        https://bugs.webkit.org/show_bug.cgi?id=195511
+        https://trac.webkit.org/changeset/242698
+
 2019-03-11  Michael Catanzaro  <[email protected]>
 
         [WPE] Enable web process sandbox

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKContentExtensionStore.mm (242709 => 242710)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKContentExtensionStore.mm	2019-03-11 16:47:21 UTC (rev 242709)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKContentExtensionStore.mm	2019-03-11 16:50:32 UTC (rev 242710)
@@ -28,14 +28,9 @@
 
 #import "PlatformUtilities.h"
 #import "Test.h"
-#import "TestWKWebView.h"
 #import <WebKit/WKContentRuleList.h>
 #import <WebKit/WKContentRuleListStorePrivate.h>
-#import <WebKit/_WKUserContentFilterPrivate.h>
 #import <wtf/RetainPtr.h>
-#import <wtf/text/StringBuilder.h>
-#import <wtf/text/StringConcatenate.h>
-#import <wtf/text/StringConcatenateNumbers.h>
 
 class WKContentRuleListStoreTest : public testing::Test {
 public:
@@ -382,102 +377,3 @@
     [webView reload];
     TestWebKitAPI::Util::run(&receivedAlert);
 }
-
-@interface TestSchemeHandlerSubresourceShouldBeBlocked : NSObject <WKURLSchemeHandler>
-@end
-@implementation TestSchemeHandlerSubresourceShouldBeBlocked
-- (void)webView:(WKWebView *)webView startURLSchemeTask:(id <WKURLSchemeTask>)task
-{
-    EXPECT_TRUE([task.request.URL.path isEqualToString:@"/shouldload"]);
-    [task didReceiveResponse:[[[NSURLResponse alloc] initWithURL:task.request.URL MIMEType:@"text/html" expectedContentLength:0 textEncodingName:nil] autorelease]];
-    [task didFinish];
-}
-- (void)webView:(WKWebView *)webView stopURLSchemeTask:(id <WKURLSchemeTask>)task
-{
-    EXPECT_TRUE(false);
-}
-@end
-
-TEST_F(WKContentRuleListStoreTest, UnsafeMMap)
-{
-    NSString *tempDir = [NSTemporaryDirectory() stringByAppendingPathComponent:@"UnsafeMMapTest"];
-    WKContentRuleListStore *store = [WKContentRuleListStore storeWithURL:[NSURL fileURLWithPath:tempDir isDirectory:YES]];
-    NSString *identifier = @"TestRuleList";
-    NSString *fileName = @"ContentRuleList-TestRuleList";
-    NSString *filePath = [tempDir stringByAppendingPathComponent:fileName];
-    NSString *ruleListSourceString = @"[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"blockedsubresource\"}}]";
-
-    auto runTest = [&] (bool shouldUseCopiedMemory) {
-        EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:filePath]);
-        
-        __block bool doneCompiling = false;
-        __block RetainPtr<WKContentRuleList> ruleList;
-        [store compileContentRuleListForIdentifier:identifier encodedContentRuleList:ruleListSourceString completionHandler:^(WKContentRuleList *filter, NSError *error) {
-            EXPECT_NOT_NULL(filter);
-            EXPECT_NULL(error);
-            doneCompiling = true;
-            ruleList = filter;
-            EXPECT_TRUE([[[[_WKUserContentFilter alloc] _initWithWKContentRuleList:filter] autorelease] usesCopiedMemory] == shouldUseCopiedMemory);
-        }];
-        TestWebKitAPI::Util::run(&doneCompiling);
-        
-        EXPECT_TRUE([[NSFileManager defaultManager] fileExistsAtPath:filePath]);
-
-        auto handler = adoptNS([TestSchemeHandlerSubresourceShouldBeBlocked new]);
-        auto configuration = adoptNS([WKWebViewConfiguration new]);
-        [configuration setURLSchemeHandler:handler.get() forURLScheme:@"testmmap"];
-        [[configuration userContentController] addContentRuleList:ruleList.get()];
-        auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
-        [webView synchronouslyLoadHTMLString:@"<html>main resource content</html>" baseURL:[NSURL URLWithString:@"testmmap://webkit.org/mainresource"]];
-
-        auto loadingShouldSucceed = [&] (NSString *resourcePath, NSString *shouldSucceed) {
-            __block bool doneEvaluating = false;
-            [webView evaluateJavaScript:[NSString stringWithFormat:@"var caught = false; var xhr = new XMLHttpRequest(); xhr.open('GET', '%@', false); try{ xhr.send() } catch(e) { caught = true; }; caught != %@ ? 'success' : 'failure'", resourcePath, shouldSucceed] completionHandler:^(id result, NSError *error) {
-                EXPECT_NULL(error);
-                EXPECT_TRUE([@"success" isEqualToString:result]);
-                doneEvaluating = true;
-            }];
-            TestWebKitAPI::Util::run(&doneEvaluating);
-        };
-        loadingShouldSucceed(@"/shouldload", @"true");
-        loadingShouldSucceed(@"/blockedsubresource", @"false");
-
-        [[configuration userContentController] removeContentRuleList:ruleList.get()];
-        
-        __block bool doneLookingUp = false;
-        [store lookUpContentRuleListForIdentifier:identifier completionHandler:^(WKContentRuleList *filter, NSError *error) {
-            EXPECT_NOT_NULL(filter);
-            EXPECT_NULL(error);
-            
-            doneLookingUp = true;
-            
-            EXPECT_TRUE([[[[_WKUserContentFilter alloc] _initWithWKContentRuleList:filter] autorelease] usesCopiedMemory] == shouldUseCopiedMemory);
-            ruleList = filter;
-        }];
-        TestWebKitAPI::Util::run(&doneLookingUp);
-
-        [[configuration userContentController] addContentRuleList:ruleList.get()];
-        loadingShouldSucceed(@"/shouldload", @"true");
-        loadingShouldSucceed(@"/blockedsubresource", @"false");
-
-        __block bool doneCheckingSource = false;
-        [store _getContentRuleListSourceForIdentifier:identifier completionHandler:^(NSString *source) {
-            EXPECT_TRUE([source isEqualToString:ruleListSourceString]);
-            doneCheckingSource = true;
-        }];
-        TestWebKitAPI::Util::run(&doneCheckingSource);
-        
-        __block bool doneRemoving = false;
-        [store removeContentRuleListForIdentifier:identifier completionHandler:^(NSError *error) {
-            EXPECT_NULL(error);
-            doneRemoving = true;
-        }];
-        TestWebKitAPI::Util::run(&doneRemoving);
-
-        EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:filePath]);
-    };
-    
-    runTest(false);
-    [WKContentRuleListStore _registerPathAsUnsafeToMemoryMapForTesting:filePath];
-    runTest(true);
-}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to