<!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>[187061] branches/safari-601.1-branch</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/187061">187061</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2015-07-20 21:36:49 -0700 (Mon, 20 Jul 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/186912">r186912</a>. rdar://problem/21866271</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari6011branchSourceWebCoreChangeLog">branches/safari-601.1-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari6011branchSourceWebCorecontentextensionsContentExtensioncpp">branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtension.cpp</a></li>
<li><a href="#branchessafari6011branchSourceWebCorecontentextensionsContentExtensionh">branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtension.h</a></li>
<li><a href="#branchessafari6011branchSourceWebCorecontentextensionsContentExtensionsBackendcpp">branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp</a></li>
<li><a href="#branchessafari6011branchSourceWebCorecontentextensionsDFABytecodeInterpretercpp">branches/safari-601.1-branch/Source/WebCore/contentextensions/DFABytecodeInterpreter.cpp</a></li>
<li><a href="#branchessafari6011branchSourceWebCorecontentextensionsDFABytecodeInterpreterh">branches/safari-601.1-branch/Source/WebCore/contentextensions/DFABytecodeInterpreter.h</a></li>
<li><a href="#branchessafari6011branchToolsChangeLog">branches/safari-601.1-branch/Tools/ChangeLog</a></li>
<li><a href="#branchessafari6011branchToolsTestWebKitAPITestsWebCoreContentExtensionscpp">branches/safari-601.1-branch/Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari6011branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/ChangeLog (187060 => 187061)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/ChangeLog        2015-07-21 04:36:45 UTC (rev 187060)
+++ branches/safari-601.1-branch/Source/WebCore/ChangeLog        2015-07-21 04:36:49 UTC (rev 187061)
</span><span class="lines">@@ -1,5 +1,40 @@
</span><span class="cx"> 2015-07-20 Matthew Hanson <matthew_hanson@apple.com>
</span><span class="cx">
</span><ins>+ Merge r186912. rdar://problem/21866271
+
+ 2015-07-16 Alex Christensen <achristensen@webkit.org>
+
+ [Content Extensions] Cache domain actions
+ https://bugs.webkit.org/show_bug.cgi?id=146817
+
+ Reviewed by Benjamin Poulain.
+
+ Right now we run regular expressions on the domain every time we have any rules that match with if-domain or unless-domain.
+ This caches the results of running regular expressions on the domain of the main document's url so we only need to
+ run those regular expressions when the main document changes domain. We also spend less time adding unused actions into HashSets.
+
+ All behavior is covered by existing api tests, but I added some to explicitly test if-domain and unless-domain with multiple load types.
+
+ * contentextensions/ContentExtension.cpp:
+ (WebCore::ContentExtensions::ContentExtension::globalDisplayNoneStyleSheet):
+ (WebCore::ContentExtensions::ContentExtension::cachedDomainActions):
+ * contentextensions/ContentExtension.h:
+ (WebCore::ContentExtensions::ContentExtension::identifier):
+ (WebCore::ContentExtensions::ContentExtension::compiledExtension):
+ * contentextensions/ContentExtensionsBackend.cpp:
+ (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad):
+ * contentextensions/DFABytecodeInterpreter.cpp:
+ (WebCore::ContentExtensions::getJumpDistance):
+ (WebCore::ContentExtensions::matchesDomain):
+ (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretAppendAction):
+ (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretTestFlagsAndAppendAction):
+ (WebCore::ContentExtensions::DFABytecodeInterpreter::actionsForDefaultStylesheetFromDFARoot):
+ (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretWithDomains):
+ (WebCore::ContentExtensions::DFABytecodeInterpreter::interpret):
+ * contentextensions/DFABytecodeInterpreter.h:
+
+2015-07-20 Matthew Hanson <matthew_hanson@apple.com>
+
</ins><span class="cx"> Merge r186890. rdar://problem/21643094
</span><span class="cx">
</span><span class="cx"> 2015-07-15 Tim Horton <timothy_horton@apple.com>
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCorecontentextensionsContentExtensioncpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtension.cpp (187060 => 187061)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtension.cpp        2015-07-21 04:36:45 UTC (rev 187060)
+++ branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtension.cpp        2015-07-21 04:36:49 UTC (rev 187061)
</span><span class="lines">@@ -75,6 +75,21 @@
</span><span class="cx"> return m_globalDisplayNoneStyleSheet.get();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+const DFABytecodeInterpreter::Actions& ContentExtension::cachedDomainActions(const String& domain)
+{
+ if (m_cachedDomain != domain) {
+ DFABytecodeInterpreter interpreter(m_compiledExtension->domainFiltersBytecode(), m_compiledExtension->domainFiltersBytecodeLength());
+ const uint16_t allLoadTypesAndResourceTypes = LoadTypeMask | ResourceTypeMask;
+ auto domainActions = interpreter.interpret(domain.utf8(), allLoadTypesAndResourceTypes);
+
+ m_cachedDomainActions.clear();
+ for (uint64_t action : domainActions)
+ m_cachedDomainActions.add(action);
+ m_cachedDomain = domain;
+ }
+ return m_cachedDomainActions;
+}
+
</ins><span class="cx"> } // namespace ContentExtensions
</span><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCorecontentextensionsContentExtensionh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtension.h (187060 => 187061)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtension.h        2015-07-21 04:36:45 UTC (rev 187060)
+++ branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtension.h        2015-07-21 04:36:49 UTC (rev 187061)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(CONTENT_EXTENSIONS)
</span><span class="cx">
</span><ins>+#include "DFABytecodeInterpreter.h"
</ins><span class="cx"> #include "StyleSheetContents.h"
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -47,6 +48,7 @@
</span><span class="cx"> const String& identifier() const { return m_identifier; }
</span><span class="cx"> const CompiledContentExtension& compiledExtension() const { return m_compiledExtension.get(); }
</span><span class="cx"> StyleSheetContents* globalDisplayNoneStyleSheet();
</span><ins>+ const DFABytecodeInterpreter::Actions& cachedDomainActions(const String& domain);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> ContentExtension(const String& identifier, Ref<CompiledContentExtension>&&);
</span><span class="lines">@@ -55,6 +57,9 @@
</span><span class="cx"> Ref<CompiledContentExtension> m_compiledExtension;
</span><span class="cx"> RefPtr<StyleSheetContents> m_globalDisplayNoneStyleSheet;
</span><span class="cx"> bool m_parsedGlobalDisplayNoneStyleSheet;
</span><ins>+
+ String m_cachedDomain;
+ DFABytecodeInterpreter::Actions m_cachedDomainActions;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace ContentExtensions
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCorecontentextensionsContentExtensionsBackendcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp (187060 => 187061)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp        2015-07-21 04:36:45 UTC (rev 187060)
+++ branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp        2015-07-21 04:36:49 UTC (rev 187061)
</span><span class="lines">@@ -90,47 +90,22 @@
</span><span class="cx"> const CompiledContentExtension& compiledExtension = contentExtension->compiledExtension();
</span><span class="cx">
</span><span class="cx"> DFABytecodeInterpreter withoutDomainsInterpreter(compiledExtension.filtersWithoutDomainsBytecode(), compiledExtension.filtersWithoutDomainsBytecodeLength());
</span><del>- DFABytecodeInterpreter::Actions triggeredActions = withoutDomainsInterpreter.interpret(urlCString, flags);
</del><ins>+ DFABytecodeInterpreter::Actions withoutDomainsActions = withoutDomainsInterpreter.interpret(urlCString, flags);
</ins><span class="cx">
</span><del>- // Check to see if there are any actions triggered with if- or unless-domain and check the domain if there are.
</del><span class="cx"> DFABytecodeInterpreter withDomainsInterpreter(compiledExtension.filtersWithDomainsBytecode(), compiledExtension.filtersWithDomainsBytecodeLength());
</span><ins>+ DFABytecodeInterpreter::Actions withDomainsActions = withDomainsInterpreter.interpretWithDomains(urlCString, flags, contentExtension->cachedDomainActions(resourceLoadInfo.mainDocumentURL.host()));
</ins><span class="cx">
</span><del>- DFABytecodeInterpreter::Actions withDomainsPossibleActions = withDomainsInterpreter.interpret(urlCString, flags);
- if (!withDomainsPossibleActions.isEmpty()) {
- DFABytecodeInterpreter domainsInterpreter(compiledExtension.domainFiltersBytecode(), compiledExtension.domainFiltersBytecodeLength());
- DFABytecodeInterpreter::Actions domainsActions = domainsInterpreter.interpret(resourceLoadInfo.mainDocumentURL.host().utf8(), flags);
-
- DFABytecodeInterpreter::Actions ifDomainActions;
- DFABytecodeInterpreter::Actions unlessDomainActions;
- for (uint64_t action : domainsActions) {
- if (action & IfDomainFlag)
- ifDomainActions.add(action);
- else
- unlessDomainActions.add(action);
- }
-
- for (uint64_t action : withDomainsPossibleActions) {
- if (ifDomainActions.contains(action)) {
- // If an if-domain trigger matches, add the action.
- ASSERT(action & IfDomainFlag);
- triggeredActions.add(action & ~IfDomainFlag);
- } else if (!(action & IfDomainFlag) && !unlessDomainActions.contains(action)) {
- // If this action did not need an if-domain, it must have been an unless-domain rule.
- // Add the action unless it matched an unless-domain trigger.
- triggeredActions.add(action);
- }
- }
- }
-
</del><span class="cx"> const SerializedActionByte* actions = compiledExtension.actions();
</span><span class="cx"> const unsigned actionsLength = compiledExtension.actionsLength();
</span><span class="cx">
</span><span class="cx"> bool sawIgnorePreviousRules = false;
</span><del>- if (!triggeredActions.isEmpty()) {
- Vector<unsigned> actionLocations;
- actionLocations.reserveInitialCapacity(triggeredActions.size());
- for (auto actionLocation : triggeredActions)
- actionLocations.append(static_cast<unsigned>(actionLocation));
</del><ins>+ if (!withoutDomainsActions.isEmpty() || !withDomainsActions.isEmpty()) {
+ Vector<uint32_t> actionLocations;
+ actionLocations.reserveInitialCapacity(withoutDomainsActions.size() + withDomainsActions.size());
+ for (uint64_t actionLocation : withoutDomainsActions)
+ actionLocations.uncheckedAppend(static_cast<uint32_t>(actionLocation));
+ for (uint64_t actionLocation : withDomainsActions)
+ actionLocations.uncheckedAppend(static_cast<uint32_t>(actionLocation));
</ins><span class="cx"> std::sort(actionLocations.begin(), actionLocations.end());
</span><span class="cx">
</span><span class="cx"> // Add actions in reverse order to properly deal with IgnorePreviousRules.
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCorecontentextensionsDFABytecodeInterpretercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/contentextensions/DFABytecodeInterpreter.cpp (187060 => 187061)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/contentextensions/DFABytecodeInterpreter.cpp        2015-07-21 04:36:45 UTC (rev 187060)
+++ branches/safari-601.1-branch/Source/WebCore/contentextensions/DFABytecodeInterpreter.cpp        2015-07-21 04:36:49 UTC (rev 187061)
</span><span class="lines">@@ -86,12 +86,22 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static inline bool matchesDomain(uint64_t actionAndFlags, const DFABytecodeInterpreter::Actions& domainActions)
+{
+ bool ifDomain = actionAndFlags & IfDomainFlag;
+ bool domain = domainActions.contains(actionAndFlags);
+ return ifDomain == domain;
+}
+
</ins><span class="cx"> void DFABytecodeInterpreter::interpretAppendAction(uint32_t& programCounter, Actions& actions, bool ifDomain)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(getInstruction(m_bytecode, m_bytecodeLength, programCounter) == DFABytecodeInstruction::AppendAction
</span><span class="cx"> || getInstruction(m_bytecode, m_bytecodeLength, programCounter) == DFABytecodeInstruction::AppendActionWithIfDomain
</span><span class="cx"> || getInstruction(m_bytecode, m_bytecodeLength, programCounter) == DFABytecodeInstruction::AppendActionDefaultStylesheet);
</span><del>- actions.add((ifDomain ? IfDomainFlag : 0) | static_cast<uint64_t>(getBits<uint32_t>(m_bytecode, m_bytecodeLength, programCounter + sizeof(DFABytecodeInstruction))));
</del><ins>+ uint64_t action = (ifDomain ? IfDomainFlag : 0) | static_cast<uint64_t>(getBits<uint32_t>(m_bytecode, m_bytecodeLength, programCounter + sizeof(DFABytecodeInstruction)));
+ if (!m_domainActions || matchesDomain(action, *m_domainActions))
+ actions.add(action);
+
</ins><span class="cx"> programCounter += instructionSizeWithArguments(DFABytecodeInstruction::AppendAction);
</span><span class="cx"> ASSERT(instructionSizeWithArguments(DFABytecodeInstruction::AppendAction) == instructionSizeWithArguments(DFABytecodeInstruction::AppendActionWithIfDomain));
</span><span class="cx"> ASSERT(instructionSizeWithArguments(DFABytecodeInstruction::AppendAction) == instructionSizeWithArguments(DFABytecodeInstruction::AppendActionDefaultStylesheet));
</span><span class="lines">@@ -104,13 +114,16 @@
</span><span class="cx"> uint16_t flagsToCheck = getBits<uint16_t>(m_bytecode, m_bytecodeLength, programCounter + sizeof(DFABytecodeInstruction));
</span><span class="cx">
</span><span class="cx"> uint16_t loadTypeFlags = flagsToCheck & LoadTypeMask;
</span><del>- uint16_t ressourceTypeFlags = flagsToCheck & ResourceTypeMask;
</del><ins>+ uint16_t resourceTypeFlags = flagsToCheck & ResourceTypeMask;
</ins><span class="cx">
</span><span class="cx"> bool loadTypeMatches = loadTypeFlags ? (loadTypeFlags & flags) : true;
</span><del>- bool ressourceTypeMatches = ressourceTypeFlags ? (ressourceTypeFlags & flags) : true;
</del><ins>+ bool resourceTypeMatches = resourceTypeFlags ? (resourceTypeFlags & flags) : true;
</ins><span class="cx">
</span><del>- if (loadTypeMatches && ressourceTypeMatches)
- actions.add((ifDomain ? IfDomainFlag : 0) | static_cast<uint64_t>(getBits<uint32_t>(m_bytecode, m_bytecodeLength, programCounter + sizeof(DFABytecodeInstruction) + sizeof(uint16_t))));
</del><ins>+ if (loadTypeMatches && resourceTypeMatches) {
+ uint64_t actionAndFlags = (ifDomain ? IfDomainFlag : 0) | (static_cast<uint64_t>(flagsToCheck) << 32) | static_cast<uint64_t>(getBits<uint32_t>(m_bytecode, m_bytecodeLength, programCounter + sizeof(DFABytecodeInstruction) + sizeof(uint16_t)));
+ if (!m_domainActions || matchesDomain(actionAndFlags, *m_domainActions))
+ actions.add(actionAndFlags);
+ }
</ins><span class="cx"> programCounter += instructionSizeWithArguments(DFABytecodeInstruction::TestFlagsAndAppendAction);
</span><span class="cx"> ASSERT(instructionSizeWithArguments(DFABytecodeInstruction::TestFlagsAndAppendAction) == instructionSizeWithArguments(DFABytecodeInstruction::TestFlagsAndAppendActionWithIfDomain));
</span><span class="cx"> }
</span><span class="lines">@@ -142,6 +155,15 @@
</span><span class="cx"> return actions;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+DFABytecodeInterpreter::Actions DFABytecodeInterpreter::interpretWithDomains(const CString& urlCString, uint16_t flags, const DFABytecodeInterpreter::Actions& domainActions)
+{
+ ASSERT(!m_domainActions);
+ m_domainActions = &domainActions;
+ DFABytecodeInterpreter::Actions actions = interpret(urlCString, flags);
+ m_domainActions = nullptr;
+ return actions;
+}
+
</ins><span class="cx"> DFABytecodeInterpreter::Actions DFABytecodeInterpreter::interpret(const CString& urlCString, uint16_t flags)
</span><span class="cx"> {
</span><span class="cx"> const char* url = urlCString.data();
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCorecontentextensionsDFABytecodeInterpreterh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/contentextensions/DFABytecodeInterpreter.h (187060 => 187061)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/contentextensions/DFABytecodeInterpreter.h        2015-07-21 04:36:45 UTC (rev 187060)
+++ branches/safari-601.1-branch/Source/WebCore/contentextensions/DFABytecodeInterpreter.h        2015-07-21 04:36:49 UTC (rev 187061)
</span><span class="lines">@@ -50,6 +50,7 @@
</span><span class="cx"> typedef HashSet<uint64_t, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> Actions;
</span><span class="cx">
</span><span class="cx"> Actions interpret(const CString&, uint16_t flags);
</span><ins>+ Actions interpretWithDomains(const CString&, uint16_t flags, const DFABytecodeInterpreter::Actions& domainActions);
</ins><span class="cx"> Actions actionsForDefaultStylesheetFromDFARoot();
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="lines">@@ -57,6 +58,7 @@
</span><span class="cx"> void interpretTestFlagsAndAppendAction(unsigned& programCounter, uint16_t flags, Actions&, bool ifDomain);
</span><span class="cx"> const DFABytecode* m_bytecode;
</span><span class="cx"> const unsigned m_bytecodeLength;
</span><ins>+ const DFABytecodeInterpreter::Actions* m_domainActions { nullptr };
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace ContentExtensions
</span></span></pre></div>
<a id="branchessafari6011branchToolsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Tools/ChangeLog (187060 => 187061)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Tools/ChangeLog        2015-07-21 04:36:45 UTC (rev 187060)
+++ branches/safari-601.1-branch/Tools/ChangeLog        2015-07-21 04:36:49 UTC (rev 187061)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-07-20 Matthew Hanson <matthew_hanson@apple.com>
+
+ Merge r186912. rdar://problem/21866271
+
+ 2015-07-16 Alex Christensen <achristensen@webkit.org>
+
+ [Content Extensions] Cache domain actions
+ https://bugs.webkit.org/show_bug.cgi?id=146817
+
+ Reviewed by Benjamin Poulain.
+
+ * TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp:
+ (TestWebKitAPI::TEST_F):
+ Test if-domain and unless-domain with multiple load types.
+
</ins><span class="cx"> 2015-07-16 Matthew Hanson <matthew_hanson@apple.com>
</span><span class="cx">
</span><span class="cx"> Merge r186881. rdar://problem/21822278
</span></span></pre></div>
<a id="branchessafari6011branchToolsTestWebKitAPITestsWebCoreContentExtensionscpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp (187060 => 187061)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp        2015-07-21 04:36:45 UTC (rev 187060)
+++ branches/safari-601.1-branch/Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp        2015-07-21 04:36:49 UTC (rev 187061)
</span><span class="lines">@@ -917,6 +917,38 @@
</span><span class="cx"> "{\"action\":{\"type\":\"css-display-none\",\"selector\":\".hidden\"},\"trigger\":{\"url-filter\":\".*\"}}]");
</span><span class="cx"> EXPECT_EQ(nullptr, backend5.globalDisplayNoneStyleSheet(ASCIILiteral("testFilter")));
</span><span class="cx"> testRequest(backend5, mainDocumentRequest("http://webkit.org"), { ContentExtensions::ActionType::CSSDisplayNoneSelector }, true);
</span><ins>+
+ auto backend6 = makeBackend("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\".*\",\"if-domain\":[\"webkit.org\",\"*w3c.org\"],\"resource-type\":[\"document\",\"script\"]}},"
+ "{\"action\":{\"type\":\"ignore-previous-rules\"},\"trigger\":{\"url-filter\":\"ignore\",\"if-domain\":[\"*webkit.org\",\"w3c.org\"]}},"
+ "{\"action\":{\"type\":\"block-cookies\"},\"trigger\":{\"url-filter\":\".*\",\"unless-domain\":[\"webkit.org\",\"whatwg.org\"],\"resource-type\":[\"script\",\"image\"],\"load-type\":[\"third-party\"]}}]");
+ EXPECT_EQ(nullptr, backend6.globalDisplayNoneStyleSheet(ASCIILiteral("testFilter")));
+ testRequest(backend6, mainDocumentRequest("http://webkit.org"), { ContentExtensions::ActionType::BlockLoad });
+ testRequest(backend6, mainDocumentRequest("http://w3c.org"), { ContentExtensions::ActionType::BlockLoad });
+ testRequest(backend6, mainDocumentRequest("http://whatwg.org"), { });
+ testRequest(backend6, mainDocumentRequest("http://sub.webkit.org"), { });
+ testRequest(backend6, mainDocumentRequest("http://sub.w3c.org"), { ContentExtensions::ActionType::BlockLoad });
+ testRequest(backend6, mainDocumentRequest("http://sub.whatwg.org"), { });
+ testRequest(backend6, mainDocumentRequest("http://webkit.org/ignore"), { }, true);
+ testRequest(backend6, mainDocumentRequest("http://w3c.org/ignore"), { }, true);
+ testRequest(backend6, mainDocumentRequest("http://whatwg.org/ignore"), { });
+ testRequest(backend6, mainDocumentRequest("http://sub.webkit.org/ignore"), { }, true);
+ testRequest(backend6, mainDocumentRequest("http://sub.w3c.org/ignore"), { ContentExtensions::ActionType::BlockLoad });
+ testRequest(backend6, mainDocumentRequest("http://sub.whatwg.org/ignore"), { });
+ testRequest(backend6, subResourceRequest("http://example.com/image.png", "http://webkit.org/", ResourceType::Image), { });
+ testRequest(backend6, subResourceRequest("http://example.com/image.png", "http://w3c.org/", ResourceType::Image), { ContentExtensions::ActionType::BlockCookies });
+ testRequest(backend6, subResourceRequest("http://example.com/doc.html", "http://webkit.org/", ResourceType::Document), { ContentExtensions::ActionType::BlockLoad });
+ testRequest(backend6, subResourceRequest("http://example.com/script.js", "http://webkit.org/", ResourceType::Script), { ContentExtensions::ActionType::BlockLoad });
+ testRequest(backend6, subResourceRequest("http://example.com/script.js", "http://w3c.org/", ResourceType::Script), { ContentExtensions::ActionType::BlockCookies, ContentExtensions::ActionType::BlockLoad });
+ testRequest(backend6, subResourceRequest("http://example.com/script.js", "http://example.com/", ResourceType::Script), { });
+ testRequest(backend6, subResourceRequest("http://example.com/ignore/image.png", "http://webkit.org/", ResourceType::Image), { }, true);
+ testRequest(backend6, subResourceRequest("http://example.com/ignore/image.png", "http://example.com/", ResourceType::Image), { });
+ testRequest(backend6, subResourceRequest("http://example.com/ignore/image.png", "http://example.org/", ResourceType::Image), { ContentExtensions::ActionType::BlockCookies });
+ testRequest(backend6, subResourceRequest("http://example.com/doc.html", "http://example.org/", ResourceType::Document), { });
+ testRequest(backend6, subResourceRequest("http://example.com/", "http://example.com/", ResourceType::Font), { });
+ testRequest(backend6, subResourceRequest("http://example.com/ignore", "http://webkit.org/", ResourceType::Image), { }, true);
+ testRequest(backend6, subResourceRequest("http://example.com/ignore", "http://webkit.org/", ResourceType::Font), { }, true);
+ testRequest(backend6, subResourceRequest("http://example.com/", "http://example.com/", ResourceType::Script), { });
+ testRequest(backend6, subResourceRequest("http://example.com/ignore", "http://example.com/", ResourceType::Script), { });
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TEST_F(ContentExtensionTest, InvalidJSON)
</span></span></pre>
</div>
</div>
</body>
</html>