Changeset 216809 in webkit


Ignore:
Timestamp:
May 12, 2017, 6:33:13 PM (8 years ago)
Author:
achristensen@apple.com
Message:

Rename WKContentExtension to WKContentRuleList
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.

Location:
trunk
Files:
36 edited
16 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r216807 r216809  
     12017-05-12  Alex Christensen  <achristensen@webkit.org>
     2
     3        Rename WKContentExtension to WKContentRuleList
     4        https://bugs.webkit.org/show_bug.cgi?id=172053
     5        <rdar://problem/32141005>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        Covered by existing API tests.
     10
     11        * English.lproj/Localizable.strings:
     12
    1132017-05-12  Timothy Horton  <timothy_horton@apple.com>
    214
  • trunk/Source/WebCore/English.lproj/Localizable.strings

    r216007 r216809  
    164164"Click to restart" = "Click to restart";
    165165
    166 /* WKErrorContentExtensionStoreCompileFailed description */
    167 "Compiling a WKUserContentExtension failed" = "Compiling a WKUserContentExtension failed";
     166/* WKErrorContentRuleListStoreCompileFailed description */
     167"Compiling a WKContentRuleList failed" = "Compiling a WKContentRuleList failed";
    168168
    169169/* WebKitErrorCannotShowMIMEType description */
     
    353353"Look Up “%s”" = "Look Up “%s”";
    354354
    355 /* WKErrorContentExtensionStoreLookupFailed description */
    356 "Looking up a WKUserContentExtension failed" = "Looking up a WKUserContentExtension failed";
    357 
    358 /* WKErrorContentExtensionStoreVersionMismatch description */
    359 "Looking up a WKUserContentExtension found a binary that is incompatible" = "Looking up a WKUserContentExtension found a binary that is incompatible";
     355/* WKErrorContentRuleListStoreLookupFailed description */
     356"Looking up a WKContentRuleList failed" = "Looking up a WKContentRuleList failed";
     357
     358/* WKErrorContentRuleListStoreVersionMismatch description */
     359"Looking up a WKContentRuleList found a binary that is incompatible" = "Looking up a WKContentRuleList found a binary that is incompatible";
    360360
    361361/* Media Loop context menu item */
     
    497497"Reload" = "Reload";
    498498
    499 /* WKErrorContentExtensionStoreRemoveFailed description */
    500 "Removing a WKUserContentExtension failed" = "Removing a WKUserContentExtension failed";
     499/* WKErrorContentRuleListStoreRemoveFailed description */
     500"Removing a WKContentRuleList failed" = "Removing a WKContentRuleList failed";
    501501
    502502/* default label for Reset buttons in forms on web pages */
  • trunk/Source/WebKit2/CMakeLists.txt

    r216696 r216809  
    183183    Shared/VisitedLinkTable.cpp
    184184    Shared/WebBackForwardListItem.cpp
    185     Shared/WebCompiledContentExtension.cpp
    186     Shared/WebCompiledContentExtensionData.cpp
     185    Shared/WebCompiledContentRuleList.cpp
     186    Shared/WebCompiledContentRuleListData.cpp
    187187    Shared/WebConnection.cpp
    188188    Shared/WebConnectionClient.cpp
     
    331331    UIProcess/WebViewportAttributes.cpp
    332332
    333     UIProcess/API/APIContentExtension.cpp
    334     UIProcess/API/APIContentExtensionStore.cpp
     333    UIProcess/API/APIContentRuleList.cpp
     334    UIProcess/API/APIContentRuleListStore.cpp
    335335    UIProcess/API/APIExperimentalFeature.cpp
    336336    UIProcess/API/APIFrameInfo.cpp
  • trunk/Source/WebKit2/ChangeLog

    r216806 r216809  
     12017-05-12  Alex Christensen  <achristensen@webkit.org>
     2
     3        Rename WKContentExtension to WKContentRuleList
     4        https://bugs.webkit.org/show_bug.cgi?id=172053
     5        <rdar://problem/32141005>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        * Shared/API/APIObject.h:
     10        * Shared/API/Cocoa/WebKit.h:
     11        * Shared/API/c/WKDeprecatedFunctions.cpp:
     12        (WKPageGroupAddUserContentFilter):
     13        (WKPageGroupRemoveUserContentFilter):
     14        * Shared/Cocoa/APIObject.mm:
     15        (API::Object::newObject):
     16        * Shared/WebCompiledContentExtension.cpp: Removed.
     17        * Shared/WebCompiledContentExtension.h: Removed.
     18        * Shared/WebCompiledContentExtensionData.cpp: Removed.
     19        * Shared/WebCompiledContentExtensionData.h: Removed.
     20        * Shared/WebCompiledContentRuleList.cpp: Copied from Source/WebKit2/Shared/WebCompiledContentExtension.cpp.
     21        (WebKit::WebCompiledContentRuleList::create):
     22        (WebKit::WebCompiledContentRuleList::WebCompiledContentRuleList):
     23        (WebKit::WebCompiledContentRuleList::~WebCompiledContentRuleList):
     24        (WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain):
     25        (WebKit::WebCompiledContentRuleList::filtersWithoutConditionsBytecode):
     26        (WebKit::WebCompiledContentRuleList::filtersWithoutConditionsBytecodeLength):
     27        (WebKit::WebCompiledContentRuleList::filtersWithConditionsBytecode):
     28        (WebKit::WebCompiledContentRuleList::filtersWithConditionsBytecodeLength):
     29        (WebKit::WebCompiledContentRuleList::topURLFiltersBytecode):
     30        (WebKit::WebCompiledContentRuleList::topURLFiltersBytecodeLength):
     31        (WebKit::WebCompiledContentRuleList::actions):
     32        (WebKit::WebCompiledContentRuleList::actionsLength):
     33        (WebKit::WebCompiledContentExtension::create): Deleted.
     34        (WebKit::WebCompiledContentExtension::WebCompiledContentExtension): Deleted.
     35        (WebKit::WebCompiledContentExtension::~WebCompiledContentExtension): Deleted.
     36        (WebKit::WebCompiledContentExtension::conditionsApplyOnlyToDomain): Deleted.
     37        (WebKit::WebCompiledContentExtension::filtersWithoutConditionsBytecode): Deleted.
     38        (WebKit::WebCompiledContentExtension::filtersWithoutConditionsBytecodeLength): Deleted.
     39        (WebKit::WebCompiledContentExtension::filtersWithConditionsBytecode): Deleted.
     40        (WebKit::WebCompiledContentExtension::filtersWithConditionsBytecodeLength): Deleted.
     41        (WebKit::WebCompiledContentExtension::topURLFiltersBytecode): Deleted.
     42        (WebKit::WebCompiledContentExtension::topURLFiltersBytecodeLength): Deleted.
     43        (WebKit::WebCompiledContentExtension::actions): Deleted.
     44        (WebKit::WebCompiledContentExtension::actionsLength): Deleted.
     45        * Shared/WebCompiledContentRuleList.h: Copied from Source/WebKit2/Shared/WebCompiledContentExtension.h.
     46        * Shared/WebCompiledContentRuleListData.cpp: Copied from Source/WebKit2/Shared/WebCompiledContentExtensionData.cpp.
     47        (WebKit::WebCompiledContentRuleListData::encode):
     48        (WebKit::WebCompiledContentRuleListData::decode):
     49        (WebKit::WebCompiledContentExtensionData::encode): Deleted.
     50        (WebKit::WebCompiledContentExtensionData::decode): Deleted.
     51        * Shared/WebCompiledContentRuleListData.h: Copied from Source/WebKit2/Shared/WebCompiledContentExtensionData.h.
     52        (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
     53        (WebKit::WebCompiledContentExtensionData::WebCompiledContentExtensionData): Deleted.
     54        * Shared/WebPageCreationParameters.cpp:
     55        (WebKit::WebPageCreationParameters::encode):
     56        (WebKit::WebPageCreationParameters::decode):
     57        * Shared/WebPageCreationParameters.h:
     58        * UIProcess/API/APIContentExtension.cpp: Removed.
     59        * UIProcess/API/APIContentExtension.h: Removed.
     60        * UIProcess/API/APIContentExtensionStore.cpp: Removed.
     61        * UIProcess/API/APIContentExtensionStore.h: Removed.
     62        * UIProcess/API/APIContentRuleList.cpp: Copied from Source/WebKit2/UIProcess/API/APIContentExtension.cpp.
     63        (API::ContentRuleList::ContentRuleList):
     64        (API::ContentRuleList::~ContentRuleList):
     65        (API::ContentExtension::ContentExtension): Deleted.
     66        (API::ContentExtension::~ContentExtension): Deleted.
     67        * UIProcess/API/APIContentRuleList.h: Copied from Source/WebKit2/UIProcess/API/APIContentExtension.h.
     68        * UIProcess/API/APIContentRuleListStore.cpp: Copied from Source/WebKit2/UIProcess/API/APIContentExtensionStore.cpp.
     69        (API::ContentRuleListStore::legacyDefaultStore):
     70        (API::ContentRuleListStore::nonLegacyDdefaultStore):
     71        (API::ContentRuleListStore::defaultStore):
     72        (API::ContentRuleListStore::storeWithPath):
     73        (API::ContentRuleListStore::ContentRuleListStore):
     74        (API::ContentRuleListStore::~ContentRuleListStore):
     75        (API::constructedPathPrefix):
     76        (API::ContentRuleListMetaData::fileSize):
     77        (API::encodeContentRuleListMetaData):
     78        (API::decodeContentRuleListMetaData):
     79        (API::openAndMapContentRuleList):
     80        (API::compiledToFile):
     81        (API::createExtension):
     82        (API::ContentRuleListStore::lookupContentRuleList):
     83        (API::ContentRuleListStore::getAvailableContentRuleListIdentifiers):
     84        (API::ContentRuleListStore::compileContentRuleList):
     85        (API::ContentRuleListStore::removeContentRuleList):
     86        (API::ContentRuleListStore::synchronousRemoveAllContentRuleLists):
     87        (API::ContentRuleListStore::invalidateContentRuleListVersion):
     88        (API::ContentRuleListStore::getContentRuleListSource):
     89        (API::contentRuleListStoreErrorCategory):
     90        (API::ContentExtensionStore::defaultStore): Deleted.
     91        (API::ContentExtensionStore::storeWithPath): Deleted.
     92        (API::ContentExtensionStore::ContentExtensionStore): Deleted.
     93        (API::ContentExtensionStore::~ContentExtensionStore): Deleted.
     94        (API::ContentExtensionMetaData::fileSize): Deleted.
     95        (API::encodeContentExtensionMetaData): Deleted.
     96        (API::decodeContentExtensionMetaData): Deleted.
     97        (API::openAndMapContentExtension): Deleted.
     98        (API::ContentExtensionStore::lookupContentExtension): Deleted.
     99        (API::ContentExtensionStore::getAvailableContentExtensionIdentifiers): Deleted.
     100        (API::ContentExtensionStore::compileContentExtension): Deleted.
     101        (API::ContentExtensionStore::removeContentExtension): Deleted.
     102        (API::ContentExtensionStore::synchronousRemoveAllContentExtensions): Deleted.
     103        (API::ContentExtensionStore::invalidateContentExtensionVersion): Deleted.
     104        (API::ContentExtensionStore::getContentExtensionSource): Deleted.
     105        (API::contentExtensionStoreErrorCategory): Deleted.
     106        * UIProcess/API/APIContentRuleListStore.h: Copied from Source/WebKit2/UIProcess/API/APIContentExtensionStore.h.
     107        (API::make_error_code):
     108        * UIProcess/API/C/WKAPICast.h:
     109        * UIProcess/API/C/WKPageGroup.cpp:
     110        * UIProcess/API/C/WKUserContentControllerRef.cpp:
     111        (WKUserContentControllerAddUserContentFilter):
     112        (WKUserContentControllerRemoveAllUserContentFilters):
     113        * UIProcess/API/C/WKUserContentExtensionStoreRef.cpp:
     114        (WKUserContentExtensionStoreGetTypeID):
     115        * UIProcess/API/Cocoa/APIUserContentExtensionStoreCocoa.mm:
     116        (API::ContentRuleListStore::defaultStorePath):
     117        (API::ContentExtensionStore::defaultStorePath): Deleted.
     118        * UIProcess/API/Cocoa/WKContentExtension.h: Removed.
     119        * UIProcess/API/Cocoa/WKContentExtension.mm: Removed.
     120        * UIProcess/API/Cocoa/WKContentExtensionInternal.h: Removed.
     121        * UIProcess/API/Cocoa/WKContentExtensionStore.h: Removed.
     122        * UIProcess/API/Cocoa/WKContentExtensionStore.mm: Removed.
     123        * UIProcess/API/Cocoa/WKContentExtensionStoreInternal.h: Removed.
     124        * UIProcess/API/Cocoa/WKContentExtensionStorePrivate.h: Removed.
     125        * UIProcess/API/Cocoa/WKContentRuleList.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtension.h.
     126        * UIProcess/API/Cocoa/WKContentRuleList.mm: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtension.mm.
     127        (-[WKContentRuleList dealloc]):
     128        (-[WKContentRuleList _apiObject]):
     129        (-[WKContentRuleList identifier]):
     130        (-[WKContentExtension dealloc]): Deleted.
     131        (-[WKContentExtension _apiObject]): Deleted.
     132        (-[WKContentExtension identifier]): Deleted.
     133        * UIProcess/API/Cocoa/WKContentRuleListInternal.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionInternal.h.
     134        (WebKit::wrapper):
     135        * UIProcess/API/Cocoa/WKContentRuleListStore.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStore.h.
     136        * UIProcess/API/Cocoa/WKContentRuleListStore.mm: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStore.mm.
     137        (toWKErrorCode):
     138        (-[WKContentRuleListStore dealloc]):
     139        (+[WKContentRuleListStore defaultStore]):
     140        (+[WKContentRuleListStore storeWithURL:]):
     141        (-[WKContentRuleListStore compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:]):
     142        (-[WKContentRuleListStore _compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:releasesArgument:]):
     143        (-[WKContentRuleListStore lookUpContentRuleListForIdentifier:completionHandler:]):
     144        (-[WKContentRuleListStore getAvailableContentRuleListIdentifiers:]):
     145        (-[WKContentRuleListStore removeContentRuleListForIdentifier:completionHandler:]):
     146        (-[WKContentRuleListStore _apiObject]):
     147        (-[WKContentRuleListStore _removeAllContentRuleLists]):
     148        (-[WKContentRuleListStore _invalidateContentRuleListVersionForIdentifier:]):
     149        (-[WKContentRuleListStore _getContentRuleListSourceForIdentifier:completionHandler:]):
     150        (-[WKContentRuleListStore _compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:]):
     151        (-[WKContentExtensionStore dealloc]): Deleted.
     152        (+[WKContentExtensionStore defaultStore]): Deleted.
     153        (+[WKContentExtensionStore storeWithURL:]): Deleted.
     154        (-[WKContentExtensionStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]): Deleted.
     155        (-[WKContentExtensionStore _compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:releasesArgument:]): Deleted.
     156        (-[WKContentExtensionStore lookUpContentExtensionForIdentifier:completionHandler:]): Deleted.
     157        (-[WKContentExtensionStore getAvailableContentExtensionIdentifiers:]): Deleted.
     158        (-[WKContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]): Deleted.
     159        (-[WKContentExtensionStore _apiObject]): Deleted.
     160        (-[WKContentExtensionStore _removeAllContentExtensions]): Deleted.
     161        (-[WKContentExtensionStore _invalidateContentExtensionVersionForIdentifier:]): Deleted.
     162        (-[WKContentExtensionStore _getContentExtensionSourceForIdentifier:completionHandler:]): Deleted.
     163        (-[WKContentExtensionStore _compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]): Deleted.
     164        * UIProcess/API/Cocoa/WKContentRuleListStoreInternal.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStoreInternal.h.
     165        (WebKit::wrapper):
     166        * UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStorePrivate.h.
     167        * UIProcess/API/Cocoa/WKError.h:
     168        * UIProcess/API/Cocoa/WKError.mm:
     169        (localizedDescriptionForErrorCode):
     170        * UIProcess/API/Cocoa/WKUserContentController.h:
     171        * UIProcess/API/Cocoa/WKUserContentController.mm:
     172        (-[WKUserContentController addContentRuleList:]):
     173        (-[WKUserContentController removeContentRuleList:]):
     174        (-[WKUserContentController removeAllContentRuleLists]):
     175        (-[WKUserContentController _addUserContentFilter:]):
     176        (-[WKUserContentController _removeUserContentFilter:]):
     177        (-[WKUserContentController _removeAllUserContentFilters]):
     178        (-[WKUserContentController addContentExtension:]): Deleted.
     179        (-[WKUserContentController removeContentExtension:]): Deleted.
     180        (-[WKUserContentController removeAllContentExtensions]): Deleted.
     181        * UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm:
     182        (toUserContentRuleListStoreError):
     183        (+[_WKUserContentExtensionStore defaultStore]):
     184        (+[_WKUserContentExtensionStore storeWithURL:]):
     185        (-[_WKUserContentExtensionStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]):
     186        (-[_WKUserContentExtensionStore lookupContentExtensionForIdentifier:completionHandler:]):
     187        (-[_WKUserContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]):
     188        (-[_WKUserContentExtensionStore _apiObject]):
     189        (-[_WKUserContentExtensionStore _removeAllContentExtensions]):
     190        (-[_WKUserContentExtensionStore _invalidateContentExtensionVersionForIdentifier:]):
     191        (-[_WKUserContentExtensionStore _initWithWKContentRuleListStore:]):
     192        (toUserContentExtensionStoreError): Deleted.
     193        (-[_WKUserContentExtensionStore _initWithWKContentExtensionStore:]): Deleted.
     194        * UIProcess/API/Cocoa/_WKUserContentExtensionStoreInternal.h:
     195        * UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h:
     196        * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
     197        (-[_WKUserContentFilter _apiObject]):
     198        (-[_WKUserContentFilter _initWithWKContentRuleList:]):
     199        (-[_WKUserContentFilter _initWithWKContentExtension:]): Deleted.
     200        * UIProcess/API/Cocoa/_WKUserContentFilterInternal.h:
     201        * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
     202        * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
     203        (WebKit::WebUserContentControllerProxy::addProcess):
     204        (WebKit::WebUserContentControllerProxy::addContentRuleList):
     205        (WebKit::WebUserContentControllerProxy::removeContentRuleList):
     206        (WebKit::WebUserContentControllerProxy::removeAllContentRuleLists):
     207        (WebKit::WebUserContentControllerProxy::addContentExtension): Deleted.
     208        (WebKit::WebUserContentControllerProxy::removeContentExtension): Deleted.
     209        (WebKit::WebUserContentControllerProxy::removeAllContentExtensions): Deleted.
     210        * UIProcess/UserContent/WebUserContentControllerProxy.h:
     211        * UIProcess/WebPageGroup.cpp:
     212        * WebKit2.xcodeproj/project.pbxproj:
     213        * WebProcess/UserContent/WebUserContentController.cpp:
     214        (WebKit::WebUserContentController::addContentRuleLists):
     215        (WebKit::WebUserContentController::removeContentRuleList):
     216        (WebKit::WebUserContentController::removeAllContentRuleLists):
     217        (WebKit::WebUserContentController::addContentExtensions): Deleted.
     218        (WebKit::WebUserContentController::removeContentExtension): Deleted.
     219        (WebKit::WebUserContentController::removeAllContentExtensions): Deleted.
     220        * WebProcess/UserContent/WebUserContentController.h:
     221        * WebProcess/UserContent/WebUserContentController.messages.in:
     222        * WebProcess/WebPage/WebPage.cpp:
     223        (WebKit::m_backgroundCPULimit):
     224
    12252017-05-12  Jeremy Jones  <jeremyj@apple.com>
    2226
  • trunk/Source/WebKit2/PlatformMac.cmake

    r216248 r216809  
    183183    UIProcess/API/C/mac/WKPagePrivateMac.mm
    184184
     185    UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm
    185186    UIProcess/API/Cocoa/APISerializedScriptValueCocoa.mm
    186     UIProcess/API/Cocoa/APIUserContentExtensionStoreCocoa.mm
    187187    UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm
    188188    UIProcess/API/Cocoa/LegacyBundleForClass.mm
     
    192192    UIProcess/API/Cocoa/WKBrowsingContextGroup.mm
    193193    UIProcess/API/Cocoa/WKConnection.mm
    194     UIProcess/API/Cocoa/WKContentExtension.mm
    195     UIProcess/API/Cocoa/WKContentExtensionStore.mm
     194    UIProcess/API/Cocoa/WKContentRuleList.mm
     195    UIProcess/API/Cocoa/WKContentRuleListStore.mm
    196196    UIProcess/API/Cocoa/WKError.mm
    197197    UIProcess/API/Cocoa/WKFrameInfo.mm
  • trunk/Source/WebKit2/Shared/API/APIObject.h

    r216696 r216809  
    104104        CacheManager,
    105105        ColorPickerResultListener,
    106         ContentExtension,
    107         ContentExtensionStore,
     106        ContentRuleList,
     107        ContentRuleListStore,
    108108        ContextMenuListener,
    109109        CookieManager,
  • trunk/Source/WebKit2/Shared/API/Cocoa/WebKit.h

    r216616 r216809  
    2626#import <WebKit/WKBackForwardList.h>
    2727#import <WebKit/WKBackForwardListItem.h>
    28 #import <WebKit/WKContentExtension.h>
    29 #import <WebKit/WKContentExtensionStore.h>
     28#import <WebKit/WKContentRuleList.h>
     29#import <WebKit/WKContentRuleListStore.h>
    3030#import <WebKit/WKError.h>
    3131#import <WebKit/WKFoundation.h>
  • trunk/Source/WebKit2/Shared/API/c/WKDeprecatedFunctions.cpp

    r216348 r216809  
    2626#include "config.h"
    2727
    28 #include "APIContentExtension.h"
     28#include "APIContentRuleList.h"
    2929#include "APIDictionary.h"
    3030#include "WKAPICast.h"
     
    6161{
    6262#if ENABLE(CONTENT_EXTENSIONS)
    63     toImpl(pageGroupRef)->userContentController().addContentExtension(*toImpl(contentFilterRef));
     63    toImpl(pageGroupRef)->userContentController().addContentRuleList(*toImpl(contentFilterRef));
    6464#else
    6565    UNUSED_PARAM(pageGroupRef);
     
    7171{
    7272#if ENABLE(CONTENT_EXTENSIONS)
    73     toImpl(pageGroupRef)->userContentController().removeContentExtension(toWTFString(contentFilterNameRef));
     73    toImpl(pageGroupRef)->userContentController().removeContentRuleList(toWTFString(contentFilterNameRef));
    7474#else
    7575    UNUSED_PARAM(pageGroupRef);
  • trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm

    r216037 r216809  
    3434#import "WKBrowsingContextGroupInternal.h"
    3535#import "WKConnectionInternal.h"
    36 #import "WKContentExtensionInternal.h"
    37 #import "WKContentExtensionStoreInternal.h"
     36#import "WKContentRuleListInternal.h"
     37#import "WKContentRuleListStoreInternal.h"
    3838#import "WKFrameInfoInternal.h"
    3939#import "WKHTTPCookieStoreInternal.h"
     
    247247        break;
    248248
    249     case Type::ContentExtension:
    250         wrapper = [WKContentExtension alloc];
    251         break;
    252 
    253     case Type::ContentExtensionStore:
    254         wrapper = [WKContentExtensionStore alloc];
     249    case Type::ContentRuleList:
     250        wrapper = [WKContentRuleList alloc];
     251        break;
     252
     253    case Type::ContentRuleListStore:
     254        wrapper = [WKContentRuleListStore alloc];
    255255        break;
    256256
  • trunk/Source/WebKit2/Shared/WebCompiledContentRuleList.cpp

    r216807 r216809  
    2525
    2626#include "config.h"
    27 #include "WebCompiledContentExtension.h"
     27#include "WebCompiledContentRuleList.h"
    2828
    2929#if ENABLE(CONTENT_EXTENSIONS)
     
    3131namespace WebKit {
    3232
    33 Ref<WebCompiledContentExtension> WebCompiledContentExtension::create(WebCompiledContentExtensionData&& data)
     33Ref<WebCompiledContentRuleList> WebCompiledContentRuleList::create(WebCompiledContentRuleListData&& data)
    3434{
    35     return adoptRef(*new WebCompiledContentExtension(WTFMove(data)));
     35    return adoptRef(*new WebCompiledContentRuleList(WTFMove(data)));
    3636}
    3737
    38 WebCompiledContentExtension::WebCompiledContentExtension(WebCompiledContentExtensionData&& data)
     38WebCompiledContentRuleList::WebCompiledContentRuleList(WebCompiledContentRuleListData&& data)
    3939    : m_data(WTFMove(data))
    4040{
    4141}
    4242
    43 WebCompiledContentExtension::~WebCompiledContentExtension()
     43WebCompiledContentRuleList::~WebCompiledContentRuleList()
    4444{
    4545}
    4646
    47 bool WebCompiledContentExtension::conditionsApplyOnlyToDomain() const
     47bool WebCompiledContentRuleList::conditionsApplyOnlyToDomain() const
    4848{
    4949    return *reinterpret_cast<uint32_t*>(reinterpret_cast<uint8_t*>(m_data.data->data()) + m_data.conditionsApplyOnlyToDomainOffset);
    5050}
    5151
    52 const WebCore::ContentExtensions::DFABytecode* WebCompiledContentExtension::filtersWithoutConditionsBytecode() const
     52const WebCore::ContentExtensions::DFABytecode* WebCompiledContentRuleList::filtersWithoutConditionsBytecode() const
    5353{
    5454    return static_cast<const WebCore::ContentExtensions::DFABytecode*>(m_data.data->data()) + m_data.filtersWithoutConditionsBytecodeOffset;
    5555}
    5656
    57 unsigned WebCompiledContentExtension::filtersWithoutConditionsBytecodeLength() const
     57unsigned WebCompiledContentRuleList::filtersWithoutConditionsBytecodeLength() const
    5858{
    5959    return m_data.filtersWithoutConditionsBytecodeSize;
    6060}
    6161
    62 const WebCore::ContentExtensions::DFABytecode* WebCompiledContentExtension::filtersWithConditionsBytecode() const
     62const WebCore::ContentExtensions::DFABytecode* WebCompiledContentRuleList::filtersWithConditionsBytecode() const
    6363{
    6464    return static_cast<const WebCore::ContentExtensions::DFABytecode*>(m_data.data->data()) + m_data.filtersWithConditionsBytecodeOffset;
    6565}
    6666
    67 unsigned WebCompiledContentExtension::filtersWithConditionsBytecodeLength() const
     67unsigned WebCompiledContentRuleList::filtersWithConditionsBytecodeLength() const
    6868{
    6969    return m_data.filtersWithConditionsBytecodeSize;
    7070}
    7171
    72 const WebCore::ContentExtensions::DFABytecode* WebCompiledContentExtension::topURLFiltersBytecode() const
     72const WebCore::ContentExtensions::DFABytecode* WebCompiledContentRuleList::topURLFiltersBytecode() const
    7373{
    7474    return static_cast<const WebCore::ContentExtensions::DFABytecode*>(m_data.data->data()) + m_data.topURLFiltersBytecodeOffset;
    7575}
    7676
    77 unsigned WebCompiledContentExtension::topURLFiltersBytecodeLength() const
     77unsigned WebCompiledContentRuleList::topURLFiltersBytecodeLength() const
    7878{
    7979    return m_data.topURLFiltersBytecodeSize;
    8080}
    8181
    82 const WebCore::ContentExtensions::SerializedActionByte* WebCompiledContentExtension::actions() const
     82const WebCore::ContentExtensions::SerializedActionByte* WebCompiledContentRuleList::actions() const
    8383{
    8484    return static_cast<const WebCore::ContentExtensions::SerializedActionByte*>(m_data.data->data()) + m_data.actionsOffset;
    8585}
    8686
    87 unsigned WebCompiledContentExtension::actionsLength() const
     87unsigned WebCompiledContentRuleList::actionsLength() const
    8888{
    8989    return m_data.actionsSize;
  • trunk/Source/WebKit2/Shared/WebCompiledContentRuleList.h

    r216807 r216809  
    2828#if ENABLE(CONTENT_EXTENSIONS)
    2929
    30 #include "WebCompiledContentExtensionData.h"
     30#include "WebCompiledContentRuleListData.h"
     31#include <WebCore/CompiledContentExtension.h>
    3132#include <WebCore/ContentExtensionCompiler.h>
    32 #include <WebCore/CompiledContentExtension.h>
    3333
    3434namespace WebKit {
    3535
    36 class WebCompiledContentExtension final : public WebCore::ContentExtensions::CompiledContentExtension {
     36class WebCompiledContentRuleList final : public WebCore::ContentExtensions::CompiledContentExtension {
    3737public:
    38     static Ref<WebCompiledContentExtension> create(WebCompiledContentExtensionData&&);
    39     virtual ~WebCompiledContentExtension();
     38    static Ref<WebCompiledContentRuleList> create(WebCompiledContentRuleListData&&);
     39    virtual ~WebCompiledContentRuleList();
    4040
    41     WebCompiledContentExtensionData data() const { return m_data; }
     41    WebCompiledContentRuleListData data() const { return m_data; }
    4242
    4343private:
    44     WebCompiledContentExtension(WebCompiledContentExtensionData&&);
     44    WebCompiledContentRuleList(WebCompiledContentRuleListData&&);
    4545
    4646    const WebCore::ContentExtensions::DFABytecode* filtersWithoutConditionsBytecode() const final;
     
    5555    unsigned actionsLength() const final;
    5656   
    57     WebCompiledContentExtensionData m_data;
     57    WebCompiledContentRuleListData m_data;
    5858};
    5959
  • trunk/Source/WebKit2/Shared/WebCompiledContentRuleListData.cpp

    r216807 r216809  
    2525
    2626#include "config.h"
    27 #include "WebCompiledContentExtensionData.h"
     27#include "WebCompiledContentRuleListData.h"
    2828
    2929#if ENABLE(CONTENT_EXTENSIONS)
     
    3333namespace WebKit {
    3434
    35 void WebCompiledContentExtensionData::encode(IPC::Encoder& encoder) const
     35void WebCompiledContentRuleListData::encode(IPC::Encoder& encoder) const
    3636{
    3737    SharedMemory::Handle handle;
     
    4949}
    5050
    51 bool WebCompiledContentExtensionData::decode(IPC::Decoder& decoder, WebCompiledContentExtensionData& compiledContentExtensionData)
     51bool WebCompiledContentRuleListData::decode(IPC::Decoder& decoder, WebCompiledContentRuleListData& compiledContentRuleListData)
    5252{
    5353    SharedMemory::Handle handle;
    5454    if (!decoder.decode(handle))
    5555        return false;
    56     compiledContentExtensionData.data = SharedMemory::map(handle, SharedMemory::Protection::ReadOnly);
     56    compiledContentRuleListData.data = SharedMemory::map(handle, SharedMemory::Protection::ReadOnly);
    5757
    58     if (!decoder.decode(compiledContentExtensionData.actionsOffset))
     58    if (!decoder.decode(compiledContentRuleListData.actionsOffset))
    5959        return false;
    60     if (!decoder.decode(compiledContentExtensionData.actionsSize))
     60    if (!decoder.decode(compiledContentRuleListData.actionsSize))
    6161        return false;
    62     if (!decoder.decode(compiledContentExtensionData.filtersWithoutConditionsBytecodeOffset))
     62    if (!decoder.decode(compiledContentRuleListData.filtersWithoutConditionsBytecodeOffset))
    6363        return false;
    64     if (!decoder.decode(compiledContentExtensionData.filtersWithoutConditionsBytecodeSize))
     64    if (!decoder.decode(compiledContentRuleListData.filtersWithoutConditionsBytecodeSize))
    6565        return false;
    66     if (!decoder.decode(compiledContentExtensionData.filtersWithConditionsBytecodeOffset))
     66    if (!decoder.decode(compiledContentRuleListData.filtersWithConditionsBytecodeOffset))
    6767        return false;
    68     if (!decoder.decode(compiledContentExtensionData.filtersWithConditionsBytecodeSize))
     68    if (!decoder.decode(compiledContentRuleListData.filtersWithConditionsBytecodeSize))
    6969        return false;
    70     if (!decoder.decode(compiledContentExtensionData.topURLFiltersBytecodeOffset))
     70    if (!decoder.decode(compiledContentRuleListData.topURLFiltersBytecodeOffset))
    7171        return false;
    72     if (!decoder.decode(compiledContentExtensionData.topURLFiltersBytecodeSize))
     72    if (!decoder.decode(compiledContentRuleListData.topURLFiltersBytecodeSize))
    7373        return false;
    7474
  • trunk/Source/WebKit2/Shared/WebCompiledContentRuleListData.h

    r216807 r216809  
    3939namespace WebKit {
    4040
    41 class WebCompiledContentExtensionData {
     41class WebCompiledContentRuleListData {
    4242public:
    43     WebCompiledContentExtensionData() = default;
     43    WebCompiledContentRuleListData() = default;
    4444
    45     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)
     45    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)
    4646        : data(WTFMove(data))
    4747        , fileData(fileData)
     
    5959
    6060    void encode(IPC::Encoder&) const;
    61     static bool decode(IPC::Decoder&, WebCompiledContentExtensionData&);
     61    static bool decode(IPC::Decoder&, WebCompiledContentRuleListData&);
    6262
    6363    RefPtr<SharedMemory> data;
  • trunk/Source/WebKit2/Shared/WebPageCreationParameters.cpp

    r216612 r216809  
    108108    encoder << messageHandlers;
    109109#if ENABLE(CONTENT_EXTENSIONS)
    110     encoder << contentExtensions;
     110    encoder << contentRuleLists;
    111111#endif
    112112}
     
    258258        return false;
    259259#if ENABLE(CONTENT_EXTENSIONS)
    260     if (!decoder.decode(parameters.contentExtensions))
     260    if (!decoder.decode(parameters.contentRuleLists))
    261261        return false;
    262262#endif
  • trunk/Source/WebKit2/Shared/WebPageCreationParameters.h

    r216612 r216809  
    2929#include "LayerTreeContext.h"
    3030#include "SessionState.h"
    31 #include "WebCompiledContentExtensionData.h"
     31#include "WebCompiledContentRuleListData.h"
    3232#include "WebCoreArgumentCoders.h"
    3333#include "WebPageGroupData.h"
     
    166166    Vector<WebScriptMessageHandlerData> messageHandlers;
    167167#if ENABLE(CONTENT_EXTENSIONS)
    168     Vector<std::pair<String, WebCompiledContentExtensionData>> contentExtensions;
     168    Vector<std::pair<String, WebCompiledContentRuleListData>> contentRuleLists;
    169169#endif
    170170};
  • trunk/Source/WebKit2/UIProcess/API/APIContentRuleList.cpp

    r216807 r216809  
    2525
    2626#include "config.h"
    27 #include "APIContentExtension.h"
     27#include "APIContentRuleList.h"
    2828
    2929#if ENABLE(CONTENT_EXTENSIONS)
    3030
    31 #include "WebCompiledContentExtension.h"
     31#include "WebCompiledContentRuleList.h"
    3232
    3333namespace API {
    3434
    35 ContentExtension::ContentExtension(const WTF::String& name, Ref<WebKit::WebCompiledContentExtension>&& contentExtension)
     35ContentRuleList::ContentRuleList(const WTF::String& name, Ref<WebKit::WebCompiledContentRuleList>&& contentRuleList)
    3636    : m_name(name)
    37     , m_compiledExtension(WTFMove(contentExtension))
     37    , m_compiledRuleList(WTFMove(contentRuleList))
    3838{
    3939}
    4040
    41 ContentExtension::~ContentExtension()
     41ContentRuleList::~ContentRuleList()
    4242{
    4343}
  • trunk/Source/WebKit2/UIProcess/API/APIContentRuleList.h

    r216807 r216809  
    3030
    3131namespace WebKit {
    32 class WebCompiledContentExtension;
     32class WebCompiledContentRuleList;
    3333}
    3434
    3535namespace API {
    3636
    37 class ContentExtension final : public ObjectImpl<Object::Type::ContentExtension> {
     37class ContentRuleList final : public ObjectImpl<Object::Type::ContentRuleList> {
    3838public:
    3939#if ENABLE(CONTENT_EXTENSIONS)
    40     static Ref<ContentExtension> create(const WTF::String& name, Ref<WebKit::WebCompiledContentExtension>&& contentExtension)
     40    static Ref<ContentRuleList> create(const WTF::String& name, Ref<WebKit::WebCompiledContentRuleList>&& contentRuleList)
    4141    {
    42         return adoptRef(*new ContentExtension(name, WTFMove(contentExtension)));
     42        return adoptRef(*new ContentRuleList(name, WTFMove(contentRuleList)));
    4343    }
    4444
    45     ContentExtension(const WTF::String& name, Ref<WebKit::WebCompiledContentExtension>&&);
    46     virtual ~ContentExtension();
     45    ContentRuleList(const WTF::String& name, Ref<WebKit::WebCompiledContentRuleList>&&);
     46    virtual ~ContentRuleList();
    4747
    4848    const WTF::String& name() const { return m_name; }
    49     const WebKit::WebCompiledContentExtension& compiledExtension() const { return m_compiledExtension.get(); }
     49    const WebKit::WebCompiledContentRuleList& compiledRuleList() const { return m_compiledRuleList.get(); }
    5050
    5151private:
    5252    WTF::String m_name;
    53     Ref<WebKit::WebCompiledContentExtension> m_compiledExtension;
     53    Ref<WebKit::WebCompiledContentRuleList> m_compiledRuleList;
    5454#endif // ENABLE(CONTENT_EXTENSIONS)
    5555};
  • trunk/Source/WebKit2/UIProcess/API/APIContentRuleListStore.cpp

    r216807 r216809  
    2525
    2626#include "config.h"
    27 #include "APIContentExtensionStore.h"
     27#include "APIContentRuleListStore.h"
    2828
    2929#if ENABLE(CONTENT_EXTENSIONS)
    3030
    31 #include "APIContentExtension.h"
     31#include "APIContentRuleList.h"
    3232#include "NetworkCacheData.h"
    3333#include "NetworkCacheFileSystem.h"
    3434#include "SharedMemory.h"
    35 #include "WebCompiledContentExtension.h"
     35#include "WebCompiledContentRuleList.h"
    3636#include <WebCore/ContentExtensionCompiler.h>
    3737#include <WebCore/ContentExtensionError.h>
     
    4646
    4747namespace API {
    48 
    49 ContentExtensionStore& ContentExtensionStore::defaultStore()
    50 {
    51     static ContentExtensionStore* defaultStore = adoptRef(new ContentExtensionStore).leakRef();
     48   
     49ContentRuleListStore& ContentRuleListStore::legacyDefaultStore()
     50{
     51    const bool legacyFilename = true;
     52    static ContentRuleListStore* defaultStore = adoptRef(new ContentRuleListStore(legacyFilename)).leakRef();
    5253    return *defaultStore;
    5354}
    54 
    55 Ref<ContentExtensionStore> ContentExtensionStore::storeWithPath(const WTF::String& storePath)
    56 {
    57     return adoptRef(*new ContentExtensionStore(storePath));
    58 }
    59 
    60 ContentExtensionStore::ContentExtensionStore()
    61     : ContentExtensionStore(defaultStorePath())
    62 {
    63 }
    64 
    65 ContentExtensionStore::ContentExtensionStore(const WTF::String& storePath)
     55   
     56ContentRuleListStore& ContentRuleListStore::nonLegacyDdefaultStore()
     57{
     58    const bool legacyFilename = false;
     59    static ContentRuleListStore* defaultStore = adoptRef(new ContentRuleListStore(legacyFilename)).leakRef();
     60    return *defaultStore;
     61}
     62   
     63ContentRuleListStore& ContentRuleListStore::defaultStore(bool legacyFilename)
     64{
     65    if (legacyFilename)
     66        return legacyDefaultStore();
     67    return nonLegacyDdefaultStore();
     68}
     69
     70Ref<ContentRuleListStore> ContentRuleListStore::storeWithPath(const WTF::String& storePath, bool legacyFilename)
     71{
     72    return adoptRef(*new ContentRuleListStore(storePath, legacyFilename));
     73}
     74
     75ContentRuleListStore::ContentRuleListStore(bool legacyFilename)
     76    : ContentRuleListStore(defaultStorePath(legacyFilename), legacyFilename)
     77{
     78}
     79
     80ContentRuleListStore::ContentRuleListStore(const WTF::String& storePath, bool legacyFilename)
    6681    : m_storePath(storePath)
    67     , m_compileQueue(WorkQueue::create("ContentExtensionStore Compile Queue", WorkQueue::Type::Concurrent))
    68     , m_readQueue(WorkQueue::create("ContentExtensionStore Read Queue"))
    69     , m_removeQueue(WorkQueue::create("ContentExtensionStore Remove Queue"))
     82    , m_compileQueue(WorkQueue::create("ContentRuleListStore Compile Queue", WorkQueue::Type::Concurrent))
     83    , m_readQueue(WorkQueue::create("ContentRuleListStore Read Queue"))
     84    , m_removeQueue(WorkQueue::create("ContentRuleListStore Remove Queue"))
     85    , m_legacyFilename(legacyFilename)
    7086{
    7187    WebCore::makeAllDirectories(storePath);
    7288}
    7389
    74 ContentExtensionStore::~ContentExtensionStore()
    75 {
    76 }
    77 
    78 static const String& constructedPathPrefix()
    79 {
    80     static NeverDestroyed<String> prefix("ContentExtension-");
     90ContentRuleListStore::~ContentRuleListStore()
     91{
     92}
     93
     94static const String& constructedPathPrefix(bool legacyFilename)
     95{
     96    static NeverDestroyed<String> prefix("ContentRuleList-");
     97    static NeverDestroyed<String> legacyPrefix("ContentExtension-");
     98    if (legacyFilename)
     99        return legacyPrefix;
    81100    return prefix;
    82101}
    83102
    84 static const String constructedPathFilter()
    85 {
    86     return makeString(constructedPathPrefix(), '*');
    87 }
    88 
    89 static String constructedPath(const String& base, const String& identifier)
    90 {
    91     return WebCore::pathByAppendingComponent(base, makeString(constructedPathPrefix(), WebCore::encodeForFileName(identifier)));
     103static const String constructedPathFilter(bool legacyFilename)
     104{
     105    return makeString(constructedPathPrefix(legacyFilename), '*');
     106}
     107
     108static String constructedPath(const String& base, const String& identifier, bool legacyFilename)
     109{
     110    return WebCore::pathByAppendingComponent(base, makeString(constructedPathPrefix(legacyFilename), WebCore::encodeForFileName(identifier)));
    92111}
    93112
    94113// The size and offset of the densely packed bytes in the file, not sizeof and offsetof, which would
    95114// represent the size and offset of the structure in memory, possibly with compiler-added padding.
    96 const size_t ContentExtensionFileHeaderSize = 2 * sizeof(uint32_t) + 5 * sizeof(uint64_t);
     115const size_t ContentRuleListFileHeaderSize = 2 * sizeof(uint32_t) + 5 * sizeof(uint64_t);
    97116const size_t ConditionsApplyOnlyToDomainOffset = sizeof(uint32_t) + 5 * sizeof(uint64_t);
    98117
    99 struct ContentExtensionMetaData {
    100     uint32_t version { ContentExtensionStore::CurrentContentExtensionFileVersion };
     118struct ContentRuleListMetaData {
     119    uint32_t version { ContentRuleListStore::CurrentContentRuleListFileVersion };
    101120    uint64_t sourceSize { 0 };
    102121    uint64_t actionsSize { 0 };
     
    108127    size_t fileSize() const
    109128    {
    110         return ContentExtensionFileHeaderSize
     129        return ContentRuleListFileHeaderSize
    111130            + sourceSize
    112131            + actionsSize
     
    117136};
    118137
    119 static Data encodeContentExtensionMetaData(const ContentExtensionMetaData& metaData)
     138static Data encodeContentRuleListMetaData(const ContentRuleListMetaData& metaData)
    120139{
    121140    WTF::Persistence::Encoder encoder;
     
    129148    encoder << metaData.conditionsApplyOnlyToDomain;
    130149
    131     ASSERT(encoder.bufferSize() == ContentExtensionFileHeaderSize);
     150    ASSERT(encoder.bufferSize() == ContentRuleListFileHeaderSize);
    132151    return Data(encoder.buffer(), encoder.bufferSize());
    133152}
    134153
    135 static bool decodeContentExtensionMetaData(ContentExtensionMetaData& metaData, const Data& fileData)
     154static bool decodeContentRuleListMetaData(ContentRuleListMetaData& metaData, const Data& fileData)
    136155{
    137156    bool success = false;
     
    163182}
    164183
    165 static bool openAndMapContentExtension(const String& path, ContentExtensionMetaData& metaData, Data& fileData)
     184static bool openAndMapContentRuleList(const String& path, ContentRuleListMetaData& metaData, Data& fileData)
    166185{
    167186    fileData = mapFile(WebCore::fileSystemRepresentation(path).data());
     
    169188        return false;
    170189
    171     if (!decodeContentExtensionMetaData(metaData, fileData))
     190    if (!decodeContentRuleListMetaData(metaData, fileData))
    172191        return false;
    173192
     
    189208}
    190209
    191 static std::error_code compiledToFile(String&& json, const String& finalFilePath, ContentExtensionMetaData& metaData, Data& mappedData)
     210static std::error_code compiledToFile(String&& json, const String& finalFilePath, ContentRuleListMetaData& metaData, Data& mappedData)
    192211{
    193212    using namespace WebCore::ContentExtensions;
     
    195214    class CompilationClient final : public ContentExtensionCompilationClient {
    196215    public:
    197         CompilationClient(WebCore::PlatformFileHandle fileHandle, ContentExtensionMetaData& metaData)
     216        CompilationClient(WebCore::PlatformFileHandle fileHandle, ContentRuleListMetaData& metaData)
    198217            : m_fileHandle(fileHandle)
    199218            , m_metaData(metaData)
     
    267286            m_metaData.conditionsApplyOnlyToDomain = m_conditionsApplyOnlyToDomain;
    268287           
    269             Data header = encodeContentExtensionMetaData(m_metaData);
     288            Data header = encodeContentRuleListMetaData(m_metaData);
    270289            if (!m_fileError && WebCore::seekFile(m_fileHandle, 0ll, WebCore::FileSeekOrigin::SeekFromBeginning) == -1) {
    271290                WebCore::closeFile(m_fileHandle);
     
    291310       
    292311        WebCore::PlatformFileHandle m_fileHandle;
    293         ContentExtensionMetaData& m_metaData;
     312        ContentRuleListMetaData& m_metaData;
    294313        size_t m_filtersWithoutConditionsBytecodeWritten { 0 };
    295314        size_t m_filtersWithConditionBytecodeWritten { 0 };
     
    302321
    303322    auto temporaryFileHandle = WebCore::invalidPlatformFileHandle;
    304     String temporaryFilePath = WebCore::openTemporaryFile("ContentExtension", temporaryFileHandle);
     323    String temporaryFilePath = WebCore::openTemporaryFile("ContentRuleList", temporaryFileHandle);
    305324    if (temporaryFileHandle == WebCore::invalidPlatformFileHandle)
    306         return ContentExtensionStore::Error::CompileFailed;
    307    
    308     char invalidHeader[ContentExtensionFileHeaderSize];
     325        return ContentRuleListStore::Error::CompileFailed;
     326   
     327    char invalidHeader[ContentRuleListFileHeaderSize];
    309328    memset(invalidHeader, 0xFF, sizeof(invalidHeader));
    310329    // This header will be rewritten in CompilationClient::finalize.
    311330    if (WebCore::writeToFile(temporaryFileHandle, invalidHeader, sizeof(invalidHeader)) == -1) {
    312331        WebCore::closeFile(temporaryFileHandle);
    313         return ContentExtensionStore::Error::CompileFailed;
     332        return ContentRuleListStore::Error::CompileFailed;
    314333    }
    315334
     
    322341    if (compilationClient.hadErrorWhileWritingToFile()) {
    323342        WebCore::closeFile(temporaryFileHandle);
    324         return ContentExtensionStore::Error::CompileFailed;
     343        return ContentRuleListStore::Error::CompileFailed;
    325344    }
    326345   
    327346    mappedData = adoptAndMapFile(temporaryFileHandle, 0, metaData.fileSize());
    328347    if (mappedData.isNull())
    329         return ContentExtensionStore::Error::CompileFailed;
     348        return ContentRuleListStore::Error::CompileFailed;
    330349
    331350    if (!WebCore::moveFile(temporaryFilePath, finalFilePath))
    332         return ContentExtensionStore::Error::CompileFailed;
     351        return ContentRuleListStore::Error::CompileFailed;
    333352
    334353    return { };
    335354}
    336355
    337 static Ref<API::ContentExtension> createExtension(const String& identifier, const ContentExtensionMetaData& metaData, const Data& fileData)
     356static Ref<API::ContentRuleList> createExtension(const String& identifier, const ContentRuleListMetaData& metaData, const Data& fileData)
    338357{
    339358    auto sharedMemory = WebKit::SharedMemory::create(const_cast<uint8_t*>(fileData.data()), fileData.size(), WebKit::SharedMemory::Protection::ReadOnly);
    340     const size_t headerAndSourceSize = ContentExtensionFileHeaderSize + metaData.sourceSize;
    341     auto compiledContentExtensionData = WebKit::WebCompiledContentExtensionData(
     359    const size_t headerAndSourceSize = ContentRuleListFileHeaderSize + metaData.sourceSize;
     360    auto compiledContentRuleListData = WebKit::WebCompiledContentRuleListData(
    342361        WTFMove(sharedMemory),
    343362        fileData,
     
    358377        metaData.conditionedFiltersBytecodeSize
    359378    );
    360     auto compiledContentExtension = WebKit::WebCompiledContentExtension::create(WTFMove(compiledContentExtensionData));
    361     return API::ContentExtension::create(identifier, WTFMove(compiledContentExtension));
    362 }
    363 
    364 void ContentExtensionStore::lookupContentExtension(const WTF::String& identifier, Function<void(RefPtr<API::ContentExtension>, std::error_code)> completionHandler)
    365 {
    366     m_readQueue->dispatch([protectedThis = makeRef(*this), identifier = identifier.isolatedCopy(), storePath = m_storePath.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
    367         auto path = constructedPath(storePath, identifier);
    368        
    369         ContentExtensionMetaData metaData;
     379    auto compiledContentRuleList = WebKit::WebCompiledContentRuleList::create(WTFMove(compiledContentRuleListData));
     380    return API::ContentRuleList::create(identifier, WTFMove(compiledContentRuleList));
     381}
     382
     383void ContentRuleListStore::lookupContentRuleList(const WTF::String& identifier, Function<void(RefPtr<API::ContentRuleList>, std::error_code)> completionHandler)
     384{
     385    m_readQueue->dispatch([protectedThis = makeRef(*this), identifier = identifier.isolatedCopy(), storePath = m_storePath.isolatedCopy(), legacyFilename = m_legacyFilename, completionHandler = WTFMove(completionHandler)]() mutable {
     386        auto path = constructedPath(storePath, identifier, legacyFilename);
     387       
     388        ContentRuleListMetaData metaData;
    370389        Data fileData;
    371         if (!openAndMapContentExtension(path, metaData, fileData)) {
     390        if (!openAndMapContentRuleList(path, metaData, fileData)) {
    372391            RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler)] {
    373392                completionHandler(nullptr, Error::LookupFailed);
     
    376395        }
    377396       
    378         if (metaData.version != ContentExtensionStore::CurrentContentExtensionFileVersion) {
     397        if (metaData.version != ContentRuleListStore::CurrentContentRuleListFileVersion) {
    379398            RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler)] {
    380399                completionHandler(nullptr, Error::VersionMismatch);
     
    389408}
    390409
    391 void ContentExtensionStore::getAvailableContentExtensionIdentifiers(Function<void(WTF::Vector<WTF::String>)> completionHandler)
    392 {
    393     m_readQueue->dispatch([protectedThis = makeRef(*this), storePath = m_storePath.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
    394 
    395         Vector<String> fullPaths = WebCore::listDirectory(storePath, constructedPathFilter());
     410void ContentRuleListStore::getAvailableContentRuleListIdentifiers(Function<void(WTF::Vector<WTF::String>)> completionHandler)
     411{
     412    m_readQueue->dispatch([protectedThis = makeRef(*this), storePath = m_storePath.isolatedCopy(), legacyFilename = m_legacyFilename, completionHandler = WTFMove(completionHandler)]() mutable {
     413
     414        Vector<String> fullPaths = WebCore::listDirectory(storePath, constructedPathFilter(legacyFilename));
    396415        Vector<String> identifiers;
    397416        identifiers.reserveInitialCapacity(fullPaths.size());
    398         const auto prefixLength = constructedPathPrefix().length();
     417        const auto prefixLength = constructedPathPrefix(legacyFilename).length();
    399418        for (const auto& path : fullPaths)
    400419            identifiers.uncheckedAppend(WebCore::decodeFromFilename(path.substring(path.reverseFind('/') + 1 + prefixLength)));
     
    406425}
    407426
    408 void ContentExtensionStore::compileContentExtension(const WTF::String& identifier, WTF::String&& json, Function<void(RefPtr<API::ContentExtension>, std::error_code)> completionHandler)
     427void ContentRuleListStore::compileContentRuleList(const WTF::String& identifier, WTF::String&& json, Function<void(RefPtr<API::ContentRuleList>, std::error_code)> completionHandler)
    409428{
    410429    AtomicString::init();
    411     m_compileQueue->dispatch([protectedThis = makeRef(*this), identifier = identifier.isolatedCopy(), json = json.isolatedCopy(), storePath = m_storePath.isolatedCopy(), completionHandler = WTFMove(completionHandler)] () mutable {
    412         auto path = constructedPath(storePath, identifier);
    413 
    414         ContentExtensionMetaData metaData;
     430    m_compileQueue->dispatch([protectedThis = makeRef(*this), identifier = identifier.isolatedCopy(), legacyFilename = m_legacyFilename, json = json.isolatedCopy(), storePath = m_storePath.isolatedCopy(), completionHandler = WTFMove(completionHandler)] () mutable {
     431        auto path = constructedPath(storePath, identifier, legacyFilename);
     432
     433        ContentRuleListMetaData metaData;
    415434        Data fileData;
    416435        auto error = compiledToFile(WTFMove(json), path, metaData, fileData);
     
    423442
    424443        RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), identifier = WTFMove(identifier), fileData = WTFMove(fileData), metaData = WTFMove(metaData), completionHandler = WTFMove(completionHandler)] {
    425             RefPtr<API::ContentExtension> contentExtension = createExtension(identifier, metaData, fileData);
    426             completionHandler(contentExtension, { });
     444            RefPtr<API::ContentRuleList> contentRuleList = createExtension(identifier, metaData, fileData);
     445            completionHandler(contentRuleList, { });
    427446        });
    428447    });
    429448}
    430449
    431 void ContentExtensionStore::removeContentExtension(const WTF::String& identifier, Function<void(std::error_code)> completionHandler)
    432 {
    433     m_removeQueue->dispatch([protectedThis = makeRef(*this), identifier = identifier.isolatedCopy(), storePath = m_storePath.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
    434         auto path = constructedPath(storePath, identifier);
     450void ContentRuleListStore::removeContentRuleList(const WTF::String& identifier, Function<void(std::error_code)> completionHandler)
     451{
     452    m_removeQueue->dispatch([protectedThis = makeRef(*this), identifier = identifier.isolatedCopy(), storePath = m_storePath.isolatedCopy(), legacyFilename = m_legacyFilename, completionHandler = WTFMove(completionHandler)]() mutable {
     453        auto path = constructedPath(storePath, identifier, legacyFilename);
    435454
    436455        if (!WebCore::deleteFile(path)) {
     
    447466}
    448467
    449 void ContentExtensionStore::synchronousRemoveAllContentExtensions()
     468void ContentRuleListStore::synchronousRemoveAllContentRuleLists()
    450469{
    451470    for (const auto& path : WebCore::listDirectory(m_storePath, "*"))
     
    453472}
    454473
    455 void ContentExtensionStore::invalidateContentExtensionVersion(const WTF::String& identifier)
    456 {
    457     auto file = WebCore::openFile(constructedPath(m_storePath, identifier), WebCore::OpenForWrite);
     474void ContentRuleListStore::invalidateContentRuleListVersion(const WTF::String& identifier)
     475{
     476    auto file = WebCore::openFile(constructedPath(m_storePath, identifier, m_legacyFilename), WebCore::OpenForWrite);
    458477    if (file == WebCore::invalidPlatformFileHandle)
    459478        return;
    460     ContentExtensionMetaData invalidHeader = {0, 0, 0, 0, 0, 0};
     479    ContentRuleListMetaData invalidHeader = {0, 0, 0, 0, 0, 0};
    461480    auto bytesWritten = WebCore::writeToFile(file, reinterpret_cast<const char*>(&invalidHeader), sizeof(invalidHeader));
    462481    ASSERT_UNUSED(bytesWritten, bytesWritten == sizeof(invalidHeader));
     
    464483}
    465484
    466 void ContentExtensionStore::getContentExtensionSource(const WTF::String& identifier, Function<void(WTF::String)> completionHandler)
    467 {
    468     m_readQueue->dispatch([protectedThis = makeRef(*this), identifier = identifier.isolatedCopy(), storePath = m_storePath.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
    469         auto path = constructedPath(storePath, identifier);
     485void ContentRuleListStore::getContentRuleListSource(const WTF::String& identifier, Function<void(WTF::String)> completionHandler)
     486{
     487    m_readQueue->dispatch([protectedThis = makeRef(*this), identifier = identifier.isolatedCopy(), storePath = m_storePath.isolatedCopy(), legacyFilename = m_legacyFilename, completionHandler = WTFMove(completionHandler)]() mutable {
     488        auto path = constructedPath(storePath, identifier, legacyFilename);
    470489       
    471490        auto complete = [protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler)](String source) mutable {
     
    475494        };
    476495       
    477         ContentExtensionMetaData metaData;
     496        ContentRuleListMetaData metaData;
    478497        Data fileData;
    479         if (!openAndMapContentExtension(path, metaData, fileData)) {
     498        if (!openAndMapContentRuleList(path, metaData, fileData)) {
    480499            complete({ });
    481500            return;
     
    488507                return;
    489508            }
    490             bool is8Bit = fileData.data()[ContentExtensionFileHeaderSize];
    491             size_t start = ContentExtensionFileHeaderSize + sizeof(bool);
     509            bool is8Bit = fileData.data()[ContentRuleListFileHeaderSize];
     510            size_t start = ContentRuleListFileHeaderSize + sizeof(bool);
    492511            size_t length = metaData.sourceSize - sizeof(bool);
    493512            if (is8Bit)
     
    505524}
    506525
    507 const std::error_category& contentExtensionStoreErrorCategory()
    508 {
    509     class ContentExtensionStoreErrorCategory : public std::error_category {
     526const std::error_category& contentRuleListStoreErrorCategory()
     527{
     528    class ContentRuleListStoreErrorCategory : public std::error_category {
    510529        const char* name() const noexcept final
    511530        {
     
    515534        std::string message(int errorCode) const final
    516535        {
    517             switch (static_cast<ContentExtensionStore::Error>(errorCode)) {
    518             case ContentExtensionStore::Error::LookupFailed:
     536            switch (static_cast<ContentRuleListStore::Error>(errorCode)) {
     537            case ContentRuleListStore::Error::LookupFailed:
    519538                return "Unspecified error during lookup.";
    520             case ContentExtensionStore::Error::VersionMismatch:
     539            case ContentRuleListStore::Error::VersionMismatch:
    521540                return "Version of file does not match version of interpreter.";
    522             case ContentExtensionStore::Error::CompileFailed:
     541            case ContentRuleListStore::Error::CompileFailed:
    523542                return "Unspecified error during compile.";
    524             case ContentExtensionStore::Error::RemoveFailed:
     543            case ContentRuleListStore::Error::RemoveFailed:
    525544                return "Unspecified error during remove.";
    526545            }
     
    530549    };
    531550
    532     static NeverDestroyed<ContentExtensionStoreErrorCategory> contentExtensionErrorCategory;
    533     return contentExtensionErrorCategory;
     551    static NeverDestroyed<ContentRuleListStoreErrorCategory> contentRuleListErrorCategory;
     552    return contentRuleListErrorCategory;
    534553}
    535554
  • trunk/Source/WebKit2/UIProcess/API/APIContentRuleListStore.h

    r216807 r216809  
    3838namespace API {
    3939
    40 class ContentExtension;
     40class ContentRuleList;
    4141
    42 class ContentExtensionStore final : public ObjectImpl<Object::Type::ContentExtensionStore> {
     42class ContentRuleListStore final : public ObjectImpl<Object::Type::ContentRuleListStore> {
    4343public:
    4444    enum class Error {
     
    5151    // This should be incremented every time a functional change is made to the bytecode, file format, etc.
    5252    // to prevent crashing while loading old data.
    53     // Also update ContentExtensionStore::getContentExtensionSource to be able to find the original JSON
     53    // Also update ContentRuleListStore::getContentRuleListSource to be able to find the original JSON
    5454    // source from old versions.
    55     const static uint32_t CurrentContentExtensionFileVersion = 9;
     55    const static uint32_t CurrentContentRuleListFileVersion = 9;
    5656
    57     static ContentExtensionStore& defaultStore();
    58     static Ref<ContentExtensionStore> storeWithPath(const WTF::String& storePath);
     57    static ContentRuleListStore& defaultStore(bool legacyFilename);
     58    static Ref<ContentRuleListStore> storeWithPath(const WTF::String& storePath, bool legacyFilename);
    5959
    60     explicit ContentExtensionStore();
    61     explicit ContentExtensionStore(const WTF::String& storePath);
    62     virtual ~ContentExtensionStore();
     60    explicit ContentRuleListStore(bool legacyFilename);
     61    explicit ContentRuleListStore(const WTF::String& storePath, bool legacyFilename);
     62    virtual ~ContentRuleListStore();
    6363
    64     void compileContentExtension(const WTF::String& identifier, WTF::String&& json, Function<void(RefPtr<API::ContentExtension>, std::error_code)>);
    65     void lookupContentExtension(const WTF::String& identifier, Function<void(RefPtr<API::ContentExtension>, std::error_code)>);
    66     void removeContentExtension(const WTF::String& identifier, Function<void(std::error_code)>);
    67     void getAvailableContentExtensionIdentifiers(Function<void(WTF::Vector<WTF::String>)>);
     64    void compileContentRuleList(const WTF::String& identifier, WTF::String&& json, Function<void(RefPtr<API::ContentRuleList>, std::error_code)>);
     65    void lookupContentRuleList(const WTF::String& identifier, Function<void(RefPtr<API::ContentRuleList>, std::error_code)>);
     66    void removeContentRuleList(const WTF::String& identifier, Function<void(std::error_code)>);
     67    void getAvailableContentRuleListIdentifiers(Function<void(WTF::Vector<WTF::String>)>);
    6868
    6969    // For testing only.
    70     void synchronousRemoveAllContentExtensions();
    71     void invalidateContentExtensionVersion(const WTF::String& identifier);
    72     void getContentExtensionSource(const WTF::String& identifier, Function<void(WTF::String)>);
     70    void synchronousRemoveAllContentRuleLists();
     71    void invalidateContentRuleListVersion(const WTF::String& identifier);
     72    void getContentRuleListSource(const WTF::String& identifier, Function<void(WTF::String)>);
    7373
    7474private:
    75     WTF::String defaultStorePath();
    76 
     75    WTF::String defaultStorePath(bool legacyFilename);
     76    static ContentRuleListStore& legacyDefaultStore();
     77    static ContentRuleListStore& nonLegacyDdefaultStore();
     78   
    7779    const WTF::String m_storePath;
    7880    Ref<WTF::WorkQueue> m_compileQueue;
    7981    Ref<WTF::WorkQueue> m_readQueue;
    8082    Ref<WTF::WorkQueue> m_removeQueue;
     83    bool m_legacyFilename { false };
    8184};
    8285
    83 const std::error_category& contentExtensionStoreErrorCategory();
     86const std::error_category& contentRuleListStoreErrorCategory();
    8487
    85 inline std::error_code make_error_code(ContentExtensionStore::Error error)
     88inline std::error_code make_error_code(ContentRuleListStore::Error error)
    8689{
    87     return { static_cast<int>(error), contentExtensionStoreErrorCategory() };
     90    return { static_cast<int>(error), contentRuleListStoreErrorCategory() };
    8891}
    8992
     
    9194
    9295namespace std {
    93 template<> struct is_error_code_enum<API::ContentExtensionStore::Error> : public true_type { };
     96template<> struct is_error_code_enum<API::ContentRuleListStore::Error> : public true_type { };
    9497}
    9598
  • trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h

    r216696 r216809  
    5454
    5555namespace API {
    56 class ContentExtension;
    57 class ContentExtensionStore;
     56class ContentRuleList;
     57class ContentRuleListStore;
    5858class ExperimentalFeature;
    5959class FrameHandle;
     
    163163WK_ADD_API_MAPPING(WKTextCheckerRef, WebTextChecker)
    164164WK_ADD_API_MAPPING(WKUserContentControllerRef, WebUserContentControllerProxy)
    165 WK_ADD_API_MAPPING(WKUserContentExtensionStoreRef, API::ContentExtensionStore)
    166 WK_ADD_API_MAPPING(WKUserContentFilterRef, API::ContentExtension)
     165WK_ADD_API_MAPPING(WKUserContentExtensionStoreRef, API::ContentRuleListStore)
     166WK_ADD_API_MAPPING(WKUserContentFilterRef, API::ContentRuleList)
    167167WK_ADD_API_MAPPING(WKUserMediaPermissionCheckRef, UserMediaPermissionCheckProxy)
    168168WK_ADD_API_MAPPING(WKUserMediaPermissionRequestRef, UserMediaPermissionRequestProxy)
  • trunk/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp

    r216473 r216809  
    2727#include "WKPageGroup.h"
    2828
    29 #include "APIContentExtension.h"
     29#include "APIContentRuleList.h"
    3030#include "APIUserContentWorld.h"
    3131#include "APIUserScript.h"
  • trunk/Source/WebKit2/UIProcess/API/C/WKUserContentControllerRef.cpp

    r213696 r216809  
    2727#include "WKUserContentControllerRef.h"
    2828
    29 #include "APIContentExtension.h"
     29#include "APIContentRuleList.h"
    3030#include "APIUserScript.h"
    3131#include "WKAPICast.h"
     
    6363{
    6464#if ENABLE(CONTENT_EXTENSIONS)
    65     toImpl(userContentControllerRef)->addContentExtension(*toImpl(userContentFilterRef));
     65    toImpl(userContentControllerRef)->addContentRuleList(*toImpl(userContentFilterRef));
    6666#endif
    6767}
     
    7070{
    7171#if ENABLE(CONTENT_EXTENSIONS)
    72     toImpl(userContentControllerRef)->removeAllContentExtensions();
     72    toImpl(userContentControllerRef)->removeAllContentRuleLists();
    7373#endif
    7474}
  • trunk/Source/WebKit2/UIProcess/API/C/WKUserContentExtensionStoreRef.cpp

    r213696 r216809  
    2727#include "WKUserContentExtensionStoreRef.h"
    2828
    29 #include "APIContentExtensionStore.h"
     29#include "APIContentRuleListStore.h"
    3030#include "WKAPICast.h"
    3131
     
    3535{
    3636#if ENABLE(CONTENT_EXTENSIONS)
    37     return toAPI(API::ContentExtensionStore::APIType);
     37    return toAPI(API::ContentRuleListStore::APIType);
    3838#else
    3939    return 0;
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm

    r216807 r216809  
    2525
    2626#include "config.h"
    27 #include "APIContentExtensionStore.h"
     27#include "APIContentRuleListStore.h"
    2828
    2929#if ENABLE(CONTENT_EXTENSIONS)
     
    3333namespace API {
    3434
    35 String ContentExtensionStore::defaultStorePath()
     35String ContentRuleListStore::defaultStorePath(bool legacyFilename)
    3636{
    3737    static dispatch_once_t onceToken;
    38     static NSURL *contentExtensionStoreURL;
     38    static NSURL *contentRuleListStoreURL;
    3939
    4040    dispatch_once(&onceToken, ^{
     
    5151            url = [url URLByAppendingPathComponent:bundleIdentifier isDirectory:YES];
    5252        }
    53 
    54         contentExtensionStoreURL = [[url URLByAppendingPathComponent:@"ContentExtensions" isDirectory:YES] retain];
     53       
     54        if (legacyFilename)
     55            contentRuleListStoreURL = [[url URLByAppendingPathComponent:@"ContentExtensions" isDirectory:YES] retain];
     56        else
     57            contentRuleListStoreURL = [[url URLByAppendingPathComponent:@"ContentRuleLists" isDirectory:YES] retain];
    5558    });
    5659
    57     if (![[NSFileManager defaultManager] createDirectoryAtURL:contentExtensionStoreURL withIntermediateDirectories:YES attributes:nil error:nullptr])
    58         LOG_ERROR("Failed to create directory %@", contentExtensionStoreURL);
     60    if (![[NSFileManager defaultManager] createDirectoryAtURL:contentRuleListStoreURL withIntermediateDirectories:YES attributes:nil error:nullptr])
     61        LOG_ERROR("Failed to create directory %@", contentRuleListStoreURL);
    5962
    60     return contentExtensionStoreURL.absoluteURL.path.fileSystemRepresentation;
     63    return contentRuleListStoreURL.absoluteURL.path.fileSystemRepresentation;
    6164}
    6265
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentRuleList.h

    r216807 r216809  
    2929
    3030WK_CLASS_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA))
    31 @interface WKContentExtension : NSObject
     31@interface WKContentRuleList : NSObject
    3232
    3333/*! @abstract A copy of the identifier of the content extension. */
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentRuleList.mm

    r216807 r216809  
    2525
    2626#import "config.h"
    27 #import "WKContentExtensionInternal.h"
     27#import "WKContentRuleListInternal.h"
    2828
    2929#if WK_API_ENABLED
    3030
    31 #include "WebCompiledContentExtension.h"
     31#include "WebCompiledContentRuleList.h"
    3232
    33 @implementation WKContentExtension
     33@implementation WKContentRuleList
    3434
    3535- (void)dealloc
    3636{
    37     _contentExtension->~ContentExtension();
     37    _contentRuleList->~ContentRuleList();
    3838
    3939    [super dealloc];
     
    4444- (API::Object&)_apiObject
    4545{
    46     return *_contentExtension;
     46    return *_contentRuleList;
    4747}
    4848
    4949- (NSString *)identifier
    5050{
    51     return _contentExtension->name();
     51    return _contentRuleList->name();
    5252}
    5353
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentRuleListInternal.h

    r216807 r216809  
    2424 */
    2525
    26 #import "WKContentExtension.h"
     26#import "WKContentRuleList.h"
    2727
    2828#if WK_API_ENABLED
    2929
    30 #import "APIContentExtension.h"
     30#import "APIContentRuleList.h"
    3131#import "WKObject.h"
    3232
    3333namespace WebKit {
    3434
    35 inline WKContentExtension *wrapper(API::ContentExtension& contentExtension)
     35inline WKContentRuleList *wrapper(API::ContentRuleList& contentRuleList)
    3636{
    37     ASSERT([contentExtension.wrapper() isKindOfClass:[WKContentExtension class]]);
    38     return (WKContentExtension *)contentExtension.wrapper();
     37    ASSERT([contentRuleList.wrapper() isKindOfClass:[WKContentRuleList class]]);
     38    return (WKContentRuleList *)contentRuleList.wrapper();
    3939}
    4040
    4141}
    4242
    43 @interface WKContentExtension () <WKObject> {
     43@interface WKContentRuleList () <WKObject> {
    4444@package
    45     API::ObjectStorage<API::ContentExtension> _contentExtension;
     45    API::ObjectStorage<API::ContentRuleList> _contentRuleList;
    4646}
    4747@end
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentRuleListStore.h

    r216807 r216809  
    2828#if WK_API_ENABLED
    2929
    30 @class WKContentExtension;
     30@class WKContentRuleList;
    3131
    3232WK_CLASS_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA))
    33 @interface WKContentExtensionStore : NSObject
     33@interface WKContentRuleListStore : NSObject
    3434
    3535+ (instancetype)defaultStore;
    3636+ (instancetype)storeWithURL:(NSURL *)url;
    3737
    38 - (void)compileContentExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *) encodedContentExtension completionHandler:(void (^)(WKContentExtension *, NSError *))completionHandler;
    39 - (void)lookUpContentExtensionForIdentifier:(NSString *)identifier completionHandler:(void (^)(WKContentExtension *, NSError *))completionHandler;
    40 - (void)removeContentExtensionForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSError *))completionHandler;
    41 - (void)getAvailableContentExtensionIdentifiers:(void (^)(NSArray<NSString *>*))completionHandler;
     38- (void)compileContentRuleListForIdentifier:(NSString *)identifier encodedContentRuleList:(NSString *) encodedContentRuleList completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler;
     39- (void)lookUpContentRuleListForIdentifier:(NSString *)identifier completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler;
     40- (void)removeContentRuleListForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSError *))completionHandler;
     41- (void)getAvailableContentRuleListIdentifiers:(void (^)(NSArray<NSString *>*))completionHandler;
    4242
    4343@end
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentRuleListStore.mm

    r216807 r216809  
    2525
    2626#import "config.h"
    27 #import "WKContentExtensionInternal.h"
    28 #import "WKContentExtensionStoreInternal.h"
     27#import "WKContentRuleListInternal.h"
     28#import "WKContentRuleListStoreInternal.h"
    2929
    3030#if WK_API_ENABLED
    3131
    32 #import "APIContentExtensionStore.h"
     32#import "APIContentRuleListStore.h"
    3333#import "WKErrorInternal.h"
    3434#import <wtf/BlockPtr.h>
     
    3636static WKErrorCode toWKErrorCode(const std::error_code& error)
    3737{
    38     ASSERT(error.category() == API::contentExtensionStoreErrorCategory());
    39     switch (static_cast<API::ContentExtensionStore::Error>(error.value())) {
    40     case API::ContentExtensionStore::Error::LookupFailed:
    41         return WKErrorContentExtensionStoreLookUpFailed;
    42     case API::ContentExtensionStore::Error::VersionMismatch:
    43         return WKErrorContentExtensionStoreVersionMismatch;
    44     case API::ContentExtensionStore::Error::CompileFailed:
    45         return WKErrorContentExtensionStoreCompileFailed;
    46     case API::ContentExtensionStore::Error::RemoveFailed:
    47         return WKErrorContentExtensionStoreRemoveFailed;
     38    ASSERT(error.category() == API::contentRuleListStoreErrorCategory());
     39    switch (static_cast<API::ContentRuleListStore::Error>(error.value())) {
     40    case API::ContentRuleListStore::Error::LookupFailed:
     41        return WKErrorContentRuleListStoreLookUpFailed;
     42    case API::ContentRuleListStore::Error::VersionMismatch:
     43        return WKErrorContentRuleListStoreVersionMismatch;
     44    case API::ContentRuleListStore::Error::CompileFailed:
     45        return WKErrorContentRuleListStoreCompileFailed;
     46    case API::ContentRuleListStore::Error::RemoveFailed:
     47        return WKErrorContentRuleListStoreRemoveFailed;
    4848    }
    4949    ASSERT_NOT_REACHED();
     
    5151}
    5252
    53 @implementation WKContentExtensionStore
     53@implementation WKContentRuleListStore
    5454
    5555- (void)dealloc
    5656{
    57     _contentExtensionStore->~ContentExtensionStore();
     57    _contentRuleListStore->~ContentRuleListStore();
    5858
    5959    [super dealloc];
     
    6262+ (instancetype)defaultStore
    6363{
    64     return WebKit::wrapper(API::ContentExtensionStore::defaultStore());
     64    const bool legacyFilename = false;
     65    return WebKit::wrapper(API::ContentRuleListStore::defaultStore(legacyFilename));
    6566}
    6667
    6768+ (instancetype)storeWithURL:(NSURL *)url
    6869{
    69     Ref<API::ContentExtensionStore> store = API::ContentExtensionStore::storeWithPath(url.absoluteURL.fileSystemRepresentation);
     70    const bool legacyFilename = false;
     71    Ref<API::ContentRuleListStore> store = API::ContentRuleListStore::storeWithPath(url.absoluteURL.fileSystemRepresentation, legacyFilename);
    7072    return WebKit::wrapper(store.leakRef());
    7173}
    7274
    73 - (void)compileContentExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *)encodedContentExtension completionHandler:(void (^)(WKContentExtension *, NSError *))completionHandler
     75- (void)compileContentRuleListForIdentifier:(NSString *)identifier encodedContentRuleList:(NSString *)encodedContentRuleList completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler
    7476{
    75     [self _compileContentExtensionForIdentifier:identifier encodedContentExtension:encodedContentExtension completionHandler:completionHandler releasesArgument:NO];
     77    [self _compileContentRuleListForIdentifier:identifier encodedContentRuleList:encodedContentRuleList completionHandler:completionHandler releasesArgument:NO];
    7678}
    7779
    78 - (void)_compileContentExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *)encodedContentExtension completionHandler:(void (^)(WKContentExtension *, NSError *))completionHandler releasesArgument:(BOOL)releasesArgument
     80- (void)_compileContentRuleListForIdentifier:(NSString *)identifier encodedContentRuleList:(NSString *)encodedContentRuleList completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler releasesArgument:(BOOL)releasesArgument
    7981{
    80     String json(encodedContentExtension);
     82    String json(encodedContentRuleList);
    8183    if (releasesArgument) {
    82         [encodedContentExtension release];
    83         encodedContentExtension = nil;
     84        [encodedContentRuleList release];
     85        encodedContentRuleList = nil;
    8486    }
    8587
    86     _contentExtensionStore->compileContentExtension(identifier, WTFMove(json), [completionHandler = makeBlockPtr(completionHandler)](RefPtr<API::ContentExtension> contentExtension, std::error_code error) {
     88    _contentRuleListStore->compileContentRuleList(identifier, WTFMove(json), [completionHandler = makeBlockPtr(completionHandler)](RefPtr<API::ContentRuleList> contentRuleList, std::error_code error) {
    8789        if (error) {
    88             auto userInfo = @{NSHelpAnchorErrorKey: [NSString stringWithFormat:@"Extension compilation failed: %s", error.message().c_str()]};
     90            auto userInfo = @{NSHelpAnchorErrorKey: [NSString stringWithFormat:@"Rule list compilation failed: %s", error.message().c_str()]};
    8991
    90             // error.value() could have a specific compiler error that is not equal to WKErrorContentExtensionStoreCompileFailed.
     92            // error.value() could have a specific compiler error that is not equal to WKErrorContentRuleListStoreCompileFailed.
    9193            // We want to use error.message, but here we want to only pass on CompileFailed with userInfo from the std::error_code.
    92             return completionHandler(nil, [NSError errorWithDomain:WKErrorDomain code:WKErrorContentExtensionStoreCompileFailed userInfo:userInfo]);
     94            return completionHandler(nil, [NSError errorWithDomain:WKErrorDomain code:WKErrorContentRuleListStoreCompileFailed userInfo:userInfo]);
    9395        }
    94         completionHandler(WebKit::wrapper(*contentExtension.get()), nil);
     96        completionHandler(WebKit::wrapper(*contentRuleList.get()), nil);
    9597    });
    9698}
    9799
    98 - (void)lookUpContentExtensionForIdentifier:(NSString *)identifier completionHandler:(void (^)(WKContentExtension *, NSError *))completionHandler
     100- (void)lookUpContentRuleListForIdentifier:(NSString *)identifier completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler
    99101{
    100     _contentExtensionStore->lookupContentExtension(identifier, [completionHandler = makeBlockPtr(completionHandler)](RefPtr<API::ContentExtension> contentExtension, std::error_code error) {
     102    _contentRuleListStore->lookupContentRuleList(identifier, [completionHandler = makeBlockPtr(completionHandler)](RefPtr<API::ContentRuleList> contentRuleList, std::error_code error) {
    101103        if (error) {
    102             auto userInfo = @{NSHelpAnchorErrorKey: [NSString stringWithFormat:@"Extension lookup failed: %s", error.message().c_str()]};
     104            auto userInfo = @{NSHelpAnchorErrorKey: [NSString stringWithFormat:@"Rule list lookup failed: %s", error.message().c_str()]};
    103105            auto wkError = toWKErrorCode(error);
    104             ASSERT(wkError == WKErrorContentExtensionStoreLookUpFailed || wkError == WKErrorContentExtensionStoreVersionMismatch);
     106            ASSERT(wkError == WKErrorContentRuleListStoreLookUpFailed || wkError == WKErrorContentRuleListStoreVersionMismatch);
    105107            return completionHandler(nil, [NSError errorWithDomain:WKErrorDomain code:wkError userInfo:userInfo]);
    106108        }
    107109
    108         completionHandler(WebKit::wrapper(*contentExtension.get()), nil);
     110        completionHandler(WebKit::wrapper(*contentRuleList.get()), nil);
    109111    });
    110112}
    111113
    112 - (void)getAvailableContentExtensionIdentifiers:(void (^)(NSArray<NSString *>*))completionHandler
     114- (void)getAvailableContentRuleListIdentifiers:(void (^)(NSArray<NSString *>*))completionHandler
    113115{
    114     _contentExtensionStore->getAvailableContentExtensionIdentifiers([completionHandler = makeBlockPtr(completionHandler)](Vector<String> identifiers) {
     116    _contentRuleListStore->getAvailableContentRuleListIdentifiers([completionHandler = makeBlockPtr(completionHandler)](Vector<String> identifiers) {
    115117        NSMutableArray<NSString *> *nsIdentifiers = [NSMutableArray arrayWithCapacity:identifiers.size()];
    116118        for (const auto& identifier : identifiers)
     
    120122}
    121123
    122 - (void)removeContentExtensionForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSError *))completionHandler
     124- (void)removeContentRuleListForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSError *))completionHandler
    123125{
    124     _contentExtensionStore->removeContentExtension(identifier, [completionHandler = makeBlockPtr(completionHandler)](std::error_code error) {
     126    _contentRuleListStore->removeContentRuleList(identifier, [completionHandler = makeBlockPtr(completionHandler)](std::error_code error) {
    125127        if (error) {
    126             auto userInfo = @{NSHelpAnchorErrorKey: [NSString stringWithFormat:@"Extension removal failed: %s", error.message().c_str()]};
    127             ASSERT(toWKErrorCode(error) == WKErrorContentExtensionStoreRemoveFailed);
    128             return completionHandler([NSError errorWithDomain:WKErrorDomain code:WKErrorContentExtensionStoreRemoveFailed userInfo:userInfo]);
     128            auto userInfo = @{NSHelpAnchorErrorKey: [NSString stringWithFormat:@"Rule list removal failed: %s", error.message().c_str()]};
     129            ASSERT(toWKErrorCode(error) == WKErrorContentRuleListStoreRemoveFailed);
     130            return completionHandler([NSError errorWithDomain:WKErrorDomain code:WKErrorContentRuleListStoreRemoveFailed userInfo:userInfo]);
    129131        }
    130132
     
    137139- (API::Object&)_apiObject
    138140{
    139     return *_contentExtensionStore;
     141    return *_contentRuleListStore;
    140142}
    141143
    142144@end
    143145
    144 @implementation WKContentExtensionStore (WKPrivate)
     146@implementation WKContentRuleListStore (WKPrivate)
    145147
    146148// For testing only.
    147149
    148 - (void)_removeAllContentExtensions
     150- (void)_removeAllContentRuleLists
    149151{
    150     _contentExtensionStore->synchronousRemoveAllContentExtensions();
     152    _contentRuleListStore->synchronousRemoveAllContentRuleLists();
    151153}
    152154
    153 - (void)_invalidateContentExtensionVersionForIdentifier:(NSString *)identifier
     155- (void)_invalidateContentRuleListVersionForIdentifier:(NSString *)identifier
    154156{
    155     _contentExtensionStore->invalidateContentExtensionVersion(identifier);
     157    _contentRuleListStore->invalidateContentRuleListVersion(identifier);
    156158}
    157159
    158 - (void)_getContentExtensionSourceForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSString*))completionHandler
     160- (void)_getContentRuleListSourceForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSString*))completionHandler
    159161{
    160162    auto handler = adoptNS([completionHandler copy]);
    161     _contentExtensionStore->getContentExtensionSource(identifier, [handler](String source) {
     163    _contentRuleListStore->getContentRuleListSource(identifier, [handler](String source) {
    162164        auto rawHandler = (void (^)(NSString *))handler.get();
    163165        if (source.isNull())
     
    170172// NS_RELEASES_ARGUMENT to keep peak memory usage low.
    171173
    172 - (void)_compileContentExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *)encodedContentExtension completionHandler:(void (^)(WKContentExtension *, NSError *))completionHandler
     174- (void)_compileContentRuleListForIdentifier:(NSString *)identifier encodedContentRuleList:(NSString *)encodedContentRuleList completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler
    173175{
    174     [self _compileContentExtensionForIdentifier:identifier encodedContentExtension:encodedContentExtension completionHandler:completionHandler releasesArgument:YES];
     176    [self _compileContentRuleListForIdentifier:identifier encodedContentRuleList:encodedContentRuleList completionHandler:completionHandler releasesArgument:YES];
     177}
     178
     179+ (instancetype)defaultStoreWithLegacyFilename
     180{
     181    const bool legacyFilename = true;
     182    return WebKit::wrapper(API::ContentRuleListStore::defaultStore(legacyFilename));
     183}
     184
     185+ (instancetype)storeWithURLAndLegacyFilename:(NSURL *)url
     186{
     187    const bool legacyFilename = true;
     188    Ref<API::ContentRuleListStore> store = API::ContentRuleListStore::storeWithPath(url.absoluteURL.fileSystemRepresentation, legacyFilename);
     189    return WebKit::wrapper(store.leakRef());
    175190}
    176191
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentRuleListStoreInternal.h

    r216807 r216809  
    2424 */
    2525
    26 #import "WKContentExtensionStorePrivate.h"
     26#import "WKContentRuleListStorePrivate.h"
    2727
    2828#if WK_API_ENABLED
    2929
    30 #import "APIContentExtensionStore.h"
     30#import "APIContentRuleListStore.h"
    3131#import "WKObject.h"
    3232
    3333namespace WebKit {
    3434
    35 inline WKContentExtensionStore *wrapper(API::ContentExtensionStore& store)
     35inline WKContentRuleListStore *wrapper(API::ContentRuleListStore& store)
    3636{
    37     ASSERT([store.wrapper() isKindOfClass:[WKContentExtensionStore class]]);
    38     return (WKContentExtensionStore *)store.wrapper();
     37    ASSERT([store.wrapper() isKindOfClass:[WKContentRuleListStore class]]);
     38    return (WKContentRuleListStore *)store.wrapper();
    3939}
    4040
    4141}
    4242
    43 @interface WKContentExtensionStore () <WKObject> {
     43@interface WKContentRuleListStore () <WKObject> {
    4444@package
    45     API::ObjectStorage<API::ContentExtensionStore> _contentExtensionStore;
     45    API::ObjectStorage<API::ContentRuleListStore> _contentRuleListStore;
    4646}
    4747@end
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h

    r216807 r216809  
    2424 */
    2525
    26 #import <WebKit/WKContentExtensionStore.h>
     26#import <WebKit/WKContentRuleListStore.h>
    2727
    2828#if WK_API_ENABLED
    2929
    30 @interface WKContentExtensionStore (WKPrivate)
     30@interface WKContentRuleListStore (WKPrivate)
    3131
    3232// For testing only.
    33 - (void)_removeAllContentExtensions;
    34 - (void)_invalidateContentExtensionVersionForIdentifier:(NSString *)identifier;
    35 - (void)_getContentExtensionSourceForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSString*))completionHandler;
     33- (void)_removeAllContentRuleLists;
     34- (void)_invalidateContentRuleListVersionForIdentifier:(NSString *)identifier;
     35- (void)_getContentRuleListSourceForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSString*))completionHandler;
    3636
    3737// NS_RELEASES_ARGUMENT to keep peak memory usage low.
    38 - (void)_compileContentExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *) NS_RELEASES_ARGUMENT encodedContentExtension completionHandler:(void (^)(WKContentExtension *, NSError *))completionHandler;
     38- (void)_compileContentRuleListForIdentifier:(NSString *)identifier encodedContentRuleList:(NSString *) NS_RELEASES_ARGUMENT encodedContentRuleList completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler;
     39
     40// To maintain compatibility with _WKUserContentExtensionStore
     41// FIXME: Add something to existing clients of _WKUserContentExtensionStore to migrate files from legacy filenames,
     42// adopt WKContentRuleListStore, and remove _WKUserContentExtensionStore.
     43+ (instancetype)defaultStoreWithLegacyFilename;
     44+ (instancetype)storeWithURLAndLegacyFilename:(NSURL *)url;
    3945
    4046@end
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKError.h

    r214061 r216809  
    4242 @constant WKErrorJavaScriptExceptionOccurred          Indicates that a JavaScript exception occurred.
    4343 @constant WKErrorJavaScriptResultTypeIsUnsupported    Indicates that the result of JavaScript execution could not be returned.
    44  @constant WKErrorContentExtensionStoreCompileFailed   Indicates that compiling a WKUserContentExtension failed.
    45  @constant WKErrorContentExtensionStoreLookUpFailed    Indicates that looking up a WKUserContentExtension failed.
    46  @constant WKErrorContentExtensionStoreRemoveFailed    Indicates that removing a WKUserContentExtension failed.
    47  @constant WKErrorContentExtensionStoreVersionMismatch Indicates that the WKUserContentExtension version did not match the latest.
     44 @constant WKErrorContentRuleListStoreCompileFailed    Indicates that compiling a WKUserContentRuleList failed.
     45 @constant WKErrorContentRuleListStoreLookUpFailed     Indicates that looking up a WKUserContentRuleList failed.
     46 @constant WKErrorContentRuleListStoreRemoveFailed     Indicates that removing a WKUserContentRuleList failed.
     47 @constant WKErrorContentRuleListStoreVersionMismatch  Indicates that the WKUserContentRuleList version did not match the latest.
    4848 */
    4949typedef NS_ENUM(NSInteger, WKErrorCode) {
     
    5353    WKErrorJavaScriptExceptionOccurred,
    5454    WKErrorJavaScriptResultTypeIsUnsupported WK_API_AVAILABLE(macosx(10.11), ios(9.0)),
    55     WKErrorContentExtensionStoreCompileFailed WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)),
    56     WKErrorContentExtensionStoreLookUpFailed WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)),
    57     WKErrorContentExtensionStoreRemoveFailed WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)),
    58     WKErrorContentExtensionStoreVersionMismatch WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)),
     55    WKErrorContentRuleListStoreCompileFailed WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)),
     56    WKErrorContentRuleListStoreLookUpFailed WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)),
     57    WKErrorContentRuleListStoreRemoveFailed WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)),
     58    WKErrorContentRuleListStoreVersionMismatch WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)),
    5959} WK_API_AVAILABLE(macosx(10.10), ios(8.0));
    6060
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKError.mm

    r214061 r216809  
    5959        return WEB_UI_STRING("JavaScript execution returned a result of an unsupported type", "WKErrorJavaScriptResultTypeIsUnsupported description");
    6060
    61     case WKErrorContentExtensionStoreLookUpFailed:
    62         return WEB_UI_STRING("Looking up a WKUserContentExtension failed", "WKErrorContentExtensionStoreLookupFailed description");
     61    case WKErrorContentRuleListStoreLookUpFailed:
     62        return WEB_UI_STRING("Looking up a WKContentRuleList failed", "WKErrorContentRuleListStoreLookupFailed description");
    6363
    64     case WKErrorContentExtensionStoreVersionMismatch:
    65         return WEB_UI_STRING("Looking up a WKUserContentExtension found a binary that is incompatible", "WKErrorContentExtensionStoreVersionMismatch description");
     64    case WKErrorContentRuleListStoreVersionMismatch:
     65        return WEB_UI_STRING("Looking up a WKContentRuleList found a binary that is incompatible", "WKErrorContentRuleListStoreVersionMismatch description");
    6666
    67     case WKErrorContentExtensionStoreCompileFailed:
    68         return WEB_UI_STRING("Compiling a WKUserContentExtension failed", "WKErrorContentExtensionStoreCompileFailed description");
     67    case WKErrorContentRuleListStoreCompileFailed:
     68        return WEB_UI_STRING("Compiling a WKContentRuleList failed", "WKErrorContentRuleListStoreCompileFailed description");
    6969
    70     case WKErrorContentExtensionStoreRemoveFailed:
    71         return WEB_UI_STRING("Removing a WKUserContentExtension failed", "WKErrorContentExtensionStoreRemoveFailed description");
     70    case WKErrorContentRuleListStoreRemoveFailed:
     71        return WEB_UI_STRING("Removing a WKContentRuleList failed", "WKErrorContentRuleListStoreRemoveFailed description");
    7272    }
    7373}
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.h

    r214061 r216809  
    3232NS_ASSUME_NONNULL_BEGIN
    3333
    34 @class WKContentExtension;
     34@class WKContentRuleList;
    3535@class WKUserScript;
    3636@protocol WKScriptMessageHandler;
     
    7272- (void)removeScriptMessageHandlerForName:(NSString *)name;
    7373
    74 /*! @abstract Adds a user content extension.
    75  @param name The name of the user content extension to add.
     74/*! @abstract Adds a content rule list.
     75 @param contentRuleList The content rule list to add.
    7676 */
    77 - (void)addContentExtension:(WKContentExtension *)contentExtension WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
     77- (void)addContentRuleList:(WKContentRuleList *)contentRuleList WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
    7878
    79 /*! @abstract Removes a user content extension.
    80  @param name The identifier of the user content extension to remove.
     79/*! @abstract Removes a content rule list.
     80 @param contentRuleList The content rule list to remove.
    8181 */
    82 - (void)removeContentExtension:(WKContentExtension *)contentExtension WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
     82- (void)removeContentRuleList:(WKContentRuleList *)contentRuleList WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
    8383
    84 /*! @abstract Removes all associated user content extensions.
     84/*! @abstract Removes all associated content rule lists.
    8585 */
    86 - (void)removeAllContentExtensions WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
     86- (void)removeAllContentRuleLists WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
    8787
    8888@end
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm

    r214061 r216809  
    3131#import "APISerializedScriptValue.h"
    3232#import "APIUserContentWorld.h"
    33 #import "WKContentExtensionInternal.h"
     33#import "WKContentRuleListInternal.h"
    3434#import "WKFrameInfoInternal.h"
    3535#import "WKNSArray.h"
     
    9393}
    9494
    95 - (void)addContentExtension:(WKContentExtension *)contentExtension
    96 {
    97 #if ENABLE(CONTENT_EXTENSIONS)
    98     _userContentControllerProxy->addContentExtension(*contentExtension->_contentExtension);
    99 #endif
    100 }
    101 
    102 - (void)removeContentExtension:(WKContentExtension *)contentExtension
    103 {
    104 #if ENABLE(CONTENT_EXTENSIONS)
    105     _userContentControllerProxy->removeContentExtension(contentExtension->_contentExtension->name());
    106 #endif
    107 }
    108 
    109 - (void)removeAllContentExtensions
    110 {
    111 #if ENABLE(CONTENT_EXTENSIONS)
    112     _userContentControllerProxy->removeAllContentExtensions();
     95- (void)addContentRuleList:(WKContentRuleList *)contentRuleList
     96{
     97#if ENABLE(CONTENT_EXTENSIONS)
     98    _userContentControllerProxy->addContentRuleList(*contentRuleList->_contentRuleList);
     99#endif
     100}
     101
     102- (void)removeContentRuleList:(WKContentRuleList *)contentRuleList
     103{
     104#if ENABLE(CONTENT_EXTENSIONS)
     105    _userContentControllerProxy->removeContentRuleList(contentRuleList->_contentRuleList->name());
     106#endif
     107}
     108
     109- (void)removeAllContentRuleLists
     110{
     111#if ENABLE(CONTENT_EXTENSIONS)
     112    _userContentControllerProxy->removeAllContentRuleLists();
    113113#endif
    114114}
     
    176176{
    177177#if ENABLE(CONTENT_EXTENSIONS)
    178     _userContentControllerProxy->addContentExtension(*userContentFilter->_contentExtension->_contentExtension);
     178    _userContentControllerProxy->addContentRuleList(*userContentFilter->_contentRuleList->_contentRuleList);
    179179#endif
    180180}
     
    183183{
    184184#if ENABLE(CONTENT_EXTENSIONS)
    185     _userContentControllerProxy->removeContentExtension(userContentFilterName);
     185    _userContentControllerProxy->removeContentRuleList(userContentFilterName);
    186186#endif
    187187}
     
    190190{
    191191#if ENABLE(CONTENT_EXTENSIONS)
    192     _userContentControllerProxy->removeAllContentExtensions();
     192    _userContentControllerProxy->removeAllContentRuleLists();
    193193#endif
    194194}
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm

    r214061 r216809  
    2929#if WK_API_ENABLED
    3030
    31 #import "WKContentExtensionStoreInternal.h"
    32 #import "WKContentExtensionStorePrivate.h"
     31#import "WKContentRuleListStoreInternal.h"
     32#import "WKContentRuleListStorePrivate.h"
    3333#import "WKErrorInternal.h"
    3434#import "_WKUserContentExtensionStorePrivate.h"
     
    3939NSString * const _WKUserContentExtensionsDomain = @"WKErrorDomain";
    4040
    41 static NSError *toUserContentExtensionStoreError(const NSError *error)
     41static NSError *toUserContentRuleListStoreError(const NSError *error)
    4242{
    4343    if (!error)
     
    4646    ASSERT(error.domain == WKErrorDomain);
    4747    switch (error.code) {
    48     case WKErrorContentExtensionStoreLookUpFailed:
     48    case WKErrorContentRuleListStoreLookUpFailed:
    4949        return [NSError errorWithDomain:_WKUserContentExtensionsDomain code:_WKUserContentExtensionStoreErrorLookupFailed userInfo:error.userInfo];
    50     case WKErrorContentExtensionStoreVersionMismatch:
     50    case WKErrorContentRuleListStoreVersionMismatch:
    5151        return [NSError errorWithDomain:_WKUserContentExtensionsDomain code:_WKUserContentExtensionStoreErrorVersionMismatch userInfo:error.userInfo];
    52     case WKErrorContentExtensionStoreCompileFailed:
     52    case WKErrorContentRuleListStoreCompileFailed:
    5353        return [NSError errorWithDomain:_WKUserContentExtensionsDomain code:_WKUserContentExtensionStoreErrorCompileFailed userInfo:error.userInfo];
    54     case WKErrorContentExtensionStoreRemoveFailed:
     54    case WKErrorContentRuleListStoreRemoveFailed:
    5555        return [NSError errorWithDomain:_WKUserContentExtensionsDomain code:_WKUserContentExtensionStoreErrorRemoveFailed userInfo:error.userInfo];
    5656    default:
     
    6363+ (instancetype)defaultStore
    6464{
    65     return [[[_WKUserContentExtensionStore alloc] _initWithWKContentExtensionStore:[WKContentExtensionStore defaultStore]] autorelease];
     65    return [[[_WKUserContentExtensionStore alloc] _initWithWKContentRuleListStore:[WKContentRuleListStore defaultStoreWithLegacyFilename]] autorelease];
    6666}
    6767
    6868+ (instancetype)storeWithURL:(NSURL *)url
    6969{
    70     return [[[_WKUserContentExtensionStore alloc] _initWithWKContentExtensionStore:[WKContentExtensionStore storeWithURL:url]] autorelease];
     70    return [[[_WKUserContentExtensionStore alloc] _initWithWKContentRuleListStore:[WKContentRuleListStore storeWithURLAndLegacyFilename:url]] autorelease];
    7171}
    7272
    73 - (void)compileContentExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *)encodedContentExtension completionHandler:(void (^)(_WKUserContentFilter *, NSError *))completionHandler
     73- (void)compileContentExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *)encodedContentRuleList completionHandler:(void (^)(_WKUserContentFilter *, NSError *))completionHandler
    7474{
    75     [_contentExtensionStore _compileContentExtensionForIdentifier:identifier encodedContentExtension:encodedContentExtension completionHandler:^(WKContentExtension *contentExtension, NSError *error) {
    76         _WKUserContentFilter *contentFilter = contentExtension ? [[[_WKUserContentFilter alloc] _initWithWKContentExtension:contentExtension] autorelease] : nil;
    77         completionHandler(contentFilter, toUserContentExtensionStoreError(error));
     75    [_contentRuleListStore _compileContentRuleListForIdentifier:identifier encodedContentRuleList:encodedContentRuleList completionHandler:^(WKContentRuleList *contentRuleList, NSError *error) {
     76        _WKUserContentFilter *contentFilter = contentRuleList ? [[[_WKUserContentFilter alloc] _initWithWKContentRuleList:contentRuleList] autorelease] : nil;
     77        completionHandler(contentFilter, toUserContentRuleListStoreError(error));
    7878    }];
    7979}
     
    8181- (void)lookupContentExtensionForIdentifier:(NSString *)identifier completionHandler:(void (^)(_WKUserContentFilter *, NSError *))completionHandler
    8282{
    83     [_contentExtensionStore lookUpContentExtensionForIdentifier:identifier completionHandler:^(WKContentExtension *contentExtension, NSError *error) {
    84         _WKUserContentFilter *contentFilter = contentExtension ? [[[_WKUserContentFilter alloc] _initWithWKContentExtension:contentExtension] autorelease] : nil;
    85         completionHandler(contentFilter, toUserContentExtensionStoreError(error));
     83    [_contentRuleListStore lookUpContentRuleListForIdentifier:identifier completionHandler:^(WKContentRuleList *contentRuleList, NSError *error) {
     84        _WKUserContentFilter *contentFilter = contentRuleList ? [[[_WKUserContentFilter alloc] _initWithWKContentRuleList:contentRuleList] autorelease] : nil;
     85        completionHandler(contentFilter, toUserContentRuleListStoreError(error));
    8686    }];
    8787}
     
    8989- (void)removeContentExtensionForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSError *))completionHandler
    9090{
    91     [_contentExtensionStore removeContentExtensionForIdentifier:identifier completionHandler:^(NSError *error) {
    92         completionHandler(toUserContentExtensionStoreError(error));
     91    [_contentRuleListStore removeContentRuleListForIdentifier:identifier completionHandler:^(NSError *error) {
     92        completionHandler(toUserContentRuleListStoreError(error));
    9393    }];
    9494}
     
    9898- (API::Object&)_apiObject
    9999{
    100     return [_contentExtensionStore _apiObject];
     100    return [_contentRuleListStore _apiObject];
    101101}
    102102
     
    109109- (void)_removeAllContentExtensions
    110110{
    111     [_contentExtensionStore _removeAllContentExtensions];
     111    [_contentRuleListStore _removeAllContentRuleLists];
    112112}
    113113
    114114- (void)_invalidateContentExtensionVersionForIdentifier:(NSString *)identifier
    115115{
    116     [_contentExtensionStore _invalidateContentExtensionVersionForIdentifier:identifier];
     116    [_contentRuleListStore _invalidateContentRuleListVersionForIdentifier:identifier];
    117117}
    118118
    119 - (id)_initWithWKContentExtensionStore:(WKContentExtensionStore*)contentExtensionStore
     119- (id)_initWithWKContentRuleListStore:(WKContentRuleListStore*)contentRuleListStore
    120120{
    121121    self = [super init];
     
    123123        return nil;
    124124   
    125     _contentExtensionStore = contentExtensionStore;
     125    _contentRuleListStore = contentRuleListStore;
    126126   
    127127    return self;
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStoreInternal.h

    r213696 r216809  
    2828#if WK_API_ENABLED
    2929
    30 #import "APIContentExtensionStore.h"
     30#import "APIContentRuleListStore.h"
    3131#import "WKObject.h"
    3232
    33 @class WKContentExtensionStore;
     33@class WKContentRuleListStore;
    3434
    3535@interface _WKUserContentExtensionStore () <WKObject> {
    3636@package
    37     RetainPtr<WKContentExtensionStore> _contentExtensionStore;
     37    RetainPtr<WKContentRuleListStore> _contentRuleListStore;
    3838}
    3939@end
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h

    r213696 r216809  
    2828#if WK_API_ENABLED
    2929
    30 @class WKContentExtensionStore;
     30@class WKContentRuleListStore;
    3131
    3232@interface _WKUserContentExtensionStore (WKPrivate)
     
    3636- (void)_invalidateContentExtensionVersionForIdentifier:(NSString *)identifier;
    3737
    38 - (id)_initWithWKContentExtensionStore:(WKContentExtensionStore*)contentExtensionStore;
     38- (id)_initWithWKContentRuleListStore:(WKContentRuleListStore*)contentRuleListStore;
    3939
    4040@end
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilter.mm

    r213696 r216809  
    2929#if WK_API_ENABLED
    3030
    31 #include "WebCompiledContentExtension.h"
     31#include "WebCompiledContentRuleList.h"
    3232#include <WebCore/ContentExtensionCompiler.h>
    3333#include <WebCore/ContentExtensionError.h>
     
    4040- (API::Object&)_apiObject
    4141{
    42     return [_contentExtension _apiObject];
     42    return [_contentRuleList _apiObject];
    4343}
    4444
     
    4747@implementation _WKUserContentFilter (WKPrivate)
    4848
    49 - (id)_initWithWKContentExtension:(WKContentExtension*)contentExtension
     49- (id)_initWithWKContentRuleList:(WKContentRuleList*)contentRuleList
    5050{
    5151    self = [super init];
     
    5353        return nil;
    5454   
    55     _contentExtension = contentExtension;
     55    _contentRuleList = contentRuleList;
    5656   
    5757    return self;
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilterInternal.h

    r213696 r216809  
    2828#if WK_API_ENABLED
    2929
    30 #import "APIContentExtension.h"
     30#import "APIContentRuleList.h"
    3131#import "WKObject.h"
    3232
    33 @class WKContentExtension;
     33@class WKContentRuleList;
    3434
    3535@interface _WKUserContentFilter () <WKObject> {
    3636@package
    37     RetainPtr<WKContentExtension> _contentExtension;
     37    RetainPtr<WKContentRuleList> _contentRuleList;
    3838}
    3939@end
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h

    r213696 r216809  
    2828#if WK_API_ENABLED
    2929
    30 @class WKUserContentExtension;
     30@class WKUserContentRuleList;
    3131
    3232@interface _WKUserContentFilter (WKPrivate)
    3333
    34 - (id)_initWithWKContentExtension:(WKContentExtension*)contentExtension;
     34- (id)_initWithWKContentRuleList:(WKContentRuleList*)contentRuleList;
    3535
    3636@end
  • trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp

    r216348 r216809  
    4141
    4242#if ENABLE(CONTENT_EXTENSIONS)
    43 #include "APIContentExtension.h"
    44 #include "WebCompiledContentExtension.h"
     43#include "APIContentRuleList.h"
     44#include "WebCompiledContentRuleList.h"
    4545#endif
    4646
     
    9393
    9494#if ENABLE(CONTENT_EXTENSIONS)
    95     ASSERT(parameters.contentExtensions.isEmpty());
    96     for (const auto& contentExtension : m_contentExtensions.values())
    97         parameters.contentExtensions.append(std::make_pair(contentExtension->name(), contentExtension->compiledExtension().data()));
     95    ASSERT(parameters.contentRuleLists.isEmpty());
     96    for (const auto& contentRuleList : m_contentRuleLists.values())
     97        parameters.contentRuleLists.append(std::make_pair(contentRuleList->name(), contentRuleList->compiledRuleList().data()));
    9898#endif
    9999}
     
    333333
    334334#if ENABLE(CONTENT_EXTENSIONS)
    335 void WebUserContentControllerProxy::addContentExtension(API::ContentExtension& contentExtension)
    336 {
    337     m_contentExtensions.set(contentExtension.name(), &contentExtension);
    338 
    339     auto pair = std::make_pair(contentExtension.name(), contentExtension.compiledExtension().data());
    340 
    341     for (WebProcessProxy* process : m_processes)
    342         process->send(Messages::WebUserContentController::AddContentExtensions({ pair }), m_identifier);
    343 }
    344 
    345 void WebUserContentControllerProxy::removeContentExtension(const String& name)
    346 {
    347     m_contentExtensions.remove(name);
    348 
    349     for (WebProcessProxy* process : m_processes)
    350         process->send(Messages::WebUserContentController::RemoveContentExtension(name), m_identifier);
    351 }
    352 
    353 void WebUserContentControllerProxy::removeAllContentExtensions()
    354 {
    355     m_contentExtensions.clear();
    356 
    357     for (WebProcessProxy* process : m_processes)
    358         process->send(Messages::WebUserContentController::RemoveAllContentExtensions(), m_identifier);
     335void WebUserContentControllerProxy::addContentRuleList(API::ContentRuleList& contentRuleList)
     336{
     337    m_contentRuleLists.set(contentRuleList.name(), &contentRuleList);
     338
     339    auto pair = std::make_pair(contentRuleList.name(), contentRuleList.compiledRuleList().data());
     340
     341    for (WebProcessProxy* process : m_processes)
     342        process->send(Messages::WebUserContentController::AddContentRuleLists({ pair }), m_identifier);
     343}
     344
     345void WebUserContentControllerProxy::removeContentRuleList(const String& name)
     346{
     347    m_contentRuleLists.remove(name);
     348
     349    for (WebProcessProxy* process : m_processes)
     350        process->send(Messages::WebUserContentController::RemoveContentRuleList(name), m_identifier);
     351}
     352
     353void WebUserContentControllerProxy::removeAllContentRuleLists()
     354{
     355    m_contentRuleLists.clear();
     356
     357    for (WebProcessProxy* process : m_processes)
     358        process->send(Messages::WebUserContentController::RemoveAllContentRuleLists(), m_identifier);
    359359}
    360360#endif
  • trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.h

    r215212 r216809  
    3838namespace API {
    3939class Array;
    40 class ContentExtension;
     40class ContentRuleList;
    4141class UserContentWorld;
    4242class UserScript;
     
    9393
    9494#if ENABLE(CONTENT_EXTENSIONS)
    95     void addContentExtension(API::ContentExtension&);
    96     void removeContentExtension(const String&);
    97     void removeAllContentExtensions();
     95    void addContentRuleList(API::ContentRuleList&);
     96    void removeContentRuleList(const String&);
     97    void removeAllContentRuleLists();
    9898#endif
    9999
     
    117117
    118118#if ENABLE(CONTENT_EXTENSIONS)
    119     HashMap<String, RefPtr<API::ContentExtension>> m_contentExtensions;
     119    HashMap<String, RefPtr<API::ContentRuleList>> m_contentRuleLists;
    120120#endif
    121121};
  • trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp

    r216473 r216809  
    2828
    2929#include "APIArray.h"
    30 #include "APIContentExtension.h"
     30#include "APIContentRuleList.h"
    3131#include "APIUserScript.h"
    3232#include "APIUserStyleSheet.h"
    33 #include "WebCompiledContentExtension.h"
     33#include "WebCompiledContentRuleList.h"
    3434#include "WebPageProxy.h"
    3535#include "WebPreferences.h"
  • trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r216690 r216809  
    11691169                5CBC9B8D1C65279C00A8FDCF /* NetworkDataTaskCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CBC9B8B1C65257300A8FDCF /* NetworkDataTaskCocoa.mm */; };
    11701170                5CBC9B8E1C652CA000A8FDCF /* NetworkDataTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CBC9B891C6524A500A8FDCF /* NetworkDataTask.h */; };
    1171                 5CD286511E7235990094FDC8 /* WKContentExtensionStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD2864D1E722F440094FDC8 /* WKContentExtensionStore.h */; settings = {ATTRIBUTES = (Public, ); }; };
    1172                 5CD286521E7235A60094FDC8 /* WKContentExtension.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CD2864B1E722F440094FDC8 /* WKContentExtension.mm */; };
     1171                5CD286511E7235990094FDC8 /* WKContentRuleListStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD2864D1E722F440094FDC8 /* WKContentRuleListStore.h */; settings = {ATTRIBUTES = (Public, ); }; };
     1172                5CD286521E7235A60094FDC8 /* WKContentRuleList.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CD2864B1E722F440094FDC8 /* WKContentRuleList.mm */; };
    11731173                5CD286531E7235AA0094FDC8 /* _WKUserContentFilterPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD286491E722F440094FDC8 /* _WKUserContentFilterPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
    1174                 5CD286541E7235B10094FDC8 /* WKContentExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD2864A1E722F440094FDC8 /* WKContentExtension.h */; settings = {ATTRIBUTES = (Public, ); }; };
    1175                 5CD286551E7235B80094FDC8 /* WKContentExtensionInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD2864C1E722F440094FDC8 /* WKContentExtensionInternal.h */; };
    1176                 5CD286561E7235C60094FDC8 /* WKContentExtensionStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CD2864E1E722F440094FDC8 /* WKContentExtensionStore.mm */; };
    1177                 5CD286571E7235C90094FDC8 /* WKContentExtensionStoreInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD2864F1E722F440094FDC8 /* WKContentExtensionStoreInternal.h */; };
    1178                 5CD286581E7235D10094FDC8 /* WKContentExtensionStorePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD286501E722F440094FDC8 /* WKContentExtensionStorePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1174                5CD286541E7235B10094FDC8 /* WKContentRuleList.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD2864A1E722F440094FDC8 /* WKContentRuleList.h */; settings = {ATTRIBUTES = (Public, ); }; };
     1175                5CD286551E7235B80094FDC8 /* WKContentRuleListInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD2864C1E722F440094FDC8 /* WKContentRuleListInternal.h */; };
     1176                5CD286561E7235C60094FDC8 /* WKContentRuleListStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CD2864E1E722F440094FDC8 /* WKContentRuleListStore.mm */; };
     1177                5CD286571E7235C90094FDC8 /* WKContentRuleListStoreInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD2864F1E722F440094FDC8 /* WKContentRuleListStoreInternal.h */; };
     1178                5CD286581E7235D10094FDC8 /* WKContentRuleListStorePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD286501E722F440094FDC8 /* WKContentRuleListStorePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
    11791179                5CE85B201C88E64B0070BFCE /* PingLoad.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CE85B1F1C88E6430070BFCE /* PingLoad.h */; };
    11801180                5CFECB041E1ED1CC00F88504 /* LegacyCustomProtocolManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CFECB031E1ED1C800F88504 /* LegacyCustomProtocolManager.cpp */; };
     
    12341234                7C361D79192803BD0036A59D /* WebUserContentControllerProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C361D77192803BD0036A59D /* WebUserContentControllerProxyMessages.h */; };
    12351235                7C387434172F5615001BD88A /* PageBanner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C387433172F5615001BD88A /* PageBanner.cpp */; };
    1236                 7C3A06A71AAB903E009D74BA /* APIContentExtensionStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3A06A51AAB903E009D74BA /* APIContentExtensionStore.cpp */; };
    1237                 7C3A06A81AAB903E009D74BA /* APIContentExtensionStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3A06A61AAB903E009D74BA /* APIContentExtensionStore.h */; };
     1236                7C3A06A71AAB903E009D74BA /* APIContentRuleListStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3A06A51AAB903E009D74BA /* APIContentRuleListStore.cpp */; };
     1237                7C3A06A81AAB903E009D74BA /* APIContentRuleListStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3A06A61AAB903E009D74BA /* APIContentRuleListStore.h */; };
    12381238                7C3F8C90173AF52D007B7F39 /* PluginInformation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3F8C8E173AF52D007B7F39 /* PluginInformation.cpp */; };
    12391239                7C3F8C91173AF52D007B7F39 /* PluginInformation.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3F8C8F173AF52D007B7F39 /* PluginInformation.h */; };
     
    12431243                7C4694D01A51E36800AD5845 /* WebPasteboardProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4694CD1A51E36800AD5845 /* WebPasteboardProxy.cpp */; };
    12441244                7C4694D11A51E36800AD5845 /* WebPasteboardProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C4694CE1A51E36800AD5845 /* WebPasteboardProxy.h */; };
    1245                 7C4ABED01AA8E9F00088AA37 /* WebCompiledContentExtension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4ABECE1AA8E9F00088AA37 /* WebCompiledContentExtension.cpp */; };
    1246                 7C4ABED11AA8E9F00088AA37 /* WebCompiledContentExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C4ABECF1AA8E9F00088AA37 /* WebCompiledContentExtension.h */; };
    1247                 7C4ABED41AA8FCB80088AA37 /* WebCompiledContentExtensionData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4ABED21AA8FCB80088AA37 /* WebCompiledContentExtensionData.cpp */; };
    1248                 7C4ABED51AA8FCB80088AA37 /* WebCompiledContentExtensionData.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C4ABED31AA8FCB80088AA37 /* WebCompiledContentExtensionData.h */; };
     1245                7C4ABED01AA8E9F00088AA37 /* WebCompiledContentRuleList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4ABECE1AA8E9F00088AA37 /* WebCompiledContentRuleList.cpp */; };
     1246                7C4ABED11AA8E9F00088AA37 /* WebCompiledContentRuleList.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C4ABECF1AA8E9F00088AA37 /* WebCompiledContentRuleList.h */; };
     1247                7C4ABED41AA8FCB80088AA37 /* WebCompiledContentRuleListData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4ABED21AA8FCB80088AA37 /* WebCompiledContentRuleListData.cpp */; };
     1248                7C4ABED51AA8FCB80088AA37 /* WebCompiledContentRuleListData.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C4ABED31AA8FCB80088AA37 /* WebCompiledContentRuleListData.h */; };
    12491249                7C6D37FC172F555F009D2847 /* PageBannerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C6D37FA172F555F009D2847 /* PageBannerMac.mm */; };
    12501250                7C6E70FB18B2DC7A00F24E2E /* WebProcessCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C6E70F918B2D4A000F24E2E /* WebProcessCocoa.mm */; };
     
    12681268                7C89D2A41A678875003A5FDE /* WKUserScriptRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C89D2A21A678875003A5FDE /* WKUserScriptRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
    12691269                7C89D2A61A6789EA003A5FDE /* APIUserScript.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89D2A51A6789EA003A5FDE /* APIUserScript.cpp */; };
    1270                 7C89D2B31A6B068C003A5FDE /* APIContentExtension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89D2B11A6B068C003A5FDE /* APIContentExtension.cpp */; };
    1271                 7C89D2B41A6B068C003A5FDE /* APIContentExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C89D2B21A6B068C003A5FDE /* APIContentExtension.h */; };
     1270                7C89D2B31A6B068C003A5FDE /* APIContentRuleList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89D2B11A6B068C003A5FDE /* APIContentRuleList.cpp */; };
     1271                7C89D2B41A6B068C003A5FDE /* APIContentRuleList.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C89D2B21A6B068C003A5FDE /* APIContentRuleList.h */; };
    12721272                7C89D2B61A6B0DD9003A5FDE /* WKUserContentControllerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C89D2B51A6B0DD9003A5FDE /* WKUserContentControllerPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
    12731273                7C89D2B91A6B0F2C003A5FDE /* _WKUserContentFilter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C89D2B71A6B0F2C003A5FDE /* _WKUserContentFilter.mm */; };
     
    13141314                7CE4D2271A4916C200C7F152 /* WebProcessPoolMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE4D2251A4916C200C7F152 /* WebProcessPoolMessageReceiver.cpp */; };
    13151315                7CE4D2281A4916C200C7F152 /* WebProcessPoolMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE4D2261A4916C200C7F152 /* WebProcessPoolMessages.h */; };
    1316                 7CEFA9621AC0999300B910FD /* APIUserContentExtensionStoreCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7CEFA9601AC0999300B910FD /* APIUserContentExtensionStoreCocoa.mm */; };
     1316                7CEFA9621AC0999300B910FD /* APIContentRuleListStoreCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7CEFA9601AC0999300B910FD /* APIContentRuleListStoreCocoa.mm */; };
    13171317                7CF47FF617275B71008ACB91 /* WKBundlePageBanner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CF47FF417275B71008ACB91 /* WKBundlePageBanner.cpp */; };
    13181318                7CF47FF717275B71008ACB91 /* WKBundlePageBanner.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CF47FF517275B71008ACB91 /* WKBundlePageBanner.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    34453445                5CBC9B8B1C65257300A8FDCF /* NetworkDataTaskCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = NetworkDataTaskCocoa.mm; path = NetworkProcess/cocoa/NetworkDataTaskCocoa.mm; sourceTree = "<group>"; };
    34463446                5CD286491E722F440094FDC8 /* _WKUserContentFilterPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKUserContentFilterPrivate.h; sourceTree = "<group>"; };
    3447                 5CD2864A1E722F440094FDC8 /* WKContentExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentExtension.h; sourceTree = "<group>"; };
    3448                 5CD2864B1E722F440094FDC8 /* WKContentExtension.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKContentExtension.mm; sourceTree = "<group>"; };
    3449                 5CD2864C1E722F440094FDC8 /* WKContentExtensionInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentExtensionInternal.h; sourceTree = "<group>"; };
    3450                 5CD2864D1E722F440094FDC8 /* WKContentExtensionStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentExtensionStore.h; sourceTree = "<group>"; };
    3451                 5CD2864E1E722F440094FDC8 /* WKContentExtensionStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKContentExtensionStore.mm; sourceTree = "<group>"; };
    3452                 5CD2864F1E722F440094FDC8 /* WKContentExtensionStoreInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentExtensionStoreInternal.h; sourceTree = "<group>"; };
    3453                 5CD286501E722F440094FDC8 /* WKContentExtensionStorePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentExtensionStorePrivate.h; sourceTree = "<group>"; };
     3447                5CD2864A1E722F440094FDC8 /* WKContentRuleList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentRuleList.h; sourceTree = "<group>"; };
     3448                5CD2864B1E722F440094FDC8 /* WKContentRuleList.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKContentRuleList.mm; sourceTree = "<group>"; };
     3449                5CD2864C1E722F440094FDC8 /* WKContentRuleListInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentRuleListInternal.h; sourceTree = "<group>"; };
     3450                5CD2864D1E722F440094FDC8 /* WKContentRuleListStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentRuleListStore.h; sourceTree = "<group>"; };
     3451                5CD2864E1E722F440094FDC8 /* WKContentRuleListStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKContentRuleListStore.mm; sourceTree = "<group>"; };
     3452                5CD2864F1E722F440094FDC8 /* WKContentRuleListStoreInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentRuleListStoreInternal.h; sourceTree = "<group>"; };
     3453                5CD286501E722F440094FDC8 /* WKContentRuleListStorePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentRuleListStorePrivate.h; sourceTree = "<group>"; };
    34543454                5CE85B1F1C88E6430070BFCE /* PingLoad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PingLoad.h; path = NetworkProcess/PingLoad.h; sourceTree = "<group>"; };
    34553455                5CFECB031E1ED1C800F88504 /* LegacyCustomProtocolManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LegacyCustomProtocolManager.cpp; path = NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp; sourceTree = "<group>"; };
     
    35203520                7C361D77192803BD0036A59D /* WebUserContentControllerProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebUserContentControllerProxyMessages.h; sourceTree = "<group>"; };
    35213521                7C387433172F5615001BD88A /* PageBanner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageBanner.cpp; sourceTree = "<group>"; };
    3522                 7C3A06A51AAB903E009D74BA /* APIContentExtensionStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIContentExtensionStore.cpp; sourceTree = "<group>"; };
    3523                 7C3A06A61AAB903E009D74BA /* APIContentExtensionStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIContentExtensionStore.h; sourceTree = "<group>"; };
     3522                7C3A06A51AAB903E009D74BA /* APIContentRuleListStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIContentRuleListStore.cpp; sourceTree = "<group>"; };
     3523                7C3A06A61AAB903E009D74BA /* APIContentRuleListStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIContentRuleListStore.h; sourceTree = "<group>"; };
    35243524                7C3F8C8E173AF52D007B7F39 /* PluginInformation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginInformation.cpp; sourceTree = "<group>"; };
    35253525                7C3F8C8F173AF52D007B7F39 /* PluginInformation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginInformation.h; sourceTree = "<group>"; };
     
    35303530                7C4694CE1A51E36800AD5845 /* WebPasteboardProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPasteboardProxy.h; sourceTree = "<group>"; };
    35313531                7C4694CF1A51E36800AD5845 /* WebPasteboardProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebPasteboardProxy.messages.in; sourceTree = "<group>"; };
    3532                 7C4ABECE1AA8E9F00088AA37 /* WebCompiledContentExtension.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCompiledContentExtension.cpp; sourceTree = "<group>"; };
    3533                 7C4ABECF1AA8E9F00088AA37 /* WebCompiledContentExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCompiledContentExtension.h; sourceTree = "<group>"; };
    3534                 7C4ABED21AA8FCB80088AA37 /* WebCompiledContentExtensionData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCompiledContentExtensionData.cpp; sourceTree = "<group>"; };
    3535                 7C4ABED31AA8FCB80088AA37 /* WebCompiledContentExtensionData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCompiledContentExtensionData.h; sourceTree = "<group>"; };
     3532                7C4ABECE1AA8E9F00088AA37 /* WebCompiledContentRuleList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCompiledContentRuleList.cpp; sourceTree = "<group>"; };
     3533                7C4ABECF1AA8E9F00088AA37 /* WebCompiledContentRuleList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCompiledContentRuleList.h; sourceTree = "<group>"; };
     3534                7C4ABED21AA8FCB80088AA37 /* WebCompiledContentRuleListData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCompiledContentRuleListData.cpp; sourceTree = "<group>"; };
     3535                7C4ABED31AA8FCB80088AA37 /* WebCompiledContentRuleListData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCompiledContentRuleListData.h; sourceTree = "<group>"; };
    35363536                7C4ED3261A3119D90079BD49 /* InjectedBundleCSSStyleDeclarationHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleCSSStyleDeclarationHandle.cpp; sourceTree = "<group>"; };
    35373537                7C4ED3271A3119D90079BD49 /* InjectedBundleCSSStyleDeclarationHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleCSSStyleDeclarationHandle.h; sourceTree = "<group>"; };
     
    35573557                7C89D2A21A678875003A5FDE /* WKUserScriptRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserScriptRef.h; sourceTree = "<group>"; };
    35583558                7C89D2A51A6789EA003A5FDE /* APIUserScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIUserScript.cpp; sourceTree = "<group>"; };
    3559                 7C89D2B11A6B068C003A5FDE /* APIContentExtension.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIContentExtension.cpp; sourceTree = "<group>"; };
    3560                 7C89D2B21A6B068C003A5FDE /* APIContentExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIContentExtension.h; sourceTree = "<group>"; };
     3559                7C89D2B11A6B068C003A5FDE /* APIContentRuleList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIContentRuleList.cpp; sourceTree = "<group>"; };
     3560                7C89D2B21A6B068C003A5FDE /* APIContentRuleList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIContentRuleList.h; sourceTree = "<group>"; };
    35613561                7C89D2B51A6B0DD9003A5FDE /* WKUserContentControllerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserContentControllerPrivate.h; sourceTree = "<group>"; };
    35623562                7C89D2B71A6B0F2C003A5FDE /* _WKUserContentFilter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKUserContentFilter.mm; sourceTree = "<group>"; };
     
    36053605                7CE4D2251A4916C200C7F152 /* WebProcessPoolMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebProcessPoolMessageReceiver.cpp; sourceTree = "<group>"; };
    36063606                7CE4D2261A4916C200C7F152 /* WebProcessPoolMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcessPoolMessages.h; sourceTree = "<group>"; };
    3607                 7CEFA9601AC0999300B910FD /* APIUserContentExtensionStoreCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = APIUserContentExtensionStoreCocoa.mm; sourceTree = "<group>"; };
     3607                7CEFA9601AC0999300B910FD /* APIContentRuleListStoreCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = APIContentRuleListStoreCocoa.mm; sourceTree = "<group>"; };
    36083608                7CF47FF417275B71008ACB91 /* WKBundlePageBanner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundlePageBanner.cpp; sourceTree = "<group>"; };
    36093609                7CF47FF517275B71008ACB91 /* WKBundlePageBanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundlePageBanner.h; sourceTree = "<group>"; };
     
    49694969                                518D2CAC12D5153B003BB93B /* WebBackForwardListItem.h */,
    49704970                                BCF50726124329AA005955AE /* WebCertificateInfo.h */,
    4971                                 7C4ABECE1AA8E9F00088AA37 /* WebCompiledContentExtension.cpp */,
    4972                                 7C4ABECF1AA8E9F00088AA37 /* WebCompiledContentExtension.h */,
    4973                                 7C4ABED21AA8FCB80088AA37 /* WebCompiledContentExtensionData.cpp */,
    4974                                 7C4ABED31AA8FCB80088AA37 /* WebCompiledContentExtensionData.h */,
     4971                                7C4ABECE1AA8E9F00088AA37 /* WebCompiledContentRuleList.cpp */,
     4972                                7C4ABECF1AA8E9F00088AA37 /* WebCompiledContentRuleList.h */,
     4973                                7C4ABED21AA8FCB80088AA37 /* WebCompiledContentRuleListData.cpp */,
     4974                                7C4ABED31AA8FCB80088AA37 /* WebCompiledContentRuleListData.h */,
    49754975                                BC4A628B147312BE006C681A /* WebConnection.cpp */,
    49764976                                BC4A628C147312BE006C681A /* WebConnection.h */,
     
    56195619                                5CB2378D1DF0E0C200117AA3 /* _WKWebsitePoliciesInternal.h */,
    56205620                                FED3C1DA1B447AE800E0EB7F /* APISerializedScriptValueCocoa.mm */,
    5621                                 7CEFA9601AC0999300B910FD /* APIUserContentExtensionStoreCocoa.mm */,
     5621                                7CEFA9601AC0999300B910FD /* APIContentRuleListStoreCocoa.mm */,
    56225622                                1A3635AB1A3145E500ED6197 /* APIWebsiteDataStoreCocoa.mm */,
    56235623                                1AFDE64319510B5500C48FFA /* LegacyBundleForClass.mm */,
     
    56305630                                2DFF7B6E1DA4CFAF00814614 /* WKBackForwardListItemPrivate.h */,
    56315631                                1A9F28101958F478008CAC72 /* WKBackForwardListPrivate.h */,
    5632                                 5CD2864A1E722F440094FDC8 /* WKContentExtension.h */,
    5633                                 5CD2864B1E722F440094FDC8 /* WKContentExtension.mm */,
    5634                                 5CD2864C1E722F440094FDC8 /* WKContentExtensionInternal.h */,
    5635                                 5CD2864D1E722F440094FDC8 /* WKContentExtensionStore.h */,
    5636                                 5CD2864E1E722F440094FDC8 /* WKContentExtensionStore.mm */,
    5637                                 5CD2864F1E722F440094FDC8 /* WKContentExtensionStoreInternal.h */,
    5638                                 5CD286501E722F440094FDC8 /* WKContentExtensionStorePrivate.h */,
     5632                                5CD2864A1E722F440094FDC8 /* WKContentRuleList.h */,
     5633                                5CD2864B1E722F440094FDC8 /* WKContentRuleList.mm */,
     5634                                5CD2864C1E722F440094FDC8 /* WKContentRuleListInternal.h */,
     5635                                5CD2864D1E722F440094FDC8 /* WKContentRuleListStore.h */,
     5636                                5CD2864E1E722F440094FDC8 /* WKContentRuleListStore.mm */,
     5637                                5CD2864F1E722F440094FDC8 /* WKContentRuleListStoreInternal.h */,
     5638                                5CD286501E722F440094FDC8 /* WKContentRuleListStorePrivate.h */,
    56395639                                1AF4592D19464B2000F9D4A2 /* WKError.h */,
    56405640                                1AF4592C19464B2000F9D4A2 /* WKError.mm */,
     
    68546854                                99C81D5B1C20E817005C4C82 /* APIAutomationClient.h */,
    68556855                                990D28B31C6526D400986977 /* APIAutomationSessionClient.h */,
    6856                                 7C89D2B11A6B068C003A5FDE /* APIContentExtension.cpp */,
    6857                                 7C89D2B21A6B068C003A5FDE /* APIContentExtension.h */,
    6858                                 7C3A06A51AAB903E009D74BA /* APIContentExtensionStore.cpp */,
    6859                                 7C3A06A61AAB903E009D74BA /* APIContentExtensionStore.h */,
     6856                                7C89D2B11A6B068C003A5FDE /* APIContentRuleList.cpp */,
     6857                                7C89D2B21A6B068C003A5FDE /* APIContentRuleList.h */,
     6858                                7C3A06A51AAB903E009D74BA /* APIContentRuleListStore.cpp */,
     6859                                7C3A06A61AAB903E009D74BA /* APIContentRuleListStore.h */,
    68606860                                076E884D1A13CADF005E90FC /* APIContextMenuClient.h */,
    68616861                                7A821F4F1E2F7A5C00604577 /* APICustomProtocolManagerClient.h */,
     
    81928192                                990D28C01C6553F100986977 /* APIAutomationSessionClient.h in Headers */,
    81938193                                1A3DD206125E5A2F004515E6 /* APIClient.h in Headers */,
    8194                                 7C89D2B41A6B068C003A5FDE /* APIContentExtension.h in Headers */,
    8195                                 7C3A06A81AAB903E009D74BA /* APIContentExtensionStore.h in Headers */,
     8194                                7C89D2B41A6B068C003A5FDE /* APIContentRuleList.h in Headers */,
     8195                                7C3A06A81AAB903E009D74BA /* APIContentRuleListStore.h in Headers */,
    81968196                                076E884E1A13CADF005E90FC /* APIContextMenuClient.h in Headers */,
    81978197                                7A821F501E2F7A7500604577 /* APICustomProtocolManagerClient.h in Headers */,
     
    86148614                                3F87B9C0158940D80090FF62 /* WebColorPicker.h in Headers */,
    86158615                                728E86F11795188C0087879E /* WebColorPickerMac.h in Headers */,
    8616                                 7C4ABED11AA8E9F00088AA37 /* WebCompiledContentExtension.h in Headers */,
    8617                                 7C4ABED51AA8FCB80088AA37 /* WebCompiledContentExtensionData.h in Headers */,
     8616                                7C4ABED11AA8E9F00088AA37 /* WebCompiledContentRuleList.h in Headers */,
     8617                                7C4ABED51AA8FCB80088AA37 /* WebCompiledContentRuleListData.h in Headers */,
    86188618                                BC4A6290147312BE006C681A /* WebConnection.h in Headers */,
    86198619                                BC4A6292147312BE006C681A /* WebConnectionClient.h in Headers */,
     
    88608860                                BC5C75C814954DA600BC4775 /* WKConnectionInternal.h in Headers */,
    88618861                                BC4A6297147313A0006C681A /* WKConnectionRef.h in Headers */,
    8862                                 5CD286541E7235B10094FDC8 /* WKContentExtension.h in Headers */,
    8863                                 5CD286551E7235B80094FDC8 /* WKContentExtensionInternal.h in Headers */,
    8864                                 5CD286511E7235990094FDC8 /* WKContentExtensionStore.h in Headers */,
    8865                                 5CD286571E7235C90094FDC8 /* WKContentExtensionStoreInternal.h in Headers */,
    8866                                 5CD286581E7235D10094FDC8 /* WKContentExtensionStorePrivate.h in Headers */,
     8862                                5CD286541E7235B10094FDC8 /* WKContentRuleList.h in Headers */,
     8863                                5CD286551E7235B80094FDC8 /* WKContentRuleListInternal.h in Headers */,
     8864                                5CD286511E7235990094FDC8 /* WKContentRuleListStore.h in Headers */,
     8865                                5CD286571E7235C90094FDC8 /* WKContentRuleListStoreInternal.h in Headers */,
     8866                                5CD286581E7235D10094FDC8 /* WKContentRuleListStorePrivate.h in Headers */,
    88678867                                0FCB4E4C18BBE044000FCFC9 /* WKContentView.h in Headers */,
    88688868                                0FCB4E6C18BBF26A000FCFC9 /* WKContentViewInteraction.h in Headers */,
     
    97569756                                A7D792D61767CB6E00881CBE /* ActivityAssertion.cpp in Sources */,
    97579757                                BC64696F11DBE603006455B0 /* APIArray.cpp in Sources */,
    9758                                 7C89D2B31A6B068C003A5FDE /* APIContentExtension.cpp in Sources */,
    9759                                 7C3A06A71AAB903E009D74BA /* APIContentExtensionStore.cpp in Sources */,
     9758                                7C89D2B31A6B068C003A5FDE /* APIContentRuleList.cpp in Sources */,
     9759                                7C3A06A71AAB903E009D74BA /* APIContentRuleListStore.cpp in Sources */,
    97609760                                1AAB037C185F99D800EDF501 /* APIData.cpp in Sources */,
    97619761                                1A1EF1991A1D5B420023200A /* APIDataCocoa.mm in Sources */,
     
    97849784                                BC90A1D3122DD55E00CC8C50 /* APIURLResponse.cpp in Sources */,
    97859785                                51D1243A1E6E0AAB002B2820 /* APIURLSchemeTask.cpp in Sources */,
    9786                                 7CEFA9621AC0999300B910FD /* APIUserContentExtensionStoreCocoa.mm in Sources */,
     9786                                7CEFA9621AC0999300B910FD /* APIContentRuleListStoreCocoa.mm in Sources */,
    97879787                                7C882DFE1C7E99AC006BF731 /* APIUserContentWorld.cpp in Sources */,
    97889788                                7C89D2A61A6789EA003A5FDE /* APIUserScript.cpp in Sources */,
     
    1018710187                                F036978815F4BF0500C3A80E /* WebColorPicker.cpp in Sources */,
    1018810188                                728E86F21795188C0087879E /* WebColorPickerMac.mm in Sources */,
    10189                                 7C4ABED01AA8E9F00088AA37 /* WebCompiledContentExtension.cpp in Sources */,
    10190                                 7C4ABED41AA8FCB80088AA37 /* WebCompiledContentExtensionData.cpp in Sources */,
     10189                                7C4ABED01AA8E9F00088AA37 /* WebCompiledContentRuleList.cpp in Sources */,
     10190                                7C4ABED41AA8FCB80088AA37 /* WebCompiledContentRuleListData.cpp in Sources */,
    1019110191                                BC4A628F147312BE006C681A /* WebConnection.cpp in Sources */,
    1019210192                                BC4A6291147312BE006C681A /* WebConnectionClient.cpp in Sources */,
     
    1045710457                                BCA284D61492F2C7001F9042 /* WKConnection.mm in Sources */,
    1045810458                                BC4A6296147313A0006C681A /* WKConnectionRef.cpp in Sources */,
    10459                                 5CD286521E7235A60094FDC8 /* WKContentExtension.mm in Sources */,
    10460                                 5CD286561E7235C60094FDC8 /* WKContentExtensionStore.mm in Sources */,
     10459                                5CD286521E7235A60094FDC8 /* WKContentRuleList.mm in Sources */,
     10460                                5CD286561E7235C60094FDC8 /* WKContentRuleListStore.mm in Sources */,
    1046110461                                0FCB4E4D18BBE044000FCFC9 /* WKContentView.mm in Sources */,
    1046210462                                0FCB4E6D18BBF26A000FCFC9 /* WKContentViewInteraction.mm in Sources */,
  • trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp

    r215831 r216809  
    3030#include "FrameInfoData.h"
    3131#include "InjectedBundleScriptWorld.h"
    32 #include "WebCompiledContentExtension.h"
     32#include "WebCompiledContentRuleList.h"
    3333#include "WebFrame.h"
    3434#include "WebPage.h"
     
    340340
    341341#if ENABLE(CONTENT_EXTENSIONS)
    342 void WebUserContentController::addContentExtensions(const Vector<std::pair<String, WebCompiledContentExtensionData>>& contentExtensions)
    343 {
    344     for (const auto& contentExtension : contentExtensions) {
    345         WebCompiledContentExtensionData contentExtensionData = contentExtension.second;
    346         RefPtr<WebCompiledContentExtension> compiledContentExtension = WebCompiledContentExtension::create(WTFMove(contentExtensionData));
    347 
    348         m_contentExtensionBackend.addContentExtension(contentExtension.first, WTFMove(compiledContentExtension));
    349     }
    350 }
    351 
    352 void WebUserContentController::removeContentExtension(const String& name)
     342void WebUserContentController::addContentRuleLists(const Vector<std::pair<String, WebCompiledContentRuleListData>>& contentRuleLists)
     343{
     344    for (const auto& contentRuleList : contentRuleLists) {
     345        WebCompiledContentRuleListData contentRuleListData = contentRuleList.second;
     346        RefPtr<WebCompiledContentRuleList> compiledContentRuleList = WebCompiledContentRuleList::create(WTFMove(contentRuleListData));
     347
     348        m_contentExtensionBackend.addContentExtension(contentRuleList.first, WTFMove(compiledContentRuleList));
     349    }
     350}
     351
     352void WebUserContentController::removeContentRuleList(const String& name)
    353353{
    354354    m_contentExtensionBackend.removeContentExtension(name);
    355355}
    356356
    357 void WebUserContentController::removeAllContentExtensions()
     357void WebUserContentController::removeAllContentRuleLists()
    358358{
    359359    m_contentExtensionBackend.removeAllContentExtensions();
  • trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.h

    r215831 r216809  
    4545
    4646class InjectedBundleScriptWorld;
    47 class WebCompiledContentExtensionData;
     47class WebCompiledContentRuleListData;
    4848class WebUserMessageHandlerDescriptorProxy;
    4949
     
    6868    void addUserScriptMessageHandlers(const Vector<WebScriptMessageHandlerData>&);
    6969#if ENABLE(CONTENT_EXTENSIONS)
    70     void addContentExtensions(const Vector<std::pair<String, WebCompiledContentExtensionData>>&);
     70    void addContentRuleLists(const Vector<std::pair<String, WebCompiledContentRuleListData>>&);
    7171#endif
    7272
     
    9999
    100100#if ENABLE(CONTENT_EXTENSIONS)
    101     void removeContentExtension(const String& name);
    102     void removeAllContentExtensions();
     101    void removeContentRuleList(const String& name);
     102    void removeAllContentRuleLists();
    103103#endif
    104104
  • trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.messages.in

    r213696 r216809  
    4141
    4242#if ENABLE(CONTENT_EXTENSIONS)
    43     AddContentExtensions(Vector<std::pair<String, WebKit::WebCompiledContentExtensionData>> contentFilters);
    44     RemoveContentExtension(String name);
    45     RemoveAllContentExtensions();
     43    AddContentRuleLists(Vector<std::pair<String, WebKit::WebCompiledContentRuleListData>> contentFilters);
     44    RemoveContentRuleList(String name);
     45    RemoveAllContentRuleLists();
    4646#endif
    4747}
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r216696 r216809  
    569569    m_userContentController->addUserScriptMessageHandlers(parameters.messageHandlers);
    570570#if ENABLE(CONTENT_EXTENSIONS)
    571     m_userContentController->addContentExtensions(parameters.contentExtensions);
     571    m_userContentController->addContentRuleLists(parameters.contentRuleLists);
    572572#endif
    573573}
  • trunk/Tools/ChangeLog

    r216808 r216809  
     12017-05-12  Alex Christensen  <achristensen@webkit.org>
     2
     3        Rename WKContentExtension to WKContentRuleList
     4        https://bugs.webkit.org/show_bug.cgi?id=172053
     5        <rdar://problem/32141005>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        * TestWebKitAPI/Tests/WebKit2Cocoa/WKContentExtensionStore.mm:
     10        (WKContentRuleListStoreTest::SetUp):
     11        (TEST_F):
     12        (-[ContentRuleListDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]):
     13        (WKContentExtensionStoreTest::SetUp): Deleted.
     14        (-[ContentExtensionDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]): Deleted.
     15
    1162017-05-12  Keith Miller  <keith_miller@apple.com>
    217
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKContentExtensionStore.mm

    r215807 r216809  
    3131#import "PlatformUtilities.h"
    3232#import "Test.h"
    33 #import <WebKit/WKContentExtension.h>
    34 #import <WebKit/WKContentExtensionStorePrivate.h>
     33#import <WebKit/WKContentRuleList.h>
     34#import <WebKit/WKContentRuleListStorePrivate.h>
    3535#import <wtf/RetainPtr.h>
    3636
    37 class WKContentExtensionStoreTest : public testing::Test {
     37class WKContentRuleListStoreTest : public testing::Test {
    3838public:
    3939    virtual void SetUp()
    4040    {
    41         [[WKContentExtensionStore defaultStore] _removeAllContentExtensions];
     41        [[WKContentRuleListStore defaultStore] _removeAllContentRuleLists];
    4242    }
    4343};
     
    4545static NSString *basicFilter = @"[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\".*webkit.org\"}}]";
    4646
    47 TEST_F(WKContentExtensionStoreTest, Compile)
    48 {
    49     __block bool doneCompiling = false;
    50     [[WKContentExtensionStore defaultStore] compileContentExtensionForIdentifier:@"TestExtension" encodedContentExtension:basicFilter completionHandler:^(WKContentExtension *filter, NSError *error) {
     47TEST_F(WKContentRuleListStoreTest, Compile)
     48{
     49    __block bool doneCompiling = false;
     50    [[WKContentRuleListStore defaultStore] compileContentRuleListForIdentifier:@"TestRuleList" encodedContentRuleList:basicFilter completionHandler:^(WKContentRuleList *filter, NSError *error) {
    5151   
    5252        EXPECT_NOT_NULL(filter);
     
    6565}
    6666
    67 TEST_F(WKContentExtensionStoreTest, InvalidExtension)
    68 {
    69     __block bool doneCompiling = false;
    70     [[WKContentExtensionStore defaultStore] compileContentExtensionForIdentifier:@"TestExtension" encodedContentExtension:invalidFilter completionHandler:^(WKContentExtension *filter, NSError *error) {
     67TEST_F(WKContentRuleListStoreTest, InvalidRuleList)
     68{
     69    __block bool doneCompiling = false;
     70    [[WKContentRuleListStore defaultStore] compileContentRuleListForIdentifier:@"TestRuleList" encodedContentRuleList:invalidFilter completionHandler:^(WKContentRuleList *filter, NSError *error) {
    7171   
    7272        EXPECT_NULL(filter);
    7373        EXPECT_NOT_NULL(error);
    7474        checkDomain(error);
    75         EXPECT_EQ(error.code, WKErrorContentExtensionStoreCompileFailed);
    76         EXPECT_STREQ("Extension compilation failed: Failed to parse the JSON String.", [[error helpAnchor] UTF8String]);
    77 
    78         doneCompiling = true;
    79     }];
    80     TestWebKitAPI::Util::run(&doneCompiling);
    81 }
    82 
    83 TEST_F(WKContentExtensionStoreTest, Lookup)
    84 {
    85     __block bool doneCompiling = false;
    86     [[WKContentExtensionStore defaultStore] compileContentExtensionForIdentifier:@"TestExtension" encodedContentExtension:basicFilter completionHandler:^(WKContentExtension *filter, NSError *error) {
     75        EXPECT_EQ(error.code, WKErrorContentRuleListStoreCompileFailed);
     76        EXPECT_STREQ("Rule list compilation failed: Failed to parse the JSON String.", [[error helpAnchor] UTF8String]);
     77
     78        doneCompiling = true;
     79    }];
     80    TestWebKitAPI::Util::run(&doneCompiling);
     81}
     82
     83TEST_F(WKContentRuleListStoreTest, Lookup)
     84{
     85    __block bool doneCompiling = false;
     86    [[WKContentRuleListStore defaultStore] compileContentRuleListForIdentifier:@"TestRuleList" encodedContentRuleList:basicFilter completionHandler:^(WKContentRuleList *filter, NSError *error) {
    8787   
    8888        EXPECT_NOT_NULL(filter);
     
    9494
    9595    __block bool doneLookingUp = false;
    96     [[WKContentExtensionStore defaultStore] lookUpContentExtensionForIdentifier:@"TestExtension" completionHandler:^(WKContentExtension *filter, NSError *error) {
    97 
    98         EXPECT_STREQ(filter.identifier.UTF8String, "TestExtension");
     96    [[WKContentRuleListStore defaultStore] lookUpContentRuleListForIdentifier:@"TestRuleList" completionHandler:^(WKContentRuleList *filter, NSError *error) {
     97
     98        EXPECT_STREQ(filter.identifier.UTF8String, "TestRuleList");
    9999        EXPECT_NOT_NULL(filter);
    100100        EXPECT_NULL(error);
     
    105105}
    106106
    107 TEST_F(WKContentExtensionStoreTest, EncodedIdentifier)
     107TEST_F(WKContentRuleListStoreTest, EncodedIdentifier)
    108108{
    109109    // FIXME: U+00C4 causes problems here. Using the output of encodeForFileName with
     
    111111    NSString *identifier = @":;%25%+25И😍";
    112112    __block bool done = false;
    113     [[WKContentExtensionStore defaultStore] compileContentExtensionForIdentifier:identifier encodedContentExtension:basicFilter completionHandler:^(WKContentExtension *filter, NSError *error) {
     113    [[WKContentRuleListStore defaultStore] compileContentRuleListForIdentifier:identifier encodedContentRuleList:basicFilter completionHandler:^(WKContentRuleList *filter, NSError *error) {
    114114
    115115        EXPECT_STREQ(filter.identifier.UTF8String, identifier.UTF8String);
    116116
    117         [[WKContentExtensionStore defaultStore] getAvailableContentExtensionIdentifiers:^(NSArray<NSString *> *identifiers) {
     117        [[WKContentRuleListStore defaultStore] getAvailableContentRuleListIdentifiers:^(NSArray<NSString *> *identifiers) {
    118118            EXPECT_EQ(identifiers.count, 1u);
    119119            EXPECT_EQ(identifiers[0].length, identifier.length);
     
    126126}
    127127
    128 TEST_F(WKContentExtensionStoreTest, NonExistingIdentifierLookup)
     128TEST_F(WKContentRuleListStoreTest, NonExistingIdentifierLookup)
    129129{
    130130    __block bool doneLookingUp = false;
    131     [[WKContentExtensionStore defaultStore] lookUpContentExtensionForIdentifier:@"DoesNotExist" completionHandler:^(WKContentExtension *filter, NSError *error) {
     131    [[WKContentRuleListStore defaultStore] lookUpContentRuleListForIdentifier:@"DoesNotExist" completionHandler:^(WKContentRuleList *filter, NSError *error) {
    132132   
    133133        EXPECT_NULL(filter);
    134134        EXPECT_NOT_NULL(error);
    135135        checkDomain(error);
    136         EXPECT_EQ(error.code, WKErrorContentExtensionStoreLookUpFailed);
    137         EXPECT_STREQ("Extension lookup failed: Unspecified error during lookup.", [[error helpAnchor] UTF8String]);
     136        EXPECT_EQ(error.code, WKErrorContentRuleListStoreLookUpFailed);
     137        EXPECT_STREQ("Rule list lookup failed: Unspecified error during lookup.", [[error helpAnchor] UTF8String]);
    138138       
    139139        doneLookingUp = true;
     
    142142}
    143143
    144 TEST_F(WKContentExtensionStoreTest, VersionMismatch)
    145 {
    146     __block bool doneCompiling = false;
    147     [[WKContentExtensionStore defaultStore] compileContentExtensionForIdentifier:@"TestExtension" encodedContentExtension:basicFilter completionHandler:^(WKContentExtension *filter, NSError *error)
     144TEST_F(WKContentRuleListStoreTest, VersionMismatch)
     145{
     146    __block bool doneCompiling = false;
     147    [[WKContentRuleListStore defaultStore] compileContentRuleListForIdentifier:@"TestRuleList" encodedContentRuleList:basicFilter completionHandler:^(WKContentRuleList *filter, NSError *error)
    148148    {
    149149       
     
    155155    TestWebKitAPI::Util::run(&doneCompiling);
    156156
    157     [[WKContentExtensionStore defaultStore] _invalidateContentExtensionVersionForIdentifier:@"TestExtension"];
     157    [[WKContentRuleListStore defaultStore] _invalidateContentRuleListVersionForIdentifier:@"TestRuleList"];
    158158   
    159159    __block bool doneLookingUp = false;
    160     [[WKContentExtensionStore defaultStore] lookUpContentExtensionForIdentifier:@"TestExtension" completionHandler:^(WKContentExtension *filter, NSError *error)
     160    [[WKContentRuleListStore defaultStore] lookUpContentRuleListForIdentifier:@"TestRuleList" completionHandler:^(WKContentRuleList *filter, NSError *error)
    161161    {
    162162       
     
    164164        EXPECT_NOT_NULL(error);
    165165        checkDomain(error);
    166         EXPECT_EQ(error.code, WKErrorContentExtensionStoreVersionMismatch);
    167         EXPECT_STREQ("Extension lookup failed: Version of file does not match version of interpreter.", [[error helpAnchor] UTF8String]);
     166        EXPECT_EQ(error.code, WKErrorContentRuleListStoreVersionMismatch);
     167        EXPECT_STREQ("Rule list lookup failed: Version of file does not match version of interpreter.", [[error helpAnchor] UTF8String]);
    168168       
    169169        doneLookingUp = true;
     
    172172
    173173    __block bool doneGettingSource = false;
    174     [[WKContentExtensionStore defaultStore] _getContentExtensionSourceForIdentifier:@"TestExtension" completionHandler:^(NSString* source) {
     174    [[WKContentRuleListStore defaultStore] _getContentRuleListSourceForIdentifier:@"TestRuleList" completionHandler:^(NSString* source) {
    175175        EXPECT_NULL(source);
    176176        doneGettingSource = true;
     
    179179}
    180180
    181 TEST_F(WKContentExtensionStoreTest, Removal)
    182 {
    183     __block bool doneCompiling = false;
    184     [[WKContentExtensionStore defaultStore] compileContentExtensionForIdentifier:@"TestExtension" encodedContentExtension:basicFilter completionHandler:^(WKContentExtension *filter, NSError *error) {
     181TEST_F(WKContentRuleListStoreTest, Removal)
     182{
     183    __block bool doneCompiling = false;
     184    [[WKContentRuleListStore defaultStore] compileContentRuleListForIdentifier:@"TestRuleList" encodedContentRuleList:basicFilter completionHandler:^(WKContentRuleList *filter, NSError *error) {
    185185   
    186186        EXPECT_NOT_NULL(filter);
     
    192192
    193193    __block bool doneRemoving = false;
    194     [[WKContentExtensionStore defaultStore] removeContentExtensionForIdentifier:@"TestExtension" completionHandler:^(NSError *error) {
     194    [[WKContentRuleListStore defaultStore] removeContentRuleListForIdentifier:@"TestRuleList" completionHandler:^(NSError *error) {
    195195        EXPECT_NULL(error);
    196196
     
    200200}
    201201
    202 TEST_F(WKContentExtensionStoreTest, NonExistingIdentifierRemove)
     202TEST_F(WKContentRuleListStoreTest, NonExistingIdentifierRemove)
    203203{
    204204    __block bool doneRemoving = false;
    205     [[WKContentExtensionStore defaultStore] removeContentExtensionForIdentifier:@"DoesNotExist" completionHandler:^(NSError *error) {
     205    [[WKContentRuleListStore defaultStore] removeContentRuleListForIdentifier:@"DoesNotExist" completionHandler:^(NSError *error) {
    206206        EXPECT_NOT_NULL(error);
    207207        checkDomain(error);
    208         EXPECT_EQ(error.code, WKErrorContentExtensionStoreRemoveFailed);
    209         EXPECT_STREQ("Extension removal failed: Unspecified error during remove.", [[error helpAnchor] UTF8String]);
     208        EXPECT_EQ(error.code, WKErrorContentRuleListStoreRemoveFailed);
     209        EXPECT_STREQ("Rule list removal failed: Unspecified error during remove.", [[error helpAnchor] UTF8String]);
    210210
    211211        doneRemoving = true;
     
    214214}
    215215
    216 TEST_F(WKContentExtensionStoreTest, NonDefaultStore)
    217 {
    218     NSURL *tempDir = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"ContentExtensionTest"] isDirectory:YES];
    219     WKContentExtensionStore *store = [WKContentExtensionStore storeWithURL:tempDir];
    220     NSString *identifier = @"TestExtension";
    221     NSString *fileName = @"ContentExtension-TestExtension";
     216TEST_F(WKContentRuleListStoreTest, NonDefaultStore)
     217{
     218    NSURL *tempDir = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"ContentRuleListTest"] isDirectory:YES];
     219    WKContentRuleListStore *store = [WKContentRuleListStore storeWithURL:tempDir];
     220    NSString *identifier = @"TestRuleList";
     221    NSString *fileName = @"ContentRuleList-TestRuleList";
    222222
    223223    __block bool doneGettingAvailableIdentifiers = false;
    224     [store getAvailableContentExtensionIdentifiers:^(NSArray<NSString *> *identifiers) {
     224    [store getAvailableContentRuleListIdentifiers:^(NSArray<NSString *> *identifiers) {
    225225        EXPECT_NOT_NULL(identifiers);
    226226        EXPECT_EQ(identifiers.count, 0u);
     
    230230   
    231231    __block bool doneCompiling = false;
    232     [store compileContentExtensionForIdentifier:identifier encodedContentExtension:basicFilter completionHandler:^(WKContentExtension *filter, NSError *error) {
     232    [store compileContentRuleListForIdentifier:identifier encodedContentRuleList:basicFilter completionHandler:^(WKContentRuleList *filter, NSError *error) {
    233233        EXPECT_NOT_NULL(filter);
    234234        EXPECT_NULL(error);
     
    238238
    239239    doneGettingAvailableIdentifiers = false;
    240     [store getAvailableContentExtensionIdentifiers:^(NSArray<NSString *> *identifiers) {
     240    [store getAvailableContentRuleListIdentifiers:^(NSArray<NSString *> *identifiers) {
    241241        EXPECT_NOT_NULL(identifiers);
    242242        EXPECT_EQ(identifiers.count, 1u);
    243         EXPECT_STREQ(identifiers[0].UTF8String, "TestExtension");
     243        EXPECT_STREQ(identifiers[0].UTF8String, "TestRuleList");
    244244        doneGettingAvailableIdentifiers = true;
    245245    }];
     
    251251   
    252252    __block bool doneCheckingSource = false;
    253     [store _getContentExtensionSourceForIdentifier:identifier completionHandler:^(NSString *source) {
     253    [store _getContentRuleListSourceForIdentifier:identifier completionHandler:^(NSString *source) {
    254254        EXPECT_NOT_NULL(source);
    255255        EXPECT_STREQ(basicFilter.UTF8String, source.UTF8String);
     
    259259   
    260260    __block bool doneRemoving = false;
    261     [store removeContentExtensionForIdentifier:identifier completionHandler:^(NSError *error) {
     261    [store removeContentRuleListForIdentifier:identifier completionHandler:^(NSError *error) {
    262262        EXPECT_NULL(error);
    263263        doneRemoving = true;
     
    269269}
    270270
    271 TEST_F(WKContentExtensionStoreTest, MultipleExtensions)
     271TEST_F(WKContentRuleListStoreTest, MultipleRuleLists)
    272272{
    273273    __block bool done = false;
    274     [[WKContentExtensionStore defaultStore] compileContentExtensionForIdentifier:@"FirstExtension" encodedContentExtension:basicFilter completionHandler:^(WKContentExtension *filter, NSError *error) {
    275         EXPECT_NOT_NULL(filter);
    276         EXPECT_NULL(error);
    277         [[WKContentExtensionStore defaultStore] compileContentExtensionForIdentifier:@"SecondExtension" encodedContentExtension:basicFilter completionHandler:^(WKContentExtension *filter, NSError *error) {
     274    [[WKContentRuleListStore defaultStore] compileContentRuleListForIdentifier:@"FirstRuleList" encodedContentRuleList:basicFilter completionHandler:^(WKContentRuleList *filter, NSError *error) {
     275        EXPECT_NOT_NULL(filter);
     276        EXPECT_NULL(error);
     277        [[WKContentRuleListStore defaultStore] compileContentRuleListForIdentifier:@"SecondRuleList" encodedContentRuleList:basicFilter completionHandler:^(WKContentRuleList *filter, NSError *error) {
    278278            EXPECT_NOT_NULL(filter);
    279279            EXPECT_NULL(error);
    280             [[WKContentExtensionStore defaultStore] getAvailableContentExtensionIdentifiers:^(NSArray<NSString *> *identifiers) {
     280            [[WKContentRuleListStore defaultStore] getAvailableContentRuleListIdentifiers:^(NSArray<NSString *> *identifiers) {
    281281                EXPECT_NOT_NULL(identifiers);
    282282                EXPECT_EQ(identifiers.count, 2u);
    283                 EXPECT_STREQ(identifiers[0].UTF8String, "FirstExtension");
    284                 EXPECT_STREQ(identifiers[1].UTF8String, "SecondExtension");
     283                EXPECT_STREQ(identifiers[0].UTF8String, "FirstRuleList");
     284                EXPECT_STREQ(identifiers[1].UTF8String, "SecondRuleList");
    285285                done = true;
    286286            }];
     
    290290}
    291291
    292 TEST_F(WKContentExtensionStoreTest, NonASCIISource)
     292TEST_F(WKContentRuleListStoreTest, NonASCIISource)
    293293{
    294294    static NSString *nonASCIIFilter = @"[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\".*webkit.org\"}, \"unused\":\"💩\"}]";
    295     NSURL *tempDir = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"ContentExtensionTest"] isDirectory:YES];
    296     WKContentExtensionStore *store = [WKContentExtensionStore storeWithURL:tempDir];
    297     NSString *identifier = @"TestExtension";
    298     NSString *fileName = @"ContentExtension-TestExtension";
     295    NSURL *tempDir = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"ContentRuleListTest"] isDirectory:YES];
     296    WKContentRuleListStore *store = [WKContentRuleListStore storeWithURL:tempDir];
     297    NSString *identifier = @"TestRuleList";
     298    NSString *fileName = @"ContentRuleList-TestRuleList";
    299299   
    300300    __block bool done = false;
    301     [store compileContentExtensionForIdentifier:identifier encodedContentExtension:nonASCIIFilter completionHandler:^(WKContentExtension *filter, NSError *error) {
    302         EXPECT_NOT_NULL(filter);
    303         EXPECT_NULL(error);
    304 
    305         [store _getContentExtensionSourceForIdentifier:identifier completionHandler:^(NSString *source) {
     301    [store compileContentRuleListForIdentifier:identifier encodedContentRuleList:nonASCIIFilter completionHandler:^(WKContentRuleList *filter, NSError *error) {
     302        EXPECT_NOT_NULL(filter);
     303        EXPECT_NULL(error);
     304
     305        [store _getContentRuleListSourceForIdentifier:identifier completionHandler:^(NSString *source) {
    306306            EXPECT_NOT_NULL(source);
    307307            EXPECT_STREQ(nonASCIIFilter.UTF8String, source.UTF8String);
    308308
    309             [store _removeAllContentExtensions];
     309            [store _removeAllContentRuleLists];
    310310            NSData *dataAfterRemoving = [NSData dataWithContentsOfURL:[tempDir URLByAppendingPathComponent:fileName]];
    311311            EXPECT_NULL(dataAfterRemoving);
     
    320320static bool receivedAlert { false };
    321321
    322 @interface ContentExtensionDelegate : NSObject <WKUIDelegate>
     322@interface ContentRuleListDelegate : NSObject <WKUIDelegate>
    323323@end
    324324
    325 @implementation ContentExtensionDelegate
     325@implementation ContentRuleListDelegate
    326326
    327327- (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler
     
    333333        break;
    334334    case 1:
    335         // After having removed the content extension.
     335        // After having removed the content RuleList.
    336336        EXPECT_STREQ("content blockers disabled", message.UTF8String);
    337337        break;
     
    345345@end
    346346
    347 TEST_F(WKContentExtensionStoreTest, AddRemove)
    348 {
    349     [[WKContentExtensionStore defaultStore] _removeAllContentExtensions];
     347TEST_F(WKContentRuleListStoreTest, AddRemove)
     348{
     349    [[WKContentRuleListStore defaultStore] _removeAllContentRuleLists];
    350350
    351351    __block bool doneCompiling = false;
    352352    NSString* contentBlocker = @"[{\"action\":{\"type\":\"css-display-none\",\"selector\":\".hidden\"},\"trigger\":{\"url-filter\":\".*\"}}]";
    353     __block RetainPtr<WKContentExtension> extension;
    354     [[WKContentExtensionStore defaultStore] compileContentExtensionForIdentifier:@"TestAddRemove" encodedContentExtension:contentBlocker completionHandler:^(WKContentExtension *compiledExtension, NSError *error) {
     353    __block RetainPtr<WKContentRuleList> ruleList;
     354    [[WKContentRuleListStore defaultStore] compileContentRuleListForIdentifier:@"TestAddRemove" encodedContentRuleList:contentBlocker completionHandler:^(WKContentRuleList *compiledRuleList, NSError *error) {
    355355        EXPECT_TRUE(error == nil);
    356         extension = compiledExtension;
    357         doneCompiling = true;
    358     }];
    359     TestWebKitAPI::Util::run(&doneCompiling);
    360     EXPECT_NOT_NULL(extension);
     356        ruleList = compiledRuleList;
     357        doneCompiling = true;
     358    }];
     359    TestWebKitAPI::Util::run(&doneCompiling);
     360    EXPECT_NOT_NULL(ruleList);
    361361
    362362    auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
    363     [[configuration userContentController] addContentExtension:extension.get()];
     363    [[configuration userContentController] addContentRuleList:ruleList.get()];
    364364
    365365    auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
    366366
    367     auto delegate = adoptNS([[ContentExtensionDelegate alloc] init]);
     367    auto delegate = adoptNS([[ContentRuleListDelegate alloc] init]);
    368368    [webView setUIDelegate:delegate.get()];
    369369
     
    374374    TestWebKitAPI::Util::run(&receivedAlert);
    375375
    376     [[configuration userContentController] removeContentExtension:extension.get()];
     376    [[configuration userContentController] removeContentRuleList:ruleList.get()];
    377377
    378378    receivedAlert = false;
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/_WKUserContentExtensionStore.mm

    r201457 r216809  
    7373        checkDomain(error);
    7474        EXPECT_EQ(error.code, _WKUserContentExtensionStoreErrorCompileFailed);
    75         EXPECT_STREQ("Extension compilation failed: Failed to parse the JSON String.", [[error helpAnchor] UTF8String]);
     75        EXPECT_STREQ("Rule list compilation failed: Failed to parse the JSON String.", [[error helpAnchor] UTF8String]);
    7676
    7777        doneCompiling = true;
     
    112112        checkDomain(error);
    113113        EXPECT_EQ(error.code, _WKUserContentExtensionStoreErrorLookupFailed);
    114         EXPECT_STREQ("Extension lookup failed: Unspecified error during lookup.", [[error helpAnchor] UTF8String]);
     114        EXPECT_STREQ("Rule list lookup failed: Unspecified error during lookup.", [[error helpAnchor] UTF8String]);
    115115       
    116116        doneLookingUp = true;
     
    142142        checkDomain(error);
    143143        EXPECT_EQ(error.code, _WKUserContentExtensionStoreErrorVersionMismatch);
    144         EXPECT_STREQ("Extension lookup failed: Version of file does not match version of interpreter.", [[error helpAnchor] UTF8String]);
     144        EXPECT_STREQ("Rule list lookup failed: Version of file does not match version of interpreter.", [[error helpAnchor] UTF8String]);
    145145       
    146146        doneLookingUp = true;
     
    177177        checkDomain(error);
    178178        EXPECT_EQ(error.code, _WKUserContentExtensionStoreErrorRemoveFailed);
    179         EXPECT_STREQ("Extension removal failed: Unspecified error during remove.", [[error helpAnchor] UTF8String]);
     179        EXPECT_STREQ("Rule list removal failed: Unspecified error during remove.", [[error helpAnchor] UTF8String]);
    180180
    181181        doneRemoving = true;
Note: See TracChangeset for help on using the changeset viewer.