Rename WKContentExtension to WKContentRuleList
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 May 2017 01:33:13 +0000 (01:33 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 May 2017 01:33:13 +0000 (01:33 +0000)
https://bugs.webkit.org/show_bug.cgi?id=172053
<rdar://problem/32141005>

Reviewed by Geoffrey Garen.

Source/WebCore:

Covered by existing API tests.

* English.lproj/Localizable.strings:

Source/WebKit2:

* Shared/API/APIObject.h:
* Shared/API/Cocoa/WebKit.h:
* Shared/API/c/WKDeprecatedFunctions.cpp:
(WKPageGroupAddUserContentFilter):
(WKPageGroupRemoveUserContentFilter):
* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):
* Shared/WebCompiledContentExtension.cpp: Removed.
* Shared/WebCompiledContentExtension.h: Removed.
* Shared/WebCompiledContentExtensionData.cpp: Removed.
* Shared/WebCompiledContentExtensionData.h: Removed.
* Shared/WebCompiledContentRuleList.cpp: Copied from Source/WebKit2/Shared/WebCompiledContentExtension.cpp.
(WebKit::WebCompiledContentRuleList::create):
(WebKit::WebCompiledContentRuleList::WebCompiledContentRuleList):
(WebKit::WebCompiledContentRuleList::~WebCompiledContentRuleList):
(WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain):
(WebKit::WebCompiledContentRuleList::filtersWithoutConditionsBytecode):
(WebKit::WebCompiledContentRuleList::filtersWithoutConditionsBytecodeLength):
(WebKit::WebCompiledContentRuleList::filtersWithConditionsBytecode):
(WebKit::WebCompiledContentRuleList::filtersWithConditionsBytecodeLength):
(WebKit::WebCompiledContentRuleList::topURLFiltersBytecode):
(WebKit::WebCompiledContentRuleList::topURLFiltersBytecodeLength):
(WebKit::WebCompiledContentRuleList::actions):
(WebKit::WebCompiledContentRuleList::actionsLength):
(WebKit::WebCompiledContentExtension::create): Deleted.
(WebKit::WebCompiledContentExtension::WebCompiledContentExtension): Deleted.
(WebKit::WebCompiledContentExtension::~WebCompiledContentExtension): Deleted.
(WebKit::WebCompiledContentExtension::conditionsApplyOnlyToDomain): Deleted.
(WebKit::WebCompiledContentExtension::filtersWithoutConditionsBytecode): Deleted.
(WebKit::WebCompiledContentExtension::filtersWithoutConditionsBytecodeLength): Deleted.
(WebKit::WebCompiledContentExtension::filtersWithConditionsBytecode): Deleted.
(WebKit::WebCompiledContentExtension::filtersWithConditionsBytecodeLength): Deleted.
(WebKit::WebCompiledContentExtension::topURLFiltersBytecode): Deleted.
(WebKit::WebCompiledContentExtension::topURLFiltersBytecodeLength): Deleted.
(WebKit::WebCompiledContentExtension::actions): Deleted.
(WebKit::WebCompiledContentExtension::actionsLength): Deleted.
* Shared/WebCompiledContentRuleList.h: Copied from Source/WebKit2/Shared/WebCompiledContentExtension.h.
* Shared/WebCompiledContentRuleListData.cpp: Copied from Source/WebKit2/Shared/WebCompiledContentExtensionData.cpp.
(WebKit::WebCompiledContentRuleListData::encode):
(WebKit::WebCompiledContentRuleListData::decode):
(WebKit::WebCompiledContentExtensionData::encode): Deleted.
(WebKit::WebCompiledContentExtensionData::decode): Deleted.
* Shared/WebCompiledContentRuleListData.h: Copied from Source/WebKit2/Shared/WebCompiledContentExtensionData.h.
(WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
(WebKit::WebCompiledContentExtensionData::WebCompiledContentExtensionData): Deleted.
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* UIProcess/API/APIContentExtension.cpp: Removed.
* UIProcess/API/APIContentExtension.h: Removed.
* UIProcess/API/APIContentExtensionStore.cpp: Removed.
* UIProcess/API/APIContentExtensionStore.h: Removed.
* UIProcess/API/APIContentRuleList.cpp: Copied from Source/WebKit2/UIProcess/API/APIContentExtension.cpp.
(API::ContentRuleList::ContentRuleList):
(API::ContentRuleList::~ContentRuleList):
(API::ContentExtension::ContentExtension): Deleted.
(API::ContentExtension::~ContentExtension): Deleted.
* UIProcess/API/APIContentRuleList.h: Copied from Source/WebKit2/UIProcess/API/APIContentExtension.h.
* UIProcess/API/APIContentRuleListStore.cpp: Copied from Source/WebKit2/UIProcess/API/APIContentExtensionStore.cpp.
(API::ContentRuleListStore::legacyDefaultStore):
(API::ContentRuleListStore::nonLegacyDdefaultStore):
(API::ContentRuleListStore::defaultStore):
(API::ContentRuleListStore::storeWithPath):
(API::ContentRuleListStore::ContentRuleListStore):
(API::ContentRuleListStore::~ContentRuleListStore):
(API::constructedPathPrefix):
(API::ContentRuleListMetaData::fileSize):
(API::encodeContentRuleListMetaData):
(API::decodeContentRuleListMetaData):
(API::openAndMapContentRuleList):
(API::compiledToFile):
(API::createExtension):
(API::ContentRuleListStore::lookupContentRuleList):
(API::ContentRuleListStore::getAvailableContentRuleListIdentifiers):
(API::ContentRuleListStore::compileContentRuleList):
(API::ContentRuleListStore::removeContentRuleList):
(API::ContentRuleListStore::synchronousRemoveAllContentRuleLists):
(API::ContentRuleListStore::invalidateContentRuleListVersion):
(API::ContentRuleListStore::getContentRuleListSource):
(API::contentRuleListStoreErrorCategory):
(API::ContentExtensionStore::defaultStore): Deleted.
(API::ContentExtensionStore::storeWithPath): Deleted.
(API::ContentExtensionStore::ContentExtensionStore): Deleted.
(API::ContentExtensionStore::~ContentExtensionStore): Deleted.
(API::ContentExtensionMetaData::fileSize): Deleted.
(API::encodeContentExtensionMetaData): Deleted.
(API::decodeContentExtensionMetaData): Deleted.
(API::openAndMapContentExtension): Deleted.
(API::ContentExtensionStore::lookupContentExtension): Deleted.
(API::ContentExtensionStore::getAvailableContentExtensionIdentifiers): Deleted.
(API::ContentExtensionStore::compileContentExtension): Deleted.
(API::ContentExtensionStore::removeContentExtension): Deleted.
(API::ContentExtensionStore::synchronousRemoveAllContentExtensions): Deleted.
(API::ContentExtensionStore::invalidateContentExtensionVersion): Deleted.
(API::ContentExtensionStore::getContentExtensionSource): Deleted.
(API::contentExtensionStoreErrorCategory): Deleted.
* UIProcess/API/APIContentRuleListStore.h: Copied from Source/WebKit2/UIProcess/API/APIContentExtensionStore.h.
(API::make_error_code):
* UIProcess/API/C/WKAPICast.h:
* UIProcess/API/C/WKPageGroup.cpp:
* UIProcess/API/C/WKUserContentControllerRef.cpp:
(WKUserContentControllerAddUserContentFilter):
(WKUserContentControllerRemoveAllUserContentFilters):
* UIProcess/API/C/WKUserContentExtensionStoreRef.cpp:
(WKUserContentExtensionStoreGetTypeID):
* UIProcess/API/Cocoa/APIUserContentExtensionStoreCocoa.mm:
(API::ContentRuleListStore::defaultStorePath):
(API::ContentExtensionStore::defaultStorePath): Deleted.
* UIProcess/API/Cocoa/WKContentExtension.h: Removed.
* UIProcess/API/Cocoa/WKContentExtension.mm: Removed.
* UIProcess/API/Cocoa/WKContentExtensionInternal.h: Removed.
* UIProcess/API/Cocoa/WKContentExtensionStore.h: Removed.
* UIProcess/API/Cocoa/WKContentExtensionStore.mm: Removed.
* UIProcess/API/Cocoa/WKContentExtensionStoreInternal.h: Removed.
* UIProcess/API/Cocoa/WKContentExtensionStorePrivate.h: Removed.
* UIProcess/API/Cocoa/WKContentRuleList.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtension.h.
* UIProcess/API/Cocoa/WKContentRuleList.mm: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtension.mm.
(-[WKContentRuleList dealloc]):
(-[WKContentRuleList _apiObject]):
(-[WKContentRuleList identifier]):
(-[WKContentExtension dealloc]): Deleted.
(-[WKContentExtension _apiObject]): Deleted.
(-[WKContentExtension identifier]): Deleted.
* UIProcess/API/Cocoa/WKContentRuleListInternal.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionInternal.h.
(WebKit::wrapper):
* UIProcess/API/Cocoa/WKContentRuleListStore.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStore.h.
* UIProcess/API/Cocoa/WKContentRuleListStore.mm: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStore.mm.
(toWKErrorCode):
(-[WKContentRuleListStore dealloc]):
(+[WKContentRuleListStore defaultStore]):
(+[WKContentRuleListStore storeWithURL:]):
(-[WKContentRuleListStore compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:]):
(-[WKContentRuleListStore _compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:releasesArgument:]):
(-[WKContentRuleListStore lookUpContentRuleListForIdentifier:completionHandler:]):
(-[WKContentRuleListStore getAvailableContentRuleListIdentifiers:]):
(-[WKContentRuleListStore removeContentRuleListForIdentifier:completionHandler:]):
(-[WKContentRuleListStore _apiObject]):
(-[WKContentRuleListStore _removeAllContentRuleLists]):
(-[WKContentRuleListStore _invalidateContentRuleListVersionForIdentifier:]):
(-[WKContentRuleListStore _getContentRuleListSourceForIdentifier:completionHandler:]):
(-[WKContentRuleListStore _compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:]):
(-[WKContentExtensionStore dealloc]): Deleted.
(+[WKContentExtensionStore defaultStore]): Deleted.
(+[WKContentExtensionStore storeWithURL:]): Deleted.
(-[WKContentExtensionStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]): Deleted.
(-[WKContentExtensionStore _compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:releasesArgument:]): Deleted.
(-[WKContentExtensionStore lookUpContentExtensionForIdentifier:completionHandler:]): Deleted.
(-[WKContentExtensionStore getAvailableContentExtensionIdentifiers:]): Deleted.
(-[WKContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]): Deleted.
(-[WKContentExtensionStore _apiObject]): Deleted.
(-[WKContentExtensionStore _removeAllContentExtensions]): Deleted.
(-[WKContentExtensionStore _invalidateContentExtensionVersionForIdentifier:]): Deleted.
(-[WKContentExtensionStore _getContentExtensionSourceForIdentifier:completionHandler:]): Deleted.
(-[WKContentExtensionStore _compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]): Deleted.
* UIProcess/API/Cocoa/WKContentRuleListStoreInternal.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStoreInternal.h.
(WebKit::wrapper):
* UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStorePrivate.h.
* UIProcess/API/Cocoa/WKError.h:
* UIProcess/API/Cocoa/WKError.mm:
(localizedDescriptionForErrorCode):
* UIProcess/API/Cocoa/WKUserContentController.h:
* UIProcess/API/Cocoa/WKUserContentController.mm:
(-[WKUserContentController addContentRuleList:]):
(-[WKUserContentController removeContentRuleList:]):
(-[WKUserContentController removeAllContentRuleLists]):
(-[WKUserContentController _addUserContentFilter:]):
(-[WKUserContentController _removeUserContentFilter:]):
(-[WKUserContentController _removeAllUserContentFilters]):
(-[WKUserContentController addContentExtension:]): Deleted.
(-[WKUserContentController removeContentExtension:]): Deleted.
(-[WKUserContentController removeAllContentExtensions]): Deleted.
* UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm:
(toUserContentRuleListStoreError):
(+[_WKUserContentExtensionStore defaultStore]):
(+[_WKUserContentExtensionStore storeWithURL:]):
(-[_WKUserContentExtensionStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]):
(-[_WKUserContentExtensionStore lookupContentExtensionForIdentifier:completionHandler:]):
(-[_WKUserContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]):
(-[_WKUserContentExtensionStore _apiObject]):
(-[_WKUserContentExtensionStore _removeAllContentExtensions]):
(-[_WKUserContentExtensionStore _invalidateContentExtensionVersionForIdentifier:]):
(-[_WKUserContentExtensionStore _initWithWKContentRuleListStore:]):
(toUserContentExtensionStoreError): Deleted.
(-[_WKUserContentExtensionStore _initWithWKContentExtensionStore:]): Deleted.
* UIProcess/API/Cocoa/_WKUserContentExtensionStoreInternal.h:
* UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h:
* UIProcess/API/Cocoa/_WKUserContentFilter.mm:
(-[_WKUserContentFilter _apiObject]):
(-[_WKUserContentFilter _initWithWKContentRuleList:]):
(-[_WKUserContentFilter _initWithWKContentExtension:]): Deleted.
* UIProcess/API/Cocoa/_WKUserContentFilterInternal.h:
* UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
* UIProcess/UserContent/WebUserContentControllerProxy.cpp:
(WebKit::WebUserContentControllerProxy::addProcess):
(WebKit::WebUserContentControllerProxy::addContentRuleList):
(WebKit::WebUserContentControllerProxy::removeContentRuleList):
(WebKit::WebUserContentControllerProxy::removeAllContentRuleLists):
(WebKit::WebUserContentControllerProxy::addContentExtension): Deleted.
(WebKit::WebUserContentControllerProxy::removeContentExtension): Deleted.
(WebKit::WebUserContentControllerProxy::removeAllContentExtensions): Deleted.
* UIProcess/UserContent/WebUserContentControllerProxy.h:
* UIProcess/WebPageGroup.cpp:
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/UserContent/WebUserContentController.cpp:
(WebKit::WebUserContentController::addContentRuleLists):
(WebKit::WebUserContentController::removeContentRuleList):
(WebKit::WebUserContentController::removeAllContentRuleLists):
(WebKit::WebUserContentController::addContentExtensions): Deleted.
(WebKit::WebUserContentController::removeContentExtension): Deleted.
(WebKit::WebUserContentController::removeAllContentExtensions): Deleted.
* WebProcess/UserContent/WebUserContentController.h:
* WebProcess/UserContent/WebUserContentController.messages.in:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_backgroundCPULimit):

Tools:

* TestWebKitAPI/Tests/WebKit2Cocoa/WKContentExtensionStore.mm:
(WKContentRuleListStoreTest::SetUp):
(TEST_F):
(-[ContentRuleListDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]):
(WKContentExtensionStoreTest::SetUp): Deleted.
(-[ContentExtensionDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]): Deleted.

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

53 files changed:
Source/WebCore/ChangeLog
Source/WebCore/English.lproj/Localizable.strings
Source/WebKit2/CMakeLists.txt
Source/WebKit2/ChangeLog
Source/WebKit2/PlatformMac.cmake
Source/WebKit2/Shared/API/APIObject.h
Source/WebKit2/Shared/API/Cocoa/WebKit.h
Source/WebKit2/Shared/API/c/WKDeprecatedFunctions.cpp
Source/WebKit2/Shared/Cocoa/APIObject.mm
Source/WebKit2/Shared/WebCompiledContentRuleList.cpp [moved from Source/WebKit2/Shared/WebCompiledContentExtension.cpp with 74% similarity]
Source/WebKit2/Shared/WebCompiledContentRuleList.h [moved from Source/WebKit2/Shared/WebCompiledContentExtension.h with 83% similarity]
Source/WebKit2/Shared/WebCompiledContentRuleListData.cpp [moved from Source/WebKit2/Shared/WebCompiledContentExtensionData.cpp with 69% similarity]
Source/WebKit2/Shared/WebCompiledContentRuleListData.h [moved from Source/WebKit2/Shared/WebCompiledContentExtensionData.h with 82% similarity]
Source/WebKit2/Shared/WebPageCreationParameters.cpp
Source/WebKit2/Shared/WebPageCreationParameters.h
Source/WebKit2/UIProcess/API/APIContentRuleList.cpp [moved from Source/WebKit2/UIProcess/API/APIContentExtension.cpp with 84% similarity]
Source/WebKit2/UIProcess/API/APIContentRuleList.h [moved from Source/WebKit2/UIProcess/API/APIContentExtension.h with 72% similarity]
Source/WebKit2/UIProcess/API/APIContentRuleListStore.cpp [moved from Source/WebKit2/UIProcess/API/APIContentExtensionStore.cpp with 70% similarity]
Source/WebKit2/UIProcess/API/APIContentRuleListStore.h [moved from Source/WebKit2/UIProcess/API/APIContentExtensionStore.h with 53% similarity]
Source/WebKit2/UIProcess/API/C/WKAPICast.h
Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp
Source/WebKit2/UIProcess/API/C/WKUserContentControllerRef.cpp
Source/WebKit2/UIProcess/API/C/WKUserContentExtensionStoreRef.cpp
Source/WebKit2/UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm [moved from Source/WebKit2/UIProcess/API/Cocoa/APIUserContentExtensionStoreCocoa.mm with 77% similarity]
Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStore.mm [deleted file]
Source/WebKit2/UIProcess/API/Cocoa/WKContentRuleList.h [moved from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtension.h with 97% similarity]
Source/WebKit2/UIProcess/API/Cocoa/WKContentRuleList.mm [moved from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtension.mm with 87% similarity]
Source/WebKit2/UIProcess/API/Cocoa/WKContentRuleListInternal.h [moved from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionInternal.h with 78% similarity]
Source/WebKit2/UIProcess/API/Cocoa/WKContentRuleListStore.h [moved from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStore.h with 71% similarity]
Source/WebKit2/UIProcess/API/Cocoa/WKContentRuleListStore.mm [new file with mode: 0644]
Source/WebKit2/UIProcess/API/Cocoa/WKContentRuleListStoreInternal.h [moved from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStoreInternal.h with 78% similarity]
Source/WebKit2/UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h [moved from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStorePrivate.h with 61% similarity]
Source/WebKit2/UIProcess/API/Cocoa/WKError.h
Source/WebKit2/UIProcess/API/Cocoa/WKError.mm
Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.h
Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm
Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm
Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStoreInternal.h
Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h
Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilter.mm
Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilterInternal.h
Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h
Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp
Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.h
Source/WebKit2/UIProcess/WebPageGroup.cpp
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp
Source/WebKit2/WebProcess/UserContent/WebUserContentController.h
Source/WebKit2/WebProcess/UserContent/WebUserContentController.messages.in
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKContentExtensionStore.mm
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/_WKUserContentExtensionStore.mm

index 7171ef3..fced7bb 100644 (file)
@@ -1,3 +1,15 @@
+2017-05-12  Alex Christensen  <achristensen@webkit.org>
+
+        Rename WKContentExtension to WKContentRuleList
+        https://bugs.webkit.org/show_bug.cgi?id=172053
+        <rdar://problem/32141005>
+
+        Reviewed by Geoffrey Garen.
+
+        Covered by existing API tests.
+
+        * English.lproj/Localizable.strings:
+
 2017-05-12  Timothy Horton  <timothy_horton@apple.com>
 
         Don't use LinkPresentation URL shortening if it's not available
index 4c7c10e..605afe1 100644 (file)
 /* Subtitle of the label to show on a snapshotted plug-in */
 "Click to restart" = "Click to restart";
 
-/* WKErrorContentExtensionStoreCompileFailed description */
-"Compiling a WKUserContentExtension failed" = "Compiling a WKUserContentExtension failed";
+/* WKErrorContentRuleListStoreCompileFailed description */
+"Compiling a WKContentRuleList failed" = "Compiling a WKContentRuleList failed";
 
 /* WebKitErrorCannotShowMIMEType description */
 "Content with specified MIME type can’t be shown" = "Content with specified MIME type can’t be shown";
 /* Look Up context menu item with selected word */
 "Look Up “%s”" = "Look Up “%s”";
 
-/* WKErrorContentExtensionStoreLookupFailed description */
-"Looking up a WKUserContentExtension failed" = "Looking up a WKUserContentExtension failed";
+/* WKErrorContentRuleListStoreLookupFailed description */
+"Looking up a WKContentRuleList failed" = "Looking up a WKContentRuleList failed";
 
-/* WKErrorContentExtensionStoreVersionMismatch description */
-"Looking up a WKUserContentExtension found a binary that is incompatible" = "Looking up a WKUserContentExtension found a binary that is incompatible";
+/* WKErrorContentRuleListStoreVersionMismatch description */
+"Looking up a WKContentRuleList found a binary that is incompatible" = "Looking up a WKContentRuleList found a binary that is incompatible";
 
 /* Media Loop context menu item */
 "Loop" = "Loop";
 /* Reload context menu item */
 "Reload" = "Reload";
 
-/* WKErrorContentExtensionStoreRemoveFailed description */
-"Removing a WKUserContentExtension failed" = "Removing a WKUserContentExtension failed";
+/* WKErrorContentRuleListStoreRemoveFailed description */
+"Removing a WKContentRuleList failed" = "Removing a WKContentRuleList failed";
 
 /* default label for Reset buttons in forms on web pages */
 "Reset" = "Reset";
