Changeset 216809 in webkit
- Timestamp:
- May 12, 2017, 6:33:13 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 36 edited
- 16 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r216807 r216809 1 2017-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 1 13 2017-05-12 Timothy Horton <timothy_horton@apple.com> 2 14 -
trunk/Source/WebCore/English.lproj/Localizable.strings
r216007 r216809 164 164 "Click to restart" = "Click to restart"; 165 165 166 /* WKErrorContent ExtensionStoreCompileFailed description */167 "Compiling a WK UserContentExtension failed" = "Compiling a WKUserContentExtensionfailed";166 /* WKErrorContentRuleListStoreCompileFailed description */ 167 "Compiling a WKContentRuleList failed" = "Compiling a WKContentRuleList failed"; 168 168 169 169 /* WebKitErrorCannotShowMIMEType description */ … … 353 353 "Look Up “%s”" = "Look Up “%s”"; 354 354 355 /* WKErrorContent ExtensionStoreLookupFailed description */356 "Looking up a WK UserContentExtension failed" = "Looking up a WKUserContentExtensionfailed";357 358 /* WKErrorContent ExtensionStoreVersionMismatch description */359 "Looking up a WK UserContentExtension found a binary that is incompatible" = "Looking up a WKUserContentExtensionfound 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"; 360 360 361 361 /* Media Loop context menu item */ … … 497 497 "Reload" = "Reload"; 498 498 499 /* WKErrorContent ExtensionStoreRemoveFailed description */500 "Removing a WK UserContentExtension failed" = "Removing a WKUserContentExtensionfailed";499 /* WKErrorContentRuleListStoreRemoveFailed description */ 500 "Removing a WKContentRuleList failed" = "Removing a WKContentRuleList failed"; 501 501 502 502 /* default label for Reset buttons in forms on web pages */ -
trunk/Source/WebKit2/CMakeLists.txt
r216696 r216809 183 183 Shared/VisitedLinkTable.cpp 184 184 Shared/WebBackForwardListItem.cpp 185 Shared/WebCompiledContent Extension.cpp186 Shared/WebCompiledContent ExtensionData.cpp185 Shared/WebCompiledContentRuleList.cpp 186 Shared/WebCompiledContentRuleListData.cpp 187 187 Shared/WebConnection.cpp 188 188 Shared/WebConnectionClient.cpp … … 331 331 UIProcess/WebViewportAttributes.cpp 332 332 333 UIProcess/API/APIContent Extension.cpp334 UIProcess/API/APIContent ExtensionStore.cpp333 UIProcess/API/APIContentRuleList.cpp 334 UIProcess/API/APIContentRuleListStore.cpp 335 335 UIProcess/API/APIExperimentalFeature.cpp 336 336 UIProcess/API/APIFrameInfo.cpp -
trunk/Source/WebKit2/ChangeLog
r216806 r216809 1 2017-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 1 225 2017-05-12 Jeremy Jones <jeremyj@apple.com> 2 226 -
trunk/Source/WebKit2/PlatformMac.cmake
r216248 r216809 183 183 UIProcess/API/C/mac/WKPagePrivateMac.mm 184 184 185 UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm 185 186 UIProcess/API/Cocoa/APISerializedScriptValueCocoa.mm 186 UIProcess/API/Cocoa/APIUserContentExtensionStoreCocoa.mm187 187 UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm 188 188 UIProcess/API/Cocoa/LegacyBundleForClass.mm … … 192 192 UIProcess/API/Cocoa/WKBrowsingContextGroup.mm 193 193 UIProcess/API/Cocoa/WKConnection.mm 194 UIProcess/API/Cocoa/WKContent Extension.mm195 UIProcess/API/Cocoa/WKContent ExtensionStore.mm194 UIProcess/API/Cocoa/WKContentRuleList.mm 195 UIProcess/API/Cocoa/WKContentRuleListStore.mm 196 196 UIProcess/API/Cocoa/WKError.mm 197 197 UIProcess/API/Cocoa/WKFrameInfo.mm -
trunk/Source/WebKit2/Shared/API/APIObject.h
r216696 r216809 104 104 CacheManager, 105 105 ColorPickerResultListener, 106 Content Extension,107 Content ExtensionStore,106 ContentRuleList, 107 ContentRuleListStore, 108 108 ContextMenuListener, 109 109 CookieManager, -
trunk/Source/WebKit2/Shared/API/Cocoa/WebKit.h
r216616 r216809 26 26 #import <WebKit/WKBackForwardList.h> 27 27 #import <WebKit/WKBackForwardListItem.h> 28 #import <WebKit/WKContent Extension.h>29 #import <WebKit/WKContent ExtensionStore.h>28 #import <WebKit/WKContentRuleList.h> 29 #import <WebKit/WKContentRuleListStore.h> 30 30 #import <WebKit/WKError.h> 31 31 #import <WebKit/WKFoundation.h> -
trunk/Source/WebKit2/Shared/API/c/WKDeprecatedFunctions.cpp
r216348 r216809 26 26 #include "config.h" 27 27 28 #include "APIContent Extension.h"28 #include "APIContentRuleList.h" 29 29 #include "APIDictionary.h" 30 30 #include "WKAPICast.h" … … 61 61 { 62 62 #if ENABLE(CONTENT_EXTENSIONS) 63 toImpl(pageGroupRef)->userContentController().addContent Extension(*toImpl(contentFilterRef));63 toImpl(pageGroupRef)->userContentController().addContentRuleList(*toImpl(contentFilterRef)); 64 64 #else 65 65 UNUSED_PARAM(pageGroupRef); … … 71 71 { 72 72 #if ENABLE(CONTENT_EXTENSIONS) 73 toImpl(pageGroupRef)->userContentController().removeContent Extension(toWTFString(contentFilterNameRef));73 toImpl(pageGroupRef)->userContentController().removeContentRuleList(toWTFString(contentFilterNameRef)); 74 74 #else 75 75 UNUSED_PARAM(pageGroupRef); -
trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm
r216037 r216809 34 34 #import "WKBrowsingContextGroupInternal.h" 35 35 #import "WKConnectionInternal.h" 36 #import "WKContent ExtensionInternal.h"37 #import "WKContent ExtensionStoreInternal.h"36 #import "WKContentRuleListInternal.h" 37 #import "WKContentRuleListStoreInternal.h" 38 38 #import "WKFrameInfoInternal.h" 39 39 #import "WKHTTPCookieStoreInternal.h" … … 247 247 break; 248 248 249 case Type::Content Extension:250 wrapper = [WKContent Extensionalloc];251 break; 252 253 case Type::Content ExtensionStore:254 wrapper = [WKContent ExtensionStore alloc];249 case Type::ContentRuleList: 250 wrapper = [WKContentRuleList alloc]; 251 break; 252 253 case Type::ContentRuleListStore: 254 wrapper = [WKContentRuleListStore alloc]; 255 255 break; 256 256 -
trunk/Source/WebKit2/Shared/WebCompiledContentRuleList.cpp
r216807 r216809 25 25 26 26 #include "config.h" 27 #include "WebCompiledContent Extension.h"27 #include "WebCompiledContentRuleList.h" 28 28 29 29 #if ENABLE(CONTENT_EXTENSIONS) … … 31 31 namespace WebKit { 32 32 33 Ref<WebCompiledContent Extension> WebCompiledContentExtension::create(WebCompiledContentExtensionData&& data)33 Ref<WebCompiledContentRuleList> WebCompiledContentRuleList::create(WebCompiledContentRuleListData&& data) 34 34 { 35 return adoptRef(*new WebCompiledContent Extension(WTFMove(data)));35 return adoptRef(*new WebCompiledContentRuleList(WTFMove(data))); 36 36 } 37 37 38 WebCompiledContent Extension::WebCompiledContentExtension(WebCompiledContentExtensionData&& data)38 WebCompiledContentRuleList::WebCompiledContentRuleList(WebCompiledContentRuleListData&& data) 39 39 : m_data(WTFMove(data)) 40 40 { 41 41 } 42 42 43 WebCompiledContent Extension::~WebCompiledContentExtension()43 WebCompiledContentRuleList::~WebCompiledContentRuleList() 44 44 { 45 45 } 46 46 47 bool WebCompiledContent Extension::conditionsApplyOnlyToDomain() const47 bool WebCompiledContentRuleList::conditionsApplyOnlyToDomain() const 48 48 { 49 49 return *reinterpret_cast<uint32_t*>(reinterpret_cast<uint8_t*>(m_data.data->data()) + m_data.conditionsApplyOnlyToDomainOffset); 50 50 } 51 51 52 const WebCore::ContentExtensions::DFABytecode* WebCompiledContent Extension::filtersWithoutConditionsBytecode() const52 const WebCore::ContentExtensions::DFABytecode* WebCompiledContentRuleList::filtersWithoutConditionsBytecode() const 53 53 { 54 54 return static_cast<const WebCore::ContentExtensions::DFABytecode*>(m_data.data->data()) + m_data.filtersWithoutConditionsBytecodeOffset; 55 55 } 56 56 57 unsigned WebCompiledContent Extension::filtersWithoutConditionsBytecodeLength() const57 unsigned WebCompiledContentRuleList::filtersWithoutConditionsBytecodeLength() const 58 58 { 59 59 return m_data.filtersWithoutConditionsBytecodeSize; 60 60 } 61 61 62 const WebCore::ContentExtensions::DFABytecode* WebCompiledContent Extension::filtersWithConditionsBytecode() const62 const WebCore::ContentExtensions::DFABytecode* WebCompiledContentRuleList::filtersWithConditionsBytecode() const 63 63 { 64 64 return static_cast<const WebCore::ContentExtensions::DFABytecode*>(m_data.data->data()) + m_data.filtersWithConditionsBytecodeOffset; 65 65 } 66 66 67 unsigned WebCompiledContent Extension::filtersWithConditionsBytecodeLength() const67 unsigned WebCompiledContentRuleList::filtersWithConditionsBytecodeLength() const 68 68 { 69 69 return m_data.filtersWithConditionsBytecodeSize; 70 70 } 71 71 72 const WebCore::ContentExtensions::DFABytecode* WebCompiledContent Extension::topURLFiltersBytecode() const72 const WebCore::ContentExtensions::DFABytecode* WebCompiledContentRuleList::topURLFiltersBytecode() const 73 73 { 74 74 return static_cast<const WebCore::ContentExtensions::DFABytecode*>(m_data.data->data()) + m_data.topURLFiltersBytecodeOffset; 75 75 } 76 76 77 unsigned WebCompiledContent Extension::topURLFiltersBytecodeLength() const77 unsigned WebCompiledContentRuleList::topURLFiltersBytecodeLength() const 78 78 { 79 79 return m_data.topURLFiltersBytecodeSize; 80 80 } 81 81 82 const WebCore::ContentExtensions::SerializedActionByte* WebCompiledContent Extension::actions() const82 const WebCore::ContentExtensions::SerializedActionByte* WebCompiledContentRuleList::actions() const 83 83 { 84 84 return static_cast<const WebCore::ContentExtensions::SerializedActionByte*>(m_data.data->data()) + m_data.actionsOffset; 85 85 } 86 86 87 unsigned WebCompiledContent Extension::actionsLength() const87 unsigned WebCompiledContentRuleList::actionsLength() const 88 88 { 89 89 return m_data.actionsSize; -
trunk/Source/WebKit2/Shared/WebCompiledContentRuleList.h
r216807 r216809 28 28 #if ENABLE(CONTENT_EXTENSIONS) 29 29 30 #include "WebCompiledContentExtensionData.h" 30 #include "WebCompiledContentRuleListData.h" 31 #include <WebCore/CompiledContentExtension.h> 31 32 #include <WebCore/ContentExtensionCompiler.h> 32 #include <WebCore/CompiledContentExtension.h>33 33 34 34 namespace WebKit { 35 35 36 class WebCompiledContent Extensionfinal : public WebCore::ContentExtensions::CompiledContentExtension {36 class WebCompiledContentRuleList final : public WebCore::ContentExtensions::CompiledContentExtension { 37 37 public: 38 static Ref<WebCompiledContent Extension> create(WebCompiledContentExtensionData&&);39 virtual ~WebCompiledContent Extension();38 static Ref<WebCompiledContentRuleList> create(WebCompiledContentRuleListData&&); 39 virtual ~WebCompiledContentRuleList(); 40 40 41 WebCompiledContent ExtensionData data() const { return m_data; }41 WebCompiledContentRuleListData data() const { return m_data; } 42 42 43 43 private: 44 WebCompiledContent Extension(WebCompiledContentExtensionData&&);44 WebCompiledContentRuleList(WebCompiledContentRuleListData&&); 45 45 46 46 const WebCore::ContentExtensions::DFABytecode* filtersWithoutConditionsBytecode() const final; … … 55 55 unsigned actionsLength() const final; 56 56 57 WebCompiledContent ExtensionData m_data;57 WebCompiledContentRuleListData m_data; 58 58 }; 59 59 -
trunk/Source/WebKit2/Shared/WebCompiledContentRuleListData.cpp
r216807 r216809 25 25 26 26 #include "config.h" 27 #include "WebCompiledContent ExtensionData.h"27 #include "WebCompiledContentRuleListData.h" 28 28 29 29 #if ENABLE(CONTENT_EXTENSIONS) … … 33 33 namespace WebKit { 34 34 35 void WebCompiledContent ExtensionData::encode(IPC::Encoder& encoder) const35 void WebCompiledContentRuleListData::encode(IPC::Encoder& encoder) const 36 36 { 37 37 SharedMemory::Handle handle; … … 49 49 } 50 50 51 bool WebCompiledContent ExtensionData::decode(IPC::Decoder& decoder, WebCompiledContentExtensionData& compiledContentExtensionData)51 bool WebCompiledContentRuleListData::decode(IPC::Decoder& decoder, WebCompiledContentRuleListData& compiledContentRuleListData) 52 52 { 53 53 SharedMemory::Handle handle; 54 54 if (!decoder.decode(handle)) 55 55 return false; 56 compiledContent ExtensionData.data = SharedMemory::map(handle, SharedMemory::Protection::ReadOnly);56 compiledContentRuleListData.data = SharedMemory::map(handle, SharedMemory::Protection::ReadOnly); 57 57 58 if (!decoder.decode(compiledContent ExtensionData.actionsOffset))58 if (!decoder.decode(compiledContentRuleListData.actionsOffset)) 59 59 return false; 60 if (!decoder.decode(compiledContent ExtensionData.actionsSize))60 if (!decoder.decode(compiledContentRuleListData.actionsSize)) 61 61 return false; 62 if (!decoder.decode(compiledContent ExtensionData.filtersWithoutConditionsBytecodeOffset))62 if (!decoder.decode(compiledContentRuleListData.filtersWithoutConditionsBytecodeOffset)) 63 63 return false; 64 if (!decoder.decode(compiledContent ExtensionData.filtersWithoutConditionsBytecodeSize))64 if (!decoder.decode(compiledContentRuleListData.filtersWithoutConditionsBytecodeSize)) 65 65 return false; 66 if (!decoder.decode(compiledContent ExtensionData.filtersWithConditionsBytecodeOffset))66 if (!decoder.decode(compiledContentRuleListData.filtersWithConditionsBytecodeOffset)) 67 67 return false; 68 if (!decoder.decode(compiledContent ExtensionData.filtersWithConditionsBytecodeSize))68 if (!decoder.decode(compiledContentRuleListData.filtersWithConditionsBytecodeSize)) 69 69 return false; 70 if (!decoder.decode(compiledContent ExtensionData.topURLFiltersBytecodeOffset))70 if (!decoder.decode(compiledContentRuleListData.topURLFiltersBytecodeOffset)) 71 71 return false; 72 if (!decoder.decode(compiledContent ExtensionData.topURLFiltersBytecodeSize))72 if (!decoder.decode(compiledContentRuleListData.topURLFiltersBytecodeSize)) 73 73 return false; 74 74 -
trunk/Source/WebKit2/Shared/WebCompiledContentRuleListData.h
r216807 r216809 39 39 namespace WebKit { 40 40 41 class WebCompiledContent ExtensionData {41 class WebCompiledContentRuleListData { 42 42 public: 43 WebCompiledContent ExtensionData() = default;43 WebCompiledContentRuleListData() = default; 44 44 45 WebCompiledContent ExtensionData(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) 46 46 : data(WTFMove(data)) 47 47 , fileData(fileData) … … 59 59 60 60 void encode(IPC::Encoder&) const; 61 static bool decode(IPC::Decoder&, WebCompiledContent ExtensionData&);61 static bool decode(IPC::Decoder&, WebCompiledContentRuleListData&); 62 62 63 63 RefPtr<SharedMemory> data; -
trunk/Source/WebKit2/Shared/WebPageCreationParameters.cpp
r216612 r216809 108 108 encoder << messageHandlers; 109 109 #if ENABLE(CONTENT_EXTENSIONS) 110 encoder << content Extensions;110 encoder << contentRuleLists; 111 111 #endif 112 112 } … … 258 258 return false; 259 259 #if ENABLE(CONTENT_EXTENSIONS) 260 if (!decoder.decode(parameters.content Extensions))260 if (!decoder.decode(parameters.contentRuleLists)) 261 261 return false; 262 262 #endif -
trunk/Source/WebKit2/Shared/WebPageCreationParameters.h
r216612 r216809 29 29 #include "LayerTreeContext.h" 30 30 #include "SessionState.h" 31 #include "WebCompiledContent ExtensionData.h"31 #include "WebCompiledContentRuleListData.h" 32 32 #include "WebCoreArgumentCoders.h" 33 33 #include "WebPageGroupData.h" … … 166 166 Vector<WebScriptMessageHandlerData> messageHandlers; 167 167 #if ENABLE(CONTENT_EXTENSIONS) 168 Vector<std::pair<String, WebCompiledContent ExtensionData>> contentExtensions;168 Vector<std::pair<String, WebCompiledContentRuleListData>> contentRuleLists; 169 169 #endif 170 170 }; -
trunk/Source/WebKit2/UIProcess/API/APIContentRuleList.cpp
r216807 r216809 25 25 26 26 #include "config.h" 27 #include "APIContent Extension.h"27 #include "APIContentRuleList.h" 28 28 29 29 #if ENABLE(CONTENT_EXTENSIONS) 30 30 31 #include "WebCompiledContent Extension.h"31 #include "WebCompiledContentRuleList.h" 32 32 33 33 namespace API { 34 34 35 Content Extension::ContentExtension(const WTF::String& name, Ref<WebKit::WebCompiledContentExtension>&& contentExtension)35 ContentRuleList::ContentRuleList(const WTF::String& name, Ref<WebKit::WebCompiledContentRuleList>&& contentRuleList) 36 36 : m_name(name) 37 , m_compiled Extension(WTFMove(contentExtension))37 , m_compiledRuleList(WTFMove(contentRuleList)) 38 38 { 39 39 } 40 40 41 Content Extension::~ContentExtension()41 ContentRuleList::~ContentRuleList() 42 42 { 43 43 } -
trunk/Source/WebKit2/UIProcess/API/APIContentRuleList.h
r216807 r216809 30 30 31 31 namespace WebKit { 32 class WebCompiledContent Extension;32 class WebCompiledContentRuleList; 33 33 } 34 34 35 35 namespace API { 36 36 37 class Content Extension final : public ObjectImpl<Object::Type::ContentExtension> {37 class ContentRuleList final : public ObjectImpl<Object::Type::ContentRuleList> { 38 38 public: 39 39 #if ENABLE(CONTENT_EXTENSIONS) 40 static Ref<Content Extension> create(const WTF::String& name, Ref<WebKit::WebCompiledContentExtension>&& contentExtension)40 static Ref<ContentRuleList> create(const WTF::String& name, Ref<WebKit::WebCompiledContentRuleList>&& contentRuleList) 41 41 { 42 return adoptRef(*new Content Extension(name, WTFMove(contentExtension)));42 return adoptRef(*new ContentRuleList(name, WTFMove(contentRuleList))); 43 43 } 44 44 45 Content Extension(const WTF::String& name, Ref<WebKit::WebCompiledContentExtension>&&);46 virtual ~Content Extension();45 ContentRuleList(const WTF::String& name, Ref<WebKit::WebCompiledContentRuleList>&&); 46 virtual ~ContentRuleList(); 47 47 48 48 const WTF::String& name() const { return m_name; } 49 const WebKit::WebCompiledContent Extension& compiledExtension() const { return m_compiledExtension.get(); }49 const WebKit::WebCompiledContentRuleList& compiledRuleList() const { return m_compiledRuleList.get(); } 50 50 51 51 private: 52 52 WTF::String m_name; 53 Ref<WebKit::WebCompiledContent Extension> m_compiledExtension;53 Ref<WebKit::WebCompiledContentRuleList> m_compiledRuleList; 54 54 #endif // ENABLE(CONTENT_EXTENSIONS) 55 55 }; -
trunk/Source/WebKit2/UIProcess/API/APIContentRuleListStore.cpp
r216807 r216809 25 25 26 26 #include "config.h" 27 #include "APIContent ExtensionStore.h"27 #include "APIContentRuleListStore.h" 28 28 29 29 #if ENABLE(CONTENT_EXTENSIONS) 30 30 31 #include "APIContent Extension.h"31 #include "APIContentRuleList.h" 32 32 #include "NetworkCacheData.h" 33 33 #include "NetworkCacheFileSystem.h" 34 34 #include "SharedMemory.h" 35 #include "WebCompiledContent Extension.h"35 #include "WebCompiledContentRuleList.h" 36 36 #include <WebCore/ContentExtensionCompiler.h> 37 37 #include <WebCore/ContentExtensionError.h> … … 46 46 47 47 namespace API { 48 49 ContentExtensionStore& ContentExtensionStore::defaultStore() 50 { 51 static ContentExtensionStore* defaultStore = adoptRef(new ContentExtensionStore).leakRef(); 48 49 ContentRuleListStore& ContentRuleListStore::legacyDefaultStore() 50 { 51 const bool legacyFilename = true; 52 static ContentRuleListStore* defaultStore = adoptRef(new ContentRuleListStore(legacyFilename)).leakRef(); 52 53 return *defaultStore; 53 54 } 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 56 ContentRuleListStore& ContentRuleListStore::nonLegacyDdefaultStore() 57 { 58 const bool legacyFilename = false; 59 static ContentRuleListStore* defaultStore = adoptRef(new ContentRuleListStore(legacyFilename)).leakRef(); 60 return *defaultStore; 61 } 62 63 ContentRuleListStore& ContentRuleListStore::defaultStore(bool legacyFilename) 64 { 65 if (legacyFilename) 66 return legacyDefaultStore(); 67 return nonLegacyDdefaultStore(); 68 } 69 70 Ref<ContentRuleListStore> ContentRuleListStore::storeWithPath(const WTF::String& storePath, bool legacyFilename) 71 { 72 return adoptRef(*new ContentRuleListStore(storePath, legacyFilename)); 73 } 74 75 ContentRuleListStore::ContentRuleListStore(bool legacyFilename) 76 : ContentRuleListStore(defaultStorePath(legacyFilename), legacyFilename) 77 { 78 } 79 80 ContentRuleListStore::ContentRuleListStore(const WTF::String& storePath, bool legacyFilename) 66 81 : 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) 70 86 { 71 87 WebCore::makeAllDirectories(storePath); 72 88 } 73 89 74 ContentExtensionStore::~ContentExtensionStore() 75 { 76 } 77 78 static const String& constructedPathPrefix() 79 { 80 static NeverDestroyed<String> prefix("ContentExtension-"); 90 ContentRuleListStore::~ContentRuleListStore() 91 { 92 } 93 94 static const String& constructedPathPrefix(bool legacyFilename) 95 { 96 static NeverDestroyed<String> prefix("ContentRuleList-"); 97 static NeverDestroyed<String> legacyPrefix("ContentExtension-"); 98 if (legacyFilename) 99 return legacyPrefix; 81 100 return prefix; 82 101 } 83 102 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)));103 static const String constructedPathFilter(bool legacyFilename) 104 { 105 return makeString(constructedPathPrefix(legacyFilename), '*'); 106 } 107 108 static String constructedPath(const String& base, const String& identifier, bool legacyFilename) 109 { 110 return WebCore::pathByAppendingComponent(base, makeString(constructedPathPrefix(legacyFilename), WebCore::encodeForFileName(identifier))); 92 111 } 93 112 94 113 // The size and offset of the densely packed bytes in the file, not sizeof and offsetof, which would 95 114 // represent the size and offset of the structure in memory, possibly with compiler-added padding. 96 const size_t Content ExtensionFileHeaderSize = 2 * sizeof(uint32_t) + 5 * sizeof(uint64_t);115 const size_t ContentRuleListFileHeaderSize = 2 * sizeof(uint32_t) + 5 * sizeof(uint64_t); 97 116 const size_t ConditionsApplyOnlyToDomainOffset = sizeof(uint32_t) + 5 * sizeof(uint64_t); 98 117 99 struct Content ExtensionMetaData {100 uint32_t version { Content ExtensionStore::CurrentContentExtensionFileVersion };118 struct ContentRuleListMetaData { 119 uint32_t version { ContentRuleListStore::CurrentContentRuleListFileVersion }; 101 120 uint64_t sourceSize { 0 }; 102 121 uint64_t actionsSize { 0 }; … … 108 127 size_t fileSize() const 109 128 { 110 return Content ExtensionFileHeaderSize129 return ContentRuleListFileHeaderSize 111 130 + sourceSize 112 131 + actionsSize … … 117 136 }; 118 137 119 static Data encodeContent ExtensionMetaData(const ContentExtensionMetaData& metaData)138 static Data encodeContentRuleListMetaData(const ContentRuleListMetaData& metaData) 120 139 { 121 140 WTF::Persistence::Encoder encoder; … … 129 148 encoder << metaData.conditionsApplyOnlyToDomain; 130 149 131 ASSERT(encoder.bufferSize() == Content ExtensionFileHeaderSize);150 ASSERT(encoder.bufferSize() == ContentRuleListFileHeaderSize); 132 151 return Data(encoder.buffer(), encoder.bufferSize()); 133 152 } 134 153 135 static bool decodeContent ExtensionMetaData(ContentExtensionMetaData& metaData, const Data& fileData)154 static bool decodeContentRuleListMetaData(ContentRuleListMetaData& metaData, const Data& fileData) 136 155 { 137 156 bool success = false; … … 163 182 } 164 183 165 static bool openAndMapContent Extension(const String& path, ContentExtensionMetaData& metaData, Data& fileData)184 static bool openAndMapContentRuleList(const String& path, ContentRuleListMetaData& metaData, Data& fileData) 166 185 { 167 186 fileData = mapFile(WebCore::fileSystemRepresentation(path).data()); … … 169 188 return false; 170 189 171 if (!decodeContent ExtensionMetaData(metaData, fileData))190 if (!decodeContentRuleListMetaData(metaData, fileData)) 172 191 return false; 173 192 … … 189 208 } 190 209 191 static std::error_code compiledToFile(String&& json, const String& finalFilePath, Content ExtensionMetaData& metaData, Data& mappedData)210 static std::error_code compiledToFile(String&& json, const String& finalFilePath, ContentRuleListMetaData& metaData, Data& mappedData) 192 211 { 193 212 using namespace WebCore::ContentExtensions; … … 195 214 class CompilationClient final : public ContentExtensionCompilationClient { 196 215 public: 197 CompilationClient(WebCore::PlatformFileHandle fileHandle, Content ExtensionMetaData& metaData)216 CompilationClient(WebCore::PlatformFileHandle fileHandle, ContentRuleListMetaData& metaData) 198 217 : m_fileHandle(fileHandle) 199 218 , m_metaData(metaData) … … 267 286 m_metaData.conditionsApplyOnlyToDomain = m_conditionsApplyOnlyToDomain; 268 287 269 Data header = encodeContent ExtensionMetaData(m_metaData);288 Data header = encodeContentRuleListMetaData(m_metaData); 270 289 if (!m_fileError && WebCore::seekFile(m_fileHandle, 0ll, WebCore::FileSeekOrigin::SeekFromBeginning) == -1) { 271 290 WebCore::closeFile(m_fileHandle); … … 291 310 292 311 WebCore::PlatformFileHandle m_fileHandle; 293 Content ExtensionMetaData& m_metaData;312 ContentRuleListMetaData& m_metaData; 294 313 size_t m_filtersWithoutConditionsBytecodeWritten { 0 }; 295 314 size_t m_filtersWithConditionBytecodeWritten { 0 }; … … 302 321 303 322 auto temporaryFileHandle = WebCore::invalidPlatformFileHandle; 304 String temporaryFilePath = WebCore::openTemporaryFile("Content Extension", temporaryFileHandle);323 String temporaryFilePath = WebCore::openTemporaryFile("ContentRuleList", temporaryFileHandle); 305 324 if (temporaryFileHandle == WebCore::invalidPlatformFileHandle) 306 return Content ExtensionStore::Error::CompileFailed;307 308 char invalidHeader[Content ExtensionFileHeaderSize];325 return ContentRuleListStore::Error::CompileFailed; 326 327 char invalidHeader[ContentRuleListFileHeaderSize]; 309 328 memset(invalidHeader, 0xFF, sizeof(invalidHeader)); 310 329 // This header will be rewritten in CompilationClient::finalize. 311 330 if (WebCore::writeToFile(temporaryFileHandle, invalidHeader, sizeof(invalidHeader)) == -1) { 312 331 WebCore::closeFile(temporaryFileHandle); 313 return Content ExtensionStore::Error::CompileFailed;332 return ContentRuleListStore::Error::CompileFailed; 314 333 } 315 334 … … 322 341 if (compilationClient.hadErrorWhileWritingToFile()) { 323 342 WebCore::closeFile(temporaryFileHandle); 324 return Content ExtensionStore::Error::CompileFailed;343 return ContentRuleListStore::Error::CompileFailed; 325 344 } 326 345 327 346 mappedData = adoptAndMapFile(temporaryFileHandle, 0, metaData.fileSize()); 328 347 if (mappedData.isNull()) 329 return Content ExtensionStore::Error::CompileFailed;348 return ContentRuleListStore::Error::CompileFailed; 330 349 331 350 if (!WebCore::moveFile(temporaryFilePath, finalFilePath)) 332 return Content ExtensionStore::Error::CompileFailed;351 return ContentRuleListStore::Error::CompileFailed; 333 352 334 353 return { }; 335 354 } 336 355 337 static Ref<API::Content Extension> createExtension(const String& identifier, const ContentExtensionMetaData& metaData, const Data& fileData)356 static Ref<API::ContentRuleList> createExtension(const String& identifier, const ContentRuleListMetaData& metaData, const Data& fileData) 338 357 { 339 358 auto sharedMemory = WebKit::SharedMemory::create(const_cast<uint8_t*>(fileData.data()), fileData.size(), WebKit::SharedMemory::Protection::ReadOnly); 340 const size_t headerAndSourceSize = Content ExtensionFileHeaderSize + metaData.sourceSize;341 auto compiledContent ExtensionData = WebKit::WebCompiledContentExtensionData(359 const size_t headerAndSourceSize = ContentRuleListFileHeaderSize + metaData.sourceSize; 360 auto compiledContentRuleListData = WebKit::WebCompiledContentRuleListData( 342 361 WTFMove(sharedMemory), 343 362 fileData, … … 358 377 metaData.conditionedFiltersBytecodeSize 359 378 ); 360 auto compiledContent Extension = WebKit::WebCompiledContentExtension::create(WTFMove(compiledContentExtensionData));361 return API::Content Extension::create(identifier, WTFMove(compiledContentExtension));362 } 363 364 void Content ExtensionStore::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 Content ExtensionMetaData metaData;379 auto compiledContentRuleList = WebKit::WebCompiledContentRuleList::create(WTFMove(compiledContentRuleListData)); 380 return API::ContentRuleList::create(identifier, WTFMove(compiledContentRuleList)); 381 } 382 383 void 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; 370 389 Data fileData; 371 if (!openAndMapContent Extension(path, metaData, fileData)) {390 if (!openAndMapContentRuleList(path, metaData, fileData)) { 372 391 RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler)] { 373 392 completionHandler(nullptr, Error::LookupFailed); … … 376 395 } 377 396 378 if (metaData.version != Content ExtensionStore::CurrentContentExtensionFileVersion) {397 if (metaData.version != ContentRuleListStore::CurrentContentRuleListFileVersion) { 379 398 RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler)] { 380 399 completionHandler(nullptr, Error::VersionMismatch); … … 389 408 } 390 409 391 void Content ExtensionStore::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( ));410 void 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)); 396 415 Vector<String> identifiers; 397 416 identifiers.reserveInitialCapacity(fullPaths.size()); 398 const auto prefixLength = constructedPathPrefix( ).length();417 const auto prefixLength = constructedPathPrefix(legacyFilename).length(); 399 418 for (const auto& path : fullPaths) 400 419 identifiers.uncheckedAppend(WebCore::decodeFromFilename(path.substring(path.reverseFind('/') + 1 + prefixLength))); … … 406 425 } 407 426 408 void Content ExtensionStore::compileContentExtension(const WTF::String& identifier, WTF::String&& json, Function<void(RefPtr<API::ContentExtension>, std::error_code)> completionHandler)427 void ContentRuleListStore::compileContentRuleList(const WTF::String& identifier, WTF::String&& json, Function<void(RefPtr<API::ContentRuleList>, std::error_code)> completionHandler) 409 428 { 410 429 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 Content ExtensionMetaData 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; 415 434 Data fileData; 416 435 auto error = compiledToFile(WTFMove(json), path, metaData, fileData); … … 423 442 424 443 RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), identifier = WTFMove(identifier), fileData = WTFMove(fileData), metaData = WTFMove(metaData), completionHandler = WTFMove(completionHandler)] { 425 RefPtr<API::Content Extension> contentExtension= createExtension(identifier, metaData, fileData);426 completionHandler(content Extension, { });444 RefPtr<API::ContentRuleList> contentRuleList = createExtension(identifier, metaData, fileData); 445 completionHandler(contentRuleList, { }); 427 446 }); 428 447 }); 429 448 } 430 449 431 void Content ExtensionStore::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 );450 void 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); 435 454 436 455 if (!WebCore::deleteFile(path)) { … … 447 466 } 448 467 449 void Content ExtensionStore::synchronousRemoveAllContentExtensions()468 void ContentRuleListStore::synchronousRemoveAllContentRuleLists() 450 469 { 451 470 for (const auto& path : WebCore::listDirectory(m_storePath, "*")) … … 453 472 } 454 473 455 void Content ExtensionStore::invalidateContentExtensionVersion(const WTF::String& identifier)456 { 457 auto file = WebCore::openFile(constructedPath(m_storePath, identifier ), WebCore::OpenForWrite);474 void ContentRuleListStore::invalidateContentRuleListVersion(const WTF::String& identifier) 475 { 476 auto file = WebCore::openFile(constructedPath(m_storePath, identifier, m_legacyFilename), WebCore::OpenForWrite); 458 477 if (file == WebCore::invalidPlatformFileHandle) 459 478 return; 460 Content ExtensionMetaData invalidHeader = {0, 0, 0, 0, 0, 0};479 ContentRuleListMetaData invalidHeader = {0, 0, 0, 0, 0, 0}; 461 480 auto bytesWritten = WebCore::writeToFile(file, reinterpret_cast<const char*>(&invalidHeader), sizeof(invalidHeader)); 462 481 ASSERT_UNUSED(bytesWritten, bytesWritten == sizeof(invalidHeader)); … … 464 483 } 465 484 466 void Content ExtensionStore::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 );485 void 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); 470 489 471 490 auto complete = [protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler)](String source) mutable { … … 475 494 }; 476 495 477 Content ExtensionMetaData metaData;496 ContentRuleListMetaData metaData; 478 497 Data fileData; 479 if (!openAndMapContent Extension(path, metaData, fileData)) {498 if (!openAndMapContentRuleList(path, metaData, fileData)) { 480 499 complete({ }); 481 500 return; … … 488 507 return; 489 508 } 490 bool is8Bit = fileData.data()[Content ExtensionFileHeaderSize];491 size_t start = Content ExtensionFileHeaderSize + sizeof(bool);509 bool is8Bit = fileData.data()[ContentRuleListFileHeaderSize]; 510 size_t start = ContentRuleListFileHeaderSize + sizeof(bool); 492 511 size_t length = metaData.sourceSize - sizeof(bool); 493 512 if (is8Bit) … … 505 524 } 506 525 507 const std::error_category& content ExtensionStoreErrorCategory()508 { 509 class Content ExtensionStoreErrorCategory : public std::error_category {526 const std::error_category& contentRuleListStoreErrorCategory() 527 { 528 class ContentRuleListStoreErrorCategory : public std::error_category { 510 529 const char* name() const noexcept final 511 530 { … … 515 534 std::string message(int errorCode) const final 516 535 { 517 switch (static_cast<Content ExtensionStore::Error>(errorCode)) {518 case Content ExtensionStore::Error::LookupFailed:536 switch (static_cast<ContentRuleListStore::Error>(errorCode)) { 537 case ContentRuleListStore::Error::LookupFailed: 519 538 return "Unspecified error during lookup."; 520 case Content ExtensionStore::Error::VersionMismatch:539 case ContentRuleListStore::Error::VersionMismatch: 521 540 return "Version of file does not match version of interpreter."; 522 case Content ExtensionStore::Error::CompileFailed:541 case ContentRuleListStore::Error::CompileFailed: 523 542 return "Unspecified error during compile."; 524 case Content ExtensionStore::Error::RemoveFailed:543 case ContentRuleListStore::Error::RemoveFailed: 525 544 return "Unspecified error during remove."; 526 545 } … … 530 549 }; 531 550 532 static NeverDestroyed<Content ExtensionStoreErrorCategory> contentExtensionErrorCategory;533 return content ExtensionErrorCategory;551 static NeverDestroyed<ContentRuleListStoreErrorCategory> contentRuleListErrorCategory; 552 return contentRuleListErrorCategory; 534 553 } 535 554 -
trunk/Source/WebKit2/UIProcess/API/APIContentRuleListStore.h
r216807 r216809 38 38 namespace API { 39 39 40 class Content Extension;40 class ContentRuleList; 41 41 42 class Content ExtensionStore final : public ObjectImpl<Object::Type::ContentExtensionStore> {42 class ContentRuleListStore final : public ObjectImpl<Object::Type::ContentRuleListStore> { 43 43 public: 44 44 enum class Error { … … 51 51 // This should be incremented every time a functional change is made to the bytecode, file format, etc. 52 52 // to prevent crashing while loading old data. 53 // Also update Content ExtensionStore::getContentExtensionSource to be able to find the original JSON53 // Also update ContentRuleListStore::getContentRuleListSource to be able to find the original JSON 54 54 // source from old versions. 55 const static uint32_t CurrentContent ExtensionFileVersion = 9;55 const static uint32_t CurrentContentRuleListFileVersion = 9; 56 56 57 static Content ExtensionStore& defaultStore();58 static Ref<Content ExtensionStore> storeWithPath(const WTF::String& storePath);57 static ContentRuleListStore& defaultStore(bool legacyFilename); 58 static Ref<ContentRuleListStore> storeWithPath(const WTF::String& storePath, bool legacyFilename); 59 59 60 explicit Content ExtensionStore();61 explicit Content ExtensionStore(const WTF::String& storePath);62 virtual ~Content ExtensionStore();60 explicit ContentRuleListStore(bool legacyFilename); 61 explicit ContentRuleListStore(const WTF::String& storePath, bool legacyFilename); 62 virtual ~ContentRuleListStore(); 63 63 64 void compileContent Extension(const WTF::String& identifier, WTF::String&& json, Function<void(RefPtr<API::ContentExtension>, std::error_code)>);65 void lookupContent Extension(const WTF::String& identifier, Function<void(RefPtr<API::ContentExtension>, std::error_code)>);66 void removeContent Extension(const WTF::String& identifier, Function<void(std::error_code)>);67 void getAvailableContent ExtensionIdentifiers(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>)>); 68 68 69 69 // For testing only. 70 void synchronousRemoveAllContent Extensions();71 void invalidateContent ExtensionVersion(const WTF::String& identifier);72 void getContent ExtensionSource(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)>); 73 73 74 74 private: 75 WTF::String defaultStorePath(); 76 75 WTF::String defaultStorePath(bool legacyFilename); 76 static ContentRuleListStore& legacyDefaultStore(); 77 static ContentRuleListStore& nonLegacyDdefaultStore(); 78 77 79 const WTF::String m_storePath; 78 80 Ref<WTF::WorkQueue> m_compileQueue; 79 81 Ref<WTF::WorkQueue> m_readQueue; 80 82 Ref<WTF::WorkQueue> m_removeQueue; 83 bool m_legacyFilename { false }; 81 84 }; 82 85 83 const std::error_category& content ExtensionStoreErrorCategory();86 const std::error_category& contentRuleListStoreErrorCategory(); 84 87 85 inline std::error_code make_error_code(Content ExtensionStore::Error error)88 inline std::error_code make_error_code(ContentRuleListStore::Error error) 86 89 { 87 return { static_cast<int>(error), content ExtensionStoreErrorCategory() };90 return { static_cast<int>(error), contentRuleListStoreErrorCategory() }; 88 91 } 89 92 … … 91 94 92 95 namespace std { 93 template<> struct is_error_code_enum<API::Content ExtensionStore::Error> : public true_type { };96 template<> struct is_error_code_enum<API::ContentRuleListStore::Error> : public true_type { }; 94 97 } 95 98 -
trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h
r216696 r216809 54 54 55 55 namespace API { 56 class Content Extension;57 class Content ExtensionStore;56 class ContentRuleList; 57 class ContentRuleListStore; 58 58 class ExperimentalFeature; 59 59 class FrameHandle; … … 163 163 WK_ADD_API_MAPPING(WKTextCheckerRef, WebTextChecker) 164 164 WK_ADD_API_MAPPING(WKUserContentControllerRef, WebUserContentControllerProxy) 165 WK_ADD_API_MAPPING(WKUserContentExtensionStoreRef, API::Content ExtensionStore)166 WK_ADD_API_MAPPING(WKUserContentFilterRef, API::Content Extension)165 WK_ADD_API_MAPPING(WKUserContentExtensionStoreRef, API::ContentRuleListStore) 166 WK_ADD_API_MAPPING(WKUserContentFilterRef, API::ContentRuleList) 167 167 WK_ADD_API_MAPPING(WKUserMediaPermissionCheckRef, UserMediaPermissionCheckProxy) 168 168 WK_ADD_API_MAPPING(WKUserMediaPermissionRequestRef, UserMediaPermissionRequestProxy) -
trunk/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp
r216473 r216809 27 27 #include "WKPageGroup.h" 28 28 29 #include "APIContent Extension.h"29 #include "APIContentRuleList.h" 30 30 #include "APIUserContentWorld.h" 31 31 #include "APIUserScript.h" -
trunk/Source/WebKit2/UIProcess/API/C/WKUserContentControllerRef.cpp
r213696 r216809 27 27 #include "WKUserContentControllerRef.h" 28 28 29 #include "APIContent Extension.h"29 #include "APIContentRuleList.h" 30 30 #include "APIUserScript.h" 31 31 #include "WKAPICast.h" … … 63 63 { 64 64 #if ENABLE(CONTENT_EXTENSIONS) 65 toImpl(userContentControllerRef)->addContent Extension(*toImpl(userContentFilterRef));65 toImpl(userContentControllerRef)->addContentRuleList(*toImpl(userContentFilterRef)); 66 66 #endif 67 67 } … … 70 70 { 71 71 #if ENABLE(CONTENT_EXTENSIONS) 72 toImpl(userContentControllerRef)->removeAllContent Extensions();72 toImpl(userContentControllerRef)->removeAllContentRuleLists(); 73 73 #endif 74 74 } -
trunk/Source/WebKit2/UIProcess/API/C/WKUserContentExtensionStoreRef.cpp
r213696 r216809 27 27 #include "WKUserContentExtensionStoreRef.h" 28 28 29 #include "APIContent ExtensionStore.h"29 #include "APIContentRuleListStore.h" 30 30 #include "WKAPICast.h" 31 31 … … 35 35 { 36 36 #if ENABLE(CONTENT_EXTENSIONS) 37 return toAPI(API::Content ExtensionStore::APIType);37 return toAPI(API::ContentRuleListStore::APIType); 38 38 #else 39 39 return 0; -
trunk/Source/WebKit2/UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm
r216807 r216809 25 25 26 26 #include "config.h" 27 #include "APIContent ExtensionStore.h"27 #include "APIContentRuleListStore.h" 28 28 29 29 #if ENABLE(CONTENT_EXTENSIONS) … … 33 33 namespace API { 34 34 35 String Content ExtensionStore::defaultStorePath()35 String ContentRuleListStore::defaultStorePath(bool legacyFilename) 36 36 { 37 37 static dispatch_once_t onceToken; 38 static NSURL *content ExtensionStoreURL;38 static NSURL *contentRuleListStoreURL; 39 39 40 40 dispatch_once(&onceToken, ^{ … … 51 51 url = [url URLByAppendingPathComponent:bundleIdentifier isDirectory:YES]; 52 52 } 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]; 55 58 }); 56 59 57 if (![[NSFileManager defaultManager] createDirectoryAtURL:content ExtensionStoreURL withIntermediateDirectories:YES attributes:nil error:nullptr])58 LOG_ERROR("Failed to create directory %@", content ExtensionStoreURL);60 if (![[NSFileManager defaultManager] createDirectoryAtURL:contentRuleListStoreURL withIntermediateDirectories:YES attributes:nil error:nullptr]) 61 LOG_ERROR("Failed to create directory %@", contentRuleListStoreURL); 59 62 60 return content ExtensionStoreURL.absoluteURL.path.fileSystemRepresentation;63 return contentRuleListStoreURL.absoluteURL.path.fileSystemRepresentation; 61 64 } 62 65 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentRuleList.h
r216807 r216809 29 29 30 30 WK_CLASS_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)) 31 @interface WKContent Extension: NSObject31 @interface WKContentRuleList : NSObject 32 32 33 33 /*! @abstract A copy of the identifier of the content extension. */ -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentRuleList.mm
r216807 r216809 25 25 26 26 #import "config.h" 27 #import "WKContent ExtensionInternal.h"27 #import "WKContentRuleListInternal.h" 28 28 29 29 #if WK_API_ENABLED 30 30 31 #include "WebCompiledContent Extension.h"31 #include "WebCompiledContentRuleList.h" 32 32 33 @implementation WKContent Extension33 @implementation WKContentRuleList 34 34 35 35 - (void)dealloc 36 36 { 37 _content Extension->~ContentExtension();37 _contentRuleList->~ContentRuleList(); 38 38 39 39 [super dealloc]; … … 44 44 - (API::Object&)_apiObject 45 45 { 46 return *_content Extension;46 return *_contentRuleList; 47 47 } 48 48 49 49 - (NSString *)identifier 50 50 { 51 return _content Extension->name();51 return _contentRuleList->name(); 52 52 } 53 53 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentRuleListInternal.h
r216807 r216809 24 24 */ 25 25 26 #import "WKContent Extension.h"26 #import "WKContentRuleList.h" 27 27 28 28 #if WK_API_ENABLED 29 29 30 #import "APIContent Extension.h"30 #import "APIContentRuleList.h" 31 31 #import "WKObject.h" 32 32 33 33 namespace WebKit { 34 34 35 inline WKContent Extension *wrapper(API::ContentExtension& contentExtension)35 inline WKContentRuleList *wrapper(API::ContentRuleList& contentRuleList) 36 36 { 37 ASSERT([content Extension.wrapper() isKindOfClass:[WKContentExtensionclass]]);38 return (WKContent Extension *)contentExtension.wrapper();37 ASSERT([contentRuleList.wrapper() isKindOfClass:[WKContentRuleList class]]); 38 return (WKContentRuleList *)contentRuleList.wrapper(); 39 39 } 40 40 41 41 } 42 42 43 @interface WKContent Extension() <WKObject> {43 @interface WKContentRuleList () <WKObject> { 44 44 @package 45 API::ObjectStorage<API::Content Extension> _contentExtension;45 API::ObjectStorage<API::ContentRuleList> _contentRuleList; 46 46 } 47 47 @end -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentRuleListStore.h
r216807 r216809 28 28 #if WK_API_ENABLED 29 29 30 @class WKContent Extension;30 @class WKContentRuleList; 31 31 32 32 WK_CLASS_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)) 33 @interface WKContent ExtensionStore : NSObject33 @interface WKContentRuleListStore : NSObject 34 34 35 35 + (instancetype)defaultStore; 36 36 + (instancetype)storeWithURL:(NSURL *)url; 37 37 38 - (void)compileContent ExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *) encodedContentExtension completionHandler:(void (^)(WKContentExtension*, NSError *))completionHandler;39 - (void)lookUpContent ExtensionForIdentifier:(NSString *)identifier completionHandler:(void (^)(WKContentExtension*, NSError *))completionHandler;40 - (void)removeContent ExtensionForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSError *))completionHandler;41 - (void)getAvailableContent ExtensionIdentifiers:(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; 42 42 43 43 @end -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentRuleListStore.mm
r216807 r216809 25 25 26 26 #import "config.h" 27 #import "WKContent ExtensionInternal.h"28 #import "WKContent ExtensionStoreInternal.h"27 #import "WKContentRuleListInternal.h" 28 #import "WKContentRuleListStoreInternal.h" 29 29 30 30 #if WK_API_ENABLED 31 31 32 #import "APIContent ExtensionStore.h"32 #import "APIContentRuleListStore.h" 33 33 #import "WKErrorInternal.h" 34 34 #import <wtf/BlockPtr.h> … … 36 36 static WKErrorCode toWKErrorCode(const std::error_code& error) 37 37 { 38 ASSERT(error.category() == API::content ExtensionStoreErrorCategory());39 switch (static_cast<API::Content ExtensionStore::Error>(error.value())) {40 case API::Content ExtensionStore::Error::LookupFailed:41 return WKErrorContent ExtensionStoreLookUpFailed;42 case API::Content ExtensionStore::Error::VersionMismatch:43 return WKErrorContent ExtensionStoreVersionMismatch;44 case API::Content ExtensionStore::Error::CompileFailed:45 return WKErrorContent ExtensionStoreCompileFailed;46 case API::Content ExtensionStore::Error::RemoveFailed:47 return WKErrorContent ExtensionStoreRemoveFailed;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; 48 48 } 49 49 ASSERT_NOT_REACHED(); … … 51 51 } 52 52 53 @implementation WKContent ExtensionStore53 @implementation WKContentRuleListStore 54 54 55 55 - (void)dealloc 56 56 { 57 _content ExtensionStore->~ContentExtensionStore();57 _contentRuleListStore->~ContentRuleListStore(); 58 58 59 59 [super dealloc]; … … 62 62 + (instancetype)defaultStore 63 63 { 64 return WebKit::wrapper(API::ContentExtensionStore::defaultStore()); 64 const bool legacyFilename = false; 65 return WebKit::wrapper(API::ContentRuleListStore::defaultStore(legacyFilename)); 65 66 } 66 67 67 68 + (instancetype)storeWithURL:(NSURL *)url 68 69 { 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); 70 72 return WebKit::wrapper(store.leakRef()); 71 73 } 72 74 73 - (void)compileContent ExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *)encodedContentExtension completionHandler:(void (^)(WKContentExtension*, NSError *))completionHandler75 - (void)compileContentRuleListForIdentifier:(NSString *)identifier encodedContentRuleList:(NSString *)encodedContentRuleList completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler 74 76 { 75 [self _compileContent ExtensionForIdentifier:identifier encodedContentExtension:encodedContentExtensioncompletionHandler:completionHandler releasesArgument:NO];77 [self _compileContentRuleListForIdentifier:identifier encodedContentRuleList:encodedContentRuleList completionHandler:completionHandler releasesArgument:NO]; 76 78 } 77 79 78 - (void)_compileContent ExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *)encodedContentExtension completionHandler:(void (^)(WKContentExtension*, NSError *))completionHandler releasesArgument:(BOOL)releasesArgument80 - (void)_compileContentRuleListForIdentifier:(NSString *)identifier encodedContentRuleList:(NSString *)encodedContentRuleList completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler releasesArgument:(BOOL)releasesArgument 79 81 { 80 String json(encodedContent Extension);82 String json(encodedContentRuleList); 81 83 if (releasesArgument) { 82 [encodedContent Extensionrelease];83 encodedContent Extension= nil;84 [encodedContentRuleList release]; 85 encodedContentRuleList = nil; 84 86 } 85 87 86 _content ExtensionStore->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) { 87 89 if (error) { 88 auto userInfo = @{NSHelpAnchorErrorKey: [NSString stringWithFormat:@" Extensioncompilation failed: %s", error.message().c_str()]};90 auto userInfo = @{NSHelpAnchorErrorKey: [NSString stringWithFormat:@"Rule list compilation failed: %s", error.message().c_str()]}; 89 91 90 // error.value() could have a specific compiler error that is not equal to WKErrorContent ExtensionStoreCompileFailed.92 // error.value() could have a specific compiler error that is not equal to WKErrorContentRuleListStoreCompileFailed. 91 93 // 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:WKErrorContent ExtensionStoreCompileFailed userInfo:userInfo]);94 return completionHandler(nil, [NSError errorWithDomain:WKErrorDomain code:WKErrorContentRuleListStoreCompileFailed userInfo:userInfo]); 93 95 } 94 completionHandler(WebKit::wrapper(*content Extension.get()), nil);96 completionHandler(WebKit::wrapper(*contentRuleList.get()), nil); 95 97 }); 96 98 } 97 99 98 - (void)lookUpContent ExtensionForIdentifier:(NSString *)identifier completionHandler:(void (^)(WKContentExtension*, NSError *))completionHandler100 - (void)lookUpContentRuleListForIdentifier:(NSString *)identifier completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler 99 101 { 100 _content ExtensionStore->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) { 101 103 if (error) { 102 auto userInfo = @{NSHelpAnchorErrorKey: [NSString stringWithFormat:@" Extensionlookup failed: %s", error.message().c_str()]};104 auto userInfo = @{NSHelpAnchorErrorKey: [NSString stringWithFormat:@"Rule list lookup failed: %s", error.message().c_str()]}; 103 105 auto wkError = toWKErrorCode(error); 104 ASSERT(wkError == WKErrorContent ExtensionStoreLookUpFailed || wkError == WKErrorContentExtensionStoreVersionMismatch);106 ASSERT(wkError == WKErrorContentRuleListStoreLookUpFailed || wkError == WKErrorContentRuleListStoreVersionMismatch); 105 107 return completionHandler(nil, [NSError errorWithDomain:WKErrorDomain code:wkError userInfo:userInfo]); 106 108 } 107 109 108 completionHandler(WebKit::wrapper(*content Extension.get()), nil);110 completionHandler(WebKit::wrapper(*contentRuleList.get()), nil); 109 111 }); 110 112 } 111 113 112 - (void)getAvailableContent ExtensionIdentifiers:(void (^)(NSArray<NSString *>*))completionHandler114 - (void)getAvailableContentRuleListIdentifiers:(void (^)(NSArray<NSString *>*))completionHandler 113 115 { 114 _content ExtensionStore->getAvailableContentExtensionIdentifiers([completionHandler = makeBlockPtr(completionHandler)](Vector<String> identifiers) {116 _contentRuleListStore->getAvailableContentRuleListIdentifiers([completionHandler = makeBlockPtr(completionHandler)](Vector<String> identifiers) { 115 117 NSMutableArray<NSString *> *nsIdentifiers = [NSMutableArray arrayWithCapacity:identifiers.size()]; 116 118 for (const auto& identifier : identifiers) … … 120 122 } 121 123 122 - (void)removeContent ExtensionForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSError *))completionHandler124 - (void)removeContentRuleListForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSError *))completionHandler 123 125 { 124 _content ExtensionStore->removeContentExtension(identifier, [completionHandler = makeBlockPtr(completionHandler)](std::error_code error) {126 _contentRuleListStore->removeContentRuleList(identifier, [completionHandler = makeBlockPtr(completionHandler)](std::error_code error) { 125 127 if (error) { 126 auto userInfo = @{NSHelpAnchorErrorKey: [NSString stringWithFormat:@" Extensionremoval failed: %s", error.message().c_str()]};127 ASSERT(toWKErrorCode(error) == WKErrorContent ExtensionStoreRemoveFailed);128 return completionHandler([NSError errorWithDomain:WKErrorDomain code:WKErrorContent ExtensionStoreRemoveFailed 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]); 129 131 } 130 132 … … 137 139 - (API::Object&)_apiObject 138 140 { 139 return *_content ExtensionStore;141 return *_contentRuleListStore; 140 142 } 141 143 142 144 @end 143 145 144 @implementation WKContent ExtensionStore (WKPrivate)146 @implementation WKContentRuleListStore (WKPrivate) 145 147 146 148 // For testing only. 147 149 148 - (void)_removeAllContent Extensions150 - (void)_removeAllContentRuleLists 149 151 { 150 _content ExtensionStore->synchronousRemoveAllContentExtensions();152 _contentRuleListStore->synchronousRemoveAllContentRuleLists(); 151 153 } 152 154 153 - (void)_invalidateContent ExtensionVersionForIdentifier:(NSString *)identifier155 - (void)_invalidateContentRuleListVersionForIdentifier:(NSString *)identifier 154 156 { 155 _content ExtensionStore->invalidateContentExtensionVersion(identifier);157 _contentRuleListStore->invalidateContentRuleListVersion(identifier); 156 158 } 157 159 158 - (void)_getContent ExtensionSourceForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSString*))completionHandler160 - (void)_getContentRuleListSourceForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSString*))completionHandler 159 161 { 160 162 auto handler = adoptNS([completionHandler copy]); 161 _content ExtensionStore->getContentExtensionSource(identifier, [handler](String source) {163 _contentRuleListStore->getContentRuleListSource(identifier, [handler](String source) { 162 164 auto rawHandler = (void (^)(NSString *))handler.get(); 163 165 if (source.isNull()) … … 170 172 // NS_RELEASES_ARGUMENT to keep peak memory usage low. 171 173 172 - (void)_compileContent ExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *)encodedContentExtension completionHandler:(void (^)(WKContentExtension*, NSError *))completionHandler174 - (void)_compileContentRuleListForIdentifier:(NSString *)identifier encodedContentRuleList:(NSString *)encodedContentRuleList completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler 173 175 { 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()); 175 190 } 176 191 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentRuleListStoreInternal.h
r216807 r216809 24 24 */ 25 25 26 #import "WKContent ExtensionStorePrivate.h"26 #import "WKContentRuleListStorePrivate.h" 27 27 28 28 #if WK_API_ENABLED 29 29 30 #import "APIContent ExtensionStore.h"30 #import "APIContentRuleListStore.h" 31 31 #import "WKObject.h" 32 32 33 33 namespace WebKit { 34 34 35 inline WKContent ExtensionStore *wrapper(API::ContentExtensionStore& store)35 inline WKContentRuleListStore *wrapper(API::ContentRuleListStore& store) 36 36 { 37 ASSERT([store.wrapper() isKindOfClass:[WKContent ExtensionStore class]]);38 return (WKContent ExtensionStore *)store.wrapper();37 ASSERT([store.wrapper() isKindOfClass:[WKContentRuleListStore class]]); 38 return (WKContentRuleListStore *)store.wrapper(); 39 39 } 40 40 41 41 } 42 42 43 @interface WKContent ExtensionStore () <WKObject> {43 @interface WKContentRuleListStore () <WKObject> { 44 44 @package 45 API::ObjectStorage<API::Content ExtensionStore> _contentExtensionStore;45 API::ObjectStorage<API::ContentRuleListStore> _contentRuleListStore; 46 46 } 47 47 @end -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h
r216807 r216809 24 24 */ 25 25 26 #import <WebKit/WKContent ExtensionStore.h>26 #import <WebKit/WKContentRuleListStore.h> 27 27 28 28 #if WK_API_ENABLED 29 29 30 @interface WKContent ExtensionStore (WKPrivate)30 @interface WKContentRuleListStore (WKPrivate) 31 31 32 32 // For testing only. 33 - (void)_removeAllContent Extensions;34 - (void)_invalidateContent ExtensionVersionForIdentifier:(NSString *)identifier;35 - (void)_getContent ExtensionSourceForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSString*))completionHandler;33 - (void)_removeAllContentRuleLists; 34 - (void)_invalidateContentRuleListVersionForIdentifier:(NSString *)identifier; 35 - (void)_getContentRuleListSourceForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSString*))completionHandler; 36 36 37 37 // 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; 39 45 40 46 @end -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKError.h
r214061 r216809 42 42 @constant WKErrorJavaScriptExceptionOccurred Indicates that a JavaScript exception occurred. 43 43 @constant WKErrorJavaScriptResultTypeIsUnsupported Indicates that the result of JavaScript execution could not be returned. 44 @constant WKErrorContent ExtensionStoreCompileFailed Indicates that compiling a WKUserContentExtensionfailed.45 @constant WKErrorContent ExtensionStoreLookUpFailed Indicates that looking up a WKUserContentExtensionfailed.46 @constant WKErrorContent ExtensionStoreRemoveFailed Indicates that removing a WKUserContentExtensionfailed.47 @constant WKErrorContent ExtensionStoreVersionMismatch Indicates that the WKUserContentExtensionversion 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. 48 48 */ 49 49 typedef NS_ENUM(NSInteger, WKErrorCode) { … … 53 53 WKErrorJavaScriptExceptionOccurred, 54 54 WKErrorJavaScriptResultTypeIsUnsupported WK_API_AVAILABLE(macosx(10.11), ios(9.0)), 55 WKErrorContent ExtensionStoreCompileFailed WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)),56 WKErrorContent ExtensionStoreLookUpFailed WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)),57 WKErrorContent ExtensionStoreRemoveFailed WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)),58 WKErrorContent ExtensionStoreVersionMismatch 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)), 59 59 } WK_API_AVAILABLE(macosx(10.10), ios(8.0)); 60 60 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKError.mm
r214061 r216809 59 59 return WEB_UI_STRING("JavaScript execution returned a result of an unsupported type", "WKErrorJavaScriptResultTypeIsUnsupported description"); 60 60 61 case WKErrorContent ExtensionStoreLookUpFailed:62 return WEB_UI_STRING("Looking up a WK UserContentExtension failed", "WKErrorContentExtensionStoreLookupFailed description");61 case WKErrorContentRuleListStoreLookUpFailed: 62 return WEB_UI_STRING("Looking up a WKContentRuleList failed", "WKErrorContentRuleListStoreLookupFailed description"); 63 63 64 case WKErrorContent ExtensionStoreVersionMismatch:65 return WEB_UI_STRING("Looking up a WK UserContentExtension 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"); 66 66 67 case WKErrorContent ExtensionStoreCompileFailed:68 return WEB_UI_STRING("Compiling a WK UserContentExtension failed", "WKErrorContentExtensionStoreCompileFailed description");67 case WKErrorContentRuleListStoreCompileFailed: 68 return WEB_UI_STRING("Compiling a WKContentRuleList failed", "WKErrorContentRuleListStoreCompileFailed description"); 69 69 70 case WKErrorContent ExtensionStoreRemoveFailed:71 return WEB_UI_STRING("Removing a WK UserContentExtension failed", "WKErrorContentExtensionStoreRemoveFailed description");70 case WKErrorContentRuleListStoreRemoveFailed: 71 return WEB_UI_STRING("Removing a WKContentRuleList failed", "WKErrorContentRuleListStoreRemoveFailed description"); 72 72 } 73 73 } -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.h
r214061 r216809 32 32 NS_ASSUME_NONNULL_BEGIN 33 33 34 @class WKContent Extension;34 @class WKContentRuleList; 35 35 @class WKUserScript; 36 36 @protocol WKScriptMessageHandler; … … 72 72 - (void)removeScriptMessageHandlerForName:(NSString *)name; 73 73 74 /*! @abstract Adds a user content extension.75 @param name The name of the user content extensionto add.74 /*! @abstract Adds a content rule list. 75 @param contentRuleList The content rule list to add. 76 76 */ 77 - (void)addContent Extension:(WKContentExtension *)contentExtensionWK_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)); 78 78 79 /*! @abstract Removes a user content extension.80 @param name The identifier of the user content extensionto remove.79 /*! @abstract Removes a content rule list. 80 @param contentRuleList The content rule list to remove. 81 81 */ 82 - (void)removeContent Extension:(WKContentExtension *)contentExtensionWK_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)); 83 83 84 /*! @abstract Removes all associated user content extensions.84 /*! @abstract Removes all associated content rule lists. 85 85 */ 86 - (void)removeAllContent Extensions 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)); 87 87 88 88 @end -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm
r214061 r216809 31 31 #import "APISerializedScriptValue.h" 32 32 #import "APIUserContentWorld.h" 33 #import "WKContent ExtensionInternal.h"33 #import "WKContentRuleListInternal.h" 34 34 #import "WKFrameInfoInternal.h" 35 35 #import "WKNSArray.h" … … 93 93 } 94 94 95 - (void)addContent Extension:(WKContentExtension *)contentExtension96 { 97 #if ENABLE(CONTENT_EXTENSIONS) 98 _userContentControllerProxy->addContent Extension(*contentExtension->_contentExtension);99 #endif 100 } 101 102 - (void)removeContent Extension:(WKContentExtension *)contentExtension103 { 104 #if ENABLE(CONTENT_EXTENSIONS) 105 _userContentControllerProxy->removeContent Extension(contentExtension->_contentExtension->name());106 #endif 107 } 108 109 - (void)removeAllContent Extensions110 { 111 #if ENABLE(CONTENT_EXTENSIONS) 112 _userContentControllerProxy->removeAllContent Extensions();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(); 113 113 #endif 114 114 } … … 176 176 { 177 177 #if ENABLE(CONTENT_EXTENSIONS) 178 _userContentControllerProxy->addContent Extension(*userContentFilter->_contentExtension->_contentExtension);178 _userContentControllerProxy->addContentRuleList(*userContentFilter->_contentRuleList->_contentRuleList); 179 179 #endif 180 180 } … … 183 183 { 184 184 #if ENABLE(CONTENT_EXTENSIONS) 185 _userContentControllerProxy->removeContent Extension(userContentFilterName);185 _userContentControllerProxy->removeContentRuleList(userContentFilterName); 186 186 #endif 187 187 } … … 190 190 { 191 191 #if ENABLE(CONTENT_EXTENSIONS) 192 _userContentControllerProxy->removeAllContent Extensions();192 _userContentControllerProxy->removeAllContentRuleLists(); 193 193 #endif 194 194 } -
trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm
r214061 r216809 29 29 #if WK_API_ENABLED 30 30 31 #import "WKContent ExtensionStoreInternal.h"32 #import "WKContent ExtensionStorePrivate.h"31 #import "WKContentRuleListStoreInternal.h" 32 #import "WKContentRuleListStorePrivate.h" 33 33 #import "WKErrorInternal.h" 34 34 #import "_WKUserContentExtensionStorePrivate.h" … … 39 39 NSString * const _WKUserContentExtensionsDomain = @"WKErrorDomain"; 40 40 41 static NSError *toUserContent ExtensionStoreError(const NSError *error)41 static NSError *toUserContentRuleListStoreError(const NSError *error) 42 42 { 43 43 if (!error) … … 46 46 ASSERT(error.domain == WKErrorDomain); 47 47 switch (error.code) { 48 case WKErrorContent ExtensionStoreLookUpFailed:48 case WKErrorContentRuleListStoreLookUpFailed: 49 49 return [NSError errorWithDomain:_WKUserContentExtensionsDomain code:_WKUserContentExtensionStoreErrorLookupFailed userInfo:error.userInfo]; 50 case WKErrorContent ExtensionStoreVersionMismatch:50 case WKErrorContentRuleListStoreVersionMismatch: 51 51 return [NSError errorWithDomain:_WKUserContentExtensionsDomain code:_WKUserContentExtensionStoreErrorVersionMismatch userInfo:error.userInfo]; 52 case WKErrorContent ExtensionStoreCompileFailed:52 case WKErrorContentRuleListStoreCompileFailed: 53 53 return [NSError errorWithDomain:_WKUserContentExtensionsDomain code:_WKUserContentExtensionStoreErrorCompileFailed userInfo:error.userInfo]; 54 case WKErrorContent ExtensionStoreRemoveFailed:54 case WKErrorContentRuleListStoreRemoveFailed: 55 55 return [NSError errorWithDomain:_WKUserContentExtensionsDomain code:_WKUserContentExtensionStoreErrorRemoveFailed userInfo:error.userInfo]; 56 56 default: … … 63 63 + (instancetype)defaultStore 64 64 { 65 return [[[_WKUserContentExtensionStore alloc] _initWithWKContent ExtensionStore:[WKContentExtensionStore defaultStore]] autorelease];65 return [[[_WKUserContentExtensionStore alloc] _initWithWKContentRuleListStore:[WKContentRuleListStore defaultStoreWithLegacyFilename]] autorelease]; 66 66 } 67 67 68 68 + (instancetype)storeWithURL:(NSURL *)url 69 69 { 70 return [[[_WKUserContentExtensionStore alloc] _initWithWKContent ExtensionStore:[WKContentExtensionStore storeWithURL:url]] autorelease];70 return [[[_WKUserContentExtensionStore alloc] _initWithWKContentRuleListStore:[WKContentRuleListStore storeWithURLAndLegacyFilename:url]] autorelease]; 71 71 } 72 72 73 - (void)compileContentExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *)encodedContent ExtensioncompletionHandler:(void (^)(_WKUserContentFilter *, NSError *))completionHandler73 - (void)compileContentExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *)encodedContentRuleList completionHandler:(void (^)(_WKUserContentFilter *, NSError *))completionHandler 74 74 { 75 [_content ExtensionStore _compileContentExtensionForIdentifier:identifier encodedContentExtension:encodedContentExtension completionHandler:^(WKContentExtension *contentExtension, NSError *error) {76 _WKUserContentFilter *contentFilter = content Extension ? [[[_WKUserContentFilter alloc] _initWithWKContentExtension:contentExtension] autorelease] : nil;77 completionHandler(contentFilter, toUserContent ExtensionStoreError(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)); 78 78 }]; 79 79 } … … 81 81 - (void)lookupContentExtensionForIdentifier:(NSString *)identifier completionHandler:(void (^)(_WKUserContentFilter *, NSError *))completionHandler 82 82 { 83 [_content ExtensionStore lookUpContentExtensionForIdentifier:identifier completionHandler:^(WKContentExtension *contentExtension, NSError *error) {84 _WKUserContentFilter *contentFilter = content Extension ? [[[_WKUserContentFilter alloc] _initWithWKContentExtension:contentExtension] autorelease] : nil;85 completionHandler(contentFilter, toUserContent ExtensionStoreError(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)); 86 86 }]; 87 87 } … … 89 89 - (void)removeContentExtensionForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSError *))completionHandler 90 90 { 91 [_content ExtensionStore removeContentExtensionForIdentifier:identifier completionHandler:^(NSError *error) {92 completionHandler(toUserContent ExtensionStoreError(error));91 [_contentRuleListStore removeContentRuleListForIdentifier:identifier completionHandler:^(NSError *error) { 92 completionHandler(toUserContentRuleListStoreError(error)); 93 93 }]; 94 94 } … … 98 98 - (API::Object&)_apiObject 99 99 { 100 return [_content ExtensionStore _apiObject];100 return [_contentRuleListStore _apiObject]; 101 101 } 102 102 … … 109 109 - (void)_removeAllContentExtensions 110 110 { 111 [_content ExtensionStore _removeAllContentExtensions];111 [_contentRuleListStore _removeAllContentRuleLists]; 112 112 } 113 113 114 114 - (void)_invalidateContentExtensionVersionForIdentifier:(NSString *)identifier 115 115 { 116 [_content ExtensionStore _invalidateContentExtensionVersionForIdentifier:identifier];116 [_contentRuleListStore _invalidateContentRuleListVersionForIdentifier:identifier]; 117 117 } 118 118 119 - (id)_initWithWKContent ExtensionStore:(WKContentExtensionStore*)contentExtensionStore119 - (id)_initWithWKContentRuleListStore:(WKContentRuleListStore*)contentRuleListStore 120 120 { 121 121 self = [super init]; … … 123 123 return nil; 124 124 125 _content ExtensionStore = contentExtensionStore;125 _contentRuleListStore = contentRuleListStore; 126 126 127 127 return self; -
trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStoreInternal.h
r213696 r216809 28 28 #if WK_API_ENABLED 29 29 30 #import "APIContent ExtensionStore.h"30 #import "APIContentRuleListStore.h" 31 31 #import "WKObject.h" 32 32 33 @class WKContent ExtensionStore;33 @class WKContentRuleListStore; 34 34 35 35 @interface _WKUserContentExtensionStore () <WKObject> { 36 36 @package 37 RetainPtr<WKContent ExtensionStore> _contentExtensionStore;37 RetainPtr<WKContentRuleListStore> _contentRuleListStore; 38 38 } 39 39 @end -
trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h
r213696 r216809 28 28 #if WK_API_ENABLED 29 29 30 @class WKContent ExtensionStore;30 @class WKContentRuleListStore; 31 31 32 32 @interface _WKUserContentExtensionStore (WKPrivate) … … 36 36 - (void)_invalidateContentExtensionVersionForIdentifier:(NSString *)identifier; 37 37 38 - (id)_initWithWKContent ExtensionStore:(WKContentExtensionStore*)contentExtensionStore;38 - (id)_initWithWKContentRuleListStore:(WKContentRuleListStore*)contentRuleListStore; 39 39 40 40 @end -
trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilter.mm
r213696 r216809 29 29 #if WK_API_ENABLED 30 30 31 #include "WebCompiledContent Extension.h"31 #include "WebCompiledContentRuleList.h" 32 32 #include <WebCore/ContentExtensionCompiler.h> 33 33 #include <WebCore/ContentExtensionError.h> … … 40 40 - (API::Object&)_apiObject 41 41 { 42 return [_content Extension_apiObject];42 return [_contentRuleList _apiObject]; 43 43 } 44 44 … … 47 47 @implementation _WKUserContentFilter (WKPrivate) 48 48 49 - (id)_initWithWKContent Extension:(WKContentExtension*)contentExtension49 - (id)_initWithWKContentRuleList:(WKContentRuleList*)contentRuleList 50 50 { 51 51 self = [super init]; … … 53 53 return nil; 54 54 55 _content Extension = contentExtension;55 _contentRuleList = contentRuleList; 56 56 57 57 return self; -
trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilterInternal.h
r213696 r216809 28 28 #if WK_API_ENABLED 29 29 30 #import "APIContent Extension.h"30 #import "APIContentRuleList.h" 31 31 #import "WKObject.h" 32 32 33 @class WKContent Extension;33 @class WKContentRuleList; 34 34 35 35 @interface _WKUserContentFilter () <WKObject> { 36 36 @package 37 RetainPtr<WKContent Extension> _contentExtension;37 RetainPtr<WKContentRuleList> _contentRuleList; 38 38 } 39 39 @end -
trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h
r213696 r216809 28 28 #if WK_API_ENABLED 29 29 30 @class WKUserContent Extension;30 @class WKUserContentRuleList; 31 31 32 32 @interface _WKUserContentFilter (WKPrivate) 33 33 34 - (id)_initWithWKContent Extension:(WKContentExtension*)contentExtension;34 - (id)_initWithWKContentRuleList:(WKContentRuleList*)contentRuleList; 35 35 36 36 @end -
trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp
r216348 r216809 41 41 42 42 #if ENABLE(CONTENT_EXTENSIONS) 43 #include "APIContent Extension.h"44 #include "WebCompiledContent Extension.h"43 #include "APIContentRuleList.h" 44 #include "WebCompiledContentRuleList.h" 45 45 #endif 46 46 … … 93 93 94 94 #if ENABLE(CONTENT_EXTENSIONS) 95 ASSERT(parameters.content Extensions.isEmpty());96 for (const auto& content Extension : m_contentExtensions.values())97 parameters.content Extensions.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())); 98 98 #endif 99 99 } … … 333 333 334 334 #if ENABLE(CONTENT_EXTENSIONS) 335 void WebUserContentControllerProxy::addContent Extension(API::ContentExtension& contentExtension)336 { 337 m_content Extensions.set(contentExtension.name(), &contentExtension);338 339 auto pair = std::make_pair(content Extension.name(), contentExtension.compiledExtension().data());340 341 for (WebProcessProxy* process : m_processes) 342 process->send(Messages::WebUserContentController::AddContent Extensions({ pair }), m_identifier);343 } 344 345 void WebUserContentControllerProxy::removeContent Extension(const String& name)346 { 347 m_content Extensions.remove(name);348 349 for (WebProcessProxy* process : m_processes) 350 process->send(Messages::WebUserContentController::RemoveContent Extension(name), m_identifier);351 } 352 353 void WebUserContentControllerProxy::removeAllContent Extensions()354 { 355 m_content Extensions.clear();356 357 for (WebProcessProxy* process : m_processes) 358 process->send(Messages::WebUserContentController::RemoveAllContent Extensions(), m_identifier);335 void 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 345 void 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 353 void WebUserContentControllerProxy::removeAllContentRuleLists() 354 { 355 m_contentRuleLists.clear(); 356 357 for (WebProcessProxy* process : m_processes) 358 process->send(Messages::WebUserContentController::RemoveAllContentRuleLists(), m_identifier); 359 359 } 360 360 #endif -
trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.h
r215212 r216809 38 38 namespace API { 39 39 class Array; 40 class Content Extension;40 class ContentRuleList; 41 41 class UserContentWorld; 42 42 class UserScript; … … 93 93 94 94 #if ENABLE(CONTENT_EXTENSIONS) 95 void addContent Extension(API::ContentExtension&);96 void removeContent Extension(const String&);97 void removeAllContent Extensions();95 void addContentRuleList(API::ContentRuleList&); 96 void removeContentRuleList(const String&); 97 void removeAllContentRuleLists(); 98 98 #endif 99 99 … … 117 117 118 118 #if ENABLE(CONTENT_EXTENSIONS) 119 HashMap<String, RefPtr<API::Content Extension>> m_contentExtensions;119 HashMap<String, RefPtr<API::ContentRuleList>> m_contentRuleLists; 120 120 #endif 121 121 }; -
trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp
r216473 r216809 28 28 29 29 #include "APIArray.h" 30 #include "APIContent Extension.h"30 #include "APIContentRuleList.h" 31 31 #include "APIUserScript.h" 32 32 #include "APIUserStyleSheet.h" 33 #include "WebCompiledContent Extension.h"33 #include "WebCompiledContentRuleList.h" 34 34 #include "WebPageProxy.h" 35 35 #include "WebPreferences.h" -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r216690 r216809 1169 1169 5CBC9B8D1C65279C00A8FDCF /* NetworkDataTaskCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CBC9B8B1C65257300A8FDCF /* NetworkDataTaskCocoa.mm */; }; 1170 1170 5CBC9B8E1C652CA000A8FDCF /* NetworkDataTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CBC9B891C6524A500A8FDCF /* NetworkDataTask.h */; }; 1171 5CD286511E7235990094FDC8 /* WKContent ExtensionStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD2864D1E722F440094FDC8 /* WKContentExtensionStore.h */; settings = {ATTRIBUTES = (Public, ); }; };1172 5CD286521E7235A60094FDC8 /* WKContent Extension.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 */; }; 1173 1173 5CD286531E7235AA0094FDC8 /* _WKUserContentFilterPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD286491E722F440094FDC8 /* _WKUserContentFilterPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1174 5CD286541E7235B10094FDC8 /* WKContent Extension.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD2864A1E722F440094FDC8 /* WKContentExtension.h */; settings = {ATTRIBUTES = (Public, ); }; };1175 5CD286551E7235B80094FDC8 /* WKContent ExtensionInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD2864C1E722F440094FDC8 /* WKContentExtensionInternal.h */; };1176 5CD286561E7235C60094FDC8 /* WKContent ExtensionStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CD2864E1E722F440094FDC8 /* WKContentExtensionStore.mm */; };1177 5CD286571E7235C90094FDC8 /* WKContent ExtensionStoreInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD2864F1E722F440094FDC8 /* WKContentExtensionStoreInternal.h */; };1178 5CD286581E7235D10094FDC8 /* WKContent ExtensionStorePrivate.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, ); }; }; 1179 1179 5CE85B201C88E64B0070BFCE /* PingLoad.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CE85B1F1C88E6430070BFCE /* PingLoad.h */; }; 1180 1180 5CFECB041E1ED1CC00F88504 /* LegacyCustomProtocolManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CFECB031E1ED1C800F88504 /* LegacyCustomProtocolManager.cpp */; }; … … 1234 1234 7C361D79192803BD0036A59D /* WebUserContentControllerProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C361D77192803BD0036A59D /* WebUserContentControllerProxyMessages.h */; }; 1235 1235 7C387434172F5615001BD88A /* PageBanner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C387433172F5615001BD88A /* PageBanner.cpp */; }; 1236 7C3A06A71AAB903E009D74BA /* APIContent ExtensionStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3A06A51AAB903E009D74BA /* APIContentExtensionStore.cpp */; };1237 7C3A06A81AAB903E009D74BA /* APIContent ExtensionStore.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 */; }; 1238 1238 7C3F8C90173AF52D007B7F39 /* PluginInformation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3F8C8E173AF52D007B7F39 /* PluginInformation.cpp */; }; 1239 1239 7C3F8C91173AF52D007B7F39 /* PluginInformation.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3F8C8F173AF52D007B7F39 /* PluginInformation.h */; }; … … 1243 1243 7C4694D01A51E36800AD5845 /* WebPasteboardProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4694CD1A51E36800AD5845 /* WebPasteboardProxy.cpp */; }; 1244 1244 7C4694D11A51E36800AD5845 /* WebPasteboardProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C4694CE1A51E36800AD5845 /* WebPasteboardProxy.h */; }; 1245 7C4ABED01AA8E9F00088AA37 /* WebCompiledContent Extension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4ABECE1AA8E9F00088AA37 /* WebCompiledContentExtension.cpp */; };1246 7C4ABED11AA8E9F00088AA37 /* WebCompiledContent Extension.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C4ABECF1AA8E9F00088AA37 /* WebCompiledContentExtension.h */; };1247 7C4ABED41AA8FCB80088AA37 /* WebCompiledContent ExtensionData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4ABED21AA8FCB80088AA37 /* WebCompiledContentExtensionData.cpp */; };1248 7C4ABED51AA8FCB80088AA37 /* WebCompiledContent ExtensionData.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 */; }; 1249 1249 7C6D37FC172F555F009D2847 /* PageBannerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C6D37FA172F555F009D2847 /* PageBannerMac.mm */; }; 1250 1250 7C6E70FB18B2DC7A00F24E2E /* WebProcessCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C6E70F918B2D4A000F24E2E /* WebProcessCocoa.mm */; }; … … 1268 1268 7C89D2A41A678875003A5FDE /* WKUserScriptRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C89D2A21A678875003A5FDE /* WKUserScriptRef.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1269 1269 7C89D2A61A6789EA003A5FDE /* APIUserScript.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89D2A51A6789EA003A5FDE /* APIUserScript.cpp */; }; 1270 7C89D2B31A6B068C003A5FDE /* APIContent Extension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89D2B11A6B068C003A5FDE /* APIContentExtension.cpp */; };1271 7C89D2B41A6B068C003A5FDE /* APIContent Extension.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 */; }; 1272 1272 7C89D2B61A6B0DD9003A5FDE /* WKUserContentControllerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C89D2B51A6B0DD9003A5FDE /* WKUserContentControllerPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1273 1273 7C89D2B91A6B0F2C003A5FDE /* _WKUserContentFilter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C89D2B71A6B0F2C003A5FDE /* _WKUserContentFilter.mm */; }; … … 1314 1314 7CE4D2271A4916C200C7F152 /* WebProcessPoolMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE4D2251A4916C200C7F152 /* WebProcessPoolMessageReceiver.cpp */; }; 1315 1315 7CE4D2281A4916C200C7F152 /* WebProcessPoolMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE4D2261A4916C200C7F152 /* WebProcessPoolMessages.h */; }; 1316 7CEFA9621AC0999300B910FD /* API UserContentExtensionStoreCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7CEFA9601AC0999300B910FD /* APIUserContentExtensionStoreCocoa.mm */; };1316 7CEFA9621AC0999300B910FD /* APIContentRuleListStoreCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7CEFA9601AC0999300B910FD /* APIContentRuleListStoreCocoa.mm */; }; 1317 1317 7CF47FF617275B71008ACB91 /* WKBundlePageBanner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CF47FF417275B71008ACB91 /* WKBundlePageBanner.cpp */; }; 1318 1318 7CF47FF717275B71008ACB91 /* WKBundlePageBanner.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CF47FF517275B71008ACB91 /* WKBundlePageBanner.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 3445 3445 5CBC9B8B1C65257300A8FDCF /* NetworkDataTaskCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = NetworkDataTaskCocoa.mm; path = NetworkProcess/cocoa/NetworkDataTaskCocoa.mm; sourceTree = "<group>"; }; 3446 3446 5CD286491E722F440094FDC8 /* _WKUserContentFilterPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKUserContentFilterPrivate.h; sourceTree = "<group>"; }; 3447 5CD2864A1E722F440094FDC8 /* WKContent Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentExtension.h; sourceTree = "<group>"; };3448 5CD2864B1E722F440094FDC8 /* WKContent Extension.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKContentExtension.mm; sourceTree = "<group>"; };3449 5CD2864C1E722F440094FDC8 /* WKContent ExtensionInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentExtensionInternal.h; sourceTree = "<group>"; };3450 5CD2864D1E722F440094FDC8 /* WKContent ExtensionStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentExtensionStore.h; sourceTree = "<group>"; };3451 5CD2864E1E722F440094FDC8 /* WKContent ExtensionStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKContentExtensionStore.mm; sourceTree = "<group>"; };3452 5CD2864F1E722F440094FDC8 /* WKContent ExtensionStoreInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentExtensionStoreInternal.h; sourceTree = "<group>"; };3453 5CD286501E722F440094FDC8 /* WKContent ExtensionStorePrivate.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>"; }; 3454 3454 5CE85B1F1C88E6430070BFCE /* PingLoad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PingLoad.h; path = NetworkProcess/PingLoad.h; sourceTree = "<group>"; }; 3455 3455 5CFECB031E1ED1C800F88504 /* LegacyCustomProtocolManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LegacyCustomProtocolManager.cpp; path = NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp; sourceTree = "<group>"; }; … … 3520 3520 7C361D77192803BD0036A59D /* WebUserContentControllerProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebUserContentControllerProxyMessages.h; sourceTree = "<group>"; }; 3521 3521 7C387433172F5615001BD88A /* PageBanner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageBanner.cpp; sourceTree = "<group>"; }; 3522 7C3A06A51AAB903E009D74BA /* APIContent ExtensionStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIContentExtensionStore.cpp; sourceTree = "<group>"; };3523 7C3A06A61AAB903E009D74BA /* APIContent ExtensionStore.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>"; }; 3524 3524 7C3F8C8E173AF52D007B7F39 /* PluginInformation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginInformation.cpp; sourceTree = "<group>"; }; 3525 3525 7C3F8C8F173AF52D007B7F39 /* PluginInformation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginInformation.h; sourceTree = "<group>"; }; … … 3530 3530 7C4694CE1A51E36800AD5845 /* WebPasteboardProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPasteboardProxy.h; sourceTree = "<group>"; }; 3531 3531 7C4694CF1A51E36800AD5845 /* WebPasteboardProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebPasteboardProxy.messages.in; sourceTree = "<group>"; }; 3532 7C4ABECE1AA8E9F00088AA37 /* WebCompiledContent Extension.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCompiledContentExtension.cpp; sourceTree = "<group>"; };3533 7C4ABECF1AA8E9F00088AA37 /* WebCompiledContent Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCompiledContentExtension.h; sourceTree = "<group>"; };3534 7C4ABED21AA8FCB80088AA37 /* WebCompiledContent ExtensionData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCompiledContentExtensionData.cpp; sourceTree = "<group>"; };3535 7C4ABED31AA8FCB80088AA37 /* WebCompiledContent ExtensionData.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>"; }; 3536 3536 7C4ED3261A3119D90079BD49 /* InjectedBundleCSSStyleDeclarationHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleCSSStyleDeclarationHandle.cpp; sourceTree = "<group>"; }; 3537 3537 7C4ED3271A3119D90079BD49 /* InjectedBundleCSSStyleDeclarationHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleCSSStyleDeclarationHandle.h; sourceTree = "<group>"; }; … … 3557 3557 7C89D2A21A678875003A5FDE /* WKUserScriptRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserScriptRef.h; sourceTree = "<group>"; }; 3558 3558 7C89D2A51A6789EA003A5FDE /* APIUserScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIUserScript.cpp; sourceTree = "<group>"; }; 3559 7C89D2B11A6B068C003A5FDE /* APIContent Extension.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIContentExtension.cpp; sourceTree = "<group>"; };3560 7C89D2B21A6B068C003A5FDE /* APIContent Extension.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>"; }; 3561 3561 7C89D2B51A6B0DD9003A5FDE /* WKUserContentControllerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserContentControllerPrivate.h; sourceTree = "<group>"; }; 3562 3562 7C89D2B71A6B0F2C003A5FDE /* _WKUserContentFilter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKUserContentFilter.mm; sourceTree = "<group>"; }; … … 3605 3605 7CE4D2251A4916C200C7F152 /* WebProcessPoolMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebProcessPoolMessageReceiver.cpp; sourceTree = "<group>"; }; 3606 3606 7CE4D2261A4916C200C7F152 /* WebProcessPoolMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcessPoolMessages.h; sourceTree = "<group>"; }; 3607 7CEFA9601AC0999300B910FD /* API UserContentExtensionStoreCocoa.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>"; }; 3608 3608 7CF47FF417275B71008ACB91 /* WKBundlePageBanner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundlePageBanner.cpp; sourceTree = "<group>"; }; 3609 3609 7CF47FF517275B71008ACB91 /* WKBundlePageBanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundlePageBanner.h; sourceTree = "<group>"; }; … … 4969 4969 518D2CAC12D5153B003BB93B /* WebBackForwardListItem.h */, 4970 4970 BCF50726124329AA005955AE /* WebCertificateInfo.h */, 4971 7C4ABECE1AA8E9F00088AA37 /* WebCompiledContent Extension.cpp */,4972 7C4ABECF1AA8E9F00088AA37 /* WebCompiledContent Extension.h */,4973 7C4ABED21AA8FCB80088AA37 /* WebCompiledContent ExtensionData.cpp */,4974 7C4ABED31AA8FCB80088AA37 /* WebCompiledContent ExtensionData.h */,4971 7C4ABECE1AA8E9F00088AA37 /* WebCompiledContentRuleList.cpp */, 4972 7C4ABECF1AA8E9F00088AA37 /* WebCompiledContentRuleList.h */, 4973 7C4ABED21AA8FCB80088AA37 /* WebCompiledContentRuleListData.cpp */, 4974 7C4ABED31AA8FCB80088AA37 /* WebCompiledContentRuleListData.h */, 4975 4975 BC4A628B147312BE006C681A /* WebConnection.cpp */, 4976 4976 BC4A628C147312BE006C681A /* WebConnection.h */, … … 5619 5619 5CB2378D1DF0E0C200117AA3 /* _WKWebsitePoliciesInternal.h */, 5620 5620 FED3C1DA1B447AE800E0EB7F /* APISerializedScriptValueCocoa.mm */, 5621 7CEFA9601AC0999300B910FD /* API UserContentExtensionStoreCocoa.mm */,5621 7CEFA9601AC0999300B910FD /* APIContentRuleListStoreCocoa.mm */, 5622 5622 1A3635AB1A3145E500ED6197 /* APIWebsiteDataStoreCocoa.mm */, 5623 5623 1AFDE64319510B5500C48FFA /* LegacyBundleForClass.mm */, … … 5630 5630 2DFF7B6E1DA4CFAF00814614 /* WKBackForwardListItemPrivate.h */, 5631 5631 1A9F28101958F478008CAC72 /* WKBackForwardListPrivate.h */, 5632 5CD2864A1E722F440094FDC8 /* WKContent Extension.h */,5633 5CD2864B1E722F440094FDC8 /* WKContent Extension.mm */,5634 5CD2864C1E722F440094FDC8 /* WKContent ExtensionInternal.h */,5635 5CD2864D1E722F440094FDC8 /* WKContent ExtensionStore.h */,5636 5CD2864E1E722F440094FDC8 /* WKContent ExtensionStore.mm */,5637 5CD2864F1E722F440094FDC8 /* WKContent ExtensionStoreInternal.h */,5638 5CD286501E722F440094FDC8 /* WKContent ExtensionStorePrivate.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 */, 5639 5639 1AF4592D19464B2000F9D4A2 /* WKError.h */, 5640 5640 1AF4592C19464B2000F9D4A2 /* WKError.mm */, … … 6854 6854 99C81D5B1C20E817005C4C82 /* APIAutomationClient.h */, 6855 6855 990D28B31C6526D400986977 /* APIAutomationSessionClient.h */, 6856 7C89D2B11A6B068C003A5FDE /* APIContent Extension.cpp */,6857 7C89D2B21A6B068C003A5FDE /* APIContent Extension.h */,6858 7C3A06A51AAB903E009D74BA /* APIContent ExtensionStore.cpp */,6859 7C3A06A61AAB903E009D74BA /* APIContent ExtensionStore.h */,6856 7C89D2B11A6B068C003A5FDE /* APIContentRuleList.cpp */, 6857 7C89D2B21A6B068C003A5FDE /* APIContentRuleList.h */, 6858 7C3A06A51AAB903E009D74BA /* APIContentRuleListStore.cpp */, 6859 7C3A06A61AAB903E009D74BA /* APIContentRuleListStore.h */, 6860 6860 076E884D1A13CADF005E90FC /* APIContextMenuClient.h */, 6861 6861 7A821F4F1E2F7A5C00604577 /* APICustomProtocolManagerClient.h */, … … 8192 8192 990D28C01C6553F100986977 /* APIAutomationSessionClient.h in Headers */, 8193 8193 1A3DD206125E5A2F004515E6 /* APIClient.h in Headers */, 8194 7C89D2B41A6B068C003A5FDE /* APIContent Extension.h in Headers */,8195 7C3A06A81AAB903E009D74BA /* APIContent ExtensionStore.h in Headers */,8194 7C89D2B41A6B068C003A5FDE /* APIContentRuleList.h in Headers */, 8195 7C3A06A81AAB903E009D74BA /* APIContentRuleListStore.h in Headers */, 8196 8196 076E884E1A13CADF005E90FC /* APIContextMenuClient.h in Headers */, 8197 8197 7A821F501E2F7A7500604577 /* APICustomProtocolManagerClient.h in Headers */, … … 8614 8614 3F87B9C0158940D80090FF62 /* WebColorPicker.h in Headers */, 8615 8615 728E86F11795188C0087879E /* WebColorPickerMac.h in Headers */, 8616 7C4ABED11AA8E9F00088AA37 /* WebCompiledContent Extension.h in Headers */,8617 7C4ABED51AA8FCB80088AA37 /* WebCompiledContent ExtensionData.h in Headers */,8616 7C4ABED11AA8E9F00088AA37 /* WebCompiledContentRuleList.h in Headers */, 8617 7C4ABED51AA8FCB80088AA37 /* WebCompiledContentRuleListData.h in Headers */, 8618 8618 BC4A6290147312BE006C681A /* WebConnection.h in Headers */, 8619 8619 BC4A6292147312BE006C681A /* WebConnectionClient.h in Headers */, … … 8860 8860 BC5C75C814954DA600BC4775 /* WKConnectionInternal.h in Headers */, 8861 8861 BC4A6297147313A0006C681A /* WKConnectionRef.h in Headers */, 8862 5CD286541E7235B10094FDC8 /* WKContent Extension.h in Headers */,8863 5CD286551E7235B80094FDC8 /* WKContent ExtensionInternal.h in Headers */,8864 5CD286511E7235990094FDC8 /* WKContent ExtensionStore.h in Headers */,8865 5CD286571E7235C90094FDC8 /* WKContent ExtensionStoreInternal.h in Headers */,8866 5CD286581E7235D10094FDC8 /* WKContent ExtensionStorePrivate.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 */, 8867 8867 0FCB4E4C18BBE044000FCFC9 /* WKContentView.h in Headers */, 8868 8868 0FCB4E6C18BBF26A000FCFC9 /* WKContentViewInteraction.h in Headers */, … … 9756 9756 A7D792D61767CB6E00881CBE /* ActivityAssertion.cpp in Sources */, 9757 9757 BC64696F11DBE603006455B0 /* APIArray.cpp in Sources */, 9758 7C89D2B31A6B068C003A5FDE /* APIContent Extension.cpp in Sources */,9759 7C3A06A71AAB903E009D74BA /* APIContent ExtensionStore.cpp in Sources */,9758 7C89D2B31A6B068C003A5FDE /* APIContentRuleList.cpp in Sources */, 9759 7C3A06A71AAB903E009D74BA /* APIContentRuleListStore.cpp in Sources */, 9760 9760 1AAB037C185F99D800EDF501 /* APIData.cpp in Sources */, 9761 9761 1A1EF1991A1D5B420023200A /* APIDataCocoa.mm in Sources */, … … 9784 9784 BC90A1D3122DD55E00CC8C50 /* APIURLResponse.cpp in Sources */, 9785 9785 51D1243A1E6E0AAB002B2820 /* APIURLSchemeTask.cpp in Sources */, 9786 7CEFA9621AC0999300B910FD /* API UserContentExtensionStoreCocoa.mm in Sources */,9786 7CEFA9621AC0999300B910FD /* APIContentRuleListStoreCocoa.mm in Sources */, 9787 9787 7C882DFE1C7E99AC006BF731 /* APIUserContentWorld.cpp in Sources */, 9788 9788 7C89D2A61A6789EA003A5FDE /* APIUserScript.cpp in Sources */, … … 10187 10187 F036978815F4BF0500C3A80E /* WebColorPicker.cpp in Sources */, 10188 10188 728E86F21795188C0087879E /* WebColorPickerMac.mm in Sources */, 10189 7C4ABED01AA8E9F00088AA37 /* WebCompiledContent Extension.cpp in Sources */,10190 7C4ABED41AA8FCB80088AA37 /* WebCompiledContent ExtensionData.cpp in Sources */,10189 7C4ABED01AA8E9F00088AA37 /* WebCompiledContentRuleList.cpp in Sources */, 10190 7C4ABED41AA8FCB80088AA37 /* WebCompiledContentRuleListData.cpp in Sources */, 10191 10191 BC4A628F147312BE006C681A /* WebConnection.cpp in Sources */, 10192 10192 BC4A6291147312BE006C681A /* WebConnectionClient.cpp in Sources */, … … 10457 10457 BCA284D61492F2C7001F9042 /* WKConnection.mm in Sources */, 10458 10458 BC4A6296147313A0006C681A /* WKConnectionRef.cpp in Sources */, 10459 5CD286521E7235A60094FDC8 /* WKContent Extension.mm in Sources */,10460 5CD286561E7235C60094FDC8 /* WKContent ExtensionStore.mm in Sources */,10459 5CD286521E7235A60094FDC8 /* WKContentRuleList.mm in Sources */, 10460 5CD286561E7235C60094FDC8 /* WKContentRuleListStore.mm in Sources */, 10461 10461 0FCB4E4D18BBE044000FCFC9 /* WKContentView.mm in Sources */, 10462 10462 0FCB4E6D18BBF26A000FCFC9 /* WKContentViewInteraction.mm in Sources */, -
trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp
r215831 r216809 30 30 #include "FrameInfoData.h" 31 31 #include "InjectedBundleScriptWorld.h" 32 #include "WebCompiledContent Extension.h"32 #include "WebCompiledContentRuleList.h" 33 33 #include "WebFrame.h" 34 34 #include "WebPage.h" … … 340 340 341 341 #if ENABLE(CONTENT_EXTENSIONS) 342 void WebUserContentController::addContent Extensions(const Vector<std::pair<String, WebCompiledContentExtensionData>>& contentExtensions)343 { 344 for (const auto& content Extension : contentExtensions) {345 WebCompiledContent ExtensionData contentExtensionData = contentExtension.second;346 RefPtr<WebCompiledContent Extension> compiledContentExtension = WebCompiledContentExtension::create(WTFMove(contentExtensionData));347 348 m_contentExtensionBackend.addContentExtension(content Extension.first, WTFMove(compiledContentExtension));349 } 350 } 351 352 void WebUserContentController::removeContent Extension(const String& name)342 void 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 352 void WebUserContentController::removeContentRuleList(const String& name) 353 353 { 354 354 m_contentExtensionBackend.removeContentExtension(name); 355 355 } 356 356 357 void WebUserContentController::removeAllContent Extensions()357 void WebUserContentController::removeAllContentRuleLists() 358 358 { 359 359 m_contentExtensionBackend.removeAllContentExtensions(); -
trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.h
r215831 r216809 45 45 46 46 class InjectedBundleScriptWorld; 47 class WebCompiledContent ExtensionData;47 class WebCompiledContentRuleListData; 48 48 class WebUserMessageHandlerDescriptorProxy; 49 49 … … 68 68 void addUserScriptMessageHandlers(const Vector<WebScriptMessageHandlerData>&); 69 69 #if ENABLE(CONTENT_EXTENSIONS) 70 void addContent Extensions(const Vector<std::pair<String, WebCompiledContentExtensionData>>&);70 void addContentRuleLists(const Vector<std::pair<String, WebCompiledContentRuleListData>>&); 71 71 #endif 72 72 … … 99 99 100 100 #if ENABLE(CONTENT_EXTENSIONS) 101 void removeContent Extension(const String& name);102 void removeAllContent Extensions();101 void removeContentRuleList(const String& name); 102 void removeAllContentRuleLists(); 103 103 #endif 104 104 -
trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.messages.in
r213696 r216809 41 41 42 42 #if ENABLE(CONTENT_EXTENSIONS) 43 AddContent Extensions(Vector<std::pair<String, WebKit::WebCompiledContentExtensionData>> contentFilters);44 RemoveContent Extension(String name);45 RemoveAllContent Extensions();43 AddContentRuleLists(Vector<std::pair<String, WebKit::WebCompiledContentRuleListData>> contentFilters); 44 RemoveContentRuleList(String name); 45 RemoveAllContentRuleLists(); 46 46 #endif 47 47 } -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r216696 r216809 569 569 m_userContentController->addUserScriptMessageHandlers(parameters.messageHandlers); 570 570 #if ENABLE(CONTENT_EXTENSIONS) 571 m_userContentController->addContent Extensions(parameters.contentExtensions);571 m_userContentController->addContentRuleLists(parameters.contentRuleLists); 572 572 #endif 573 573 } -
trunk/Tools/ChangeLog
r216808 r216809 1 2017-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 1 16 2017-05-12 Keith Miller <keith_miller@apple.com> 2 17 -
trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKContentExtensionStore.mm
r215807 r216809 31 31 #import "PlatformUtilities.h" 32 32 #import "Test.h" 33 #import <WebKit/WKContent Extension.h>34 #import <WebKit/WKContent ExtensionStorePrivate.h>33 #import <WebKit/WKContentRuleList.h> 34 #import <WebKit/WKContentRuleListStorePrivate.h> 35 35 #import <wtf/RetainPtr.h> 36 36 37 class WKContent ExtensionStoreTest : public testing::Test {37 class WKContentRuleListStoreTest : public testing::Test { 38 38 public: 39 39 virtual void SetUp() 40 40 { 41 [[WKContent ExtensionStore defaultStore] _removeAllContentExtensions];41 [[WKContentRuleListStore defaultStore] _removeAllContentRuleLists]; 42 42 } 43 43 }; … … 45 45 static NSString *basicFilter = @"[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\".*webkit.org\"}}]"; 46 46 47 TEST_F(WKContent ExtensionStoreTest, Compile)48 { 49 __block bool doneCompiling = false; 50 [[WKContent ExtensionStore defaultStore] compileContentExtensionForIdentifier:@"TestExtension" encodedContentExtension:basicFilter completionHandler:^(WKContentExtension*filter, NSError *error) {47 TEST_F(WKContentRuleListStoreTest, Compile) 48 { 49 __block bool doneCompiling = false; 50 [[WKContentRuleListStore defaultStore] compileContentRuleListForIdentifier:@"TestRuleList" encodedContentRuleList:basicFilter completionHandler:^(WKContentRuleList *filter, NSError *error) { 51 51 52 52 EXPECT_NOT_NULL(filter); … … 65 65 } 66 66 67 TEST_F(WKContent ExtensionStoreTest, InvalidExtension)68 { 69 __block bool doneCompiling = false; 70 [[WKContent ExtensionStore defaultStore] compileContentExtensionForIdentifier:@"TestExtension" encodedContentExtension:invalidFilter completionHandler:^(WKContentExtension*filter, NSError *error) {67 TEST_F(WKContentRuleListStoreTest, InvalidRuleList) 68 { 69 __block bool doneCompiling = false; 70 [[WKContentRuleListStore defaultStore] compileContentRuleListForIdentifier:@"TestRuleList" encodedContentRuleList:invalidFilter completionHandler:^(WKContentRuleList *filter, NSError *error) { 71 71 72 72 EXPECT_NULL(filter); 73 73 EXPECT_NOT_NULL(error); 74 74 checkDomain(error); 75 EXPECT_EQ(error.code, WKErrorContent ExtensionStoreCompileFailed);76 EXPECT_STREQ(" Extensioncompilation 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(WKContent ExtensionStoreTest, Lookup)84 { 85 __block bool doneCompiling = false; 86 [[WKContent ExtensionStore 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 83 TEST_F(WKContentRuleListStoreTest, Lookup) 84 { 85 __block bool doneCompiling = false; 86 [[WKContentRuleListStore defaultStore] compileContentRuleListForIdentifier:@"TestRuleList" encodedContentRuleList:basicFilter completionHandler:^(WKContentRuleList *filter, NSError *error) { 87 87 88 88 EXPECT_NOT_NULL(filter); … … 94 94 95 95 __block bool doneLookingUp = false; 96 [[WKContent ExtensionStore defaultStore] lookUpContentExtensionForIdentifier:@"TestExtension" completionHandler:^(WKContentExtension*filter, NSError *error) {97 98 EXPECT_STREQ(filter.identifier.UTF8String, "Test Extension");96 [[WKContentRuleListStore defaultStore] lookUpContentRuleListForIdentifier:@"TestRuleList" completionHandler:^(WKContentRuleList *filter, NSError *error) { 97 98 EXPECT_STREQ(filter.identifier.UTF8String, "TestRuleList"); 99 99 EXPECT_NOT_NULL(filter); 100 100 EXPECT_NULL(error); … … 105 105 } 106 106 107 TEST_F(WKContent ExtensionStoreTest, EncodedIdentifier)107 TEST_F(WKContentRuleListStoreTest, EncodedIdentifier) 108 108 { 109 109 // FIXME: U+00C4 causes problems here. Using the output of encodeForFileName with … … 111 111 NSString *identifier = @":;%25%+25И😍"; 112 112 __block bool done = false; 113 [[WKContent ExtensionStore defaultStore] compileContentExtensionForIdentifier:identifier encodedContentExtension:basicFilter completionHandler:^(WKContentExtension*filter, NSError *error) {113 [[WKContentRuleListStore defaultStore] compileContentRuleListForIdentifier:identifier encodedContentRuleList:basicFilter completionHandler:^(WKContentRuleList *filter, NSError *error) { 114 114 115 115 EXPECT_STREQ(filter.identifier.UTF8String, identifier.UTF8String); 116 116 117 [[WKContent ExtensionStore defaultStore] getAvailableContentExtensionIdentifiers:^(NSArray<NSString *> *identifiers) {117 [[WKContentRuleListStore defaultStore] getAvailableContentRuleListIdentifiers:^(NSArray<NSString *> *identifiers) { 118 118 EXPECT_EQ(identifiers.count, 1u); 119 119 EXPECT_EQ(identifiers[0].length, identifier.length); … … 126 126 } 127 127 128 TEST_F(WKContent ExtensionStoreTest, NonExistingIdentifierLookup)128 TEST_F(WKContentRuleListStoreTest, NonExistingIdentifierLookup) 129 129 { 130 130 __block bool doneLookingUp = false; 131 [[WKContent ExtensionStore defaultStore] lookUpContentExtensionForIdentifier:@"DoesNotExist" completionHandler:^(WKContentExtension*filter, NSError *error) {131 [[WKContentRuleListStore defaultStore] lookUpContentRuleListForIdentifier:@"DoesNotExist" completionHandler:^(WKContentRuleList *filter, NSError *error) { 132 132 133 133 EXPECT_NULL(filter); 134 134 EXPECT_NOT_NULL(error); 135 135 checkDomain(error); 136 EXPECT_EQ(error.code, WKErrorContent ExtensionStoreLookUpFailed);137 EXPECT_STREQ(" Extensionlookup 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]); 138 138 139 139 doneLookingUp = true; … … 142 142 } 143 143 144 TEST_F(WKContent ExtensionStoreTest, VersionMismatch)145 { 146 __block bool doneCompiling = false; 147 [[WKContent ExtensionStore defaultStore] compileContentExtensionForIdentifier:@"TestExtension" encodedContentExtension:basicFilter completionHandler:^(WKContentExtension*filter, NSError *error)144 TEST_F(WKContentRuleListStoreTest, VersionMismatch) 145 { 146 __block bool doneCompiling = false; 147 [[WKContentRuleListStore defaultStore] compileContentRuleListForIdentifier:@"TestRuleList" encodedContentRuleList:basicFilter completionHandler:^(WKContentRuleList *filter, NSError *error) 148 148 { 149 149 … … 155 155 TestWebKitAPI::Util::run(&doneCompiling); 156 156 157 [[WKContent ExtensionStore defaultStore] _invalidateContentExtensionVersionForIdentifier:@"TestExtension"];157 [[WKContentRuleListStore defaultStore] _invalidateContentRuleListVersionForIdentifier:@"TestRuleList"]; 158 158 159 159 __block bool doneLookingUp = false; 160 [[WKContent ExtensionStore defaultStore] lookUpContentExtensionForIdentifier:@"TestExtension" completionHandler:^(WKContentExtension*filter, NSError *error)160 [[WKContentRuleListStore defaultStore] lookUpContentRuleListForIdentifier:@"TestRuleList" completionHandler:^(WKContentRuleList *filter, NSError *error) 161 161 { 162 162 … … 164 164 EXPECT_NOT_NULL(error); 165 165 checkDomain(error); 166 EXPECT_EQ(error.code, WKErrorContent ExtensionStoreVersionMismatch);167 EXPECT_STREQ(" Extensionlookup 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]); 168 168 169 169 doneLookingUp = true; … … 172 172 173 173 __block bool doneGettingSource = false; 174 [[WKContent ExtensionStore defaultStore] _getContentExtensionSourceForIdentifier:@"TestExtension" completionHandler:^(NSString* source) {174 [[WKContentRuleListStore defaultStore] _getContentRuleListSourceForIdentifier:@"TestRuleList" completionHandler:^(NSString* source) { 175 175 EXPECT_NULL(source); 176 176 doneGettingSource = true; … … 179 179 } 180 180 181 TEST_F(WKContent ExtensionStoreTest, Removal)182 { 183 __block bool doneCompiling = false; 184 [[WKContent ExtensionStore defaultStore] compileContentExtensionForIdentifier:@"TestExtension" encodedContentExtension:basicFilter completionHandler:^(WKContentExtension*filter, NSError *error) {181 TEST_F(WKContentRuleListStoreTest, Removal) 182 { 183 __block bool doneCompiling = false; 184 [[WKContentRuleListStore defaultStore] compileContentRuleListForIdentifier:@"TestRuleList" encodedContentRuleList:basicFilter completionHandler:^(WKContentRuleList *filter, NSError *error) { 185 185 186 186 EXPECT_NOT_NULL(filter); … … 192 192 193 193 __block bool doneRemoving = false; 194 [[WKContent ExtensionStore defaultStore] removeContentExtensionForIdentifier:@"TestExtension" completionHandler:^(NSError *error) {194 [[WKContentRuleListStore defaultStore] removeContentRuleListForIdentifier:@"TestRuleList" completionHandler:^(NSError *error) { 195 195 EXPECT_NULL(error); 196 196 … … 200 200 } 201 201 202 TEST_F(WKContent ExtensionStoreTest, NonExistingIdentifierRemove)202 TEST_F(WKContentRuleListStoreTest, NonExistingIdentifierRemove) 203 203 { 204 204 __block bool doneRemoving = false; 205 [[WKContent ExtensionStore defaultStore] removeContentExtensionForIdentifier:@"DoesNotExist" completionHandler:^(NSError *error) {205 [[WKContentRuleListStore defaultStore] removeContentRuleListForIdentifier:@"DoesNotExist" completionHandler:^(NSError *error) { 206 206 EXPECT_NOT_NULL(error); 207 207 checkDomain(error); 208 EXPECT_EQ(error.code, WKErrorContent ExtensionStoreRemoveFailed);209 EXPECT_STREQ(" Extensionremoval 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]); 210 210 211 211 doneRemoving = true; … … 214 214 } 215 215 216 TEST_F(WKContent ExtensionStoreTest, NonDefaultStore)217 { 218 NSURL *tempDir = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"Content ExtensionTest"] isDirectory:YES];219 WKContent ExtensionStore *store = [WKContentExtensionStore storeWithURL:tempDir];220 NSString *identifier = @"Test Extension";221 NSString *fileName = @"Content Extension-TestExtension";216 TEST_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"; 222 222 223 223 __block bool doneGettingAvailableIdentifiers = false; 224 [store getAvailableContent ExtensionIdentifiers:^(NSArray<NSString *> *identifiers) {224 [store getAvailableContentRuleListIdentifiers:^(NSArray<NSString *> *identifiers) { 225 225 EXPECT_NOT_NULL(identifiers); 226 226 EXPECT_EQ(identifiers.count, 0u); … … 230 230 231 231 __block bool doneCompiling = false; 232 [store compileContent ExtensionForIdentifier:identifier encodedContentExtension:basicFilter completionHandler:^(WKContentExtension*filter, NSError *error) {232 [store compileContentRuleListForIdentifier:identifier encodedContentRuleList:basicFilter completionHandler:^(WKContentRuleList *filter, NSError *error) { 233 233 EXPECT_NOT_NULL(filter); 234 234 EXPECT_NULL(error); … … 238 238 239 239 doneGettingAvailableIdentifiers = false; 240 [store getAvailableContent ExtensionIdentifiers:^(NSArray<NSString *> *identifiers) {240 [store getAvailableContentRuleListIdentifiers:^(NSArray<NSString *> *identifiers) { 241 241 EXPECT_NOT_NULL(identifiers); 242 242 EXPECT_EQ(identifiers.count, 1u); 243 EXPECT_STREQ(identifiers[0].UTF8String, "Test Extension");243 EXPECT_STREQ(identifiers[0].UTF8String, "TestRuleList"); 244 244 doneGettingAvailableIdentifiers = true; 245 245 }]; … … 251 251 252 252 __block bool doneCheckingSource = false; 253 [store _getContent ExtensionSourceForIdentifier:identifier completionHandler:^(NSString *source) {253 [store _getContentRuleListSourceForIdentifier:identifier completionHandler:^(NSString *source) { 254 254 EXPECT_NOT_NULL(source); 255 255 EXPECT_STREQ(basicFilter.UTF8String, source.UTF8String); … … 259 259 260 260 __block bool doneRemoving = false; 261 [store removeContent ExtensionForIdentifier:identifier completionHandler:^(NSError *error) {261 [store removeContentRuleListForIdentifier:identifier completionHandler:^(NSError *error) { 262 262 EXPECT_NULL(error); 263 263 doneRemoving = true; … … 269 269 } 270 270 271 TEST_F(WKContent ExtensionStoreTest, MultipleExtensions)271 TEST_F(WKContentRuleListStoreTest, MultipleRuleLists) 272 272 { 273 273 __block bool done = false; 274 [[WKContent ExtensionStore defaultStore] compileContentExtensionForIdentifier:@"FirstExtension" encodedContentExtension:basicFilter completionHandler:^(WKContentExtension*filter, NSError *error) {275 EXPECT_NOT_NULL(filter); 276 EXPECT_NULL(error); 277 [[WKContent ExtensionStore 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) { 278 278 EXPECT_NOT_NULL(filter); 279 279 EXPECT_NULL(error); 280 [[WKContent ExtensionStore defaultStore] getAvailableContentExtensionIdentifiers:^(NSArray<NSString *> *identifiers) {280 [[WKContentRuleListStore defaultStore] getAvailableContentRuleListIdentifiers:^(NSArray<NSString *> *identifiers) { 281 281 EXPECT_NOT_NULL(identifiers); 282 282 EXPECT_EQ(identifiers.count, 2u); 283 EXPECT_STREQ(identifiers[0].UTF8String, "First Extension");284 EXPECT_STREQ(identifiers[1].UTF8String, "Second Extension");283 EXPECT_STREQ(identifiers[0].UTF8String, "FirstRuleList"); 284 EXPECT_STREQ(identifiers[1].UTF8String, "SecondRuleList"); 285 285 done = true; 286 286 }]; … … 290 290 } 291 291 292 TEST_F(WKContent ExtensionStoreTest, NonASCIISource)292 TEST_F(WKContentRuleListStoreTest, NonASCIISource) 293 293 { 294 294 static NSString *nonASCIIFilter = @"[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\".*webkit.org\"}, \"unused\":\"💩\"}]"; 295 NSURL *tempDir = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"Content ExtensionTest"] isDirectory:YES];296 WKContent ExtensionStore *store = [WKContentExtensionStore storeWithURL:tempDir];297 NSString *identifier = @"Test Extension";298 NSString *fileName = @"Content Extension-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"; 299 299 300 300 __block bool done = false; 301 [store compileContent ExtensionForIdentifier:identifier encodedContentExtension:nonASCIIFilter completionHandler:^(WKContentExtension*filter, NSError *error) {302 EXPECT_NOT_NULL(filter); 303 EXPECT_NULL(error); 304 305 [store _getContent ExtensionSourceForIdentifier: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) { 306 306 EXPECT_NOT_NULL(source); 307 307 EXPECT_STREQ(nonASCIIFilter.UTF8String, source.UTF8String); 308 308 309 [store _removeAllContent Extensions];309 [store _removeAllContentRuleLists]; 310 310 NSData *dataAfterRemoving = [NSData dataWithContentsOfURL:[tempDir URLByAppendingPathComponent:fileName]]; 311 311 EXPECT_NULL(dataAfterRemoving); … … 320 320 static bool receivedAlert { false }; 321 321 322 @interface Content ExtensionDelegate : NSObject <WKUIDelegate>322 @interface ContentRuleListDelegate : NSObject <WKUIDelegate> 323 323 @end 324 324 325 @implementation Content ExtensionDelegate325 @implementation ContentRuleListDelegate 326 326 327 327 - (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler … … 333 333 break; 334 334 case 1: 335 // After having removed the content extension.335 // After having removed the content RuleList. 336 336 EXPECT_STREQ("content blockers disabled", message.UTF8String); 337 337 break; … … 345 345 @end 346 346 347 TEST_F(WKContent ExtensionStoreTest, AddRemove)348 { 349 [[WKContent ExtensionStore defaultStore] _removeAllContentExtensions];347 TEST_F(WKContentRuleListStoreTest, AddRemove) 348 { 349 [[WKContentRuleListStore defaultStore] _removeAllContentRuleLists]; 350 350 351 351 __block bool doneCompiling = false; 352 352 NSString* contentBlocker = @"[{\"action\":{\"type\":\"css-display-none\",\"selector\":\".hidden\"},\"trigger\":{\"url-filter\":\".*\"}}]"; 353 __block RetainPtr<WKContent Extension> extension;354 [[WKContent ExtensionStore 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) { 355 355 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); 361 361 362 362 auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); 363 [[configuration userContentController] addContent Extension:extension.get()];363 [[configuration userContentController] addContentRuleList:ruleList.get()]; 364 364 365 365 auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]); 366 366 367 auto delegate = adoptNS([[Content ExtensionDelegate alloc] init]);367 auto delegate = adoptNS([[ContentRuleListDelegate alloc] init]); 368 368 [webView setUIDelegate:delegate.get()]; 369 369 … … 374 374 TestWebKitAPI::Util::run(&receivedAlert); 375 375 376 [[configuration userContentController] removeContent Extension:extension.get()];376 [[configuration userContentController] removeContentRuleList:ruleList.get()]; 377 377 378 378 receivedAlert = false; -
trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/_WKUserContentExtensionStore.mm
r201457 r216809 73 73 checkDomain(error); 74 74 EXPECT_EQ(error.code, _WKUserContentExtensionStoreErrorCompileFailed); 75 EXPECT_STREQ(" Extensioncompilation 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]); 76 76 77 77 doneCompiling = true; … … 112 112 checkDomain(error); 113 113 EXPECT_EQ(error.code, _WKUserContentExtensionStoreErrorLookupFailed); 114 EXPECT_STREQ(" Extensionlookup failed: Unspecified error during lookup.", [[error helpAnchor] UTF8String]);114 EXPECT_STREQ("Rule list lookup failed: Unspecified error during lookup.", [[error helpAnchor] UTF8String]); 115 115 116 116 doneLookingUp = true; … … 142 142 checkDomain(error); 143 143 EXPECT_EQ(error.code, _WKUserContentExtensionStoreErrorVersionMismatch); 144 EXPECT_STREQ(" Extensionlookup 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]); 145 145 146 146 doneLookingUp = true; … … 177 177 checkDomain(error); 178 178 EXPECT_EQ(error.code, _WKUserContentExtensionStoreErrorRemoveFailed); 179 EXPECT_STREQ(" Extensionremoval failed: Unspecified error during remove.", [[error helpAnchor] UTF8String]);179 EXPECT_STREQ("Rule list removal failed: Unspecified error during remove.", [[error helpAnchor] UTF8String]); 180 180 181 181 doneRemoving = true;
Note:
See TracChangeset
for help on using the changeset viewer.