<!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>[181000] trunk</title>
</head>
<body>

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

<h3>Log Message</h3>
<pre>[Content Extensions] Split parsing and compiling of content extensions into their own files
https://bugs.webkit.org/show_bug.cgi?id=142259

Reviewed by Anders Carlsson.

Source/WebCore:

Added new unit test:
    ContentFilterTest.Basic

* WebCore.xcodeproj/project.pbxproj:
Add new files (CompiledContentExtension.h/cpp, ContentExtensionCompiler.h/cpp, and ContentExtensionParser.h/cpp)

* contentextensions/CompiledContentExtension.cpp: Added.
* contentextensions/CompiledContentExtension.h: Added.
Add new class for holding onto the compiled content extension itself. Make it ThreadSafeRefCounted so it is easy
to move between threads which will be important in a subsequent patch where we enable compilation on a background
thread.

* contentextensions/ContentExtensionCompiler.cpp: Added.
(WebCore::ContentExtensions::serializeActions):
(WebCore::ContentExtensions::compileRuleList):
* contentextensions/ContentExtensionCompiler.h: Added.
Moving compilation to its own file. Was previously in ContentExtensionsBackend. This is necessary because
we will want to be able to compile without the need of a backend.

* contentextensions/ContentExtensionParser.cpp: Copied from contentextensions/ContentExtensionsManager.cpp.
* contentextensions/ContentExtensionParser.h: Copied from contentextensions/ContentExtensionsManager.h.
Renamed ContentExtensionsManager to ContentExtensionParser, since that is all it is doing.

* contentextensions/ContentExtensionsBackend.cpp:
(WebCore::ContentExtensions::ContentExtensionsBackend::addContentExtension):
(WebCore::ContentExtensions::ContentExtensionsBackend::removeContentExtension):
(WebCore::ContentExtensions::ContentExtensionsBackend::removeAllContentExtensions):
(WebCore::ContentExtensions::ContentExtensionsBackend::actionsForURL):
(WebCore::ContentExtensions::ContentExtensionsBackend::serializeActions): Deleted.
(WebCore::ContentExtensions::ContentExtensionsBackend::setRuleList): Deleted.
(WebCore::ContentExtensions::ContentExtensionsBackend::removeRuleList): Deleted.
(WebCore::ContentExtensions::ContentExtensionsBackend::removeAllRuleLists): Deleted.
* contentextensions/ContentExtensionsBackend.h:
Change the backend to use the new CompiledContentExtension and change the terminology to
reference content extensions, rather than rule lists.

* page/UserContentController.cpp:
(WebCore::UserContentController::addUserContentFilter):
(WebCore::UserContentController::removeUserContentFilter):
(WebCore::UserContentController::removeAllUserContentFilters):
Update for new names and change addUserContentFilter to explicitly compile the JSON
rule list before handing it to the backend. In subsequent changes, addUserContentFilter
should be changed to take the compiled content extension, and it should become the responsibility
of the called (WebKit) to create them.

Tools:

Add basic unit test for the content filter compiler.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebCore/ContentFilter.cpp: Added.
(WebCore::ContentExtensions::operator&lt;&lt;):
(TestWebKitAPI::ContentFilterTest::SetUp):
(TestWebKitAPI::TEST_F):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</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="#trunkSourceWebCorepageUserContentControllercpp">trunk/Source/WebCore/page/UserContentController.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorecontentextensionsCompiledContentExtensioncpp">trunk/Source/WebCore/contentextensions/CompiledContentExtension.cpp</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsCompiledContentExtensionh">trunk/Source/WebCore/contentextensions/CompiledContentExtension.h</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsContentExtensionCompilercpp">trunk/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsContentExtensionCompilerh">trunk/Source/WebCore/contentextensions/ContentExtensionCompiler.h</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsContentExtensionParsercpp">trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsContentExtensionParserh">trunk/Source/WebCore/contentextensions/ContentExtensionParser.h</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebCoreContentFiltercpp">trunk/Tools/TestWebKitAPI/Tests/WebCore/ContentFilter.cpp</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorecontentextensionsContentExtensionsManagercpp">trunk/Source/WebCore/contentextensions/ContentExtensionsManager.cpp</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsContentExtensionsManagerh">trunk/Source/WebCore/contentextensions/ContentExtensionsManager.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (180999 => 181000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-03-04 15:52:13 UTC (rev 180999)
+++ trunk/Source/WebCore/ChangeLog        2015-03-04 16:41:31 UTC (rev 181000)
</span><span class="lines">@@ -1,3 +1,55 @@
</span><ins>+2015-03-03  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        [Content Extensions] Split parsing and compiling of content extensions into their own files
+        https://bugs.webkit.org/show_bug.cgi?id=142259
+
+        Reviewed by Anders Carlsson.
+
+        Added new unit test:
+            ContentFilterTest.Basic
+
+        * WebCore.xcodeproj/project.pbxproj:
+        Add new files (CompiledContentExtension.h/cpp, ContentExtensionCompiler.h/cpp, and ContentExtensionParser.h/cpp)
+
+        * contentextensions/CompiledContentExtension.cpp: Added.
+        * contentextensions/CompiledContentExtension.h: Added.
+        Add new class for holding onto the compiled content extension itself. Make it ThreadSafeRefCounted so it is easy
+        to move between threads which will be important in a subsequent patch where we enable compilation on a background
+        thread.
+
+        * contentextensions/ContentExtensionCompiler.cpp: Added.
+        (WebCore::ContentExtensions::serializeActions):
+        (WebCore::ContentExtensions::compileRuleList):
+        * contentextensions/ContentExtensionCompiler.h: Added.
+        Moving compilation to its own file. Was previously in ContentExtensionsBackend. This is necessary because
+        we will want to be able to compile without the need of a backend.
+
+        * contentextensions/ContentExtensionParser.cpp: Copied from contentextensions/ContentExtensionsManager.cpp.
+        * contentextensions/ContentExtensionParser.h: Copied from contentextensions/ContentExtensionsManager.h.
+        Renamed ContentExtensionsManager to ContentExtensionParser, since that is all it is doing.
+
+        * contentextensions/ContentExtensionsBackend.cpp:
+        (WebCore::ContentExtensions::ContentExtensionsBackend::addContentExtension):
+        (WebCore::ContentExtensions::ContentExtensionsBackend::removeContentExtension):
+        (WebCore::ContentExtensions::ContentExtensionsBackend::removeAllContentExtensions):
+        (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForURL):
+        (WebCore::ContentExtensions::ContentExtensionsBackend::serializeActions): Deleted.
+        (WebCore::ContentExtensions::ContentExtensionsBackend::setRuleList): Deleted.
+        (WebCore::ContentExtensions::ContentExtensionsBackend::removeRuleList): Deleted.
+        (WebCore::ContentExtensions::ContentExtensionsBackend::removeAllRuleLists): Deleted.
+        * contentextensions/ContentExtensionsBackend.h:
+        Change the backend to use the new CompiledContentExtension and change the terminology to
+        reference content extensions, rather than rule lists.
+
+        * page/UserContentController.cpp:
+        (WebCore::UserContentController::addUserContentFilter):
+        (WebCore::UserContentController::removeUserContentFilter):
+        (WebCore::UserContentController::removeAllUserContentFilters):
+        Update for new names and change addUserContentFilter to explicitly compile the JSON
+        rule list before handing it to the backend. In subsequent changes, addUserContentFilter
+        should be changed to take the compiled content extension, and it should become the responsibility
+        of the called (WebKit) to create them.
+
</ins><span class="cx"> 2015-03-04  Philippe Normand  &lt;pnormand@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GStreamer] the GST_SCHEDULING_FLAG_BANDWIDTH_LIMITED should be wrapped by a ifdef
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (180999 => 181000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-03-04 15:52:13 UTC (rev 180999)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-03-04 16:41:31 UTC (rev 181000)
</span><span class="lines">@@ -1031,12 +1031,12 @@
</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><del>-                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, ); }; };
</del><ins>+                26F0C8971A2E724B002794F8 /* ContentExtensionParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F0C8951A2E724B002794F8 /* ContentExtensionParser.cpp */; };
+                26F0C8981A2E724B002794F8 /* ContentExtensionParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 26F0C8961A2E724B002794F8 /* ContentExtensionParser.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 26F0C89B1A2EC110002794F8 /* ContentExtensionRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F0C8991A2EC110002794F8 /* ContentExtensionRule.cpp */; };
</span><del>-                26F0C89C1A2EC110002794F8 /* ContentExtensionRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 26F0C89A1A2EC110002794F8 /* ContentExtensionRule.h */; };
</del><ins>+                26F0C89C1A2EC110002794F8 /* ContentExtensionRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 26F0C89A1A2EC110002794F8 /* ContentExtensionRule.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 26F0C89F1A2EC3BE002794F8 /* ContentExtensionsBackend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F0C89D1A2EC3BE002794F8 /* ContentExtensionsBackend.cpp */; };
</span><del>-                26F0C8A01A2EC3BE002794F8 /* ContentExtensionsBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = 26F0C89E1A2EC3BE002794F8 /* ContentExtensionsBackend.h */; };
</del><ins>+                26F0C8A01A2EC3BE002794F8 /* ContentExtensionsBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = 26F0C89E1A2EC3BE002794F8 /* ContentExtensionsBackend.h */; settings = {ATTRIBUTES = (Private, ); }; };
</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">@@ -2144,10 +2144,10 @@
</span><span class="cx">                 5C4304B6191AEF46000E2BC0 /* JSEXTShaderTextureLOD.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C4304B4191AEF46000E2BC0 /* JSEXTShaderTextureLOD.h */; };
</span><span class="cx">                 5C9A7A751AA0F6EA00958ACF /* DFABytecodeCompiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C39305E1AA0F6A90029C816 /* DFABytecodeCompiler.cpp */; };
</span><span class="cx">                 5C9A7A761AA0F6ED00958ACF /* DFABytecodeInterpreter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C3930601AA0F6A90029C816 /* DFABytecodeInterpreter.cpp */; };
</span><del>-                5CD9F5661AA0F73C00DA45FF /* DFABytecode.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C39305D1AA0F6A90029C816 /* DFABytecode.h */; };
</del><ins>+                5CD9F5661AA0F73C00DA45FF /* DFABytecode.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C39305D1AA0F6A90029C816 /* DFABytecode.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 5CD9F5671AA0F74200DA45FF /* DFABytecodeCompiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C39305F1AA0F6A90029C816 /* DFABytecodeCompiler.h */; };
</span><span class="cx">                 5CD9F5681AA0F74600DA45FF /* DFABytecodeInterpreter.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C3930611AA0F6A90029C816 /* DFABytecodeInterpreter.h */; };
</span><del>-                5CDFA6C81AA4F2DA00EA8746 /* ContentExtensionActions.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CDFA6C71AA4F2DA00EA8746 /* ContentExtensionActions.h */; };
</del><ins>+                5CDFA6C81AA4F2DA00EA8746 /* ContentExtensionActions.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CDFA6C71AA4F2DA00EA8746 /* ContentExtensionActions.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 5CFC4350192409E300A0D3B5 /* PointerLockController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CFC434E192406A900A0D3B5 /* PointerLockController.cpp */; };
</span><span class="cx">                 5D21A80213ECE5DF00BB7064 /* WebVTTParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5D21A80013ECE5DF00BB7064 /* WebVTTParser.cpp */; };
</span><span class="cx">                 5D21A80313ECE5DF00BB7064 /* WebVTTParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D21A80113ECE5DF00BB7064 /* WebVTTParser.h */; };
</span><span class="lines">@@ -2500,6 +2500,10 @@
</span><span class="cx">                 7C74D43818823B1900E5ED57 /* UTextProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C74D43618823B1900E5ED57 /* UTextProvider.h */; };
</span><span class="cx">                 7C74D43B1882400400E5ED57 /* UTextProviderUTF16.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C74D4391882400400E5ED57 /* UTextProviderUTF16.cpp */; };
</span><span class="cx">                 7C74D43C1882400400E5ED57 /* UTextProviderUTF16.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C74D43A1882400400E5ED57 /* UTextProviderUTF16.h */; };
</span><ins>+                7C93F3491AA6BA5E00A98BAB /* CompiledContentExtension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C93F3471AA6BA5E00A98BAB /* CompiledContentExtension.cpp */; };
+                7C93F34A1AA6BA5E00A98BAB /* CompiledContentExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C93F3481AA6BA5E00A98BAB /* CompiledContentExtension.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                7C93F34D1AA6BF0700A98BAB /* ContentExtensionCompiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C93F34B1AA6BF0700A98BAB /* ContentExtensionCompiler.cpp */; };
+                7C93F34E1AA6BF0700A98BAB /* ContentExtensionCompiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C93F34C1AA6BF0700A98BAB /* ContentExtensionCompiler.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 7C9DBFED1A9C49B1000D6B25 /* JSHTMLAttachmentElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C9DBFEB1A9C49B1000D6B25 /* JSHTMLAttachmentElement.cpp */; };
</span><span class="cx">                 7C9DBFEE1A9C49B1000D6B25 /* JSHTMLAttachmentElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C9DBFEC1A9C49B1000D6B25 /* JSHTMLAttachmentElement.h */; };
</span><span class="cx">                 7CC289DF1AA0FE5D009A9CE3 /* URLRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = CDEE393817974274001D7580 /* URLRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -8078,8 +8082,8 @@
</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><del>-                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;; };
</del><ins>+                26F0C8951A2E724B002794F8 /* ContentExtensionParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentExtensionParser.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                26F0C8961A2E724B002794F8 /* ContentExtensionParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentExtensionParser.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 26F0C8991A2EC110002794F8 /* ContentExtensionRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentExtensionRule.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 26F0C89A1A2EC110002794F8 /* ContentExtensionRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentExtensionRule.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 26F0C89D1A2EC3BE002794F8 /* ContentExtensionsBackend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentExtensionsBackend.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -9710,6 +9714,10 @@
</span><span class="cx">                 7C74D43618823B1900E5ED57 /* UTextProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTextProvider.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C74D4391882400400E5ED57 /* UTextProviderUTF16.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UTextProviderUTF16.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C74D43A1882400400E5ED57 /* UTextProviderUTF16.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTextProviderUTF16.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                7C93F3471AA6BA5E00A98BAB /* CompiledContentExtension.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CompiledContentExtension.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C93F3481AA6BA5E00A98BAB /* CompiledContentExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompiledContentExtension.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C93F34B1AA6BF0700A98BAB /* ContentExtensionCompiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentExtensionCompiler.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C93F34C1AA6BF0700A98BAB /* ContentExtensionCompiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentExtensionCompiler.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 7C9DBFEA1A9C489F000D6B25 /* HTMLAttachmentElement.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HTMLAttachmentElement.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C9DBFEB1A9C49B1000D6B25 /* JSHTMLAttachmentElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLAttachmentElement.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C9DBFEC1A9C49B1000D6B25 /* JSHTMLAttachmentElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLAttachmentElement.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -15409,14 +15417,18 @@
</span><span class="cx">                 26F0C8901A2D79CB002794F8 /* contentextensions */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                7C93F3471AA6BA5E00A98BAB /* CompiledContentExtension.cpp */,
+                                7C93F3481AA6BA5E00A98BAB /* CompiledContentExtension.h */,
</ins><span class="cx">                                 5CDFA6C71AA4F2DA00EA8746 /* ContentExtensionActions.h */,
</span><ins>+                                7C93F34B1AA6BF0700A98BAB /* ContentExtensionCompiler.cpp */,
+                                7C93F34C1AA6BF0700A98BAB /* ContentExtensionCompiler.h */,
+                                26F0C8951A2E724B002794F8 /* ContentExtensionParser.cpp */,
+                                26F0C8961A2E724B002794F8 /* ContentExtensionParser.h */,
</ins><span class="cx">                                 26F0C8991A2EC110002794F8 /* ContentExtensionRule.cpp */,
</span><span class="cx">                                 26F0C89A1A2EC110002794F8 /* ContentExtensionRule.h */,
</span><span class="cx">                                 26F0C89D1A2EC3BE002794F8 /* ContentExtensionsBackend.cpp */,
</span><span class="cx">                                 26F0C89E1A2EC3BE002794F8 /* ContentExtensionsBackend.h */,
</span><span class="cx">                                 262391351A648CEE007251A3 /* ContentExtensionsDebugging.h */,
</span><del>-                                26F0C8951A2E724B002794F8 /* ContentExtensionsManager.cpp */,
-                                26F0C8961A2E724B002794F8 /* ContentExtensionsManager.h */,
</del><span class="cx">                                 267725F61A5B3AD9003C24DD /* DFA.cpp */,
</span><span class="cx">                                 267725F71A5B3AD9003C24DD /* DFA.h */,
</span><span class="cx">                                 5C39305D1AA0F6A90029C816 /* DFABytecode.h */,
</span><span class="lines">@@ -25239,7 +25251,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><del>-                                26F0C8981A2E724B002794F8 /* ContentExtensionsManager.h in Headers */,
</del><ins>+                                26F0C8981A2E724B002794F8 /* ContentExtensionParser.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">@@ -26445,6 +26457,7 @@
</span><span class="cx">                                 0854B0211255E4E600B9CDD0 /* SVGInlineTextBox.h in Headers */,
</span><span class="cx">                                 B2227A300D00BF220071B782 /* SVGLangSpace.h in Headers */,
</span><span class="cx">                                 B2227A330D00BF220071B782 /* SVGLength.h in Headers */,
</span><ins>+                                7C93F34A1AA6BA5E00A98BAB /* CompiledContentExtension.h in Headers */,
</ins><span class="cx">                                 7134496E146941B300720312 /* SVGLengthContext.h in Headers */,
</span><span class="cx">                                 B2227A360D00BF220071B782 /* SVGLengthList.h in Headers */,
</span><span class="cx">                                 B2227A390D00BF220071B782 /* SVGLinearGradientElement.h in Headers */,
</span><span class="lines">@@ -26509,6 +26522,7 @@
</span><span class="cx">                                 8419D2BA120E0C7600141F8F /* SVGPathStringBuilder.h in Headers */,
</span><span class="cx">                                 84300BD6120C9AAC0021954A /* SVGPathStringSource.h in Headers */,
</span><span class="cx">                                 84C5B2FB1216DC810088B53A /* SVGPathTraversalStateBuilder.h in Headers */,
</span><ins>+                                7C93F34E1AA6BF0700A98BAB /* ContentExtensionCompiler.h in Headers */,
</ins><span class="cx">                                 71A57DF2154BE25C0009D120 /* SVGPathUtilities.h in Headers */,
</span><span class="cx">                                 B2227A880D00BF220071B782 /* SVGPatternElement.h in Headers */,
</span><span class="cx">                                 B2227A8C0D00BF220071B782 /* SVGPointList.h in Headers */,
</span><span class="lines">@@ -28418,7 +28432,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><del>-                                26F0C8971A2E724B002794F8 /* ContentExtensionsManager.cpp in Sources */,
</del><ins>+                                26F0C8971A2E724B002794F8 /* ContentExtensionParser.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">@@ -28893,6 +28907,7 @@
</span><span class="cx">                                 B2FA3E160AB75A6F000E5AC4 /* JSSVGViewElement.cpp in Sources */,
</span><span class="cx">                                 7118FED415685CC60030B79A /* JSSVGViewSpec.cpp in Sources */,
</span><span class="cx">                                 8485227D1190162C006EDC7F /* JSSVGVKernElement.cpp in Sources */,
</span><ins>+                                7C93F3491AA6BA5E00A98BAB /* CompiledContentExtension.cpp in Sources */,
</ins><span class="cx">                                 71DCB7011568197600862271 /* JSSVGZoomAndPan.cpp in Sources */,
</span><span class="cx">                                 B2FA3E180AB75A6F000E5AC4 /* JSSVGZoomEvent.cpp in Sources */,
</span><span class="cx">                                 65DF320309D1CC60000BE325 /* JSText.cpp in Sources */,
</span><span class="lines">@@ -29076,6 +29091,7 @@
</span><span class="cx">                                 CD1B4A65160786AE00282DF9 /* MediaKeyNeededEvent.cpp in Sources */,
</span><span class="cx">                                 6C568CB019DAFEA000430CA2 /* MaskImageOperation.cpp in Sources */,
</span><span class="cx">                                 CDA98E0D1603FE4A00FEA3B1 /* MediaKeys.cpp in Sources */,
</span><ins>+                                7C93F34D1AA6BF0700A98BAB /* ContentExtensionCompiler.cpp in Sources */,
</ins><span class="cx">                                 CDA98E0E1603FE5800FEA3B1 /* MediaKeySession.cpp in Sources */,
</span><span class="cx">                                 A8EA80090A19516E00A8EF5F /* MediaList.cpp in Sources */,
</span><span class="cx">                                 E44613E30CD6819F00FADA75 /* MediaPlayer.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsCompiledContentExtensioncpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/contentextensions/CompiledContentExtension.cpp (0 => 181000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/CompiledContentExtension.cpp                                (rev 0)
+++ trunk/Source/WebCore/contentextensions/CompiledContentExtension.cpp        2015-03-04 16:41:31 UTC (rev 181000)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;CompiledContentExtension.h&quot;
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+namespace WebCore {
+namespace ContentExtensions {
+
+Ref&lt;CompiledContentExtension&gt; CompiledContentExtension::create(Vector&lt;DFABytecode&gt;&amp;&amp; bytecode, Vector&lt;SerializedActionByte&gt;&amp;&amp; actions)
+{
+    return WTF::adoptRef(*new CompiledContentExtension(WTF::move(bytecode), WTF::move(actions)));
+}
+
+CompiledContentExtension::CompiledContentExtension(Vector&lt;DFABytecode&gt;&amp;&amp; bytecode, Vector&lt;SerializedActionByte&gt;&amp;&amp; actions)
+    : m_bytecode(WTF::move(bytecode))
+    , m_actions(WTF::move(actions))
+{
+}
+
+} // namespace ContentExtensions
+} // namespace WebCore
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
</ins></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsCompiledContentExtensionh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/contentextensions/CompiledContentExtension.h (0 => 181000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/CompiledContentExtension.h                                (rev 0)
+++ trunk/Source/WebCore/contentextensions/CompiledContentExtension.h        2015-03-04 16:41:31 UTC (rev 181000)
</span><span class="lines">@@ -0,0 +1,59 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CompiledContentExtension_h
+#define CompiledContentExtension_h
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+#include &quot;ContentExtensionRule.h&quot;
+#include &quot;DFABytecode.h&quot;
+#include &lt;wtf/ThreadSafeRefCounted.h&gt;
+#include &lt;wtf/Vector.h&gt;
+
+namespace WebCore {
+
+namespace ContentExtensions {
+
+class CompiledContentExtension : public ThreadSafeRefCounted&lt;CompiledContentExtension&gt; {
+public:
+    static Ref&lt;CompiledContentExtension&gt; create(Vector&lt;DFABytecode&gt;&amp;&amp;, Vector&lt;SerializedActionByte&gt;&amp;&amp;);
+
+    const Vector&lt;DFABytecode&gt;&amp; bytecode() const { return m_bytecode; }
+    const Vector&lt;SerializedActionByte&gt;&amp; actions() const { return m_actions; }
+
+private:
+    CompiledContentExtension(Vector&lt;DFABytecode&gt;&amp;&amp;, Vector&lt;SerializedActionByte&gt;&amp;&amp;);
+
+    Vector&lt;DFABytecode&gt; m_bytecode;
+    Vector&lt;SerializedActionByte&gt; m_actions;
+};
+
+} // namespace ContentExtensions
+
+} // namespace WebCore
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
+#endif // CompiledContentExtension_h
</ins></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsContentExtensionCompilercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp (0 => 181000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp                                (rev 0)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp        2015-03-04 16:41:31 UTC (rev 181000)
</span><span class="lines">@@ -0,0 +1,157 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;ContentExtensionCompiler.h&quot;
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+#include &quot;CompiledContentExtension.h&quot;
+#include &quot;ContentExtensionActions.h&quot;
+#include &quot;ContentExtensionParser.h&quot;
+#include &quot;ContentExtensionRule.h&quot;
+#include &quot;ContentExtensionsDebugging.h&quot;
+#include &quot;DFABytecodeCompiler.h&quot;
+#include &quot;NFA.h&quot;
+#include &quot;NFAToDFA.h&quot;
+#include &quot;URLFilterParser.h&quot;
+#include &lt;wtf/CurrentTime.h&gt;
+#include &lt;wtf/DataLog.h&gt;
+#include &lt;wtf/text/CString.h&gt;
+
+namespace WebCore {
+namespace ContentExtensions {
+
+static Vector&lt;unsigned&gt; serializeActions(const Vector&lt;ContentExtensionRule&gt;&amp; ruleList, Vector&lt;SerializedActionByte&gt;&amp; actions)
+{
+    ASSERT(!actions.size());
+    
+    Vector&lt;unsigned&gt; actionLocations;
+        
+    for (unsigned ruleIndex = 0; ruleIndex &lt; ruleList.size(); ++ruleIndex) {
+        const ContentExtensionRule&amp; rule = ruleList[ruleIndex];
+        actionLocations.append(actions.size());
+        
+        switch (rule.action().type()) {
+        case ActionType::InvalidAction:
+            RELEASE_ASSERT_NOT_REACHED();
+
+        case ActionType::BlockLoad:
+        case ActionType::BlockCookies:
+        case ActionType::IgnorePreviousRules:
+            actions.append(static_cast&lt;SerializedActionByte&gt;(rule.action().type()));
+            break;
+
+        case ActionType::CSSDisplayNone: {
+            const String&amp; selector = rule.action().cssSelector();
+            // Append action type (1 byte).
+            actions.append(static_cast&lt;SerializedActionByte&gt;(ActionType::CSSDisplayNone));
+            // Append Selector length (4 bytes).
+            unsigned selectorLength = selector.length();
+            actions.resize(actions.size() + sizeof(unsigned));
+            *reinterpret_cast&lt;unsigned*&gt;(&amp;actions[actions.size() - sizeof(unsigned)]) = selectorLength;
+            bool wideCharacters = !selector.is8Bit();
+            actions.append(wideCharacters);
+            // Append Selector.
+            if (wideCharacters) {
+                for (unsigned i = 0; i &lt; selectorLength; i++) {
+                    actions.resize(actions.size() + sizeof(UChar));
+                    *reinterpret_cast&lt;UChar*&gt;(&amp;actions[actions.size() - sizeof(UChar)]) = selector[i];
+                }
+            } else {
+                for (unsigned i = 0; i &lt; selectorLength; i++)
+                    actions.append(selector[i]);
+            }
+            break;
+        }
+        }
+    }
+    return actionLocations;
+}
+
+
+Ref&lt;CompiledContentExtension&gt; compileRuleList(const String&amp; ruleList)
+{
+    auto parsedRuleList = parseRuleList(ruleList);
+
+#if CONTENT_EXTENSIONS_PERFORMANCE_REPORTING
+    double nfaBuildTimeStart = monotonicallyIncreasingTime();
+#endif
+
+    Vector&lt;SerializedActionByte&gt; actions;
+    Vector&lt;unsigned&gt; actionLocations = serializeActions(parsedRuleList, actions);
+
+    NFA nfa;
+    URLFilterParser urlFilterParser(nfa);
+    for (unsigned ruleIndex = 0; ruleIndex &lt; parsedRuleList.size(); ++ruleIndex) {
+        const ContentExtensionRule&amp; contentExtensionRule = parsedRuleList[ruleIndex];
+        const Trigger&amp; trigger = contentExtensionRule.trigger();
+        ASSERT(trigger.urlFilter.length());
+
+        String error = urlFilterParser.addPattern(trigger.urlFilter, trigger.urlFilterIsCaseSensitive, actionLocations[ruleIndex]);
+
+        if (!error.isNull()) {
+            dataLogF(&quot;Error while parsing %s: %s\n&quot;, trigger.urlFilter.utf8().data(), error.utf8().data());
+            continue;
+        }
+    }
+
+#if CONTENT_EXTENSIONS_PERFORMANCE_REPORTING
+    double nfaBuildTimeEnd = monotonicallyIncreasingTime();
+    dataLogF(&quot;    Time spent building the NFA: %f\n&quot;, (nfaBuildTimeEnd - nfaBuildTimeStart));
+#endif
+
+#if CONTENT_EXTENSIONS_STATE_MACHINE_DEBUGGING
+    nfa.debugPrintDot();
+#endif
+
+#if CONTENT_EXTENSIONS_PERFORMANCE_REPORTING
+    double dfaBuildTimeStart = monotonicallyIncreasingTime();
+#endif
+
+    const DFA dfa = NFAToDFA::convert(nfa);
+
+#if CONTENT_EXTENSIONS_PERFORMANCE_REPORTING
+    double dfaBuildTimeEnd = monotonicallyIncreasingTime();
+    dataLogF(&quot;    Time spent building the DFA: %f\n&quot;, (dfaBuildTimeEnd - dfaBuildTimeStart));
+#endif
+
+    // FIXME: never add a DFA that only matches the empty set.
+
+#if CONTENT_EXTENSIONS_STATE_MACHINE_DEBUGGING
+    dfa.debugPrintDot();
+#endif
+
+    Vector&lt;DFABytecode&gt; bytecode;
+    DFABytecodeCompiler compiler(dfa, bytecode);
+    compiler.compile();
+
+    return CompiledContentExtension::create(WTF::move(bytecode), WTF::move(actions));
+}
+
+} // namespace ContentExtensions
+} // namespace WebCore
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
</ins></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsContentExtensionCompilerh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/contentextensions/ContentExtensionCompiler.h (0 => 181000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/ContentExtensionCompiler.h                                (rev 0)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionCompiler.h        2015-03-04 16:41:31 UTC (rev 181000)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ContentExtensionCompiler_h
+#define ContentExtensionCompiler_h
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+#include &quot;CompiledContentExtension.h&quot;
+#include &lt;wtf/Forward.h&gt;
+#include &lt;wtf/Ref.h&gt;
+
+namespace WebCore {
+namespace ContentExtensions {
+
+WEBCORE_EXPORT Ref&lt;CompiledContentExtension&gt; compileRuleList(const String&amp;);
+
+} // namespace ContentExtensions
+} // namespace WebCore
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
+#endif // ContentExtensionCompiler_h
</ins></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsContentExtensionParsercppfromrev180984trunkSourceWebCorecontentextensionsContentExtensionsManagercpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp (from rev 180984, trunk/Source/WebCore/contentextensions/ContentExtensionsManager.cpp) (0 => 181000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp                                (rev 0)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp        2015-03-04 16:41:31 UTC (rev 181000)
</span><span class="lines">@@ -0,0 +1,200 @@
</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;ContentExtensionParser.h&quot;
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+#include &quot;ContentExtensionRule.h&quot;
+#include &quot;ContentExtensionsBackend.h&quot;
+#include &quot;ContentExtensionsDebugging.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/CurrentTime.h&gt;
+#include &lt;wtf/text/WTFString.h&gt;
+
+using namespace JSC;
+
+namespace WebCore {
+
+namespace ContentExtensions {
+
+static bool loadTrigger(ExecState&amp; exec, JSObject&amp; ruleObject, 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;
+
+    JSValue urlFilterCaseObject = triggerObject.get(&amp;exec, Identifier(&amp;exec, &quot;url-filter-is-case-sensitive&quot;));
+    if (urlFilterCaseObject &amp;&amp; !exec.hadException() &amp;&amp; urlFilterCaseObject.isBoolean())
+        trigger.urlFilterIsCaseSensitive = urlFilterCaseObject.toBoolean(&amp;exec);
+
+    return true;
+}
+
+static bool loadAction(ExecState&amp; exec, JSObject&amp; ruleObject, 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;)
+        action = ActionType::BlockLoad;
+    else if (actionType == &quot;ignore-previous-rules&quot;)
+        action = ActionType::IgnorePreviousRules;
+    else if (actionType == &quot;block-cookies&quot;)
+        action = ActionType::BlockCookies;
+    else if (actionType == &quot;css-display-none&quot;) {
+        JSValue selector = actionObject.get(&amp;exec, Identifier(&amp;exec, &quot;selector&quot;));
+        if (!selector || exec.hadException() || !selector.isString()) {
+            WTFLogAlways(&quot;css-display-none action type requires a selector&quot;);
+            return false;
+        }
+        action = Action(ActionType::CSSDisplayNone, selector.toWTFString(&amp;exec));
+    } else {
+        WTFLogAlways(&quot;Unrecognized action: \&quot;%s\&quot;&quot;, actionType.utf8().data());
+        return false;
+    }
+
+    return true;
+}
+
+static void loadRule(ExecState&amp; exec, JSObject&amp; ruleObject, Vector&lt;ContentExtensionRule&gt;&amp; ruleList)
+{
+    Trigger trigger;
+    if (!loadTrigger(exec, ruleObject, trigger))
+        return;
+
+    Action action;
+    if (!loadAction(exec, ruleObject, action))
+        return;
+
+    ruleList.append(ContentExtensionRule(trigger, action));
+}
+
+static Vector&lt;ContentExtensionRule&gt; loadEncodedRules(ExecState&amp; exec, const String&amp; rules)
+{
+    JSValue decodedRules = JSONParse(&amp;exec, rules);
+
+    if (exec.hadException() || !decodedRules) {
+        WTFLogAlways(&quot;Failed to parse the JSON string.&quot;);
+        return Vector&lt;ContentExtensionRule&gt;();
+    }
+
+    if (decodedRules.isObject()) {
+        JSObject* topLevelObject = decodedRules.toObject(&amp;exec);
+        if (!topLevelObject || exec.hadException()) {
+            WTFLogAlways(&quot;Invalid input, the top level structure is not an object.&quot;);
+            return Vector&lt;ContentExtensionRule&gt;();
+        }
+
+        if (!isJSArray(topLevelObject)) {
+            WTFLogAlways(&quot;Invalid input, the top level object is not an array.&quot;);
+            return Vector&lt;ContentExtensionRule&gt;();
+        }
+
+        Vector&lt;ContentExtensionRule&gt; ruleList;
+        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(&amp;exec, i);
+            if (exec.hadException() || !value) {
+                WTFLogAlways(&quot;Invalid object in the array.&quot;);
+                continue;
+            }
+
+            JSObject* ruleObject = value.toObject(&amp;exec);
+            if (!ruleObject || exec.hadException()) {
+                WTFLogAlways(&quot;Invalid rule&quot;);
+                continue;
+            }
+            loadRule(exec, *ruleObject, ruleList);
+        }
+        return ruleList;
+    }
+    return Vector&lt;ContentExtensionRule&gt;();
+}
+
+Vector&lt;ContentExtensionRule&gt; parseRuleList(const String&amp; rules)
+{
+#if CONTENT_EXTENSIONS_PERFORMANCE_REPORTING
+    double loadExtensionStartTime = monotonicallyIncreasingTime();
+#endif
+    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();
+    Vector&lt;ContentExtensionRule&gt; ruleList = loadEncodedRules(*exec, rules);
+
+    vm.clear();
+
+    if (ruleList.isEmpty())
+        WTFLogAlways(&quot;Empty extension.&quot;);
+
+#if CONTENT_EXTENSIONS_PERFORMANCE_REPORTING
+    double loadExtensionEndTime = monotonicallyIncreasingTime();
+    dataLogF(&quot;Time spent loading extension %s: %f\n&quot;, identifier.utf8().data(), (loadExtensionEndTime - loadExtensionStartTime));
+#endif
+
+    return ruleList;
+}
+
+} // namespace ContentExtensions
+} // namespace WebCore
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
</ins></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsContentExtensionParserhfromrev180984trunkSourceWebCorecontentextensionsContentExtensionsManagerh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/contentextensions/ContentExtensionParser.h (from rev 180984, trunk/Source/WebCore/contentextensions/ContentExtensionsManager.h) (0 => 181000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/ContentExtensionParser.h                                (rev 0)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionParser.h        2015-03-04 16:41:31 UTC (rev 181000)
</span><span class="lines">@@ -0,0 +1,47 @@
</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 ContentExtensionParser_h
+#define ContentExtensionParser_h
+
+#if ENABLE(CONTENT_EXTENSIONS)
+
+#include &lt;wtf/Forward.h&gt;
+#include &lt;wtf/Vector.h&gt;
+
+namespace WebCore {
+
+namespace ContentExtensions {
+
+class ContentExtensionRule;
+
+Vector&lt;ContentExtensionRule&gt; parseRuleList(const String&amp; rules);
+
+} // namespace ContentExtensions
+} // namespace WebCore
+
+#endif // ENABLE(CONTENT_EXTENSIONS)
+
+#endif // ContentExtensionParser_h
</ins></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsContentExtensionsBackendcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp (180999 => 181000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp        2015-03-04 15:52:13 UTC (rev 180999)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp        2015-03-04 16:41:31 UTC (rev 181000)
</span><span class="lines">@@ -28,143 +28,37 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CONTENT_EXTENSIONS)
</span><span class="cx"> 
</span><del>-#include &quot;ContentExtensionsDebugging.h&quot;
-#include &quot;DFABytecodeCompiler.h&quot;
</del><ins>+#include &quot;CompiledContentExtension.h&quot;
</ins><span class="cx"> #include &quot;DFABytecodeInterpreter.h&quot;
</span><del>-#include &quot;NFA.h&quot;
-#include &quot;NFAToDFA.h&quot;
</del><span class="cx"> #include &quot;URL.h&quot;
</span><del>-#include &quot;URLFilterParser.h&quot;
-#include &lt;wtf/CurrentTime.h&gt;
-#include &lt;wtf/DataLog.h&gt;
-#include &lt;wtf/NeverDestroyed.h&gt;
</del><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> namespace ContentExtensions {
</span><span class="cx">     
</span><del>-Vector&lt;unsigned&gt; ContentExtensionsBackend::serializeActions(const Vector&lt;ContentExtensionRule&gt;&amp; ruleList, Vector&lt;SerializedActionByte&gt;&amp; actions)
</del><ins>+void ContentExtensionsBackend::addContentExtension(const String&amp; identifier, RefPtr&lt;CompiledContentExtension&gt; compiledContentExtension)
</ins><span class="cx"> {
</span><del>-    ASSERT(!actions.size());
-    
-    Vector&lt;unsigned&gt; actionLocations;
-        
-    for (unsigned ruleIndex = 0; ruleIndex &lt; ruleList.size(); ++ruleIndex) {
-        const ContentExtensionRule&amp; rule = ruleList[ruleIndex];
-        actionLocations.append(actions.size());
-        
-        switch (rule.action().type()) {
-        case ActionType::InvalidAction:
-            RELEASE_ASSERT_NOT_REACHED();
-
-        case ActionType::BlockLoad:
-        case ActionType::BlockCookies:
-        case ActionType::IgnorePreviousRules:
-            actions.append(static_cast&lt;SerializedActionByte&gt;(rule.action().type()));
-            break;
-
-        case ActionType::CSSDisplayNone: {
-            const String&amp; selector = rule.action().cssSelector();
-            // Append action type (1 byte).
-            actions.append(static_cast&lt;SerializedActionByte&gt;(ActionType::CSSDisplayNone));
-            // Append Selector length (4 bytes).
-            unsigned selectorLength = selector.length();
-            actions.resize(actions.size() + sizeof(unsigned));
-            *reinterpret_cast&lt;unsigned*&gt;(&amp;actions[actions.size() - sizeof(unsigned)]) = selectorLength;
-            bool wideCharacters = !selector.is8Bit();
-            actions.append(wideCharacters);
-            // Append Selector.
-            if (wideCharacters) {
-                for (unsigned i = 0; i &lt; selectorLength; i++) {
-                    actions.resize(actions.size() + sizeof(UChar));
-                    *reinterpret_cast&lt;UChar*&gt;(&amp;actions[actions.size() - sizeof(UChar)]) = selector[i];
-                }
-            } else {
-                for (unsigned i = 0; i &lt; selectorLength; i++)
-                    actions.append(selector[i]);
-            }
-            break;
-        }
-        }
-    }
-    return actionLocations;
-}
-
-void ContentExtensionsBackend::setRuleList(const String&amp; identifier, const Vector&lt;ContentExtensionRule&gt;&amp; ruleList)
-{
</del><span class="cx">     ASSERT(!identifier.isEmpty());
</span><span class="cx">     if (identifier.isEmpty())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    if (ruleList.isEmpty()) {
-        removeRuleList(identifier);
</del><ins>+    if (!compiledContentExtension) {
+        removeContentExtension(identifier);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-#if CONTENT_EXTENSIONS_PERFORMANCE_REPORTING
-    double nfaBuildTimeStart = monotonicallyIncreasingTime();
-#endif
-
-    Vector&lt;SerializedActionByte&gt; actions;
-    Vector&lt;unsigned&gt; actionLocations = serializeActions(ruleList, actions);
-
-    NFA nfa;
-    URLFilterParser urlFilterParser(nfa);
-    for (unsigned ruleIndex = 0; ruleIndex &lt; ruleList.size(); ++ruleIndex) {
-        const ContentExtensionRule&amp; contentExtensionRule = ruleList[ruleIndex];
-        const Trigger&amp; trigger = contentExtensionRule.trigger();
-        ASSERT(trigger.urlFilter.length());
-
-        String error = urlFilterParser.addPattern(trigger.urlFilter, trigger.urlFilterIsCaseSensitive, actionLocations[ruleIndex]);
-
-        if (!error.isNull()) {
-            dataLogF(&quot;Error while parsing %s: %s\n&quot;, trigger.urlFilter.utf8().data(), error.utf8().data());
-            continue;
-        }
-    }
-
-#if CONTENT_EXTENSIONS_PERFORMANCE_REPORTING
-    double nfaBuildTimeEnd = monotonicallyIncreasingTime();
-    dataLogF(&quot;    Time spent building the NFA: %f\n&quot;, (nfaBuildTimeEnd - nfaBuildTimeStart));
-#endif
-
-#if CONTENT_EXTENSIONS_STATE_MACHINE_DEBUGGING
-    nfa.debugPrintDot();
-#endif
-
-#if CONTENT_EXTENSIONS_PERFORMANCE_REPORTING
-    double dfaBuildTimeStart = monotonicallyIncreasingTime();
-#endif
-
-    const DFA dfa = NFAToDFA::convert(nfa);
-
-#if CONTENT_EXTENSIONS_PERFORMANCE_REPORTING
-    double dfaBuildTimeEnd = monotonicallyIncreasingTime();
-    dataLogF(&quot;    Time spent building the DFA: %f\n&quot;, (dfaBuildTimeEnd - dfaBuildTimeStart));
-#endif
-
-    // FIXME: never add a DFA that only matches the empty set.
-
-#if CONTENT_EXTENSIONS_STATE_MACHINE_DEBUGGING
-    dfa.debugPrintDot();
-#endif
-
-    Vector&lt;DFABytecode&gt; bytecode;
-    DFABytecodeCompiler compiler(dfa, bytecode);
-    compiler.compile();
-    CompiledContentExtension compiledContentExtension = { bytecode, actions };
-    m_ruleLists.set(identifier, compiledContentExtension);
</del><ins>+    m_contentExtensions.set(identifier, compiledContentExtension);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ContentExtensionsBackend::removeRuleList(const String&amp; identifier)
</del><ins>+void ContentExtensionsBackend::removeContentExtension(const String&amp; identifier)
</ins><span class="cx"> {
</span><del>-    m_ruleLists.remove(identifier);
</del><ins>+    m_contentExtensions.remove(identifier);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ContentExtensionsBackend::removeAllRuleLists()
</del><ins>+void ContentExtensionsBackend::removeAllContentExtensions()
</ins><span class="cx"> {
</span><del>-    m_ruleLists.clear();
</del><ins>+    m_contentExtensions.clear();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Vector&lt;Action&gt; ContentExtensionsBackend::actionsForURL(const URL&amp; url)
</span><span class="lines">@@ -174,9 +68,8 @@
</span><span class="cx">     const CString&amp; urlCString = urlString.utf8();
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;Action&gt; actions;
</span><del>-    for (auto&amp; ruleListSlot : m_ruleLists) {
-        const CompiledContentExtension&amp; compiledContentExtension = ruleListSlot.value;
-        DFABytecodeInterpreter interpreter(compiledContentExtension.bytecode);
</del><ins>+    for (auto&amp; compiledContentExtension : m_contentExtensions.values()) {
+        DFABytecodeInterpreter interpreter(compiledContentExtension-&gt;bytecode());
</ins><span class="cx">         DFABytecodeInterpreter::Actions triggeredActions = interpreter.interpret(urlCString);
</span><span class="cx">         
</span><span class="cx">         if (!triggeredActions.isEmpty()) {
</span><span class="lines">@@ -188,7 +81,7 @@
</span><span class="cx">             
</span><span class="cx">             // Add actions in reverse order to properly deal with IgnorePreviousRules.
</span><span class="cx">             for (unsigned i = actionLocations.size(); i; i--) {
</span><del>-                Action action = Action::deserialize(ruleListSlot.value.actions, actionLocations[i - 1]);
</del><ins>+                Action action = Action::deserialize(compiledContentExtension-&gt;actions(), actionLocations[i - 1]);
</ins><span class="cx">                 if (action.type() == ActionType::IgnorePreviousRules)
</span><span class="cx">                     break;
</span><span class="cx">                 actions.append(action);
</span></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsContentExtensionsBackendh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.h (180999 => 181000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.h        2015-03-04 15:52:13 UTC (rev 180999)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.h        2015-03-04 16:41:31 UTC (rev 181000)
</span><span class="lines">@@ -29,9 +29,6 @@
</span><span class="cx"> #if ENABLE(CONTENT_EXTENSIONS)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;ContentExtensionRule.h&quot;
</span><del>-#include &quot;DFA.h&quot;
-#include &quot;DFABytecode.h&quot;
-#include &quot;UserContentController.h&quot;
</del><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><span class="cx"> #include &lt;wtf/text/StringHash.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="lines">@@ -42,6 +39,8 @@
</span><span class="cx"> 
</span><span class="cx"> namespace ContentExtensions {
</span><span class="cx"> 
</span><ins>+class CompiledContentExtension;
+
</ins><span class="cx"> // The ContentExtensionsBackend is the internal model of all the content extensions.
</span><span class="cx"> //
</span><span class="cx"> // It provides two services:
</span><span class="lines">@@ -53,22 +52,15 @@
</span><span class="cx"> 
</span><span class="cx">     // Set a list of rules for a given name. If there were existing rules for the name, they are overriden.
</span><span class="cx">     // The identifier cannot be empty.
</span><del>-    void setRuleList(const String&amp; identifier, const Vector&lt;ContentExtensionRule&gt;&amp;);
-    void removeRuleList(const String&amp; identifier);
-    void removeAllRuleLists();
</del><ins>+    WEBCORE_EXPORT void addContentExtension(const String&amp; identifier, RefPtr&lt;CompiledContentExtension&gt;);
+    WEBCORE_EXPORT void removeContentExtension(const String&amp; identifier);
+    WEBCORE_EXPORT void removeAllContentExtensions();
</ins><span class="cx"> 
</span><span class="cx">     // - Internal WebCore Interface.
</span><del>-    Vector&lt;Action&gt; actionsForURL(const URL&amp;);
</del><ins>+    WEBCORE_EXPORT Vector&lt;Action&gt; actionsForURL(const URL&amp;);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    struct CompiledContentExtension {
-        Vector&lt;DFABytecode&gt; bytecode;
-        Vector&lt;SerializedActionByte&gt; actions;
-    };
-
-    Vector&lt;unsigned&gt; serializeActions(const Vector&lt;ContentExtensionRule&gt;&amp; ruleList, Vector&lt;SerializedActionByte&gt;&amp; actions);
-
-    HashMap&lt;String, CompiledContentExtension&gt; m_ruleLists;
</del><ins>+    HashMap&lt;String, RefPtr&lt;CompiledContentExtension&gt;&gt; m_contentExtensions;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace ContentExtensions
</span></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsContentExtensionsManagercpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/contentextensions/ContentExtensionsManager.cpp (180999 => 181000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/ContentExtensionsManager.cpp        2015-03-04 15:52:13 UTC (rev 180999)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsManager.cpp        2015-03-04 16:41:31 UTC (rev 181000)
</span><span class="lines">@@ -1,203 +0,0 @@
</span><del>-/*
- * 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 &quot;ContentExtensionsDebugging.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/CurrentTime.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, 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;
-
-    JSValue urlFilterCaseObject = triggerObject.get(&amp;exec, Identifier(&amp;exec, &quot;url-filter-is-case-sensitive&quot;));
-    if (urlFilterCaseObject &amp;&amp; !exec.hadException() &amp;&amp; urlFilterCaseObject.isBoolean())
-        trigger.urlFilterIsCaseSensitive = urlFilterCaseObject.toBoolean(&amp;exec);
-
-    return true;
-}
-
-static bool loadAction(ExecState&amp; exec, JSObject&amp; ruleObject, 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;)
-        action = ActionType::BlockLoad;
-    else if (actionType == &quot;ignore-previous-rules&quot;)
-        action = ActionType::IgnorePreviousRules;
-    else if (actionType == &quot;block-cookies&quot;)
-        action = ActionType::BlockCookies;
-    else if (actionType == &quot;css-display-none&quot;) {
-        JSValue selector = actionObject.get(&amp;exec, Identifier(&amp;exec, &quot;selector&quot;));
-        if (!selector || exec.hadException() || !selector.isString()) {
-            WTFLogAlways(&quot;css-display-none action type requires a selector&quot;);
-            return false;
-        }
-        action = Action(ActionType::CSSDisplayNone, selector.toWTFString(&amp;exec));
-    } else {
-        WTFLogAlways(&quot;Unrecognized action: \&quot;%s\&quot;&quot;, actionType.utf8().data());
-        return false;
-    }
-
-    return true;
-}
-
-static void loadRule(ExecState&amp; exec, JSObject&amp; ruleObject, Vector&lt;ContentExtensionRule&gt;&amp; ruleList)
-{
-    Trigger trigger;
-    if (!loadTrigger(exec, ruleObject, trigger))
-        return;
-
-    Action action;
-    if (!loadAction(exec, ruleObject, action))
-        return;
-
-    ruleList.append(ContentExtensionRule(trigger, action));
-}
-
-static Vector&lt;ContentExtensionRule&gt; loadEncodedRules(ExecState&amp; exec, const String&amp; rules)
-{
-    JSValue decodedRules = JSONParse(&amp;exec, rules);
-
-    if (exec.hadException() || !decodedRules) {
-        WTFLogAlways(&quot;Failed to parse the JSON string.&quot;);
-        return Vector&lt;ContentExtensionRule&gt;();
-    }
-
-    if (decodedRules.isObject()) {
-        JSObject* topLevelObject = decodedRules.toObject(&amp;exec);
-        if (!topLevelObject || exec.hadException()) {
-            WTFLogAlways(&quot;Invalid input, the top level structure is not an object.&quot;);
-            return Vector&lt;ContentExtensionRule&gt;();
-        }
-
-        if (!isJSArray(topLevelObject)) {
-            WTFLogAlways(&quot;Invalid input, the top level object is not an array.&quot;);
-            return Vector&lt;ContentExtensionRule&gt;();
-        }
-
-        Vector&lt;ContentExtensionRule&gt; ruleList;
-        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(&amp;exec, i);
-            if (exec.hadException() || !value) {
-                WTFLogAlways(&quot;Invalid object in the array.&quot;);
-                continue;
-            }
-
-            JSObject* ruleObject = value.toObject(&amp;exec);
-            if (!ruleObject || exec.hadException()) {
-                WTFLogAlways(&quot;Invalid rule&quot;);
-                continue;
-            }
-            loadRule(exec, *ruleObject, ruleList);
-        }
-        return ruleList;
-    }
-    return Vector&lt;ContentExtensionRule&gt;();
-}
-
-Vector&lt;ContentExtensionRule&gt; createRuleList(const String&amp; rules)
-{
-#if CONTENT_EXTENSIONS_PERFORMANCE_REPORTING
-    double loadExtensionStartTime = monotonicallyIncreasingTime();
-#endif
-    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();
-    Vector&lt;ContentExtensionRule&gt; ruleList = loadEncodedRules(*exec, rules);
-
-    vm.clear();
-
-    if (ruleList.isEmpty())
-        WTFLogAlways(&quot;Empty extension.&quot;);
-
-#if CONTENT_EXTENSIONS_PERFORMANCE_REPORTING
-    double loadExtensionEndTime = monotonicallyIncreasingTime();
-    dataLogF(&quot;Time spent loading extension %s: %f\n&quot;, identifier.utf8().data(), (loadExtensionEndTime - loadExtensionStartTime));
-#endif
-
-    return ruleList;
-}
-
-} // namespace ExtensionsManager
-} // namespace ContentExtensions
-} // namespace WebCore
-
-#endif // ENABLE(CONTENT_EXTENSIONS)
</del></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsContentExtensionsManagerh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/contentextensions/ContentExtensionsManager.h (180999 => 181000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/ContentExtensionsManager.h        2015-03-04 15:52:13 UTC (rev 180999)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsManager.h        2015-03-04 16:41:31 UTC (rev 181000)
</span><span class="lines">@@ -1,52 +0,0 @@
</span><del>-/*
- * 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;
-#include &lt;wtf/Vector.h&gt;
-
-namespace WebCore {
-
-namespace ContentExtensions {
-
-class ContentExtensionRule;
-
-// The ExtensionsManager loads serialized content extension rules directly into WebCore.
-namespace ExtensionsManager {
-
-Vector&lt;ContentExtensionRule&gt; createRuleList(const String&amp; rules);
-
-} // namespace ExtensionsManager
-
-} // namespace ContentExtensions
-} // namespace WebCore
-
-#endif // ENABLE(CONTENT_EXTENSIONS)
-
-#endif // ContentExtensionsManager_h
</del></span></pre></div>
<a id="trunkSourceWebCorepageUserContentControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/UserContentController.cpp (180999 => 181000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/UserContentController.cpp        2015-03-04 15:52:13 UTC (rev 180999)
+++ trunk/Source/WebCore/page/UserContentController.cpp        2015-03-04 16:41:31 UTC (rev 181000)
</span><span class="lines">@@ -38,8 +38,8 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CONTENT_EXTENSIONS)
</span><ins>+#include &quot;ContentExtensionCompiler.h&quot;
</ins><span class="cx"> #include &quot;ContentExtensionsBackend.h&quot;
</span><del>-#include &quot;ContentExtensionsManager.h&quot;
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -184,7 +184,7 @@
</span><span class="cx">     if (!m_contentExtensionBackend)
</span><span class="cx">         m_contentExtensionBackend = std::make_unique&lt;ContentExtensions::ContentExtensionsBackend&gt;();
</span><span class="cx">     
</span><del>-    m_contentExtensionBackend-&gt;setRuleList(name, ContentExtensions::ExtensionsManager::createRuleList(ruleList));
</del><ins>+    m_contentExtensionBackend-&gt;addContentExtension(name, ContentExtensions::compileRuleList(ruleList));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void UserContentController::removeUserContentFilter(const String&amp; name)
</span><span class="lines">@@ -192,7 +192,7 @@
</span><span class="cx">     if (!m_contentExtensionBackend)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    m_contentExtensionBackend-&gt;removeRuleList(name);
</del><ins>+    m_contentExtensionBackend-&gt;removeContentExtension(name);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void UserContentController::removeAllUserContentFilters()
</span><span class="lines">@@ -200,7 +200,7 @@
</span><span class="cx">     if (!m_contentExtensionBackend)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    m_contentExtensionBackend-&gt;removeAllRuleLists();
</del><ins>+    m_contentExtensionBackend-&gt;removeAllContentExtensions();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Vector&lt;ContentExtensions::Action&gt; UserContentController::actionsForURL(const URL&amp; url)
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (180999 => 181000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-03-04 15:52:13 UTC (rev 180999)
+++ trunk/Tools/ChangeLog        2015-03-04 16:41:31 UTC (rev 181000)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-03-03  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        [Content Extensions] Split parsing and compiling of content extensions into their own files
+        https://bugs.webkit.org/show_bug.cgi?id=142259
+
+        Reviewed by Anders Carlsson.
+
+        Add basic unit test for the content filter compiler.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebCore/ContentFilter.cpp: Added.
+        (WebCore::ContentExtensions::operator&lt;&lt;):
+        (TestWebKitAPI::ContentFilterTest::SetUp):
+        (TestWebKitAPI::TEST_F):
+
</ins><span class="cx"> 2015-03-04  Matthew Mirman  &lt;mmirman@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Cleaned up BuildAndTestFactory to not be a near duplicate of TestFactory
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (180999 => 181000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2015-03-04 15:52:13 UTC (rev 180999)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2015-03-04 16:41:31 UTC (rev 181000)
</span><span class="lines">@@ -61,6 +61,7 @@
</span><span class="cx">                 7C54A4C11AA11CE400380F78 /* WKBundleFileHandle_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C54A4BF1AA11CE400380F78 /* WKBundleFileHandle_Bundle.cpp */; };
</span><span class="cx">                 7C89D2AC1A69B80D003A5FDE /* WKPageConfiguration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89D2AA1A69B80D003A5FDE /* WKPageConfiguration.cpp */; };
</span><span class="cx">                 7C9ED98B17A19F4B00E4DC33 /* attributedStringStrikethrough.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 7C9ED98A17A19D0600E4DC33 /* attributedStringStrikethrough.html */; };
</span><ins>+                7CB184C61AA3F2100066EDFD /* ContentFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CB184C41AA3F2100066EDFD /* ContentFilter.cpp */; };
</ins><span class="cx">                 7CCE7EA41A4119F300447C4C /* InstanceMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = C08587FF13FEC3A6001EF4E5 /* InstanceMethodSwizzler.mm */; };
</span><span class="cx">                 7CCE7EA51A411A0800447C4C /* JavaScriptTestMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = C081224013FC172400DC39AE /* JavaScriptTestMac.mm */; };
</span><span class="cx">                 7CCE7EA61A411A0F00447C4C /* PlatformUtilitiesMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC131884117114B600B69727 /* PlatformUtilitiesMac.mm */; };
</span><span class="lines">@@ -523,6 +524,7 @@
</span><span class="cx">                 7C89D2AA1A69B80D003A5FDE /* WKPageConfiguration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKPageConfiguration.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C8DDAA91735DE1D00EA5AC0 /* CloseThenTerminate.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CloseThenTerminate.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C9ED98A17A19D0600E4DC33 /* attributedStringStrikethrough.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = attributedStringStrikethrough.html; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                7CB184C41AA3F2100066EDFD /* ContentFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentFilter.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 7CBBA07619BB8A9100BBF025 /* OSObjectPtr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OSObjectPtr.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7CC3E1FA197E234100BE6252 /* UserContentController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UserContentController.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7CCE7E8C1A41144E00447C4C /* libTestWebKitAPI.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libTestWebKitAPI.a; sourceTree = BUILT_PRODUCTS_DIR; };
</span><span class="lines">@@ -826,6 +828,7 @@
</span><span class="cx">                                 14464012167A8305000BD218 /* LayoutUnit.cpp */,
</span><span class="cx">                                 CDC2C7141797089D00E627FB /* TimeRanges.cpp */,
</span><span class="cx">                                 440A1D3814A0103A008A66F2 /* URL.cpp */,
</span><ins>+                                7CB184C41AA3F2100066EDFD /* ContentFilter.cpp */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = WebCore;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="lines">@@ -1492,6 +1495,7 @@
</span><span class="cx">                                 7CCE7ECE1A411A7E00447C4C /* StopLoadingFromDidFinishLoading.mm in Sources */,
</span><span class="cx">                                 7CCE7ECF1A411A7E00447C4C /* StopLoadingFromDidReceiveResponse.mm in Sources */,
</span><span class="cx">                                 7CCE7F441A411B8E00447C4C /* StringBuilder.cpp in Sources */,
</span><ins>+                                7CB184C61AA3F2100066EDFD /* ContentFilter.cpp in Sources */,
</ins><span class="cx">                                 7CCE7ED01A411A7E00447C4C /* StringByEvaluatingJavaScriptFromString.mm in Sources */,
</span><span class="cx">                                 7CCE7F451A411B8E00447C4C /* StringHasher.cpp in Sources */,
</span><span class="cx">                                 7CCE7F461A411B8E00447C4C /* StringImpl.cpp in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebCoreContentFiltercpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebCore/ContentFilter.cpp (0 => 181000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebCore/ContentFilter.cpp                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/ContentFilter.cpp        2015-03-04 16:41:31 UTC (rev 181000)
</span><span class="lines">@@ -0,0 +1,84 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+
+#include &quot;PlatformUtilities.h&quot;
+#include &lt;JavaScriptCore/InitializeThreading.h&gt;
+#include &lt;WebCore/ContentExtensionCompiler.h&gt;
+#include &lt;WebCore/ContentExtensionsBackend.h&gt;
+#include &lt;WebCore/URL.h&gt;
+#include &lt;wtf/MainThread.h&gt;
+#include &lt;wtf/RunLoop.h&gt;
+
+namespace WebCore {
+namespace ContentExtensions {
+inline std::ostream&amp; operator&lt;&lt;(std::ostream&amp; os, const ActionType&amp; action)
+{
+    switch (action) {
+    case ActionType::BlockLoad:
+        return os &lt;&lt; &quot;ContentFilterAction::BlockLoad&quot;;
+    case ActionType::BlockCookies:
+        return os &lt;&lt; &quot;ContentFilterAction::BlockCookies&quot;;
+    case ActionType::CSSDisplayNone:
+        return os &lt;&lt; &quot;ContentFilterAction::CSSDisplayNone&quot;;
+    case ActionType::IgnorePreviousRules:
+        return os &lt;&lt; &quot;ContentFilterAction::IgnorePreviousRules&quot;;
+    case ActionType::InvalidAction:
+        return os &lt;&lt; &quot;ContentFilterAction::InvalidAction&quot;;
+    }
+}
+}
+}
+
+using namespace WebCore;
+
+namespace TestWebKitAPI {
+
+class ContentFilterTest : public testing::Test {
+public:
+    virtual void SetUp()
+    {
+        WTF::initializeMainThread();
+        JSC::initializeThreading();
+        RunLoop::initializeMainRunLoop();
+    }
+};
+
+const char* basicFilter = &quot;[{\&quot;action\&quot;:{\&quot;type\&quot;:\&quot;block\&quot;},\&quot;trigger\&quot;:{\&quot;url-filter\&quot;:\&quot;.*webkit.org\&quot;}}]&quot;;
+
+TEST_F(ContentFilterTest, Basic)
+{
+    RefPtr&lt;ContentExtensions::CompiledContentExtension&gt; extension = ContentExtensions::compileRuleList(basicFilter);
+
+    ContentExtensions::ContentExtensionsBackend backend;
+    backend.addContentExtension(&quot;testFilter&quot;, extension);
+    
+    auto actions = backend.actionsForURL(URL(ParsedURLString, &quot;http://webkit.org/&quot;));
+    EXPECT_EQ(1u, actions.size());
+    EXPECT_EQ(ContentExtensions::ActionType::BlockLoad, actions[0].type());
+}
+
+} // namespace TestWebKitAPI
</ins></span></pre>
</div>
</div>

</body>
</html>