index 3fa9a51..1f73655 100644 (file)
@@ -182,8 +182,8 @@ set(WebKit2_SOURCES
     Shared/UserData.cpp
     Shared/VisitedLinkTable.cpp
     Shared/WebBackForwardListItem.cpp
-    Shared/WebCompiledContentExtension.cpp
-    Shared/WebCompiledContentExtensionData.cpp
+    Shared/WebCompiledContentRuleList.cpp
+    Shared/WebCompiledContentRuleListData.cpp
     Shared/WebConnection.cpp
     Shared/WebConnectionClient.cpp
     Shared/WebContextMenuItem.cpp
@@ -330,8 +330,8 @@ set(WebKit2_SOURCES
     UIProcess/WebURLSchemeTask.cpp
     UIProcess/WebViewportAttributes.cpp
 
-    UIProcess/API/APIContentExtension.cpp
-    UIProcess/API/APIContentExtensionStore.cpp
+    UIProcess/API/APIContentRuleList.cpp
+    UIProcess/API/APIContentRuleListStore.cpp
     UIProcess/API/APIExperimentalFeature.cpp
     UIProcess/API/APIFrameInfo.cpp
     UIProcess/API/APIHTTPCookieStore.cpp
index 6b8eedd..8ea4155 100644 (file)
@@ -1,3 +1,227 @@
+2017-05-12  Alex Christensen  <achristensen@webkit.org>
+
+        Rename WKContentExtension to WKContentRuleList
+        https://bugs.webkit.org/show_bug.cgi?id=172053
+        <rdar://problem/32141005>
+
+        Reviewed by Geoffrey Garen.
+
+        * Shared/API/APIObject.h:
+        * Shared/API/Cocoa/WebKit.h:
+        * Shared/API/c/WKDeprecatedFunctions.cpp:
+        (WKPageGroupAddUserContentFilter):
+        (WKPageGroupRemoveUserContentFilter):
+        * Shared/Cocoa/APIObject.mm:
+        (API::Object::newObject):
+        * Shared/WebCompiledContentExtension.cpp: Removed.
+        * Shared/WebCompiledContentExtension.h: Removed.
+        * Shared/WebCompiledContentExtensionData.cpp: Removed.
+        * Shared/WebCompiledContentExtensionData.h: Removed.
+        * Shared/WebCompiledContentRuleList.cpp: Copied from Source/WebKit2/Shared/WebCompiledContentExtension.cpp.
+        (WebKit::WebCompiledContentRuleList::create):
+        (WebKit::WebCompiledContentRuleList::WebCompiledContentRuleList):
+        (WebKit::WebCompiledContentRuleList::~WebCompiledContentRuleList):
+        (WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain):
+        (WebKit::WebCompiledContentRuleList::filtersWithoutConditionsBytecode):
+        (WebKit::WebCompiledContentRuleList::filtersWithoutConditionsBytecodeLength):
+        (WebKit::WebCompiledContentRuleList::filtersWithConditionsBytecode):
+        (WebKit::WebCompiledContentRuleList::filtersWithConditionsBytecodeLength):
+        (WebKit::WebCompiledContentRuleList::topURLFiltersBytecode):
+        (WebKit::WebCompiledContentRuleList::topURLFiltersBytecodeLength):
+        (WebKit::WebCompiledContentRuleList::actions):
+        (WebKit::WebCompiledContentRuleList::actionsLength):
+        (WebKit::WebCompiledContentExtension::create): Deleted.
+        (WebKit::WebCompiledContentExtension::WebCompiledContentExtension): Deleted.
+        (WebKit::WebCompiledContentExtension::~WebCompiledContentExtension): Deleted.
+        (WebKit::WebCompiledContentExtension::conditionsApplyOnlyToDomain): Deleted.
+        (WebKit::WebCompiledContentExtension::filtersWithoutConditionsBytecode): Deleted.
+        (WebKit::WebCompiledContentExtension::filtersWithoutConditionsBytecodeLength): Deleted.
+        (WebKit::WebCompiledContentExtension::filtersWithConditionsBytecode): Deleted.
+        (WebKit::WebCompiledContentExtension::filtersWithConditionsBytecodeLength): Deleted.
+        (WebKit::WebCompiledContentExtension::topURLFiltersBytecode): Deleted.
+        (WebKit::WebCompiledContentExtension::topURLFiltersBytecodeLength): Deleted.
+        (WebKit::WebCompiledContentExtension::actions): Deleted.
+        (WebKit::WebCompiledContentExtension::actionsLength): Deleted.
+        * Shared/WebCompiledContentRuleList.h: Copied from Source/WebKit2/Shared/WebCompiledContentExtension.h.
+        * Shared/WebCompiledContentRuleListData.cpp: Copied from Source/WebKit2/Shared/WebCompiledContentExtensionData.cpp.
+        (WebKit::WebCompiledContentRuleListData::encode):
+        (WebKit::WebCompiledContentRuleListData::decode):
+        (WebKit::WebCompiledContentExtensionData::encode): Deleted.
+        (WebKit::WebCompiledContentExtensionData::decode): Deleted.
+        * Shared/WebCompiledContentRuleListData.h: Copied from Source/WebKit2/Shared/WebCompiledContentExtensionData.h.
+        (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
+        (WebKit::WebCompiledContentExtensionData::WebCompiledContentExtensionData): Deleted.
+        * Shared/WebPageCreationParameters.cpp:
+        (WebKit::WebPageCreationParameters::encode):
+        (WebKit::WebPageCreationParameters::decode):
+        * Shared/WebPageCreationParameters.h:
+        * UIProcess/API/APIContentExtension.cpp: Removed.
+        * UIProcess/API/APIContentExtension.h: Removed.
+        * UIProcess/API/APIContentExtensionStore.cpp: Removed.
+        * UIProcess/API/APIContentExtensionStore.h: Removed.
+        * UIProcess/API/APIContentRuleList.cpp: Copied from Source/WebKit2/UIProcess/API/APIContentExtension.cpp.
+        (API::ContentRuleList::ContentRuleList):
+        (API::ContentRuleList::~ContentRuleList):
+        (API::ContentExtension::ContentExtension): Deleted.
+        (API::ContentExtension::~ContentExtension): Deleted.
+        * UIProcess/API/APIContentRuleList.h: Copied from Source/WebKit2/UIProcess/API/APIContentExtension.h.
+        * UIProcess/API/APIContentRuleListStore.cpp: Copied from Source/WebKit2/UIProcess/API/APIContentExtensionStore.cpp.
+        (API::ContentRuleListStore::legacyDefaultStore):
+        (API::ContentRuleListStore::nonLegacyDdefaultStore):
+        (API::ContentRuleListStore::defaultStore):
+        (API::ContentRuleListStore::storeWithPath):
+        (API::ContentRuleListStore::ContentRuleListStore):
+        (API::ContentRuleListStore::~ContentRuleListStore):
+        (API::constructedPathPrefix):
+        (API::ContentRuleListMetaData::fileSize):
+        (API::encodeContentRuleListMetaData):
+        (API::decodeContentRuleListMetaData):
+        (API::openAndMapContentRuleList):
+        (API::compiledToFile):
+        (API::createExtension):
+        (API::ContentRuleListStore::lookupContentRuleList):
+        (API::ContentRuleListStore::getAvailableContentRuleListIdentifiers):
+        (API::ContentRuleListStore::compileContentRuleList):
+        (API::ContentRuleListStore::removeContentRuleList):
+        (API::ContentRuleListStore::synchronousRemoveAllContentRuleLists):
+        (API::ContentRuleListStore::invalidateContentRuleListVersion):
+        (API::ContentRuleListStore::getContentRuleListSource):
+        (API::contentRuleListStoreErrorCategory):
+        (API::ContentExtensionStore::defaultStore): Deleted.
+        (API::ContentExtensionStore::storeWithPath): Deleted.
+        (API::ContentExtensionStore::ContentExtensionStore): Deleted.
+        (API::ContentExtensionStore::~ContentExtensionStore): Deleted.
+        (API::ContentExtensionMetaData::fileSize): Deleted.
+        (API::encodeContentExtensionMetaData): Deleted.
+        (API::decodeContentExtensionMetaData): Deleted.
+        (API::openAndMapContentExtension): Deleted.
+        (API::ContentExtensionStore::lookupContentExtension): Deleted.
+        (API::ContentExtensionStore::getAvailableContentExtensionIdentifiers): Deleted.
+        (API::ContentExtensionStore::compileContentExtension): Deleted.
+        (API::ContentExtensionStore::removeContentExtension): Deleted.
+        (API::ContentExtensionStore::synchronousRemoveAllContentExtensions): Deleted.
+        (API::ContentExtensionStore::invalidateContentExtensionVersion): Deleted.
+        (API::ContentExtensionStore::getContentExtensionSource): Deleted.
+        (API::contentExtensionStoreErrorCategory): Deleted.
+        * UIProcess/API/APIContentRuleListStore.h: Copied from Source/WebKit2/UIProcess/API/APIContentExtensionStore.h.
+        (API::make_error_code):
+        * UIProcess/API/C/WKAPICast.h:
+        * UIProcess/API/C/WKPageGroup.cpp:
+        * UIProcess/API/C/WKUserContentControllerRef.cpp:
+        (WKUserContentControllerAddUserContentFilter):
+        (WKUserContentControllerRemoveAllUserContentFilters):
+        * UIProcess/API/C/WKUserContentExtensionStoreRef.cpp:
+        (WKUserContentExtensionStoreGetTypeID):
+        * UIProcess/API/Cocoa/APIUserContentExtensionStoreCocoa.mm:
+        (API::ContentRuleListStore::defaultStorePath):
+        (API::ContentExtensionStore::defaultStorePath): Deleted.
+        * UIProcess/API/Cocoa/WKContentExtension.h: Removed.
+        * UIProcess/API/Cocoa/WKContentExtension.mm: Removed.
+        * UIProcess/API/Cocoa/WKContentExtensionInternal.h: Removed.
+        * UIProcess/API/Cocoa/WKContentExtensionStore.h: Removed.
+        * UIProcess/API/Cocoa/WKContentExtensionStore.mm: Removed.
+        * UIProcess/API/Cocoa/WKContentExtensionStoreInternal.h: Removed.
+        * UIProcess/API/Cocoa/WKContentExtensionStorePrivate.h: Removed.
+        * UIProcess/API/Cocoa/WKContentRuleList.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtension.h.
+        * UIProcess/API/Cocoa/WKContentRuleList.mm: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtension.mm.
+        (-[WKContentRuleList dealloc]):
+        (-[WKContentRuleList _apiObject]):
+        (-[WKContentRuleList identifier]):
+        (-[WKContentExtension dealloc]): Deleted.
+        (-[WKContentExtension _apiObject]): Deleted.
+        (-[WKContentExtension identifier]): Deleted.
+        * UIProcess/API/Cocoa/WKContentRuleListInternal.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionInternal.h.
+        (WebKit::wrapper):
+        * UIProcess/API/Cocoa/WKContentRuleListStore.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStore.h.
+        * UIProcess/API/Cocoa/WKContentRuleListStore.mm: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStore.mm.
+        (toWKErrorCode):
+        (-[WKContentRuleListStore dealloc]):
+        (+[WKContentRuleListStore defaultStore]):
+        (+[WKContentRuleListStore storeWithURL:]):
+        (-[WKContentRuleListStore compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:]):
+        (-[WKContentRuleListStore _compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:releasesArgument:]):
+        (-[WKContentRuleListStore lookUpContentRuleListForIdentifier:completionHandler:]):
+        (-[WKContentRuleListStore getAvailableContentRuleListIdentifiers:]):
+        (-[WKContentRuleListStore removeContentRuleListForIdentifier:completionHandler:]):
+        (-[WKContentRuleListStore _apiObject]):
+        (-[WKContentRuleListStore _removeAllContentRuleLists]):
+        (-[WKContentRuleListStore _invalidateContentRuleListVersionForIdentifier:]):
+        (-[WKContentRuleListStore _getContentRuleListSourceForIdentifier:completionHandler:]):
+        (-[WKContentRuleListStore _compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:]):
+        (-[WKContentExtensionStore dealloc]): Deleted.
+        (+[WKContentExtensionStore defaultStore]): Deleted.
+        (+[WKContentExtensionStore storeWithURL:]): Deleted.
+        (-[WKContentExtensionStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]): Deleted.
+        (-[WKContentExtensionStore _compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:releasesArgument:]): Deleted.
+        (-[WKContentExtensionStore lookUpContentExtensionForIdentifier:completionHandler:]): Deleted.
+        (-[WKContentExtensionStore getAvailableContentExtensionIdentifiers:]): Deleted.
+        (-[WKContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]): Deleted.
+        (-[WKContentExtensionStore _apiObject]): Deleted.
+        (-[WKContentExtensionStore _removeAllContentExtensions]): Deleted.
+        (-[WKContentExtensionStore _invalidateContentExtensionVersionForIdentifier:]): Deleted.
+        (-[WKContentExtensionStore _getContentExtensionSourceForIdentifier:completionHandler:]): Deleted.
+        (-[WKContentExtensionStore _compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]): Deleted.
+        * UIProcess/API/Cocoa/WKContentRuleListStoreInternal.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStoreInternal.h.
+        (WebKit::wrapper):
+        * UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStorePrivate.h.
+        * UIProcess/API/Cocoa/WKError.h:
+        * UIProcess/API/Cocoa/WKError.mm:
+        (localizedDescriptionForErrorCode):
+        * UIProcess/API/Cocoa/WKUserContentController.h:
+        * UIProcess/API/Cocoa/WKUserContentController.mm:
+        (-[WKUserContentController addContentRuleList:]):
+        (-[WKUserContentController removeContentRuleList:]):
+        (-[WKUserContentController removeAllContentRuleLists]):
+        (-[WKUserContentController _addUserContentFilter:]):
+        (-[WKUserContentController _removeUserContentFilter:]):
+        (-[WKUserContentController _removeAllUserContentFilters]):
+        (-[WKUserContentController addContentExtension:]): Deleted.
+        (-[WKUserContentController removeContentExtension:]): Deleted.
+        (-[WKUserContentController removeAllContentExtensions]): Deleted.
+        * UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm:
+        (toUserContentRuleListStoreError):
+        (+[_WKUserContentExtensionStore defaultStore]):
+        (+[_WKUserContentExtensionStore storeWithURL:]):
+        (-[_WKUserContentExtensionStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]):
+        (-[_WKUserContentExtensionStore lookupContentExtensionForIdentifier:completionHandler:]):
+        (-[_WKUserContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]):
+        (-[_WKUserContentExtensionStore _apiObject]):
+        (-[_WKUserContentExtensionStore _removeAllContentExtensions]):
+        (-[_WKUserContentExtensionStore _invalidateContentExtensionVersionForIdentifier:]):
+        (-[_WKUserContentExtensionStore _initWithWKContentRuleListStore:]):
+        (toUserContentExtensionStoreError): Deleted.
+        (-[_WKUserContentExtensionStore _initWithWKContentExtensionStore:]): Deleted.
+        * UIProcess/API/Cocoa/_WKUserContentExtensionStoreInternal.h:
+        * UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h:
+        * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
+        (-[_WKUserContentFilter _apiObject]):
+        (-[_WKUserContentFilter _initWithWKContentRuleList:]):
+        (-[_WKUserContentFilter _initWithWKContentExtension:]): Deleted.
+        * UIProcess/API/Cocoa/_WKUserContentFilterInternal.h:
+        * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
+        * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
+        (WebKit::WebUserContentControllerProxy::addProcess):
+        (WebKit::WebUserContentControllerProxy::addContentRuleList):
+        (WebKit::WebUserContentControllerProxy::removeContentRuleList):
+        (WebKit::WebUserContentControllerProxy::removeAllContentRuleLists):
+        (WebKit::WebUserContentControllerProxy::addContentExtension): Deleted.
+        (WebKit::WebUserContentControllerProxy::removeContentExtension): Deleted.
+        (WebKit::WebUserContentControllerProxy::removeAllContentExtensions): Deleted.
+        * UIProcess/UserContent/WebUserContentControllerProxy.h:
+        * UIProcess/WebPageGroup.cpp:
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/UserContent/WebUserContentController.cpp:
+        (WebKit::WebUserContentController::addContentRuleLists):
+        (WebKit::WebUserContentController::removeContentRuleList):
+        (WebKit::WebUserContentController::removeAllContentRuleLists):
+        (WebKit::WebUserContentController::addContentExtensions): Deleted.
+        (WebKit::WebUserContentController::removeContentExtension): Deleted.
+        (WebKit::WebUserContentController::removeAllContentExtensions): Deleted.
+        * WebProcess/UserContent/WebUserContentController.h:
+        * WebProcess/UserContent/WebUserContentController.messages.in:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::m_backgroundCPULimit):
+
 2017-05-12  Jeremy Jones  <jeremyj@apple.com>
 
         Add objc version of WK2 UIPageClient setHasVideoInPictureInPicture and rename it to hasVideoInPictureInPictureDidChange.
index 2795e46..5b1e86a 100644 (file)
@@ -182,8 +182,8 @@ list(APPEND WebKit2_SOURCES
     UIProcess/API/C/mac/WKContextPrivateMac.mm
     UIProcess/API/C/mac/WKPagePrivateMac.mm
 
+    UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm
     UIProcess/API/Cocoa/APISerializedScriptValueCocoa.mm
-    UIProcess/API/Cocoa/APIUserContentExtensionStoreCocoa.mm
     UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm
     UIProcess/API/Cocoa/LegacyBundleForClass.mm
     UIProcess/API/Cocoa/WKBackForwardList.mm
@@ -191,8 +191,8 @@ list(APPEND WebKit2_SOURCES
     UIProcess/API/Cocoa/WKBrowsingContextController.mm
     UIProcess/API/Cocoa/WKBrowsingContextGroup.mm
     UIProcess/API/Cocoa/WKConnection.mm
-    UIProcess/API/Cocoa/WKContentExtension.mm
-    UIProcess/API/Cocoa/WKContentExtensionStore.mm
+    UIProcess/API/Cocoa/WKContentRuleList.mm
+    UIProcess/API/Cocoa/WKContentRuleListStore.mm
     UIProcess/API/Cocoa/WKError.mm
     UIProcess/API/Cocoa/WKFrameInfo.mm
     UIProcess/API/Cocoa/WKHTTPCookieStore.mm
index 317418d..2261861 100644 (file)
@@ -103,8 +103,8 @@ public:
         BackForwardListItem,
         CacheManager,
         ColorPickerResultListener,
-        ContentExtension,
-        ContentExtensionStore,
+        ContentRuleList,
+        ContentRuleListStore,
         ContextMenuListener,
         CookieManager,
         Download,
index 6156582..b417aee 100644 (file)
@@ -25,8 +25,8 @@
 
 #import <WebKit/WKBackForwardList.h>
 #import <WebKit/WKBackForwardListItem.h>
-#import <WebKit/WKContentExtension.h>
-#import <WebKit/WKContentExtensionStore.h>
+#import <WebKit/WKContentRuleList.h>
+#import <WebKit/WKContentRuleListStore.h>
 #import <WebKit/WKError.h>
 #import <WebKit/WKFoundation.h>
 #import <WebKit/WKFrameInfo.h>
index d6ba004..4d51136 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "config.h"
 
-#include "APIContentExtension.h"
+#include "APIContentRuleList.h"
 #include "APIDictionary.h"
 #include "WKAPICast.h"
 #include "WKArray.h"
@@ -60,7 +60,7 @@ WKStringRef WKPageGroupCopyIdentifier(WKPageGroupRef)
 void WKPageGroupAddUserContentFilter(WKPageGroupRef pageGroupRef, WKUserContentFilterRef contentFilterRef)
 {
 #if ENABLE(CONTENT_EXTENSIONS)
-    toImpl(pageGroupRef)->userContentController().addContentExtension(*toImpl(contentFilterRef));
+    toImpl(pageGroupRef)->userContentController().addContentRuleList(*toImpl(contentFilterRef));
 #else
     UNUSED_PARAM(pageGroupRef);
     UNUSED_PARAM(contentFilterRef);
@@ -70,7 +70,7 @@ void WKPageGroupAddUserContentFilter(WKPageGroupRef pageGroupRef, WKUserContentF
 void WKPageGroupRemoveUserContentFilter(WKPageGroupRef pageGroupRef, WKStringRef contentFilterNameRef)
 {
 #if ENABLE(CONTENT_EXTENSIONS)
-    toImpl(pageGroupRef)->userContentController().removeContentExtension(toWTFString(contentFilterNameRef));
+    toImpl(pageGroupRef)->userContentController().removeContentRuleList(toWTFString(contentFilterNameRef));
 #else
     UNUSED_PARAM(pageGroupRef);
     UNUSED_PARAM(contentFilterNameRef);
index 17d7e37..9b0c27b 100644 (file)
@@ -33,8 +33,8 @@
 #import "WKBrowsingContextControllerInternal.h"
 #import "WKBrowsingContextGroupInternal.h"
 #import "WKConnectionInternal.h"
-#import "WKContentExtensionInternal.h"
-#import "WKContentExtensionStoreInternal.h"
+#import "WKContentRuleListInternal.h"
+#import "WKContentRuleListStoreInternal.h"
 #import "WKFrameInfoInternal.h"
 #import "WKHTTPCookieStoreInternal.h"
 #import "WKNSArray.h"
@@ -246,12 +246,12 @@ void* Object::newObject(size_t size, Type type)
         wrapper = [WKUserContentController alloc];
         break;
 
-    case Type::ContentExtension:
-        wrapper = [WKContentExtension alloc];
+    case Type::ContentRuleList:
+        wrapper = [WKContentRuleList alloc];
         break;
 
-    case Type::ContentExtensionStore:
-        wrapper = [WKContentExtensionStore alloc];
+    case Type::ContentRuleListStore:
+        wrapper = [WKContentRuleListStore alloc];
         break;
 
     case Type::UserContentWorld:
  */
 
 #include "config.h"
-#include "WebCompiledContentExtension.h"
+#include "WebCompiledContentRuleList.h"
 
 #if ENABLE(CONTENT_EXTENSIONS)
 
 namespace WebKit {
 
-Ref<WebCompiledContentExtension> WebCompiledContentExtension::create(WebCompiledContentExtensionData&& data)
+Ref<WebCompiledContentRuleList> WebCompiledContentRuleList::create(WebCompiledContentRuleListData&& data)
 {
-    return adoptRef(*new WebCompiledContentExtension(WTFMove(data)));
+    return adoptRef(*new WebCompiledContentRuleList(WTFMove(data)));
 }
 
-WebCompiledContentExtension::WebCompiledContentExtension(WebCompiledContentExtensionData&& data)
+WebCompiledContentRuleList::WebCompiledContentRuleList(WebCompiledContentRuleListData&& data)
     : m_data(WTFMove(data))
 {
 }
 
-WebCompiledContentExtension::~WebCompiledContentExtension()
+WebCompiledContentRuleList::~WebCompiledContentRuleList()
 {
 }
 
-bool WebCompiledContentExtension::conditionsApplyOnlyToDomain() const
+bool WebCompiledContentRuleList::conditionsApplyOnlyToDomain() const
 {
     return *reinterpret_cast<uint32_t*>(reinterpret_cast<uint8_t*>(m_data.data->data()) + m_data.conditionsApplyOnlyToDomainOffset);
 }
 
-const WebCore::ContentExtensions::DFABytecode* WebCompiledContentExtension::filtersWithoutConditionsBytecode() const
+const WebCore::ContentExtensions::DFABytecode* WebCompiledContentRuleList::filtersWithoutConditionsBytecode() const
 {
     return static_cast<const WebCore::ContentExtensions::DFABytecode*>(m_data.data->data()) + m_data.filtersWithoutConditionsBytecodeOffset;
 }
 
-unsigned WebCompiledContentExtension::filtersWithoutConditionsBytecodeLength() const
+unsigned WebCompiledContentRuleList::filtersWithoutConditionsBytecodeLength() const
 {
     return m_data.filtersWithoutConditionsBytecodeSize;
 }
 
-const WebCore::ContentExtensions::DFABytecode* WebCompiledContentExtension::filtersWithConditionsBytecode() const
+const WebCore::ContentExtensions::DFABytecode* WebCompiledContentRuleList::filtersWithConditionsBytecode() const
 {
     return static_cast<const WebCore::ContentExtensions::DFABytecode*>(m_data.data->data()) + m_data.filtersWithConditionsBytecodeOffset;
 }
 
-unsigned WebCompiledContentExtension::filtersWithConditionsBytecodeLength() const
+unsigned WebCompiledContentRuleList::filtersWithConditionsBytecodeLength() const
 {
     return m_data.filtersWithConditionsBytecodeSize;
 }
 
-const WebCore::ContentExtensions::DFABytecode* WebCompiledContentExtension::topURLFiltersBytecode() const
+const WebCore::ContentExtensions::DFABytecode* WebCompiledContentRuleList::topURLFiltersBytecode() const
 {
     return static_cast<const WebCore::ContentExtensions::DFABytecode*>(m_data.data->data()) + m_data.topURLFiltersBytecodeOffset;
 }
 
-unsigned WebCompiledContentExtension::topURLFiltersBytecodeLength() const
+unsigned WebCompiledContentRuleList::topURLFiltersBytecodeLength() const
 {
     return m_data.topURLFiltersBytecodeSize;
 }
 
-const WebCore::ContentExtensions::SerializedActionByte* WebCompiledContentExtension::actions() const
+const WebCore::ContentExtensions::SerializedActionByte* WebCompiledContentRuleList::actions() const
 {
     return static_cast<const WebCore::ContentExtensions::SerializedActionByte*>(m_data.data->data()) + m_data.actionsOffset;
 }
 
-unsigned WebCompiledContentExtension::actionsLength() const
+unsigned WebCompiledContentRuleList::actionsLength() const
 {
     return m_data.actionsSize;
 }
 
 #if ENABLE(CONTENT_EXTENSIONS)
 
-#include "WebCompiledContentExtensionData.h"
-#include <WebCore/ContentExtensionCompiler.h>
+#include "WebCompiledContentRuleListData.h"
 #include <WebCore/CompiledContentExtension.h>
+#include <WebCore/ContentExtensionCompiler.h>
 
 namespace WebKit {
 
-class WebCompiledContentExtension final : public WebCore::ContentExtensions::CompiledContentExtension {
+class WebCompiledContentRuleList final : public WebCore::ContentExtensions::CompiledContentExtension {
 public:
-    static Ref<WebCompiledContentExtension> create(WebCompiledContentExtensionData&&);
-    virtual ~WebCompiledContentExtension();
+    static Ref<WebCompiledContentRuleList> create(WebCompiledContentRuleListData&&);
+    virtual ~WebCompiledContentRuleList();
 
-    WebCompiledContentExtensionData data() const { return m_data; }
+    WebCompiledContentRuleListData data() const { return m_data; }
 
 private:
-    WebCompiledContentExtension(WebCompiledContentExtensionData&&);
+    WebCompiledContentRuleList(WebCompiledContentRuleListData&&);
 
     const WebCore::ContentExtensions::DFABytecode* filtersWithoutConditionsBytecode() const final;
     unsigned filtersWithoutConditionsBytecodeLength() const final;
@@ -54,7 +54,7 @@ private:
     const WebCore::ContentExtensions::SerializedActionByte* actions() const final;
     unsigned actionsLength() const final;
     
-    WebCompiledContentExtensionData m_data;
+    WebCompiledContentRuleListData m_data;
 };
 
 } // namespace WebKit
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "WebCompiledContentExtensionData.h"
+#include "WebCompiledContentRuleListData.h"
 
 #if ENABLE(CONTENT_EXTENSIONS)
 
@@ -32,7 +32,7 @@
 
 namespace WebKit {
 
-void WebCompiledContentExtensionData::encode(IPC::Encoder& encoder) const
+void WebCompiledContentRuleListData::encode(IPC::Encoder& encoder) const
 {
     SharedMemory::Handle handle;
     data->createHandle(handle, SharedMemory::Protection::ReadOnly);
@@ -48,28 +48,28 @@ void WebCompiledContentExtensionData::encode(IPC::Encoder& encoder) const
     encoder << topURLFiltersBytecodeSize;
 }
 
-bool WebCompiledContentExtensionData::decode(IPC::Decoder& decoder, WebCompiledContentExtensionData& compiledContentExtensionData)
+bool WebCompiledContentRuleListData::decode(IPC::Decoder& decoder, WebCompiledContentRuleListData& compiledContentRuleListData)
 {
     SharedMemory::Handle handle;
     if (!decoder.decode(handle))
         return false;
-    compiledContentExtensionData.data = SharedMemory::map(handle, SharedMemory::Protection::ReadOnly);
+    compiledContentRuleListData.data = SharedMemory::map(handle, SharedMemory::Protection::ReadOnly);
 
-    if (!decoder.decode(compiledContentExtensionData.actionsOffset))
+    if (!decoder.decode(compiledContentRuleListData.actionsOffset))
         return false;
-    if (!decoder.decode(compiledContentExtensionData.actionsSize))
+    if (!decoder.decode(compiledContentRuleListData.actionsSize))
         return false;
-    if (!decoder.decode(compiledContentExtensionData.filtersWithoutConditionsBytecodeOffset))
+    if (!decoder.decode(compiledContentRuleListData.filtersWithoutConditionsBytecodeOffset))
         return false;
-    if (!decoder.decode(compiledContentExtensionData.filtersWithoutConditionsBytecodeSize))
+    if (!decoder.decode(compiledContentRuleListData.filtersWithoutConditionsBytecodeSize))
         return false;
-    if (!decoder.decode(compiledContentExtensionData.filtersWithConditionsBytecodeOffset))
+    if (!decoder.decode(compiledContentRuleListData.filtersWithConditionsBytecodeOffset))
         return false;
-    if (!decoder.decode(compiledContentExtensionData.filtersWithConditionsBytecodeSize))
+    if (!decoder.decode(compiledContentRuleListData.filtersWithConditionsBytecodeSize))
         return false;
-    if (!decoder.decode(compiledContentExtensionData.topURLFiltersBytecodeOffset))
+    if (!decoder.decode(compiledContentRuleListData.topURLFiltersBytecodeOffset))
         return false;
-    if (!decoder.decode(compiledContentExtensionData.topURLFiltersBytecodeSize))
+    if (!decoder.decode(compiledContentRuleListData.topURLFiltersBytecodeSize))
         return false;
 
     return true;
@@ -38,11 +38,11 @@ class Encoder;
 
 namespace WebKit {
 
-class WebCompiledContentExtensionData {
+class WebCompiledContentRuleListData {
 public:
-    WebCompiledContentExtensionData() = default;
+    WebCompiledContentRuleListData() = default;
 
-    WebCompiledContentExtensionData(RefPtr<SharedMemory>&& 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)
@@ -58,7 +58,7 @@ public:
     }
 
     void encode(IPC::Encoder&) const;
-    static bool decode(IPC::Decoder&, WebCompiledContentExtensionData&);
+    static bool decode(IPC::Decoder&, WebCompiledContentRuleListData&);
 
     RefPtr<SharedMemory> data;
     NetworkCache::Data fileData;
index b8faebd..104d7cb 100644 (file)
@@ -107,7 +107,7 @@ void WebPageCreationParameters::encode(IPC::Encoder& encoder) const
     encoder << userStyleSheets;
     encoder << messageHandlers;
 #if ENABLE(CONTENT_EXTENSIONS)
-    encoder << contentExtensions;
+    encoder << contentRuleLists;
 #endif
 }
 
@@ -257,7 +257,7 @@ bool WebPageCreationParameters::decode(IPC::Decoder& decoder, WebPageCreationPar
     if (!decoder.decode(parameters.messageHandlers))
         return false;
 #if ENABLE(CONTENT_EXTENSIONS)
-    if (!decoder.decode(parameters.contentExtensions))
+    if (!decoder.decode(parameters.contentRuleLists))
         return false;
 #endif
     return true;
index 65d3731..27cf0b4 100644 (file)
@@ -28,7 +28,7 @@
 #include "DrawingAreaInfo.h"
 #include "LayerTreeContext.h"
 #include "SessionState.h"
-#include "WebCompiledContentExtensionData.h"
+#include "WebCompiledContentRuleListData.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebPageGroupData.h"
 #include "WebPreferencesStore.h"
@@ -165,7 +165,7 @@ struct WebPageCreationParameters {
     Vector<WebUserStyleSheetData> userStyleSheets;
     Vector<WebScriptMessageHandlerData> messageHandlers;
 #if ENABLE(CONTENT_EXTENSIONS)
-    Vector<std::pair<String, WebCompiledContentExtensionData>> contentExtensions;
+    Vector<std::pair<String, WebCompiledContentRuleListData>> contentRuleLists;
 #endif
 };
 
  */
 
 #include "config.h"
-#include "APIContentExtension.h"
+#include "APIContentRuleList.h"
 
 #if ENABLE(CONTENT_EXTENSIONS)
 
-#include "WebCompiledContentExtension.h"
+#include "WebCompiledContentRuleList.h"
 
 namespace API {
 
-ContentExtension::ContentExtension(const WTF::String& name, Ref<WebKit::WebCompiledContentExtension>&& contentExtension)
+ContentRuleList::ContentRuleList(const WTF::String& name, Ref<WebKit::WebCompiledContentRuleList>&& contentRuleList)
     : m_name(name)
-    , m_compiledExtension(WTFMove(contentExtension))
+    , m_compiledRuleList(WTFMove(contentRuleList))
 {
 }
 
-ContentExtension::~ContentExtension()
+ContentRuleList::~ContentRuleList()
 {
 }
 
 #include <wtf/text/WTFString.h>
 
 namespace WebKit {
-class WebCompiledContentExtension;
+class WebCompiledContentRuleList;
 }
 
 namespace API {
 
-class ContentExtension final : public ObjectImpl<Object::Type::ContentExtension> {
+class ContentRuleList final : public ObjectImpl<Object::Type::ContentRuleList> {
 public:
 #if ENABLE(CONTENT_EXTENSIONS)
-    static Ref<ContentExtension> create(const WTF::String& name, Ref<WebKit::WebCompiledContentExtension>&& contentExtension)
+    static Ref<ContentRuleList> create(const WTF::String& name, Ref<WebKit::WebCompiledContentRuleList>&& contentRuleList)
     {
-        return adoptRef(*new ContentExtension(name, WTFMove(contentExtension)));
+        return adoptRef(*new ContentRuleList(name, WTFMove(contentRuleList)));
     }
 
-    ContentExtension(const WTF::String& name, Ref<WebKit::WebCompiledContentExtension>&&);
-    virtual ~ContentExtension();
+    ContentRuleList(const WTF::String& name, Ref<WebKit::WebCompiledContentRuleList>&&);
+    virtual ~ContentRuleList();
 
     const WTF::String& name() const { return m_name; }
-    const WebKit::WebCompiledContentExtension& compiledExtension() const { return m_compiledExtension.get(); }
+    const WebKit::WebCompiledContentRuleList& compiledRuleList() const { return m_compiledRuleList.get(); }
 
 private:
     WTF::String m_name;
-    Ref<WebKit::WebCompiledContentExtension> m_compiledExtension;
+    Ref<WebKit::WebCompiledContentRuleList> m_compiledRuleList;
 #endif // ENABLE(CONTENT_EXTENSIONS)
 };
 
  */
 
 #include "config.h"
-#include "APIContentExtensionStore.h"
+#include "APIContentRuleListStore.h"
 
 #if ENABLE(CONTENT_EXTENSIONS)
 
-#include "APIContentExtension.h"
+#include "APIContentRuleList.h"
 #include "NetworkCacheData.h"
 #include "NetworkCacheFileSystem.h"
 #include "SharedMemory.h"
-#include "WebCompiledContentExtension.h"
+#include "WebCompiledContentRuleList.h"
 #include <WebCore/ContentExtensionCompiler.h>
 #include <WebCore/ContentExtensionError.h>
 #include <string>
 using namespace WebKit::NetworkCache;
 
 namespace API {
-
-ContentExtensionStore& ContentExtensionStore::defaultStore()
+    
+ContentRuleListStore& ContentRuleListStore::legacyDefaultStore()
 {
-    static ContentExtensionStore* defaultStore = adoptRef(new ContentExtensionStore).leakRef();
+    const bool legacyFilename = true;
+    static ContentRuleListStore* defaultStore = adoptRef(new ContentRuleListStore(legacyFilename)).leakRef();
     return *defaultStore;
 }
+    
+ContentRuleListStore& ContentRuleListStore::nonLegacyDdefaultStore()
+{
+    const bool legacyFilename = false;
+    static ContentRuleListStore* defaultStore = adoptRef(new ContentRuleListStore(legacyFilename)).leakRef();
+    return *defaultStore;
+}
+    
+ContentRuleListStore& ContentRuleListStore::defaultStore(bool legacyFilename)
+{
+    if (legacyFilename)
+        return legacyDefaultStore();
+    return nonLegacyDdefaultStore();
+}
 
-Ref<ContentExtensionStore> ContentExtensionStore::storeWithPath(const WTF::String& storePath)
+Ref<ContentRuleListStore> ContentRuleListStore::storeWithPath(const WTF::String& storePath, bool legacyFilename)
 {
-    return adoptRef(*new ContentExtensionStore(storePath));
+    return adoptRef(*new ContentRuleListStore(storePath, legacyFilename));
 }
 
-ContentExtensionStore::ContentExtensionStore()
-    : ContentExtensionStore(defaultStorePath())
+ContentRuleListStore::ContentRuleListStore(bool legacyFilename)
+    : ContentRuleListStore(defaultStorePath(legacyFilename), legacyFilename)
 {
 }
 
-ContentExtensionStore::ContentExtensionStore(const WTF::String& storePath)
+ContentRuleListStore::ContentRuleListStore(const WTF::String& storePath, bool legacyFilename)
     : m_storePath(storePath)
-    , m_compileQueue(WorkQueue::create("ContentExtensionStore Compile Queue", WorkQueue::Type::Concurrent))
-    , m_readQueue(WorkQueue::create("ContentExtensionStore Read Queue"))
-    , m_removeQueue(WorkQueue::create("ContentExtensionStore Remove Queue"))
+    , m_compileQueue(WorkQueue::create("ContentRuleListStore Compile Queue", WorkQueue::Type::Concurrent))
+    , m_readQueue(WorkQueue::create("ContentRuleListStore Read Queue"))
+    , m_removeQueue(WorkQueue::create("ContentRuleListStore Remove Queue"))
+    , m_legacyFilename(legacyFilename)
 {
     WebCore::makeAllDirectories(storePath);
 }
 
-ContentExtensionStore::~ContentExtensionStore()
+ContentRuleListStore::~ContentRuleListStore()
 {
 }
 
-static const String& constructedPathPrefix()
+static const String& constructedPathPrefix(bool legacyFilename)
 {
-    static NeverDestroyed<String> prefix("ContentExtension-");
+    static NeverDestroyed<String> prefix("ContentRuleList-");
+    static NeverDestroyed<String> legacyPrefix("ContentExtension-");
+    if (legacyFilename)
+        return legacyPrefix;
     return prefix;
 }
 
-static const String constructedPathFilter()
+static const String constructedPathFilter(bool legacyFilename)
 {
-    return makeString(constructedPathPrefix(), '*');
+    return makeString(constructedPathPrefix(legacyFilename), '*');
 }
 
-static String constructedPath(const String& base, const String& identifier)
+static String constructedPath(const String& base, const String& identifier, bool legacyFilename)
 {
-    return WebCore::pathByAppendingComponent(base, makeString(constructedPathPrefix(), WebCore::encodeForFileName(identifier)));
+    return WebCore::pathByAppendingComponent(base, makeString(constructedPathPrefix(legacyFilename), WebCore::encodeForFileName(identifier)));
 }
 
 // The size and offset of the densely packed bytes in the file, not sizeof and offsetof, which would
 // represent the size and offset of the structure in memory, possibly with compiler-added padding.
-const size_t ContentExtensionFileHeaderSize = 2 * sizeof(uint32_t) + 5 * sizeof(uint64_t);
+const size_t ContentRuleListFileHeaderSize = 2 * sizeof(uint32_t) + 5 * sizeof(uint64_t);
 const size_t ConditionsApplyOnlyToDomainOffset = sizeof(uint32_t) + 5 * sizeof(uint64_t);
 
-struct ContentExtensionMetaData {
-    uint32_t version { ContentExtensionStore::CurrentContentExtensionFileVersion };
+struct ContentRuleListMetaData {
+    uint32_t version { ContentRuleListStore::CurrentContentRuleListFileVersion };
     uint64_t sourceSize { 0 };
     uint64_t actionsSize { 0 };
     uint64_t filtersWithoutConditionsBytecodeSize { 0 };
@@ -107,7 +126,7 @@ struct ContentExtensionMetaData {
     
     size_t fileSize() const
     {
-        return ContentExtensionFileHeaderSize
+        return ContentRuleListFileHeaderSize
             + sourceSize
             + actionsSize
             + filtersWithoutConditionsBytecodeSize
@@ -116,7 +135,7 @@ struct ContentExtensionMetaData {
     }
 };
 
-static Data encodeContentExtensionMetaData(const ContentExtensionMetaData& metaData)
+static Data encodeContentRuleListMetaData(const ContentRuleListMetaData& metaData)
 {
     WTF::Persistence::Encoder encoder;
 
@@ -128,11 +147,11 @@ static Data encodeContentExtensionMetaData(const ContentExtensionMetaData& metaD
     encoder << metaData.conditionedFiltersBytecodeSize;
     encoder << metaData.conditionsApplyOnlyToDomain;
 
-    ASSERT(encoder.bufferSize() == ContentExtensionFileHeaderSize);
+    ASSERT(encoder.bufferSize() == ContentRuleListFileHeaderSize);
     return Data(encoder.buffer(), encoder.bufferSize());
 }
 
-static bool decodeContentExtensionMetaData(ContentExtensionMetaData& metaData, const Data& fileData)
+static bool decodeContentRuleListMetaData(ContentRuleListMetaData& metaData, const Data& fileData)
 {
     bool success = false;
     fileData.apply([&metaData, &success, &fileData](const uint8_t* data, size_t size) {
@@ -162,13 +181,13 @@ static bool decodeContentExtensionMetaData(ContentExtensionMetaData& metaData, c
     return success;
 }
 
-static bool openAndMapContentExtension(const String& path, ContentExtensionMetaData& metaData, Data& fileData)
+static bool openAndMapContentRuleList(const String& path, ContentRuleListMetaData& metaData, Data& fileData)
 {
     fileData = mapFile(WebCore::fileSystemRepresentation(path).data());
     if (fileData.isNull())
         return false;
 
-    if (!decodeContentExtensionMetaData(metaData, fileData))
+    if (!decodeContentRuleListMetaData(metaData, fileData))
         return false;
 
     return true;
@@ -188,13 +207,13 @@ static bool writeDataToFile(const Data& fileData, WebCore::PlatformFileHandle fd
     return success;
 }
 
-static std::error_code compiledToFile(String&& json, const String& finalFilePath, ContentExtensionMetaData& metaData, Data& mappedData)
+static std::error_code compiledToFile(String&& json, const String& finalFilePath, ContentRuleListMetaData& metaData, Data& mappedData)
 {
     using namespace WebCore::ContentExtensions;
 
     class CompilationClient final : public ContentExtensionCompilationClient {
     public:
-        CompilationClient(WebCore::PlatformFileHandle fileHandle, ContentExtensionMetaData& metaData)
+        CompilationClient(WebCore::PlatformFileHandle fileHandle, ContentRuleListMetaData& metaData)
             : m_fileHandle(fileHandle)
             , m_metaData(metaData)
         {
@@ -266,7 +285,7 @@ static std::error_code compiledToFile(String&& json, const String& finalFilePath
             m_metaData.conditionedFiltersBytecodeSize = m_conditionFiltersBytecodeWritten;
             m_metaData.conditionsApplyOnlyToDomain = m_conditionsApplyOnlyToDomain;
             
-            Data header = encodeContentExtensionMetaData(m_metaData);
+            Data header = encodeContentRuleListMetaData(m_metaData);
             if (!m_fileError && WebCore::seekFile(m_fileHandle, 0ll, WebCore::FileSeekOrigin::SeekFromBeginning) == -1) {
                 WebCore::closeFile(m_fileHandle);
                 m_fileError = true;
@@ -290,7 +309,7 @@ static std::error_code compiledToFile(String&& json, const String& finalFilePath
         }
         
         WebCore::PlatformFileHandle m_fileHandle;
-        ContentExtensionMetaData& m_metaData;
+        ContentRuleListMetaData& m_metaData;
         size_t m_filtersWithoutConditionsBytecodeWritten { 0 };
         size_t m_filtersWithConditionBytecodeWritten { 0 };
         size_t m_conditionFiltersBytecodeWritten { 0 };
@@ -301,16 +320,16 @@ static std::error_code compiledToFile(String&& json, const String& finalFilePath
     };
 
     auto temporaryFileHandle = WebCore::invalidPlatformFileHandle;
-    String temporaryFilePath = WebCore::openTemporaryFile("ContentExtension", temporaryFileHandle);
+    String temporaryFilePath = WebCore::openTemporaryFile("ContentRuleList", temporaryFileHandle);
     if (temporaryFileHandle == WebCore::invalidPlatformFileHandle)
-        return ContentExtensionStore::Error::CompileFailed;
+        return ContentRuleListStore::Error::CompileFailed;
     
-    char invalidHeader[ContentExtensionFileHeaderSize];
+    char invalidHeader[ContentRuleListFileHeaderSize];
     memset(invalidHeader, 0xFF, sizeof(invalidHeader));
     // This header will be rewritten in CompilationClient::finalize.
     if (WebCore::writeToFile(temporaryFileHandle, invalidHeader, sizeof(invalidHeader)) == -1) {
         WebCore::closeFile(temporaryFileHandle);
-        return ContentExtensionStore::Error::CompileFailed;
+        return ContentRuleListStore::Error::CompileFailed;
     }
 
     CompilationClient compilationClient(temporaryFileHandle, metaData);
@@ -321,24 +340,24 @@ static std::error_code compiledToFile(String&& json, const String& finalFilePath
     }
     if (compilationClient.hadErrorWhileWritingToFile()) {
         WebCore::closeFile(temporaryFileHandle);
-        return ContentExtensionStore::Error::CompileFailed;
+        return ContentRuleListStore::Error::CompileFailed;
     }
     
     mappedData = adoptAndMapFile(temporaryFileHandle, 0, metaData.fileSize());
     if (mappedData.isNull())
-        return ContentExtensionStore::Error::CompileFailed;
+        return ContentRuleListStore::Error::CompileFailed;
 
     if (!WebCore::moveFile(temporaryFilePath, finalFilePath))
-        return ContentExtensionStore::Error::CompileFailed;
+        return ContentRuleListStore::Error::CompileFailed;
 
     return { };
 }
 
-static Ref<API::ContentExtension> createExtension(const String& identifier, const ContentExtensionMetaData& metaData, const Data& fileData)
+static Ref<API::ContentRuleList> createExtension(const String& identifier, const ContentRuleListMetaData& metaData, const Data& fileData)
 {
     auto sharedMemory = WebKit::SharedMemory::create(const_cast<uint8_t*>(fileData.data()), fileData.size(), WebKit::SharedMemory::Protection::ReadOnly);
-    const size_t headerAndSourceSize = ContentExtensionFileHeaderSize + metaData.sourceSize;
-    auto compiledContentExtensionData = WebKit::WebCompiledContentExtensionData(
+    const size_t headerAndSourceSize = ContentRuleListFileHeaderSize + metaData.sourceSize;
+    auto compiledContentRuleListData = WebKit::WebCompiledContentRuleListData(
         WTFMove(sharedMemory),
         fileData,
         ConditionsApplyOnlyToDomainOffset,
@@ -357,25 +376,25 @@ static Ref<API::ContentExtension> createExtension(const String& identifier, cons
             + metaData.filtersWithConditionsBytecodeSize,
         metaData.conditionedFiltersBytecodeSize
     );
-    auto compiledContentExtension = WebKit::WebCompiledContentExtension::create(WTFMove(compiledContentExtensionData));
-    return API::ContentExtension::create(identifier, WTFMove(compiledContentExtension));
+    auto compiledContentRuleList = WebKit::WebCompiledContentRuleList::create(WTFMove(compiledContentRuleListData));
+    return API::ContentRuleList::create(identifier, WTFMove(compiledContentRuleList));
 }
 
-void ContentExtensionStore::lookupContentExtension(const WTF::String& identifier, Function<void(RefPtr<API::ContentExtension>, std::error_code)> completionHandler)
+void ContentRuleListStore::lookupContentRuleList(const WTF::String& identifier, Function<void(RefPtr<API::ContentRuleList>, std::error_code)> completionHandler)
 {
-    m_readQueue->dispatch([protectedThis = makeRef(*this), identifier = identifier.isolatedCopy(), storePath = m_storePath.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
-        auto path = constructedPath(storePath, identifier);
+    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);
         
-        ContentExtensionMetaData metaData;
+        ContentRuleListMetaData metaData;
         Data fileData;
-        if (!openAndMapContentExtension(path, metaData, fileData)) {
+        if (!openAndMapContentRuleList(path, metaData, fileData)) {
             RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler)] {
                 completionHandler(nullptr, Error::LookupFailed);
             });
             return;
         }
         
-        if (metaData.version != ContentExtensionStore::CurrentContentExtensionFileVersion) {
+        if (metaData.version != ContentRuleListStore::CurrentContentRuleListFileVersion) {
             RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler)] {
                 completionHandler(nullptr, Error::VersionMismatch);
             });
@@ -388,14 +407,14 @@ void ContentExtensionStore::lookupContentExtension(const WTF::String& identifier
     });
 }
 
-void ContentExtensionStore::getAvailableContentExtensionIdentifiers(Function<void(WTF::Vector<WTF::String>)> completionHandler)
+void ContentRuleListStore::getAvailableContentRuleListIdentifiers(Function<void(WTF::Vector<WTF::String>)> completionHandler)
 {
-    m_readQueue->dispatch([protectedThis = makeRef(*this), storePath = m_storePath.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
+    m_readQueue->dispatch([protectedThis = makeRef(*this), storePath = m_storePath.isolatedCopy(), legacyFilename = m_legacyFilename, completionHandler = WTFMove(completionHandler)]() mutable {
 
-        Vector<String> fullPaths = WebCore::listDirectory(storePath, constructedPathFilter());
+        Vector<String> fullPaths = WebCore::listDirectory(storePath, constructedPathFilter(legacyFilename));
         Vector<String> identifiers;
         identifiers.reserveInitialCapacity(fullPaths.size());
-        const auto prefixLength = constructedPathPrefix().length();
+        const auto prefixLength = constructedPathPrefix(legacyFilename).length();
         for (const auto& path : fullPaths)
             identifiers.uncheckedAppend(WebCore::decodeFromFilename(path.substring(path.reverseFind('/') + 1 + prefixLength)));
 
@@ -405,13 +424,13 @@ void ContentExtensionStore::getAvailableContentExtensionIdentifiers(Function<voi
     });
 }
 
-void ContentExtensionStore::compileContentExtension(const WTF::String& identifier, WTF::String&& json, Function<void(RefPtr<API::ContentExtension>, std::error_code)> completionHandler)
+void ContentRuleListStore::compileContentRuleList(const WTF::String& identifier, WTF::String&& json, Function<void(RefPtr<API::ContentRuleList>, std::error_code)> completionHandler)
 {
     AtomicString::init();
-    m_compileQueue->dispatch([protectedThis = makeRef(*this), identifier = identifier.isolatedCopy(), json = json.isolatedCopy(), storePath = m_storePath.isolatedCopy(), completionHandler = WTFMove(completionHandler)] () mutable {
-        auto path = constructedPath(storePath, identifier);
+    m_compileQueue->dispatch([protectedThis = makeRef(*this), identifier = identifier.isolatedCopy(), legacyFilename = m_legacyFilename, json = json.isolatedCopy(), storePath = m_storePath.isolatedCopy(), completionHandler = WTFMove(completionHandler)] () mutable {
+        auto path = constructedPath(storePath, identifier, legacyFilename);
 
-        ContentExtensionMetaData metaData;
+        ContentRuleListMetaData metaData;
         Data fileData;
         auto error = compiledToFile(WTFMove(json), path, metaData, fileData);
         if (error) {
@@ -422,16 +441,16 @@ void ContentExtensionStore::compileContentExtension(const WTF::String& identifie
         }
 
         RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), identifier = WTFMove(identifier), fileData = WTFMove(fileData), metaData = WTFMove(metaData), completionHandler = WTFMove(completionHandler)] {
-            RefPtr<API::ContentExtension> contentExtension = createExtension(identifier, metaData, fileData);
-            completionHandler(contentExtension, { });
+            RefPtr<API::ContentRuleList> contentRuleList = createExtension(identifier, metaData, fileData);
+            completionHandler(contentRuleList, { });
         });
     });
 }
 
-void ContentExtensionStore::removeContentExtension(const WTF::String& identifier, Function<void(std::error_code)> completionHandler)
+void ContentRuleListStore::removeContentRuleList(const WTF::String& identifier, Function<void(std::error_code)> completionHandler)
 {
-    m_removeQueue->dispatch([protectedThis = makeRef(*this), identifier = identifier.isolatedCopy(), storePath = m_storePath.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
-        auto path = constructedPath(storePath, identifier);
+    m_removeQueue->dispatch([protectedThis = makeRef(*this), identifier = identifier.isolatedCopy(), storePath = m_storePath.isolatedCopy(), legacyFilename = m_legacyFilename, completionHandler = WTFMove(completionHandler)]() mutable {
+        auto path = constructedPath(storePath, identifier, legacyFilename);
 
         if (!WebCore::deleteFile(path)) {
             RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler)] {
@@ -446,27 +465,27 @@ void ContentExtensionStore::removeContentExtension(const WTF::String& identifier
     });
 }
 
-void ContentExtensionStore::synchronousRemoveAllContentExtensions()
+void ContentRuleListStore::synchronousRemoveAllContentRuleLists()
 {
     for (const auto& path : WebCore::listDirectory(m_storePath, "*"))
         WebCore::deleteFile(path);
 }
 
-void ContentExtensionStore::invalidateContentExtensionVersion(const WTF::String& identifier)
+void ContentRuleListStore::invalidateContentRuleListVersion(const WTF::String& identifier)
 {
-    auto file = WebCore::openFile(constructedPath(m_storePath, identifier), WebCore::OpenForWrite);
+    auto file = WebCore::openFile(constructedPath(m_storePath, identifier, m_legacyFilename), WebCore::OpenForWrite);
     if (file == WebCore::invalidPlatformFileHandle)
         return;
-    ContentExtensionMetaData invalidHeader = {0, 0, 0, 0, 0, 0};
+    ContentRuleListMetaData invalidHeader = {0, 0, 0, 0, 0, 0};
     auto bytesWritten = WebCore::writeToFile(file, reinterpret_cast<const char*>(&invalidHeader), sizeof(invalidHeader));
     ASSERT_UNUSED(bytesWritten, bytesWritten == sizeof(invalidHeader));
     WebCore::closeFile(file);
 }
 
-void ContentExtensionStore::getContentExtensionSource(const WTF::String& identifier, Function<void(WTF::String)> completionHandler)
+void ContentRuleListStore::getContentRuleListSource(const WTF::String& identifier, Function<void(WTF::String)> completionHandler)
 {
-    m_readQueue->dispatch([protectedThis = makeRef(*this), identifier = identifier.isolatedCopy(), storePath = m_storePath.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
-        auto path = constructedPath(storePath, identifier);
+    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 complete = [protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler)](String source) mutable {
             RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler), source = source.isolatedCopy()] {
@@ -474,9 +493,9 @@ void ContentExtensionStore::getContentExtensionSource(const WTF::String& identif
             });
         };
         
-        ContentExtensionMetaData metaData;
+        ContentRuleListMetaData metaData;
         Data fileData;
-        if (!openAndMapContentExtension(path, metaData, fileData)) {
+        if (!openAndMapContentRuleList(path, metaData, fileData)) {
             complete({ });
             return;
         }
@@ -487,8 +506,8 @@ void ContentExtensionStore::getContentExtensionSource(const WTF::String& identif
                 complete({ });
                 return;
             }
-            bool is8Bit = fileData.data()[ContentExtensionFileHeaderSize];
-            size_t start = ContentExtensionFileHeaderSize + sizeof(bool);
+            bool is8Bit = fileData.data()[ContentRuleListFileHeaderSize];
+            size_t start = ContentRuleListFileHeaderSize + sizeof(bool);
             size_t length = metaData.sourceSize - sizeof(bool);
             if (is8Bit)
                 complete(String(fileData.data() + start, length));
@@ -504,9 +523,9 @@ void ContentExtensionStore::getContentExtensionSource(const WTF::String& identif
     });
 }
 
-const std::error_category& contentExtensionStoreErrorCategory()
+const std::error_category& contentRuleListStoreErrorCategory()
 {
-    class ContentExtensionStoreErrorCategory : public std::error_category {
+    class ContentRuleListStoreErrorCategory : public std::error_category {
         const char* name() const noexcept final
         {
             return "content extension store";
@@ -514,14 +533,14 @@ const std::error_category& contentExtensionStoreErrorCategory()
 
         std::string message(int errorCode) const final
         {
-            switch (static_cast<ContentExtensionStore::Error>(errorCode)) {
-            case ContentExtensionStore::Error::LookupFailed:
+            switch (static_cast<ContentRuleListStore::Error>(errorCode)) {
+            case ContentRuleListStore::Error::LookupFailed:
                 return "Unspecified error during lookup.";
-            case ContentExtensionStore::Error::VersionMismatch:
+            case ContentRuleListStore::Error::VersionMismatch:
                 return "Version of file does not match version of interpreter.";
-            case ContentExtensionStore::Error::CompileFailed:
+            case ContentRuleListStore::Error::CompileFailed:
                 return "Unspecified error during compile.";
-            case ContentExtensionStore::Error::RemoveFailed:
+            case ContentRuleListStore::Error::RemoveFailed:
                 return "Unspecified error during remove.";
             }
 
@@ -529,8 +548,8 @@ const std::error_category& contentExtensionStoreErrorCategory()
         }
     };
 
-    static NeverDestroyed<ContentExtensionStoreErrorCategory> contentExtensionErrorCategory;
-    return contentExtensionErrorCategory;
+    static NeverDestroyed<ContentRuleListStoreErrorCategory> contentRuleListErrorCategory;
+    return contentRuleListErrorCategory;
 }
 
 } // namespace API
@@ -37,9 +37,9 @@ class WorkQueue;
 
 namespace API {
 
-class ContentExtension;
+class ContentRuleList;
 
-class ContentExtensionStore final : public ObjectImpl<Object::Type::ContentExtensionStore> {
+class ContentRuleListStore final : public ObjectImpl<Object::Type::ContentRuleListStore> {
 public:
     enum class Error {
         LookupFailed = 1,
@@ -50,47 +50,50 @@ public:
     
     // This should be incremented every time a functional change is made to the bytecode, file format, etc.
     // to prevent crashing while loading old data.
-    // Also update ContentExtensionStore::getContentExtensionSource to be able to find the original JSON
+    // Also update ContentRuleListStore::getContentRuleListSource to be able to find the original JSON
     // source from old versions.
-    const static uint32_t CurrentContentExtensionFileVersion = 9;
+    const static uint32_t CurrentContentRuleListFileVersion = 9;
 
-    static ContentExtensionStore& defaultStore();
-    static Ref<ContentExtensionStore> storeWithPath(const WTF::String& storePath);
+    static ContentRuleListStore& defaultStore(bool legacyFilename);
+    static Ref<ContentRuleListStore> storeWithPath(const WTF::String& storePath, bool legacyFilename);
 
-    explicit ContentExtensionStore();
-    explicit ContentExtensionStore(const WTF::String& storePath);
-    virtual ~ContentExtensionStore();
+    explicit ContentRuleListStore(bool legacyFilename);
+    explicit ContentRuleListStore(const WTF::String& storePath, bool legacyFilename);
+    virtual ~ContentRuleListStore();
 
-    void compileContentExtension(const WTF::String& identifier, WTF::String&& json, Function<void(RefPtr<API::ContentExtension>, std::error_code)>);
-    void lookupContentExtension(const WTF::String& identifier, Function<void(RefPtr<API::ContentExtension>, std::error_code)>);
-    void removeContentExtension(const WTF::String& identifier, Function<void(std::error_code)>);
-    void getAvailableContentExtensionIdentifiers(Function<void(WTF::Vector<WTF::String>)>);
+    void compileContentRuleList(const WTF::String& identifier, WTF::String&& json, Function<void(RefPtr<API::ContentRuleList>, std::error_code)>);
+    void lookupContentRuleList(const WTF::String& identifier, Function<void(RefPtr<API::ContentRuleList>, std::error_code)>);
+    void removeContentRuleList(const WTF::String& identifier, Function<void(std::error_code)>);
+    void getAvailableContentRuleListIdentifiers(Function<void(WTF::Vector<WTF::String>)>);
 
     // For testing only.
-    void synchronousRemoveAllContentExtensions();
-    void invalidateContentExtensionVersion(const WTF::String& identifier);
-    void getContentExtensionSource(const WTF::String& identifier, Function<void(WTF::String)>);
+    void synchronousRemoveAllContentRuleLists();
+    void invalidateContentRuleListVersion(const WTF::String& identifier);
+    void getContentRuleListSource(const WTF::String& identifier, Function<void(WTF::String)>);
 
 private:
-    WTF::String defaultStorePath();
-
+    WTF::String defaultStorePath(bool legacyFilename);
+    static ContentRuleListStore& legacyDefaultStore();
+    static ContentRuleListStore& nonLegacyDdefaultStore();
+    
     const WTF::String m_storePath;
     Ref<WTF::WorkQueue> m_compileQueue;
     Ref<WTF::WorkQueue> m_readQueue;
     Ref<WTF::WorkQueue> m_removeQueue;
+    bool m_legacyFilename { false };
 };
 
-const std::error_category& contentExtensionStoreErrorCategory();
+const std::error_category& contentRuleListStoreErrorCategory();
 
-inline std::error_code make_error_code(ContentExtensionStore::Error error)
+inline std::error_code make_error_code(ContentRuleListStore::Error error)
 {
-    return { static_cast<int>(error), contentExtensionStoreErrorCategory() };
+    return { static_cast<int>(error), contentRuleListStoreErrorCategory() };
 }
 
 } // namespace API
 
 namespace std {
-template<> struct is_error_code_enum<API::ContentExtensionStore::Error> : public true_type { };
+template<> struct is_error_code_enum<API::ContentRuleListStore::Error> : public true_type { };
 }
 
 #endif // ENABLE(CONTENT_EXTENSIONS)
index d34934f..22d16ab 100644 (file)
@@ -53,8 +53,8 @@
 #include <WebCore/Settings.h>
 
 namespace API {
-class ContentExtension;
-class ContentExtensionStore;
+class ContentRuleList;
+class ContentRuleListStore;
 class ExperimentalFeature;
 class FrameHandle;
 class FrameInfo;
@@ -162,8 +162,8 @@ WK_ADD_API_MAPPING(WKResourceLoadStatisticsManagerRef, WebResourceLoadStatistics
 WK_ADD_API_MAPPING(WKSessionStateRef, API::SessionState)
 WK_ADD_API_MAPPING(WKTextCheckerRef, WebTextChecker)
 WK_ADD_API_MAPPING(WKUserContentControllerRef, WebUserContentControllerProxy)
-WK_ADD_API_MAPPING(WKUserContentExtensionStoreRef, API::ContentExtensionStore)
-WK_ADD_API_MAPPING(WKUserContentFilterRef, API::ContentExtension)
+WK_ADD_API_MAPPING(WKUserContentExtensionStoreRef, API::ContentRuleListStore)
+WK_ADD_API_MAPPING(WKUserContentFilterRef, API::ContentRuleList)
 WK_ADD_API_MAPPING(WKUserMediaPermissionCheckRef, UserMediaPermissionCheckProxy)
 WK_ADD_API_MAPPING(WKUserMediaPermissionRequestRef, UserMediaPermissionRequestProxy)
 WK_ADD_API_MAPPING(WKUserScriptRef, API::UserScript)
index 743154e..dfacc0c 100644 (file)
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "WKPageGroup.h"
 
-#include "APIContentExtension.h"
+#include "APIContentRuleList.h"
 #include "APIUserContentWorld.h"
 #include "APIUserScript.h"
 #include "APIUserStyleSheet.h"
index 292155e..0736b71 100644 (file)
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "WKUserContentControllerRef.h"
 
-#include "APIContentExtension.h"
+#include "APIContentRuleList.h"
 #include "APIUserScript.h"
 #include "WKAPICast.h"
 #include "WebUserContentControllerProxy.h"
@@ -62,13 +62,13 @@ void WKUserContentControllerRemoveAllUserScripts(WKUserContentControllerRef user
 void WKUserContentControllerAddUserContentFilter(WKUserContentControllerRef userContentControllerRef, WKUserContentFilterRef userContentFilterRef)
 {
 #if ENABLE(CONTENT_EXTENSIONS)
-    toImpl(userContentControllerRef)->addContentExtension(*toImpl(userContentFilterRef));
+    toImpl(userContentControllerRef)->addContentRuleList(*toImpl(userContentFilterRef));
 #endif
 }
 
 void WKUserContentControllerRemoveAllUserContentFilters(WKUserContentControllerRef userContentControllerRef)
 {
 #if ENABLE(CONTENT_EXTENSIONS)
-    toImpl(userContentControllerRef)->removeAllContentExtensions();
+    toImpl(userContentControllerRef)->removeAllContentRuleLists();
 #endif
 }
index 4d4f8eb..265c8df 100644 (file)
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "WKUserContentExtensionStoreRef.h"
 
-#include "APIContentExtensionStore.h"
+#include "APIContentRuleListStore.h"
 #include "WKAPICast.h"
 
 using namespace WebKit;
@@ -34,7 +34,7 @@ using namespace WebKit;
 WKTypeID WKUserContentExtensionStoreGetTypeID()
 {
 #if ENABLE(CONTENT_EXTENSIONS)
-    return toAPI(API::ContentExtensionStore::APIType);
+    return toAPI(API::ContentRuleListStore::APIType);
 #else
     return 0;
 #endif
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "APIContentExtensionStore.h"
+#include "APIContentRuleListStore.h"
 
 #if ENABLE(CONTENT_EXTENSIONS)
 
 
 namespace API {
 
-String ContentExtensionStore::defaultStorePath()
+String ContentRuleListStore::defaultStorePath(bool legacyFilename)
 {
     static dispatch_once_t onceToken;
-    static NSURL *contentExtensionStoreURL;
+    static NSURL *contentRuleListStoreURL;
 
     dispatch_once(&onceToken, ^{
         NSURL *url = [[NSFileManager defaultManager] URLForDirectory:NSLibraryDirectory inDomain:NSUserDomainMask appropriateForURL:nullptr create:NO error:nullptr];
@@ -50,14 +50,17 @@ String ContentExtensionStore::defaultStorePath()
                 bundleIdentifier = [NSProcessInfo processInfo].processName;
             url = [url URLByAppendingPathComponent:bundleIdentifier isDirectory:YES];
         }
-
-        contentExtensionStoreURL = [[url URLByAppendingPathComponent:@"ContentExtensions" isDirectory:YES] retain];
+        
+        if (legacyFilename)
+            contentRuleListStoreURL = [[url URLByAppendingPathComponent:@"ContentExtensions" isDirectory:YES] retain];
+        else
+            contentRuleListStoreURL = [[url URLByAppendingPathComponent:@"ContentRuleLists" isDirectory:YES] retain];
     });
 
-    if (![[NSFileManager defaultManager] createDirectoryAtURL:contentExtensionStoreURL withIntermediateDirectories:YES attributes:nil error:nullptr])
-        LOG_ERROR("Failed to create directory %@", contentExtensionStoreURL);
+    if (![[NSFileManager defaultManager] createDirectoryAtURL:contentRuleListStoreURL withIntermediateDirectories:YES attributes:nil error:nullptr])
+        LOG_ERROR("Failed to create directory %@", contentRuleListStoreURL);
 
-    return contentExtensionStoreURL.absoluteURL.path.fileSystemRepresentation;
+    return contentRuleListStoreURL.absoluteURL.path.fileSystemRepresentation;
 }
 
 } // namespace API
diff --git a/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStore.mm b/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStore.mm
deleted file mode 100644 (file)
index e3e5502..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#import "config.h"
-#import "WKContentExtensionInternal.h"
-#import "WKContentExtensionStoreInternal.h"
-
-#if WK_API_ENABLED
-
-#import "APIContentExtensionStore.h"
-#import "WKErrorInternal.h"
-#import <wtf/BlockPtr.h>
-
-static WKErrorCode toWKErrorCode(const std::error_code& error)
-{
-    ASSERT(error.category() == API::contentExtensionStoreErrorCategory());
-    switch (static_cast<API::ContentExtensionStore::Error>(error.value())) {
-    case API::ContentExtensionStore::Error::LookupFailed:
-        return WKErrorContentExtensionStoreLookUpFailed;
-    case API::ContentExtensionStore::Error::VersionMismatch:
-        return WKErrorContentExtensionStoreVersionMismatch;
-    case API::ContentExtensionStore::Error::CompileFailed:
-        return WKErrorContentExtensionStoreCompileFailed;
-    case API::ContentExtensionStore::Error::RemoveFailed:
-        return WKErrorContentExtensionStoreRemoveFailed;
-    }
-    ASSERT_NOT_REACHED();
-    return WKErrorUnknown;
-}
-
-@implementation WKContentExtensionStore
-
-- (void)dealloc
-{
-    _contentExtensionStore->~ContentExtensionStore();
-
-    [super dealloc];
-}
-
-+ (instancetype)defaultStore
-{
-    return WebKit::wrapper(API::ContentExtensionStore::defaultStore());
-}
-
-+ (instancetype)storeWithURL:(NSURL *)url
-{
-    Ref<API::ContentExtensionStore> store = API::ContentExtensionStore::storeWithPath(url.absoluteURL.fileSystemRepresentation);
-    return WebKit::wrapper(store.leakRef());
-}
-
-- (void)compileContentExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *)encodedContentExtension completionHandler:(void (^)(WKContentExtension *, NSError *))completionHandler
-{
-    [self _compileContentExtensionForIdentifier:identifier encodedContentExtension:encodedContentExtension completionHandler:completionHandler releasesArgument:NO];
-}
-
-- (void)_compileContentExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *)encodedContentExtension completionHandler:(void (^)(WKContentExtension *, NSError *))completionHandler releasesArgument:(BOOL)releasesArgument
-{
-    String json(encodedContentExtension);
-    if (releasesArgument) {
-        [encodedContentExtension release];
-        encodedContentExtension = nil;
-    }
-
-    _contentExtensionStore->compileContentExtension(identifier, WTFMove(json), [completionHandler = makeBlockPtr(completionHandler)](RefPtr<API::ContentExtension> contentExtension, std::error_code error) {
-        if (error) {
-            auto userInfo = @{NSHelpAnchorErrorKey: [NSString stringWithFormat:@"Extension compilation failed: %s", error.message().c_str()]};
-
-            // error.value() could have a specific compiler error that is not equal to WKErrorContentExtensionStoreCompileFailed.
-            // We want to use error.message, but here we want to only pass on CompileFailed with userInfo from the std::error_code.
-            return completionHandler(nil, [NSError errorWithDomain:WKErrorDomain code:WKErrorContentExtensionStoreCompileFailed userInfo:userInfo]);
-        }
-        completionHandler(WebKit::wrapper(*contentExtension.get()), nil);
-    });
-}
-
-- (void)lookUpContentExtensionForIdentifier:(NSString *)identifier completionHandler:(void (^)(WKContentExtension *, NSError *))completionHandler
-{
-    _contentExtensionStore->lookupContentExtension(identifier, [completionHandler = makeBlockPtr(completionHandler)](RefPtr<API::ContentExtension> contentExtension, std::error_code error) {
-        if (error) {
-            auto userInfo = @{NSHelpAnchorErrorKey: [NSString stringWithFormat:@"Extension lookup failed: %s", error.message().c_str()]};
-            auto wkError = toWKErrorCode(error);
-            ASSERT(wkError == WKErrorContentExtensionStoreLookUpFailed || wkError == WKErrorContentExtensionStoreVersionMismatch);
-            return completionHandler(nil, [NSError errorWithDomain:WKErrorDomain code:wkError userInfo:userInfo]);
-        }
-
-        completionHandler(WebKit::wrapper(*contentExtension.get()), nil);
-    });
-}
-
-- (void)getAvailableContentExtensionIdentifiers:(void (^)(NSArray<NSString *>*))completionHandler
-{
-    _contentExtensionStore->getAvailableContentExtensionIdentifiers([completionHandler = makeBlockPtr(completionHandler)](Vector<String> identifiers) {
-        NSMutableArray<NSString *> *nsIdentifiers = [NSMutableArray arrayWithCapacity:identifiers.size()];
-        for (const auto& identifier : identifiers)
-            [nsIdentifiers addObject:identifier];
-        completionHandler(nsIdentifiers);
-    });
-}
-
-- (void)removeContentExtensionForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSError *))completionHandler
-{
-    _contentExtensionStore->removeContentExtension(identifier, [completionHandler = makeBlockPtr(completionHandler)](std::error_code error) {
-        if (error) {
-            auto userInfo = @{NSHelpAnchorErrorKey: [NSString stringWithFormat:@"Extension removal failed: %s", error.message().c_str()]};
-            ASSERT(toWKErrorCode(error) == WKErrorContentExtensionStoreRemoveFailed);
-            return completionHandler([NSError errorWithDomain:WKErrorDomain code:WKErrorContentExtensionStoreRemoveFailed userInfo:userInfo]);
-        }
-
-        completionHandler(nil);
-    });
-}
-
-#pragma mark WKObject protocol implementation
-
-- (API::Object&)_apiObject
-{
-    return *_contentExtensionStore;
-}
-
-@end
-
-@implementation WKContentExtensionStore (WKPrivate)
-
-// For testing only.
-
-- (void)_removeAllContentExtensions
-{
-    _contentExtensionStore->synchronousRemoveAllContentExtensions();
-}
-
-- (void)_invalidateContentExtensionVersionForIdentifier:(NSString *)identifier
-{
-    _contentExtensionStore->invalidateContentExtensionVersion(identifier);
-}
-
-- (void)_getContentExtensionSourceForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSString*))completionHandler
-{
-    auto handler = adoptNS([completionHandler copy]);
-    _contentExtensionStore->getContentExtensionSource(identifier, [handler](String source) {
-        auto rawHandler = (void (^)(NSString *))handler.get();
-        if (source.isNull())
-            rawHandler(nil);
-        else
-            rawHandler(source);
-    });
-}
-
-// NS_RELEASES_ARGUMENT to keep peak memory usage low.
-
-- (void)_compileContentExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *)encodedContentExtension completionHandler:(void (^)(WKContentExtension *, NSError *))completionHandler
-{
-    [self _compileContentExtensionForIdentifier:identifier encodedContentExtension:encodedContentExtension completionHandler:completionHandler releasesArgument:YES];
-}
-
-@end
-
-#endif // WK_API_ENABLED
@@ -28,7 +28,7 @@
 #if WK_API_ENABLED
 
 WK_CLASS_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA))
-@interface WKContentExtension : NSObject
+@interface WKContentRuleList : NSObject
 
 /*! @abstract A copy of the identifier of the content extension. */
 @property (nonatomic, readonly, copy) NSString *identifier;
  */
 
 #import "config.h"
-#import "WKContentExtensionInternal.h"
+#import "WKContentRuleListInternal.h"
 
 #if WK_API_ENABLED
 
-#include "WebCompiledContentExtension.h"
+#include "WebCompiledContentRuleList.h"
 
-@implementation WKContentExtension
+@implementation WKContentRuleList
 
 - (void)dealloc
 {
-    _contentExtension->~ContentExtension();
+    _contentRuleList->~ContentRuleList();
 
     [super dealloc];
 }
 
 - (API::Object&)_apiObject
 {
-    return *_contentExtension;
+    return *_contentRuleList;
 }
 
 - (NSString *)identifier
 {
-    return _contentExtension->name();
+    return _contentRuleList->name();
 }
 
 @end
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#import "WKContentExtension.h"
+#import "WKContentRuleList.h"
 
 #if WK_API_ENABLED
 
-#import "APIContentExtension.h"
+#import "APIContentRuleList.h"
 #import "WKObject.h"
 
 namespace WebKit {
 
-inline WKContentExtension *wrapper(API::ContentExtension& contentExtension)
+inline WKContentRuleList *wrapper(API::ContentRuleList& contentRuleList)
 {
-    ASSERT([contentExtension.wrapper() isKindOfClass:[WKContentExtension class]]);
-    return (WKContentExtension *)contentExtension.wrapper();
+    ASSERT([contentRuleList.wrapper() isKindOfClass:[WKContentRuleList class]]);
+    return (WKContentRuleList *)contentRuleList.wrapper();
 }
 
 }
 
-@interface WKContentExtension () <WKObject> {
+@interface WKContentRuleList () <WKObject> {
 @package
-    API::ObjectStorage<API::ContentExtension> _contentExtension;
+    API::ObjectStorage<API::ContentRuleList> _contentRuleList;
 }
 @end
 
 
 #if WK_API_ENABLED
 
-@class WKContentExtension;
+@class WKContentRuleList;
 
 WK_CLASS_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA))
-@interface WKContentExtensionStore : NSObject
+@interface WKContentRuleListStore : NSObject
 
 + (instancetype)defaultStore;
 + (instancetype)storeWithURL:(NSURL *)url;
 
-- (void)compileContentExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *) encodedContentExtension completionHandler:(void (^)(WKContentExtension *, NSError *))completionHandler;
-- (void)lookUpContentExtensionForIdentifier:(NSString *)identifier completionHandler:(void (^)(WKContentExtension *, NSError *))completionHandler;
-- (void)removeContentExtensionForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSError *))completionHandler;
-- (void)getAvailableContentExtensionIdentifiers:(void (^)(NSArray<NSString *>*))completionHandler;
+- (void)compileContentRuleListForIdentifier:(NSString *)identifier encodedContentRuleList:(NSString *) encodedContentRuleList completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler;
+- (void)lookUpContentRuleListForIdentifier:(NSString *)identifier completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler;
+- (void)removeContentRuleListForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSError *))completionHandler;
+- (void)getAvailableContentRuleListIdentifiers:(void (^)(NSArray<NSString *>*))completionHandler;
 
 @end
 
diff --git a/Source/WebKit2/UIProcess/API/Cocoa/WKContentRuleListStore.mm b/Source/WebKit2/UIProcess/API/Cocoa/WKContentRuleListStore.mm
new file mode 100644 (file)
index 0000000..bcbb4ec
--- /dev/null
@@ -0,0 +1,194 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#import "config.h"
+#import "WKContentRuleListInternal.h"
+#import "WKContentRuleListStoreInternal.h"
+
+#if WK_API_ENABLED
+
+#import "APIContentRuleListStore.h"
+#import "WKErrorInternal.h"
+#import <wtf/BlockPtr.h>
+
+static WKErrorCode toWKErrorCode(const std::error_code& error)
+{
+    ASSERT(error.category() == API::contentRuleListStoreErrorCategory());
+    switch (static_cast<API::ContentRuleListStore::Error>(error.value())) {
+    case API::ContentRuleListStore::Error::LookupFailed:
+        return WKErrorContentRuleListStoreLookUpFailed;
+    case API::ContentRuleListStore::Error::VersionMismatch:
+        return WKErrorContentRuleListStoreVersionMismatch;
+    case API::ContentRuleListStore::Error::CompileFailed:
+        return WKErrorContentRuleListStoreCompileFailed;
+    case API::ContentRuleListStore::Error::RemoveFailed:
+        return WKErrorContentRuleListStoreRemoveFailed;
+    }
+    ASSERT_NOT_REACHED();
+    return WKErrorUnknown;
+}
+
+@implementation WKContentRuleListStore
+
+- (void)dealloc
+{
+    _contentRuleListStore->~ContentRuleListStore();
+
+    [super dealloc];
+}
+
++ (instancetype)defaultStore
+{
+    const bool legacyFilename = false;
+    return WebKit::wrapper(API::ContentRuleListStore::defaultStore(legacyFilename));
+}
+
++ (instancetype)storeWithURL:(NSURL *)url
+{
+    const bool legacyFilename = false;
+    Ref<API::ContentRuleListStore> store = API::ContentRuleListStore::storeWithPath(url.absoluteURL.fileSystemRepresentation, legacyFilename);
+    return WebKit::wrapper(store.leakRef());
+}
+
+- (void)compileContentRuleListForIdentifier:(NSString *)identifier encodedContentRuleList:(NSString *)encodedContentRuleList completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler
+{
+    [self _compileContentRuleListForIdentifier:identifier encodedContentRuleList:encodedContentRuleList completionHandler:completionHandler releasesArgument:NO];
+}
+
+- (void)_compileContentRuleListForIdentifier:(NSString *)identifier encodedContentRuleList:(NSString *)encodedContentRuleList completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler releasesArgument:(BOOL)releasesArgument
+{
+    String json(encodedContentRuleList);
+    if (releasesArgument) {
+        [encodedContentRuleList release];
+        encodedContentRuleList = nil;
+    }
+
+    _contentRuleListStore->compileContentRuleList(identifier, WTFMove(json), [completionHandler = makeBlockPtr(completionHandler)](RefPtr<API::ContentRuleList> contentRuleList, std::error_code error) {
+        if (error) {
+            auto userInfo = @{NSHelpAnchorErrorKey: [NSString stringWithFormat:@"Rule list compilation failed: %s", error.message().c_str()]};
+
+            // error.value() could have a specific compiler error that is not equal to WKErrorContentRuleListStoreCompileFailed.
+            // We want to use error.message, but here we want to only pass on CompileFailed with userInfo from the std::error_code.
+            return completionHandler(nil, [NSError errorWithDomain:WKErrorDomain code:WKErrorContentRuleListStoreCompileFailed userInfo:userInfo]);
+        }
+        completionHandler(WebKit::wrapper(*contentRuleList.get()), nil);
+    });
+}
+
+- (void)lookUpContentRuleListForIdentifier:(NSString *)identifier completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler
+{
+    _contentRuleListStore->lookupContentRuleList(identifier, [completionHandler = makeBlockPtr(completionHandler)](RefPtr<API::ContentRuleList> contentRuleList, std::error_code error) {
+        if (error) {
+            auto userInfo = @{NSHelpAnchorErrorKey: [NSString stringWithFormat:@"Rule list lookup failed: %s", error.message().c_str()]};
+            auto wkError = toWKErrorCode(error);
+            ASSERT(wkError == WKErrorContentRuleListStoreLookUpFailed || wkError == WKErrorContentRuleListStoreVersionMismatch);
+            return completionHandler(nil, [NSError errorWithDomain:WKErrorDomain code:wkError userInfo:userInfo]);
+        }
+
+        completionHandler(WebKit::wrapper(*contentRuleList.get()), nil);
+    });
+}
+
+- (void)getAvailableContentRuleListIdentifiers:(void (^)(NSArray<NSString *>*))completionHandler
+{
+    _contentRuleListStore->getAvailableContentRuleListIdentifiers([completionHandler = makeBlockPtr(completionHandler)](Vector<String> identifiers) {
+        NSMutableArray<NSString *> *nsIdentifiers = [NSMutableArray arrayWithCapacity:identifiers.size()];
+        for (const auto& identifier : identifiers)
+            [nsIdentifiers addObject:identifier];
+        completionHandler(nsIdentifiers);
+    });
+}
+
+- (void)removeContentRuleListForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSError *))completionHandler
+{
+    _contentRuleListStore->removeContentRuleList(identifier, [completionHandler = makeBlockPtr(completionHandler)](std::error_code error) {
+        if (error) {
+            auto userInfo = @{NSHelpAnchorErrorKey: [NSString stringWithFormat:@"Rule list removal failed: %s", error.message().c_str()]};
+            ASSERT(toWKErrorCode(error) == WKErrorContentRuleListStoreRemoveFailed);
+            return completionHandler([NSError errorWithDomain:WKErrorDomain code:WKErrorContentRuleListStoreRemoveFailed userInfo:userInfo]);
+        }
+
+        completionHandler(nil);
+    });
+}
+
+#pragma mark WKObject protocol implementation
+
+- (API::Object&)_apiObject
+{
+    return *_contentRuleListStore;
+}
+
+@end
+
+@implementation WKContentRuleListStore (WKPrivate)
+
+// For testing only.
+
+- (void)_removeAllContentRuleLists
+{
+    _contentRuleListStore->synchronousRemoveAllContentRuleLists();
+}
+
+- (void)_invalidateContentRuleListVersionForIdentifier:(NSString *)identifier
+{
+    _contentRuleListStore->invalidateContentRuleListVersion(identifier);
+}
+
+- (void)_getContentRuleListSourceForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSString*))completionHandler
+{
+    auto handler = adoptNS([completionHandler copy]);
+    _contentRuleListStore->getContentRuleListSource(identifier, [handler](String source) {
+        auto rawHandler = (void (^)(NSString *))handler.get();
+        if (source.isNull())
+            rawHandler(nil);
+        else
+            rawHandler(source);
+    });
+}
+
+// NS_RELEASES_ARGUMENT to keep peak memory usage low.
+
+- (void)_compileContentRuleListForIdentifier:(NSString *)identifier encodedContentRuleList:(NSString *)encodedContentRuleList completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler
+{
+    [self _compileContentRuleListForIdentifier:identifier encodedContentRuleList:encodedContentRuleList completionHandler:completionHandler releasesArgument:YES];
+}
+
++ (instancetype)defaultStoreWithLegacyFilename
+{
+    const bool legacyFilename = true;
+    return WebKit::wrapper(API::ContentRuleListStore::defaultStore(legacyFilename));
+}
+
++ (instancetype)storeWithURLAndLegacyFilename:(NSURL *)url
+{
+    const bool legacyFilename = true;
+    Ref<API::ContentRuleListStore> store = API::ContentRuleListStore::storeWithPath(url.absoluteURL.fileSystemRepresentation, legacyFilename);
+    return WebKit::wrapper(store.leakRef());
+}
+
+@end
+
+#endif // WK_API_ENABLED
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#import "WKContentExtensionStorePrivate.h"
+#import "WKContentRuleListStorePrivate.h"
 
 #if WK_API_ENABLED
 
-#import "APIContentExtensionStore.h"
+#import "APIContentRuleListStore.h"
 #import "WKObject.h"
 
 namespace WebKit {
 
-inline WKContentExtensionStore *wrapper(API::ContentExtensionStore& store)
+inline WKContentRuleListStore *wrapper(API::ContentRuleListStore& store)
 {
-    ASSERT([store.wrapper() isKindOfClass:[WKContentExtensionStore class]]);
-    return (WKContentExtensionStore *)store.wrapper();
+    ASSERT([store.wrapper() isKindOfClass:[WKContentRuleListStore class]]);
+    return (WKContentRuleListStore *)store.wrapper();
 }
 
 }
 
-@interface WKContentExtensionStore () <WKObject> {
+@interface WKContentRuleListStore () <WKObject> {
 @package
-    API::ObjectStorage<API::ContentExtensionStore> _contentExtensionStore;
+    API::ObjectStorage<API::ContentRuleListStore> _contentRuleListStore;
 }
 @end
 
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#import <WebKit/WKContentExtensionStore.h>
+#import <WebKit/WKContentRuleListStore.h>
 
 #if WK_API_ENABLED
 
-@interface WKContentExtensionStore (WKPrivate)
+@interface WKContentRuleListStore (WKPrivate)
 
 // For testing only.
-- (void)_removeAllContentExtensions;
-- (void)_invalidateContentExtensionVersionForIdentifier:(NSString *)identifier;
-- (void)_getContentExtensionSourceForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSString*))completionHandler;
+- (void)_removeAllContentRuleLists;
+- (void)_invalidateContentRuleListVersionForIdentifier:(NSString *)identifier;
+- (void)_getContentRuleListSourceForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSString*))completionHandler;
 
 // NS_RELEASES_ARGUMENT to keep peak memory usage low.
-- (void)_compileContentExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *) NS_RELEASES_ARGUMENT encodedContentExtension completionHandler:(void (^)(WKContentExtension *, NSError *))completionHandler;
+- (void)_compileContentRuleListForIdentifier:(NSString *)identifier encodedContentRuleList:(NSString *) NS_RELEASES_ARGUMENT encodedContentRuleList completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler;
+
+// To maintain compatibility with _WKUserContentExtensionStore
+// FIXME: Add something to existing clients of _WKUserContentExtensionStore to migrate files from legacy filenames,
+// adopt WKContentRuleListStore, and remove _WKUserContentExtensionStore.
++ (instancetype)defaultStoreWithLegacyFilename;
++ (instancetype)storeWithURLAndLegacyFilename:(NSURL *)url;
 
 @end
 
index e3b908a..f54311b 100644 (file)
@@ -41,10 +41,10 @@ WK_EXTERN NSString * const WKErrorDomain WK_API_AVAILABLE(macosx(10.10), ios(8.0
  @constant WKErrorWebViewInvalidated                   Indicates that the WKWebView was invalidated.
  @constant WKErrorJavaScriptExceptionOccurred          Indicates that a JavaScript exception occurred.
  @constant WKErrorJavaScriptResultTypeIsUnsupported    Indicates that the result of JavaScript execution could not be returned.
- @constant WKErrorContentExtensionStoreCompileFailed   Indicates that compiling a WKUserContentExtension failed.
- @constant WKErrorContentExtensionStoreLookUpFailed    Indicates that looking up a WKUserContentExtension failed.
- @constant WKErrorContentExtensionStoreRemoveFailed    Indicates that removing a WKUserContentExtension failed.
- @constant WKErrorContentExtensionStoreVersionMismatch Indicates that the WKUserContentExtension version did not match the latest.
+ @constant WKErrorContentRuleListStoreCompileFailed    Indicates that compiling a WKUserContentRuleList failed.
+ @constant WKErrorContentRuleListStoreLookUpFailed     Indicates that looking up a WKUserContentRuleList failed.
+ @constant WKErrorContentRuleListStoreRemoveFailed     Indicates that removing a WKUserContentRuleList failed.
+ @constant WKErrorContentRuleListStoreVersionMismatch  Indicates that the WKUserContentRuleList version did not match the latest.
  */
 typedef NS_ENUM(NSInteger, WKErrorCode) {
     WKErrorUnknown = 1,
@@ -52,10 +52,10 @@ typedef NS_ENUM(NSInteger, WKErrorCode) {
     WKErrorWebViewInvalidated,
     WKErrorJavaScriptExceptionOccurred,
     WKErrorJavaScriptResultTypeIsUnsupported WK_API_AVAILABLE(macosx(10.11), ios(9.0)),
-    WKErrorContentExtensionStoreCompileFailed WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)),
-    WKErrorContentExtensionStoreLookUpFailed WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)),
-    WKErrorContentExtensionStoreRemoveFailed WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)),
-    WKErrorContentExtensionStoreVersionMismatch WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)),
+    WKErrorContentRuleListStoreCompileFailed WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)),
+    WKErrorContentRuleListStoreLookUpFailed WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)),
+    WKErrorContentRuleListStoreRemoveFailed WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)),
+    WKErrorContentRuleListStoreVersionMismatch WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)),
 } WK_API_AVAILABLE(macosx(10.10), ios(8.0));
 
 NS_ASSUME_NONNULL_END
index 7aabbe9..36c85de 100644 (file)
@@ -58,17 +58,17 @@ NSString *localizedDescriptionForErrorCode(WKErrorCode errorCode)
     case WKErrorJavaScriptResultTypeIsUnsupported:
         return WEB_UI_STRING("JavaScript execution returned a result of an unsupported type", "WKErrorJavaScriptResultTypeIsUnsupported description");
 
-    case WKErrorContentExtensionStoreLookUpFailed:
-        return WEB_UI_STRING("Looking up a WKUserContentExtension failed", "WKErrorContentExtensionStoreLookupFailed description");
+    case WKErrorContentRuleListStoreLookUpFailed:
+        return WEB_UI_STRING("Looking up a WKContentRuleList failed", "WKErrorContentRuleListStoreLookupFailed description");
 
-    case WKErrorContentExtensionStoreVersionMismatch:
-        return WEB_UI_STRING("Looking up a WKUserContentExtension found a binary that is incompatible", "WKErrorContentExtensionStoreVersionMismatch description");
+    case WKErrorContentRuleListStoreVersionMismatch:
+        return WEB_UI_STRING("Looking up a WKContentRuleList found a binary that is incompatible", "WKErrorContentRuleListStoreVersionMismatch description");
 
-    case WKErrorContentExtensionStoreCompileFailed:
-        return WEB_UI_STRING("Compiling a WKUserContentExtension failed", "WKErrorContentExtensionStoreCompileFailed description");
+    case WKErrorContentRuleListStoreCompileFailed:
+        return WEB_UI_STRING("Compiling a WKContentRuleList failed", "WKErrorContentRuleListStoreCompileFailed description");
 
-    case WKErrorContentExtensionStoreRemoveFailed:
-        return WEB_UI_STRING("Removing a WKUserContentExtension failed", "WKErrorContentExtensionStoreRemoveFailed description");
+    case WKErrorContentRuleListStoreRemoveFailed:
+        return WEB_UI_STRING("Removing a WKContentRuleList failed", "WKErrorContentRuleListStoreRemoveFailed description");
     }
 }
 
index 62bb809..19982e9 100644 (file)
@@ -31,7 +31,7 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-@class WKContentExtension;
+@class WKContentRuleList;
 @class WKUserScript;
 @protocol WKScriptMessageHandler;
 
@@ -71,19 +71,19 @@ WK_CLASS_AVAILABLE(macosx(10.10), ios(8.0))
  */
 - (void)removeScriptMessageHandlerForName:(NSString *)name;
 
-/*! @abstract Adds a user content extension.
- @param name The name of the user content extension to add.
+/*! @abstract Adds a content rule list.
+ @param contentRuleList The content rule list to add.
  */
-- (void)addContentExtension:(WKContentExtension *)contentExtension WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (void)addContentRuleList:(WKContentRuleList *)contentRuleList WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
-/*! @abstract Removes a user content extension.
- @param name The identifier of the user content extension to remove.
+/*! @abstract Removes a content rule list.
+ @param contentRuleList The content rule list to remove.
  */
-- (void)removeContentExtension:(WKContentExtension *)contentExtension WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (void)removeContentRuleList:(WKContentRuleList *)contentRuleList WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
-/*! @abstract Removes all associated user content extensions.
+/*! @abstract Removes all associated content rule lists.
  */
-- (void)removeAllContentExtensions WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (void)removeAllContentRuleLists WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 @end
 
index ac5b38a..38f8c12 100644 (file)
@@ -30,7 +30,7 @@
 
 #import "APISerializedScriptValue.h"
 #import "APIUserContentWorld.h"
-#import "WKContentExtensionInternal.h"
+#import "WKContentRuleListInternal.h"
 #import "WKFrameInfoInternal.h"
 #import "WKNSArray.h"
 #import "WKScriptMessageHandler.h"
     _userContentControllerProxy->removeAllUserScripts();
 }
 
-- (void)addContentExtension:(WKContentExtension *)contentExtension
+- (void)addContentRuleList:(WKContentRuleList *)contentRuleList
 {
 #if ENABLE(CONTENT_EXTENSIONS)
-    _userContentControllerProxy->addContentExtension(*contentExtension->_contentExtension);
+    _userContentControllerProxy->addContentRuleList(*contentRuleList->_contentRuleList);
 #endif
 }
 
-- (void)removeContentExtension:(WKContentExtension *)contentExtension
+- (void)removeContentRuleList:(WKContentRuleList *)contentRuleList
 {
 #if ENABLE(CONTENT_EXTENSIONS)
-    _userContentControllerProxy->removeContentExtension(contentExtension->_contentExtension->name());
+    _userContentControllerProxy->removeContentRuleList(contentRuleList->_contentRuleList->name());
 #endif
 }
 
-- (void)removeAllContentExtensions
+- (void)removeAllContentRuleLists
 {
 #if ENABLE(CONTENT_EXTENSIONS)
-    _userContentControllerProxy->removeAllContentExtensions();
+    _userContentControllerProxy->removeAllContentRuleLists();
 #endif
 }
 
@@ -175,21 +175,21 @@ private:
 - (void)_addUserContentFilter:(_WKUserContentFilter *)userContentFilter
 {
 #if ENABLE(CONTENT_EXTENSIONS)
-    _userContentControllerProxy->addContentExtension(*userContentFilter->_contentExtension->_contentExtension);
+    _userContentControllerProxy->addContentRuleList(*userContentFilter->_contentRuleList->_contentRuleList);
 #endif
 }
 
 - (void)_removeUserContentFilter:(NSString *)userContentFilterName
 {
 #if ENABLE(CONTENT_EXTENSIONS)
-    _userContentControllerProxy->removeContentExtension(userContentFilterName);
+    _userContentControllerProxy->removeContentRuleList(userContentFilterName);
 #endif
 }
 
 - (void)_removeAllUserContentFilters
 {
 #if ENABLE(CONTENT_EXTENSIONS)
-    _userContentControllerProxy->removeAllContentExtensions();
+    _userContentControllerProxy->removeAllContentRuleLists();
 #endif
 }
 
index 5cf5dff..6551856 100644 (file)
@@ -28,8 +28,8 @@
 
 #if WK_API_ENABLED
 
-#import "WKContentExtensionStoreInternal.h"
-#import "WKContentExtensionStorePrivate.h"
+#import "WKContentRuleListStoreInternal.h"
+#import "WKContentRuleListStorePrivate.h"
 #import "WKErrorInternal.h"
 #import "_WKUserContentExtensionStorePrivate.h"
 #import "_WKUserContentFilterInternal.h"
 
 NSString * const _WKUserContentExtensionsDomain = @"WKErrorDomain";
 
-static NSError *toUserContentExtensionStoreError(const NSError *error)
+static NSError *toUserContentRuleListStoreError(const NSError *error)
 {
     if (!error)
         return nil;
 
     ASSERT(error.domain == WKErrorDomain);
     switch (error.code) {
-    case WKErrorContentExtensionStoreLookUpFailed:
+    case WKErrorContentRuleListStoreLookUpFailed:
         return [NSError errorWithDomain:_WKUserContentExtensionsDomain code:_WKUserContentExtensionStoreErrorLookupFailed userInfo:error.userInfo];
-    case WKErrorContentExtensionStoreVersionMismatch:
+    case WKErrorContentRuleListStoreVersionMismatch:
         return [NSError errorWithDomain:_WKUserContentExtensionsDomain code:_WKUserContentExtensionStoreErrorVersionMismatch userInfo:error.userInfo];
-    case WKErrorContentExtensionStoreCompileFailed:
+    case WKErrorContentRuleListStoreCompileFailed:
         return [NSError errorWithDomain:_WKUserContentExtensionsDomain code:_WKUserContentExtensionStoreErrorCompileFailed userInfo:error.userInfo];
-    case WKErrorContentExtensionStoreRemoveFailed:
+    case WKErrorContentRuleListStoreRemoveFailed:
         return [NSError errorWithDomain:_WKUserContentExtensionsDomain code:_WKUserContentExtensionStoreErrorRemoveFailed userInfo:error.userInfo];
     default:
         RELEASE_ASSERT_NOT_REACHED();
@@ -62,34 +62,34 @@ static NSError *toUserContentExtensionStoreError(const NSError *error)
 
 + (instancetype)defaultStore
 {
-    return [[[_WKUserContentExtensionStore alloc] _initWithWKContentExtensionStore:[WKContentExtensionStore defaultStore]] autorelease];
+    return [[[_WKUserContentExtensionStore alloc] _initWithWKContentRuleListStore:[WKContentRuleListStore defaultStoreWithLegacyFilename]] autorelease];
 }
 
 + (instancetype)storeWithURL:(NSURL *)url
 {
-    return [[[_WKUserContentExtensionStore alloc] _initWithWKContentExtensionStore:[WKContentExtensionStore storeWithURL:url]] autorelease];
+    return [[[_WKUserContentExtensionStore alloc] _initWithWKContentRuleListStore:[WKContentRuleListStore storeWithURLAndLegacyFilename:url]] autorelease];
 }
 
-- (void)compileContentExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *)encodedContentExtension completionHandler:(void (^)(_WKUserContentFilter *, NSError *))completionHandler
+- (void)compileContentExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *)encodedContentRuleList completionHandler:(void (^)(_WKUserContentFilter *, NSError *))completionHandler
 {
-    [_contentExtensionStore _compileContentExtensionForIdentifier:identifier encodedContentExtension:encodedContentExtension completionHandler:^(WKContentExtension *contentExtension, NSError *error) {
-        _WKUserContentFilter *contentFilter = contentExtension ? [[[_WKUserContentFilter alloc] _initWithWKContentExtension:contentExtension] autorelease] : nil;
-        completionHandler(contentFilter, toUserContentExtensionStoreError(error));
+    [_contentRuleListStore _compileContentRuleListForIdentifier:identifier encodedContentRuleList:encodedContentRuleList completionHandler:^(WKContentRuleList *contentRuleList, NSError *error) {
+        _WKUserContentFilter *contentFilter = contentRuleList ? [[[_WKUserContentFilter alloc] _initWithWKContentRuleList:contentRuleList] autorelease] : nil;
+        completionHandler(contentFilter, toUserContentRuleListStoreError(error));
     }];
 }
 
 - (void)lookupContentExtensionForIdentifier:(NSString *)identifier completionHandler:(void (^)(_WKUserContentFilter *, NSError *))completionHandler
 {
-    [_contentExtensionStore lookUpContentExtensionForIdentifier:identifier completionHandler:^(WKContentExtension *contentExtension, NSError *error) {
-        _WKUserContentFilter *contentFilter = contentExtension ? [[[_WKUserContentFilter alloc] _initWithWKContentExtension:contentExtension] autorelease] : nil;
-        completionHandler(contentFilter, toUserContentExtensionStoreError(error));
+    [_contentRuleListStore lookUpContentRuleListForIdentifier:identifier completionHandler:^(WKContentRuleList *contentRuleList, NSError *error) {
+        _WKUserContentFilter *contentFilter = contentRuleList ? [[[_WKUserContentFilter alloc] _initWithWKContentRuleList:contentRuleList] autorelease] : nil;
+        completionHandler(contentFilter, toUserContentRuleListStoreError(error));
     }];
 }
 
 - (void)removeContentExtensionForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSError *))completionHandler
 {
-    [_contentExtensionStore removeContentExtensionForIdentifier:identifier completionHandler:^(NSError *error) {
-        completionHandler(toUserContentExtensionStoreError(error));
+    [_contentRuleListStore removeContentRuleListForIdentifier:identifier completionHandler:^(NSError *error) {
+        completionHandler(toUserContentRuleListStoreError(error));
     }];
 }
 
@@ -97,7 +97,7 @@ static NSError *toUserContentExtensionStoreError(const NSError *error)
 
 - (API::Object&)_apiObject
 {
-    return [_contentExtensionStore _apiObject];
+    return [_contentRuleListStore _apiObject];
 }
 
 @end
@@ -108,21 +108,21 @@ static NSError *toUserContentExtensionStoreError(const NSError *error)
 
 - (void)_removeAllContentExtensions
 {
-    [_contentExtensionStore _removeAllContentExtensions];
+    [_contentRuleListStore _removeAllContentRuleLists];
 }
 
 - (void)_invalidateContentExtensionVersionForIdentifier:(NSString *)identifier
 {
-    [_contentExtensionStore _invalidateContentExtensionVersionForIdentifier:identifier];
+    [_contentRuleListStore _invalidateContentRuleListVersionForIdentifier:identifier];
 }
 
-- (id)_initWithWKContentExtensionStore:(WKContentExtensionStore*)contentExtensionStore
+- (id)_initWithWKContentRuleListStore:(WKContentRuleListStore*)contentRuleListStore
 {
     self = [super init];
     if (!self)
         return nil;
     
-    _contentExtensionStore = contentExtensionStore;
+    _contentRuleListStore = contentRuleListStore;
     
     return self;
 }
index 383420f..f43ef7a 100644 (file)
 
 #if WK_API_ENABLED
 
-#import "APIContentExtensionStore.h"
+#import "APIContentRuleListStore.h"
 #import "WKObject.h"
 
-@class WKContentExtensionStore;
+@class WKContentRuleListStore;
 
 @interface _WKUserContentExtensionStore () <WKObject> {
 @package
-    RetainPtr<WKContentExtensionStore> _contentExtensionStore;
+    RetainPtr<WKContentRuleListStore> _contentRuleListStore;
 }
 @end
 
index 5c0cdc6..88ed9b5 100644 (file)
@@ -27,7 +27,7 @@
 
 #if WK_API_ENABLED
 
-@class WKContentExtensionStore;
+@class WKContentRuleListStore;
 
 @interface _WKUserContentExtensionStore (WKPrivate)
 
@@ -35,7 +35,7 @@
 - (void)_removeAllContentExtensions;
 - (void)_invalidateContentExtensionVersionForIdentifier:(NSString *)identifier;
 
-- (id)_initWithWKContentExtensionStore:(WKContentExtensionStore*)contentExtensionStore;
+- (id)_initWithWKContentRuleListStore:(WKContentRuleListStore*)contentRuleListStore;
 
 @end
 
index 7371d68..90288a8 100644 (file)
@@ -28,7 +28,7 @@
 
 #if WK_API_ENABLED
 
-#include "WebCompiledContentExtension.h"
+#include "WebCompiledContentRuleList.h"
 #include <WebCore/ContentExtensionCompiler.h>
 #include <WebCore/ContentExtensionError.h>
 #include <string>
 
 - (API::Object&)_apiObject
 {
-    return [_contentExtension _apiObject];
+    return [_contentRuleList _apiObject];
 }
 
 @end
 
 @implementation _WKUserContentFilter (WKPrivate)
 
-- (id)_initWithWKContentExtension:(WKContentExtension*)contentExtension
+- (id)_initWithWKContentRuleList:(WKContentRuleList*)contentRuleList
 {
     self = [super init];
     if (!self)
         return nil;
     
-    _contentExtension = contentExtension;
+    _contentRuleList = contentRuleList;
     
     return self;
 }
index 9980a00..1c53246 100644 (file)
 
 #if WK_API_ENABLED
 
-#import "APIContentExtension.h"
+#import "APIContentRuleList.h"
 #import "WKObject.h"
 
-@class WKContentExtension;
+@class WKContentRuleList;
 
 @interface _WKUserContentFilter () <WKObject> {
 @package
-    RetainPtr<WKContentExtension> _contentExtension;
+    RetainPtr<WKContentRuleList> _contentRuleList;
 }
 @end
 
index 12cef20..cbe7523 100644 (file)
 
 #if WK_API_ENABLED
 
-@class WKUserContentExtension;
+@class WKUserContentRuleList;
 
 @interface _WKUserContentFilter (WKPrivate)
 
-- (id)_initWithWKContentExtension:(WKContentExtension*)contentExtension;
+- (id)_initWithWKContentRuleList:(WKContentRuleList*)contentRuleList;
 
 @end
 
index 62da5ed..7f86943 100644 (file)
@@ -40,8 +40,8 @@
 #include <WebCore/SerializedScriptValue.h>
 
 #if ENABLE(CONTENT_EXTENSIONS)
-#include "APIContentExtension.h"
-#include "WebCompiledContentExtension.h"
+#include "APIContentRuleList.h"
+#include "WebCompiledContentRuleList.h"
 #endif
 
 namespace WebKit {
@@ -92,9 +92,9 @@ void WebUserContentControllerProxy::addProcess(WebProcessProxy& webProcessProxy,
         parameters.messageHandlers.append({ handler->identifier(), handler->userContentWorld().identifier(), handler->name() });
 
 #if ENABLE(CONTENT_EXTENSIONS)
-    ASSERT(parameters.contentExtensions.isEmpty());
-    for (const auto& contentExtension : m_contentExtensions.values())
-        parameters.contentExtensions.append(std::make_pair(contentExtension->name(), contentExtension->compiledExtension().data()));
+    ASSERT(parameters.contentRuleLists.isEmpty());
+    for (const auto& contentRuleList : m_contentRuleLists.values())
+        parameters.contentRuleLists.append(std::make_pair(contentRuleList->name(), contentRuleList->compiledRuleList().data()));
 #endif
 }
 
@@ -332,30 +332,30 @@ void WebUserContentControllerProxy::didPostMessage(IPC::Connection& connection,
 }
 
 #if ENABLE(CONTENT_EXTENSIONS)
-void WebUserContentControllerProxy::addContentExtension(API::ContentExtension& contentExtension)
+void WebUserContentControllerProxy::addContentRuleList(API::ContentRuleList& contentRuleList)
 {
-    m_contentExtensions.set(contentExtension.name(), &contentExtension);
+    m_contentRuleLists.set(contentRuleList.name(), &contentRuleList);
 
-    auto pair = std::make_pair(contentExtension.name(), contentExtension.compiledExtension().data());
+    auto pair = std::make_pair(contentRuleList.name(), contentRuleList.compiledRuleList().data());
 
     for (WebProcessProxy* process : m_processes)
-        process->send(Messages::WebUserContentController::AddContentExtensions({ pair }), m_identifier);
+        process->send(Messages::WebUserContentController::AddContentRuleLists({ pair }), m_identifier);
 }
 
-void WebUserContentControllerProxy::removeContentExtension(const String& name)
+void WebUserContentControllerProxy::removeContentRuleList(const String& name)
 {
-    m_contentExtensions.remove(name);
+    m_contentRuleLists.remove(name);
 
     for (WebProcessProxy* process : m_processes)
-        process->send(Messages::WebUserContentController::RemoveContentExtension(name), m_identifier);
+        process->send(Messages::WebUserContentController::RemoveContentRuleList(name), m_identifier);
 }
 
-void WebUserContentControllerProxy::removeAllContentExtensions()
+void WebUserContentControllerProxy::removeAllContentRuleLists()
 {
-    m_contentExtensions.clear();
+    m_contentRuleLists.clear();
 
     for (WebProcessProxy* process : m_processes)
-        process->send(Messages::WebUserContentController::RemoveAllContentExtensions(), m_identifier);
+        process->send(Messages::WebUserContentController::RemoveAllContentRuleLists(), m_identifier);
 }
 #endif
 
index 0f48d03..469306a 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace API {
 class Array;
-class ContentExtension;
+class ContentRuleList;
 class UserContentWorld;
 class UserScript;
 class UserStyleSheet;
@@ -92,9 +92,9 @@ public:
     void removeAllUserMessageHandlers(API::UserContentWorld&);
 
 #if ENABLE(CONTENT_EXTENSIONS)
-    void addContentExtension(API::ContentExtension&);
-    void removeContentExtension(const String&);
-    void removeAllContentExtensions();
+    void addContentRuleList(API::ContentRuleList&);
+    void removeContentRuleList(const String&);
+    void removeAllContentRuleLists();
 #endif
 
 private:
@@ -116,7 +116,7 @@ private:
     HashCountedSet<RefPtr<API::UserContentWorld>> m_userContentWorlds;
 
 #if ENABLE(CONTENT_EXTENSIONS)
-    HashMap<String, RefPtr<API::ContentExtension>> m_contentExtensions;
+    HashMap<String, RefPtr<API::ContentRuleList>> m_contentRuleLists;
 #endif
 };
 
index 61259f5..2cf5d59 100644 (file)
 #include "WebPageGroup.h"
 
 #include "APIArray.h"
-#include "APIContentExtension.h"
+#include "APIContentRuleList.h"
 #include "APIUserScript.h"
 #include "APIUserStyleSheet.h"
-#include "WebCompiledContentExtension.h"
+#include "WebCompiledContentRuleList.h"
 #include "WebPageProxy.h"
 #include "WebPreferences.h"
 #include "WebUserContentControllerProxy.h"
index 350acff..049c182 100644 (file)
                5CB237921DF0E2EE00117AA3 /* APIWebsitePolicies.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CB2378F1DF0E1B800117AA3 /* APIWebsitePolicies.h */; };
                5CBC9B8D1C65279C00A8FDCF /* NetworkDataTaskCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CBC9B8B1C65257300A8FDCF /* NetworkDataTaskCocoa.mm */; };
                5CBC9B8E1C652CA000A8FDCF /* NetworkDataTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CBC9B891C6524A500A8FDCF /* NetworkDataTask.h */; };
-               5CD286511E7235990094FDC8 /* WKContentExtensionStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD2864D1E722F440094FDC8 /* WKContentExtensionStore.h */; settings = {ATTRIBUTES = (Public, ); }; };
-               5CD286521E7235A60094FDC8 /* WKContentExtension.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CD2864B1E722F440094FDC8 /* WKContentExtension.mm */; };
+               5CD286511E7235990094FDC8 /* WKContentRuleListStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD2864D1E722F440094FDC8 /* WKContentRuleListStore.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               5CD286521E7235A60094FDC8 /* WKContentRuleList.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CD2864B1E722F440094FDC8 /* WKContentRuleList.mm */; };
                5CD286531E7235AA0094FDC8 /* _WKUserContentFilterPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD286491E722F440094FDC8 /* _WKUserContentFilterPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               5CD286541E7235B10094FDC8 /* WKContentExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD2864A1E722F440094FDC8 /* WKContentExtension.h */; settings = {ATTRIBUTES = (Public, ); }; };
