<!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>[178151] trunk/Source</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/178151">178151</a></dd>
<dt>Author</dt> <dd>benjamin@webkit.org</dd>
<dt>Date</dt> <dd>2015-01-08 17:56:00 -0800 (Thu, 08 Jan 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[WK2] Start a prototype for declarative site specific extensions
https://bugs.webkit.org/show_bug.cgi?id=140160

Reviewed by Andreas Kling.

Source/WebCore:

Currently, clients have various ways to execute custom code for certain URLs.
Each of those mechanism implies messaging the UIProcess, executing some code
calling back to the WebProcess, then actually load the resource.
All this back and forth introduces delays before we actually load resources.

Since the set of actions is done per site is actually simple and limited,
it may be possible to do everything in WebCore and shortcut the defered loading.

This patch provides the starting point for this idea. The &quot;rules&quot; (currently just blocking)
are be passed to WebCore in a JSON format. In WebCore, we create a state
machine to match the rules and we execute the action when the state machine tells
us to.

* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:
* contentextensions/ContentExtensionRule.cpp: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h.
(WebCore::ContentExtensions::ContentExtensionRule::ContentExtensionRule):
* contentextensions/ContentExtensionRule.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h.
(WebCore::ContentExtensions::ContentExtensionRule::trigger):
(WebCore::ContentExtensions::ContentExtensionRule::action):
* contentextensions/ContentExtensionsBackend.cpp: Added.
(WebCore::ContentExtensions::ContentExtensionsBackend::sharedInstance):
(WebCore::ContentExtensions::ContentExtensionsBackend::setRuleList):
(WebCore::ContentExtensions::ContentExtensionsBackend::removeRuleList):
(WebCore::ContentExtensions::ContentExtensionsBackend::shouldBlockURL):
* contentextensions/ContentExtensionsBackend.h: Added.
* contentextensions/ContentExtensionsInterface.cpp: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h.
(WebCore::ContentExtensions::shouldBlockURL):
* contentextensions/ContentExtensionsInterface.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h.
* contentextensions/ContentExtensionsManager.cpp: Added.
(WebCore::ContentExtensions::ExtensionsManager::loadTrigger):
(WebCore::ContentExtensions::ExtensionsManager::loadAction):
(WebCore::ContentExtensions::ExtensionsManager::loadRule):
(WebCore::ContentExtensions::ExtensionsManager::loadExtension):
* contentextensions/ContentExtensionsManager.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h.
* contentextensions/DFA.cpp: Added.
(WebCore::ContentExtensions::DFA::DFA):
(WebCore::ContentExtensions::DFA::operator=):
(WebCore::ContentExtensions::DFA::nextState):
(WebCore::ContentExtensions::DFA::actions):
(WebCore::ContentExtensions::DFA::debugPrintDot):
* contentextensions/DFA.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h.
(WebCore::ContentExtensions::DFA::root):
* contentextensions/DFANode.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h.
* contentextensions/NFA.cpp: Added.
(WebCore::ContentExtensions::NFA::NFA):
(WebCore::ContentExtensions::NFA::createNode):
(WebCore::ContentExtensions::NFA::addTransition):
(WebCore::ContentExtensions::NFA::addEpsilonTransition):
(WebCore::ContentExtensions::NFA::setFinal):
(WebCore::ContentExtensions::NFA::debugPrintDot):
* contentextensions/NFA.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h.
(WebCore::ContentExtensions::NFA::root):
* contentextensions/NFANode.cpp: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h.
(WebCore::ContentExtensions::NFANode::NFANode):
* contentextensions/NFANode.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h.
* contentextensions/NFAToDFA.cpp: Added.
(WebCore::ContentExtensions::epsilonClosure):
(WebCore::ContentExtensions::setTransitionsExcludingEpsilon):
(WebCore::ContentExtensions::HashableNodeIdSet::HashableNodeIdSet):
(WebCore::ContentExtensions::HashableNodeIdSet::operator=):
(WebCore::ContentExtensions::HashableNodeIdSet::isEmptyValue):
(WebCore::ContentExtensions::HashableNodeIdSet::isDeletedValue):
(WebCore::ContentExtensions::HashableNodeIdSet::nodeIdSet):
(WebCore::ContentExtensions::HashableNodeIdSetHash::hash):
(WebCore::ContentExtensions::HashableNodeIdSetHash::equal):
(WebCore::ContentExtensions::addDFAState):
(WebCore::ContentExtensions::NFAToDFA::convert):
* contentextensions/NFAToDFA.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h.
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource):

Source/WebKit2:

Provide a small SPI for OS X. This will likely move
to a better place.

* UIProcess/API/Cocoa/WKProcessPool.mm:
(-[WKProcessPool _loadContentExtensionWithIdentifier:serializedRules:successCompletionHandler:errorCompletionHandler:]):
* UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::processDidFinishLaunching):
(WebKit::WebProcessPool::loadContentExtension):
* UIProcess/WebProcessPool.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::loadContentExtension):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:

Source/WTF:

* wtf/FeatureDefines.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfFeatureDefinesh">trunk/Source/WTF/wtf/FeatureDefines.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourceLoadercpp">trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKProcessPoolmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKProcessPoolPrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebProcessPoolcpp">trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebProcessPoolh">trunk/Source/WebKit2/UIProcess/WebProcessPool.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebProcesscpp">trunk/Source/WebKit2/WebProcess/WebProcess.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebProcessh">trunk/Source/WebKit2/WebProcess/WebProcess.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebProcessmessagesin">trunk/Source/WebKit2/WebProcess/WebProcess.messages.in</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/Source/WebCore/contentextensions/</li>
<li><a href="#trunkSourceWebCorecontentextensionsContentExtensionRulecpp">trunk/Source/WebCore/contentextensions/ContentExtensionRule.cpp</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsContentExtensionRuleh">trunk/Source/WebCore/contentextensions/ContentExtensionRule.h</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsContentExtensionsBackendcpp">trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsContentExtensionsBackendh">trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.h</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsContentExtensionsInterfacecpp">trunk/Source/WebCore/contentextensions/ContentExtensionsInterface.cpp</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsContentExtensionsInterfaceh">trunk/Source/WebCore/contentextensions/ContentExtensionsInterface.h</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsContentExtensionsManagercpp">trunk/Source/WebCore/contentextensions/ContentExtensionsManager.cpp</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsContentExtensionsManagerh">trunk/Source/WebCore/contentextensions/ContentExtensionsManager.h</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsDFAcpp">trunk/Source/WebCore/contentextensions/DFA.cpp</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsDFAh">trunk/Source/WebCore/contentextensions/DFA.h</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsDFANodeh">trunk/Source/WebCore/contentextensions/DFANode.h</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsNFAcpp">trunk/Source/WebCore/contentextensions/NFA.cpp</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsNFAh">trunk/Source/WebCore/contentextensions/NFA.h</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsNFANodecpp">trunk/Source/WebCore/contentextensions/NFANode.cpp</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsNFANodeh">trunk/Source/WebCore/contentextensions/NFANode.h</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsNFAToDFAcpp">trunk/Source/WebCore/contentextensions/NFAToDFA.cpp</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsNFAToDFAh">trunk/Source/WebCore/contentextensions/NFAToDFA.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (178150 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2015-01-09 01:50:41 UTC (rev 178150)
+++ trunk/Source/WTF/ChangeLog        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2015-01-08  Benjamin Poulain  &lt;benjamin@webkit.org&gt;
+
+        [WK2] Start a prototype for declarative site specific extensions
+        https://bugs.webkit.org/show_bug.cgi?id=140160
+
+        Reviewed by Andreas Kling.
+
+        * wtf/FeatureDefines.h:
+
</ins><span class="cx"> 2015-01-07  Daniel Bates  &lt;dabates@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] Make WebKit2 build with public iOS SDK and more build fixes for DRT
</span></span></pre></div>
<a id="trunkSourceWTFwtfFeatureDefinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/FeatureDefines.h (178150 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/FeatureDefines.h        2015-01-09 01:50:41 UTC (rev 178150)
+++ trunk/Source/WTF/wtf/FeatureDefines.h        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -58,6 +58,10 @@
</span><span class="cx"> #define ENABLE_ASYNC_SCROLLING 1
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if !defined(ENABLE_CONTENT_EXTENSIONS)
+#define ENABLE_CONTENT_EXTENSIONS 1
+#endif
+
</ins><span class="cx"> #if !defined(ENABLE_CONTEXT_MENUS)
</span><span class="cx"> #define ENABLE_CONTEXT_MENUS 0
</span><span class="cx"> #endif
</span><span class="lines">@@ -167,6 +171,10 @@
</span><span class="cx"> /* --------- Apple MAC port (not IOS) --------- */
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> 
</span><ins>+#if !defined(ENABLE_CONTENT_EXTENSIONS)
+#define ENABLE_CONTENT_EXTENSIONS 1
+#endif
+
</ins><span class="cx"> #if !defined(ENABLE_CSS_IMAGE_SET)
</span><span class="cx"> #define ENABLE_CSS_IMAGE_SET 1
</span><span class="cx"> #endif
</span><span class="lines">@@ -329,6 +337,10 @@
</span><span class="cx"> #define ENABLE_CHANNEL_MESSAGING 1
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if !defined(ENABLE_CONTENT_EXTENSIONS)
+#define ENABLE_CONTENT_EXTENSIONS 0
+#endif
+
</ins><span class="cx"> #if !defined(ENABLE_CONTEXT_MENUS)
</span><span class="cx"> #define ENABLE_CONTEXT_MENUS 1
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (178150 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-01-09 01:50:41 UTC (rev 178150)
+++ trunk/Source/WebCore/ChangeLog        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -1,3 +1,82 @@
</span><ins>+2015-01-08  Benjamin Poulain  &lt;benjamin@webkit.org&gt;
+
+        [WK2] Start a prototype for declarative site specific extensions
+        https://bugs.webkit.org/show_bug.cgi?id=140160
+
+        Reviewed by Andreas Kling.
+
+        Currently, clients have various ways to execute custom code for certain URLs.
+        Each of those mechanism implies messaging the UIProcess, executing some code
+        calling back to the WebProcess, then actually load the resource.
+        All this back and forth introduces delays before we actually load resources.
+
+        Since the set of actions is done per site is actually simple and limited,
+        it may be possible to do everything in WebCore and shortcut the defered loading.
+
+        This patch provides the starting point for this idea. The &quot;rules&quot; (currently just blocking)
+        are be passed to WebCore in a JSON format. In WebCore, we create a state
+        machine to match the rules and we execute the action when the state machine tells
+        us to.
+
+        * WebCore.exp.in:
+        * WebCore.xcodeproj/project.pbxproj:
+        * contentextensions/ContentExtensionRule.cpp: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h.
+        (WebCore::ContentExtensions::ContentExtensionRule::ContentExtensionRule):
+        * contentextensions/ContentExtensionRule.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h.
+        (WebCore::ContentExtensions::ContentExtensionRule::trigger):
+        (WebCore::ContentExtensions::ContentExtensionRule::action):
+        * contentextensions/ContentExtensionsBackend.cpp: Added.
+        (WebCore::ContentExtensions::ContentExtensionsBackend::sharedInstance):
+        (WebCore::ContentExtensions::ContentExtensionsBackend::setRuleList):
+        (WebCore::ContentExtensions::ContentExtensionsBackend::removeRuleList):
+        (WebCore::ContentExtensions::ContentExtensionsBackend::shouldBlockURL):
+        * contentextensions/ContentExtensionsBackend.h: Added.
+        * contentextensions/ContentExtensionsInterface.cpp: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h.
+        (WebCore::ContentExtensions::shouldBlockURL):
+        * contentextensions/ContentExtensionsInterface.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h.
+        * contentextensions/ContentExtensionsManager.cpp: Added.
+        (WebCore::ContentExtensions::ExtensionsManager::loadTrigger):
+        (WebCore::ContentExtensions::ExtensionsManager::loadAction):
+        (WebCore::ContentExtensions::ExtensionsManager::loadRule):
+        (WebCore::ContentExtensions::ExtensionsManager::loadExtension):
+        * contentextensions/ContentExtensionsManager.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h.
+        * contentextensions/DFA.cpp: Added.
+        (WebCore::ContentExtensions::DFA::DFA):
+        (WebCore::ContentExtensions::DFA::operator=):
+        (WebCore::ContentExtensions::DFA::nextState):
+        (WebCore::ContentExtensions::DFA::actions):
+        (WebCore::ContentExtensions::DFA::debugPrintDot):
+        * contentextensions/DFA.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h.
+        (WebCore::ContentExtensions::DFA::root):
+        * contentextensions/DFANode.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h.
+        * contentextensions/NFA.cpp: Added.
+        (WebCore::ContentExtensions::NFA::NFA):
+        (WebCore::ContentExtensions::NFA::createNode):
+        (WebCore::ContentExtensions::NFA::addTransition):
+        (WebCore::ContentExtensions::NFA::addEpsilonTransition):
+        (WebCore::ContentExtensions::NFA::setFinal):
+        (WebCore::ContentExtensions::NFA::debugPrintDot):
+        * contentextensions/NFA.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h.
+        (WebCore::ContentExtensions::NFA::root):
+        * contentextensions/NFANode.cpp: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h.
+        (WebCore::ContentExtensions::NFANode::NFANode):
+        * contentextensions/NFANode.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h.
+        * contentextensions/NFAToDFA.cpp: Added.
+        (WebCore::ContentExtensions::epsilonClosure):
+        (WebCore::ContentExtensions::setTransitionsExcludingEpsilon):
+        (WebCore::ContentExtensions::HashableNodeIdSet::HashableNodeIdSet):
+        (WebCore::ContentExtensions::HashableNodeIdSet::operator=):
+        (WebCore::ContentExtensions::HashableNodeIdSet::isEmptyValue):
+        (WebCore::ContentExtensions::HashableNodeIdSet::isDeletedValue):
+        (WebCore::ContentExtensions::HashableNodeIdSet::nodeIdSet):
+        (WebCore::ContentExtensions::HashableNodeIdSetHash::hash):
+        (WebCore::ContentExtensions::HashableNodeIdSetHash::equal):
+        (WebCore::ContentExtensions::addDFAState):
+        (WebCore::ContentExtensions::NFAToDFA::convert):
+        * contentextensions/NFAToDFA.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h.
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::requestResource):
+
</ins><span class="cx"> 2015-01-08  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Make better use of the stack when compiling selectors
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (178150 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2015-01-09 01:50:41 UTC (rev 178150)
+++ trunk/Source/WebCore/WebCore.exp.in        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -3014,6 +3014,10 @@
</span><span class="cx"> __ZN7WebCore37synthesizeRedirectResponseIfNecessaryEP15NSURLConnectionP12NSURLRequestP13NSURLResponse
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(CONTENT_EXTENSIONS)
+__ZN7WebCore17ContentExtensions17ExtensionsManager13loadExtensionERKN3WTF6StringES5_
+#endif
+
</ins><span class="cx"> #if ENABLE(CONTENT_FILTERING)
</span><span class="cx"> __ZN7WebCore13ContentFilter6decodeEP17NSKeyedUnarchiverRS0_
</span><span class="cx"> __ZN7WebCore13ContentFilterC1Ev
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (178150 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-01-09 01:50:41 UTC (rev 178150)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -1023,7 +1023,16 @@
</span><span class="cx">                 265541521489B233000DFC5D /* CursorIOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2655414B1489AA2B000DFC5D /* CursorIOS.cpp */; };
</span><span class="cx">                 26601EBF14B3B9AD0012C0FE /* PlatformEventFactoryIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 26601EBD14B3B9AD0012C0FE /* PlatformEventFactoryIOS.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 26601EC014B3B9AD0012C0FE /* PlatformEventFactoryIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 26601EBE14B3B9AD0012C0FE /* PlatformEventFactoryIOS.mm */; };
</span><ins>+                267725FC1A5B3AD9003C24DD /* DFA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 267725F61A5B3AD9003C24DD /* DFA.cpp */; };
+                267725FD1A5B3AD9003C24DD /* DFA.h in Headers */ = {isa = PBXBuildFile; fileRef = 267725F71A5B3AD9003C24DD /* DFA.h */; };
+                267725FF1A5B3AD9003C24DD /* DFANode.h in Headers */ = {isa = PBXBuildFile; fileRef = 267725F91A5B3AD9003C24DD /* DFANode.h */; };
+                267726001A5B3AD9003C24DD /* NFAToDFA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 267725FA1A5B3AD9003C24DD /* NFAToDFA.cpp */; };
+                267726011A5B3AD9003C24DD /* NFAToDFA.h in Headers */ = {isa = PBXBuildFile; fileRef = 267725FB1A5B3AD9003C24DD /* NFAToDFA.h */; };
</ins><span class="cx">                 269239961505E1AA009E57FC /* JSIDBVersionChangeEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 269239921505E1AA009E57FC /* JSIDBVersionChangeEvent.h */; };
</span><ins>+                269397211A4A412F00E8349D /* NFANode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2693971F1A4A412F00E8349D /* NFANode.cpp */; };
+                269397221A4A412F00E8349D /* NFANode.h in Headers */ = {isa = PBXBuildFile; fileRef = 269397201A4A412F00E8349D /* NFANode.h */; };
+                269397241A4A5B6400E8349D /* NFA.h in Headers */ = {isa = PBXBuildFile; fileRef = 269397231A4A5B6400E8349D /* NFA.h */; };
+                269397261A4A5FBD00E8349D /* NFA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 269397251A4A5FBD00E8349D /* NFA.cpp */; };
</ins><span class="cx">                 26AA0F9E18D2A18B00419381 /* SelectorPseudoElementTypeMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26AA0F9D18D2A18B00419381 /* SelectorPseudoElementTypeMap.cpp */; };
</span><span class="cx">                 26B9998F1803AE7200D01121 /* RegisterAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = 26B9998E1803AE7200D01121 /* RegisterAllocator.h */; };
</span><span class="cx">                 26B999911803B3C900D01121 /* StackAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = 26B999901803B3C900D01121 /* StackAllocator.h */; };
</span><span class="lines">@@ -1035,6 +1044,14 @@
</span><span class="cx">                 26C17A3E1491D2D400D12BA2 /* FileSystemIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 26C17A3C1491D2D400D12BA2 /* FileSystemIOS.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 26C17A3F1491D2D400D12BA2 /* FileSystemIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 26C17A3D1491D2D400D12BA2 /* FileSystemIOS.mm */; };
</span><span class="cx">                 26E98A10130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E98A0F130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h */; };
</span><ins>+                26F0C8921A2D79CB002794F8 /* ContentExtensionsInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 26F0C8911A2D79CB002794F8 /* ContentExtensionsInterface.h */; };
+                26F0C8941A2D7A76002794F8 /* ContentExtensionsInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F0C8931A2D7A76002794F8 /* ContentExtensionsInterface.cpp */; };
+                26F0C8971A2E724B002794F8 /* ContentExtensionsManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F0C8951A2E724B002794F8 /* ContentExtensionsManager.cpp */; };
+                26F0C8981A2E724B002794F8 /* ContentExtensionsManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 26F0C8961A2E724B002794F8 /* ContentExtensionsManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                26F0C89B1A2EC110002794F8 /* ContentExtensionRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F0C8991A2EC110002794F8 /* ContentExtensionRule.cpp */; };
+                26F0C89C1A2EC110002794F8 /* ContentExtensionRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 26F0C89A1A2EC110002794F8 /* ContentExtensionRule.h */; };
+                26F0C89F1A2EC3BE002794F8 /* ContentExtensionsBackend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F0C89D1A2EC3BE002794F8 /* ContentExtensionsBackend.cpp */; };
+                26F0C8A01A2EC3BE002794F8 /* ContentExtensionsBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = 26F0C89E1A2EC3BE002794F8 /* ContentExtensionsBackend.h */; };
</ins><span class="cx">                 26F40D4A14904A6300CA67C4 /* EventLoopIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 26F40D4914904A6300CA67C4 /* EventLoopIOS.mm */; };
</span><span class="cx">                 26F9A83818A046AC00AEB88A /* ViewportConfiguration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F9A83618A046AC00AEB88A /* ViewportConfiguration.cpp */; };
</span><span class="cx">                 26F9A83918A046AC00AEB88A /* ViewportConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 26F9A83718A046AC00AEB88A /* ViewportConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -8045,8 +8062,17 @@
</span><span class="cx">                 2655414B1489AA2B000DFC5D /* CursorIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CursorIOS.cpp; path = ios/CursorIOS.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 26601EBD14B3B9AD0012C0FE /* PlatformEventFactoryIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlatformEventFactoryIOS.h; path = ios/PlatformEventFactoryIOS.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 26601EBE14B3B9AD0012C0FE /* PlatformEventFactoryIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PlatformEventFactoryIOS.mm; path = ios/PlatformEventFactoryIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                267725F61A5B3AD9003C24DD /* DFA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DFA.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                267725F71A5B3AD9003C24DD /* DFA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DFA.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                267725F91A5B3AD9003C24DD /* DFANode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DFANode.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                267725FA1A5B3AD9003C24DD /* NFAToDFA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NFAToDFA.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                267725FB1A5B3AD9003C24DD /* NFAToDFA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NFAToDFA.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 269239911505E1AA009E57FC /* JSIDBVersionChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBVersionChangeEvent.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 269239921505E1AA009E57FC /* JSIDBVersionChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBVersionChangeEvent.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                2693971F1A4A412F00E8349D /* NFANode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NFANode.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                269397201A4A412F00E8349D /* NFANode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NFANode.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                269397231A4A5B6400E8349D /* NFA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NFA.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                269397251A4A5FBD00E8349D /* NFA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NFA.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 26AA0F9918D2973D00419381 /* makeSelectorPseudoElementsMap.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = makeSelectorPseudoElementsMap.py; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 26AA0F9A18D2973D00419381 /* SelectorPseudoElementTypeMap.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = SelectorPseudoElementTypeMap.in; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 26AA0F9D18D2A18B00419381 /* SelectorPseudoElementTypeMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SelectorPseudoElementTypeMap.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -8061,6 +8087,14 @@
</span><span class="cx">                 26C17A3C1491D2D400D12BA2 /* FileSystemIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileSystemIOS.h; path = ios/FileSystemIOS.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 26C17A3D1491D2D400D12BA2 /* FileSystemIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = FileSystemIOS.mm; path = ios/FileSystemIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 26E98A0F130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextCodecASCIIFastPath.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                26F0C8911A2D79CB002794F8 /* ContentExtensionsInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentExtensionsInterface.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                26F0C8931A2D7A76002794F8 /* ContentExtensionsInterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentExtensionsInterface.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                26F0C8951A2E724B002794F8 /* ContentExtensionsManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentExtensionsManager.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                26F0C8961A2E724B002794F8 /* ContentExtensionsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentExtensionsManager.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                26F0C8991A2EC110002794F8 /* ContentExtensionRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentExtensionRule.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                26F0C89A1A2EC110002794F8 /* ContentExtensionRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentExtensionRule.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                26F0C89D1A2EC3BE002794F8 /* ContentExtensionsBackend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentExtensionsBackend.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                26F0C89E1A2EC3BE002794F8 /* ContentExtensionsBackend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentExtensionsBackend.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 26F40D4914904A6300CA67C4 /* EventLoopIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = EventLoopIOS.mm; path = ios/EventLoopIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 26F9A83618A046AC00AEB88A /* ViewportConfiguration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ViewportConfiguration.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 26F9A83718A046AC00AEB88A /* ViewportConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewportConfiguration.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -14724,6 +14758,7 @@
</span><span class="cx">                                 29A812040FBB9B4100510293 /* accessibility */,
</span><span class="cx">                                 BC1A3790097C6F970019F3D8 /* bindings */,
</span><span class="cx">                                 1A569CC40D7E2B60007C3983 /* bridge */,
</span><ins>+                                26F0C8901A2D79CB002794F8 /* contentextensions */,
</ins><span class="cx">                                 E1FF8F5B1807362B00132674 /* crypto */,
</span><span class="cx">                                 F523D18402DE42E8018635CA /* css */,
</span><span class="cx">                                 26B9998D1803ADFA00D01121 /* cssjit */,
</span><span class="lines">@@ -15370,6 +15405,30 @@
</span><span class="cx">                         name = cssjit;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="cx">                 };
</span><ins>+                26F0C8901A2D79CB002794F8 /* contentextensions */ = {
+                        isa = PBXGroup;
+                        children = (
+                                26F0C8991A2EC110002794F8 /* ContentExtensionRule.cpp */,
+                                26F0C89A1A2EC110002794F8 /* ContentExtensionRule.h */,
+                                26F0C89D1A2EC3BE002794F8 /* ContentExtensionsBackend.cpp */,
+                                26F0C89E1A2EC3BE002794F8 /* ContentExtensionsBackend.h */,
+                                26F0C8931A2D7A76002794F8 /* ContentExtensionsInterface.cpp */,
+                                26F0C8911A2D79CB002794F8 /* ContentExtensionsInterface.h */,
+                                26F0C8951A2E724B002794F8 /* ContentExtensionsManager.cpp */,
+                                26F0C8961A2E724B002794F8 /* ContentExtensionsManager.h */,
+                                267725F61A5B3AD9003C24DD /* DFA.cpp */,
+                                267725F71A5B3AD9003C24DD /* DFA.h */,
+                                267725F91A5B3AD9003C24DD /* DFANode.h */,
+                                269397251A4A5FBD00E8349D /* NFA.cpp */,
+                                269397231A4A5B6400E8349D /* NFA.h */,
+                                2693971F1A4A412F00E8349D /* NFANode.cpp */,
+                                269397201A4A412F00E8349D /* NFANode.h */,
+                                267725FA1A5B3AD9003C24DD /* NFAToDFA.cpp */,
+                                267725FB1A5B3AD9003C24DD /* NFAToDFA.h */,
+                        );
+                        path = contentextensions;
+                        sourceTree = &quot;&lt;group&gt;&quot;;
+                };
</ins><span class="cx">                 29A812040FBB9B4100510293 /* accessibility */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -23613,6 +23672,7 @@
</span><span class="cx">                                 CD318623199F1E2A0030A0F7 /* CDMPrivateMediaSourceAVFObjC.h in Headers */,
</span><span class="cx">                                 CDDD571518B57A8200A94FCB /* CDMSession.h in Headers */,
</span><span class="cx">                                 5FA904CA178E61F5004C8A2D /* CertificateInfo.h in Headers */,
</span><ins>+                                26F0C89C1A2EC110002794F8 /* ContentExtensionRule.h in Headers */,
</ins><span class="cx">                                 CE8245F019B671BA00AC0122 /* CFNetworkConnectionCacheSPI.h in Headers */,
</span><span class="cx">                                 CE12525B1A1C018200864480 /* CFNetworkSPI.h in Headers */,
</span><span class="cx">                                 E1A8E56717552B2A007488E7 /* CFURLExtras.h in Headers */,
</span><span class="lines">@@ -24058,6 +24118,7 @@
</span><span class="cx">                                 85183B440AA6926100F19FA3 /* DOMHTMLHeadingElement.h in Headers */,
</span><span class="cx">                                 85E711AE0AC5D5350053270F /* DOMHTMLHeadingElementInternal.h in Headers */,
</span><span class="cx">                                 85ECBEF10AA7626900544F0B /* DOMHTMLHRElement.h in Headers */,
</span><ins>+                                269397221A4A412F00E8349D /* NFANode.h in Headers */,
</ins><span class="cx">                                 85E711AF0AC5D5350053270F /* DOMHTMLHRElementInternal.h in Headers */,
</span><span class="cx">                                 85992EBC0AA5069500AC0785 /* DOMHTMLHtmlElement.h in Headers */,
</span><span class="cx">                                 85E711B00AC5D5350053270F /* DOMHTMLHtmlElementInternal.h in Headers */,
</span><span class="lines">@@ -24166,6 +24227,7 @@
</span><span class="cx">                                 E1284BD61044A01E00EAEB52 /* DOMPageTransitionEvent.h in Headers */,
</span><span class="cx">                                 1ACE53E80A8D18E70022947D /* DOMParser.h in Headers */,
</span><span class="cx">                                 7A54881714E432A1006AE05A /* DOMPatchSupport.h in Headers */,
</span><ins>+                                269397241A4A5B6400E8349D /* NFA.h in Headers */,
</ins><span class="cx">                                 FB91392416AE4C17001FE682 /* DOMPath.h in Headers */,
</span><span class="cx">                                 A9C6E4EC0D745E2B006442E9 /* DOMPlugin.h in Headers */,
</span><span class="cx">                                 A9C6E4F00D745E38006442E9 /* DOMPluginArray.h in Headers */,
</span><span class="lines">@@ -24688,6 +24750,7 @@
</span><span class="cx">                                 316FE1180E6E1DA700BF6088 /* ImplicitAnimation.h in Headers */,
</span><span class="cx">                                 BE961C5518AD338C00D07DC5 /* InbandDataTextTrack.h in Headers */,
</span><span class="cx">                                 BE16C59317CFE17200852C04 /* InbandGenericTextTrack.h in Headers */,
</span><ins>+                                267726011A5B3AD9003C24DD /* NFAToDFA.h in Headers */,
</ins><span class="cx">                                 07E9E12E18F5E2760011A3A4 /* InbandMetadataTextTrackPrivateAVF.h in Headers */,
</span><span class="cx">                                 07941792166E855F009416C2 /* InbandTextTrack.h in Headers */,
</span><span class="cx">                                 07941794166EA04E009416C2 /* InbandTextTrackPrivate.h in Headers */,
</span><span class="lines">@@ -25137,6 +25200,7 @@
</span><span class="cx">                                 B2FA3D570AB75A6F000E5AC4 /* JSSVGAnimationElement.h in Headers */,
</span><span class="cx">                                 B2FA3D590AB75A6F000E5AC4 /* JSSVGCircleElement.h in Headers */,
</span><span class="cx">                                 B2FA3D5B0AB75A6F000E5AC4 /* JSSVGClipPathElement.h in Headers */,
</span><ins>+                                26F0C8981A2E724B002794F8 /* ContentExtensionsManager.h in Headers */,
</ins><span class="cx">                                 B2FA3D5D0AB75A6F000E5AC4 /* JSSVGColor.h in Headers */,
</span><span class="cx">                                 B2FA3D5F0AB75A6F000E5AC4 /* JSSVGComponentTransferFunctionElement.h in Headers */,
</span><span class="cx">                                 B2FA3D610AB75A6F000E5AC4 /* JSSVGCursorElement.h in Headers */,
</span><span class="lines">@@ -25555,6 +25619,7 @@
</span><span class="cx">                                 98EB1F951313FE0500D0E1EA /* NotImplemented.h in Headers */,
</span><span class="cx">                                 1A569D0B0D7E2B82007C3983 /* NP_jsobject.h in Headers */,
</span><span class="cx">                                 1A927FD21416A15B003A83C8 /* npapi.h in Headers */,
</span><ins>+                                267725FF1A5B3AD9003C24DD /* DFANode.h in Headers */,
</ins><span class="cx">                                 1A219B3B0DCA87AB0040E3A0 /* npfunctions.h in Headers */,
</span><span class="cx">                                 1A927FD31416A15B003A83C8 /* npruntime.h in Headers */,
</span><span class="cx">                                 1A569D0F0D7E2B82007C3983 /* npruntime_impl.h in Headers */,
</span><span class="lines">@@ -25817,6 +25882,7 @@
</span><span class="cx">                                 BC1A7D9818FCB5B000421879 /* RenderMultiColumnSpannerPlaceholder.h in Headers */,
</span><span class="cx">                                 8AC822FD180FC03300FB64D5 /* RenderNamedFlowFragment.h in Headers */,
</span><span class="cx">                                 BC85F23D151915E000BC17BE /* RenderNamedFlowThread.h in Headers */,
</span><ins>+                                267725FD1A5B3AD9003C24DD /* DFA.h in Headers */,
</ins><span class="cx">                                 BCEA4880097D93020094C9E4 /* RenderObject.h in Headers */,
</span><span class="cx">                                 BCFA930810333193007B25D1 /* RenderOverflow.h in Headers */,
</span><span class="cx">                                 A43BF59D1149292800C643CA /* RenderProgress.h in Headers */,
</span><span class="lines">@@ -26363,6 +26429,7 @@
</span><span class="cx">                                 8419D2AD120D92FC00141F8F /* SVGPathByteStreamSource.h in Headers */,
</span><span class="cx">                                 8476C9EC11DF6A2900555B02 /* SVGPathConsumer.h in Headers */,
</span><span class="cx">                                 71537A01146BD9D7008BD615 /* SVGPathData.h in Headers */,
</span><ins>+                                26F0C8921A2D79CB002794F8 /* ContentExtensionsInterface.h in Headers */,
</ins><span class="cx">                                 B2227A590D00BF220071B782 /* SVGPathElement.h in Headers */,
</span><span class="cx">                                 8476C9F011DF6A5800555B02 /* SVGPathParser.h in Headers */,
</span><span class="cx">                                 B2227A5B0D00BF220071B782 /* SVGPathSeg.h in Headers */,
</span><span class="lines">@@ -26566,6 +26633,7 @@
</span><span class="cx">                                 BE88E0C21715CE2600658D98 /* TrackListBase.h in Headers */,
</span><span class="cx">                                 BE913D80181EF92400DCB09E /* TrackPrivateBase.h in Headers */,
</span><span class="cx">                                 FFAC30FE184FB145008C4F1E /* TrailingObjects.h in Headers */,
</span><ins>+                                26F0C8A01A2EC3BE002794F8 /* ContentExtensionsBackend.h in Headers */,
</ins><span class="cx">                                 49E911C40EF86D47009D0CAF /* TransformationMatrix.h in Headers */,
</span><span class="cx">                                 FB484F4D171F821E00040755 /* TransformFunctions.h in Headers */,
</span><span class="cx">                                 49E911CE0EF86D47009D0CAF /* TransformOperation.h in Headers */,
</span><span class="lines">@@ -27252,6 +27320,7 @@
</span><span class="cx">                                 FDB052DF1561A42C00B500D6 /* AudioSummingJunction.cpp in Sources */,
</span><span class="cx">                                 BE88E0D81715D2A200658D98 /* AudioTrack.cpp in Sources */,
</span><span class="cx">                                 BE88E0DB1715D2A200658D98 /* AudioTrackList.cpp in Sources */,
</span><ins>+                                267726001A5B3AD9003C24DD /* NFAToDFA.cpp in Sources */,
</ins><span class="cx">                                 CDE3A85717F6020400C5BE20 /* AudioTrackPrivateAVFObjC.mm in Sources */,
</span><span class="cx">                                 CD54A762180F9F7000B076C9 /* AudioTrackPrivateMediaSourceAVFObjC.cpp in Sources */,
</span><span class="cx">                                 FD31608A12B026F700C1A359 /* AudioUtilities.cpp in Sources */,
</span><span class="lines">@@ -27555,6 +27624,7 @@
</span><span class="cx">                                 93309DDE099E64920056E581 /* DeleteFromTextNodeCommand.cpp in Sources */,
</span><span class="cx">                                 93309DE0099E64920056E581 /* DeleteSelectionCommand.cpp in Sources */,
</span><span class="cx">                                 A7C9ABF81357A3BF00F5503F /* DetailsMarkerControl.cpp in Sources */,
</span><ins>+                                26F0C8941A2D7A76002794F8 /* ContentExtensionsInterface.cpp in Sources */,
</ins><span class="cx">                                 CCC2B51515F613060048CDD6 /* DeviceController.cpp in Sources */,
</span><span class="cx">                                 31EAF97F121435A400E7C1BF /* DeviceMotionClientIOS.mm in Sources */,
</span><span class="cx">                                 31FB1A58120A5D0600DC02A0 /* DeviceMotionController.cpp in Sources */,
</span><span class="lines">@@ -27562,6 +27632,7 @@
</span><span class="cx">                                 31FB1A5C120A5D0600DC02A0 /* DeviceMotionEvent.cpp in Sources */,
</span><span class="cx">                                 3140379E124BEA7F00AF40E4 /* DeviceOrientationClientIOS.mm in Sources */,
</span><span class="cx">                                 59309A1111F4AE5800250603 /* DeviceOrientationClientMock.cpp in Sources */,
</span><ins>+                                269397261A4A5FBD00E8349D /* NFA.cpp in Sources */,
</ins><span class="cx">                                 59A8F1D411A69508001AC34A /* DeviceOrientationController.cpp in Sources */,
</span><span class="cx">                                 59D1C10411EB5DCF00B638C8 /* DeviceOrientationData.cpp in Sources */,
</span><span class="cx">                                 59A85EA2119D68D900DEF1EF /* DeviceOrientationEvent.cpp in Sources */,
</span><span class="lines">@@ -28203,6 +28274,7 @@
</span><span class="cx">                                 A5840E1C187B74D500843B10 /* InspectorInstrumentationCookie.cpp in Sources */,
</span><span class="cx">                                 71B1E1261640491A00B1880A /* InspectorLayerTreeAgent.cpp in Sources */,
</span><span class="cx">                                 504AACCD1834455900E3D9BC /* InspectorNodeFinder.cpp in Sources */,
</span><ins>+                                26F0C89B1A2EC110002794F8 /* ContentExtensionRule.cpp in Sources */,
</ins><span class="cx">                                 7C522D4B15B477E8009B7C95 /* InspectorOverlay.cpp in Sources */,
</span><span class="cx">                                 4F6FDD641341DEDD001F8EE3 /* InspectorPageAgent.cpp in Sources */,
</span><span class="cx">                                 99CC0B6618BE9F15006CEBCC /* InspectorReplayAgent.cpp in Sources */,
</span><span class="lines">@@ -28346,6 +28418,7 @@
</span><span class="cx">                                 1ACE53DF0A8D18810022947D /* JSDOMParser.cpp in Sources */,
</span><span class="cx">                                 FB91392B16AE4FC0001FE682 /* JSDOMPath.cpp in Sources */,
</span><span class="cx">                                 A9D247FE0D757E6900FDF959 /* JSDOMPlugin.cpp in Sources */,
</span><ins>+                                26F0C8971A2E724B002794F8 /* ContentExtensionsManager.cpp in Sources */,
</ins><span class="cx">                                 A9D248000D757E6900FDF959 /* JSDOMPluginArray.cpp in Sources */,
</span><span class="cx">                                 A9C6E64C0D7465E7006442E9 /* JSDOMPluginArrayCustom.cpp in Sources */,
</span><span class="cx">                                 A9C6E64D0D7465E7006442E9 /* JSDOMPluginCustom.cpp in Sources */,
</span><span class="lines">@@ -28803,6 +28876,7 @@
</span><span class="cx">                                 B2FA3DF20AB75A6F000E5AC4 /* JSSVGScriptElement.cpp in Sources */,
</span><span class="cx">                                 B2FA3DF40AB75A6F000E5AC4 /* JSSVGSetElement.cpp in Sources */,
</span><span class="cx">                                 B2FA3DF60AB75A6F000E5AC4 /* JSSVGStopElement.cpp in Sources */,
</span><ins>+                                26F0C89F1A2EC3BE002794F8 /* ContentExtensionsBackend.cpp in Sources */,
</ins><span class="cx">                                 B2FA3DF80AB75A6F000E5AC4 /* JSSVGStringList.cpp in Sources */,
</span><span class="cx">                                 B2FA3DFA0AB75A6F000E5AC4 /* JSSVGStyleElement.cpp in Sources */,
</span><span class="cx">                                 B2FA3DFC0AB75A6F000E5AC4 /* JSSVGSVGElement.cpp in Sources */,
</span><span class="lines">@@ -29354,6 +29428,7 @@
</span><span class="cx">                                 93309E09099E64920056E581 /* ReplaceSelectionCommand.cpp in Sources */,
</span><span class="cx">                                 99CC0B5318BE9849006CEBCC /* ReplayController.cpp in Sources */,
</span><span class="cx">                                 99CC0B5518BE9849006CEBCC /* ReplayingInputCursor.cpp in Sources */,
</span><ins>+                                267725FC1A5B3AD9003C24DD /* DFA.cpp in Sources */,
</ins><span class="cx">                                 99CC0B5718BE984A006CEBCC /* ReplayInputCreationMethods.cpp in Sources */,
</span><span class="cx">                                 99CC0B5818BE984A006CEBCC /* ReplayInputDispatchMethods.cpp in Sources */,
</span><span class="cx">                                 99CC0B5918BE984A006CEBCC /* ReplaySession.cpp in Sources */,
</span><span class="lines">@@ -29781,6 +29856,7 @@
</span><span class="cx">                                 B2227A960D00BF220071B782 /* SVGPreserveAspectRatio.cpp in Sources */,
</span><span class="cx">                                 B543B85717EB758F003BE93A /* SVGPropertyInfo.cpp in Sources */,
</span><span class="cx">                                 B2227A990D00BF220071B782 /* SVGRadialGradientElement.cpp in Sources */,
</span><ins>+                                269397211A4A412F00E8349D /* NFANode.cpp in Sources */,
</ins><span class="cx">                                 B2227A9D0D00BF220071B782 /* SVGRectElement.cpp in Sources */,
</span><span class="cx">                                 BC2274780E8366E200E7F975 /* SVGRenderStyle.cpp in Sources */,
</span><span class="cx">                                 BC22747A0E8366E200E7F975 /* SVGRenderStyleDefs.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsContentExtensionRulecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/contentextensions/ContentExtensionRule.cpp (0 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/ContentExtensionRule.cpp                                (rev 0)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionRule.cpp        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+/*
+ * Copyright (C) 2014, 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;ContentExtensionRule.h&quot;
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+namespace WebCore {
+
+namespace ContentExtensions {
+
+ContentExtensionRule::ContentExtensionRule(const Trigger&amp; trigger, const Action&amp; action)
+    : m_trigger(trigger)
+    , m_action(action)
+{
+    ASSERT(!m_trigger.urlFilter.isEmpty());
+}
+
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
</ins></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsContentExtensionRuleh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/contentextensions/ContentExtensionRule.h (0 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/ContentExtensionRule.h                                (rev 0)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionRule.h        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -0,0 +1,71 @@
</span><ins>+/*
+ * Copyright (C) 2014, 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 ContentExtensionRule_h
+#define ContentExtensionRule_h
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+#include &lt;wtf/text/WTFString.h&gt;
+
+namespace WebCore {
+
+namespace ContentExtensions {
+
+enum class ExtensionActionType {
+    BlockLoad
+};
+
+// A ContentExtensionRule is the smallest unit in a ContentExtension.
+//
+// It is composed of a trigger and an action. The trigger defines on what kind of content this extension should apply.
+// The action defines what to perform on that content.
+class ContentExtensionRule {
+public:
+    struct Trigger {
+        String urlFilter;
+    };
+
+    struct Action {
+        ExtensionActionType type;
+    };
+
+    ContentExtensionRule(const Trigger&amp;, const Action&amp;);
+
+    const Trigger&amp; trigger() const { return m_trigger; }
+    const Action&amp; action() const { return m_action; }
+
+private:
+    Trigger m_trigger;
+    Action m_action;
+};
+
+} // namespace ContentExtensions
+
+} // namespace WebCore
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
+
+#endif // ContentExtensionRule_h
</ins></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsContentExtensionsBackendcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp (0 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp                                (rev 0)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -0,0 +1,114 @@
</span><ins>+/*
+ * Copyright (C) 2014 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;ContentExtensionsBackend.h&quot;
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+#include &quot;NFA.h&quot;
+#include &quot;NFAToDFA.h&quot;
+#include &quot;URL.h&quot;
+#include &lt;wtf/NeverDestroyed.h&gt;
+
+namespace WebCore {
+
+namespace ContentExtensions {
+
+ContentExtensionsBackend&amp; ContentExtensionsBackend::sharedInstance()
+{
+    static NeverDestroyed&lt;ContentExtensionsBackend&gt; instance;
+    return instance;
+}
+
+void ContentExtensionsBackend::setRuleList(const String&amp; identifier, const Vector&lt;ContentExtensionRule&gt;&amp; ruleList)
+{
+    ASSERT(!identifier.isEmpty());
+    if (identifier.isEmpty())
+        return;
+
+    if (ruleList.isEmpty()) {
+        removeRuleList(identifier);
+        return;
+    }
+
+    NFA nfa;
+    unsigned rootNode = nfa.root();
+    for (unsigned ruleIndex = 0; ruleIndex &lt; ruleList.size(); ++ruleIndex) {
+        const ContentExtensionRule&amp; contentExtensionRule = ruleList[ruleIndex];
+        const ContentExtensionRule::Trigger&amp; trigger = contentExtensionRule.trigger();
+        ASSERT(trigger.urlFilter.length());
+
+        unsigned lastNode = rootNode;
+
+        for (unsigned i = 0; i &lt; trigger.urlFilter.length(); ++i) {
+            unsigned newNode = nfa.createNode(ruleIndex);
+            nfa.addTransition(lastNode, newNode, trigger.urlFilter[i]);
+            lastNode = newNode;
+        }
+
+        nfa.setFinal(lastNode);
+    }
+
+    // FIXME: never add a DFA that only matches the empty set.
+    CompiledContentExtension compiledContentExtension = { NFAToDFA::convert(nfa), ruleList };
+    m_ruleLists.set(identifier, compiledContentExtension);
+}
+
+void ContentExtensionsBackend::removeRuleList(const String&amp; identifier)
+{
+    m_ruleLists.remove(identifier);
+}
+
+bool ContentExtensionsBackend::shouldBlockURL(const URL&amp; url)
+{
+    const String&amp; urlString = url.string();
+    ASSERT_WITH_MESSAGE(urlString.containsOnlyASCII(), &quot;A decoded URL should only contain ASCII characters. The matching algorithm assumes the input is ASCII.&quot;);
+
+    for (auto&amp; ruleListSlot : m_ruleLists) {
+        CompiledContentExtension&amp; compiledContentExtension = ruleListSlot.value;
+        unsigned state = compiledContentExtension.dfa.root();
+
+        for (unsigned i = 0; i &lt; urlString.length(); ++i) {
+            char character = static_cast&lt;char&gt;(urlString[i]);
+            bool ok;
+            state = compiledContentExtension.dfa.nextState(state, character, ok);
+            if (!ok)
+                return false;
+
+            // FIXME: accumulate the actions.
+            if (!compiledContentExtension.dfa.actions(state).isEmpty())
+                return true;
+        }
+    }
+
+    return false;
+}
+
+} // namespace ContentExtensions
+
+} // namespace WebCore
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
</ins></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsContentExtensionsBackendh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.h (0 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.h                                (rev 0)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.h        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+/*
+ * Copyright (C) 2014, 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 ContentExtensionsBackend_h
+#define ContentExtensionsBackend_h
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+#include &quot;ContentExtensionRule.h&quot;
+#include &quot;DFA.h&quot;
+#include &lt;wtf/HashMap.h&gt;
+#include &lt;wtf/text/StringHash.h&gt;
+#include &lt;wtf/text/WTFString.h&gt;
+
+namespace WebCore {
+
+class URL;
+
+namespace ContentExtensions {
+
+// The ContentExtensionsBackend is the internal model of all the content extensions.
+//
+// It provides two services:
+// 1) It stores the rules for each content extension.
+// 2) It provides APIs for the WebCore interfaces to use those rules efficiently.
+class ContentExtensionsBackend {
+public:
+    static ContentExtensionsBackend&amp; sharedInstance();
+
+    // - Rule management interface. This can be used by upper layer.
+
+    // Set a list of rules for a given name. If there were existing rules for the name, they are overriden.
+    // The identifier cannot be empty.
+    void setRuleList(const String&amp; identifier, const Vector&lt;ContentExtensionRule&gt;&amp;);
+
+    void removeRuleList(const String&amp; identifier);
+
+    // - Internal WebCore Interface.
+    bool shouldBlockURL(const URL&amp;);
+
+private:
+    struct CompiledContentExtension {
+        DFA dfa;
+        Vector&lt;ContentExtensionRule&gt; ruleList;
+    };
+
+    HashMap&lt;String, CompiledContentExtension&gt; m_ruleLists;
+};
+
+} // namespace ContentExtensions
+
+} // namespace WebCore
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
+
+#endif // ContentExtensionsBackend_h
</ins></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsContentExtensionsInterfacecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/contentextensions/ContentExtensionsInterface.cpp (0 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/ContentExtensionsInterface.cpp                                (rev 0)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsInterface.cpp        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+/*
+ * Copyright (C) 2014 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;ContentExtensionsInterface.h&quot;
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+#include &quot;ContentExtensionsBackend.h&quot;
+
+namespace WebCore {
+namespace ContentExtensions {
+
+bool shouldBlockURL(const URL&amp; url)
+{
+    return ContentExtensionsBackend::sharedInstance().shouldBlockURL(url);
+}
+
+} // namespace ContentExtensions
+} // namespace WebCore
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
</ins></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsContentExtensionsInterfaceh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/contentextensions/ContentExtensionsInterface.h (0 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/ContentExtensionsInterface.h                                (rev 0)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsInterface.h        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+/*
+ * Copyright (C) 2014, 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 ContentExtensionsInterface_h
+#define ContentExtensionsInterface_h
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+namespace WebCore {
+
+class URL;
+
+// This defines the interface by which WebCore interact with Content Extensions.
+namespace ContentExtensions {
+bool shouldBlockURL(const URL&amp;);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
+
+#endif // ContentExtensionsInterface_h
</ins></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsContentExtensionsManagercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/contentextensions/ContentExtensionsManager.cpp (0 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/ContentExtensionsManager.cpp                                (rev 0)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsManager.cpp        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -0,0 +1,167 @@
</span><ins>+/*
+ * Copyright (C) 2014 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;ContentExtensionsManager.h&quot;
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+#include &quot;ContentExtensionRule.h&quot;
+#include &quot;ContentExtensionsBackend.h&quot;
+#include &lt;JavaScriptCore/IdentifierInlines.h&gt;
+#include &lt;JavaScriptCore/JSCJSValueInlines.h&gt;
+#include &lt;JavaScriptCore/JSGlobalObject.h&gt;
+#include &lt;JavaScriptCore/JSONObject.h&gt;
+#include &lt;JavaScriptCore/StructureInlines.h&gt;
+#include &lt;JavaScriptCore/VM.h&gt;
+#include &lt;wtf/text/WTFString.h&gt;
+
+using namespace JSC;
+
+namespace WebCore {
+
+namespace ContentExtensions {
+
+namespace ExtensionsManager {
+
+static bool loadTrigger(ExecState&amp; exec, JSObject&amp; ruleObject, ContentExtensionRule::Trigger&amp; trigger)
+{
+    JSValue triggerObject = ruleObject.get(&amp;exec, Identifier(&amp;exec, &quot;trigger&quot;));
+    if (!triggerObject || exec.hadException() || !triggerObject.isObject()) {
+        WTFLogAlways(&quot;Invalid trigger object.&quot;);
+        return false;
+    }
+
+    JSValue urlFilterObject = triggerObject.get(&amp;exec, Identifier(&amp;exec, &quot;url-filter&quot;));
+    if (!urlFilterObject || exec.hadException() || !urlFilterObject.isString()) {
+        WTFLogAlways(&quot;Invalid url-filter object.&quot;);
+        return false;
+    }
+
+    String urlFilter = urlFilterObject.toWTFString(&amp;exec);
+    if (urlFilter.isEmpty()) {
+        WTFLogAlways(&quot;Invalid url-filter object. The url is empty.&quot;);
+        return false;
+    }
+
+    trigger.urlFilter = urlFilter;
+    return true;
+}
+
+static bool loadAction(ExecState&amp; exec, JSObject&amp; ruleObject, ContentExtensionRule::Action&amp; action)
+{
+    JSValue actionObject = ruleObject.get(&amp;exec, Identifier(&amp;exec, &quot;action&quot;));
+    if (!actionObject || exec.hadException() || !actionObject.isObject()) {
+        WTFLogAlways(&quot;Invalid action object.&quot;);
+        return false;
+    }
+
+    JSValue typeObject = actionObject.get(&amp;exec, Identifier(&amp;exec, &quot;type&quot;));
+    if (!typeObject || exec.hadException() || !typeObject.isString()) {
+        WTFLogAlways(&quot;Invalid url-filter object.&quot;);
+        return false;
+    }
+
+    String actionType = typeObject.toWTFString(&amp;exec);
+    if (actionType != &quot;block&quot;) {
+        WTFLogAlways(&quot;Unrocognized action: \&quot;%s\&quot;&quot;, actionType.utf8().data());
+        return false;
+    }
+
+    action.type = ExtensionActionType::BlockLoad;
+
+    return true;
+}
+
+static void loadRule(ExecState&amp; exec, JSObject&amp; ruleObject, Vector&lt;ContentExtensionRule&gt;&amp; ruleList)
+{
+    ContentExtensionRule::Trigger trigger;
+    if (!loadTrigger(exec, ruleObject, trigger))
+        return;
+
+    ContentExtensionRule::Action action;
+    if (!loadAction(exec, ruleObject, action))
+        return;
+
+    ruleList.append(ContentExtensionRule(trigger, action));
+}
+
+void loadExtension(const String&amp; identifier, const String&amp; rules)
+{
+    Vector&lt;ContentExtensionRule&gt; ruleList;
+
+    RefPtr&lt;VM&gt; vm = VM::create();
+
+    JSLockHolder locker(vm.get());
+    JSGlobalObject* globalObject = JSGlobalObject::create(*vm, JSGlobalObject::createStructure(*vm, jsNull()));
+
+    ExecState* exec = globalObject-&gt;globalExec();
+    JSValue decodedRules = JSONParse(exec, rules);
+    if (decodedRules.isObject()) {
+        JSObject* topLevelObject = decodedRules.toObject(exec);
+        if (!topLevelObject || exec-&gt;hadException()) {
+            WTFLogAlways(&quot;Invalid input, the top level structure is not an object.&quot;);
+            return;
+        }
+
+        if (!isJSArray(topLevelObject)) {
+            WTFLogAlways(&quot;Invalid input, the top level object is not an array.&quot;);
+            return;
+        }
+
+        JSArray* topLevelArray = jsCast&lt;JSArray*&gt;(topLevelObject);
+
+        unsigned length = topLevelArray-&gt;length();
+        for (unsigned i = 0; i &lt; length; ++i) {
+            JSValue value = topLevelArray-&gt;getIndex(exec, i);
+            if (exec-&gt;hadException() || !value) {
+                WTFLogAlways(&quot;Invalid object in the array.&quot;);
+                continue;
+            }
+
+            JSObject* ruleObject = value.toObject(exec);
+            if (!ruleObject || exec-&gt;hadException()) {
+                WTFLogAlways(&quot;Invalid rule&quot;);
+                continue;
+            }
+            loadRule(*exec, *ruleObject, ruleList);
+        }
+    }
+
+    vm.clear();
+
+    if (ruleList.isEmpty()) {
+        WTFLogAlways(&quot;Empty extension.&quot;);
+        return;
+    }
+
+    ContentExtensionsBackend::sharedInstance().setRuleList(identifier, ruleList);
+}
+
+} // namespace ExtensionsManager
+} // namespace ContentExtensions
+} // namespace WebCore
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
</ins></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsContentExtensionsManagerh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/contentextensions/ContentExtensionsManager.h (0 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/ContentExtensionsManager.h                                (rev 0)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsManager.h        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+/*
+ * Copyright (C) 2014 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 ContentExtensionsManager_h
+#define ContentExtensionsManager_h
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+#include &lt;wtf/Forward.h&gt;
+
+namespace WebCore {
+
+namespace ContentExtensions {
+
+// The ExtensionsManager loads serialized content extension rules directly into WebCore.
+namespace ExtensionsManager {
+
+void loadExtension(const String&amp; identifier, const String&amp; rules);
+
+} // namespace ExtensionsManager
+
+} // namespace ContentExtensions
+} // namespace WebCore
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
+
+#endif // ContentExtensionsManager_h
</ins></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsDFAcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/contentextensions/DFA.cpp (0 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/DFA.cpp                                (rev 0)
+++ trunk/Source/WebCore/contentextensions/DFA.cpp        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -0,0 +1,133 @@
</span><ins>+/*
+ * Copyright (C) 2014, 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;DFA.h&quot;
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+#include &lt;wtf/DataLog.h&gt;
+
+namespace WebCore {
+
+namespace ContentExtensions {
+
+DFA::DFA()
+    : m_root(0)
+{
+}
+
+DFA::DFA(Vector&lt;DFANode&gt;&amp;&amp; nodes, unsigned rootIndex)
+    : m_nodes(WTF::move(nodes))
+    , m_root(rootIndex)
+{
+    ASSERT(rootIndex &lt; nodes.size());
+}
+
+DFA::DFA(const DFA&amp; dfa)
+    : m_nodes(dfa.m_nodes)
+    , m_root(dfa.m_root)
+{
+}
+
+DFA&amp; DFA::operator=(const DFA&amp; dfa)
+{
+    m_nodes = dfa.m_nodes;
+    m_root = dfa.m_root;
+    return *this;
+}
+
+unsigned DFA::nextState(unsigned currentState, char character, bool&amp; ok) const
+{
+    ASSERT(currentState &lt; m_nodes.size());
+
+    const DFANode&amp; node = m_nodes[currentState];
+    auto nextNode = node.transitions.find(character);
+    if (nextNode == node.transitions.end()) {
+        ok = false;
+        return 0;
+    }
+    ok = true;
+    return nextNode-&gt;value;
+}
+
+Vector&lt;uint64_t&gt; DFA::actions(unsigned currentState) const
+{
+    ASSERT(currentState &lt; m_nodes.size());
+    return m_nodes[currentState].actions;
+}
+
+#ifndef NDEBUG
+void DFA::debugPrintDot() const
+{
+    dataLogF(&quot;digraph DFA_Transitions {\n&quot;);
+    dataLogF(&quot;    rankdir=LR;\n&quot;);
+    dataLogF(&quot;    node [shape=circle];\n&quot;);
+    dataLogF(&quot;    {\n&quot;);
+    for (unsigned i = 0; i &lt; m_nodes.size(); ++i) {
+        dataLogF(&quot;         %d [label=&lt;Node %d&quot;, i, i);
+        const Vector&lt;uint64_t&gt;&amp; actions = m_nodes[i].actions;
+        if (!actions.isEmpty()) {
+            dataLogF(&quot;&lt;BR/&gt;Actions: &quot;);
+            for (unsigned actionIndex = 0; actionIndex &lt; actions.size(); ++actionIndex) {
+                if (actionIndex)
+                    dataLogF(&quot;, &quot;);
+                dataLogF(&quot;%llu&quot;, actions[actionIndex]);
+            }
+        }
+
+        Vector&lt;unsigned&gt; correspondingDFANodes = m_nodes[i].correspondingDFANodes;
+        ASSERT(!correspondingDFANodes.isEmpty());
+        dataLogF(&quot;&lt;BR/&gt;NFA Nodes: &quot;);
+        for (unsigned correspondingDFANodeIndex = 0; correspondingDFANodeIndex &lt; correspondingDFANodes.size(); ++correspondingDFANodeIndex) {
+            if (correspondingDFANodeIndex)
+                dataLogF(&quot;, &quot;);
+            dataLogF(&quot;%d&quot;, correspondingDFANodes[correspondingDFANodeIndex]);
+        }
+
+        dataLogF(&quot;&gt;]&quot;);
+
+        if (!actions.isEmpty())
+            dataLogF(&quot; [shape=doublecircle]&quot;);
+
+        dataLogF(&quot;;\n&quot;);
+    }
+    dataLogF(&quot;    }\n&quot;);
+
+    dataLogF(&quot;    {\n&quot;);
+    for (unsigned i = 0; i &lt; m_nodes.size(); ++i) {
+        for (const auto&amp; slot : m_nodes[i].transitions)
+            dataLogF(&quot;        %d -&gt; %d [label=\&quot;%c\&quot;];\n&quot;, i, slot.value, slot.key);
+    }
+    dataLogF(&quot;    }\n&quot;);
+    dataLogF(&quot;}\n&quot;);
+}
+#endif
+
+} // namespace ContentExtensions
+
+} // namespace WebCore
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
</ins></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsDFAh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/contentextensions/DFA.h (0 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/DFA.h                                (rev 0)
+++ trunk/Source/WebCore/contentextensions/DFA.h        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -0,0 +1,68 @@
</span><ins>+/*
+ * Copyright (C) 2014, 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 DFA_h
+#define DFA_h
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+#include &quot;DFANode.h&quot;
+#include &lt;wtf/Vector.h&gt;
+
+namespace WebCore {
+
+namespace ContentExtensions {
+
+// The DFA abstract a partial DFA graph in a compact form.
+class DFA {
+public:
+    DFA();
+    DFA(Vector&lt;DFANode&gt;&amp;&amp; nodes, unsigned rootIndex);
+    DFA(const DFA&amp; dfa);
+
+    DFA&amp; operator=(const DFA&amp;);
+
+    unsigned root() const { return m_root; }
+    // If there is a transition to a valid state on &quot;character&quot;, return that state and set ok to true.
+    // Otherwise, the return value is undefined and ok is false.
+    unsigned nextState(unsigned currentState, char character, bool&amp; ok) const;
+    const Vector&lt;uint64_t&gt;&amp; actions(unsigned currentState) const;
+
+#ifndef NDEBUG
+    void debugPrintDot() const;
+#endif
+
+private:
+    Vector&lt;DFANode&gt; m_nodes;
+    unsigned m_root;
+};
+
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
+
+#endif // DFA_h
</ins></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsDFANodeh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/contentextensions/DFANode.h (0 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/DFANode.h                                (rev 0)
+++ trunk/Source/WebCore/contentextensions/DFANode.h        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+/*
+ * Copyright (C) 2014, 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 DFANode_h
+#define DFANode_h
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+#include &lt;wtf/HashMap.h&gt;
+#include &lt;wtf/Vector.h&gt;
+
+namespace WebCore {
+
+namespace ContentExtensions {
+
+// A DFANode abstract the transition table out of a DFA state. If a state is accepting, the DFANode also have
+// the actions for that state.
+class DFANode {
+public:
+    HashMap&lt;uint16_t, unsigned&gt; transitions;
+    Vector&lt;uint64_t&gt; actions;
+
+#ifndef NDEBUG
+    Vector&lt;unsigned&gt; correspondingDFANodes;
+#endif
+};
+
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
+
+#endif // DFANode_h
</ins></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsNFAcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/contentextensions/NFA.cpp (0 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/NFA.cpp                                (rev 0)
+++ trunk/Source/WebCore/contentextensions/NFA.cpp        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -0,0 +1,115 @@
</span><ins>+/*
+ * Copyright (C) 2014, 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;NFA.h&quot;
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+#include &lt;wtf/DataLog.h&gt;
+#include &lt;wtf/HashSet.h&gt;
+
+namespace WebCore {
+
+namespace ContentExtensions {
+
+NFA::NFA()
+    : m_root(createNode())
+{
+}
+
+unsigned NFA::createNode(uint64_t ruleId)
+{
+    unsigned nextId = m_nodes.size();
+    m_nodes.append(NFANode(ruleId));
+    return nextId;
+}
+
+void NFA::addTransition(unsigned from, unsigned to, char character)
+{
+    ASSERT(from &lt; m_nodes.size());
+    ASSERT(to &lt; m_nodes.size());
+    ASSERT(character);
+
+    auto addResult = m_nodes[from].transitions.add(character, HashSet&lt;unsigned&gt;());
+    addResult.iterator-&gt;value.add(to);
+}
+
+void NFA::addEpsilonTransition(unsigned from, unsigned to)
+{
+    ASSERT(from &lt; m_nodes.size());
+    ASSERT(to &lt; m_nodes.size());
+
+    auto addResult = m_nodes[from].transitions.add(epsilonTransitionCharacter, HashSet&lt;unsigned&gt;());
+    addResult.iterator-&gt;value.add(to);
+}
+
+void NFA::setFinal(unsigned node)
+{
+    ASSERT(node &lt; m_nodes.size());
+    m_nodes[node].isFinal = true;
+}
+
+#ifndef NDEBUG
+void NFA::debugPrintDot() const
+{
+    dataLogF(&quot;digraph NFA_Transitions {\n&quot;);
+    dataLogF(&quot;    rankdir=LR;\n&quot;);
+    dataLogF(&quot;    node [shape=circle];\n&quot;);
+    dataLogF(&quot;    {\n&quot;);
+    for (unsigned i = 0; i &lt; m_nodes.size(); ++i) {
+        if (m_nodes[i].ruleId  == std::numeric_limits&lt;uint64_t&gt;::max())
+            dataLogF(&quot;         %d [label=\&quot;Node %d\&quot;]&quot;, i, i);
+        else
+            dataLogF(&quot;         %d [label=&lt;Node %d&lt;BR/&gt;(Rule %llu)&gt;]&quot;, i, i, m_nodes[i].ruleId);
+
+        if (m_nodes[i].isFinal)
+            dataLogF(&quot; [shape=doublecircle]&quot;);
+
+        dataLogF(&quot;;\n&quot;);
+    }
+    dataLogF(&quot;    }\n&quot;);
+
+    dataLogF(&quot;    {\n&quot;);
+    for (unsigned i = 0; i &lt; m_nodes.size(); ++i) {
+        for (const auto&amp; slot : m_nodes[i].transitions) {
+            for (unsigned nextState : slot.value) {
+                if (slot.key == epsilonTransitionCharacter)
+                    dataLogF(&quot;        %d -&gt; %d [label=\&quot;ɛ\&quot;];\n&quot;, i, nextState);
+                else
+                    dataLogF(&quot;        %d -&gt; %d [label=\&quot;%c\&quot;];\n&quot;, i, nextState, slot.key);
+            }
+        }
+    }
+    dataLogF(&quot;    }\n&quot;);
+    dataLogF(&quot;}\n&quot;);
+}
+#endif
+
+} // namespace ContentExtensions
+
+} // namespace WebCore
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
</ins></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsNFAh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/contentextensions/NFA.h (0 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/NFA.h                                (rev 0)
+++ trunk/Source/WebCore/contentextensions/NFA.h        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -0,0 +1,72 @@
</span><ins>+/*
+ * Copyright (C) 2014 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 NFA_h
+#define NFA_h
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+#include &quot;NFANode.h&quot;
+#include &lt;limits&gt;
+#include &lt;wtf/Vector.h&gt;
+
+namespace WebCore {
+
+namespace ContentExtensions {
+
+class NFAToDFA;
+
+// The NFA provides a way to build a NFA graph with characters or epsilon as transitions.
+// The nodes are accessed through an identifier.
+class NFA {
+public:
+    NFA();
+    unsigned root() const { return m_root; }
+    unsigned createNode(uint64_t ruleId = std::numeric_limits&lt;uint64_t&gt;::max());
+
+    void addTransition(unsigned from, unsigned to, char character);
+    void addEpsilonTransition(unsigned from, unsigned to);
+    void setFinal(unsigned node);
+
+#ifndef NDEBUG
+    void debugPrintDot() const;
+#endif
+
+private:
+    friend class NFAToDFA;
+
+    static const unsigned epsilonTransitionCharacter = 256;
+
+    Vector&lt;NFANode&gt; m_nodes;
+    unsigned m_root;
+};
+
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
+
+#endif // NFA_h
</ins></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsNFANodecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/contentextensions/NFANode.cpp (0 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/NFANode.cpp                                (rev 0)
+++ trunk/Source/WebCore/contentextensions/NFANode.cpp        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+/*
+ * Copyright (C) 2014 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;NFANode.h&quot;
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+namespace WebCore {
+
+namespace ContentExtensions {
+
+NFANode::NFANode(uint64_t ruleId)
+    : isFinal(false)
+    , ruleId(ruleId)
+{
+}
+
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
</ins></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsNFANodeh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/contentextensions/NFANode.h (0 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/NFANode.h                                (rev 0)
+++ trunk/Source/WebCore/contentextensions/NFANode.h        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+/*
+ * Copyright (C) 2014, 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 NFANode_h
+#define NFANode_h
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+#include &lt;wtf/HashMap.h&gt;
+#include &lt;wtf/HashSet.h&gt;
+
+namespace WebCore {
+
+namespace ContentExtensions {
+
+// A NFANode abstract the transition table out of a NFA state.
+class NFANode {
+public:
+    NFANode(uint64_t ruleId);
+
+    HashMap&lt;uint16_t, HashSet&lt;unsigned&gt;&gt; transitions;
+    bool isFinal;
+    const uint64_t ruleId;
+};
+
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
+
+#endif // NFANode_h
</ins></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsNFAToDFAcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/contentextensions/NFAToDFA.cpp (0 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/NFAToDFA.cpp                                (rev 0)
+++ trunk/Source/WebCore/contentextensions/NFAToDFA.cpp        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -0,0 +1,250 @@
</span><ins>+/*
+ * Copyright (C) 2014, 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;NFAToDFA.h&quot;
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+#include &quot;DFANode.h&quot;
+#include &quot;NFA.h&quot;
+#include &lt;wtf/HashMap.h&gt;
+#include &lt;wtf/HashSet.h&gt;
+
+namespace WebCore {
+
+namespace ContentExtensions {
+
+typedef HashSet&lt;unsigned, DefaultHash&lt;unsigned&gt;::Hash, WTF::UnsignedWithZeroKeyHashTraits&lt;unsigned&gt;&gt; NodeIdSet;
+
+static NodeIdSet epsilonClosure(const NodeIdSet&amp; nodeSet, const Vector&lt;NFANode&gt;&amp; graph, unsigned epsilonTransitionCharacter)
+{
+    ASSERT(!nodeSet.isEmpty());
+    ASSERT(!graph.isEmpty());
+
+    // We go breadth-first first into our graph following all the epsilon transition. At each generation,
+    // discoveredNodes contains all the new nodes we have discovered by following a single epsilon transition
+    // out of the previous set of nodes.
+    NodeIdSet outputNodeSet = nodeSet;
+    NodeIdSet discoveredNodes = nodeSet;
+    do {
+        outputNodeSet.add(discoveredNodes.begin(), discoveredNodes.end());
+
+        NodeIdSet nextGenerationDiscoveredNodes;
+
+        for (unsigned nodeId : discoveredNodes) {
+            const NFANode&amp; node = graph[nodeId];
+            auto epsilonTransitionSlot = node.transitions.find(epsilonTransitionCharacter);
+            if (epsilonTransitionSlot != node.transitions.end()) {
+                const HashSet&lt;unsigned&gt;&amp; targets = epsilonTransitionSlot-&gt;value;
+                for (unsigned targetNodeId : targets) {
+                    if (!outputNodeSet.contains(targetNodeId))
+                        nextGenerationDiscoveredNodes.add(targetNodeId);
+                }
+            }
+        }
+
+        discoveredNodes = nextGenerationDiscoveredNodes;
+    } while (!discoveredNodes.isEmpty());
+
+    ASSERT(!outputNodeSet.isEmpty());
+    return outputNodeSet;
+}
+
+typedef HashMap&lt;uint16_t, NodeIdSet, DefaultHash&lt;uint16_t&gt;::Hash, WTF::UnsignedWithZeroKeyHashTraits&lt;uint16_t&gt;&gt; SetTransitionsExcludingEpsilon;
+
+static SetTransitionsExcludingEpsilon setTransitionsExcludingEpsilon(const NodeIdSet&amp; nodeSet, const Vector&lt;NFANode&gt;&amp; graph, unsigned epsilonTransitionCharacter)
+{
+    ASSERT(!nodeSet.isEmpty());
+    ASSERT(!graph.isEmpty());
+
+    SetTransitionsExcludingEpsilon outputSetTransitionsExcludingEpsilon;
+
+    for (unsigned nodeId : nodeSet) {
+        const NFANode&amp; node = graph[nodeId];
+        for (const auto&amp; transitionSlot : node.transitions) {
+            if (transitionSlot.key != epsilonTransitionCharacter) {
+                auto existingTransition = outputSetTransitionsExcludingEpsilon.find(transitionSlot.key);
+                if (existingTransition != outputSetTransitionsExcludingEpsilon.end())
+                    existingTransition-&gt;value.add(transitionSlot.value.begin(), transitionSlot.value.end());
+                else {
+                    NodeIdSet newSet;
+                    newSet.add(transitionSlot.value.begin(), transitionSlot.value.end());
+                    outputSetTransitionsExcludingEpsilon.add(transitionSlot.key, newSet);
+                }
+            }
+        }
+    }
+
+    return outputSetTransitionsExcludingEpsilon;
+}
+
+class HashableNodeIdSet {
+public:
+    enum EmptyValueTag { EmptyValue };
+    enum DeletedValueTag { DeletedValue };
+
+    HashableNodeIdSet(EmptyValueTag) { }
+    HashableNodeIdSet(DeletedValueTag)
+        : m_isDeleted(true)
+    {
+    }
+
+    HashableNodeIdSet(const NodeIdSet&amp; nodeIdSet)
+        : m_nodeIdSet(nodeIdSet)
+    {
+        ASSERT(!nodeIdSet.isEmpty());
+    }
+
+    HashableNodeIdSet(HashableNodeIdSet&amp;&amp; other)
+        : m_nodeIdSet(other.m_nodeIdSet)
+        , m_isDeleted(other.m_isDeleted)
+    {
+        other.m_nodeIdSet.clear();
+        other.m_isDeleted = false;
+    }
+
+    HashableNodeIdSet&amp; operator=(HashableNodeIdSet&amp;&amp; other)
+    {
+        m_nodeIdSet = other.m_nodeIdSet;
+        other.m_nodeIdSet.clear();
+        m_isDeleted = other.m_isDeleted;
+        other.m_isDeleted = false;
+        return *this;
+    }
+
+    bool isEmptyValue() const { return m_nodeIdSet.isEmpty(); }
+    bool isDeletedValue() const { return m_isDeleted; }
+
+    NodeIdSet nodeIdSet() const { return m_nodeIdSet; }
+
+private:
+    NodeIdSet m_nodeIdSet;
+    bool m_isDeleted = false;
+};
+
+struct HashableNodeIdSetHash {
+    static unsigned hash(const HashableNodeIdSet&amp; p)
+    {
+        unsigned hash = 0;
+        for (unsigned nodeId : p.nodeIdSet())
+            hash ^= DefaultHash&lt;unsigned&gt;::Hash::hash(nodeId);
+        return hash;
+    }
+
+    static bool equal(const HashableNodeIdSet&amp; a, const HashableNodeIdSet&amp; b)
+    {
+        return a.nodeIdSet() == b.nodeIdSet() &amp;&amp; a.isDeletedValue() == b.isDeletedValue();
+    }
+    static const bool safeToCompareToEmptyOrDeleted = true;
+};
+
+struct HashableNodeIdSetHashTraits : public WTF::CustomHashTraits&lt;HashableNodeIdSet&gt; { };
+
+typedef HashMap&lt;HashableNodeIdSet, unsigned, HashableNodeIdSetHash, HashableNodeIdSetHashTraits&gt; NFAToDFANodeMap;
+
+static unsigned addDFAState(Vector&lt;DFANode&gt;&amp; dfaGraph, NFAToDFANodeMap&amp; nfaToDFANodeMap, const Vector&lt;NFANode&gt;&amp; nfaGraph, NodeIdSet nfaNodes, unsigned epsilonTransitionCharacter)
+{
+    ASSERT(!nfaToDFANodeMap.contains(nfaNodes));
+    ASSERT_UNUSED(epsilonTransitionCharacter, epsilonClosure(nfaNodes, nfaGraph, epsilonTransitionCharacter) ==  nfaNodes);
+
+    DFANode newDFANode;
+
+    HashSet&lt;uint64_t, DefaultHash&lt;uint64_t&gt;::Hash, WTF::UnsignedWithZeroKeyHashTraits&lt;uint64_t&gt;&gt; actions;
+    for (unsigned nfaNodeId : nfaNodes) {
+        const NFANode&amp; nfaNode = nfaGraph[nfaNodeId];
+        if (nfaNode.isFinal)
+            actions.add(nfaNode.ruleId);
+#ifndef NDEBUG
+        newDFANode.correspondingDFANodes.append(nfaNodeId);
+#endif
+    }
+
+    for (uint64_t action : actions)
+        newDFANode.actions.append(action);
+
+    unsigned dfaNodeId = dfaGraph.size();
+    dfaGraph.append(newDFANode);
+    nfaToDFANodeMap.add(nfaNodes, dfaNodeId);
+    return dfaNodeId;
+}
+
+typedef HashSet&lt;HashableNodeIdSet, HashableNodeIdSetHash, HashableNodeIdSetHashTraits&gt; SetOfNodeSet;
+
+DFA NFAToDFA::convert(const NFA&amp; nfa)
+{
+    Vector&lt;DFANode&gt; dfaGraph;
+    NFAToDFANodeMap nfaToDFANodeMap;
+
+    SetOfNodeSet processedStateSets;
+    SetOfNodeSet unprocessedStateSets;
+
+    const Vector&lt;NFANode&gt;&amp; nfaGraph = nfa.m_nodes;
+
+    NodeIdSet initialSet({ nfa.root() });
+    NodeIdSet closedInitialSet = epsilonClosure(initialSet, nfaGraph, NFA::epsilonTransitionCharacter);
+
+    addDFAState(dfaGraph, nfaToDFANodeMap, nfaGraph, closedInitialSet, NFA::epsilonTransitionCharacter);
+    unprocessedStateSets.add(closedInitialSet);
+
+    do {
+        HashableNodeIdSet stateSet = unprocessedStateSets.takeAny();
+
+        ASSERT(!processedStateSets.contains(stateSet));
+        processedStateSets.add(stateSet.nodeIdSet());
+
+        unsigned dfaNodeId = nfaToDFANodeMap.get(stateSet);
+
+        SetTransitionsExcludingEpsilon transitionsFromClosedSet = setTransitionsExcludingEpsilon(stateSet.nodeIdSet(), nfaGraph, NFA::epsilonTransitionCharacter);
+        for (const auto&amp; transitionSlot : transitionsFromClosedSet) {
+            NodeIdSet closedTargetNodeSet = epsilonClosure(transitionSlot.value, nfaGraph, NFA::epsilonTransitionCharacter);
+            unsigned newDFANodeId;
+
+            const auto&amp; existingNFAToDFAAssociation = nfaToDFANodeMap.find(closedTargetNodeSet);
+            if (existingNFAToDFAAssociation != nfaToDFANodeMap.end())
+                newDFANodeId = existingNFAToDFAAssociation-&gt;value;
+            else
+                newDFANodeId = addDFAState(dfaGraph, nfaToDFANodeMap, nfaGraph, closedTargetNodeSet, NFA::epsilonTransitionCharacter);
+
+            ASSERT(newDFANodeId &lt; dfaGraph.size());
+
+            const auto addResult = dfaGraph[dfaNodeId].transitions.set(transitionSlot.key, newDFANodeId);
+            ASSERT_UNUSED(addResult, addResult.isNewEntry);
+
+            if (!processedStateSets.contains(closedTargetNodeSet))
+                unprocessedStateSets.add(closedTargetNodeSet);
+        }
+    } while (!unprocessedStateSets.isEmpty());
+
+    ASSERT(processedStateSets.size() == nfaToDFANodeMap.size());
+
+    return DFA(WTF::move(dfaGraph), 0);
+}
+
+} // namespace ContentExtensions
+
+} // namespace WebCore
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
</ins></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsNFAToDFAh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/contentextensions/NFAToDFA.h (0 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/NFAToDFA.h                                (rev 0)
+++ trunk/Source/WebCore/contentextensions/NFAToDFA.h        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+/*
+ * Copyright (C) 2014, 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 NFAToDFA_h
+#define NFAToDFA_h
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+#include &quot;DFA.h&quot;
+
+namespace WebCore {
+
+namespace ContentExtensions {
+
+class NFA;
+
+// NFAToDFA provides a way to build a DFA corresponding to a NFA.
+class NFAToDFA {
+public:
+    static DFA convert(const NFA&amp;);
+};
+
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
+
+#endif // NFAToDFA_h
</ins></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (178150 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp        2015-01-09 01:50:41 UTC (rev 178150)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -63,6 +63,10 @@
</span><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><ins>+#if ENABLE(CONTENT_EXTENSIONS)
+#include &quot;ContentExtensionsInterface.h&quot;
+#endif
+
</ins><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx"> #include &quot;CachedTextTrack.h&quot;
</span><span class="cx"> #endif
</span><span class="lines">@@ -453,6 +457,11 @@
</span><span class="cx">     if (!canRequest(type, url, request.options(), request.forPreload()))
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><ins>+#if ENABLE(CONTENT_EXTENSIONS)
+    if (ContentExtensions::shouldBlockURL(url))
+        return nullptr;
+#endif
+
</ins><span class="cx">     if (memoryCache().disabled()) {
</span><span class="cx">         DocumentResourceMap::iterator it = m_documentResources.find(url.string());
</span><span class="cx">         if (it != m_documentResources.end()) {
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (178150 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-01-09 01:50:41 UTC (rev 178150)
+++ trunk/Source/WebKit2/ChangeLog        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2015-01-08  Benjamin Poulain  &lt;benjamin@webkit.org&gt;
+
+        [WK2] Start a prototype for declarative site specific extensions
+        https://bugs.webkit.org/show_bug.cgi?id=140160
+
+        Reviewed by Andreas Kling.
+
+        Provide a small SPI for OS X. This will likely move
+        to a better place.
+
+        * UIProcess/API/Cocoa/WKProcessPool.mm:
+        (-[WKProcessPool _loadContentExtensionWithIdentifier:serializedRules:successCompletionHandler:errorCompletionHandler:]):
+        * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::processDidFinishLaunching):
+        (WebKit::WebProcessPool::loadContentExtension):
+        * UIProcess/WebProcessPool.h:
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::loadContentExtension):
+        * WebProcess/WebProcess.h:
+        * WebProcess/WebProcess.messages.in:
+
</ins><span class="cx"> 2015-01-08  Sam Weinig  &lt;sam@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Make WKNavigation bridged to API::Navigation
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKProcessPoolmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm (178150 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm        2015-01-09 01:50:41 UTC (rev 178150)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -244,6 +244,20 @@
</span><span class="cx">     _processPool-&gt;sendToAllProcesses(Messages::WebProcess::SetInjectedBundleParameter(parameter, IPC::DataReference(static_cast&lt;const uint8_t*&gt;([data bytes]), [data length])));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)_loadContentExtensionWithIdentifier:(NSString *)identifier serializedRules:(NSString *)serializedRules successCompletionHandler:(void (^)(NSDictionary *info))successCompletionHandler errorCompletionHandler:(void (^)(NSError *error))errorCompletionHandler
+{
+#if ENABLE(CONTENT_EXTENSIONS)
+    // For this experimentation, the ContentExtensions are handled by each WebProcess.
+    // Eventually the ContentExtension will have to be handled separately from the WebProcesses and we'll be able
+    // to provide meaningful completion handlers.
+    UNUSED_PARAM(errorCompletionHandler);
+
+    _processPool-&gt;loadContentExtension(identifier, serializedRules);
+
+    successCompletionHandler(nil);
+#endif
+}
+
</ins><span class="cx"> - (id &lt;_WKDownloadDelegate&gt;)_downloadDelegate
</span><span class="cx"> {
</span><span class="cx">     return _downloadDelegate.getAutoreleased();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKProcessPoolPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h (178150 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h        2015-01-09 01:50:41 UTC (rev 178150)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -43,6 +43,9 @@
</span><span class="cx"> - (id)_objectForBundleParameter:(NSString *)parameter;
</span><span class="cx"> - (void)_setObject:(id &lt;NSCopying, NSSecureCoding&gt;)object forBundleParameter:(NSString *)parameter;
</span><span class="cx"> 
</span><ins>+// FIXME: move the API to a better place.
+- (void)_loadContentExtensionWithIdentifier:(NSString *)identifier serializedRules:(NSString *)serializedRules successCompletionHandler:(void (^)(NSDictionary *info))successCompletionHandler errorCompletionHandler:(void (^)(NSError *error))errorCompletionHandler;
+
</ins><span class="cx"> @property (nonatomic, weak, setter=_setDownloadDelegate:) id &lt;_WKDownloadDelegate&gt; _downloadDelegate;
</span><span class="cx"> 
</span><span class="cx"> + (NSURL *)_websiteDataURLForContainerWithURL:(NSURL *)containerURL;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessPoolcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp (178150 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp        2015-01-09 01:50:41 UTC (rev 178150)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -810,6 +810,11 @@
</span><span class="cx">         process-&gt;send(Messages::WebProcess::StartMemorySampler(sampleLogSandboxHandle, sampleLogFilePath, m_memorySamplerInterval), 0);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+#if ENABLE(CONTENT_EXTENSIONS)
+    for (const auto&amp; slot : m_encodedContentExtensions)
+        process-&gt;send(Messages::WebProcess::LoadContentExtension(slot.key, slot.value), 0);
+#endif
+
</ins><span class="cx">     m_connectionClient.didCreateConnection(this, process-&gt;webConnection());
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1431,4 +1436,12 @@
</span><span class="cx">     sendToAllProcesses(Messages::WebProcess::SetMemoryCacheDisabled(disabled));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(CONTENT_EXTENSIONS)
+void WebProcessPool::loadContentExtension(const String&amp; identifier, const String&amp; serializedRules)
+{
+    m_encodedContentExtensions.set(identifier, serializedRules);
+    sendToAllProcesses(Messages::WebProcess::LoadContentExtension(identifier, serializedRules));
+}
+#endif
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessPoolh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.h (178150 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebProcessPool.h        2015-01-09 01:50:41 UTC (rev 178150)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.h        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -357,6 +357,10 @@
</span><span class="cx">         return m_processSuppressionDisabledForPageCounter.token&lt;ProcessSuppressionDisabledTokenType&gt;();
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+#if ENABLE(CONTENT_EXTENSIONS)
+    void loadContentExtension(const String&amp; identifier, const String&amp; serializedRules);
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     void platformInitialize();
</span><span class="cx"> 
</span><span class="lines">@@ -540,6 +544,10 @@
</span><span class="cx">     RetainPtr&lt;NSMutableDictionary&gt; m_bundleParameters;
</span><span class="cx">     ProcessSuppressionDisabledToken m_pluginProcessManagerProcessSuppressionDisabledToken;
</span><span class="cx"> #endif
</span><ins>+
+#if ENABLE(CONTENT_EXTENSIONS)
+    HashMap&lt;String, String&gt; m_encodedContentExtensions;
+#endif
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename T&gt;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (178150 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp        2015-01-09 01:50:41 UTC (rev 178150)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -103,6 +103,10 @@
</span><span class="cx"> #include &quot;NetworkProcessConnection.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(CONTENT_EXTENSIONS)
+#include &lt;WebCore/ContentExtensionsManager.h&gt;
+#endif
+
</ins><span class="cx"> #if ENABLE(SEC_ITEM_SHIM)
</span><span class="cx"> #include &quot;SecItemShim.h&quot;
</span><span class="cx"> #endif
</span><span class="lines">@@ -1315,6 +1319,13 @@
</span><span class="cx">     return UserData::transform(object, Transformer());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(CONTENT_EXTENSIONS)
+void WebProcess::loadContentExtension(const String&amp; identifier, const String&amp; serializedRules)
+{
+    ContentExtensions::ExtensionsManager::loadExtension(identifier, serializedRules);
+}
+#endif
+
</ins><span class="cx"> void WebProcess::setMemoryCacheDisabled(bool disabled)
</span><span class="cx"> {
</span><span class="cx">     if (memoryCache().disabled() != disabled)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (178150 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebProcess.h        2015-01-09 01:50:41 UTC (rev 178150)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -202,6 +202,10 @@
</span><span class="cx">     bool hasRichContentServices() const { return m_hasRichContentServices; }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(CONTENT_EXTENSIONS)
+    void loadContentExtension(const String&amp; identifier, const String&amp; serializedRules);
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     WebProcess();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebProcessmessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebProcess.messages.in (178150 => 178151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebProcess.messages.in        2015-01-09 01:50:41 UTC (rev 178150)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.messages.in        2015-01-09 01:56:00 UTC (rev 178151)
</span><span class="lines">@@ -93,6 +93,10 @@
</span><span class="cx">     SetEnabledServices(bool hasImageServices, bool hasSelectionServices, bool hasRichContentServices)
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(CONTENT_EXTENSIONS)
+    LoadContentExtension(String identifier, String serializedRules)
+#endif
+
</ins><span class="cx">     ProcessWillSuspend()
</span><span class="cx">     CancelProcessWillSuspend()
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>