<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[213696] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/213696">213696</a></dd>
<dt>Author</dt> <dd>achristensen@apple.com</dd>
<dt>Date</dt> <dd>2017-03-09 17:48:30 -0800 (Thu, 09 Mar 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Expose public APIs for content filters
https://bugs.webkit.org/show_bug.cgi?id=150479

Reviewed by Brady Eidson and Geoff Garen.

Source/WebCore:

* English.lproj/Localizable.strings:

Source/WebKit2:

This takes _WKUserContentExtensionStore and _WKUserContentFilter and turns them into the consistently-named public API
WKContentExtensionStore and WKContentExtension respectively with the same design and functionaly of the original SPI.
We also added public functions to WKUserContentController corresponding to existing private functions.

The old SPI ObjC classes are now just wrappers around the new ObjC classes, which are wrappers around C++ objects in the API namespace.
        
The peak-memory-reducing optimization of having NS_RELEASES_ARGUMENT in _compileContentExtensionForIdentifier is kept for Safari,
but the public API doesn't need such an optimization.  The public compileContentExtensionForIdentifier will not deallocate the input
NSString during compiling.
        
We moved the error codes into the WKErrorDomain, which requires changing the values of the error codes and domain, but source
compiled that uses the SPI before and after should still work.  Using new applications with old frameworks or vice versa will
have unexpected error codes, though.

* Shared/API/APIObject.h:
* Shared/API/c/WKDeprecatedFunctions.cpp:
(WKPageGroupAddUserContentFilter):
(WKPageGroupRemoveUserContentFilter):
* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):
* UIProcess/API/APIContentExtension.cpp: Copied from UIProcess/API/APIUserContentExtension.cpp.
(API::ContentExtension::ContentExtension):
(API::ContentExtension::~ContentExtension):
(API::UserContentExtension::UserContentExtension): Deleted.
(API::UserContentExtension::~UserContentExtension): Deleted.
* UIProcess/API/APIContentExtension.h: Copied from UIProcess/API/APIUserContentExtension.h.
* UIProcess/API/APIContentExtensionStore.cpp: Copied from UIProcess/API/APIUserContentExtensionStore.cpp.
(API::ContentExtensionStore::defaultStore):
(API::ContentExtensionStore::storeWithPath):
(API::ContentExtensionStore::ContentExtensionStore):
(API::ContentExtensionStore::~ContentExtensionStore):
(API::compiledToFile):
(API::createExtension):
(API::ContentExtensionStore::lookupContentExtension):
(API::ContentExtensionStore::compileContentExtension):
(API::ContentExtensionStore::removeContentExtension):
(API::ContentExtensionStore::synchronousRemoveAllContentExtensions):
(API::ContentExtensionStore::invalidateContentExtensionVersion):
(API::contentExtensionStoreErrorCategory):
(API::UserContentExtensionStore::defaultStore): Deleted.
(API::UserContentExtensionStore::storeWithPath): Deleted.
(API::UserContentExtensionStore::UserContentExtensionStore): Deleted.
(API::UserContentExtensionStore::~UserContentExtensionStore): Deleted.
(API::UserContentExtensionStore::lookupContentExtension): Deleted.
(API::UserContentExtensionStore::compileContentExtension): Deleted.
(API::UserContentExtensionStore::removeContentExtension): Deleted.
(API::UserContentExtensionStore::synchronousRemoveAllContentExtensions): Deleted.
(API::UserContentExtensionStore::invalidateContentExtensionVersion): Deleted.
(API::userContentExtensionStoreErrorCategory): Deleted.
* UIProcess/API/APIContentExtensionStore.h: Copied from UIProcess/API/APIUserContentExtensionStore.h.
(API::make_error_code):
* UIProcess/API/APIUserContentExtension.cpp: Removed.
* UIProcess/API/APIUserContentExtension.h: Removed.
* UIProcess/API/APIUserContentExtensionStore.cpp: Removed.
* UIProcess/API/APIUserContentExtensionStore.h: Removed.
* UIProcess/API/C/WKAPICast.h:
* UIProcess/API/C/WKPageGroup.cpp:
* UIProcess/API/C/WKUserContentControllerRef.cpp:
(WKUserContentControllerAddUserContentFilter):
(WKUserContentControllerRemoveAllUserContentFilters):
* UIProcess/API/C/WKUserContentExtensionStoreRef.cpp:
(WKUserContentExtensionStoreGetTypeID):
* UIProcess/API/Cocoa/APIUserContentExtensionStoreCocoa.mm:
(API::ContentExtensionStore::defaultStorePath):
(API::UserContentExtensionStore::defaultStorePath): Deleted.
* UIProcess/API/Cocoa/WKContentExtension.h: Copied from UIProcess/API/Cocoa/_WKUserContentFilter.h.
* UIProcess/API/Cocoa/WKContentExtension.mm: Copied from UIProcess/API/Cocoa/_WKUserContentFilter.mm.
(-[WKContentExtension dealloc]):
(-[WKContentExtension _apiObject]):
(-[_WKUserContentFilter dealloc]): Deleted.
(-[_WKUserContentFilter _apiObject]): Deleted.
* UIProcess/API/Cocoa/WKContentExtensionInternal.h: Copied from UIProcess/API/Cocoa/_WKUserContentFilterInternal.h.
(WebKit::wrapper):
* UIProcess/API/Cocoa/WKContentExtensionStore.h: Copied from UIProcess/API/Cocoa/_WKUserContentExtensionStore.h.
* UIProcess/API/Cocoa/WKContentExtensionStore.mm: Copied from UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm.
(-[WKContentExtensionStore dealloc]):
(+[WKContentExtensionStore defaultStore]):
(+[WKContentExtensionStore storeWithURL:]):
(-[WKContentExtensionStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]):
(-[WKContentExtensionStore _compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:releasesArgument:]):
(-[WKContentExtensionStore lookupContentExtensionForIdentifier:completionHandler:]):
(-[WKContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]):
(-[WKContentExtensionStore _apiObject]):
(-[WKContentExtensionStore _removeAllContentExtensions]):
(-[WKContentExtensionStore _invalidateContentExtensionVersionForIdentifier:]):
(-[WKContentExtensionStore _compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]):
(-[_WKUserContentExtensionStore dealloc]): Deleted.
(+[_WKUserContentExtensionStore defaultStore]): Deleted.
(+[_WKUserContentExtensionStore storeWithURL:]): Deleted.
(-[_WKUserContentExtensionStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]): Deleted.
(-[_WKUserContentExtensionStore lookupContentExtensionForIdentifier:completionHandler:]): Deleted.
(-[_WKUserContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]): Deleted.
(-[_WKUserContentExtensionStore _apiObject]): Deleted.
(-[_WKUserContentExtensionStore _removeAllContentExtensions]): Deleted.
(-[_WKUserContentExtensionStore _invalidateContentExtensionVersionForIdentifier:]): Deleted.
* UIProcess/API/Cocoa/WKContentExtensionStoreInternal.h: Copied from UIProcess/API/Cocoa/_WKUserContentExtensionStoreInternal.h.
(WebKit::wrapper):
* UIProcess/API/Cocoa/WKContentExtensionStorePrivate.h: Copied from UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h.
* UIProcess/API/Cocoa/WKError.h:
* UIProcess/API/Cocoa/WKError.mm:
(localizedDescriptionForErrorCode):
* UIProcess/API/Cocoa/WKUserContentController.h:
* UIProcess/API/Cocoa/WKUserContentController.mm:
(-[WKUserContentController addContentExtension:]):
(-[WKUserContentController removeContentExtension:]):
(-[WKUserContentController removeAllContentExtensions]):
(-[WKUserContentController _addUserContentFilter:]):
(-[WKUserContentController _removeUserContentFilter:]):
(-[WKUserContentController _removeAllUserContentFilters]):
* UIProcess/API/Cocoa/_WKUserContentExtensionStore.h:
* UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm:
(+[_WKUserContentExtensionStore defaultStore]):
(+[_WKUserContentExtensionStore storeWithURL:]):
(-[_WKUserContentExtensionStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]):
(-[_WKUserContentExtensionStore lookupContentExtensionForIdentifier:completionHandler:]):
(-[_WKUserContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]):
(-[_WKUserContentExtensionStore _apiObject]):
(-[_WKUserContentExtensionStore _removeAllContentExtensions]):
(-[_WKUserContentExtensionStore _invalidateContentExtensionVersionForIdentifier:]):
(-[_WKUserContentExtensionStore _initWithWKContentExtensionStore:]):
(-[_WKUserContentExtensionStore dealloc]): Deleted.
* UIProcess/API/Cocoa/_WKUserContentExtensionStoreInternal.h:
(WebKit::wrapper): Deleted.
* UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h:
* UIProcess/API/Cocoa/_WKUserContentFilter.mm:
(-[_WKUserContentFilter _apiObject]):
(-[_WKUserContentFilter _initWithWKContentExtension:]):
(-[_WKUserContentFilter dealloc]): Deleted.
* UIProcess/API/Cocoa/_WKUserContentFilterInternal.h:
(WebKit::wrapper): Deleted.
* UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h: Added.
* UIProcess/UserContent/WebUserContentControllerProxy.cpp:
(WebKit::WebUserContentControllerProxy::addProcess):
(WebKit::WebUserContentControllerProxy::addContentExtension):
(WebKit::WebUserContentControllerProxy::removeContentExtension):
(WebKit::WebUserContentControllerProxy::removeAllContentExtensions):
(WebKit::WebUserContentControllerProxy::addUserContentExtension): Deleted.
(WebKit::WebUserContentControllerProxy::removeUserContentExtension): Deleted.
(WebKit::WebUserContentControllerProxy::removeAllUserContentExtensions): Deleted.
* UIProcess/UserContent/WebUserContentControllerProxy.h:
* UIProcess/WebPageGroup.cpp:
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/UserContent/WebUserContentController.cpp:
(WebKit::WebUserContentController::addContentExtensions):
(WebKit::WebUserContentController::removeContentExtension):
(WebKit::WebUserContentController::removeAllContentExtensions):
(WebKit::WebUserContentController::addUserContentExtensions): Deleted.
(WebKit::WebUserContentController::removeUserContentExtension): Deleted.
(WebKit::WebUserContentController::removeAllUserContentExtensions): Deleted.
* WebProcess/UserContent/WebUserContentController.h:
* WebProcess/UserContent/WebUserContentController.messages.in:
* WebProcess/WebCoreSupport/mac/WebErrorsMac.mm:
(WebKit::blockedByContentFilterError):

Tools:

Keep the existing tests to verify that I made the wrapper classes for the old SPI work correctly.
Add new identical tests for the new API are added with the new names.
We should keep both until we migrate from and remove the old SPI.
Enum error code values and strings have changed, but the API is source compatible.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/WKUserContentExtensionStore.mm: Copied from Tools/TestWebKitAPI/Tests/WebKit2Cocoa/_WKUserContentExtensionStore.mm.
(WKUserContentExtensionStoreTest::SetUp):
(TEST_F):
(checkDomain):
(_WKUserContentExtensionStoreTest::SetUp): Deleted.
* TestWebKitAPI/Tests/WebKit2Cocoa/_WKUserContentExtensionStore.mm:
(checkDomain):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreEnglishlprojLocalizablestrings">trunk/Source/WebCore/English.lproj/Localizable.strings</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsDFABytecodeh">trunk/Source/WebCore/contentextensions/DFABytecode.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedAPIAPIObjecth">trunk/Source/WebKit2/Shared/API/APIObject.h</a></li>
<li><a href="#trunkSourceWebKit2SharedAPIcWKDeprecatedFunctionscpp">trunk/Source/WebKit2/Shared/API/c/WKDeprecatedFunctions.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedCocoaAPIObjectmm">trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKAPICasth">trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKPageGroupcpp">trunk/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKUserContentControllerRefcpp">trunk/Source/WebKit2/UIProcess/API/C/WKUserContentControllerRef.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKUserContentExtensionStoreRefcpp">trunk/Source/WebKit2/UIProcess/API/C/WKUserContentExtensionStoreRef.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaAPIUserContentExtensionStoreCocoamm">trunk/Source/WebKit2/UIProcess/API/Cocoa/APIUserContentExtensionStoreCocoa.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKErrorh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKError.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKErrormm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKError.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKUserContentControllerh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKUserContentControllermm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoa_WKUserContentExtensionStoreh">trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStore.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoa_WKUserContentExtensionStoremm">trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoa_WKUserContentExtensionStoreInternalh">trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStoreInternal.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoa_WKUserContentExtensionStorePrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoa_WKUserContentFiltermm">trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilter.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoa_WKUserContentFilterInternalh">trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilterInternal.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessUserContentWebUserContentControllerProxycpp">trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessUserContentWebUserContentControllerProxyh">trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageGroupcpp">trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2WebProcessUserContentWebUserContentControllercpp">trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessUserContentWebUserContentControllerh">trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessUserContentWebUserContentControllermessagesin">trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.messages.in</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportmacWebErrorsMacmm">trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcessAPIAPIContentExtensioncpp">trunk/Source/WebKit2/UIProcess/API/APIContentExtension.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIAPIContentExtensionh">trunk/Source/WebKit2/UIProcess/API/APIContentExtension.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIAPIContentExtensionStorecpp">trunk/Source/WebKit2/UIProcess/API/APIContentExtensionStore.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIAPIContentExtensionStoreh">trunk/Source/WebKit2/UIProcess/API/APIContentExtensionStore.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKContentExtensionh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtension.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKContentExtensionmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtension.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKContentExtensionInternalh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionInternal.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKContentExtensionStoreh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStore.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKContentExtensionStoremm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStore.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKContentExtensionStoreInternalh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStoreInternal.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKContentExtensionStorePrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStorePrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoa_WKUserContentFilterPrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2CocoaWKUserContentExtensionStoremm">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKUserContentExtensionStore.mm</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcessAPIAPIUserContentExtensioncpp">trunk/Source/WebKit2/UIProcess/API/APIUserContentExtension.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIAPIUserContentExtensionh">trunk/Source/WebKit2/UIProcess/API/APIUserContentExtension.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIAPIUserContentExtensionStorecpp">trunk/Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIAPIUserContentExtensionStoreh">trunk/Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebCore/ChangeLog        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2017-03-09  Brian Nicholson  &lt;bnicholson@mozilla.com&gt; and Alex Christensen  &lt;achristensen@webkit.org&gt;
+
+        Expose public APIs for content filters
+        https://bugs.webkit.org/show_bug.cgi?id=150479
+
+        Reviewed by Brady Eidson and Geoff Garen.
+
+        * English.lproj/Localizable.strings:
+
</ins><span class="cx"> 2017-03-09  Matt Baker  &lt;mattbaker@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Add XHR breakpoints UI
</span></span></pre></div>
<a id="trunkSourceWebCoreEnglishlprojLocalizablestrings"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/English.lproj/Localizable.strings (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/English.lproj/Localizable.strings        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebCore/English.lproj/Localizable.strings        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -172,6 +172,9 @@
</span><span class="cx"> /* Subtitle of the label to show on a snapshotted plug-in */
</span><span class="cx"> &quot;Click to restart&quot; = &quot;Click to restart&quot;;
</span><span class="cx"> 
</span><ins>+/* WKErrorContentExtensionStoreCompileFailed description */
+&quot;Compiling a WKContentExtension failed&quot; = &quot;Compiling a WKContentExtension failed&quot;;
+
</ins><span class="cx"> /* WebKitErrorCannotShowMIMEType description */
</span><span class="cx"> &quot;Content with specified MIME type can’t be shown&quot; = &quot;Content with specified MIME type can’t be shown&quot;;
</span><span class="cx"> 
</span><span class="lines">@@ -358,6 +361,12 @@
</span><span class="cx"> /* Look Up context menu item with selected word */
</span><span class="cx"> &quot;Look Up “&lt;selection&gt;”&quot; = &quot;Look Up “&lt;selection&gt;”&quot;;
</span><span class="cx"> 
</span><ins>+/* WKErrorContentExtensionStoreLookupFailed description */
+&quot;Looking up a WKContentExtension failed&quot; = &quot;Looking up a WKContentExtension failed&quot;;
+
+/* WKErrorContentExtensionStoreVersionMismatch description */
+&quot;Looking up a WKContentExtension found a binary that is incompatible&quot; = &quot;Looking up a WKContentExtension found a binary that is incompatible&quot;;
+
</ins><span class="cx"> /* Media Loop context menu item */
</span><span class="cx"> &quot;Loop&quot; = &quot;Loop&quot;;
</span><span class="cx"> 
</span><span class="lines">@@ -496,6 +505,9 @@
</span><span class="cx"> /* Reload context menu item */
</span><span class="cx"> &quot;Reload&quot; = &quot;Reload&quot;;
</span><span class="cx"> 
</span><ins>+/* WKErrorContentExtensionStoreRemoveFailed description */
+&quot;Removing a WKContentExtension failed&quot; = &quot;Removing a WKContentExtension failed&quot;;
+
</ins><span class="cx"> /* default label for Reset buttons in forms on web pages */
</span><span class="cx"> &quot;Reset&quot; = &quot;Reset&quot;;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsDFABytecodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/contentextensions/DFABytecode.h (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/DFABytecode.h        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebCore/contentextensions/DFABytecode.h        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -33,7 +33,7 @@
</span><span class="cx"> 
</span><span class="cx"> typedef uint8_t DFABytecode;
</span><span class="cx"> 
</span><del>-// Increment UserContentExtensionStore::CurrentContentExtensionFileVersion
</del><ins>+// Increment ContentExtensionStore::CurrentContentExtensionFileVersion
</ins><span class="cx"> // when making any non-backwards-compatible changes to the bytecode.
</span><span class="cx"> // FIXME: Changes here should not require changes in WebKit2.  Move all versioning to WebCore.
</span><span class="cx"> enum class DFABytecodeInstruction : uint8_t {
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/ChangeLog        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -1,3 +1,164 @@
</span><ins>+2017-03-09  Brian Nicholson  &lt;bnicholson@mozilla.com&gt; and Alex Christensen  &lt;achristensen@webkit.org&gt;
+
+        Expose public APIs for content filters
+        https://bugs.webkit.org/show_bug.cgi?id=150479
+
+        Reviewed by Brady Eidson and Geoff Garen.
+
+        This takes _WKUserContentExtensionStore and _WKUserContentFilter and turns them into the consistently-named public API
+        WKContentExtensionStore and WKContentExtension respectively with the same design and functionaly of the original SPI.
+        We also added public functions to WKUserContentController corresponding to existing private functions.
+
+        The old SPI ObjC classes are now just wrappers around the new ObjC classes, which are wrappers around C++ objects in the API namespace.
+        
+        The peak-memory-reducing optimization of having NS_RELEASES_ARGUMENT in _compileContentExtensionForIdentifier is kept for Safari,
+        but the public API doesn't need such an optimization.  The public compileContentExtensionForIdentifier will not deallocate the input
+        NSString during compiling.
+        
+        We moved the error codes into the WKErrorDomain, which requires changing the values of the error codes and domain, but source
+        compiled that uses the SPI before and after should still work.  Using new applications with old frameworks or vice versa will
+        have unexpected error codes, though.
+
+        * Shared/API/APIObject.h:
+        * Shared/API/c/WKDeprecatedFunctions.cpp:
+        (WKPageGroupAddUserContentFilter):
+        (WKPageGroupRemoveUserContentFilter):
+        * Shared/Cocoa/APIObject.mm:
+        (API::Object::newObject):
+        * UIProcess/API/APIContentExtension.cpp: Copied from UIProcess/API/APIUserContentExtension.cpp.
+        (API::ContentExtension::ContentExtension):
+        (API::ContentExtension::~ContentExtension):
+        (API::UserContentExtension::UserContentExtension): Deleted.
+        (API::UserContentExtension::~UserContentExtension): Deleted.
+        * UIProcess/API/APIContentExtension.h: Copied from UIProcess/API/APIUserContentExtension.h.
+        * UIProcess/API/APIContentExtensionStore.cpp: Copied from UIProcess/API/APIUserContentExtensionStore.cpp.
+        (API::ContentExtensionStore::defaultStore):
+        (API::ContentExtensionStore::storeWithPath):
+        (API::ContentExtensionStore::ContentExtensionStore):
+        (API::ContentExtensionStore::~ContentExtensionStore):
+        (API::compiledToFile):
+        (API::createExtension):
+        (API::ContentExtensionStore::lookupContentExtension):
+        (API::ContentExtensionStore::compileContentExtension):
+        (API::ContentExtensionStore::removeContentExtension):
+        (API::ContentExtensionStore::synchronousRemoveAllContentExtensions):
+        (API::ContentExtensionStore::invalidateContentExtensionVersion):
+        (API::contentExtensionStoreErrorCategory):
+        (API::UserContentExtensionStore::defaultStore): Deleted.
+        (API::UserContentExtensionStore::storeWithPath): Deleted.
+        (API::UserContentExtensionStore::UserContentExtensionStore): Deleted.
+        (API::UserContentExtensionStore::~UserContentExtensionStore): Deleted.
+        (API::UserContentExtensionStore::lookupContentExtension): Deleted.
+        (API::UserContentExtensionStore::compileContentExtension): Deleted.
+        (API::UserContentExtensionStore::removeContentExtension): Deleted.
+        (API::UserContentExtensionStore::synchronousRemoveAllContentExtensions): Deleted.
+        (API::UserContentExtensionStore::invalidateContentExtensionVersion): Deleted.
+        (API::userContentExtensionStoreErrorCategory): Deleted.
+        * UIProcess/API/APIContentExtensionStore.h: Copied from UIProcess/API/APIUserContentExtensionStore.h.
+        (API::make_error_code):
+        * UIProcess/API/APIUserContentExtension.cpp: Removed.
+        * UIProcess/API/APIUserContentExtension.h: Removed.
+        * UIProcess/API/APIUserContentExtensionStore.cpp: Removed.
+        * UIProcess/API/APIUserContentExtensionStore.h: Removed.
+        * UIProcess/API/C/WKAPICast.h:
+        * UIProcess/API/C/WKPageGroup.cpp:
+        * UIProcess/API/C/WKUserContentControllerRef.cpp:
+        (WKUserContentControllerAddUserContentFilter):
+        (WKUserContentControllerRemoveAllUserContentFilters):
+        * UIProcess/API/C/WKUserContentExtensionStoreRef.cpp:
+        (WKUserContentExtensionStoreGetTypeID):
+        * UIProcess/API/Cocoa/APIUserContentExtensionStoreCocoa.mm:
+        (API::ContentExtensionStore::defaultStorePath):
+        (API::UserContentExtensionStore::defaultStorePath): Deleted.
+        * UIProcess/API/Cocoa/WKContentExtension.h: Copied from UIProcess/API/Cocoa/_WKUserContentFilter.h.
+        * UIProcess/API/Cocoa/WKContentExtension.mm: Copied from UIProcess/API/Cocoa/_WKUserContentFilter.mm.
+        (-[WKContentExtension dealloc]):
+        (-[WKContentExtension _apiObject]):
+        (-[_WKUserContentFilter dealloc]): Deleted.
+        (-[_WKUserContentFilter _apiObject]): Deleted.
+        * UIProcess/API/Cocoa/WKContentExtensionInternal.h: Copied from UIProcess/API/Cocoa/_WKUserContentFilterInternal.h.
+        (WebKit::wrapper):
+        * UIProcess/API/Cocoa/WKContentExtensionStore.h: Copied from UIProcess/API/Cocoa/_WKUserContentExtensionStore.h.
+        * UIProcess/API/Cocoa/WKContentExtensionStore.mm: Copied from UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm.
+        (-[WKContentExtensionStore dealloc]):
+        (+[WKContentExtensionStore defaultStore]):
+        (+[WKContentExtensionStore storeWithURL:]):
+        (-[WKContentExtensionStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]):
+        (-[WKContentExtensionStore _compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:releasesArgument:]):
+        (-[WKContentExtensionStore lookupContentExtensionForIdentifier:completionHandler:]):
+        (-[WKContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]):
+        (-[WKContentExtensionStore _apiObject]):
+        (-[WKContentExtensionStore _removeAllContentExtensions]):
+        (-[WKContentExtensionStore _invalidateContentExtensionVersionForIdentifier:]):
+        (-[WKContentExtensionStore _compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]):
+        (-[_WKUserContentExtensionStore dealloc]): Deleted.
+        (+[_WKUserContentExtensionStore defaultStore]): Deleted.
+        (+[_WKUserContentExtensionStore storeWithURL:]): Deleted.
+        (-[_WKUserContentExtensionStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]): Deleted.
+        (-[_WKUserContentExtensionStore lookupContentExtensionForIdentifier:completionHandler:]): Deleted.
+        (-[_WKUserContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]): Deleted.
+        (-[_WKUserContentExtensionStore _apiObject]): Deleted.
+        (-[_WKUserContentExtensionStore _removeAllContentExtensions]): Deleted.
+        (-[_WKUserContentExtensionStore _invalidateContentExtensionVersionForIdentifier:]): Deleted.
+        * UIProcess/API/Cocoa/WKContentExtensionStoreInternal.h: Copied from UIProcess/API/Cocoa/_WKUserContentExtensionStoreInternal.h.
+        (WebKit::wrapper):
+        * UIProcess/API/Cocoa/WKContentExtensionStorePrivate.h: Copied from UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h.
+        * UIProcess/API/Cocoa/WKError.h:
+        * UIProcess/API/Cocoa/WKError.mm:
+        (localizedDescriptionForErrorCode):
+        * UIProcess/API/Cocoa/WKUserContentController.h:
+        * UIProcess/API/Cocoa/WKUserContentController.mm:
+        (-[WKUserContentController addContentExtension:]):
+        (-[WKUserContentController removeContentExtension:]):
+        (-[WKUserContentController removeAllContentExtensions]):
+        (-[WKUserContentController _addUserContentFilter:]):
+        (-[WKUserContentController _removeUserContentFilter:]):
+        (-[WKUserContentController _removeAllUserContentFilters]):
+        * UIProcess/API/Cocoa/_WKUserContentExtensionStore.h:
+        * UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm:
+        (+[_WKUserContentExtensionStore defaultStore]):
+        (+[_WKUserContentExtensionStore storeWithURL:]):
+        (-[_WKUserContentExtensionStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]):
+        (-[_WKUserContentExtensionStore lookupContentExtensionForIdentifier:completionHandler:]):
+        (-[_WKUserContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]):
+        (-[_WKUserContentExtensionStore _apiObject]):
+        (-[_WKUserContentExtensionStore _removeAllContentExtensions]):
+        (-[_WKUserContentExtensionStore _invalidateContentExtensionVersionForIdentifier:]):
+        (-[_WKUserContentExtensionStore _initWithWKContentExtensionStore:]):
+        (-[_WKUserContentExtensionStore dealloc]): Deleted.
+        * UIProcess/API/Cocoa/_WKUserContentExtensionStoreInternal.h:
+        (WebKit::wrapper): Deleted.
+        * UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h:
+        * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
+        (-[_WKUserContentFilter _apiObject]):
+        (-[_WKUserContentFilter _initWithWKContentExtension:]):
+        (-[_WKUserContentFilter dealloc]): Deleted.
+        * UIProcess/API/Cocoa/_WKUserContentFilterInternal.h:
+        (WebKit::wrapper): Deleted.
+        * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h: Added.
+        * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
+        (WebKit::WebUserContentControllerProxy::addProcess):
+        (WebKit::WebUserContentControllerProxy::addContentExtension):
+        (WebKit::WebUserContentControllerProxy::removeContentExtension):
+        (WebKit::WebUserContentControllerProxy::removeAllContentExtensions):
+        (WebKit::WebUserContentControllerProxy::addUserContentExtension): Deleted.
+        (WebKit::WebUserContentControllerProxy::removeUserContentExtension): Deleted.
+        (WebKit::WebUserContentControllerProxy::removeAllUserContentExtensions): Deleted.
+        * UIProcess/UserContent/WebUserContentControllerProxy.h:
+        * UIProcess/WebPageGroup.cpp:
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/UserContent/WebUserContentController.cpp:
+        (WebKit::WebUserContentController::addContentExtensions):
+        (WebKit::WebUserContentController::removeContentExtension):
+        (WebKit::WebUserContentController::removeAllContentExtensions):
+        (WebKit::WebUserContentController::addUserContentExtensions): Deleted.
+        (WebKit::WebUserContentController::removeUserContentExtension): Deleted.
+        (WebKit::WebUserContentController::removeAllUserContentExtensions): Deleted.
+        * WebProcess/UserContent/WebUserContentController.h:
+        * WebProcess/UserContent/WebUserContentController.messages.in:
+        * WebProcess/WebCoreSupport/mac/WebErrorsMac.mm:
+        (WebKit::blockedByContentFilterError):
+
</ins><span class="cx"> 2017-03-09  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix some debug builds after r213686
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedAPIAPIObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/API/APIObject.h (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/API/APIObject.h        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/Shared/API/APIObject.h        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -103,6 +103,8 @@
</span><span class="cx">         BackForwardListItem,
</span><span class="cx">         CacheManager,
</span><span class="cx">         ColorPickerResultListener,
</span><ins>+        ContentExtension,
+        ContentExtensionStore,
</ins><span class="cx">         ContextMenuListener,
</span><span class="cx">         CookieManager,
</span><span class="cx">         Download,
</span><span class="lines">@@ -146,8 +148,6 @@
</span><span class="cx">         TextChecker,
</span><span class="cx">         URLSchemeHandlerTask,
</span><span class="cx">         UserContentController,
</span><del>-        UserContentExtension,
-        UserContentExtensionStore,
</del><span class="cx">         UserContentWorld,
</span><span class="cx">         UserInitiatedAction,
</span><span class="cx">         UserMediaPermissionCheck,
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedAPIcWKDeprecatedFunctionscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/API/c/WKDeprecatedFunctions.cpp (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/API/c/WKDeprecatedFunctions.cpp        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/Shared/API/c/WKDeprecatedFunctions.cpp        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -25,8 +25,8 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;APIContentExtension.h&quot;
</ins><span class="cx"> #include &quot;APIDictionary.h&quot;
</span><del>-#include &quot;APIUserContentExtension.h&quot;
</del><span class="cx"> #include &quot;WKArray.h&quot;
</span><span class="cx"> #include &quot;WKContextPrivate.h&quot;
</span><span class="cx"> #include &quot;WKMutableDictionary.h&quot;
</span><span class="lines">@@ -56,22 +56,22 @@
</span><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WKPageGroupAddUserContentFilter(WKPageGroupRef pageGroupRef, WKUserContentFilterRef userContentFilterRef)
</del><ins>+void WKPageGroupAddUserContentFilter(WKPageGroupRef pageGroupRef, WKUserContentFilterRef contentFilterRef)
</ins><span class="cx"> {
</span><span class="cx"> #if ENABLE(CONTENT_EXTENSIONS)
</span><del>-    toImpl(pageGroupRef)-&gt;userContentController().addUserContentExtension(*toImpl(userContentFilterRef));
</del><ins>+    toImpl(pageGroupRef)-&gt;userContentController().addContentExtension(*toImpl(contentFilterRef));
</ins><span class="cx"> #else
</span><span class="cx">     UNUSED_PARAM(pageGroupRef);
</span><del>-    UNUSED_PARAM(userContentFilterRef);
</del><ins>+    UNUSED_PARAM(contentFilterRef);
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WKPageGroupRemoveUserContentFilter(WKPageGroupRef pageGroupRef, WKStringRef userContentFilterNameRef)
</del><ins>+void WKPageGroupRemoveUserContentFilter(WKPageGroupRef pageGroupRef, WKStringRef contentFilterNameRef)
</ins><span class="cx"> {
</span><span class="cx"> #if ENABLE(CONTENT_EXTENSIONS)
</span><del>-    toImpl(pageGroupRef)-&gt;userContentController().removeUserContentExtension(toWTFString(userContentFilterNameRef));
</del><ins>+    toImpl(pageGroupRef)-&gt;userContentController().removeContentExtension(toWTFString(contentFilterNameRef));
</ins><span class="cx"> #else
</span><span class="cx">     UNUSED_PARAM(pageGroupRef);
</span><del>-    UNUSED_PARAM(userContentFilterNameRef);
</del><ins>+    UNUSED_PARAM(contentFilterNameRef);
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedCocoaAPIObjectmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -33,6 +33,8 @@
</span><span class="cx"> #import &quot;WKBrowsingContextControllerInternal.h&quot;
</span><span class="cx"> #import &quot;WKBrowsingContextGroupInternal.h&quot;
</span><span class="cx"> #import &quot;WKConnectionInternal.h&quot;
</span><ins>+#import &quot;WKContentExtensionInternal.h&quot;
+#import &quot;WKContentExtensionStoreInternal.h&quot;
</ins><span class="cx"> #import &quot;WKFrameInfoInternal.h&quot;
</span><span class="cx"> #import &quot;WKNSArray.h&quot;
</span><span class="cx"> #import &quot;WKNSData.h&quot;
</span><span class="lines">@@ -71,8 +73,6 @@
</span><span class="cx"> #import &quot;_WKFrameHandleInternal.h&quot;
</span><span class="cx"> #import &quot;_WKHitTestResultInternal.h&quot;
</span><span class="cx"> #import &quot;_WKProcessPoolConfigurationInternal.h&quot;
</span><del>-#import &quot;_WKUserContentExtensionStoreInternal.h&quot;
-#import &quot;_WKUserContentFilterInternal.h&quot;
</del><span class="cx"> #import &quot;_WKUserContentWorldInternal.h&quot;
</span><span class="cx"> #import &quot;_WKUserInitiatedActionInternal.h&quot;
</span><span class="cx"> #import &quot;_WKUserStyleSheetInternal.h&quot;
</span><span class="lines">@@ -234,12 +234,12 @@
</span><span class="cx">         wrapper = [WKUserContentController alloc];
</span><span class="cx">         break;
</span><span class="cx"> 
</span><del>-    case Type::UserContentExtension:
-        wrapper = [_WKUserContentFilter alloc];
</del><ins>+    case Type::ContentExtension:
+        wrapper = [WKContentExtension alloc];
</ins><span class="cx">         break;
</span><span class="cx"> 
</span><del>-    case Type::UserContentExtensionStore:
-        wrapper = [_WKUserContentExtensionStore alloc];
</del><ins>+    case Type::ContentExtensionStore:
+        wrapper = [WKContentExtensionStore alloc];
</ins><span class="cx">         break;
</span><span class="cx"> 
</span><span class="cx">     case Type::UserContentWorld:
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIAPIContentExtensioncppfromrev213687trunkSourceWebKit2UIProcessAPIAPIUserContentExtensioncpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/API/APIContentExtension.cpp (from rev 213687, trunk/Source/WebKit2/UIProcess/API/APIUserContentExtension.cpp) (0 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/APIContentExtension.cpp                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/APIContentExtension.cpp        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;APIContentExtension.h&quot;
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+#include &quot;WebCompiledContentExtension.h&quot;
+
+namespace API {
+
+ContentExtension::ContentExtension(const WTF::String&amp; name, Ref&lt;WebKit::WebCompiledContentExtension&gt;&amp;&amp; contentExtension)
+    : m_name(name)
+    , m_compiledExtension(WTFMove(contentExtension))
+{
+}
+
+ContentExtension::~ContentExtension()
+{
+}
+
+} // namespace API
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIAPIContentExtensionhfromrev213687trunkSourceWebKit2UIProcessAPIAPIUserContentExtensionh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/API/APIContentExtension.h (from rev 213687, trunk/Source/WebKit2/UIProcess/API/APIUserContentExtension.h) (0 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/APIContentExtension.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/APIContentExtension.h        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -0,0 +1,57 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include &quot;APIObject.h&quot;
+#include &lt;wtf/text/WTFString.h&gt;
+
+namespace WebKit {
+class WebCompiledContentExtension;
+}
+
+namespace API {
+
+class ContentExtension final : public ObjectImpl&lt;Object::Type::ContentExtension&gt; {
+public:
+#if ENABLE(CONTENT_EXTENSIONS)
+    static Ref&lt;ContentExtension&gt; create(const WTF::String&amp; name, Ref&lt;WebKit::WebCompiledContentExtension&gt;&amp;&amp; contentExtension)
+    {
+        return adoptRef(*new ContentExtension(name, WTFMove(contentExtension)));
+    }
+
+    ContentExtension(const WTF::String&amp; name, Ref&lt;WebKit::WebCompiledContentExtension&gt;&amp;&amp;);
+    virtual ~ContentExtension();
+
+    const WTF::String&amp; name() const { return m_name; }
+    const WebKit::WebCompiledContentExtension&amp; compiledExtension() const { return m_compiledExtension.get(); }
+
+private:
+    WTF::String m_name;
+    Ref&lt;WebKit::WebCompiledContentExtension&gt; m_compiledExtension;
+#endif // ENABLE(CONTENT_EXTENSIONS)
+};
+
+} // namespace API
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIAPIContentExtensionStorecppfromrev213687trunkSourceWebKit2UIProcessAPIAPIUserContentExtensionStorecpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/API/APIContentExtensionStore.cpp (from rev 213687, trunk/Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp) (0 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/APIContentExtensionStore.cpp                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/APIContentExtensionStore.cpp        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -0,0 +1,436 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;APIContentExtensionStore.h&quot;
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+#include &quot;APIContentExtension.h&quot;
+#include &quot;NetworkCacheData.h&quot;
+#include &quot;NetworkCacheFileSystem.h&quot;
+#include &quot;SharedMemory.h&quot;
+#include &quot;WebCompiledContentExtension.h&quot;
+#include &lt;WebCore/ContentExtensionCompiler.h&gt;
+#include &lt;WebCore/ContentExtensionError.h&gt;
+#include &lt;string&gt;
+#include &lt;wtf/NeverDestroyed.h&gt;
+#include &lt;wtf/RunLoop.h&gt;
+#include &lt;wtf/WorkQueue.h&gt;
+#include &lt;wtf/persistence/Decoder.h&gt;
+#include &lt;wtf/persistence/Encoder.h&gt;
+
+using namespace WebKit::NetworkCache;
+
+namespace API {
+
+ContentExtensionStore&amp; ContentExtensionStore::defaultStore()
+{
+    static ContentExtensionStore* defaultStore = adoptRef(new ContentExtensionStore).leakRef();
+    return *defaultStore;
+}
+
+Ref&lt;ContentExtensionStore&gt; ContentExtensionStore::storeWithPath(const WTF::String&amp; storePath)
+{
+    return adoptRef(*new ContentExtensionStore(storePath));
+}
+
+ContentExtensionStore::ContentExtensionStore()
+    : ContentExtensionStore(defaultStorePath())
+{
+}
+
+ContentExtensionStore::ContentExtensionStore(const WTF::String&amp; storePath)
+    : m_storePath(storePath)
+    , m_compileQueue(WorkQueue::create(&quot;ContentExtensionStore Compile Queue&quot;, WorkQueue::Type::Concurrent))
+    , m_readQueue(WorkQueue::create(&quot;ContentExtensionStore Read Queue&quot;))
+    , m_removeQueue(WorkQueue::create(&quot;ContentExtensionStore Remove Queue&quot;))
+{
+}
+
+ContentExtensionStore::~ContentExtensionStore()
+{
+}
+
+static String constructedPath(const String&amp; base, const String&amp; identifier)
+{
+    return WebCore::pathByAppendingComponent(base, &quot;ContentExtension-&quot; + WebCore::encodeForFileName(identifier));
+}
+
+// The size and offset of the densely packed bytes in the file, not sizeof and offsetof, which would
+// represent the size and offset of the structure in memory, possibly with compiler-added padding.
+const size_t ContentExtensionFileHeaderSize = 2 * sizeof(uint32_t) + 4 * sizeof(uint64_t);
+const size_t ConditionsApplyOnlyToDomainOffset = sizeof(uint32_t) + 4 * sizeof(uint64_t);
+
+struct ContentExtensionMetaData {
+    uint32_t version { ContentExtensionStore::CurrentContentExtensionFileVersion };
+    uint64_t actionsSize { 0 };
+    uint64_t filtersWithoutConditionsBytecodeSize { 0 };
+    uint64_t filtersWithConditionsBytecodeSize { 0 };
+    uint64_t conditionedFiltersBytecodeSize { 0 };
+    uint32_t conditionsApplyOnlyToDomain { false };
+    
+    size_t fileSize() const
+    {
+        return ContentExtensionFileHeaderSize
+            + actionsSize
+            + filtersWithoutConditionsBytecodeSize
+            + filtersWithConditionsBytecodeSize
+            + conditionedFiltersBytecodeSize;
+    }
+};
+
+static Data encodeContentExtensionMetaData(const ContentExtensionMetaData&amp; metaData)
+{
+    WTF::Persistence::Encoder encoder;
+
+    encoder &lt;&lt; metaData.version;
+    encoder &lt;&lt; metaData.actionsSize;
+    encoder &lt;&lt; metaData.filtersWithoutConditionsBytecodeSize;
+    encoder &lt;&lt; metaData.filtersWithConditionsBytecodeSize;
+    encoder &lt;&lt; metaData.conditionedFiltersBytecodeSize;
+    encoder &lt;&lt; metaData.conditionsApplyOnlyToDomain;
+
+    ASSERT(encoder.bufferSize() == ContentExtensionFileHeaderSize);
+    return Data(encoder.buffer(), encoder.bufferSize());
+}
+
+static bool decodeContentExtensionMetaData(ContentExtensionMetaData&amp; metaData, const Data&amp; fileData)
+{
+    bool success = false;
+    fileData.apply([&amp;metaData, &amp;success, &amp;fileData](const uint8_t* data, size_t size) {
+        // The file data should be mapped into one continuous memory segment so the size
+        // passed to the applier should always equal the data size.
+        if (size != fileData.size())
+            return false;
+
+        WTF::Persistence::Decoder decoder(data, size);
+        if (!decoder.decode(metaData.version))
+            return false;
+        if (!decoder.decode(metaData.actionsSize))
+            return false;
+        if (!decoder.decode(metaData.filtersWithoutConditionsBytecodeSize))
+            return false;
+        if (!decoder.decode(metaData.filtersWithConditionsBytecodeSize))
+            return false;
+        if (!decoder.decode(metaData.conditionedFiltersBytecodeSize))
+            return false;
+        if (!decoder.decode(metaData.conditionsApplyOnlyToDomain))
+            return false;
+        success = true;
+        return false;
+    });
+    return success;
+}
+
+static bool openAndMapContentExtension(const String&amp; path, ContentExtensionMetaData&amp; metaData, Data&amp; fileData)
+{
+    fileData = mapFile(WebCore::fileSystemRepresentation(path).data());
+    if (fileData.isNull())
+        return false;
+
+    if (!decodeContentExtensionMetaData(metaData, fileData))
+        return false;
+
+    return true;
+}
+
+static bool writeDataToFile(const Data&amp; fileData, WebCore::PlatformFileHandle fd)
+{
+    bool success = true;
+    fileData.apply([fd, &amp;success](const uint8_t* data, size_t size) {
+        if (WebCore::writeToFile(fd, (const char*)data, size) == -1) {
+            success = false;
+            return false;
+        }
+        return true;
+    });
+    
+    return success;
+}
+
+static std::error_code compiledToFile(String&amp;&amp; json, const String&amp; finalFilePath, ContentExtensionMetaData&amp; metaData, Data&amp; mappedData)
+{
+    using namespace WebCore::ContentExtensions;
+
+    class CompilationClient final : public ContentExtensionCompilationClient {
+    public:
+        CompilationClient(WebCore::PlatformFileHandle fileHandle, ContentExtensionMetaData&amp; metaData)
+            : m_fileHandle(fileHandle)
+            , m_metaData(metaData)
+        {
+            ASSERT(!metaData.actionsSize);
+            ASSERT(!metaData.filtersWithoutConditionsBytecodeSize);
+            ASSERT(!metaData.filtersWithConditionsBytecodeSize);
+            ASSERT(!metaData.conditionedFiltersBytecodeSize);
+            ASSERT(!metaData.conditionsApplyOnlyToDomain);
+        }
+        
+        void writeFiltersWithoutConditionsBytecode(Vector&lt;DFABytecode&gt;&amp;&amp; bytecode) final
+        {
+            ASSERT(!m_filtersWithConditionBytecodeWritten);
+            ASSERT(!m_conditionFiltersBytecodeWritten);
+            m_filtersWithoutConditionsBytecodeWritten += bytecode.size();
+            writeToFile(Data(bytecode.data(), bytecode.size()));
+        }
+        
+        void writeFiltersWithConditionsBytecode(Vector&lt;DFABytecode&gt;&amp;&amp; bytecode) final
+        {
+            ASSERT(!m_conditionFiltersBytecodeWritten);
+            m_filtersWithConditionBytecodeWritten += bytecode.size();
+            writeToFile(Data(bytecode.data(), bytecode.size()));
+        }
+        
+        void writeTopURLFiltersBytecode(Vector&lt;DFABytecode&gt;&amp;&amp; bytecode) final
+        {
+            m_conditionFiltersBytecodeWritten += bytecode.size();
+            writeToFile(Data(bytecode.data(), bytecode.size()));
+        }
+
+        void writeActions(Vector&lt;SerializedActionByte&gt;&amp;&amp; actions, bool conditionsApplyOnlyToDomain) final
+        {
+            ASSERT(!m_filtersWithoutConditionsBytecodeWritten);
+            ASSERT(!m_filtersWithConditionBytecodeWritten);
+            ASSERT(!m_conditionFiltersBytecodeWritten);
+            ASSERT(!m_actionsWritten);
+            m_actionsWritten += actions.size();
+            m_conditionsApplyOnlyToDomain = conditionsApplyOnlyToDomain;
+            writeToFile(Data(actions.data(), actions.size()));
+        }
+        
+        void finalize() final
+        {
+            m_metaData.actionsSize = m_actionsWritten;
+            m_metaData.filtersWithoutConditionsBytecodeSize = m_filtersWithoutConditionsBytecodeWritten;
+            m_metaData.filtersWithConditionsBytecodeSize = m_filtersWithConditionBytecodeWritten;
+            m_metaData.conditionedFiltersBytecodeSize = m_conditionFiltersBytecodeWritten;
+            m_metaData.conditionsApplyOnlyToDomain = m_conditionsApplyOnlyToDomain;
+            
+            Data header = encodeContentExtensionMetaData(m_metaData);
+            if (!m_fileError &amp;&amp; WebCore::seekFile(m_fileHandle, 0ll, WebCore::FileSeekOrigin::SeekFromBeginning) == -1) {
+                WebCore::closeFile(m_fileHandle);
+                m_fileError = true;
+            }
+            writeToFile(header);
+        }
+        
+        bool hadErrorWhileWritingToFile() { return m_fileError; }
+
+    private:
+        void writeToFile(const Data&amp; data)
+        {
+            if (!m_fileError &amp;&amp; !writeDataToFile(data, m_fileHandle)) {
+                WebCore::closeFile(m_fileHandle);
+                m_fileError = true;
+            }
+        }
+        
+        WebCore::PlatformFileHandle m_fileHandle;
+        ContentExtensionMetaData&amp; m_metaData;
+        size_t m_filtersWithoutConditionsBytecodeWritten { 0 };
+        size_t m_filtersWithConditionBytecodeWritten { 0 };
+        size_t m_conditionFiltersBytecodeWritten { 0 };
+        size_t m_actionsWritten { 0 };
+        bool m_conditionsApplyOnlyToDomain { false };
+        bool m_fileError { false };
+    };
+
+    auto temporaryFileHandle = WebCore::invalidPlatformFileHandle;
+    String temporaryFilePath = WebCore::openTemporaryFile(&quot;ContentExtension&quot;, temporaryFileHandle);
+    if (temporaryFileHandle == WebCore::invalidPlatformFileHandle)
+        return ContentExtensionStore::Error::CompileFailed;
+    
+    char invalidHeader[ContentExtensionFileHeaderSize];
+    memset(invalidHeader, 0xFF, sizeof(invalidHeader));
+    // This header will be rewritten in CompilationClient::finalize.
+    if (WebCore::writeToFile(temporaryFileHandle, invalidHeader, sizeof(invalidHeader)) == -1) {
+        WebCore::closeFile(temporaryFileHandle);
+        return ContentExtensionStore::Error::CompileFailed;
+    }
+
+    CompilationClient compilationClient(temporaryFileHandle, metaData);
+    
+    if (auto compilerError = compileRuleList(compilationClient, WTFMove(json))) {
+        WebCore::closeFile(temporaryFileHandle);
+        return compilerError;
+    }
+    if (compilationClient.hadErrorWhileWritingToFile()) {
+        WebCore::closeFile(temporaryFileHandle);
+        return ContentExtensionStore::Error::CompileFailed;
+    }
+    
+    mappedData = adoptAndMapFile(temporaryFileHandle, 0, metaData.fileSize());
+    if (mappedData.isNull())
+        return ContentExtensionStore::Error::CompileFailed;
+
+    if (!WebCore::moveFile(temporaryFilePath, finalFilePath))
+        return ContentExtensionStore::Error::CompileFailed;
+
+    return { };
+}
+
+static RefPtr&lt;API::ContentExtension&gt; createExtension(const String&amp; identifier, const ContentExtensionMetaData&amp; metaData, const Data&amp; fileData)
+{
+    auto sharedMemory = WebKit::SharedMemory::create(const_cast&lt;uint8_t*&gt;(fileData.data()), fileData.size(), WebKit::SharedMemory::Protection::ReadOnly);
+    auto compiledContentExtensionData = WebKit::WebCompiledContentExtensionData(
+        WTFMove(sharedMemory),
+        fileData,
+        ConditionsApplyOnlyToDomainOffset,
+        ContentExtensionFileHeaderSize,
+        metaData.actionsSize,
+        ContentExtensionFileHeaderSize
+            + metaData.actionsSize,
+        metaData.filtersWithoutConditionsBytecodeSize,
+        ContentExtensionFileHeaderSize
+            + metaData.actionsSize
+            + metaData.filtersWithoutConditionsBytecodeSize,
+        metaData.filtersWithConditionsBytecodeSize,
+        ContentExtensionFileHeaderSize
+            + metaData.actionsSize
+            + metaData.filtersWithoutConditionsBytecodeSize
+            + metaData.filtersWithConditionsBytecodeSize,
+        metaData.conditionedFiltersBytecodeSize
+    );
+    auto compiledContentExtension = WebKit::WebCompiledContentExtension::create(WTFMove(compiledContentExtensionData));
+    return API::ContentExtension::create(identifier, WTFMove(compiledContentExtension));
+}
+
+void ContentExtensionStore::lookupContentExtension(const WTF::String&amp; identifier, Function&lt;void(RefPtr&lt;API::ContentExtension&gt;, std::error_code)&gt; completionHandler)
+{
+    m_readQueue-&gt;dispatch([protectedThis = makeRef(*this), identifier = identifier.isolatedCopy(), storePath = m_storePath.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
+        auto path = constructedPath(storePath, identifier);
+        
+        ContentExtensionMetaData metaData;
+        Data fileData;
+        if (!openAndMapContentExtension(path, metaData, fileData)) {
+            RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler)] {
+                completionHandler(nullptr, Error::LookupFailed);
+            });
+            return;
+        }
+        
+        if (metaData.version != ContentExtensionStore::CurrentContentExtensionFileVersion) {
+            RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler)] {
+                completionHandler(nullptr, Error::VersionMismatch);
+            });
+            return;
+        }
+        
+        RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), identifier = WTFMove(identifier), fileData = WTFMove(fileData), metaData = WTFMove(metaData), completionHandler = WTFMove(completionHandler)] {
+            RefPtr&lt;API::ContentExtension&gt; contentExtension = createExtension(identifier, metaData, fileData);
+            completionHandler(contentExtension, { });
+        });
+    });
+}
+
+void ContentExtensionStore::compileContentExtension(const WTF::String&amp; identifier, WTF::String&amp;&amp; json, Function&lt;void(RefPtr&lt;API::ContentExtension&gt;, std::error_code)&gt; completionHandler)
+{
+    m_compileQueue-&gt;dispatch([protectedThis = makeRef(*this), identifier = identifier.isolatedCopy(), json = json.isolatedCopy(), storePath = m_storePath.isolatedCopy(), completionHandler = WTFMove(completionHandler)] () mutable {
+        auto path = constructedPath(storePath, identifier);
+
+        ContentExtensionMetaData metaData;
+        Data fileData;
+        auto error = compiledToFile(WTFMove(json), path, metaData, fileData);
+        if (error) {
+            RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), error = WTFMove(error), completionHandler = WTFMove(completionHandler)] {
+                completionHandler(nullptr, error);
+            });
+            return;
+        }
+
+        RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), identifier = WTFMove(identifier), fileData = WTFMove(fileData), metaData = WTFMove(metaData), completionHandler = WTFMove(completionHandler)] {
+            RefPtr&lt;API::ContentExtension&gt; contentExtension = createExtension(identifier, metaData, fileData);
+            completionHandler(contentExtension, { });
+        });
+    });
+}
+
+void ContentExtensionStore::removeContentExtension(const WTF::String&amp; identifier, Function&lt;void(std::error_code)&gt; completionHandler)
+{
+    m_removeQueue-&gt;dispatch([protectedThis = makeRef(*this), identifier = identifier.isolatedCopy(), storePath = m_storePath.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
+        auto path = constructedPath(storePath, identifier);
+
+        if (!WebCore::deleteFile(path)) {
+            RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler)] {
+                completionHandler(Error::RemoveFailed);
+            });
+            return;
+        }
+
+        RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler)] {
+            completionHandler({ });
+        });
+    });
+}
+
+void ContentExtensionStore::synchronousRemoveAllContentExtensions()
+{
+    for (const auto&amp; path : WebCore::listDirectory(m_storePath, &quot;*&quot;))
+        WebCore::deleteFile(path);
+}
+
+void ContentExtensionStore::invalidateContentExtensionVersion(const WTF::String&amp; identifier)
+{
+    auto file = WebCore::openFile(constructedPath(m_storePath, identifier), WebCore::OpenForWrite);
+    if (file == WebCore::invalidPlatformFileHandle)
+        return;
+    ContentExtensionMetaData invalidHeader = {0, 0, 0, 0, 0, 0};
+    auto bytesWritten = WebCore::writeToFile(file, reinterpret_cast&lt;const char*&gt;(&amp;invalidHeader), sizeof(invalidHeader));
+    ASSERT_UNUSED(bytesWritten, bytesWritten == sizeof(invalidHeader));
+    WebCore::closeFile(file);
+}
+    
+const std::error_category&amp; contentExtensionStoreErrorCategory()
+{
+    class ContentExtensionStoreErrorCategory : public std::error_category {
+        const char* name() const noexcept final
+        {
+            return &quot;content extension store&quot;;
+        }
+
+        std::string message(int errorCode) const final
+        {
+            switch (static_cast&lt;ContentExtensionStore::Error&gt;(errorCode)) {
+            case ContentExtensionStore::Error::LookupFailed:
+                return &quot;Unspecified error during lookup.&quot;;
+            case ContentExtensionStore::Error::VersionMismatch:
+                return &quot;Version of file does not match version of interpreter.&quot;;
+            case ContentExtensionStore::Error::CompileFailed:
+                return &quot;Unspecified error during compile.&quot;;
+            case ContentExtensionStore::Error::RemoveFailed:
+                return &quot;Unspecified error during remove.&quot;;
+            }
+
+            return std::string();
+        }
+    };
+
+    static NeverDestroyed&lt;ContentExtensionStoreErrorCategory&gt; contentExtensionErrorCategory;
+    return contentExtensionErrorCategory;
+}
+
+} // namespace API
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIAPIContentExtensionStorehfromrev213687trunkSourceWebKit2UIProcessAPIAPIUserContentExtensionStoreh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/API/APIContentExtensionStore.h (from rev 213687, trunk/Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.h) (0 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/APIContentExtensionStore.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/APIContentExtensionStore.h        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -0,0 +1,92 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+#include &quot;APIObject.h&quot;
+#include &lt;system_error&gt;
+#include &lt;wtf/text/WTFString.h&gt;
+
+namespace WTF {
+class WorkQueue;
+}
+
+namespace API {
+
+class ContentExtension;
+
+class ContentExtensionStore final : public ObjectImpl&lt;Object::Type::ContentExtensionStore&gt; {
+public:
+    enum class Error {
+        LookupFailed = 6, // Mirrors value of WKErrorContentExtensionStoreLookupFailed
+        VersionMismatch,
+        CompileFailed,
+        RemoveFailed
+    };
+    
+    // This should be incremented every time a functional change is made to the bytecode, file format, etc.
+    // to prevent crashing while loading old data.
+    const static uint32_t CurrentContentExtensionFileVersion = 8;
+
+    static ContentExtensionStore&amp; defaultStore();
+    static Ref&lt;ContentExtensionStore&gt; storeWithPath(const WTF::String&amp; storePath);
+
+    explicit ContentExtensionStore();
+    explicit ContentExtensionStore(const WTF::String&amp; storePath);
+    virtual ~ContentExtensionStore();
+
+    void compileContentExtension(const WTF::String&amp; identifier, WTF::String&amp;&amp; json, Function&lt;void(RefPtr&lt;API::ContentExtension&gt;, std::error_code)&gt;);
+    void lookupContentExtension(const WTF::String&amp; identifier, Function&lt;void(RefPtr&lt;API::ContentExtension&gt;, std::error_code)&gt;);
+    void removeContentExtension(const WTF::String&amp; identifier, Function&lt;void(std::error_code)&gt;);
+
+    // For testing only.
+    void synchronousRemoveAllContentExtensions();
+    void invalidateContentExtensionVersion(const WTF::String&amp; identifier);
+
+private:
+    WTF::String defaultStorePath();
+
+    const WTF::String m_storePath;
+    Ref&lt;WTF::WorkQueue&gt; m_compileQueue;
+    Ref&lt;WTF::WorkQueue&gt; m_readQueue;
+    Ref&lt;WTF::WorkQueue&gt; m_removeQueue;
+};
+
+const std::error_category&amp; contentExtensionStoreErrorCategory();
+
+inline std::error_code make_error_code(ContentExtensionStore::Error error)
+{
+    return { static_cast&lt;int&gt;(error), contentExtensionStoreErrorCategory() };
+}
+
+} // namespace API
+
+namespace std {
+template&lt;&gt; struct is_error_code_enum&lt;API::ContentExtensionStore::Error&gt; : public true_type { };
+}
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIAPIUserContentExtensioncpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/API/APIUserContentExtension.cpp (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/APIUserContentExtension.cpp        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/UIProcess/API/APIUserContentExtension.cpp        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -1,47 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include &quot;config.h&quot;
-#include &quot;APIUserContentExtension.h&quot;
-
-#if ENABLE(CONTENT_EXTENSIONS)
-
-#include &quot;WebCompiledContentExtension.h&quot;
-
-namespace API {
-
-UserContentExtension::UserContentExtension(const WTF::String&amp; name, Ref&lt;WebKit::WebCompiledContentExtension&gt;&amp;&amp; contentExtension)
-    : m_name(name)
-    , m_compiledExtension(WTFMove(contentExtension))
-{
-}
-
-UserContentExtension::~UserContentExtension()
-{
-}
-
-} // namespace API
-
-#endif // ENABLE(CONTENT_EXTENSIONS)
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIAPIUserContentExtensionh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/API/APIUserContentExtension.h (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/APIUserContentExtension.h        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/UIProcess/API/APIUserContentExtension.h        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -1,60 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef APIUserContentExtension_h
-#define APIUserContentExtension_h
-
-#include &quot;APIObject.h&quot;
-#include &lt;wtf/text/WTFString.h&gt;
-
-namespace WebKit {
-class WebCompiledContentExtension;
-}
-
-namespace API {
-
-class UserContentExtension final : public ObjectImpl&lt;Object::Type::UserContentExtension&gt; {
-public:
-#if ENABLE(CONTENT_EXTENSIONS)
-    static Ref&lt;UserContentExtension&gt; create(const WTF::String&amp; name, Ref&lt;WebKit::WebCompiledContentExtension&gt;&amp;&amp; contentExtension)
-    {
-        return adoptRef(*new UserContentExtension(name, WTFMove(contentExtension)));
-    }
-
-    UserContentExtension(const WTF::String&amp; name, Ref&lt;WebKit::WebCompiledContentExtension&gt;&amp;&amp;);
-    virtual ~UserContentExtension();
-
-    const WTF::String&amp; name() const { return m_name; }
-    const WebKit::WebCompiledContentExtension&amp; compiledExtension() const { return m_compiledExtension.get(); }
-
-private:
-    WTF::String m_name;
-    Ref&lt;WebKit::WebCompiledContentExtension&gt; m_compiledExtension;
-#endif // ENABLE(CONTENT_EXTENSIONS)
-};
-
-} // namespace API
-
-#endif // APIUserContentExtension_h
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIAPIUserContentExtensionStorecpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -1,436 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include &quot;config.h&quot;
-#include &quot;APIUserContentExtensionStore.h&quot;
-
-#if ENABLE(CONTENT_EXTENSIONS)
-
-#include &quot;APIUserContentExtension.h&quot;
-#include &quot;NetworkCacheData.h&quot;
-#include &quot;NetworkCacheFileSystem.h&quot;
-#include &quot;SharedMemory.h&quot;
-#include &quot;WebCompiledContentExtension.h&quot;
-#include &lt;WebCore/ContentExtensionCompiler.h&gt;
-#include &lt;WebCore/ContentExtensionError.h&gt;
-#include &lt;string&gt;
-#include &lt;wtf/NeverDestroyed.h&gt;
-#include &lt;wtf/RunLoop.h&gt;
-#include &lt;wtf/WorkQueue.h&gt;
-#include &lt;wtf/persistence/Decoder.h&gt;
-#include &lt;wtf/persistence/Encoder.h&gt;
-
-using namespace WebKit::NetworkCache;
-
-namespace API {
-
-UserContentExtensionStore&amp; UserContentExtensionStore::defaultStore()
-{
-    static UserContentExtensionStore* defaultStore = adoptRef(new UserContentExtensionStore).leakRef();
-    return *defaultStore;
-}
-
-Ref&lt;UserContentExtensionStore&gt; UserContentExtensionStore::storeWithPath(const WTF::String&amp; storePath)
-{
-    return adoptRef(*new UserContentExtensionStore(storePath));
-}
-
-UserContentExtensionStore::UserContentExtensionStore()
-    : UserContentExtensionStore(defaultStorePath())
-{
-}
-
-UserContentExtensionStore::UserContentExtensionStore(const WTF::String&amp; storePath)
-    : m_storePath(storePath)
-    , m_compileQueue(WorkQueue::create(&quot;UserContentExtensionStore Compile Queue&quot;, WorkQueue::Type::Concurrent))
-    , m_readQueue(WorkQueue::create(&quot;UserContentExtensionStore Read Queue&quot;))
-    , m_removeQueue(WorkQueue::create(&quot;UserContentExtensionStore Remove Queue&quot;))
-{
-}
-
-UserContentExtensionStore::~UserContentExtensionStore()
-{
-}
-
-static String constructedPath(const String&amp; base, const String&amp; identifier)
-{
-    return WebCore::pathByAppendingComponent(base, &quot;ContentExtension-&quot; + WebCore::encodeForFileName(identifier));
-}
-
-// The size and offset of the densely packed bytes in the file, not sizeof and offsetof, which would
-// represent the size and offset of the structure in memory, possibly with compiler-added padding.
-const size_t ContentExtensionFileHeaderSize = 2 * sizeof(uint32_t) + 4 * sizeof(uint64_t);
-const size_t ConditionsApplyOnlyToDomainOffset = sizeof(uint32_t) + 4 * sizeof(uint64_t);
-
-struct ContentExtensionMetaData {
-    uint32_t version { UserContentExtensionStore::CurrentContentExtensionFileVersion };
-    uint64_t actionsSize { 0 };
-    uint64_t filtersWithoutConditionsBytecodeSize { 0 };
-    uint64_t filtersWithConditionsBytecodeSize { 0 };
-    uint64_t conditionedFiltersBytecodeSize { 0 };
-    uint32_t conditionsApplyOnlyToDomain { false };
-    
-    size_t fileSize() const
-    {
-        return ContentExtensionFileHeaderSize
-            + actionsSize
-            + filtersWithoutConditionsBytecodeSize
-            + filtersWithConditionsBytecodeSize
-            + conditionedFiltersBytecodeSize;
-    }
-};
-
-static Data encodeContentExtensionMetaData(const ContentExtensionMetaData&amp; metaData)
-{
-    WTF::Persistence::Encoder encoder;
-
-    encoder &lt;&lt; metaData.version;
-    encoder &lt;&lt; metaData.actionsSize;
-    encoder &lt;&lt; metaData.filtersWithoutConditionsBytecodeSize;
-    encoder &lt;&lt; metaData.filtersWithConditionsBytecodeSize;
-    encoder &lt;&lt; metaData.conditionedFiltersBytecodeSize;
-    encoder &lt;&lt; metaData.conditionsApplyOnlyToDomain;
-
-    ASSERT(encoder.bufferSize() == ContentExtensionFileHeaderSize);
-    return Data(encoder.buffer(), encoder.bufferSize());
-}
-
-static bool decodeContentExtensionMetaData(ContentExtensionMetaData&amp; metaData, const Data&amp; fileData)
-{
-    bool success = false;
-    fileData.apply([&amp;metaData, &amp;success, &amp;fileData](const uint8_t* data, size_t size) {
-        // The file data should be mapped into one continuous memory segment so the size
-        // passed to the applier should always equal the data size.
-        if (size != fileData.size())
-            return false;
-
-        WTF::Persistence::Decoder decoder(data, size);
-        if (!decoder.decode(metaData.version))
-            return false;
-        if (!decoder.decode(metaData.actionsSize))
-            return false;
-        if (!decoder.decode(metaData.filtersWithoutConditionsBytecodeSize))
-            return false;
-        if (!decoder.decode(metaData.filtersWithConditionsBytecodeSize))
-            return false;
-        if (!decoder.decode(metaData.conditionedFiltersBytecodeSize))
-            return false;
-        if (!decoder.decode(metaData.conditionsApplyOnlyToDomain))
-            return false;
-        success = true;
-        return false;
-    });
-    return success;
-}
-
-static bool openAndMapContentExtension(const String&amp; path, ContentExtensionMetaData&amp; metaData, Data&amp; fileData)
-{
-    fileData = mapFile(WebCore::fileSystemRepresentation(path).data());
-    if (fileData.isNull())
-        return false;
-
-    if (!decodeContentExtensionMetaData(metaData, fileData))
-        return false;
-
-    return true;
-}
-
-static bool writeDataToFile(const Data&amp; fileData, WebCore::PlatformFileHandle fd)
-{
-    bool success = true;
-    fileData.apply([fd, &amp;success](const uint8_t* data, size_t size) {
-        if (WebCore::writeToFile(fd, (const char*)data, size) == -1) {
-            success = false;
-            return false;
-        }
-        return true;
-    });
-    
-    return success;
-}
-
-static std::error_code compiledToFile(String&amp;&amp; json, const String&amp; finalFilePath, ContentExtensionMetaData&amp; metaData, Data&amp; mappedData)
-{
-    using namespace WebCore::ContentExtensions;
-
-    class CompilationClient final : public ContentExtensionCompilationClient {
-    public:
-        CompilationClient(WebCore::PlatformFileHandle fileHandle, ContentExtensionMetaData&amp; metaData)
-            : m_fileHandle(fileHandle)
-            , m_metaData(metaData)
-        {
-            ASSERT(!metaData.actionsSize);
-            ASSERT(!metaData.filtersWithoutConditionsBytecodeSize);
-            ASSERT(!metaData.filtersWithConditionsBytecodeSize);
-            ASSERT(!metaData.conditionedFiltersBytecodeSize);
-            ASSERT(!metaData.conditionsApplyOnlyToDomain);
-        }
-        
-        void writeFiltersWithoutConditionsBytecode(Vector&lt;DFABytecode&gt;&amp;&amp; bytecode) final
-        {
-            ASSERT(!m_filtersWithConditionBytecodeWritten);
-            ASSERT(!m_conditionFiltersBytecodeWritten);
-            m_filtersWithoutConditionsBytecodeWritten += bytecode.size();
-            writeToFile(Data(bytecode.data(), bytecode.size()));
-        }
-        
-        void writeFiltersWithConditionsBytecode(Vector&lt;DFABytecode&gt;&amp;&amp; bytecode) final
-        {
-            ASSERT(!m_conditionFiltersBytecodeWritten);
-            m_filtersWithConditionBytecodeWritten += bytecode.size();
-            writeToFile(Data(bytecode.data(), bytecode.size()));
-        }
-        
-        void writeTopURLFiltersBytecode(Vector&lt;DFABytecode&gt;&amp;&amp; bytecode) final
-        {
-            m_conditionFiltersBytecodeWritten += bytecode.size();
-            writeToFile(Data(bytecode.data(), bytecode.size()));
-        }
-
-        void writeActions(Vector&lt;SerializedActionByte&gt;&amp;&amp; actions, bool conditionsApplyOnlyToDomain) final
-        {
-            ASSERT(!m_filtersWithoutConditionsBytecodeWritten);
-            ASSERT(!m_filtersWithConditionBytecodeWritten);
-            ASSERT(!m_conditionFiltersBytecodeWritten);
-            ASSERT(!m_actionsWritten);
-            m_actionsWritten += actions.size();
-            m_conditionsApplyOnlyToDomain = conditionsApplyOnlyToDomain;
-            writeToFile(Data(actions.data(), actions.size()));
-        }
-        
-        void finalize() final
-        {
-            m_metaData.actionsSize = m_actionsWritten;
-            m_metaData.filtersWithoutConditionsBytecodeSize = m_filtersWithoutConditionsBytecodeWritten;
-            m_metaData.filtersWithConditionsBytecodeSize = m_filtersWithConditionBytecodeWritten;
-            m_metaData.conditionedFiltersBytecodeSize = m_conditionFiltersBytecodeWritten;
-            m_metaData.conditionsApplyOnlyToDomain = m_conditionsApplyOnlyToDomain;
-            
-            Data header = encodeContentExtensionMetaData(m_metaData);
-            if (!m_fileError &amp;&amp; WebCore::seekFile(m_fileHandle, 0ll, WebCore::FileSeekOrigin::SeekFromBeginning) == -1) {
-                WebCore::closeFile(m_fileHandle);
-                m_fileError = true;
-            }
-            writeToFile(header);
-        }
-        
-        bool hadErrorWhileWritingToFile() { return m_fileError; }
-
-    private:
-        void writeToFile(const Data&amp; data)
-        {
-            if (!m_fileError &amp;&amp; !writeDataToFile(data, m_fileHandle)) {
-                WebCore::closeFile(m_fileHandle);
-                m_fileError = true;
-            }
-        }
-        
-        WebCore::PlatformFileHandle m_fileHandle;
-        ContentExtensionMetaData&amp; m_metaData;
-        size_t m_filtersWithoutConditionsBytecodeWritten { 0 };
-        size_t m_filtersWithConditionBytecodeWritten { 0 };
-        size_t m_conditionFiltersBytecodeWritten { 0 };
-        size_t m_actionsWritten { 0 };
-        bool m_conditionsApplyOnlyToDomain { false };
-        bool m_fileError { false };
-    };
-
-    auto temporaryFileHandle = WebCore::invalidPlatformFileHandle;
-    String temporaryFilePath = WebCore::openTemporaryFile(&quot;ContentExtension&quot;, temporaryFileHandle);
-    if (temporaryFileHandle == WebCore::invalidPlatformFileHandle)
-        return UserContentExtensionStore::Error::CompileFailed;
-    
-    char invalidHeader[ContentExtensionFileHeaderSize];
-    memset(invalidHeader, 0xFF, sizeof(invalidHeader));
-    // This header will be rewritten in CompilationClient::finalize.
-    if (WebCore::writeToFile(temporaryFileHandle, invalidHeader, sizeof(invalidHeader)) == -1) {
-        WebCore::closeFile(temporaryFileHandle);
-        return UserContentExtensionStore::Error::CompileFailed;
-    }
-
-    CompilationClient compilationClient(temporaryFileHandle, metaData);
-    
-    if (auto compilerError = compileRuleList(compilationClient, WTFMove(json))) {
-        WebCore::closeFile(temporaryFileHandle);
-        return compilerError;
-    }
-    if (compilationClient.hadErrorWhileWritingToFile()) {
-        WebCore::closeFile(temporaryFileHandle);
-        return UserContentExtensionStore::Error::CompileFailed;
-    }
-    
-    mappedData = adoptAndMapFile(temporaryFileHandle, 0, metaData.fileSize());
-    if (mappedData.isNull())
-        return UserContentExtensionStore::Error::CompileFailed;
-
-    if (!WebCore::moveFile(temporaryFilePath, finalFilePath))
-        return UserContentExtensionStore::Error::CompileFailed;
-
-    return { };
-}
-
-static RefPtr&lt;API::UserContentExtension&gt; createExtension(const String&amp; identifier, const ContentExtensionMetaData&amp; metaData, const Data&amp; fileData)
-{
-    auto sharedMemory = WebKit::SharedMemory::create(const_cast&lt;uint8_t*&gt;(fileData.data()), fileData.size(), WebKit::SharedMemory::Protection::ReadOnly);
-    auto compiledContentExtensionData = WebKit::WebCompiledContentExtensionData(
-        WTFMove(sharedMemory),
-        fileData,
-        ConditionsApplyOnlyToDomainOffset,
-        ContentExtensionFileHeaderSize,
-        metaData.actionsSize,
-        ContentExtensionFileHeaderSize
-            + metaData.actionsSize,
-        metaData.filtersWithoutConditionsBytecodeSize,
-        ContentExtensionFileHeaderSize
-            + metaData.actionsSize
-            + metaData.filtersWithoutConditionsBytecodeSize,
-        metaData.filtersWithConditionsBytecodeSize,
-        ContentExtensionFileHeaderSize
-            + metaData.actionsSize
-            + metaData.filtersWithoutConditionsBytecodeSize
-            + metaData.filtersWithConditionsBytecodeSize,
-        metaData.conditionedFiltersBytecodeSize
-    );
-    auto compiledContentExtension = WebKit::WebCompiledContentExtension::create(WTFMove(compiledContentExtensionData));
-    return API::UserContentExtension::create(identifier, WTFMove(compiledContentExtension));
-}
-
-void UserContentExtensionStore::lookupContentExtension(const WTF::String&amp; identifier, Function&lt;void(RefPtr&lt;API::UserContentExtension&gt;, std::error_code)&gt; completionHandler)
-{
-    m_readQueue-&gt;dispatch([protectedThis = makeRef(*this), identifier = identifier.isolatedCopy(), storePath = m_storePath.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
-        auto path = constructedPath(storePath, identifier);
-        
-        ContentExtensionMetaData metaData;
-        Data fileData;
-        if (!openAndMapContentExtension(path, metaData, fileData)) {
-            RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler)] {
-                completionHandler(nullptr, Error::LookupFailed);
-            });
-            return;
-        }
-        
-        if (metaData.version != UserContentExtensionStore::CurrentContentExtensionFileVersion) {
-            RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler)] {
-                completionHandler(nullptr, Error::VersionMismatch);
-            });
-            return;
-        }
-        
-        RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), identifier = WTFMove(identifier), fileData = WTFMove(fileData), metaData = WTFMove(metaData), completionHandler = WTFMove(completionHandler)] {
-            RefPtr&lt;API::UserContentExtension&gt; userContentExtension = createExtension(identifier, metaData, fileData);
-            completionHandler(userContentExtension, { });
-        });
-    });
-}
-
-void UserContentExtensionStore::compileContentExtension(const WTF::String&amp; identifier, WTF::String&amp;&amp; json, Function&lt;void(RefPtr&lt;API::UserContentExtension&gt;, std::error_code)&gt; completionHandler)
-{
-    m_compileQueue-&gt;dispatch([protectedThis = makeRef(*this), identifier = identifier.isolatedCopy(), json = json.isolatedCopy(), storePath = m_storePath.isolatedCopy(), completionHandler = WTFMove(completionHandler)] () mutable {
-        auto path = constructedPath(storePath, identifier);
-
-        ContentExtensionMetaData metaData;
-        Data fileData;
-        auto error = compiledToFile(WTFMove(json), path, metaData, fileData);
-        if (error) {
-            RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), error = WTFMove(error), completionHandler = WTFMove(completionHandler)] {
-                completionHandler(nullptr, error);
-            });
-            return;
-        }
-
-        RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), identifier = WTFMove(identifier), fileData = WTFMove(fileData), metaData = WTFMove(metaData), completionHandler = WTFMove(completionHandler)] {
-            RefPtr&lt;API::UserContentExtension&gt; userContentExtension = createExtension(identifier, metaData, fileData);
-            completionHandler(userContentExtension, { });
-        });
-    });
-}
-
-void UserContentExtensionStore::removeContentExtension(const WTF::String&amp; identifier, Function&lt;void(std::error_code)&gt; completionHandler)
-{
-    m_removeQueue-&gt;dispatch([protectedThis = makeRef(*this), identifier = identifier.isolatedCopy(), storePath = m_storePath.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
-        auto path = constructedPath(storePath, identifier);
-
-        if (!WebCore::deleteFile(path)) {
-            RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler)] {
-                completionHandler(Error::RemoveFailed);
-            });
-            return;
-        }
-
-        RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler)] {
-            completionHandler({ });
-        });
-    });
-}
-
-void UserContentExtensionStore::synchronousRemoveAllContentExtensions()
-{
-    for (const auto&amp; path : WebCore::listDirectory(m_storePath, &quot;*&quot;))
-        WebCore::deleteFile(path);
-}
-
-void UserContentExtensionStore::invalidateContentExtensionVersion(const WTF::String&amp; identifier)
-{
-    auto file = WebCore::openFile(constructedPath(m_storePath, identifier), WebCore::OpenForWrite);
-    if (file == WebCore::invalidPlatformFileHandle)
-        return;
-    ContentExtensionMetaData invalidHeader;
-    auto bytesWritten = WebCore::writeToFile(file, reinterpret_cast&lt;const char*&gt;(&amp;invalidHeader), sizeof(invalidHeader));
-    ASSERT_UNUSED(bytesWritten, bytesWritten == sizeof(invalidHeader));
-    WebCore::closeFile(file);
-}
-    
-const std::error_category&amp; userContentExtensionStoreErrorCategory()
-{
-    class UserContentExtensionStoreErrorCategory : public std::error_category {
-        const char* name() const noexcept final
-        {
-            return &quot;user content extension store&quot;;
-        }
-
-        std::string message(int errorCode) const final
-        {
-            switch (static_cast&lt;UserContentExtensionStore::Error&gt;(errorCode)) {
-            case UserContentExtensionStore::Error::LookupFailed:
-                return &quot;Unspecified error during lookup.&quot;;
-            case UserContentExtensionStore::Error::VersionMismatch:
-                return &quot;Version of file does not match version of interpreter.&quot;;
-            case UserContentExtensionStore::Error::CompileFailed:
-                return &quot;Unspecified error during compile.&quot;;
-            case UserContentExtensionStore::Error::RemoveFailed:
-                return &quot;Unspecified error during remove.&quot;;
-            }
-
-            return std::string();
-        }
-    };
-
-    static NeverDestroyed&lt;UserContentExtensionStoreErrorCategory&gt; contentExtensionErrorCategory;
-    return contentExtensionErrorCategory;
-}
-
-} // namespace API
-
-#endif // ENABLE(CONTENT_EXTENSIONS)
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIAPIUserContentExtensionStoreh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.h (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.h        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.h        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -1,92 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(CONTENT_EXTENSIONS)
-
-#include &quot;APIObject.h&quot;
-#include &lt;system_error&gt;
-#include &lt;wtf/text/WTFString.h&gt;
-
-namespace WTF {
-class WorkQueue;
-}
-
-namespace API {
-
-class UserContentExtension;
-
-class UserContentExtensionStore final : public ObjectImpl&lt;Object::Type::UserContentExtensionStore&gt; {
-public:
-    enum class Error {
-        LookupFailed = 1,
-        VersionMismatch,
-        CompileFailed,
-        RemoveFailed
-    };
-    
-    // This should be incremented every time a functional change is made to the bytecode, file format, etc.
-    // to prevent crashing while loading old data.
-    const static uint32_t CurrentContentExtensionFileVersion = 8;
-
-    static UserContentExtensionStore&amp; defaultStore();
-    static Ref&lt;UserContentExtensionStore&gt; storeWithPath(const WTF::String&amp; storePath);
-
-    explicit UserContentExtensionStore();
-    explicit UserContentExtensionStore(const WTF::String&amp; storePath);
-    virtual ~UserContentExtensionStore();
-
-    void compileContentExtension(const WTF::String&amp; identifier, WTF::String&amp;&amp; json, Function&lt;void(RefPtr&lt;API::UserContentExtension&gt;, std::error_code)&gt;);
-    void lookupContentExtension(const WTF::String&amp; identifier, Function&lt;void(RefPtr&lt;API::UserContentExtension&gt;, std::error_code)&gt;);
-    void removeContentExtension(const WTF::String&amp; identifier, Function&lt;void(std::error_code)&gt;);
-
-    // For testing only.
-    void synchronousRemoveAllContentExtensions();
-    void invalidateContentExtensionVersion(const WTF::String&amp; identifier);
-
-private:
-    WTF::String defaultStorePath();
-
-    const WTF::String m_storePath;
-    Ref&lt;WTF::WorkQueue&gt; m_compileQueue;
-    Ref&lt;WTF::WorkQueue&gt; m_readQueue;
-    Ref&lt;WTF::WorkQueue&gt; m_removeQueue;
-};
-
-const std::error_category&amp; userContentExtensionStoreErrorCategory();
-
-inline std::error_code make_error_code(UserContentExtensionStore::Error error)
-{
-    return { static_cast&lt;int&gt;(error), userContentExtensionStoreErrorCategory() };
-}
-
-} // namespace API
-
-namespace std {
-    template&lt;&gt; struct is_error_code_enum&lt;API::UserContentExtensionStore::Error&gt; : public true_type { };
-}
-
-#endif // ENABLE(CONTENT_EXTENSIONS)
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKAPICasth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -51,6 +51,8 @@
</span><span class="cx"> #include &lt;WebCore/Settings.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace API {
</span><ins>+class ContentExtension;
+class ContentExtensionStore;
</ins><span class="cx"> class ExperimentalFeature;
</span><span class="cx"> class FrameHandle;
</span><span class="cx"> class FrameInfo;
</span><span class="lines">@@ -63,8 +65,6 @@
</span><span class="cx"> class PageConfiguration;
</span><span class="cx"> class ProcessPoolConfiguration;
</span><span class="cx"> class SessionState;
</span><del>-class UserContentExtension;
-class UserContentExtensionStore;
</del><span class="cx"> class UserScript;
</span><span class="cx"> class WebsiteDataStore;
</span><span class="cx"> class WebsitePolicies;
</span><span class="lines">@@ -161,8 +161,8 @@
</span><span class="cx"> WK_ADD_API_MAPPING(WKSessionStateRef, API::SessionState)
</span><span class="cx"> WK_ADD_API_MAPPING(WKTextCheckerRef, WebTextChecker)
</span><span class="cx"> WK_ADD_API_MAPPING(WKUserContentControllerRef, WebUserContentControllerProxy)
</span><del>-WK_ADD_API_MAPPING(WKUserContentExtensionStoreRef, API::UserContentExtensionStore)
-WK_ADD_API_MAPPING(WKUserContentFilterRef, API::UserContentExtension)
</del><ins>+WK_ADD_API_MAPPING(WKUserContentExtensionStoreRef, API::ContentExtensionStore)
+WK_ADD_API_MAPPING(WKUserContentFilterRef, API::ContentExtension)
</ins><span class="cx"> WK_ADD_API_MAPPING(WKUserMediaPermissionCheckRef, UserMediaPermissionCheckProxy)
</span><span class="cx"> WK_ADD_API_MAPPING(WKUserMediaPermissionRequestRef, UserMediaPermissionRequestProxy)
</span><span class="cx"> WK_ADD_API_MAPPING(WKUserScriptRef, API::UserScript)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKPageGroupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;WKPageGroup.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;APIUserContentExtension.h&quot;
</del><ins>+#include &quot;APIContentExtension.h&quot;
</ins><span class="cx"> #include &quot;APIUserContentWorld.h&quot;
</span><span class="cx"> #include &quot;APIUserScript.h&quot;
</span><span class="cx"> #include &quot;APIUserStyleSheet.h&quot;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKUserContentControllerRefcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKUserContentControllerRef.cpp (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKUserContentControllerRef.cpp        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKUserContentControllerRef.cpp        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;WKUserContentControllerRef.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;APIUserContentExtension.h&quot;
</del><ins>+#include &quot;APIContentExtension.h&quot;
</ins><span class="cx"> #include &quot;APIUserScript.h&quot;
</span><span class="cx"> #include &quot;WKAPICast.h&quot;
</span><span class="cx"> #include &quot;WebUserContentControllerProxy.h&quot;
</span><span class="lines">@@ -62,7 +62,7 @@
</span><span class="cx"> void WKUserContentControllerAddUserContentFilter(WKUserContentControllerRef userContentControllerRef, WKUserContentFilterRef userContentFilterRef)
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(CONTENT_EXTENSIONS)
</span><del>-    toImpl(userContentControllerRef)-&gt;addUserContentExtension(*toImpl(userContentFilterRef));
</del><ins>+    toImpl(userContentControllerRef)-&gt;addContentExtension(*toImpl(userContentFilterRef));
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -69,6 +69,6 @@
</span><span class="cx"> void WKUserContentControllerRemoveAllUserContentFilters(WKUserContentControllerRef userContentControllerRef)
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(CONTENT_EXTENSIONS)
</span><del>-    toImpl(userContentControllerRef)-&gt;removeAllUserContentExtensions();
</del><ins>+    toImpl(userContentControllerRef)-&gt;removeAllContentExtensions();
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKUserContentExtensionStoreRefcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKUserContentExtensionStoreRef.cpp (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKUserContentExtensionStoreRef.cpp        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKUserContentExtensionStoreRef.cpp        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;WKUserContentExtensionStoreRef.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;APIUserContentExtensionStore.h&quot;
</del><ins>+#include &quot;APIContentExtensionStore.h&quot;
</ins><span class="cx"> #include &quot;WKAPICast.h&quot;
</span><span class="cx"> 
</span><span class="cx"> using namespace WebKit;
</span><span class="lines">@@ -34,7 +34,7 @@
</span><span class="cx"> WKTypeID WKUserContentExtensionStoreGetTypeID()
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(CONTENT_EXTENSIONS)
</span><del>-    return toAPI(API::UserContentExtensionStore::APIType);
</del><ins>+    return toAPI(API::ContentExtensionStore::APIType);
</ins><span class="cx"> #else
</span><span class="cx">     return 0;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaAPIUserContentExtensionStoreCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/APIUserContentExtensionStoreCocoa.mm (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/APIUserContentExtensionStoreCocoa.mm        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/APIUserContentExtensionStoreCocoa.mm        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -24,7 +24,7 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #include &quot;config.h&quot;
</span><del>-#include &quot;APIUserContentExtensionStore.h&quot;
</del><ins>+#include &quot;APIContentExtensionStore.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(CONTENT_EXTENSIONS)
</span><span class="cx"> 
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace API {
</span><span class="cx"> 
</span><del>-String UserContentExtensionStore::defaultStorePath()
</del><ins>+String ContentExtensionStore::defaultStorePath()
</ins><span class="cx"> {
</span><span class="cx">     static dispatch_once_t onceToken;
</span><span class="cx">     static NSURL *contentExtensionStoreURL;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKContentExtensionhfromrev213687trunkSourceWebKit2UIProcessAPICocoa_WKUserContentFilterh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtension.h (from rev 213687, trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilter.h) (0 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtension.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtension.h        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import &lt;WebKit/WKFoundation.h&gt;
+
+#if WK_API_ENABLED
+
+WK_CLASS_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA))
+@interface WKContentExtension : NSObject
+
+@end
+
+#endif // WK_API_ENABLED
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKContentExtensionmmfromrev213687trunkSourceWebKit2UIProcessAPICocoa_WKUserContentFiltermm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtension.mm (from rev 213687, trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilter.mm) (0 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtension.mm                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtension.mm        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import &quot;config.h&quot;
+#import &quot;WKContentExtensionInternal.h&quot;
+
+#if WK_API_ENABLED
+
+#include &quot;WebCompiledContentExtension.h&quot;
+
+@implementation WKContentExtension
+
+- (void)dealloc
+{
+    _contentExtension-&gt;~ContentExtension();
+
+    [super dealloc];
+}
+
+#pragma mark WKObject protocol implementation
+
+- (API::Object&amp;)_apiObject
+{
+    return *_contentExtension;
+}
+
+@end
+
+#endif // WK_API_ENABLED
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKContentExtensionInternalhfromrev213687trunkSourceWebKit2UIProcessAPICocoa_WKUserContentFilterInternalh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionInternal.h (from rev 213687, trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilterInternal.h) (0 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionInternal.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionInternal.h        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import &quot;WKContentExtension.h&quot;
+
+#if WK_API_ENABLED
+
+#import &quot;APIContentExtension.h&quot;
+#import &quot;WKObject.h&quot;
+
+namespace WebKit {
+
+inline WKContentExtension *wrapper(API::ContentExtension&amp; contentExtension)
+{
+    ASSERT([contentExtension.wrapper() isKindOfClass:[WKContentExtension class]]);
+    return (WKContentExtension *)contentExtension.wrapper();
+}
+
+}
+
+@interface WKContentExtension () &lt;WKObject&gt; {
+@package
+    API::ObjectStorage&lt;API::ContentExtension&gt; _contentExtension;
+}
+@end
+
+#endif // WK_API_ENABLED
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKContentExtensionStorehfromrev213687trunkSourceWebKit2UIProcessAPICocoa_WKUserContentExtensionStoreh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStore.h (from rev 213687, trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStore.h) (0 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStore.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStore.h        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import &lt;WebKit/WKFoundation.h&gt;
+
+#if WK_API_ENABLED
+
+@class WKContentExtension;
+
+WK_CLASS_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA))
+@interface WKContentExtensionStore : NSObject
+
++ (instancetype)defaultStore;
++ (instancetype)storeWithURL:(NSURL *)url;
+
+- (void)compileContentExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *) encodedContentExtension completionHandler:(void (^)(WKContentExtension *, NSError *))completionHandler;
+- (void)lookupContentExtensionForIdentifier:(NSString *)identifier completionHandler:(void (^)(WKContentExtension *, NSError *))completionHandler;
+- (void)removeContentExtensionForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSError *))completionHandler;
+
+@end
+
+#endif // WK_API_ENABLED
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKContentExtensionStoremmfromrev213687trunkSourceWebKit2UIProcessAPICocoa_WKUserContentExtensionStoremm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStore.mm (from rev 213687, trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm) (0 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStore.mm                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStore.mm        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -0,0 +1,156 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import &quot;config.h&quot;
+#import &quot;WKContentExtensionInternal.h&quot;
+#import &quot;WKContentExtensionStoreInternal.h&quot;
+
+#if WK_API_ENABLED
+
+#import &quot;WKErrorInternal.h&quot;
+
+@implementation WKContentExtensionStore
+
+- (void)dealloc
+{
+    _contentExtensionStore-&gt;~ContentExtensionStore();
+
+    [super dealloc];
+}
+
++ (instancetype)defaultStore
+{
+    return WebKit::wrapper(API::ContentExtensionStore::defaultStore());
+}
+
++ (instancetype)storeWithURL:(NSURL *)url
+{
+    Ref&lt;API::ContentExtensionStore&gt; store = API::ContentExtensionStore::storeWithPath(url.absoluteURL.fileSystemRepresentation);
+    return WebKit::wrapper(store.leakRef());
+}
+
+- (void)compileContentExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *)encodedContentExtension completionHandler:(void (^)(WKContentExtension *, NSError *))completionHandler
+{
+    [self _compileContentExtensionForIdentifier:identifier encodedContentExtension:encodedContentExtension completionHandler:completionHandler releasesArgument:NO];
+}
+
+- (void)_compileContentExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *)encodedContentExtension completionHandler:(void (^)(WKContentExtension *, NSError *))completionHandler releasesArgument:(BOOL)releasesArgument
+{
+    auto handler = adoptNS([completionHandler copy]);
+
+    String json(encodedContentExtension);
+    if (releasesArgument) {
+        [encodedContentExtension release];
+        encodedContentExtension = nil;
+    }
+
+    _contentExtensionStore-&gt;compileContentExtension(identifier, WTFMove(json), [handler](RefPtr&lt;API::ContentExtension&gt; contentExtension, std::error_code error) {
+        if (error) {
+            auto rawHandler = (void (^)(WKContentExtension *, NSError *))handler.get();
+            
+            auto userInfo = @{NSHelpAnchorErrorKey: [NSString stringWithFormat:@&quot;Extension compilation failed: %s&quot;, error.message().c_str()]};
+
+            // error.value() could have a specific compiler error that is not equal to WKErrorContentExtensionStoreCompileFailed.
+            // We want to use error.message, but here we want to only pass on CompileFailed with userInfo from the std::error_code.
+            rawHandler(nil, [NSError errorWithDomain:WKErrorDomain code:WKErrorContentExtensionStoreCompileFailed userInfo:userInfo]);
+            return;
+        }
+
+        auto rawHandler = (void (^)(WKContentExtension *, NSError *))handler.get();
+        rawHandler(WebKit::wrapper(*contentExtension.get()), nil);
+    });
+}
+
+- (void)lookupContentExtensionForIdentifier:(NSString *)identifier completionHandler:(void (^)(WKContentExtension *, NSError *))completionHandler
+{
+    auto handler = adoptNS([completionHandler copy]);
+
+    _contentExtensionStore-&gt;lookupContentExtension(identifier, [handler](RefPtr&lt;API::ContentExtension&gt; contentExtension, std::error_code error) {
+        if (error) {
+            auto rawHandler = (void (^)(WKContentExtension *, NSError *))handler.get();
+
+            auto userInfo = @{NSHelpAnchorErrorKey: [NSString stringWithFormat:@&quot;Extension lookup failed: %s&quot;, error.message().c_str()]};
+            ASSERT(error.value() == WKErrorContentExtensionStoreLookupFailed || error.value() == WKErrorContentExtensionStoreVersionMismatch);
+            rawHandler(nil, [NSError errorWithDomain:WKErrorDomain code:error.value() userInfo:userInfo]);
+            return;
+        }
+
+        auto rawHandler = (void (^)(WKContentExtension *, NSError *))handler.get();
+        rawHandler(WebKit::wrapper(*contentExtension.get()), nil);
+    });
+}
+
+- (void)removeContentExtensionForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSError *))completionHandler
+{
+    auto handler = adoptNS([completionHandler copy]);
+
+    _contentExtensionStore-&gt;removeContentExtension(identifier, [handler](std::error_code error) {
+        if (error) {
+            auto rawHandler = (void (^)(NSError *))handler.get();
+
+            auto userInfo = @{NSHelpAnchorErrorKey: [NSString stringWithFormat:@&quot;Extension removal failed: %s&quot;, error.message().c_str()]};
+            ASSERT(error.value() == WKErrorContentExtensionStoreRemoveFailed);
+            rawHandler([NSError errorWithDomain:WKErrorDomain code:WKErrorContentExtensionStoreRemoveFailed userInfo:userInfo]);
+            return;
+        }
+
+        auto rawHandler = (void (^)(NSError *))handler.get();
+        rawHandler(nil);
+    });
+}
+
+#pragma mark WKObject protocol implementation
+
+- (API::Object&amp;)_apiObject
+{
+    return *_contentExtensionStore;
+}
+
+@end
+
+@implementation WKContentExtensionStore (WKPrivate)
+
+// For testing only.
+
+- (void)_removeAllContentExtensions
+{
+    _contentExtensionStore-&gt;synchronousRemoveAllContentExtensions();
+}
+
+- (void)_invalidateContentExtensionVersionForIdentifier:(NSString *)identifier
+{
+    _contentExtensionStore-&gt;invalidateContentExtensionVersion(identifier);
+}
+
+// NS_RELEASES_ARGUMENT to keep peak memory usage low.
+
+- (void)_compileContentExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *)encodedContentExtension completionHandler:(void (^)(WKContentExtension *, NSError *))completionHandler
+{
+    [self _compileContentExtensionForIdentifier:identifier encodedContentExtension:encodedContentExtension completionHandler:completionHandler releasesArgument:YES];
+}
+
+@end
+
+#endif // WK_API_ENABLED
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKContentExtensionStoreInternalhfromrev213687trunkSourceWebKit2UIProcessAPICocoa_WKUserContentExtensionStoreInternalh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStoreInternal.h (from rev 213687, trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStoreInternal.h) (0 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStoreInternal.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStoreInternal.h        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import &quot;WKContentExtensionStorePrivate.h&quot;
+
+#if WK_API_ENABLED
+
+#import &quot;APIContentExtensionStore.h&quot;
+#import &quot;WKObject.h&quot;
+
+namespace WebKit {
+
+inline WKContentExtensionStore *wrapper(API::ContentExtensionStore&amp; store)
+{
+    ASSERT([store.wrapper() isKindOfClass:[WKContentExtensionStore class]]);
+    return (WKContentExtensionStore *)store.wrapper();
+}
+
+}
+
+@interface WKContentExtensionStore () &lt;WKObject&gt; {
+@package
+    API::ObjectStorage&lt;API::ContentExtensionStore&gt; _contentExtensionStore;
+}
+@end
+
+#endif // WK_API_ENABLED
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKContentExtensionStorePrivatehfromrev213687trunkSourceWebKit2UIProcessAPICocoa_WKUserContentExtensionStorePrivateh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStorePrivate.h (from rev 213687, trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h) (0 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStorePrivate.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStorePrivate.h        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import &lt;WebKit/WKContentExtensionStore.h&gt;
+
+#if WK_API_ENABLED
+
+@interface WKContentExtensionStore (WKPrivate)
+
+// For testing only.
+- (void)_removeAllContentExtensions;
+- (void)_invalidateContentExtensionVersionForIdentifier:(NSString *)identifier;
+
+// NS_RELEASES_ARGUMENT to keep peak memory usage low.
+- (void)_compileContentExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *) NS_RELEASES_ARGUMENT encodedContentExtension completionHandler:(void (^)(WKContentExtension *, NSError *))completionHandler;
+
+@end
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKErrorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKError.h (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKError.h        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKError.h        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -36,11 +36,15 @@
</span><span class="cx"> 
</span><span class="cx"> /*! @enum WKErrorCode
</span><span class="cx">  @abstract Constants used by NSError to indicate errors in the WebKit domain.
</span><del>- @constant WKErrorUnknown                           Indicates that an unknown error occurred.
- @constant WKErrorWebContentProcessTerminated       Indicates that the Web Content process was terminated.
- @constant WKErrorWebViewInvalidated                Indicates that the WKWebView was invalidated.
- @constant WKErrorJavaScriptExceptionOccurred       Indicates that a JavaScript exception occurred.
- @constant WKErrorJavaScriptResultTypeIsUnsupported Indicates that the result of JavaScript execution could not be returned.
</del><ins>+ @constant WKErrorUnknown                              Indicates that an unknown error occurred.
+ @constant WKErrorWebContentProcessTerminated          Indicates that the Web Content process was terminated.
+ @constant WKErrorWebViewInvalidated                   Indicates that the WKWebView was invalidated.
+ @constant WKErrorJavaScriptExceptionOccurred          Indicates that a JavaScript exception occurred.
+ @constant WKErrorJavaScriptResultTypeIsUnsupported    Indicates that the result of JavaScript execution could not be returned.
+ @constant WKErrorContentExtensionStoreLookupFailed    Indicates that looking up a WKUserContentExtension failed.
+ @constant WKErrorContentExtensionStoreVersionMismatch Indicates that looking up a WKUserContentExtension found an extension with an incompatible binary version.
+ @constant WKErrorContentExtensionStoreCompileFailed   Indicates that compiling a WKUserContentExtension failed.
+ @constant WKErrorContentExtensionStoreRemoveFailed    Indicates that removing a WKUserContentExtension failed.
</ins><span class="cx">  */
</span><span class="cx"> typedef NS_ENUM(NSInteger, WKErrorCode) {
</span><span class="cx">     WKErrorUnknown = 1,
</span><span class="lines">@@ -48,6 +52,10 @@
</span><span class="cx">     WKErrorWebViewInvalidated,
</span><span class="cx">     WKErrorJavaScriptExceptionOccurred,
</span><span class="cx">     WKErrorJavaScriptResultTypeIsUnsupported WK_API_AVAILABLE(macosx(10.11), ios(9.0)),
</span><ins>+    WKErrorContentExtensionStoreLookupFailed WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)),
+    WKErrorContentExtensionStoreVersionMismatch WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)),
+    WKErrorContentExtensionStoreCompileFailed WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)),
+    WKErrorContentExtensionStoreRemoveFailed WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)),
</ins><span class="cx"> } WK_API_AVAILABLE(macosx(10.10), ios(8.0));
</span><span class="cx"> 
</span><span class="cx"> NS_ASSUME_NONNULL_END
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKErrormm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKError.mm (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKError.mm        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKError.mm        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -57,6 +57,18 @@
</span><span class="cx"> 
</span><span class="cx">     case WKErrorJavaScriptResultTypeIsUnsupported:
</span><span class="cx">         return WEB_UI_STRING(&quot;JavaScript execution returned a result of an unsupported type&quot;, &quot;WKErrorJavaScriptResultTypeIsUnsupported description&quot;);
</span><ins>+
+    case WKErrorContentExtensionStoreLookupFailed:
+        return WEB_UI_STRING(&quot;Looking up a WKUserContentExtension failed&quot;, &quot;WKErrorContentExtensionStoreLookupFailed description&quot;);
+
+    case WKErrorContentExtensionStoreVersionMismatch:
+        return WEB_UI_STRING(&quot;Looking up a WKUserContentExtension found a binary that is incompatible&quot;, &quot;WKErrorContentExtensionStoreVersionMismatch description&quot;);
+
+    case WKErrorContentExtensionStoreCompileFailed:
+        return WEB_UI_STRING(&quot;Compiling a WKUserContentExtension failed&quot;, &quot;WKErrorContentExtensionStoreCompileFailed description&quot;);
+
+    case WKErrorContentExtensionStoreRemoveFailed:
+        return WEB_UI_STRING(&quot;Removing a WKUserContentExtension failed&quot;, &quot;WKErrorContentExtensionStoreRemoveFailed description&quot;);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKUserContentControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.h (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.h        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.h        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> 
</span><span class="cx"> NS_ASSUME_NONNULL_BEGIN
</span><span class="cx"> 
</span><ins>+@class WKContentExtension;
</ins><span class="cx"> @class WKUserScript;
</span><span class="cx"> @protocol WKScriptMessageHandler;
</span><span class="cx"> 
</span><span class="lines">@@ -70,6 +71,20 @@
</span><span class="cx">  */
</span><span class="cx"> - (void)removeScriptMessageHandlerForName:(NSString *)name;
</span><span class="cx"> 
</span><ins>+/*! @abstract Adds a user content extension.
+ @param name The name of the user content extension to add.
+ */
+- (void)addContentExtension:(WKContentExtension *)contentExtension WK_API_AVAILABLE(macosx(WK_IOS_TBA), ios(WK_IOS_TBA));
+
+/*! @abstract Removes a user content extension.
+ @param name The identifier of the user content extension to remove.
+ */
+- (void)removeContentExtension:(NSString *)identifier WK_API_AVAILABLE(macosx(WK_IOS_TBA), ios(WK_IOS_TBA));
+
+/*! @abstract Removes all associated user content extensions.
+ */
+- (void)removeAllContentExtensions WK_API_AVAILABLE(macosx(WK_IOS_TBA), ios(WK_IOS_TBA));
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> NS_ASSUME_NONNULL_END
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKUserContentControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> 
</span><span class="cx"> #import &quot;APISerializedScriptValue.h&quot;
</span><span class="cx"> #import &quot;APIUserContentWorld.h&quot;
</span><ins>+#import &quot;WKContentExtensionInternal.h&quot;
</ins><span class="cx"> #import &quot;WKFrameInfoInternal.h&quot;
</span><span class="cx"> #import &quot;WKNSArray.h&quot;
</span><span class="cx"> #import &quot;WKScriptMessageHandler.h&quot;
</span><span class="lines">@@ -91,6 +92,27 @@
</span><span class="cx">     _userContentControllerProxy-&gt;removeAllUserScripts();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)addContentExtension:(WKContentExtension *)contentExtension
+{
+#if ENABLE(CONTENT_EXTENSIONS)
+    _userContentControllerProxy-&gt;addContentExtension(*contentExtension-&gt;_contentExtension);
+#endif
+}
+
+- (void)removeContentExtension:(NSString *)identifier
+{
+#if ENABLE(CONTENT_EXTENSIONS)
+    _userContentControllerProxy-&gt;removeContentExtension(identifier);
+#endif
+}
+
+- (void)removeAllContentExtensions
+{
+#if ENABLE(CONTENT_EXTENSIONS)
+    _userContentControllerProxy-&gt;removeAllContentExtensions();
+#endif
+}
+
</ins><span class="cx"> class ScriptMessageHandlerDelegate final : public WebKit::WebScriptMessageHandler::Client {
</span><span class="cx"> public:
</span><span class="cx">     ScriptMessageHandlerDelegate(WKUserContentController *controller, id &lt;WKScriptMessageHandler&gt; handler, NSString *name)
</span><span class="lines">@@ -153,7 +175,7 @@
</span><span class="cx"> - (void)_addUserContentFilter:(_WKUserContentFilter *)userContentFilter
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(CONTENT_EXTENSIONS)
</span><del>-    _userContentControllerProxy-&gt;addUserContentExtension(*userContentFilter-&gt;_userContentExtension);
</del><ins>+    _userContentControllerProxy-&gt;addContentExtension(*userContentFilter-&gt;_contentExtension-&gt;_contentExtension);
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -160,7 +182,7 @@
</span><span class="cx"> - (void)_removeUserContentFilter:(NSString *)userContentFilterName
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(CONTENT_EXTENSIONS)
</span><del>-    _userContentControllerProxy-&gt;removeUserContentExtension(userContentFilterName);
</del><ins>+    _userContentControllerProxy-&gt;removeContentExtension(userContentFilterName);
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -167,7 +189,7 @@
</span><span class="cx"> - (void)_removeAllUserContentFilters
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(CONTENT_EXTENSIONS)
</span><del>-    _userContentControllerProxy-&gt;removeAllUserContentExtensions();
</del><ins>+    _userContentControllerProxy-&gt;removeAllContentExtensions();
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoa_WKUserContentExtensionStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStore.h (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStore.h        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStore.h        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx"> WK_EXTERN NSString * const _WKUserContentExtensionsDomain WK_API_AVAILABLE(macosx(10.12), ios(10.0));
</span><span class="cx"> 
</span><span class="cx"> typedef NS_ENUM(NSInteger, _WKUserContentExtensionStoreErrorCode) {
</span><del>-    _WKUserContentExtensionStoreErrorLookupFailed = 1,
</del><ins>+    _WKUserContentExtensionStoreErrorLookupFailed = 6, // Mirrors value of WKErrorContentExtensionStoreLookupFailed
</ins><span class="cx">     _WKUserContentExtensionStoreErrorVersionMismatch,
</span><span class="cx">     _WKUserContentExtensionStoreErrorCompileFailed,
</span><span class="cx">     _WKUserContentExtensionStoreErrorRemoveFailed,
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoa_WKUserContentExtensionStoremm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -28,93 +28,47 @@
</span><span class="cx"> 
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx"> 
</span><ins>+#import &quot;WKContentExtensionStoreInternal.h&quot;
+#import &quot;WKContentExtensionStorePrivate.h&quot;
</ins><span class="cx"> #import &quot;WKErrorInternal.h&quot;
</span><ins>+#import &quot;_WKUserContentExtensionStorePrivate.h&quot;
</ins><span class="cx"> #import &quot;_WKUserContentFilterInternal.h&quot;
</span><ins>+#import &quot;_WKUserContentFilterPrivate.h&quot;
</ins><span class="cx"> #import &lt;string&gt;
</span><span class="cx"> 
</span><del>-NSString * const _WKUserContentExtensionsDomain = @&quot;_WKUserContentExtensionsDomain&quot;;
</del><ins>+NSString * const _WKUserContentExtensionsDomain = @&quot;WKErrorDomain&quot;;
</ins><span class="cx"> 
</span><span class="cx"> @implementation _WKUserContentExtensionStore
</span><span class="cx"> 
</span><del>-- (void)dealloc
-{
-    _userContentExtensionStore-&gt;~UserContentExtensionStore();
-
-    [super dealloc];
-}
-
</del><span class="cx"> + (instancetype)defaultStore
</span><span class="cx"> {
</span><del>-    return WebKit::wrapper(API::UserContentExtensionStore::defaultStore());
</del><ins>+    return [[[_WKUserContentExtensionStore alloc] _initWithWKContentExtensionStore:[WKContentExtensionStore defaultStore]] autorelease];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> + (instancetype)storeWithURL:(NSURL *)url
</span><span class="cx"> {
</span><del>-    Ref&lt;API::UserContentExtensionStore&gt; store = API::UserContentExtensionStore::storeWithPath(url.absoluteURL.fileSystemRepresentation);
-    return WebKit::wrapper(store.leakRef());
</del><ins>+    return [[[_WKUserContentExtensionStore alloc] _initWithWKContentExtensionStore:[WKContentExtensionStore storeWithURL:url]] autorelease];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)compileContentExtensionForIdentifier:(NSString *)identifier encodedContentExtension:(NSString *)encodedContentExtension completionHandler:(void (^)(_WKUserContentFilter *, NSError *))completionHandler
</span><span class="cx"> {
</span><del>-    auto handler = adoptNS([completionHandler copy]);
-
-    String json(encodedContentExtension);
-    [encodedContentExtension release];
-    encodedContentExtension = nil;
-
-    _userContentExtensionStore-&gt;compileContentExtension(identifier, WTFMove(json), [handler](RefPtr&lt;API::UserContentExtension&gt; contentExtension, std::error_code error) {
-        if (error) {
-            auto rawHandler = (void (^)(_WKUserContentFilter *, NSError *))handler.get();
-            
-            auto userInfo = @{NSHelpAnchorErrorKey: [NSString stringWithFormat:@&quot;Extension compilation failed: %s&quot;, error.message().c_str()]};
-
-            // error.value() could have a specific compiler error that is not equal to _WKUserContentExtensionStoreErrorCompileFailed.
-            // We want to use error.message, but here we want to only pass on CompileFailed.
-            rawHandler(nil, [NSError errorWithDomain:_WKUserContentExtensionsDomain code:_WKUserContentExtensionStoreErrorCompileFailed userInfo:userInfo]);
-            return;
-        }
-
-        auto rawHandler = (void (^)(_WKUserContentFilter *, NSError *))handler.get();
-        rawHandler(WebKit::wrapper(*contentExtension.get()), nil);
-    });
</del><ins>+    [_contentExtensionStore _compileContentExtensionForIdentifier:identifier encodedContentExtension:encodedContentExtension completionHandler:^(WKContentExtension *contentExtension, NSError *error) {
+        _WKUserContentFilter *contentFilter = contentExtension ? [[[_WKUserContentFilter alloc] _initWithWKContentExtension:contentExtension] autorelease] : nil;
+        completionHandler(contentFilter, error);
+    }];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)lookupContentExtensionForIdentifier:(NSString *)identifier completionHandler:(void (^)(_WKUserContentFilter *, NSError *))completionHandler
</span><span class="cx"> {
</span><del>-    auto handler = adoptNS([completionHandler copy]);
-
-    _userContentExtensionStore-&gt;lookupContentExtension(identifier, [handler](RefPtr&lt;API::UserContentExtension&gt; contentExtension, std::error_code error) {
-        if (error) {
-            auto rawHandler = (void (^)(_WKUserContentFilter *, NSError *))handler.get();
-
-            auto userInfo = @{NSHelpAnchorErrorKey: [NSString stringWithFormat:@&quot;Extension lookup failed: %s&quot;, error.message().c_str()]};
-            ASSERT(error.value() == _WKUserContentExtensionStoreErrorLookupFailed || error.value() == _WKUserContentExtensionStoreErrorVersionMismatch);
-            rawHandler(nil, [NSError errorWithDomain:_WKUserContentExtensionsDomain code:error.value() userInfo:userInfo]);
-            return;
-        }
-
-        auto rawHandler = (void (^)(_WKUserContentFilter *, NSError *))handler.get();
-        rawHandler(WebKit::wrapper(*contentExtension.get()), nil);
-    });
</del><ins>+    [_contentExtensionStore lookupContentExtensionForIdentifier:identifier completionHandler:^(WKContentExtension *contentExtension, NSError *error) {
+        _WKUserContentFilter *contentFilter = contentExtension ? [[[_WKUserContentFilter alloc] _initWithWKContentExtension:contentExtension] autorelease] : nil;
+        completionHandler(contentFilter, error);
+    }];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)removeContentExtensionForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSError *))completionHandler
</span><span class="cx"> {
</span><del>-    auto handler = adoptNS([completionHandler copy]);
-
-    _userContentExtensionStore-&gt;removeContentExtension(identifier, [handler](std::error_code error) {
-        if (error) {
-            auto rawHandler = (void (^)(NSError *))handler.get();
-
-            auto userInfo = @{NSHelpAnchorErrorKey: [NSString stringWithFormat:@&quot;Extension removal failed: %s&quot;, error.message().c_str()]};
-            ASSERT(error.value() == _WKUserContentExtensionStoreErrorRemoveFailed);
-            rawHandler([NSError errorWithDomain:_WKUserContentExtensionsDomain code:_WKUserContentExtensionStoreErrorRemoveFailed userInfo:userInfo]);
-            return;
-        }
-
-        auto rawHandler = (void (^)(NSError *))handler.get();
-        rawHandler(nil);
-    });
</del><ins>+    [_contentExtensionStore removeContentExtensionForIdentifier:identifier completionHandler:completionHandler];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #pragma mark WKObject protocol implementation
</span><span class="lines">@@ -121,7 +75,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (API::Object&amp;)_apiObject
</span><span class="cx"> {
</span><del>-    return *_userContentExtensionStore;
</del><ins>+    return [_contentExtensionStore _apiObject];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> @end
</span><span class="lines">@@ -132,14 +86,25 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_removeAllContentExtensions
</span><span class="cx"> {
</span><del>-    _userContentExtensionStore-&gt;synchronousRemoveAllContentExtensions();
</del><ins>+    [_contentExtensionStore _removeAllContentExtensions];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_invalidateContentExtensionVersionForIdentifier:(NSString *)identifier
</span><span class="cx"> {
</span><del>-    _userContentExtensionStore-&gt;invalidateContentExtensionVersion(identifier);
</del><ins>+    [_contentExtensionStore _invalidateContentExtensionVersionForIdentifier:identifier];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (id)_initWithWKContentExtensionStore:(WKContentExtensionStore*)contentExtensionStore
+{
+    self = [super init];
+    if (!self)
+        return nil;
+    
+    _contentExtensionStore = contentExtensionStore;
+    
+    return self;
+}
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #endif // WK_API_ENABLED
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoa_WKUserContentExtensionStoreInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStoreInternal.h (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStoreInternal.h        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStoreInternal.h        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -27,22 +27,14 @@
</span><span class="cx"> 
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx"> 
</span><del>-#import &quot;APIUserContentExtensionStore.h&quot;
</del><ins>+#import &quot;APIContentExtensionStore.h&quot;
</ins><span class="cx"> #import &quot;WKObject.h&quot;
</span><span class="cx"> 
</span><del>-namespace WebKit {
</del><ins>+@class WKContentExtensionStore;
</ins><span class="cx"> 
</span><del>-inline _WKUserContentExtensionStore *wrapper(API::UserContentExtensionStore&amp; store)
-{
-    ASSERT([store.wrapper() isKindOfClass:[_WKUserContentExtensionStore class]]);
-    return (_WKUserContentExtensionStore *)store.wrapper();
-}
-
-}
-
</del><span class="cx"> @interface _WKUserContentExtensionStore () &lt;WKObject&gt; {
</span><span class="cx"> @package
</span><del>-    API::ObjectStorage&lt;API::UserContentExtensionStore&gt; _userContentExtensionStore;
</del><ins>+    RetainPtr&lt;WKContentExtensionStore&gt; _contentExtensionStore;
</ins><span class="cx"> }
</span><span class="cx"> @end
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoa_WKUserContentExtensionStorePrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -27,6 +27,8 @@
</span><span class="cx"> 
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx"> 
</span><ins>+@class WKContentExtensionStore;
+
</ins><span class="cx"> @interface _WKUserContentExtensionStore (WKPrivate)
</span><span class="cx"> 
</span><span class="cx"> // For testing only.
</span><span class="lines">@@ -33,6 +35,8 @@
</span><span class="cx"> - (void)_removeAllContentExtensions;
</span><span class="cx"> - (void)_invalidateContentExtensionVersionForIdentifier:(NSString *)identifier;
</span><span class="cx"> 
</span><ins>+- (id)_initWithWKContentExtensionStore:(WKContentExtensionStore*)contentExtensionStore;
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoa_WKUserContentFiltermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilter.mm (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilter.mm        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilter.mm        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -35,18 +35,26 @@
</span><span class="cx"> 
</span><span class="cx"> @implementation _WKUserContentFilter
</span><span class="cx"> 
</span><del>-- (void)dealloc
</del><ins>+#pragma mark WKObject protocol implementation
+
+- (API::Object&amp;)_apiObject
</ins><span class="cx"> {
</span><del>-    _userContentExtension-&gt;~UserContentExtension();
-
-    [super dealloc];
</del><ins>+    return [_contentExtension _apiObject];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-#pragma mark WKObject protocol implementation
</del><ins>+@end
</ins><span class="cx"> 
</span><del>-- (API::Object&amp;)_apiObject
</del><ins>+@implementation _WKUserContentFilter (WKPrivate)
+
+- (id)_initWithWKContentExtension:(WKContentExtension*)contentExtension
</ins><span class="cx"> {
</span><del>-    return *_userContentExtension;
</del><ins>+    self = [super init];
+    if (!self)
+        return nil;
+    
+    _contentExtension = contentExtension;
+    
+    return self;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoa_WKUserContentFilterInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilterInternal.h (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilterInternal.h        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilterInternal.h        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -27,22 +27,14 @@
</span><span class="cx"> 
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx"> 
</span><del>-#import &quot;APIUserContentExtension.h&quot;
</del><ins>+#import &quot;APIContentExtension.h&quot;
</ins><span class="cx"> #import &quot;WKObject.h&quot;
</span><span class="cx"> 
</span><del>-namespace WebKit {
</del><ins>+@class WKContentExtension;
</ins><span class="cx"> 
</span><del>-inline _WKUserContentFilter *wrapper(API::UserContentExtension&amp; userContentExtension)
-{
-    ASSERT([userContentExtension.wrapper() isKindOfClass:[_WKUserContentFilter class]]);
-    return (_WKUserContentFilter *)userContentExtension.wrapper();
-}
-
-}
-
</del><span class="cx"> @interface _WKUserContentFilter () &lt;WKObject&gt; {
</span><span class="cx"> @package
</span><del>-    API::ObjectStorage&lt;API::UserContentExtension&gt; _userContentExtension;
</del><ins>+    RetainPtr&lt;WKContentExtension&gt; _contentExtension;
</ins><span class="cx"> }
</span><span class="cx"> @end
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoa_WKUserContentFilterPrivateh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h (0 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import &lt;WebKit/_WKUserContentFilter.h&gt;
+
+#if WK_API_ENABLED
+
+@class WKUserContentExtension;
+
+@interface _WKUserContentFilter (WKPrivate)
+
+- (id)_initWithWKContentExtension:(WKContentExtension*)contentExtension;
+
+@end
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessUserContentWebUserContentControllerProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx"> #include &lt;WebCore/SerializedScriptValue.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CONTENT_EXTENSIONS)
</span><del>-#include &quot;APIUserContentExtension.h&quot;
</del><ins>+#include &quot;APIContentExtension.h&quot;
</ins><span class="cx"> #include &quot;WebCompiledContentExtension.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -97,10 +97,10 @@
</span><span class="cx">     webProcessProxy.connection()-&gt;send(Messages::WebUserContentController::AddUserScriptMessageHandlers(messageHandlers), m_identifier);
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CONTENT_EXTENSIONS)
</span><del>-    Vector&lt;std::pair&lt;String, WebCompiledContentExtensionData&gt;&gt; userContentExtensions;
-    for (const auto&amp; userContentExtension : m_userContentExtensions.values())
-        userContentExtensions.append(std::make_pair(userContentExtension-&gt;name(), userContentExtension-&gt;compiledExtension().data()));
-    webProcessProxy.connection()-&gt;send(Messages::WebUserContentController::AddUserContentExtensions(userContentExtensions), m_identifier);
</del><ins>+    Vector&lt;std::pair&lt;String, WebCompiledContentExtensionData&gt;&gt; contentExtensions;
+    for (const auto&amp; contentExtension : m_contentExtensions.values())
+        contentExtensions.append(std::make_pair(contentExtension-&gt;name(), contentExtension-&gt;compiledExtension().data()));
+    webProcessProxy.connection()-&gt;send(Messages::WebUserContentController::AddContentExtensions(contentExtensions), m_identifier);
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -338,30 +338,30 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CONTENT_EXTENSIONS)
</span><del>-void WebUserContentControllerProxy::addUserContentExtension(API::UserContentExtension&amp; userContentExtension)
</del><ins>+void WebUserContentControllerProxy::addContentExtension(API::ContentExtension&amp; contentExtension)
</ins><span class="cx"> {
</span><del>-    m_userContentExtensions.set(userContentExtension.name(), &amp;userContentExtension);
</del><ins>+    m_contentExtensions.set(contentExtension.name(), &amp;contentExtension);
</ins><span class="cx"> 
</span><del>-    auto pair = std::make_pair(userContentExtension.name(), userContentExtension.compiledExtension().data());
</del><ins>+    auto pair = std::make_pair(contentExtension.name(), contentExtension.compiledExtension().data());
</ins><span class="cx"> 
</span><span class="cx">     for (WebProcessProxy* process : m_processes)
</span><del>-        process-&gt;connection()-&gt;send(Messages::WebUserContentController::AddUserContentExtensions({ pair }), m_identifier);
</del><ins>+        process-&gt;connection()-&gt;send(Messages::WebUserContentController::AddContentExtensions({ pair }), m_identifier);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebUserContentControllerProxy::removeUserContentExtension(const String&amp; name)
</del><ins>+void WebUserContentControllerProxy::removeContentExtension(const String&amp; name)
</ins><span class="cx"> {
</span><del>-    m_userContentExtensions.remove(name);
</del><ins>+    m_contentExtensions.remove(name);
</ins><span class="cx"> 
</span><span class="cx">     for (WebProcessProxy* process : m_processes)
</span><del>-        process-&gt;connection()-&gt;send(Messages::WebUserContentController::RemoveUserContentExtension(name), m_identifier);
</del><ins>+        process-&gt;connection()-&gt;send(Messages::WebUserContentController::RemoveContentExtension(name), m_identifier);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebUserContentControllerProxy::removeAllUserContentExtensions()
</del><ins>+void WebUserContentControllerProxy::removeAllContentExtensions()
</ins><span class="cx"> {
</span><del>-    m_userContentExtensions.clear();
</del><ins>+    m_contentExtensions.clear();
</ins><span class="cx"> 
</span><span class="cx">     for (WebProcessProxy* process : m_processes)
</span><del>-        process-&gt;connection()-&gt;send(Messages::WebUserContentController::RemoveAllUserContentExtensions(), m_identifier);
</del><ins>+        process-&gt;connection()-&gt;send(Messages::WebUserContentController::RemoveAllContentExtensions(), m_identifier);
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessUserContentWebUserContentControllerProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.h (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.h        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.h        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -23,8 +23,7 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef WebUserContentControllerProxy_h
-#define WebUserContentControllerProxy_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;APIObject.h&quot;
</span><span class="cx"> #include &quot;MessageReceiver.h&quot;
</span><span class="lines">@@ -38,8 +37,8 @@
</span><span class="cx"> 
</span><span class="cx"> namespace API {
</span><span class="cx"> class Array;
</span><ins>+class ContentExtension;
</ins><span class="cx"> class UserContentWorld;
</span><del>-class UserContentExtension;
</del><span class="cx"> class UserScript;
</span><span class="cx"> class UserStyleSheet;
</span><span class="cx"> }
</span><span class="lines">@@ -92,9 +91,9 @@
</span><span class="cx">     void removeAllUserMessageHandlers(API::UserContentWorld&amp;);
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CONTENT_EXTENSIONS)
</span><del>-    void addUserContentExtension(API::UserContentExtension&amp;);
-    void removeUserContentExtension(const String&amp;);
-    void removeAllUserContentExtensions();
</del><ins>+    void addContentExtension(API::ContentExtension&amp;);
+    void removeContentExtension(const String&amp;);
+    void removeAllContentExtensions();
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -116,10 +115,8 @@
</span><span class="cx">     HashCountedSet&lt;RefPtr&lt;API::UserContentWorld&gt;&gt; m_userContentWorlds;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CONTENT_EXTENSIONS)
</span><del>-    HashMap&lt;String, RefPtr&lt;API::UserContentExtension&gt;&gt; m_userContentExtensions;
</del><ins>+    HashMap&lt;String, RefPtr&lt;API::ContentExtension&gt;&gt; m_contentExtensions;
</ins><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span><del>-
-#endif // WebUserContentControllerProxy_h
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageGroupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -27,7 +27,7 @@
</span><span class="cx"> #include &quot;WebPageGroup.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;APIArray.h&quot;
</span><del>-#include &quot;APIUserContentExtension.h&quot;
</del><ins>+#include &quot;APIContentExtension.h&quot;
</ins><span class="cx"> #include &quot;APIUserScript.h&quot;
</span><span class="cx"> #include &quot;APIUserStyleSheet.h&quot;
</span><span class="cx"> #include &quot;WebCompiledContentExtension.h&quot;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -1154,6 +1154,14 @@
</span><span class="cx">                 5CB237921DF0E2EE00117AA3 /* APIWebsitePolicies.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CB2378F1DF0E1B800117AA3 /* APIWebsitePolicies.h */; };
</span><span class="cx">                 5CBC9B8D1C65279C00A8FDCF /* NetworkDataTaskCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CBC9B8B1C65257300A8FDCF /* NetworkDataTaskCocoa.mm */; };
</span><span class="cx">                 5CBC9B8E1C652CA000A8FDCF /* NetworkDataTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CBC9B891C6524A500A8FDCF /* NetworkDataTask.h */; };
</span><ins>+                5CD286511E7235990094FDC8 /* WKContentExtensionStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD2864D1E722F440094FDC8 /* WKContentExtensionStore.h */; settings = {ATTRIBUTES = (Public, ); }; };
+                5CD286521E7235A60094FDC8 /* WKContentExtension.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CD2864B1E722F440094FDC8 /* WKContentExtension.mm */; };
+                5CD286531E7235AA0094FDC8 /* _WKUserContentFilterPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD286491E722F440094FDC8 /* _WKUserContentFilterPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                5CD286541E7235B10094FDC8 /* WKContentExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD2864A1E722F440094FDC8 /* WKContentExtension.h */; settings = {ATTRIBUTES = (Public, ); }; };
+                5CD286551E7235B80094FDC8 /* WKContentExtensionInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD2864C1E722F440094FDC8 /* WKContentExtensionInternal.h */; };
+                5CD286561E7235C60094FDC8 /* WKContentExtensionStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CD2864E1E722F440094FDC8 /* WKContentExtensionStore.mm */; };
+                5CD286571E7235C90094FDC8 /* WKContentExtensionStoreInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD2864F1E722F440094FDC8 /* WKContentExtensionStoreInternal.h */; };
+                5CD286581E7235D10094FDC8 /* WKContentExtensionStorePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD286501E722F440094FDC8 /* WKContentExtensionStorePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 5CE85B201C88E64B0070BFCE /* PingLoad.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CE85B1F1C88E6430070BFCE /* PingLoad.h */; };
</span><span class="cx">                 5CFECB041E1ED1CC00F88504 /* LegacyCustomProtocolManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CFECB031E1ED1C800F88504 /* LegacyCustomProtocolManager.cpp */; };
</span><span class="cx">                 6501BD1A12F1243400E9F248 /* WKBundleInspector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65B86F1712F11D7B00B7DD8A /* WKBundleInspector.cpp */; };
</span><span class="lines">@@ -1204,8 +1212,8 @@
</span><span class="cx">                 7C361D78192803BD0036A59D /* WebUserContentControllerProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C361D76192803BD0036A59D /* WebUserContentControllerProxyMessageReceiver.cpp */; };
</span><span class="cx">                 7C361D79192803BD0036A59D /* WebUserContentControllerProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C361D77192803BD0036A59D /* WebUserContentControllerProxyMessages.h */; };
</span><span class="cx">                 7C387434172F5615001BD88A /* PageBanner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C387433172F5615001BD88A /* PageBanner.cpp */; };
</span><del>-                7C3A06A71AAB903E009D74BA /* APIUserContentExtensionStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3A06A51AAB903E009D74BA /* APIUserContentExtensionStore.cpp */; };
-                7C3A06A81AAB903E009D74BA /* APIUserContentExtensionStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3A06A61AAB903E009D74BA /* APIUserContentExtensionStore.h */; };
</del><ins>+                7C3A06A71AAB903E009D74BA /* APIContentExtensionStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3A06A51AAB903E009D74BA /* APIContentExtensionStore.cpp */; };
+                7C3A06A81AAB903E009D74BA /* APIContentExtensionStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3A06A61AAB903E009D74BA /* APIContentExtensionStore.h */; };
</ins><span class="cx">                 7C3F8C90173AF52D007B7F39 /* PluginInformation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3F8C8E173AF52D007B7F39 /* PluginInformation.cpp */; };
</span><span class="cx">                 7C3F8C91173AF52D007B7F39 /* PluginInformation.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3F8C8F173AF52D007B7F39 /* PluginInformation.h */; };
</span><span class="cx">                 7C4694C91A4B4EA100AD5845 /* WebPasteboardProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4694C71A4B4EA000AD5845 /* WebPasteboardProxyMessageReceiver.cpp */; };
</span><span class="lines">@@ -1238,8 +1246,8 @@
</span><span class="cx">                 7C89D2A31A678875003A5FDE /* WKUserScriptRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89D2A11A678875003A5FDE /* WKUserScriptRef.cpp */; };
</span><span class="cx">                 7C89D2A41A678875003A5FDE /* WKUserScriptRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C89D2A21A678875003A5FDE /* WKUserScriptRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 7C89D2A61A6789EA003A5FDE /* APIUserScript.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89D2A51A6789EA003A5FDE /* APIUserScript.cpp */; };
</span><del>-                7C89D2B31A6B068C003A5FDE /* APIUserContentExtension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89D2B11A6B068C003A5FDE /* APIUserContentExtension.cpp */; };
-                7C89D2B41A6B068C003A5FDE /* APIUserContentExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C89D2B21A6B068C003A5FDE /* APIUserContentExtension.h */; };
</del><ins>+                7C89D2B31A6B068C003A5FDE /* APIContentExtension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89D2B11A6B068C003A5FDE /* APIContentExtension.cpp */; };
+                7C89D2B41A6B068C003A5FDE /* APIContentExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C89D2B21A6B068C003A5FDE /* APIContentExtension.h */; };
</ins><span class="cx">                 7C89D2B61A6B0DD9003A5FDE /* WKUserContentControllerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C89D2B51A6B0DD9003A5FDE /* WKUserContentControllerPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 7C89D2B91A6B0F2C003A5FDE /* _WKUserContentFilter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C89D2B71A6B0F2C003A5FDE /* _WKUserContentFilter.mm */; };
</span><span class="cx">                 7C89D2BA1A6B0F2C003A5FDE /* _WKUserContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C89D2B81A6B0F2C003A5FDE /* _WKUserContentFilter.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -3377,6 +3385,14 @@
</span><span class="cx">                 5CB237901DF0E1DD00117AA3 /* APIWebsitePolicies.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIWebsitePolicies.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5CBC9B891C6524A500A8FDCF /* NetworkDataTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkDataTask.h; path = NetworkProcess/NetworkDataTask.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5CBC9B8B1C65257300A8FDCF /* NetworkDataTaskCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = NetworkDataTaskCocoa.mm; path = NetworkProcess/cocoa/NetworkDataTaskCocoa.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                5CD286491E722F440094FDC8 /* _WKUserContentFilterPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKUserContentFilterPrivate.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5CD2864A1E722F440094FDC8 /* WKContentExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentExtension.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5CD2864B1E722F440094FDC8 /* WKContentExtension.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKContentExtension.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5CD2864C1E722F440094FDC8 /* WKContentExtensionInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentExtensionInternal.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5CD2864D1E722F440094FDC8 /* WKContentExtensionStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentExtensionStore.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5CD2864E1E722F440094FDC8 /* WKContentExtensionStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKContentExtensionStore.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5CD2864F1E722F440094FDC8 /* WKContentExtensionStoreInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentExtensionStoreInternal.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5CD286501E722F440094FDC8 /* WKContentExtensionStorePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentExtensionStorePrivate.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 5CE85B1F1C88E6430070BFCE /* PingLoad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PingLoad.h; path = NetworkProcess/PingLoad.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5CFECB031E1ED1C800F88504 /* LegacyCustomProtocolManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LegacyCustomProtocolManager.cpp; path = NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5D442A5516D5856700AC3331 /* PluginService.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PluginService.entitlements; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -3437,8 +3453,8 @@
</span><span class="cx">                 7C361D76192803BD0036A59D /* WebUserContentControllerProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebUserContentControllerProxyMessageReceiver.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C361D77192803BD0036A59D /* WebUserContentControllerProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebUserContentControllerProxyMessages.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C387433172F5615001BD88A /* PageBanner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageBanner.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                7C3A06A51AAB903E009D74BA /* APIUserContentExtensionStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIUserContentExtensionStore.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                7C3A06A61AAB903E009D74BA /* APIUserContentExtensionStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIUserContentExtensionStore.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                7C3A06A51AAB903E009D74BA /* APIContentExtensionStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIContentExtensionStore.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C3A06A61AAB903E009D74BA /* APIContentExtensionStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIContentExtensionStore.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 7C3F8C8E173AF52D007B7F39 /* PluginInformation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginInformation.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C3F8C8F173AF52D007B7F39 /* PluginInformation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginInformation.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C4694C71A4B4EA000AD5845 /* WebPasteboardProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPasteboardProxyMessageReceiver.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -3474,8 +3490,8 @@
</span><span class="cx">                 7C89D2A11A678875003A5FDE /* WKUserScriptRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKUserScriptRef.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C89D2A21A678875003A5FDE /* WKUserScriptRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserScriptRef.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C89D2A51A6789EA003A5FDE /* APIUserScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIUserScript.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                7C89D2B11A6B068C003A5FDE /* APIUserContentExtension.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIUserContentExtension.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                7C89D2B21A6B068C003A5FDE /* APIUserContentExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIUserContentExtension.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                7C89D2B11A6B068C003A5FDE /* APIContentExtension.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIContentExtension.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C89D2B21A6B068C003A5FDE /* APIContentExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIContentExtension.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 7C89D2B51A6B0DD9003A5FDE /* WKUserContentControllerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserContentControllerPrivate.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C89D2B71A6B0F2C003A5FDE /* _WKUserContentFilter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKUserContentFilter.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C89D2B81A6B0F2C003A5FDE /* _WKUserContentFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKUserContentFilter.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -5425,6 +5441,14 @@
</span><span class="cx">                 37C4C08318149C2A003688B9 /* Cocoa */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                5CD286491E722F440094FDC8 /* _WKUserContentFilterPrivate.h */,
+                                5CD2864A1E722F440094FDC8 /* WKContentExtension.h */,
+                                5CD2864B1E722F440094FDC8 /* WKContentExtension.mm */,
+                                5CD2864C1E722F440094FDC8 /* WKContentExtensionInternal.h */,
+                                5CD2864D1E722F440094FDC8 /* WKContentExtensionStore.h */,
+                                5CD2864E1E722F440094FDC8 /* WKContentExtensionStore.mm */,
+                                5CD2864F1E722F440094FDC8 /* WKContentExtensionStoreInternal.h */,
+                                5CD286501E722F440094FDC8 /* WKContentExtensionStorePrivate.h */,
</ins><span class="cx">                                 1A43E826188F38E2009E4D30 /* Deprecated */,
</span><span class="cx">                                 37A5E01218BBF937000A081E /* _WKActivatedElementInfo.h */,
</span><span class="cx">                                 37A5E01118BBF937000A081E /* _WKActivatedElementInfo.mm */,
</span><span class="lines">@@ -6730,10 +6754,10 @@
</span><span class="cx">                                 1A4D664718A2D91A00D82E21 /* APIUIClient.h */,
</span><span class="cx">                                 51D124381E6DFDB9002B2820 /* APIURLSchemeHandlerTask.cpp */,
</span><span class="cx">                                 51D124391E6DFDB9002B2820 /* APIURLSchemeHandlerTask.h */,
</span><del>-                                7C89D2B11A6B068C003A5FDE /* APIUserContentExtension.cpp */,
-                                7C89D2B21A6B068C003A5FDE /* APIUserContentExtension.h */,
-                                7C3A06A51AAB903E009D74BA /* APIUserContentExtensionStore.cpp */,
-                                7C3A06A61AAB903E009D74BA /* APIUserContentExtensionStore.h */,
</del><ins>+                                7C89D2B11A6B068C003A5FDE /* APIContentExtension.cpp */,
+                                7C89D2B21A6B068C003A5FDE /* APIContentExtension.h */,
+                                7C3A06A51AAB903E009D74BA /* APIContentExtensionStore.cpp */,
+                                7C3A06A61AAB903E009D74BA /* APIContentExtensionStore.h */,
</ins><span class="cx">                                 7C882DFB1C7E99A6006BF731 /* APIUserContentWorld.cpp */,
</span><span class="cx">                                 7C882DFC1C7E99A6006BF731 /* APIUserContentWorld.h */,
</span><span class="cx">                                 7CB365AF1D31DD1E007158CA /* APIUserInitiatedAction.h */,
</span><span class="lines">@@ -7999,6 +8023,7 @@
</span><span class="cx">                                 2D87861D1BDB54BF00D02ABB /* _WKUserStyleSheet.h in Headers */,
</span><span class="cx">                                 2D8786201BDB57F500D02ABB /* _WKUserStyleSheetInternal.h in Headers */,
</span><span class="cx">                                 1A81B38118BD66AD0007FDAC /* _WKVisitedLinkStore.h in Headers */,
</span><ins>+                                5CD286541E7235B10094FDC8 /* WKContentExtension.h in Headers */,
</ins><span class="cx">                                 1A81B38518BD673A0007FDAC /* _WKVisitedLinkStoreInternal.h in Headers */,
</span><span class="cx">                                 1AE286781C7E76510069AC4F /* _WKWebsiteDataSize.h in Headers */,
</span><span class="cx">                                 1AE286801C7F92C00069AC4F /* _WKWebsiteDataSizeInternal.h in Headers */,
</span><span class="lines">@@ -8007,6 +8032,7 @@
</span><span class="cx">                                 5CB2378C1DF0DE6E00117AA3 /* _WKWebsitePolicies.h in Headers */,
</span><span class="cx">                                 5CB2378E1DF0E0D300117AA3 /* _WKWebsitePoliciesInternal.h in Headers */,
</span><span class="cx">                                 A115DC72191D82DA00DA8072 /* _WKWebViewPrintFormatter.h in Headers */,
</span><ins>+                                5CD286571E7235C90094FDC8 /* WKContentExtensionStoreInternal.h in Headers */,
</ins><span class="cx">                                 A19DD3C01D07D16800AC823B /* _WKWebViewPrintFormatterInternal.h in Headers */,
</span><span class="cx">                                 A182D5B51BE6BD250087A7CC /* AccessibilityIOS.h in Headers */,
</span><span class="cx">                                 A7D792D81767CCA300881CBE /* ActivityAssertion.h in Headers */,
</span><span class="lines">@@ -8054,8 +8080,8 @@
</span><span class="cx">                                 BCDB86C11200FB97007254BE /* APIURL.h in Headers */,
</span><span class="cx">                                 BCE2315D122C30CA00D5C35A /* APIURLRequest.h in Headers */,
</span><span class="cx">                                 BC90A1D2122DD55E00CC8C50 /* APIURLResponse.h in Headers */,
</span><del>-                                7C89D2B41A6B068C003A5FDE /* APIUserContentExtension.h in Headers */,
-                                7C3A06A81AAB903E009D74BA /* APIUserContentExtensionStore.h in Headers */,
</del><ins>+                                7C89D2B41A6B068C003A5FDE /* APIContentExtension.h in Headers */,
+                                7C3A06A81AAB903E009D74BA /* APIContentExtensionStore.h in Headers */,
</ins><span class="cx">                                 F6113E25126CE1820057D0A7 /* APIUserContentURLPattern.h in Headers */,
</span><span class="cx">                                 7C882DFD1C7E99A8006BF731 /* APIUserContentWorld.h in Headers */,
</span><span class="cx">                                 7CB365B11D31DD1E007158CA /* APIUserInitiatedAction.h in Headers */,
</span><span class="lines">@@ -8263,6 +8289,7 @@
</span><span class="cx">                                 1A2D848B127F6A49001EB962 /* NPIdentifierData.h in Headers */,
</span><span class="cx">                                 1AE4976811FF658E0048B464 /* NPJSObject.h in Headers */,
</span><span class="cx">                                 1A2D82A5127F4EAB001EB962 /* NPObjectMessageReceiver.h in Headers */,
</span><ins>+                                5CD286511E7235990094FDC8 /* WKContentExtensionStore.h in Headers */,
</ins><span class="cx">                                 1A2D843A127F65D5001EB962 /* NPObjectMessageReceiverMessages.h in Headers */,
</span><span class="cx">                                 1A2D82A7127F4EAB001EB962 /* NPObjectProxy.h in Headers */,
</span><span class="cx">                                 1A2D82A9127F4EAB001EB962 /* NPRemoteObjectMap.h in Headers */,
</span><span class="lines">@@ -8619,6 +8646,7 @@
</span><span class="cx">                                 BCBAACF61452324F0053F82F /* WKBrowsingContextGroupPrivate.h in Headers */,
</span><span class="cx">                                 1AE00D4D182D6EB000087DD7 /* WKBrowsingContextHandle.h in Headers */,
</span><span class="cx">                                 1AE00D4F182D6F5000087DD7 /* WKBrowsingContextHandleInternal.h in Headers */,
</span><ins>+                                5CD286581E7235D10094FDC8 /* WKContentExtensionStorePrivate.h in Headers */,
</ins><span class="cx">                                 370F34A71829CFF3009027C8 /* WKBrowsingContextHistoryDelegate.h in Headers */,
</span><span class="cx">                                 BCBAAD0B14560A430053F82F /* WKBrowsingContextLoadDelegate.h in Headers */,
</span><span class="cx">                                 37FC19471850FBF2008CFA47 /* WKBrowsingContextLoadDelegatePrivate.h in Headers */,
</span><span class="lines">@@ -8798,6 +8826,7 @@
</span><span class="cx">                                 BC7B633712A45ABA00D174A4 /* WKPageGroup.h in Headers */,
</span><span class="cx">                                 2D9EA30D1A96CB59002D2807 /* WKPageInjectedBundleClient.h in Headers */,
</span><span class="cx">                                 1AB8A1EC1840080900E9AE69 /* WKPageLoaderClient.h in Headers */,
</span><ins>+                                5CD286531E7235AA0094FDC8 /* _WKUserContentFilterPrivate.h in Headers */,
</ins><span class="cx">                                 BC2D021912AC426C00E732A3 /* WKPageLoadTypes.h in Headers */,
</span><span class="cx">                                 93BDEB01171DD7AF00BFEE1B /* WKPageLoadTypesPrivate.h in Headers */,
</span><span class="cx">                                 2D7303791A7C2B7500F8F487 /* WKPageNavigationClient.h in Headers */,
</span><span class="lines">@@ -8920,6 +8949,7 @@
</span><span class="cx">                                 75A8D2C8187CCFAB00C39C9E /* WKWebsiteDataStore.h in Headers */,
</span><span class="cx">                                 75A8D2D6187D1C0E00C39C9E /* WKWebsiteDataStoreInternal.h in Headers */,
</span><span class="cx">                                 1AE2867A1C7F7BA60069AC4F /* WKWebsiteDataStorePrivate.h in Headers */,
</span><ins>+                                5CD286551E7235B80094FDC8 /* WKContentExtensionInternal.h in Headers */,
</ins><span class="cx">                                 1A57109F1ABA0027002FABBE /* WKWebsiteDataStoreRef.h in Headers */,
</span><span class="cx">                                 5C9E56831DF7F1B300C9EE33 /* WKWebsitePolicies.h in Headers */,
</span><span class="cx">                                 1A3CC16718906ACF001E6ED8 /* WKWebView.h in Headers */,
</span><span class="lines">@@ -9579,8 +9609,8 @@
</span><span class="cx">                                 1AFDE6611954E9B100C48FFA /* APISessionState.cpp in Sources */,
</span><span class="cx">                                 BCE2315E122C30CA00D5C35A /* APIURLRequest.cpp in Sources */,
</span><span class="cx">                                 BC90A1D3122DD55E00CC8C50 /* APIURLResponse.cpp in Sources */,
</span><del>-                                7C89D2B31A6B068C003A5FDE /* APIUserContentExtension.cpp in Sources */,
-                                7C3A06A71AAB903E009D74BA /* APIUserContentExtensionStore.cpp in Sources */,
</del><ins>+                                7C89D2B31A6B068C003A5FDE /* APIContentExtension.cpp in Sources */,
+                                7C3A06A71AAB903E009D74BA /* APIContentExtensionStore.cpp in Sources */,
</ins><span class="cx">                                 7CEFA9621AC0999300B910FD /* APIUserContentExtensionStoreCocoa.mm in Sources */,
</span><span class="cx">                                 7C882DFE1C7E99AC006BF731 /* APIUserContentWorld.cpp in Sources */,
</span><span class="cx">                                 7C89D2A61A6789EA003A5FDE /* APIUserScript.cpp in Sources */,
</span><span class="lines">@@ -9979,6 +10009,7 @@
</span><span class="cx">                                 BC82839916B48DC000A278FE /* WebContentServiceEntryPoint.mm in Sources */,
</span><span class="cx">                                 31A505F91680025500A930EB /* WebContextClient.cpp in Sources */,
</span><span class="cx">                                 BC09B8F8147460F7005F5625 /* WebContextConnectionClient.cpp in Sources */,
</span><ins>+                                5CD286561E7235C60094FDC8 /* WKContentExtensionStore.mm in Sources */,
</ins><span class="cx">                                 BCDE059C11CDA8AE00E41AF1 /* WebContextInjectedBundleClient.cpp in Sources */,
</span><span class="cx">                                 51871B5B127CB89D00F76232 /* WebContextMenu.cpp in Sources */,
</span><span class="cx">                                 BC111A5B112F4FBB00337BAB /* WebContextMenuClient.cpp in Sources */,
</span><span class="lines">@@ -10391,6 +10422,7 @@
</span><span class="cx">                                 1AA2E56618D77508003814BD /* WKWebProcessBundleParameters.mm in Sources */,
</span><span class="cx">                                 BC989D81161A7E5D000D46D3 /* WKWebProcessPlugIn.mm in Sources */,
</span><span class="cx">                                 BC8F2F2A16273A2C005FACB5 /* WKWebProcessPlugInBrowserContextController.mm in Sources */,
</span><ins>+                                5CD286521E7235A60094FDC8 /* WKContentExtension.mm in Sources */,
</ins><span class="cx">                                 1F7506AD1859161C00EC0FF7 /* WKWebProcessPlugInFrame.mm in Sources */,
</span><span class="cx">                                 1F7506AE1859162200EC0FF7 /* WKWebProcessPlugInHitTestResult.mm in Sources */,
</span><span class="cx">                                 1F7506AF1859162800EC0FF7 /* WKWebProcessPlugInNodeHandle.mm in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessUserContentWebUserContentControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -339,22 +339,22 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CONTENT_EXTENSIONS)
</span><del>-void WebUserContentController::addUserContentExtensions(const Vector&lt;std::pair&lt;String, WebCompiledContentExtensionData&gt;&gt;&amp; userContentExtensions)
</del><ins>+void WebUserContentController::addContentExtensions(const Vector&lt;std::pair&lt;String, WebCompiledContentExtensionData&gt;&gt;&amp; contentExtensions)
</ins><span class="cx"> {
</span><del>-    for (const auto&amp; userContentExtension : userContentExtensions) {
-        WebCompiledContentExtensionData contentExtensionData = userContentExtension.second;
</del><ins>+    for (const auto&amp; contentExtension : contentExtensions) {
+        WebCompiledContentExtensionData contentExtensionData = contentExtension.second;
</ins><span class="cx">         RefPtr&lt;WebCompiledContentExtension&gt; compiledContentExtension = WebCompiledContentExtension::create(WTFMove(contentExtensionData));
</span><span class="cx"> 
</span><del>-        m_contentExtensionBackend.addContentExtension(userContentExtension.first, WTFMove(compiledContentExtension));
</del><ins>+        m_contentExtensionBackend.addContentExtension(contentExtension.first, WTFMove(compiledContentExtension));
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebUserContentController::removeUserContentExtension(const String&amp; name)
</del><ins>+void WebUserContentController::removeContentExtension(const String&amp; name)
</ins><span class="cx"> {
</span><span class="cx">     m_contentExtensionBackend.removeContentExtension(name);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebUserContentController::removeAllUserContentExtensions()
</del><ins>+void WebUserContentController::removeAllContentExtensions()
</ins><span class="cx"> {
</span><span class="cx">     m_contentExtensionBackend.removeAllContentExtensions();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessUserContentWebUserContentControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.h (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.h        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.h        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -23,8 +23,7 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef WebUserContentController_h
-#define WebUserContentController_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;MessageReceiver.h&quot;
</span><span class="cx"> #include &quot;WebScriptMessageHandler.h&quot;
</span><span class="lines">@@ -95,9 +94,9 @@
</span><span class="cx">     void removeAllUserScriptMessageHandlers(const Vector&lt;uint64_t&gt;&amp;);
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CONTENT_EXTENSIONS)
</span><del>-    void addUserContentExtensions(const Vector&lt;std::pair&lt;String, WebCompiledContentExtensionData&gt;&gt;&amp;);
-    void removeUserContentExtension(const String&amp; name);
-    void removeAllUserContentExtensions();
</del><ins>+    void addContentExtensions(const Vector&lt;std::pair&lt;String, WebCompiledContentExtensionData&gt;&gt;&amp;);
+    void removeContentExtension(const String&amp; name);
+    void removeAllContentExtensions();
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     void addUserScriptInternal(InjectedBundleScriptWorld&amp;, uint64_t userScriptIdentifier, WebCore::UserScript&amp;&amp;);
</span><span class="lines">@@ -128,5 +127,3 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span><del>-
-#endif // WebUserContentController_h
</del></span></pre></div>
<a id="trunkSourceWebKit2WebProcessUserContentWebUserContentControllermessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.messages.in (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.messages.in        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.messages.in        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -40,8 +40,8 @@
</span><span class="cx">     RemoveAllUserScriptMessageHandlers(Vector&lt;uint64_t&gt; worldIdentifiers);
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CONTENT_EXTENSIONS)
</span><del>-    AddUserContentExtensions(Vector&lt;std::pair&lt;String, WebKit::WebCompiledContentExtensionData&gt;&gt; userContentFilters);
-    RemoveUserContentExtension(String name);
-    RemoveAllUserContentExtensions();
</del><ins>+    AddContentExtensions(Vector&lt;std::pair&lt;String, WebKit::WebCompiledContentExtensionData&gt;&gt; contentFilters);
+    RemoveContentExtension(String name);
+    RemoveAllContentExtensions();
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportmacWebErrorsMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -85,7 +85,7 @@
</span><span class="cx"> #if ENABLE(CONTENT_FILTERING)
</span><span class="cx"> ResourceError blockedByContentFilterError(const ResourceRequest&amp; request)
</span><span class="cx"> {
</span><del>-    return ResourceError(API::Error::webKitErrorDomain(), kWKErrorCodeFrameLoadBlockedByContentFilter, request.url(), WEB_UI_STRING(&quot;The URL was blocked by a content filter&quot;, &quot;WebKitErrorBlockedByContentFilter&quot;));
</del><ins>+    return ResourceError(API::Error::webKitErrorDomain(), kWKErrorCodeFrameLoadBlockedByContentFilter, request.url(), WEB_UI_STRING(&quot;The URL was blocked by a content filter&quot;, &quot;WebKitErrorFrameLoadBlockedByContentFilter description&quot;));
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Tools/ChangeLog        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2017-03-09  Brian Nicholson  &lt;bnicholson@mozilla.com&gt; and Alex Christensen  &lt;achristensen@webkit.org&gt;
+
+        Expose public APIs for content filters
+        https://bugs.webkit.org/show_bug.cgi?id=150479
+
+        Reviewed by Brady Eidson and Geoff Garen.
+
+        Keep the existing tests to verify that I made the wrapper classes for the old SPI work correctly.
+        Add new identical tests for the new API are added with the new names.
+        We should keep both until we migrate from and remove the old SPI.
+        Enum error code values and strings have changed, but the API is source compatible.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKit2Cocoa/WKUserContentExtensionStore.mm: Copied from Tools/TestWebKitAPI/Tests/WebKit2Cocoa/_WKUserContentExtensionStore.mm.
+        (WKUserContentExtensionStoreTest::SetUp):
+        (TEST_F):
+        (checkDomain):
+        (_WKUserContentExtensionStoreTest::SetUp): Deleted.
+        * TestWebKitAPI/Tests/WebKit2Cocoa/_WKUserContentExtensionStore.mm:
+        (checkDomain):
+
</ins><span class="cx"> 2017-03-09  Daniel Bates  &lt;dabates@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Attempt to fix the WebKit2 test bots following &lt;https://trac.webkit.org/changeset/213676&gt;
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (213695 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2017-03-10 01:27:32 UTC (rev 213695)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -189,6 +189,7 @@
</span><span class="cx">                 5C9E59411D3EB5AC00E3C62E /* ApplicationCache.db in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5C9E593E1D3EB1DE00E3C62E /* ApplicationCache.db */; };
</span><span class="cx">                 5C9E59421D3EB5AC00E3C62E /* ApplicationCache.db-shm in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5C9E593F1D3EB1DE00E3C62E /* ApplicationCache.db-shm */; };
</span><span class="cx">                 5C9E59431D3EB5AC00E3C62E /* ApplicationCache.db-wal in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5C9E59401D3EB1DE00E3C62E /* ApplicationCache.db-wal */; };
</span><ins>+                5CE354D91E70DA5C00BEFE3B /* WKUserContentExtensionStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CE354D81E70D9C300BEFE3B /* WKUserContentExtensionStore.mm */; };
</ins><span class="cx">                 5E4B1D2E1D404C6100053621 /* WKScrollViewDelegateCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5E4B1D2C1D404C6100053621 /* WKScrollViewDelegateCrash.mm */; };
</span><span class="cx">                 6BFD294C1D5E6C1D008EC968 /* HashCountedSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A38D7E51C752D5F004F157D /* HashCountedSet.cpp */; };
</span><span class="cx">                 755A20AF1E6E38630093C69F /* DatabaseTrackerTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 755A20AE1E6E38630093C69F /* DatabaseTrackerTest.cpp */; };
</span><span class="lines">@@ -1092,6 +1093,7 @@
</span><span class="cx">                 5C9E593E1D3EB1DE00E3C62E /* ApplicationCache.db */ = {isa = PBXFileReference; lastKnownFileType = file; path = ApplicationCache.db; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5C9E593F1D3EB1DE00E3C62E /* ApplicationCache.db-shm */ = {isa = PBXFileReference; lastKnownFileType = file; path = &quot;ApplicationCache.db-shm&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5C9E59401D3EB1DE00E3C62E /* ApplicationCache.db-wal */ = {isa = PBXFileReference; lastKnownFileType = file; path = &quot;ApplicationCache.db-wal&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                5CE354D81E70D9C300BEFE3B /* WKUserContentExtensionStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKUserContentExtensionStore.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 5E4B1D2C1D404C6100053621 /* WKScrollViewDelegateCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKScrollViewDelegateCrash.mm; path = ../ios/WKScrollViewDelegateCrash.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 755A20AE1E6E38630093C69F /* DatabaseTrackerTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DatabaseTrackerTest.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7560917719259C59009EF06E /* MemoryCacheAddImageToCacheIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MemoryCacheAddImageToCacheIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -1648,6 +1650,7 @@
</span><span class="cx">                                 37B47E2E1D64E7CA005F4EFF /* WKObject.mm */,
</span><span class="cx">                                 2D00065D1C1F58940088E6A7 /* WKPDFViewResizeCrash.mm */,
</span><span class="cx">                                 5E4B1D2C1D404C6100053621 /* WKScrollViewDelegateCrash.mm */,
</span><ins>+                                5CE354D81E70D9C300BEFE3B /* WKUserContentExtensionStore.mm */,
</ins><span class="cx">                                 2EFF06D61D8AF34A0004BB30 /* WKWebViewCandidateTests.mm */,
</span><span class="cx">                                 7C417F311D19E14800B8EF53 /* WKWebViewDefaultNavigationDelegate.mm */,
</span><span class="cx">                                 0F3B94A51A77266C00DE3272 /* WKWebViewEvaluateJavaScript.mm */,
</span><span class="lines">@@ -2918,6 +2921,7 @@
</span><span class="cx">                                 7CCE7F1E1A411AE600447C4C /* WKStringJSString.cpp in Sources */,
</span><span class="cx">                                 A14FC5851B89739100D107EB /* WKWebViewConfigurationExtras.mm in Sources */,
</span><span class="cx">                                 7C417F331D19E14800B8EF53 /* WKWebViewDefaultNavigationDelegate.mm in Sources */,
</span><ins>+                                5CE354D91E70DA5C00BEFE3B /* WKUserContentExtensionStore.mm in Sources */,
</ins><span class="cx">                                 0F3B94A71A77267400DE3272 /* WKWebViewEvaluateJavaScript.mm in Sources */,
</span><span class="cx">                                 9984FACC1CFFAF60008D198C /* WKWebViewTextInput.mm in Sources */,
</span><span class="cx">                                 764322D71B61CCC30024F801 /* WordBoundaryTypingAttributes.mm in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2CocoaWKUserContentExtensionStoremmfromrev213687trunkToolsTestWebKitAPITestsWebKit2Cocoa_WKUserContentExtensionStoremm"></a>
<div class="copfile"><h4>Copied: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKUserContentExtensionStore.mm (from rev 213687, trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/_WKUserContentExtensionStore.mm) (0 => 213696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKUserContentExtensionStore.mm                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKUserContentExtensionStore.mm        2017-03-10 01:48:30 UTC (rev 213696)
</span><span class="lines">@@ -0,0 +1,186 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import &quot;config.h&quot;
+#import &lt;WebKit/WKFoundation.h&gt;
+
+#if WK_API_ENABLED
+
+#import &quot;PlatformUtilities.h&quot;
+#import &quot;Test.h&quot;
+#import &lt;WebKit/WKContentExtensionStorePrivate.h&gt;
+#import &lt;wtf/RetainPtr.h&gt;
+
+class WKContentExtensionStoreTest : public testing::Test {
+public:
+    virtual void SetUp()
+    {
+        [[WKContentExtensionStore defaultStore] _removeAllContentExtensions];
+    }
+};
+
+static NSString *basicFilter = @&quot;[{\&quot;action\&quot;:{\&quot;type\&quot;:\&quot;block\&quot;},\&quot;trigger\&quot;:{\&quot;url-filter\&quot;:\&quot;.*webkit.org\&quot;}}]&quot;;
+
+TEST_F(WKContentExtensionStoreTest, Compile)
+{
+    __block bool doneCompiling = false;
+    [[WKContentExtensionStore defaultStore] compileContentExtensionForIdentifier:@&quot;TestExtension&quot; encodedContentExtension:basicFilter completionHandler:^(WKContentExtension *filter, NSError *error) {
+    
+        EXPECT_NOT_NULL(filter);
+        EXPECT_NULL(error);
+
+        doneCompiling = true;
+    }];
+    TestWebKitAPI::Util::run(&amp;doneCompiling);
+}
+
+static NSString *invalidFilter = @&quot;[&quot;;
+
+static void checkDomain(NSError *error)
+{
+    EXPECT_STREQ([[error domain] UTF8String], [WKErrorDomain UTF8String]);
+}
+
+TEST_F(WKContentExtensionStoreTest, InvalidExtension)
+{
+    __block bool doneCompiling = false;
+    [[WKContentExtensionStore defaultStore] compileContentExtensionForIdentifier:@&quot;TestExtension&quot; encodedContentExtension:invalidFilter completionHandler:^(WKContentExtension *filter, NSError *error) {
+    
+        EXPECT_NULL(filter);
+        EXPECT_NOT_NULL(error);
+        checkDomain(error);
+        EXPECT_EQ(error.code, WKErrorContentExtensionStoreCompileFailed);
+        EXPECT_STREQ(&quot;Extension compilation failed: Failed to parse the JSON String.&quot;, [[error helpAnchor] UTF8String]);
+
+        doneCompiling = true;
+    }];
+    TestWebKitAPI::Util::run(&amp;doneCompiling);
+}
+
+TEST_F(WKContentExtensionStoreTest, Lookup)
+{
+    __block bool doneCompiling = false;
+    [[WKContentExtensionStore defaultStore] compileContentExtensionForIdentifier:@&quot;TestExtension&quot; encodedContentExtension:basicFilter completionHandler:^(WKContentExtension *filter, NSError *error) {
+    
+        EXPECT_NOT_NULL(filter);
+        EXPECT_NULL(error);
+
+        doneCompiling = true;
+    }];
+    TestWebKitAPI::Util::run(&amp;doneCompiling);
+
+    __block bool doneLookingUp = false;
+    [[WKContentExtensionStore defaultStore] lookupContentExtensionForIdentifier:@&quot;TestExtension&quot; completionHandler:^(WKContentExtension *filter, NSError *error) {
+    
+        EXPECT_NOT_NULL(filter);
+        EXPECT_NULL(error);
+
+        doneLookingUp = true;
+    }];
+    TestWebKitAPI::Util::run(&amp;doneLookingUp);
+}
+
+TEST_F(WKContentExtensionStoreTest, NonExistingIdentifierLookup)
+{
+    __block bool doneLookingUp = false;
+    [[WKContentExtensionStore defaultStore] lookupContentExtensionForIdentifier:@&quot;DoesNotExist&quot; completionHandler:^(WKContentExtension *filter, NSError *error) {
+    
+        EXPECT_NULL(filter);
+        EXPECT_NOT_NULL(error);
+        checkDomain(error);
+        EXPECT_EQ(error.code, WKErrorContentExtensionStoreLookupFailed);
+        EXPECT_STREQ(&quot;Extension lookup failed: Unspecified error during lookup.&quot;, [[error helpAnchor] UTF8String]);
+        
+        doneLookingUp = true;
+    }];
+    TestWebKitAPI::Util::run(&amp;doneLookingUp);
+}
+
+TEST_F(WKContentExtensionStoreTest, VersionMismatch)
+{
+    __block bool doneCompiling = false;
+    [[WKContentExtensionStore defaultStore] compileContentExtensionForIdentifier:@&quot;TestExtension&quot; encodedContentExtension:basicFilter completionHandler:^(WKContentExtension *filter, NSError *error)
+    {
+        
+        EXPECT_NOT_NULL(filter);
+        EXPECT_NULL(error);
+        
+        doneCompiling = true;
+    }];
+    TestWebKitAPI::Util::run(&amp;doneCompiling);
+
+    [[WKContentExtensionStore defaultStore] _invalidateContentExtensionVersionForIdentifier:@&quot;TestExtension&quot;];
+    
+    __block bool doneLookingUp = false;
+    [[WKContentExtensionStore defaultStore] lookupContentExtensionForIdentifier:@&quot;TestExtension&quot; completionHandler:^(WKContentExtension *filter, NSError *error)
+    {
+        
+        EXPECT_NULL(filter);
+        EXPECT_NOT_NULL(error);
+        checkDomain(error);
+        EXPECT_EQ(error.code, WKErrorContentExtensionStoreVersionMismatch);
+        EXPECT_STREQ(&quot;Extension lookup failed: Version of file does not match version of interpreter.&quot;, [[error helpAnchor] UTF8String]);
+        
+        doneLookingUp = true;
+    }];
+    TestWebKitAPI::Util::run(&amp;doneLookingUp);
+}
+
+TEST_F(WKContentExtensionStoreTest, Removal)
+{
+    __block bool doneCompiling = false;
+    [[WKContentExtensionStore defaultStore] compileContentExtensionForIdentifier:@&quot;TestExtension&quot; encodedContentExtension:basicFilter completionHandler:^(WKContentExtension *filter, NSError *error) {
+    
+        EXPECT_NOT_NULL(filter);
+        EXPECT_NULL(error);
+
+        doneCompiling = true;
+    }];
+    TestWebKitAPI::Util::run(&amp;doneCompiling);
+
+    __block bool doneRemoving = false;
+    [[WKContentExtensionStore defaultStore] removeContentExtensionForIdentifier:@&quot;TestExtension&quot; completionHandler:^(NSError *error) {
+        EXPECT_NULL(error);
+
+        doneRemoving = true;
+    }];
+    TestWebKitAPI::Util::run(&amp;doneRemoving);
+}
+
+TEST_F(WKContentExtensionStoreTest, NonExistingIdentifierRemove)
+{
+    __block bool doneRemoving = false;
+    [[WKContentExtensionStore defaultStore] removeContentExtensionForIdentifier:@&quot;DoesNotExist&quot; completionHandler:^(NSError *error) {
+        EXPECT_NOT_NULL(error);
+        checkDomain(error);
+        EXPECT_EQ(error.code, WKErrorContentExtensionStoreRemoveFailed);
+        EXPECT_STREQ(&quot;Extension removal failed: Unspecified error during remove.&quot;, [[error helpAnchor] UTF8String]);
+
+        doneRemoving = true;
+    }];
+    TestWebKitAPI::Util::run(&amp;doneRemoving);
+}
+
+#endif
</ins></span></pre>
</div>
</div>

</body>
</html>