-               5CD286551E7235B80094FDC8 /* WKContentExtensionInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD2864C1E722F440094FDC8 /* WKContentExtensionInternal.h */; };
-               5CD286561E7235C60094FDC8 /* WKContentExtensionStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CD2864E1E722F440094FDC8 /* WKContentExtensionStore.mm */; };
-               5CD286571E7235C90094FDC8 /* WKContentExtensionStoreInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD2864F1E722F440094FDC8 /* WKContentExtensionStoreInternal.h */; };
-               5CD286581E7235D10094FDC8 /* WKContentExtensionStorePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD286501E722F440094FDC8 /* WKContentExtensionStorePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               5CD286541E7235B10094FDC8 /* WKContentRuleList.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD2864A1E722F440094FDC8 /* WKContentRuleList.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               5CD286551E7235B80094FDC8 /* WKContentRuleListInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD2864C1E722F440094FDC8 /* WKContentRuleListInternal.h */; };
+               5CD286561E7235C60094FDC8 /* WKContentRuleListStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CD2864E1E722F440094FDC8 /* WKContentRuleListStore.mm */; };
+               5CD286571E7235C90094FDC8 /* WKContentRuleListStoreInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD2864F1E722F440094FDC8 /* WKContentRuleListStoreInternal.h */; };
+               5CD286581E7235D10094FDC8 /* WKContentRuleListStorePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD286501E722F440094FDC8 /* WKContentRuleListStorePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                5CE85B201C88E64B0070BFCE /* PingLoad.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CE85B1F1C88E6430070BFCE /* PingLoad.h */; };
                5CFECB041E1ED1CC00F88504 /* LegacyCustomProtocolManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CFECB031E1ED1C800F88504 /* LegacyCustomProtocolManager.cpp */; };
                636353A51E9858DF0009F8AF /* _WKGeolocationCoreLocationProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 63FABE191E970D65003011D5 /* _WKGeolocationCoreLocationProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
                7C361D78192803BD0036A59D /* WebUserContentControllerProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C361D76192803BD0036A59D /* WebUserContentControllerProxyMessageReceiver.cpp */; };
                7C361D79192803BD0036A59D /* WebUserContentControllerProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C361D77192803BD0036A59D /* WebUserContentControllerProxyMessages.h */; };
                7C387434172F5615001BD88A /* PageBanner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C387433172F5615001BD88A /* PageBanner.cpp */; };
