<!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>[187064] 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/187064">187064</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2015-07-20 21:37:05 -0700 (Mon, 20 Jul 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/186957">r186957</a>. rdar://problem/21867831</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari6011branchLayoutTestsChangeLog">branches/safari-601.1-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari6011branchSourceWebCoreChangeLog">branches/safari-601.1-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari6011branchSourceWebCorecontentextensionsContentExtensionCompilercpp">branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp</a></li>
<li><a href="#branchessafari6011branchSourceWebCorecontentextensionsContentExtensionRuleh">branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtensionRule.h</a></li>
<li><a href="#branchessafari6011branchSourceWebCorecontentextensionsContentExtensionsBackendcpp">branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp</a></li>
<li><a href="#branchessafari6011branchSourceWebCoreloaderDocumentLoadercpp">branches/safari-601.1-branch/Source/WebCore/loader/DocumentLoader.cpp</a></li>
<li><a href="#branchessafari6011branchSourceWebCoreloaderDocumentLoaderh">branches/safari-601.1-branch/Source/WebCore/loader/DocumentLoader.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari6011branchLayoutTestshttptestscontentextensionscssdisplaynonewithdifferentcasesensitivityarenotmergedexpectedtxt">branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/css-display-none-with-different-case-sensitivity-are-not-merged-expected.txt</a></li>
<li><a href="#branchessafari6011branchLayoutTestshttptestscontentextensionscssdisplaynonewithdifferentcasesensitivityarenotmergedhtml">branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/css-display-none-with-different-case-sensitivity-are-not-merged.html</a></li>
<li><a href="#branchessafari6011branchLayoutTestshttptestscontentextensionscssdisplaynonewithdifferentcasesensitivityarenotmergedhtmljson">branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/css-display-none-with-different-case-sensitivity-are-not-merged.html.json</a></li>
<li><a href="#branchessafari6011branchLayoutTestshttptestscontentextensionscssdisplaynonewithdifferenttriggersarenotmergedexpectedtxt">branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/css-display-none-with-different-triggers-are-not-merged-expected.txt</a></li>
<li><a href="#branchessafari6011branchLayoutTestshttptestscontentextensionscssdisplaynonewithdifferenttriggersarenotmergedhtml">branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/css-display-none-with-different-triggers-are-not-merged.html</a></li>
<li><a href="#branchessafari6011branchLayoutTestshttptestscontentextensionscssdisplaynonewithdifferenttriggersarenotmergedhtmljson">branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/css-display-none-with-different-triggers-are-not-merged.html.json</a></li>
<li><a href="#branchessafari6011branchLayoutTestshttptestscontentextensionstwodistinguishablecssdisplaynonerulesonmainresourceexpectedtxt">branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/two-distinguishable-css-display-none-rules-on-main-resource-expected.txt</a></li>
<li><a href="#branchessafari6011branchLayoutTestshttptestscontentextensionstwodistinguishablecssdisplaynonerulesonmainresourcehtml">branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/two-distinguishable-css-display-none-rules-on-main-resource.html</a></li>
<li><a href="#branchessafari6011branchLayoutTestshttptestscontentextensionstwodistinguishablecssdisplaynonerulesonmainresourcehtmljson">branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/two-distinguishable-css-display-none-rules-on-main-resource.html.json</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari6011branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/LayoutTests/ChangeLog (187063 => 187064)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/ChangeLog        2015-07-21 04:37:00 UTC (rev 187063)
+++ branches/safari-601.1-branch/LayoutTests/ChangeLog        2015-07-21 04:37:05 UTC (rev 187064)
</span><span class="lines">@@ -1,5 +1,26 @@
</span><span class="cx"> 2015-07-20 Matthew Hanson <matthew_hanson@apple.com>
</span><span class="cx">
</span><ins>+ Merge r186957. rdar://problem/21867831
+
+ 2015-07-17 Benjamin Poulain <bpoulain@apple.com>
+
+ [Content Extensions] CSS-display-none rules are not working properly
+ https://bugs.webkit.org/show_bug.cgi?id=147024
+
+ Reviewed by Sam Weinig.
+
+ * http/tests/contentextensions/css-display-none-with-different-case-sensitivity-are-not-merged-expected.txt: Added.
+ * http/tests/contentextensions/css-display-none-with-different-case-sensitivity-are-not-merged.html: Added.
+ * http/tests/contentextensions/css-display-none-with-different-case-sensitivity-are-not-merged.html.json: Added.
+ * http/tests/contentextensions/css-display-none-with-different-triggers-are-not-merged-expected.txt: Added.
+ * http/tests/contentextensions/css-display-none-with-different-triggers-are-not-merged.html: Added.
+ * http/tests/contentextensions/css-display-none-with-different-triggers-are-not-merged.html.json: Added.
+ * http/tests/contentextensions/two-distinguishable-css-display-none-rules-on-main-resource-expected.txt: Added.
+ * http/tests/contentextensions/two-distinguishable-css-display-none-rules-on-main-resource.html: Added.
+ * http/tests/contentextensions/two-distinguishable-css-display-none-rules-on-main-resource.html.json: Added.
+
+2015-07-20 Matthew Hanson <matthew_hanson@apple.com>
+
</ins><span class="cx"> Merge r186858. 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="branchessafari6011branchLayoutTestshttptestscontentextensionscssdisplaynonewithdifferentcasesensitivityarenotmergedexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/css-display-none-with-different-case-sensitivity-are-not-merged-expected.txt (0 => 187064)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/css-display-none-with-different-case-sensitivity-are-not-merged-expected.txt         (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/css-display-none-with-different-case-sensitivity-are-not-merged-expected.txt        2015-07-21 04:37:05 UTC (rev 187064)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+This text should be visible
+
+This text should be visible
+
+This text should be visible
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestshttptestscontentextensionscssdisplaynonewithdifferentcasesensitivityarenotmergedhtml"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/css-display-none-with-different-case-sensitivity-are-not-merged.html (0 => 187064)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/css-display-none-with-different-case-sensitivity-are-not-merged.html         (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/css-display-none-with-different-case-sensitivity-are-not-merged.html        2015-07-21 04:37:05 UTC (rev 187064)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+<head>
+<meta charset="UTF-8"></meta>
+<script>
+ testRunner.dumpAsText();
+</script>
+</head>
+<body>
+<p class="hidden1">This text should be visible</p>
+<p class="hidden2">This text should not be visible!!!</p>
+<p class="hidden3">This text should be visible</p>
+<p class="hidden4">This text should be visible</p>
+</body>
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestshttptestscontentextensionscssdisplaynonewithdifferentcasesensitivityarenotmergedhtmljson"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/css-display-none-with-different-case-sensitivity-are-not-merged.html.json (0 => 187064)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/css-display-none-with-different-case-sensitivity-are-not-merged.html.json         (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/css-display-none-with-different-case-sensitivity-are-not-merged.html.json        2015-07-21 04:37:05 UTC (rev 187064)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+[
+ {
+ "action": {
+ "type": "block"
+ },
+ "trigger": {
+ "url-filter": "this-should-not-block"
+ }
+ },
+ {
+ "action": {
+ "type": "css-display-none",
+ "selector": ".hidden1"
+ },
+ "trigger": {
+ "url-filter": "this-should-not-match"
+ }
+ },
+ {
+ "action": {
+ "type": "css-display-none",
+ "selector": ".hidden2"
+ },
+ "trigger": {
+ "url-filter": "css-display-none-with-different-case-sensitivity-are-not-merged.html$"
+ }
+ },
+ {
+ "action": {
+ "type": "css-display-none",
+ "selector": ".hidden3"
+ },
+ "trigger": {
+ "url-filter-is-case-sensitive": true,
+ "url-filter": "css-display-none-with-different-Case-sensitivity-are-not-merged.html$"
+ }
+ },
+ {
+ "action": {
+ "type": "css-display-none",
+ "selector": ".hidden4"
+ },
+ "trigger": {
+ "url-filter": "this-does-not-match-the-url-either"
+ }
+ },
+ {
+ "action": {
+ "type": "block"
+ },
+ "trigger": {
+ "url-filter-is-case-sensitive": true,
+ "url-filter": "css-display-none-with-different-Case-sensitivity-are-not-merged.html$"
+ }
+ }
+]
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestshttptestscontentextensionscssdisplaynonewithdifferenttriggersarenotmergedexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/css-display-none-with-different-triggers-are-not-merged-expected.txt (0 => 187064)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/css-display-none-with-different-triggers-are-not-merged-expected.txt         (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/css-display-none-with-different-triggers-are-not-merged-expected.txt        2015-07-21 04:37:05 UTC (rev 187064)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+This text should be visible
+
+This text should be visible
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestshttptestscontentextensionscssdisplaynonewithdifferenttriggersarenotmergedhtml"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/css-display-none-with-different-triggers-are-not-merged.html (0 => 187064)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/css-display-none-with-different-triggers-are-not-merged.html         (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/css-display-none-with-different-triggers-are-not-merged.html        2015-07-21 04:37:05 UTC (rev 187064)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+<head>
+<meta charset="UTF-8"></meta>
+<script>
+ testRunner.dumpAsText();
+</script>
+</head>
+<body>
+<p class="hidden1">This text should be visible</p>
+<p class="hidden2">This text should not be visible!!!</p>
+<p class="hidden3">This text should be visible</p>
+</body>
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestshttptestscontentextensionscssdisplaynonewithdifferenttriggersarenotmergedhtmljson"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/css-display-none-with-different-triggers-are-not-merged.html.json (0 => 187064)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/css-display-none-with-different-triggers-are-not-merged.html.json         (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/css-display-none-with-different-triggers-are-not-merged.html.json        2015-07-21 04:37:05 UTC (rev 187064)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+[
+ {
+ "action": {
+ "type": "css-display-none",
+ "selector": ".hidden1"
+ },
+ "trigger": {
+ "url-filter": "this-does-not-match-the-url"
+ }
+ },
+ {
+ "action": {
+ "type": "css-display-none",
+ "selector": ".hidden2"
+ },
+ "trigger": {
+ "url-filter": "css-display-none-with-different-triggers-are-not-merged.html"
+ }
+ },
+ {
+ "action": {
+ "type": "css-display-none",
+ "selector": ".hidden3"
+ },
+ "trigger": {
+ "url-filter": "this-does-not-match-the-url-either"
+ }
+ }
+]
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestshttptestscontentextensionstwodistinguishablecssdisplaynonerulesonmainresourceexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/two-distinguishable-css-display-none-rules-on-main-resource-expected.txt (0 => 187064)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/two-distinguishable-css-display-none-rules-on-main-resource-expected.txt         (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/two-distinguishable-css-display-none-rules-on-main-resource-expected.txt        2015-07-21 04:37:05 UTC (rev 187064)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+This text should be visible.
+
+This text should be visible.
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestshttptestscontentextensionstwodistinguishablecssdisplaynonerulesonmainresourcehtml"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/two-distinguishable-css-display-none-rules-on-main-resource.html (0 => 187064)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/two-distinguishable-css-display-none-rules-on-main-resource.html         (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/two-distinguishable-css-display-none-rules-on-main-resource.html        2015-07-21 04:37:05 UTC (rev 187064)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+<head>
+<meta charset="UTF-8"></meta>
+<script>
+ testRunner.dumpAsText();
+</script>
+</head>
+<body>
+<p id="hidden">This text should be visible.</p>
+<p class="hidden1">This text should not be visible!!! 1</p>
+<p class="hidden2">This text should not be visible!!! 2</p>
+<p class="hidden1 hidden2">This text should not be visible!!! 3</p>
+<p id="hidden3">This text should be visible.</p>
+</body>
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestshttptestscontentextensionstwodistinguishablecssdisplaynonerulesonmainresourcehtmljson"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/two-distinguishable-css-display-none-rules-on-main-resource.html.json (0 => 187064)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/two-distinguishable-css-display-none-rules-on-main-resource.html.json         (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/two-distinguishable-css-display-none-rules-on-main-resource.html.json        2015-07-21 04:37:05 UTC (rev 187064)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+[
+ {
+ "action": {
+ "type": "css-display-none",
+ "selector": ".hidden1"
+ },
+ "trigger": {
+ "url-filter": "two-distinguishable-css-display-none-rules-on-main-resource.html"
+ }
+ },
+ {
+ "action": {
+ "type": "css-display-none",
+ "selector": ".hidden2"
+ },
+ "trigger": {
+ "resource-type": ["document"],
+ "url-filter": "distinguishable-css-display-none-rules-on-main-resource.html$"
+ }
+ }
+]
</ins></span></pre></div>
<a id="branchessafari6011branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/ChangeLog (187063 => 187064)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/ChangeLog        2015-07-21 04:37:00 UTC (rev 187063)
+++ branches/safari-601.1-branch/Source/WebCore/ChangeLog        2015-07-21 04:37:05 UTC (rev 187064)
</span><span class="lines">@@ -1,5 +1,55 @@
</span><span class="cx"> 2015-07-20 Matthew Hanson <matthew_hanson@apple.com>
</span><span class="cx">
</span><ins>+ Merge r186957. rdar://problem/21867831
+
+ 2015-07-17 Benjamin Poulain <bpoulain@apple.com>
+
+ [Content Extensions] CSS-display-none rules are not working properly
+ https://bugs.webkit.org/show_bug.cgi?id=147024
+
+ Reviewed by Sam Weinig.
+
+ There were 2 bugs prevening rules with css-display-none and a url-filter from working
+ correctly.
+
+ First, ContentExtensions::serializeActions() was merging selectors regardless of their
+ trigger. All the CSS Selectors would be grouped together and applied regardless of which
+ rule apply.
+
+ That problem was fixed by grouping CSS rules by trigger. We want all the undistinguishable
+ CSS rules to be merged. The trigger makes 2 rules dinstinguishable as one rule can apply
+ on a page while the next rule does not. The simplest approach is to group by trigger.
+
+ The second problem had to do with rules added before the document is created.
+ When accumulating those rules, we were only keeping the last one. The reason was that
+ DocumentLoader::addPendingContentExtensionDisplayNoneSelector() would only keep a single
+ selector list by extension.
+
+ This is fixed by keeping a vector of all the rules that apply.
+
+ Tests: http/tests/contentextensions/css-display-none-with-different-case-sensitivity-are-not-merged.html
+ http/tests/contentextensions/css-display-none-with-different-triggers-are-not-merged.html
+ http/tests/contentextensions/two-distinguishable-css-display-none-rules-on-main-resource.html
+
+ * contentextensions/ContentExtensionCompiler.cpp:
+ (WebCore::ContentExtensions::serializeActions):
+ * contentextensions/ContentExtensionRule.h:
+ (WebCore::ContentExtensions::Trigger::isEmpty):
+ (WebCore::ContentExtensions::TriggerHash::hash):
+ (WebCore::ContentExtensions::TriggerHash::equal):
+ (WebCore::ContentExtensions::TriggerHashTraits::constructDeletedValue):
+ (WebCore::ContentExtensions::TriggerHashTraits::isDeletedValue):
+ (WebCore::ContentExtensions::TriggerHashTraits::emptyValue):
+ (WebCore::ContentExtensions::TriggerHashTraits::isEmptyValue):
+ * contentextensions/ContentExtensionsBackend.cpp:
+ (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad): Deleted.
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::commitData):
+ (WebCore::DocumentLoader::addPendingContentExtensionDisplayNoneSelector):
+ * loader/DocumentLoader.h:
+
+2015-07-20 Matthew Hanson <matthew_hanson@apple.com>
+
</ins><span class="cx"> Merge r186956. rdar://problem/21643094
</span><span class="cx">
</span><span class="cx"> 2015-07-17 Tim Horton <timothy_horton@apple.com>
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCorecontentextensionsContentExtensionCompilercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp (187063 => 187064)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp        2015-07-21 04:37:00 UTC (rev 187063)
+++ branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp        2015-07-21 04:37:05 UTC (rev 187064)
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx"> Vector<String> selectors;
</span><span class="cx"> Vector<unsigned> clientLocations;
</span><span class="cx"> };
</span><del>-typedef HashMap<uint32_t, PendingDisplayNoneActions, DefaultHash<uint32_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint32_t>> PendingDisplayNoneActionsMap;
</del><ins>+typedef HashMap<Trigger, PendingDisplayNoneActions, TriggerHash, TriggerHashTraits> PendingDisplayNoneActionsMap;
</ins><span class="cx">
</span><span class="cx"> static void resolvePendingDisplayNoneActions(Vector<SerializedActionByte>& actions, Vector<unsigned>& actionLocations, PendingDisplayNoneActionsMap& pendingDisplayNoneActionsMap)
</span><span class="cx"> {
</span><span class="lines">@@ -167,7 +167,7 @@
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> case ActionType::CSSDisplayNoneSelector: {
</span><del>- const auto addResult = cssDisplayNoneActionsMap.add(flags, PendingDisplayNoneActions());
</del><ins>+ const auto addResult = cssDisplayNoneActionsMap.add(rule.trigger(), PendingDisplayNoneActions());
</ins><span class="cx"> PendingDisplayNoneActions& pendingDisplayNoneActions = addResult.iterator->value;
</span><span class="cx"> pendingDisplayNoneActions.selectors.append(rule.action().stringArgument());
</span><span class="cx"> pendingDisplayNoneActions.clientLocations.append(actionLocations.size());
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCorecontentextensionsContentExtensionRuleh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtensionRule.h (187063 => 187064)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtensionRule.h        2015-07-21 04:37:00 UTC (rev 187063)
+++ branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtensionRule.h        2015-07-21 04:37:05 UTC (rev 187064)
</span><span class="lines">@@ -51,12 +51,21 @@
</span><span class="cx"> IfDomain,
</span><span class="cx"> UnlessDomain,
</span><span class="cx"> } domainCondition { DomainCondition::None };
</span><del>-
</del><ins>+
</ins><span class="cx"> ~Trigger()
</span><span class="cx"> {
</span><span class="cx"> ASSERT(domains.isEmpty() == (domainCondition == DomainCondition::None));
</span><span class="cx"> }
</span><del>-
</del><ins>+
+ bool isEmpty() const
+ {
+ return urlFilter.isEmpty()
+ && !urlFilterIsCaseSensitive
+ && !flags
+ && domains.isEmpty()
+ && domainCondition == DomainCondition::None;
+ }
+
</ins><span class="cx"> bool operator==(const Trigger& other) const
</span><span class="cx"> {
</span><span class="cx"> return urlFilter == other.urlFilter
</span><span class="lines">@@ -66,7 +75,58 @@
</span><span class="cx"> && domainCondition == other.domainCondition;
</span><span class="cx"> }
</span><span class="cx"> };
</span><del>-
</del><ins>+
+struct TriggerHash {
+ static unsigned hash(const Trigger& trigger)
+ {
+ unsigned hash = trigger.urlFilterIsCaseSensitive ? 10619863 : 40960001;
+ if (!trigger.urlFilter.isNull())
+ hash ^= StringHash::hash(trigger.urlFilter);
+ hash = WTF::pairIntHash(hash, DefaultHash<ResourceFlags>::Hash::hash(trigger.flags));
+
+ for (const String& domain : trigger.domains)
+ hash ^= StringHash::hash(domain);
+
+ if (trigger.domainCondition == Trigger::DomainCondition::IfDomain)
+ hash |= 1 << 16;
+ else if (trigger.domainCondition == Trigger::DomainCondition::IfDomain)
+ hash |= 1 << 31;
+ return hash;
+ }
+
+ static bool equal(const Trigger& a, const Trigger& b)
+ {
+ return a == b;
+ }
+
+ static const bool safeToCompareToEmptyOrDeleted = false;
+};
+
+struct TriggerHashTraits : public WTF::CustomHashTraits<Trigger> {
+ static const bool emptyValueIsZero = false;
+ static const bool hasIsEmptyValueFunction = true;
+
+ static void constructDeletedValue(Trigger& trigger)
+ {
+ new (NotNull, std::addressof(trigger.urlFilter)) String(WTF::HashTableDeletedValue);
+ }
+
+ static bool isDeletedValue(const Trigger& trigger)
+ {
+ return trigger.urlFilter.isHashTableDeletedValue();
+ }
+
+ static Trigger emptyValue()
+ {
+ return Trigger();
+ }
+
+ static bool isEmptyValue(const Trigger& trigger)
+ {
+ return trigger.isEmpty();
+ }
+};
+
</ins><span class="cx"> struct Action {
</span><span class="cx"> Action()
</span><span class="cx"> : m_type(ActionType::InvalidAction)
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCorecontentextensionsContentExtensionsBackendcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp (187063 => 187064)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp        2015-07-21 04:37:00 UTC (rev 187063)
+++ branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp        2015-07-21 04:37:05 UTC (rev 187064)
</span><span class="lines">@@ -156,7 +156,6 @@
</span><span class="cx"> ResourceLoadInfo resourceLoadInfo = { request.url(), mainDocumentURL, resourceType };
</span><span class="cx"> Vector<ContentExtensions::Action> actions = actionsForResourceLoad(resourceLoadInfo);
</span><span class="cx">
</span><del>- StringBuilder css;
</del><span class="cx"> bool willBlockLoad = false;
</span><span class="cx"> for (const auto& action : actions) {
</span><span class="cx"> switch (action.type()) {
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCoreloaderDocumentLoadercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/loader/DocumentLoader.cpp (187063 => 187064)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/loader/DocumentLoader.cpp        2015-07-21 04:37:00 UTC (rev 187063)
+++ branches/safari-601.1-branch/Source/WebCore/loader/DocumentLoader.cpp        2015-07-21 04:37:05 UTC (rev 187064)
</span><span class="lines">@@ -836,8 +836,10 @@
</span><span class="cx">
</span><span class="cx"> for (auto& pendingStyleSheet : m_pendingNamedContentExtensionStyleSheets)
</span><span class="cx"> styleSheetCollection.maybeAddContentExtensionSheet(pendingStyleSheet.key, *pendingStyleSheet.value);
</span><del>- for (auto& pendingSelector : m_pendingContentExtensionDisplayNoneSelectors)
- styleSheetCollection.addDisplayNoneSelector(pendingSelector.key, pendingSelector.value.first, pendingSelector.value.second);
</del><ins>+ for (auto& pendingSelectorEntry : m_pendingContentExtensionDisplayNoneSelectors) {
+ for (const auto& pendingSelector : pendingSelectorEntry.value)
+ styleSheetCollection.addDisplayNoneSelector(pendingSelectorEntry.key, pendingSelector.first, pendingSelector.second);
+ }
</ins><span class="cx">
</span><span class="cx"> m_pendingNamedContentExtensionStyleSheets.clear();
</span><span class="cx"> m_pendingContentExtensionDisplayNoneSelectors.clear();
</span><span class="lines">@@ -1585,7 +1587,8 @@
</span><span class="cx"> void DocumentLoader::addPendingContentExtensionDisplayNoneSelector(const String& identifier, const String& selector, uint32_t selectorID)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(!m_gotFirstByte);
</span><del>- m_pendingContentExtensionDisplayNoneSelectors.set(identifier, std::make_pair(selector, selectorID));
</del><ins>+ auto addResult = m_pendingContentExtensionDisplayNoneSelectors.add(identifier, Vector<std::pair<String, uint32_t>>());
+ addResult.iterator->value.append(std::make_pair(selector, selectorID));
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCoreloaderDocumentLoaderh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/loader/DocumentLoader.h (187063 => 187064)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/loader/DocumentLoader.h        2015-07-21 04:37:00 UTC (rev 187063)
+++ branches/safari-601.1-branch/Source/WebCore/loader/DocumentLoader.h        2015-07-21 04:37:05 UTC (rev 187064)
</span><span class="lines">@@ -445,7 +445,7 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(CONTENT_EXTENSIONS)
</span><span class="cx"> HashMap<String, RefPtr<StyleSheetContents>> m_pendingNamedContentExtensionStyleSheets;
</span><del>- HashMap<String, std::pair<String, uint32_t>> m_pendingContentExtensionDisplayNoneSelectors;
</del><ins>+ HashMap<String, Vector<std::pair<String, uint32_t>>> m_pendingContentExtensionDisplayNoneSelectors;
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #ifndef NDEBUG
</span></span></pre>
</div>
</div>
</body>
</html>