-               7C3A06A71AAB903E009D74BA /* APIContentExtensionStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3A06A51AAB903E009D74BA /* APIContentExtensionStore.cpp */; };
-               7C3A06A81AAB903E009D74BA /* APIContentExtensionStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3A06A61AAB903E009D74BA /* APIContentExtensionStore.h */; };
+               7C3A06A71AAB903E009D74BA /* APIContentRuleListStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3A06A51AAB903E009D74BA /* APIContentRuleListStore.cpp */; };
+               7C3A06A81AAB903E009D74BA /* APIContentRuleListStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3A06A61AAB903E009D74BA /* APIContentRuleListStore.h */; };
                7C3F8C90173AF52D007B7F39 /* PluginInformation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3F8C8E173AF52D007B7F39 /* PluginInformation.cpp */; };
                7C3F8C91173AF52D007B7F39 /* PluginInformation.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3F8C8F173AF52D007B7F39 /* PluginInformation.h */; };
                7C4694C91A4B4EA100AD5845 /* WebPasteboardProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4694C71A4B4EA000AD5845 /* WebPasteboardProxyMessageReceiver.cpp */; };
                7C4694CC1A4B510A00AD5845 /* WebPasteboardProxyCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C4694CB1A4B510A00AD5845 /* WebPasteboardProxyCocoa.mm */; };
                7C4694D01A51E36800AD5845 /* WebPasteboardProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4694CD1A51E36800AD5845 /* WebPasteboardProxy.cpp */; };
                7C4694D11A51E36800AD5845 /* WebPasteboardProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C4694CE1A51E36800AD5845 /* WebPasteboardProxy.h */; };
-               7C4ABED01AA8E9F00088AA37 /* WebCompiledContentExtension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4ABECE1AA8E9F00088AA37 /* WebCompiledContentExtension.cpp */; };
-               7C4ABED11AA8E9F00088AA37 /* WebCompiledContentExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C4ABECF1AA8E9F00088AA37 /* WebCompiledContentExtension.h */; };
-               7C4ABED41AA8FCB80088AA37 /* WebCompiledContentExtensionData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4ABED21AA8FCB80088AA37 /* WebCompiledContentExtensionData.cpp */; };
-               7C4ABED51AA8FCB80088AA37 /* WebCompiledContentExtensionData.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C4ABED31AA8FCB80088AA37 /* WebCompiledContentExtensionData.h */; };
+               7C4ABED01AA8E9F00088AA37 /* WebCompiledContentRuleList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4ABECE1AA8E9F00088AA37 /* WebCompiledContentRuleList.cpp */; };
+               7C4ABED11AA8E9F00088AA37 /* WebCompiledContentRuleList.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C4ABECF1AA8E9F00088AA37 /* WebCompiledContentRuleList.h */; };
+               7C4ABED41AA8FCB80088AA37 /* WebCompiledContentRuleListData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4ABED21AA8FCB80088AA37 /* WebCompiledContentRuleListData.cpp */; };
+               7C4ABED51AA8FCB80088AA37 /* WebCompiledContentRuleListData.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C4ABED31AA8FCB80088AA37 /* WebCompiledContentRuleListData.h */; };
                7C6D37FC172F555F009D2847 /* PageBannerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C6D37FA172F555F009D2847 /* PageBannerMac.mm */; };
                7C6E70FB18B2DC7A00F24E2E /* WebProcessCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C6E70F918B2D4A000F24E2E /* WebProcessCocoa.mm */; };
                7C85FD7C193415A8000177C4 /* WebPreferencesDefinitions.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C85FD7B193415A8000177C4 /* WebPreferencesDefinitions.h */; };
                7C89D2A31A678875003A5FDE /* WKUserScriptRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89D2A11A678875003A5FDE /* WKUserScriptRef.cpp */; };
                7C89D2A41A678875003A5FDE /* WKUserScriptRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C89D2A21A678875003A5FDE /* WKUserScriptRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
                7C89D2A61A6789EA003A5FDE /* APIUserScript.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89D2A51A6789EA003A5FDE /* APIUserScript.cpp */; };
-               7C89D2B31A6B068C003A5FDE /* APIContentExtension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89D2B11A6B068C003A5FDE /* APIContentExtension.cpp */; };
-               7C89D2B41A6B068C003A5FDE /* APIContentExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C89D2B21A6B068C003A5FDE /* APIContentExtension.h */; };
+               7C89D2B31A6B068C003A5FDE /* APIContentRuleList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89D2B11A6B068C003A5FDE /* APIContentRuleList.cpp */; };
+               7C89D2B41A6B068C003A5FDE /* APIContentRuleList.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C89D2B21A6B068C003A5FDE /* APIContentRuleList.h */; };
                7C89D2B61A6B0DD9003A5FDE /* WKUserContentControllerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C89D2B51A6B0DD9003A5FDE /* WKUserContentControllerPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                7C89D2B91A6B0F2C003A5FDE /* _WKUserContentFilter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C89D2B71A6B0F2C003A5FDE /* _WKUserContentFilter.mm */; };
                7C89D2BA1A6B0F2C003A5FDE /* _WKUserContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C89D2B81A6B0F2C003A5FDE /* _WKUserContentFilter.h */; settings = {ATTRIBUTES = (Private, ); }; };
                7CE4D2201A4914CA00C7F152 /* APIProcessPoolConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE4D21E1A4914CA00C7F152 /* APIProcessPoolConfiguration.h */; };
                7CE4D2271A4916C200C7F152 /* WebProcessPoolMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE4D2251A4916C200C7F152 /* WebProcessPoolMessageReceiver.cpp */; };
                7CE4D2281A4916C200C7F152 /* WebProcessPoolMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE4D2261A4916C200C7F152 /* WebProcessPoolMessages.h */; };
-               7CEFA9621AC0999300B910FD /* APIUserContentExtensionStoreCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7CEFA9601AC0999300B910FD /* APIUserContentExtensionStoreCocoa.mm */; };
+               7CEFA9621AC0999300B910FD /* APIContentRuleListStoreCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7CEFA9601AC0999300B910FD /* APIContentRuleListStoreCocoa.mm */; };
                7CF47FF617275B71008ACB91 /* WKBundlePageBanner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CF47FF417275B71008ACB91 /* WKBundlePageBanner.cpp */; };
                7CF47FF717275B71008ACB91 /* WKBundlePageBanner.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CF47FF517275B71008ACB91 /* WKBundlePageBanner.h */; settings = {ATTRIBUTES = (Private, ); }; };
                7CF47FFB17275C57008ACB91 /* PageBanner.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CF47FF917275C57008ACB91 /* PageBanner.h */; };
                5CBC9B891C6524A500A8FDCF /* NetworkDataTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkDataTask.h; path = NetworkProcess/NetworkDataTask.h; sourceTree = "<group>"; };
                5CBC9B8B1C65257300A8FDCF /* NetworkDataTaskCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = NetworkDataTaskCocoa.mm; path = NetworkProcess/cocoa/NetworkDataTaskCocoa.mm; sourceTree = "<group>"; };
                5CD286491E722F440094FDC8 /* _WKUserContentFilterPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKUserContentFilterPrivate.h; sourceTree = "<group>"; };
-               5CD2864A1E722F440094FDC8 /* WKContentExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentExtension.h; sourceTree = "<group>"; };
-               5CD2864B1E722F440094FDC8 /* WKContentExtension.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKContentExtension.mm; sourceTree = "<group>"; };
-               5CD2864C1E722F440094FDC8 /* WKContentExtensionInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentExtensionInternal.h; sourceTree = "<group>"; };
-               5CD2864D1E722F440094FDC8 /* WKContentExtensionStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentExtensionStore.h; sourceTree = "<group>"; };
-               5CD2864E1E722F440094FDC8 /* WKContentExtensionStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKContentExtensionStore.mm; sourceTree = "<group>"; };
-               5CD2864F1E722F440094FDC8 /* WKContentExtensionStoreInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentExtensionStoreInternal.h; sourceTree = "<group>"; };
-               5CD286501E722F440094FDC8 /* WKContentExtensionStorePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentExtensionStorePrivate.h; sourceTree = "<group>"; };
+               5CD2864A1E722F440094FDC8 /* WKContentRuleList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentRuleList.h; sourceTree = "<group>"; };
+               5CD2864B1E722F440094FDC8 /* WKContentRuleList.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKContentRuleList.mm; sourceTree = "<group>"; };
+               5CD2864C1E722F440094FDC8 /* WKContentRuleListInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentRuleListInternal.h; sourceTree = "<group>"; };
+               5CD2864D1E722F440094FDC8 /* WKContentRuleListStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentRuleListStore.h; sourceTree = "<group>"; };
+               5CD2864E1E722F440094FDC8 /* WKContentRuleListStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKContentRuleListStore.mm; sourceTree = "<group>"; };
+               5CD2864F1E722F440094FDC8 /* WKContentRuleListStoreInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentRuleListStoreInternal.h; sourceTree = "<group>"; };
+               5CD286501E722F440094FDC8 /* WKContentRuleListStorePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentRuleListStorePrivate.h; sourceTree = "<group>"; };
                5CE85B1F1C88E6430070BFCE /* PingLoad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PingLoad.h; path = NetworkProcess/PingLoad.h; sourceTree = "<group>"; };
                5CFECB031E1ED1C800F88504 /* LegacyCustomProtocolManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LegacyCustomProtocolManager.cpp; path = NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp; sourceTree = "<group>"; };
                5D442A5516D5856700AC3331 /* PluginService.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PluginService.entitlements; sourceTree = "<group>"; };
                7C361D76192803BD0036A59D /* WebUserContentControllerProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebUserContentControllerProxyMessageReceiver.cpp; sourceTree = "<group>"; };
                7C361D77192803BD0036A59D /* WebUserContentControllerProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebUserContentControllerProxyMessages.h; sourceTree = "<group>"; };
                7C387433172F5615001BD88A /* PageBanner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageBanner.cpp; sourceTree = "<group>"; };
-               7C3A06A51AAB903E009D74BA /* APIContentExtensionStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIContentExtensionStore.cpp; sourceTree = "<group>"; };
-               7C3A06A61AAB903E009D74BA /* APIContentExtensionStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIContentExtensionStore.h; sourceTree = "<group>"; };
+               7C3A06A51AAB903E009D74BA /* APIContentRuleListStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIContentRuleListStore.cpp; sourceTree = "<group>"; };
+               7C3A06A61AAB903E009D74BA /* APIContentRuleListStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIContentRuleListStore.h; sourceTree = "<group>"; };
                7C3F8C8E173AF52D007B7F39 /* PluginInformation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginInformation.cpp; sourceTree = "<group>"; };
                7C3F8C8F173AF52D007B7F39 /* PluginInformation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginInformation.h; sourceTree = "<group>"; };
                7C4694C71A4B4EA000AD5845 /* WebPasteboardProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPasteboardProxyMessageReceiver.cpp; sourceTree = "<group>"; };
                7C4694CD1A51E36800AD5845 /* WebPasteboardProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPasteboardProxy.cpp; sourceTree = "<group>"; };
                7C4694CE1A51E36800AD5845 /* WebPasteboardProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPasteboardProxy.h; sourceTree = "<group>"; };
                7C4694CF1A51E36800AD5845 /* WebPasteboardProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebPasteboardProxy.messages.in; sourceTree = "<group>"; };
-               7C4ABECE1AA8E9F00088AA37 /* WebCompiledContentExtension.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCompiledContentExtension.cpp; sourceTree = "<group>"; };
-               7C4ABECF1AA8E9F00088AA37 /* WebCompiledContentExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCompiledContentExtension.h; sourceTree = "<group>"; };
-               7C4ABED21AA8FCB80088AA37 /* WebCompiledContentExtensionData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCompiledContentExtensionData.cpp; sourceTree = "<group>"; };
-               7C4ABED31AA8FCB80088AA37 /* WebCompiledContentExtensionData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCompiledContentExtensionData.h; sourceTree = "<group>"; };
+               7C4ABECE1AA8E9F00088AA37 /* WebCompiledContentRuleList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCompiledContentRuleList.cpp; sourceTree = "<group>"; };
+               7C4ABECF1AA8E9F00088AA37 /* WebCompiledContentRuleList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCompiledContentRuleList.h; sourceTree = "<group>"; };
+               7C4ABED21AA8FCB80088AA37 /* WebCompiledContentRuleListData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCompiledContentRuleListData.cpp; sourceTree = "<group>"; };
+               7C4ABED31AA8FCB80088AA37 /* WebCompiledContentRuleListData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCompiledContentRuleListData.h; sourceTree = "<group>"; };
                7C4ED3261A3119D90079BD49 /* InjectedBundleCSSStyleDeclarationHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleCSSStyleDeclarationHandle.cpp; sourceTree = "<group>"; };
                7C4ED3271A3119D90079BD49 /* InjectedBundleCSSStyleDeclarationHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleCSSStyleDeclarationHandle.h; sourceTree = "<group>"; };
                7C6D37FA172F555F009D2847 /* PageBannerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PageBannerMac.mm; sourceTree = "<group>"; };
                7C89D2A11A678875003A5FDE /* WKUserScriptRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKUserScriptRef.cpp; sourceTree = "<group>"; };
                7C89D2A21A678875003A5FDE /* WKUserScriptRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserScriptRef.h; sourceTree = "<group>"; };
                7C89D2A51A6789EA003A5FDE /* APIUserScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIUserScript.cpp; sourceTree = "<group>"; };
-               7C89D2B11A6B068C003A5FDE /* APIContentExtension.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIContentExtension.cpp; sourceTree = "<group>"; };
-               7C89D2B21A6B068C003A5FDE /* APIContentExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIContentExtension.h; sourceTree = "<group>"; };
+               7C89D2B11A6B068C003A5FDE /* APIContentRuleList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIContentRuleList.cpp; sourceTree = "<group>"; };
+               7C89D2B21A6B068C003A5FDE /* APIContentRuleList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIContentRuleList.h; sourceTree = "<group>"; };
                7C89D2B51A6B0DD9003A5FDE /* WKUserContentControllerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserContentControllerPrivate.h; sourceTree = "<group>"; };
                7C89D2B71A6B0F2C003A5FDE /* _WKUserContentFilter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKUserContentFilter.mm; sourceTree = "<group>"; };
                7C89D2B81A6B0F2C003A5FDE /* _WKUserContentFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKUserContentFilter.h; sourceTree = "<group>"; };
                7CE4D21E1A4914CA00C7F152 /* APIProcessPoolConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = APIProcessPoolConfiguration.h; path = UIProcess/API/APIProcessPoolConfiguration.h; sourceTree = SOURCE_ROOT; };
                7CE4D2251A4916C200C7F152 /* WebProcessPoolMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebProcessPoolMessageReceiver.cpp; sourceTree = "<group>"; };
                7CE4D2261A4916C200C7F152 /* WebProcessPoolMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcessPoolMessages.h; sourceTree = "<group>"; };
-               7CEFA9601AC0999300B910FD /* APIUserContentExtensionStoreCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = APIUserContentExtensionStoreCocoa.mm; sourceTree = "<group>"; };
+               7CEFA9601AC0999300B910FD /* APIContentRuleListStoreCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = APIContentRuleListStoreCocoa.mm; sourceTree = "<group>"; };
                7CF47FF417275B71008ACB91 /* WKBundlePageBanner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundlePageBanner.cpp; sourceTree = "<group>"; };
                7CF47FF517275B71008ACB91 /* WKBundlePageBanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundlePageBanner.h; sourceTree = "<group>"; };
                7CF47FF917275C57008ACB91 /* PageBanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageBanner.h; sourceTree = "<group>"; };
                                518D2CAB12D5153B003BB93B /* WebBackForwardListItem.cpp */,
                                518D2CAC12D5153B003BB93B /* WebBackForwardListItem.h */,
                                BCF50726124329AA005955AE /* WebCertificateInfo.h */,
-                               7C4ABECE1AA8E9F00088AA37 /* WebCompiledContentExtension.cpp */,
-                               7C4ABECF1AA8E9F00088AA37 /* WebCompiledContentExtension.h */,
-                               7C4ABED21AA8FCB80088AA37 /* WebCompiledContentExtensionData.cpp */,
-                               7C4ABED31AA8FCB80088AA37 /* WebCompiledContentExtensionData.h */,
+                               7C4ABECE1AA8E9F00088AA37 /* WebCompiledContentRuleList.cpp */,
+                               7C4ABECF1AA8E9F00088AA37 /* WebCompiledContentRuleList.h */,
+                               7C4ABED21AA8FCB80088AA37 /* WebCompiledContentRuleListData.cpp */,
+                               7C4ABED31AA8FCB80088AA37 /* WebCompiledContentRuleListData.h */,
                                BC4A628B147312BE006C681A /* WebConnection.cpp */,
                                BC4A628C147312BE006C681A /* WebConnection.h */,
                                1A1FEC191627B3EF00700F6D /* WebConnection.messages.in */,
                                5CB2378A1DF0DD4300117AA3 /* _WKWebsitePolicies.mm */,
                                5CB2378D1DF0E0C200117AA3 /* _WKWebsitePoliciesInternal.h */,
                                FED3C1DA1B447AE800E0EB7F /* APISerializedScriptValueCocoa.mm */,
-                               7CEFA9601AC0999300B910FD /* APIUserContentExtensionStoreCocoa.mm */,
+                               7CEFA9601AC0999300B910FD /* APIContentRuleListStoreCocoa.mm */,
                                1A3635AB1A3145E500ED6197 /* APIWebsiteDataStoreCocoa.mm */,
                                1AFDE64319510B5500C48FFA /* LegacyBundleForClass.mm */,
                                37C4C08B1814AC5C003688B9 /* WKBackForwardList.h */,
                                37C4C08818149F23003688B9 /* WKBackForwardListItemInternal.h */,
                                2DFF7B6E1DA4CFAF00814614 /* WKBackForwardListItemPrivate.h */,
                                1A9F28101958F478008CAC72 /* WKBackForwardListPrivate.h */,
-                               5CD2864A1E722F440094FDC8 /* WKContentExtension.h */,
-                               5CD2864B1E722F440094FDC8 /* WKContentExtension.mm */,
-                               5CD2864C1E722F440094FDC8 /* WKContentExtensionInternal.h */,
-                               5CD2864D1E722F440094FDC8 /* WKContentExtensionStore.h */,
-                               5CD2864E1E722F440094FDC8 /* WKContentExtensionStore.mm */,
-                               5CD2864F1E722F440094FDC8 /* WKContentExtensionStoreInternal.h */,
-                               5CD286501E722F440094FDC8 /* WKContentExtensionStorePrivate.h */,
+                               5CD2864A1E722F440094FDC8 /* WKContentRuleList.h */,
+                               5CD2864B1E722F440094FDC8 /* WKContentRuleList.mm */,
+                               5CD2864C1E722F440094FDC8 /* WKContentRuleListInternal.h */,
+                               5CD2864D1E722F440094FDC8 /* WKContentRuleListStore.h */,
+                               5CD2864E1E722F440094FDC8 /* WKContentRuleListStore.mm */,
+                               5CD2864F1E722F440094FDC8 /* WKContentRuleListStoreInternal.h */,
+                               5CD286501E722F440094FDC8 /* WKContentRuleListStorePrivate.h */,
                                1AF4592D19464B2000F9D4A2 /* WKError.h */,
                                1AF4592C19464B2000F9D4A2 /* WKError.mm */,
                                1A2D252A194688FD004537B0 /* WKErrorInternal.h */,
                                BC111B47112F616900337BAB /* mac */,
                                99C81D5B1C20E817005C4C82 /* APIAutomationClient.h */,
                                990D28B31C6526D400986977 /* APIAutomationSessionClient.h */,
-                               7C89D2B11A6B068C003A5FDE /* APIContentExtension.cpp */,
-                               7C89D2B21A6B068C003A5FDE /* APIContentExtension.h */,
-                               7C3A06A51AAB903E009D74BA /* APIContentExtensionStore.cpp */,
-                               7C3A06A61AAB903E009D74BA /* APIContentExtensionStore.h */,
+                               7C89D2B11A6B068C003A5FDE /* APIContentRuleList.cpp */,
+                               7C89D2B21A6B068C003A5FDE /* APIContentRuleList.h */,
+                               7C3A06A51AAB903E009D74BA /* APIContentRuleListStore.cpp */,
+                               7C3A06A61AAB903E009D74BA /* APIContentRuleListStore.h */,
                                076E884D1A13CADF005E90FC /* APIContextMenuClient.h */,
                                7A821F4F1E2F7A5C00604577 /* APICustomProtocolManagerClient.h */,
                                83891B621A68B3420030F386 /* APIDiagnosticLoggingClient.h */,
                                99C81D5D1C21F38B005C4C82 /* APIAutomationClient.h in Headers */,
                                990D28C01C6553F100986977 /* APIAutomationSessionClient.h in Headers */,
                                1A3DD206125E5A2F004515E6 /* APIClient.h in Headers */,
-                               7C89D2B41A6B068C003A5FDE /* APIContentExtension.h in Headers */,
-                               7C3A06A81AAB903E009D74BA /* APIContentExtensionStore.h in Headers */,
+                               7C89D2B41A6B068C003A5FDE /* APIContentRuleList.h in Headers */,
+                               7C3A06A81AAB903E009D74BA /* APIContentRuleListStore.h in Headers */,
                                076E884E1A13CADF005E90FC /* APIContextMenuClient.h in Headers */,
                                7A821F501E2F7A7500604577 /* APICustomProtocolManagerClient.h in Headers */,
                                51578B831209ECEF00A37C4A /* APIData.h in Headers */,
                                3F87B9BE158940190090FF62 /* WebColorChooser.h in Headers */,
                                3F87B9C0158940D80090FF62 /* WebColorPicker.h in Headers */,
                                728E86F11795188C0087879E /* WebColorPickerMac.h in Headers */,
-                               7C4ABED11AA8E9F00088AA37 /* WebCompiledContentExtension.h in Headers */,
-                               7C4ABED51AA8FCB80088AA37 /* WebCompiledContentExtensionData.h in Headers */,
+                               7C4ABED11AA8E9F00088AA37 /* WebCompiledContentRuleList.h in Headers */,
+                               7C4ABED51AA8FCB80088AA37 /* WebCompiledContentRuleListData.h in Headers */,
                                BC4A6290147312BE006C681A /* WebConnection.h in Headers */,
                                BC4A6292147312BE006C681A /* WebConnectionClient.h in Headers */,
                                1A1FEC1D1627B45700700F6D /* WebConnectionMessages.h in Headers */,
                                BCA284D71492F2C7001F9042 /* WKConnection.h in Headers */,
                                BC5C75C814954DA600BC4775 /* WKConnectionInternal.h in Headers */,
                                BC4A6297147313A0006C681A /* WKConnectionRef.h in Headers */,
-                               5CD286541E7235B10094FDC8 /* WKContentExtension.h in Headers */,
-                               5CD286551E7235B80094FDC8 /* WKContentExtensionInternal.h in Headers */,
-                               5CD286511E7235990094FDC8 /* WKContentExtensionStore.h in Headers */,
-                               5CD286571E7235C90094FDC8 /* WKContentExtensionStoreInternal.h in Headers */,
-                               5CD286581E7235D10094FDC8 /* WKContentExtensionStorePrivate.h in Headers */,
+                               5CD286541E7235B10094FDC8 /* WKContentRuleList.h in Headers */,
+                               5CD286551E7235B80094FDC8 /* WKContentRuleListInternal.h in Headers */,
+                               5CD286511E7235990094FDC8 /* WKContentRuleListStore.h in Headers */,
+                               5CD286571E7235C90094FDC8 /* WKContentRuleListStoreInternal.h in Headers */,
+                               5CD286581E7235D10094FDC8 /* WKContentRuleListStorePrivate.h in Headers */,
                                0FCB4E4C18BBE044000FCFC9 /* WKContentView.h in Headers */,
                                0FCB4E6C18BBF26A000FCFC9 /* WKContentViewInteraction.h in Headers */,
                                BCB9E24B1120E15C00A137E0 /* WKContext.h in Headers */,
                                A182D5B41BE6BD250087A7CC /* AccessibilityIOS.mm in Sources */,
                                A7D792D61767CB6E00881CBE /* ActivityAssertion.cpp in Sources */,
                                BC64696F11DBE603006455B0 /* APIArray.cpp in Sources */,
-                               7C89D2B31A6B068C003A5FDE /* APIContentExtension.cpp in Sources */,
-                               7C3A06A71AAB903E009D74BA /* APIContentExtensionStore.cpp in Sources */,
+                               7C89D2B31A6B068C003A5FDE /* APIContentRuleList.cpp in Sources */,
+                               7C3A06A71AAB903E009D74BA /* APIContentRuleListStore.cpp in Sources */,
                                1AAB037C185F99D800EDF501 /* APIData.cpp in Sources */,
                                1A1EF1991A1D5B420023200A /* APIDataCocoa.mm in Sources */,
                                7C1BA33D1A4A0E600043E249 /* APIDictionary.cpp in Sources */,
                                BCE2315E122C30CA00D5C35A /* APIURLRequest.cpp in Sources */,
                                BC90A1D3122DD55E00CC8C50 /* APIURLResponse.cpp in Sources */,
                                51D1243A1E6E0AAB002B2820 /* APIURLSchemeTask.cpp in Sources */,
-                               7CEFA9621AC0999300B910FD /* APIUserContentExtensionStoreCocoa.mm in Sources */,
+                               7CEFA9621AC0999300B910FD /* APIContentRuleListStoreCocoa.mm in Sources */,
                                7C882DFE1C7E99AC006BF731 /* APIUserContentWorld.cpp in Sources */,
                                7C89D2A61A6789EA003A5FDE /* APIUserScript.cpp in Sources */,
                                2D8786231BDB58FF00D02ABB /* APIUserStyleSheet.cpp in Sources */,
                                3F87B9BD158940120090FF62 /* WebColorChooser.cpp in Sources */,
                                F036978815F4BF0500C3A80E /* WebColorPicker.cpp in Sources */,
                                728E86F21795188C0087879E /* WebColorPickerMac.mm in Sources */,
-                               7C4ABED01AA8E9F00088AA37 /* WebCompiledContentExtension.cpp in Sources */,
-                               7C4ABED41AA8FCB80088AA37 /* WebCompiledContentExtensionData.cpp in Sources */,
+                               7C4ABED01AA8E9F00088AA37 /* WebCompiledContentRuleList.cpp in Sources */,
+                               7C4ABED41AA8FCB80088AA37 /* WebCompiledContentRuleListData.cpp in Sources */,
                                BC4A628F147312BE006C681A /* WebConnection.cpp in Sources */,
                                BC4A6291147312BE006C681A /* WebConnectionClient.cpp in Sources */,
                                1A1FEC1C1627B45700700F6D /* WebConnectionMessageReceiver.cpp in Sources */,
                                BC407628124FF0400068F20A /* WKCertificateInfoMac.mm in Sources */,
                                BCA284D61492F2C7001F9042 /* WKConnection.mm in Sources */,
                                BC4A6296147313A0006C681A /* WKConnectionRef.cpp in Sources */,
-                               5CD286521E7235A60094FDC8 /* WKContentExtension.mm in Sources */,
-                               5CD286561E7235C60094FDC8 /* WKContentExtensionStore.mm in Sources */,
+                               5CD286521E7235A60094FDC8 /* WKContentRuleList.mm in Sources */,
+                               5CD286561E7235C60094FDC8 /* WKContentRuleListStore.mm in Sources */,
                                0FCB4E4D18BBE044000FCFC9 /* WKContentView.mm in Sources */,
                                0FCB4E6D18BBF26A000FCFC9 /* WKContentViewInteraction.mm in Sources */,
                                BCB9E24C1120E15C00A137E0 /* WKContext.cpp in Sources */,
index 846e8bd..cc30c80 100644 (file)
@@ -29,7 +29,7 @@
 #include "DataReference.h"
 #include "FrameInfoData.h"
 #include "InjectedBundleScriptWorld.h"
-#include "WebCompiledContentExtension.h"
+#include "WebCompiledContentRuleList.h"
 #include "WebFrame.h"
 #include "WebPage.h"
 #include "WebProcess.h"
@@ -339,22 +339,22 @@ void WebUserContentController::removeUserScriptMessageHandlerInternal(InjectedBu
 #endif
 
 #if ENABLE(CONTENT_EXTENSIONS)
-void WebUserContentController::addContentExtensions(const Vector<std::pair<String, WebCompiledContentExtensionData>>& contentExtensions)
+void WebUserContentController::addContentRuleLists(const Vector<std::pair<String, WebCompiledContentRuleListData>>& contentRuleLists)
 {
-    for (const auto& contentExtension : contentExtensions) {
-        WebCompiledContentExtensionData contentExtensionData = contentExtension.second;
-        RefPtr<WebCompiledContentExtension> compiledContentExtension = WebCompiledContentExtension::create(WTFMove(contentExtensionData));
+    for (const auto& contentRuleList : contentRuleLists) {
+        WebCompiledContentRuleListData contentRuleListData = contentRuleList.second;
+        RefPtr<WebCompiledContentRuleList> compiledContentRuleList = WebCompiledContentRuleList::create(WTFMove(contentRuleListData));
 
-        m_contentExtensionBackend.addContentExtension(contentExtension.first, WTFMove(compiledContentExtension));
+        m_contentExtensionBackend.addContentExtension(contentRuleList.first, WTFMove(compiledContentRuleList));
     }
 }
 
-void WebUserContentController::removeContentExtension(const String& name)
+void WebUserContentController::removeContentRuleList(const String& name)
 {
     m_contentExtensionBackend.removeContentExtension(name);
 }
 
-void WebUserContentController::removeAllContentExtensions()
+void WebUserContentController::removeAllContentRuleLists()
 {
     m_contentExtensionBackend.removeAllContentExtensions();
 }
index 4edc0e1..9b72d96 100644 (file)
@@ -44,7 +44,7 @@ class CompiledContentExtension;
 namespace WebKit {
 
 class InjectedBundleScriptWorld;
-class WebCompiledContentExtensionData;
+class WebCompiledContentRuleListData;
 class WebUserMessageHandlerDescriptorProxy;
 
 class WebUserContentController final : public WebCore::UserContentProvider, private IPC::MessageReceiver {
@@ -67,7 +67,7 @@ public:
     void addUserStyleSheets(const Vector<WebUserStyleSheetData>&);
     void addUserScriptMessageHandlers(const Vector<WebScriptMessageHandlerData>&);
 #if ENABLE(CONTENT_EXTENSIONS)
-    void addContentExtensions(const Vector<std::pair<String, WebCompiledContentExtensionData>>&);
+    void addContentRuleLists(const Vector<std::pair<String, WebCompiledContentRuleListData>>&);
 #endif
 
 private:
@@ -98,8 +98,8 @@ private:
     void removeAllUserScriptMessageHandlers(const Vector<uint64_t>&);
 
 #if ENABLE(CONTENT_EXTENSIONS)
-    void removeContentExtension(const String& name);
-    void removeAllContentExtensions();
+    void removeContentRuleList(const String& name);
+    void removeAllContentRuleLists();
 #endif
 
     void addUserScriptInternal(InjectedBundleScriptWorld&, uint64_t userScriptIdentifier, WebCore::UserScript&&);
index df3b383..9ac7514 100644 (file)
@@ -40,8 +40,8 @@ messages -> WebUserContentController {
     RemoveAllUserScriptMessageHandlers(Vector<uint64_t> worldIdentifiers);
 
 #if ENABLE(CONTENT_EXTENSIONS)
-    AddContentExtensions(Vector<std::pair<String, WebKit::WebCompiledContentExtensionData>> contentFilters);
-    RemoveContentExtension(String name);
-    RemoveAllContentExtensions();
+    AddContentRuleLists(Vector<std::pair<String, WebKit::WebCompiledContentRuleListData>> contentFilters);
+    RemoveContentRuleList(String name);
+    RemoveAllContentRuleLists();
 #endif
 }
index 0e11782..cb072fc 100644 (file)
@@ -568,7 +568,7 @@ WebPage::WebPage(uint64_t pageID, WebPageCreationParameters&& parameters)
     m_userContentController->addUserStyleSheets(parameters.userStyleSheets);
     m_userContentController->addUserScriptMessageHandlers(parameters.messageHandlers);
 #if ENABLE(CONTENT_EXTENSIONS)
-    m_userContentController->addContentExtensions(parameters.contentExtensions);
+    m_userContentController->addContentRuleLists(parameters.contentRuleLists);
 #endif
 }
 
index 679ec55..10fea01 100644 (file)
@@ -1,3 +1,18 @@
+2017-05-12  Alex Christensen  <achristensen@webkit.org>
+
+        Rename WKContentExtension to WKContentRuleList
+        https://bugs.webkit.org/show_bug.cgi?id=172053
+        <rdar://problem/32141005>
+
+        Reviewed by Geoffrey Garen.
+
+        * TestWebKitAPI/Tests/WebKit2Cocoa/WKContentExtensionStore.mm:
+        (WKContentRuleListStoreTest::SetUp):
+        (TEST_F):
+        (-[ContentRuleListDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]):
+        (WKContentExtensionStoreTest::SetUp): Deleted.
+        (-[ContentExtensionDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]): Deleted.
+
 2017-05-12  Keith Miller  <keith_miller@apple.com>
 
         Use Mach exceptions instead of signals where possible
index 5ef5eea..1454024 100644 (file)
 
 #import "PlatformUtilities.h"
 #import "Test.h"
-#import <WebKit/WKContentExtension.h>
-#import <WebKit/WKContentExtensionStorePrivate.h>
+#import <WebKit/WKContentRuleList.h>
+#import <WebKit/WKContentRuleListStorePrivate.h>
 #import <wtf/RetainPtr.h>
 
-class WKContentExtensionStoreTest : public testing::Test {
+class WKContentRuleListStoreTest : public testing::Test {
 public:
     virtual void SetUp()
     {
-        [[WKContentExtensionStore defaultStore] _removeAllContentExtensions];
+        [[WKContentRuleListStore defaultStore] _removeAllContentRuleLists];
     }
 };
 
 static NSString *basicFilter = @"[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\".*webkit.org\"}}]";
 
-TEST_F(WKContentExtensionStoreTest, Compile)
+TEST_F(WKContentRuleListStoreTest, Compile)
 {
     __block bool doneCompiling = false;
-    [[WKContentExtensionStore defaultStore] compileContentExtensionForIdentifier:@"TestExtension" encodedContentExtension:basicFilter completionHandler:^(WKContentExtension *filter, NSError *error) {
+    [[WKContentRuleListStore defaultStore] compileContentRuleListForIdentifier:@"TestRuleList" encodedContentRuleList:basicFilter completionHandler:^(WKContentRuleList *filter, NSError *error) {
     
         EXPECT_NOT_NULL(filter);
         EXPECT_NULL(error);
@@ -64,26 +64,26 @@ static void checkDomain(NSError *error)
     EXPECT_STREQ([[error domain] UTF8String], [WKErrorDomain UTF8String]);
 }
 
-TEST_F(WKContentExtensionStoreTest, InvalidExtension)
+TEST_F(WKContentRuleListStoreTest, InvalidRuleList)
 {
     __block bool doneCompiling = false;
-    [[WKContentExtensionStore defaultStore] compileContentExtensionForIdentifier:@"TestExtension" encodedContentExtension:invalidFilter completionHandler:^(WKContentExtension *filter, NSError *error) {
+    [[WKContentRuleListStore defaultStore] compileContentRuleListForIdentifier:@"TestRuleList" encodedContentRuleList:invalidFilter completionHandler:^(WKContentRuleList *filter, NSError *error) {
     
         EXPECT_NULL(filter);
         EXPECT_NOT_NULL(error);
         checkDomain(error);
-        EXPECT_EQ(error.code, WKErrorContentExtensionStoreCompileFailed);
-        EXPECT_STREQ("Extension compilation failed: Failed to parse the JSON String.", [[error helpAnchor] UTF8String]);
+        EXPECT_EQ(error.code, WKErrorContentRuleListStoreCompileFailed);
+        EXPECT_STREQ("Rule list compilation failed: Failed to parse the JSON String.", [[error helpAnchor] UTF8String]);
 
         doneCompiling = true;
     }];
     TestWebKitAPI::Util::run(&doneCompiling);
 }
 
-TEST_F(WKContentExtensionStoreTest, Lookup)
+TEST_F(WKContentRuleListStoreTest, Lookup)
 {
     __block bool doneCompiling = false;
-    [[WKContentExtensionStore defaultStore] compileContentExtensionForIdentifier:@"TestExtension" encodedContentExtension:basicFilter completionHandler:^(WKContentExtension *filter, NSError *error) {
+    [[WKContentRuleListStore defaultStore] compileContentRuleListForIdentifier:@"TestRuleList" encodedContentRuleList:basicFilter completionHandler:^(WKContentRuleList *filter, NSError *error) {
     
         EXPECT_NOT_NULL(filter);
         EXPECT_NULL(error);
@@ -93,9 +93,9 @@ TEST_F(WKContentExtensionStoreTest, Lookup)
     TestWebKitAPI::Util::run(&doneCompiling);
 
     __block bool doneLookingUp = false;
-    [[WKContentExtensionStore defaultStore] lookUpContentExtensionForIdentifier:@"TestExtension" completionHandler:^(WKContentExtension *filter, NSError *error) {
+    [[WKContentRuleListStore defaultStore] lookUpContentRuleListForIdentifier:@"TestRuleList" completionHandler:^(WKContentRuleList *filter, NSError *error) {
 
-        EXPECT_STREQ(filter.identifier.UTF8String, "TestExtension");
+        EXPECT_STREQ(filter.identifier.UTF8String, "TestRuleList");
         EXPECT_NOT_NULL(filter);
         EXPECT_NULL(error);
 
@@ -104,17 +104,17 @@ TEST_F(WKContentExtensionStoreTest, Lookup)
     TestWebKitAPI::Util::run(&doneLookingUp);
 }
 
-TEST_F(WKContentExtensionStoreTest, EncodedIdentifier)
+TEST_F(WKContentRuleListStoreTest, EncodedIdentifier)
 {
     // FIXME: U+00C4 causes problems here. Using the output of encodeForFileName with
     // the filesystem changes it to U+0041 followed by U+0308
     NSString *identifier = @":;%25%+25И😍";
     __block bool done = false;
-    [[WKContentExtensionStore defaultStore] compileContentExtensionForIdentifier:identifier encodedContentExtension:basicFilter completionHandler:^(WKContentExtension *filter, NSError *error) {
+    [[WKContentRuleListStore defaultStore] compileContentRuleListForIdentifier:identifier encodedContentRuleList:basicFilter completionHandler:^(WKContentRuleList *filter, NSError *error) {
 
         EXPECT_STREQ(filter.identifier.UTF8String, identifier.UTF8String);
 
-        [[WKContentExtensionStore defaultStore] getAvailableContentExtensionIdentifiers:^(NSArray<NSString *> *identifiers) {
+        [[WKContentRuleListStore defaultStore] getAvailableContentRuleListIdentifiers:^(NSArray<NSString *> *identifiers) {
             EXPECT_EQ(identifiers.count, 1u);
             EXPECT_EQ(identifiers[0].length, identifier.length);
             EXPECT_STREQ(identifiers[0].UTF8String, identifier.UTF8String);
@@ -125,26 +125,26 @@ TEST_F(WKContentExtensionStoreTest, EncodedIdentifier)
     TestWebKitAPI::Util::run(&done);
 }
 
-TEST_F(WKContentExtensionStoreTest, NonExistingIdentifierLookup)
+TEST_F(WKContentRuleListStoreTest, NonExistingIdentifierLookup)
 {
     __block bool doneLookingUp = false;
-    [[WKContentExtensionStore defaultStore] lookUpContentExtensionForIdentifier:@"DoesNotExist" completionHandler:^(WKContentExtension *filter, NSError *error) {
+    [[WKContentRuleListStore defaultStore] lookUpContentRuleListForIdentifier:@"DoesNotExist" completionHandler:^(WKContentRuleList *filter, NSError *error) {
     
         EXPECT_NULL(filter);
         EXPECT_NOT_NULL(error);
         checkDomain(error);
-        EXPECT_EQ(error.code, WKErrorContentExtensionStoreLookUpFailed);
-        EXPECT_STREQ("Extension lookup failed: Unspecified error during lookup.", [[error helpAnchor] UTF8String]);
+        EXPECT_EQ(error.code, WKErrorContentRuleListStoreLookUpFailed);
+        EXPECT_STREQ("Rule list lookup failed: Unspecified error during lookup.", [[error helpAnchor] UTF8String]);
         
         doneLookingUp = true;
     }];
     TestWebKitAPI::Util::run(&doneLookingUp);
 }
 
-TEST_F(WKContentExtensionStoreTest, VersionMismatch)
+TEST_F(WKContentRuleListStoreTest, VersionMismatch)
 {
     __block bool doneCompiling = false;
-    [[WKContentExtensionStore defaultStore] compileContentExtensionForIdentifier:@"TestExtension" encodedContentExtension:basicFilter completionHandler:^(WKContentExtension *filter, NSError *error)
+    [[WKContentRuleListStore defaultStore] compileContentRuleListForIdentifier:@"TestRuleList" encodedContentRuleList:basicFilter completionHandler:^(WKContentRuleList *filter, NSError *error)
     {
         
         EXPECT_NOT_NULL(filter);
@@ -154,34 +154,34 @@ TEST_F(WKContentExtensionStoreTest, VersionMismatch)
     }];
     TestWebKitAPI::Util::run(&doneCompiling);
 
-    [[WKContentExtensionStore defaultStore] _invalidateContentExtensionVersionForIdentifier:@"TestExtension"];
+    [[WKContentRuleListStore defaultStore] _invalidateContentRuleListVersionForIdentifier:@"TestRuleList"];
     
     __block bool doneLookingUp = false;
-    [[WKContentExtensionStore defaultStore] lookUpContentExtensionForIdentifier:@"TestExtension" completionHandler:^(WKContentExtension *filter, NSError *error)
+    [[WKContentRuleListStore defaultStore] lookUpContentRuleListForIdentifier:@"TestRuleList" completionHandler:^(WKContentRuleList *filter, NSError *error)
     {
         
         EXPECT_NULL(filter);
         EXPECT_NOT_NULL(error);
         checkDomain(error);
-        EXPECT_EQ(error.code, WKErrorContentExtensionStoreVersionMismatch);
-        EXPECT_STREQ("Extension lookup failed: Version of file does not match version of interpreter.", [[error helpAnchor] UTF8String]);
+        EXPECT_EQ(error.code, WKErrorContentRuleListStoreVersionMismatch);
+        EXPECT_STREQ("Rule list lookup failed: Version of file does not match version of interpreter.", [[error helpAnchor] UTF8String]);
         
         doneLookingUp = true;
     }];
     TestWebKitAPI::Util::run(&doneLookingUp);
 
     __block bool doneGettingSource = false;
-    [[WKContentExtensionStore defaultStore] _getContentExtensionSourceForIdentifier:@"TestExtension" completionHandler:^(NSString* source) {
+    [[WKContentRuleListStore defaultStore] _getContentRuleListSourceForIdentifier:@"TestRuleList" completionHandler:^(NSString* source) {
         EXPECT_NULL(source);
         doneGettingSource = true;
     }];
     TestWebKitAPI::Util::run(&doneGettingSource);
 }
 
-TEST_F(WKContentExtensionStoreTest, Removal)
+TEST_F(WKContentRuleListStoreTest, Removal)
 {
     __block bool doneCompiling = false;
-    [[WKContentExtensionStore defaultStore] compileContentExtensionForIdentifier:@"TestExtension" encodedContentExtension:basicFilter completionHandler:^(WKContentExtension *filter, NSError *error) {
+    [[WKContentRuleListStore defaultStore] compileContentRuleListForIdentifier:@"TestRuleList" encodedContentRuleList:basicFilter completionHandler:^(WKContentRuleList *filter, NSError *error) {
     
         EXPECT_NOT_NULL(filter);
         EXPECT_NULL(error);
@@ -191,7 +191,7 @@ TEST_F(WKContentExtensionStoreTest, Removal)
     TestWebKitAPI::Util::run(&doneCompiling);
 
     __block bool doneRemoving = false;
-    [[WKContentExtensionStore defaultStore] removeContentExtensionForIdentifier:@"TestExtension" completionHandler:^(NSError *error) {
+    [[WKContentRuleListStore defaultStore] removeContentRuleListForIdentifier:@"TestRuleList" completionHandler:^(NSError *error) {
         EXPECT_NULL(error);
 
         doneRemoving = true;
@@ -199,29 +199,29 @@ TEST_F(WKContentExtensionStoreTest, Removal)
     TestWebKitAPI::Util::run(&doneRemoving);
 }
 
-TEST_F(WKContentExtensionStoreTest, NonExistingIdentifierRemove)
+TEST_F(WKContentRuleListStoreTest, NonExistingIdentifierRemove)
 {
     __block bool doneRemoving = false;
-    [[WKContentExtensionStore defaultStore] removeContentExtensionForIdentifier:@"DoesNotExist" completionHandler:^(NSError *error) {
+    [[WKContentRuleListStore defaultStore] removeContentRuleListForIdentifier:@"DoesNotExist" completionHandler:^(NSError *error) {
         EXPECT_NOT_NULL(error);
         checkDomain(error);
-        EXPECT_EQ(error.code, WKErrorContentExtensionStoreRemoveFailed);
-        EXPECT_STREQ("Extension removal failed: Unspecified error during remove.", [[error helpAnchor] UTF8String]);
+        EXPECT_EQ(error.code, WKErrorContentRuleListStoreRemoveFailed);
+        EXPECT_STREQ("Rule list removal failed: Unspecified error during remove.", [[error helpAnchor] UTF8String]);
 
         doneRemoving = true;
     }];
     TestWebKitAPI::Util::run(&doneRemoving);
 }
 
-TEST_F(WKContentExtensionStoreTest, NonDefaultStore)
+TEST_F(WKContentRuleListStoreTest, NonDefaultStore)
 {
-    NSURL *tempDir = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"ContentExtensionTest"] isDirectory:YES];
-    WKContentExtensionStore *store = [WKContentExtensionStore storeWithURL:tempDir];
-    NSString *identifier = @"TestExtension";
-    NSString *fileName = @"ContentExtension-TestExtension";
+    NSURL *tempDir = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"ContentRuleListTest"] isDirectory:YES];
+    WKContentRuleListStore *store = [WKContentRuleListStore storeWithURL:tempDir];
+    NSString *identifier = @"TestRuleList";
+    NSString *fileName = @"ContentRuleList-TestRuleList";
 
     __block bool doneGettingAvailableIdentifiers = false;
-    [store getAvailableContentExtensionIdentifiers:^(NSArray<NSString *> *identifiers) {
+    [store getAvailableContentRuleListIdentifiers:^(NSArray<NSString *> *identifiers) {
         EXPECT_NOT_NULL(identifiers);
         EXPECT_EQ(identifiers.count, 0u);
         doneGettingAvailableIdentifiers = true;
@@ -229,7 +229,7 @@ TEST_F(WKContentExtensionStoreTest, NonDefaultStore)
     TestWebKitAPI::Util::run(&doneGettingAvailableIdentifiers);
     
     __block bool doneCompiling = false;
-    [store compileContentExtensionForIdentifier:identifier encodedContentExtension:basicFilter completionHandler:^(WKContentExtension *filter, NSError *error) {
+    [store compileContentRuleListForIdentifier:identifier encodedContentRuleList:basicFilter completionHandler:^(WKContentRuleList *filter, NSError *error) {
         EXPECT_NOT_NULL(filter);
         EXPECT_NULL(error);
         doneCompiling = true;
@@ -237,10 +237,10 @@ TEST_F(WKContentExtensionStoreTest, NonDefaultStore)
     TestWebKitAPI::Util::run(&doneCompiling);
 
     doneGettingAvailableIdentifiers = false;
-    [store getAvailableContentExtensionIdentifiers:^(NSArray<NSString *> *identifiers) {
+    [store getAvailableContentRuleListIdentifiers:^(NSArray<NSString *> *identifiers) {
         EXPECT_NOT_NULL(identifiers);
         EXPECT_EQ(identifiers.count, 1u);
-        EXPECT_STREQ(identifiers[0].UTF8String, "TestExtension");
+        EXPECT_STREQ(identifiers[0].UTF8String, "TestRuleList");
         doneGettingAvailableIdentifiers = true;
     }];
     TestWebKitAPI::Util::run(&doneGettingAvailableIdentifiers);
@@ -250,7 +250,7 @@ TEST_F(WKContentExtensionStoreTest, NonDefaultStore)
     EXPECT_EQ(data.length, 228u);
     
     __block bool doneCheckingSource = false;
-    [store _getContentExtensionSourceForIdentifier:identifier completionHandler:^(NSString *source) {
+    [store _getContentRuleListSourceForIdentifier:identifier completionHandler:^(NSString *source) {
         EXPECT_NOT_NULL(source);
         EXPECT_STREQ(basicFilter.UTF8String, source.UTF8String);
         doneCheckingSource = true;
@@ -258,7 +258,7 @@ TEST_F(WKContentExtensionStoreTest, NonDefaultStore)
     TestWebKitAPI::Util::run(&doneCheckingSource);
     
     __block bool doneRemoving = false;
-    [store removeContentExtensionForIdentifier:identifier completionHandler:^(NSError *error) {
+    [store removeContentRuleListForIdentifier:identifier completionHandler:^(NSError *error) {
         EXPECT_NULL(error);
         doneRemoving = true;
     }];
@@ -268,20 +268,20 @@ TEST_F(WKContentExtensionStoreTest, NonDefaultStore)
     EXPECT_NULL(dataAfterRemoving);
 }
 
-TEST_F(WKContentExtensionStoreTest, MultipleExtensions)
+TEST_F(WKContentRuleListStoreTest, MultipleRuleLists)
 {
     __block bool done = false;
-    [[WKContentExtensionStore defaultStore] compileContentExtensionForIdentifier:@"FirstExtension" encodedContentExtension:basicFilter completionHandler:^(WKContentExtension *filter, NSError *error) {
+    [[WKContentRuleListStore defaultStore] compileContentRuleListForIdentifier:@"FirstRuleList" encodedContentRuleList:basicFilter completionHandler:^(WKContentRuleList *filter, NSError *error) {
         EXPECT_NOT_NULL(filter);
         EXPECT_NULL(error);
-        [[WKContentExtensionStore defaultStore] compileContentExtensionForIdentifier:@"SecondExtension" encodedContentExtension:basicFilter completionHandler:^(WKContentExtension *filter, NSError *error) {
+        [[WKContentRuleListStore defaultStore] compileContentRuleListForIdentifier:@"SecondRuleList" encodedContentRuleList:basicFilter completionHandler:^(WKContentRuleList *filter, NSError *error) {
             EXPECT_NOT_NULL(filter);
             EXPECT_NULL(error);
-            [[WKContentExtensionStore defaultStore] getAvailableContentExtensionIdentifiers:^(NSArray<NSString *> *identifiers) {
+            [[WKContentRuleListStore defaultStore] getAvailableContentRuleListIdentifiers:^(NSArray<NSString *> *identifiers) {
                 EXPECT_NOT_NULL(identifiers);
                 EXPECT_EQ(identifiers.count, 2u);
-                EXPECT_STREQ(identifiers[0].UTF8String, "FirstExtension");
-                EXPECT_STREQ(identifiers[1].UTF8String, "SecondExtension");
+                EXPECT_STREQ(identifiers[0].UTF8String, "FirstRuleList");
+                EXPECT_STREQ(identifiers[1].UTF8String, "SecondRuleList");
                 done = true;
             }];
         }];
@@ -289,24 +289,24 @@ TEST_F(WKContentExtensionStoreTest, MultipleExtensions)
     TestWebKitAPI::Util::run(&done);
 }
 
-TEST_F(WKContentExtensionStoreTest, NonASCIISource)
+TEST_F(WKContentRuleListStoreTest, NonASCIISource)
 {
     static NSString *nonASCIIFilter = @"[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\".*webkit.org\"}, \"unused\":\"💩\"}]";
-    NSURL *tempDir = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"ContentExtensionTest"] isDirectory:YES];
-    WKContentExtensionStore *store = [WKContentExtensionStore storeWithURL:tempDir];
-    NSString *identifier = @"TestExtension";
-    NSString *fileName = @"ContentExtension-TestExtension";
+    NSURL *tempDir = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"ContentRuleListTest"] isDirectory:YES];
+    WKContentRuleListStore *store = [WKContentRuleListStore storeWithURL:tempDir];
+    NSString *identifier = @"TestRuleList";
+    NSString *fileName = @"ContentRuleList-TestRuleList";
     
     __block bool done = false;
-    [store compileContentExtensionForIdentifier:identifier encodedContentExtension:nonASCIIFilter completionHandler:^(WKContentExtension *filter, NSError *error) {
+    [store compileContentRuleListForIdentifier:identifier encodedContentRuleList:nonASCIIFilter completionHandler:^(WKContentRuleList *filter, NSError *error) {
         EXPECT_NOT_NULL(filter);
         EXPECT_NULL(error);
 
-        [store _getContentExtensionSourceForIdentifier:identifier completionHandler:^(NSString *source) {
+        [store _getContentRuleListSourceForIdentifier:identifier completionHandler:^(NSString *source) {
             EXPECT_NOT_NULL(source);
             EXPECT_STREQ(nonASCIIFilter.UTF8String, source.UTF8String);
 
-            [store _removeAllContentExtensions];
+            [store _removeAllContentRuleLists];
             NSData *dataAfterRemoving = [NSData dataWithContentsOfURL:[tempDir URLByAppendingPathComponent:fileName]];
             EXPECT_NULL(dataAfterRemoving);
 
@@ -319,10 +319,10 @@ TEST_F(WKContentExtensionStoreTest, NonASCIISource)
 static size_t alertCount { 0 };
 static bool receivedAlert { false };
 
-@interface ContentExtensionDelegate : NSObject <WKUIDelegate>
+@interface ContentRuleListDelegate : NSObject <WKUIDelegate>
 @end
 
-@implementation ContentExtensionDelegate
+@implementation ContentRuleListDelegate
 
 - (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler
 {
@@ -332,7 +332,7 @@ static bool receivedAlert { false };
         EXPECT_STREQ("content blockers enabled", message.UTF8String);
         break;
     case 1:
-        // After having removed the content extension.
+        // After having removed the content RuleList.
         EXPECT_STREQ("content blockers disabled", message.UTF8String);
         break;
     default:
@@ -344,27 +344,27 @@ static bool receivedAlert { false };
 
 @end
 
-TEST_F(WKContentExtensionStoreTest, AddRemove)
+TEST_F(WKContentRuleListStoreTest, AddRemove)
 {
-    [[WKContentExtensionStore defaultStore] _removeAllContentExtensions];
+    [[WKContentRuleListStore defaultStore] _removeAllContentRuleLists];
 
     __block bool doneCompiling = false;
     NSString* contentBlocker = @"[{\"action\":{\"type\":\"css-display-none\",\"selector\":\".hidden\"},\"trigger\":{\"url-filter\":\".*\"}}]";
-    __block RetainPtr<WKContentExtension> extension;
-    [[WKContentExtensionStore defaultStore] compileContentExtensionForIdentifier:@"TestAddRemove" encodedContentExtension:contentBlocker completionHandler:^(WKContentExtension *compiledExtension, NSError *error) {
+    __block RetainPtr<WKContentRuleList> ruleList;
+    [[WKContentRuleListStore defaultStore] compileContentRuleListForIdentifier:@"TestAddRemove" encodedContentRuleList:contentBlocker completionHandler:^(WKContentRuleList *compiledRuleList, NSError *error) {
         EXPECT_TRUE(error == nil);
-        extension = compiledExtension;
+        ruleList = compiledRuleList;
         doneCompiling = true;
     }];
     TestWebKitAPI::Util::run(&doneCompiling);
-    EXPECT_NOT_NULL(extension);
+    EXPECT_NOT_NULL(ruleList);
 
     auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
-    [[configuration userContentController] addContentExtension:extension.get()];
+    [[configuration userContentController] addContentRuleList:ruleList.get()];
 
     auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
 
-    auto delegate = adoptNS([[ContentExtensionDelegate alloc] init]);
+    auto delegate = adoptNS([[ContentRuleListDelegate alloc] init]);
     [webView setUIDelegate:delegate.get()];
 
     NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"contentBlockerCheck" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
@@ -373,7 +373,7 @@ TEST_F(WKContentExtensionStoreTest, AddRemove)
     [webView loadRequest:request];
     TestWebKitAPI::Util::run(&receivedAlert);
 
-    [[configuration userContentController] removeContentExtension:extension.get()];
+    [[configuration userContentController] removeContentRuleList:ruleList.get()];
 
     receivedAlert = false;
     [webView reload];
index 4839533..6b9be46 100644 (file)
@@ -72,7 +72,7 @@ TEST_F(_WKUserContentExtensionStoreTest, InvalidExtension)
         EXPECT_NOT_NULL(error);
         checkDomain(error);
         EXPECT_EQ(error.code, _WKUserContentExtensionStoreErrorCompileFailed);
-        EXPECT_STREQ("Extension compilation failed: Failed to parse the JSON String.", [[error helpAnchor] UTF8String]);
+        EXPECT_STREQ("Rule list compilation failed: Failed to parse the JSON String.", [[error helpAnchor] UTF8String]);
 
         doneCompiling = true;
     }];
@@ -111,7 +111,7 @@ TEST_F(_WKUserContentExtensionStoreTest, NonExistingIdentifierLookup)
         EXPECT_NOT_NULL(error);
         checkDomain(error);
         EXPECT_EQ(error.code, _WKUserContentExtensionStoreErrorLookupFailed);
-        EXPECT_STREQ("Extension lookup failed: Unspecified error during lookup.", [[error helpAnchor] UTF8String]);
+        EXPECT_STREQ("Rule list lookup failed: Unspecified error during lookup.", [[error helpAnchor] UTF8String]);
         
         doneLookingUp = true;
     }];
@@ -141,7 +141,7 @@ TEST_F(_WKUserContentExtensionStoreTest, VersionMismatch)
         EXPECT_NOT_NULL(error);
         checkDomain(error);
         EXPECT_EQ(error.code, _WKUserContentExtensionStoreErrorVersionMismatch);
-        EXPECT_STREQ("Extension lookup failed: Version of file does not match version of interpreter.", [[error helpAnchor] UTF8String]);
+        EXPECT_STREQ("Rule list lookup failed: Version of file does not match version of interpreter.", [[error helpAnchor] UTF8String]);
         
         doneLookingUp = true;
     }];
@@ -176,7 +176,7 @@ TEST_F(_WKUserContentExtensionStoreTest, NonExistingIdentifierRemove)
         EXPECT_NOT_NULL(error);
         checkDomain(error);
         EXPECT_EQ(error.code, _WKUserContentExtensionStoreErrorRemoveFailed);
-        EXPECT_STREQ("Extension removal failed: Unspecified error during remove.", [[error helpAnchor] UTF8String]);
+        EXPECT_STREQ("Rule list removal failed: Unspecified error during remove.", [[error helpAnchor] UTF8String]);
 
         doneRemoving = true;
     }];