<!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>[186929] 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/186929">186929</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2015-07-16 22:32:26 -0700 (Thu, 16 Jul 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/186807">r186807</a>. rdar://problem/21782350</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari6011branchLayoutTestsChangeLog">branches/safari-601.1-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari6011branchLayoutTestshttptestscontentextensionsmainresourceredirectblockedexpectedtxt">branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/main-resource-redirect-blocked-expected.txt</a></li>
<li><a href="#branchessafari6011branchSourceWebCoreChangeLog">branches/safari-601.1-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari6011branchSourceWebCorecontentextensionsContentExtensionsBackendcpp">branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari6011branchLayoutTestshttptestscontentextensionsblockeverythingifdomainexpectedtxt">branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-if-domain-expected.txt</a></li>
<li><a href="#branchessafari6011branchLayoutTestshttptestscontentextensionsblockeverythingifdomainhtml">branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-if-domain.html</a></li>
<li><a href="#branchessafari6011branchLayoutTestshttptestscontentextensionsblockeverythingifdomainhtmljson">branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-if-domain.html.json</a></li>
<li><a href="#branchessafari6011branchLayoutTestshttptestscontentextensionsblockeverythingunlessdomainexpectedtxt">branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-expected.txt</a></li>
<li><a href="#branchessafari6011branchLayoutTestshttptestscontentextensionsblockeverythingunlessdomainiframeexpectedtxt">branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-iframe-expected.txt</a></li>
<li><a href="#branchessafari6011branchLayoutTestshttptestscontentextensionsblockeverythingunlessdomainiframehtml">branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-iframe.html</a></li>
<li><a href="#branchessafari6011branchLayoutTestshttptestscontentextensionsblockeverythingunlessdomainiframehtmljson">branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-iframe.html.json</a></li>
<li><a href="#branchessafari6011branchLayoutTestshttptestscontentextensionsblockeverythingunlessdomainredirectexpectedtxt">branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-redirect-expected.txt</a></li>
<li><a href="#branchessafari6011branchLayoutTestshttptestscontentextensionsblockeverythingunlessdomainredirectphp">branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-redirect.php</a></li>
<li><a href="#branchessafari6011branchLayoutTestshttptestscontentextensionsblockeverythingunlessdomainredirectphpjson">branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-redirect.php.json</a></li>
<li><a href="#branchessafari6011branchLayoutTestshttptestscontentextensionsblockeverythingunlessdomainhtml">branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain.html</a></li>
<li><a href="#branchessafari6011branchLayoutTestshttptestscontentextensionsblockeverythingunlessdomainhtmljson">branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain.html.json</a></li>
<li><a href="#branchessafari6011branchLayoutTestshttptestscontentextensionsresourcesblockeverythingunlessdomainhelperhtml">branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/resources/block-everything-unless-domain-helper.html</a></li>
<li><a href="#branchessafari6011branchLayoutTestshttptestscontentextensionsresourcesshouldloadhtml">branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/resources/should-load.html</a></li>
<li><a href="#branchessafari6011branchLayoutTestshttptestscontentextensionsresourcesshouldnotloadhtml">branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/resources/should-not-load.html</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 (186928 => 186929)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/ChangeLog        2015-07-17 05:32:19 UTC (rev 186928)
+++ branches/safari-601.1-branch/LayoutTests/ChangeLog        2015-07-17 05:32:26 UTC (rev 186929)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2015-07-16  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
+        Merge r186807. rdar://problem/21782350
+
+    2015-07-14  Alex Christensen  &lt;achristensen@webkit.org&gt;
+
+            [Content Extensions] Fix if-domain and unless-domain when loading main documents.
+            https://bugs.webkit.org/show_bug.cgi?id=146868
+
+            Reviewed by Benjamin Poulain.
+
+            * http/tests/contentextensions/block-everything-if-domain-expected.txt: Added.
+            * http/tests/contentextensions/block-everything-if-domain.html: Added.
+            * http/tests/contentextensions/block-everything-if-domain.html.json: Added.
+            * http/tests/contentextensions/block-everything-unless-domain-expected.txt: Added.
+            * http/tests/contentextensions/block-everything-unless-domain-iframe-expected.txt: Added.
+            * http/tests/contentextensions/block-everything-unless-domain-iframe.html: Added.
+            * http/tests/contentextensions/block-everything-unless-domain-iframe.html.json: Added.
+            * http/tests/contentextensions/block-everything-unless-domain-redirect-expected.txt: Added.
+            * http/tests/contentextensions/block-everything-unless-domain-redirect.php: Added.
+            * http/tests/contentextensions/block-everything-unless-domain-redirect.php.json: Added.
+            * http/tests/contentextensions/block-everything-unless-domain.html: Added.
+            * http/tests/contentextensions/block-everything-unless-domain.html.json: Added.
+            * http/tests/contentextensions/main-resource-redirect-blocked-expected.txt:
+            * http/tests/contentextensions/resources/block-everything-unless-domain-helper.html: Added.
+            * http/tests/contentextensions/resources/should-load.html: Added.
+            * http/tests/contentextensions/resources/should-not-load.html: Added.
+
</ins><span class="cx"> 2015-07-12  Babak Shafiei  &lt;bshafiei@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r186741.
</span></span></pre></div>
<a id="branchessafari6011branchLayoutTestshttptestscontentextensionsblockeverythingifdomainexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-if-domain-expected.txt (0 => 186929)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-if-domain-expected.txt                                (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-if-domain-expected.txt        2015-07-17 05:32:26 UTC (rev 186929)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+CONSOLE MESSAGE: Content blocker prevented frame displaying http://127.0.0.1:8000/contentextensions/block-everything-if-domain.html from loading a resource from http://127.0.0.1:8000/contentextensions/block-everything-if-domain.html
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestshttptestscontentextensionsblockeverythingifdomainhtml"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-if-domain.html (0 => 186929)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-if-domain.html                                (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-if-domain.html        2015-07-17 05:32:26 UTC (rev 186929)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+about:blank should load instead of this.
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestshttptestscontentextensionsblockeverythingifdomainhtmljson"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-if-domain.html.json (0 => 186929)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-if-domain.html.json                                (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-if-domain.html.json        2015-07-17 05:32:26 UTC (rev 186929)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+[
+    {
+        &quot;action&quot;: {
+            &quot;type&quot;: &quot;block&quot;
+        },
+        &quot;trigger&quot;: {
+            &quot;url-filter&quot;: &quot;.*&quot;,
+            &quot;if-domain&quot;: [&quot;127.0.0.1&quot;]
+        }
+    }
+]
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestshttptestscontentextensionsblockeverythingunlessdomainexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-expected.txt (0 => 186929)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-expected.txt                                (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-expected.txt        2015-07-17 05:32:26 UTC (rev 186929)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+CONSOLE MESSAGE: line 18: http://127.0.0.1:8000/contentextensions/resources/block-everything-unless-domain-helper.html
+CONSOLE MESSAGE: line 5: helper loaded
+CONSOLE MESSAGE: line 7: Content blocker prevented frame displaying http://localhost:8000/contentextensions/resources/should-not-load.html from loading a resource from http://localhost:8000/contentextensions/resources/should-not-load.html
+CONSOLE MESSAGE: line 15: successfully blocked load from localhost
+
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestshttptestscontentextensionsblockeverythingunlessdomainiframeexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-iframe-expected.txt (0 => 186929)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-iframe-expected.txt                                (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-iframe-expected.txt        2015-07-17 05:32:26 UTC (rev 186929)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+CONSOLE MESSAGE: line 15: The page loaded successfully.
+CONSOLE MESSAGE: line 3: This page should load.
+
+
+--------
+Frame: 'iframe'
+--------
+This page should load.
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestshttptestscontentextensionsblockeverythingunlessdomainiframehtml"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-iframe.html (0 => 186929)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-iframe.html                                (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-iframe.html        2015-07-17 05:32:26 UTC (rev 186929)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+&lt;head&gt;
+&lt;script&gt;
+if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.dumpChildFramesAsText();
+        testRunner.waitUntilDone();
+}
+function iframeLoaded()
+{
+        if (window.testRunner)
+                testRunner.notifyDone();
+}
+function bodyLoaded()
+{
+    console.log(&quot;The page loaded successfully.&quot;);
+    document.getElementById(&quot;iframe&quot;).onload = iframeLoaded;
+        document.getElementById(&quot;iframe&quot;).src = &quot;http://localhost:8000/contentextensions/resources/should-load.html&quot;;
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;bodyLoaded()&quot;&gt;
+&lt;iframe id=&quot;iframe&quot;&gt;&lt;/iframe&gt;
+&lt;/body&gt;
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestshttptestscontentextensionsblockeverythingunlessdomainiframehtmljson"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-iframe.html.json (0 => 186929)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-iframe.html.json                                (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-iframe.html.json        2015-07-17 05:32:26 UTC (rev 186929)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+[
+    {
+        &quot;action&quot;: {
+            &quot;type&quot;: &quot;block&quot;
+        },
+        &quot;trigger&quot;: {
+            &quot;url-filter&quot;: &quot;.*&quot;,
+            &quot;unless-domain&quot;: [&quot;127.0.0.1&quot;]
+        }
+    }
+]
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestshttptestscontentextensionsblockeverythingunlessdomainredirectexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-redirect-expected.txt (0 => 186929)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-redirect-expected.txt                                (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-redirect-expected.txt        2015-07-17 05:32:26 UTC (rev 186929)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+CONSOLE MESSAGE: Content blocker prevented frame displaying http://localhost/contentextensions/resources/should-not-load.html from loading a resource from http://localhost/contentextensions/resources/should-not-load.html
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestshttptestscontentextensionsblockeverythingunlessdomainredirectphp"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-redirect.php (0 => 186929)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-redirect.php                                (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-redirect.php        2015-07-17 05:32:26 UTC (rev 186929)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+&lt;?php
+  header('Location: http://localhost/contentextensions/resources/should-not-load.html');
+  header('HTTP/1.0 302 Found');
+?&gt;
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestshttptestscontentextensionsblockeverythingunlessdomainredirectphpjson"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-redirect.php.json (0 => 186929)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-redirect.php.json                                (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain-redirect.php.json        2015-07-17 05:32:26 UTC (rev 186929)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+[
+    {
+        &quot;action&quot;: {
+            &quot;type&quot;: &quot;block&quot;
+        },
+        &quot;trigger&quot;: {
+            &quot;url-filter&quot;: &quot;.*&quot;,
+            &quot;unless-domain&quot;: [&quot;127.0.0.1&quot;]
+        }
+    }
+]
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestshttptestscontentextensionsblockeverythingunlessdomainhtml"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain.html (0 => 186929)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain.html                                (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain.html        2015-07-17 05:32:26 UTC (rev 186929)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+&lt;script&gt;
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+    testRunner.setCanOpenWindows(true);
+    testRunner.setCloseRemainingWindowsWhenComplete(true);
+}
+
+var maxEventLoopRuns = 50;
+function helperLoaded () {
+    if (!maxEventLoopRuns) {
+        console.log(&quot;blocking load failed&quot;);
+        testRunner.notifyDone();
+    } else if (helper.location == &quot;about:blank&quot;) {
+        console.log(&quot;successfully blocked load from localhost&quot;);
+        testRunner.notifyDone();
+    } else {
+        console.log(helper.location);
+        setTimeout(helperLoaded, 1);
+        maxEventLoopRuns--;
+    }
+}
+
+var helper = window.open(&quot;resources/block-everything-unless-domain-helper.html&quot;);
+if (helper)
+    helper.addEventListener('load', helperLoaded);
+else {
+    console.log(&quot;opening window failed&quot;);
+    testRunner.notifyDone();
+}
+&lt;/script&gt;
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestshttptestscontentextensionsblockeverythingunlessdomainhtmljson"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain.html.json (0 => 186929)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain.html.json                                (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/block-everything-unless-domain.html.json        2015-07-17 05:32:26 UTC (rev 186929)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+[
+    {
+        &quot;action&quot;: {
+            &quot;type&quot;: &quot;block&quot;
+        },
+        &quot;trigger&quot;: {
+            &quot;url-filter&quot;: &quot;.*&quot;,
+            &quot;unless-domain&quot;: [&quot;127.0.0.1&quot;]
+        }
+    }
+]
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestshttptestscontentextensionsmainresourceredirectblockedexpectedtxt"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/main-resource-redirect-blocked-expected.txt (186928 => 186929)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/main-resource-redirect-blocked-expected.txt        2015-07-17 05:32:19 UTC (rev 186928)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/main-resource-redirect-blocked-expected.txt        2015-07-17 05:32:26 UTC (rev 186929)
</span><span class="lines">@@ -1 +1 @@
</span><del>-CONSOLE MESSAGE: Content blocker prevented frame displaying about:blank from loading a resource from http://127.0.0.1:8000/contentextensions/resources/main-resource-redirect-blocked-target.html
</del><ins>+CONSOLE MESSAGE: Content blocker prevented frame displaying http://127.0.0.1:8000/contentextensions/resources/main-resource-redirect-blocked-target.html from loading a resource from http://127.0.0.1:8000/contentextensions/resources/main-resource-redirect-blocked-target.html
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestshttptestscontentextensionsresourcesblockeverythingunlessdomainhelperhtml"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/resources/block-everything-unless-domain-helper.html (0 => 186929)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/resources/block-everything-unless-domain-helper.html                                (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/resources/block-everything-unless-domain-helper.html        2015-07-17 05:32:26 UTC (rev 186929)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+&lt;head&gt;
+&lt;script&gt;
+function bodyLoaded()
+{
+    console.log(&quot;helper loaded&quot;);
+    var anchor = document.getElementById(&quot;anchor&quot;);
+        anchor.click();
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;bodyLoaded()&quot;&gt;
+&lt;a id=&quot;anchor&quot; href=&quot;http://localhost:8000/contentextensions/resources/should-not-load.html&quot;&gt;Clicking this should take you to a document that doesn't load with the content extension.&lt;/a&gt;
+&lt;/body&gt;
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestshttptestscontentextensionsresourcesshouldloadhtml"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/resources/should-load.html (0 => 186929)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/resources/should-load.html                                (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/resources/should-load.html        2015-07-17 05:32:26 UTC (rev 186929)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+This page should load.
+&lt;script&gt;
+    console.log(&quot;This page should load.&quot;);
+&lt;/script&gt;
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestshttptestscontentextensionsresourcesshouldnotloadhtml"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/resources/should-not-load.html (0 => 186929)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/resources/should-not-load.html                                (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentextensions/resources/should-not-load.html        2015-07-17 05:32:26 UTC (rev 186929)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+This page should not load.
+&lt;script&gt;
+    console.log(&quot;This page should not load.&quot;);
+&lt;/script&gt;
</ins></span></pre></div>
<a id="branchessafari6011branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/ChangeLog (186928 => 186929)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/ChangeLog        2015-07-17 05:32:19 UTC (rev 186928)
+++ branches/safari-601.1-branch/Source/WebCore/ChangeLog        2015-07-17 05:32:26 UTC (rev 186929)
</span><span class="lines">@@ -1,5 +1,25 @@
</span><span class="cx"> 2015-07-16  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r186807. rdar://problem/21782350
+
+    2015-07-14  Alex Christensen  &lt;achristensen@webkit.org&gt;
+
+            [Content Extensions] Fix if-domain and unless-domain when loading main documents.
+            https://bugs.webkit.org/show_bug.cgi?id=146868
+
+            Reviewed by Benjamin Poulain.
+
+            Tests: http/tests/contentextensions/block-everything-if-domain.html
+                   http/tests/contentextensions/block-everything-unless-domain-iframe.html
+                   http/tests/contentextensions/block-everything-unless-domain-redirect.php
+                   http/tests/contentextensions/block-everything-unless-domain.html
+
+            * contentextensions/ContentExtensionsBackend.cpp:
+            (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad):
+            If we are loading a new main document, use that main document url as the main document url for domain comparison.
+
+2015-07-16  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
</ins><span class="cx">         Merge r186786. rdar://problem/9222837
</span><span class="cx"> 
</span><span class="cx">     2015-07-13  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCorecontentextensionsContentExtensionsBackendcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp (186928 => 186929)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp        2015-07-17 05:32:19 UTC (rev 186928)
+++ branches/safari-601.1-branch/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp        2015-07-17 05:32:26 UTC (rev 186929)
</span><span class="lines">@@ -167,10 +167,14 @@
</span><span class="cx">     Document* currentDocument = nullptr;
</span><span class="cx">     URL mainDocumentURL;
</span><span class="cx"> 
</span><del>-    if (initiatingDocumentLoader.frame()) {
-        currentDocument = initiatingDocumentLoader.frame()-&gt;document();
</del><ins>+    if (Frame* frame = initiatingDocumentLoader.frame()) {
+        currentDocument = frame-&gt;document();
</ins><span class="cx"> 
</span><del>-        if (Document* mainDocument = initiatingDocumentLoader.frame()-&gt;mainFrame().document())
</del><ins>+        if (initiatingDocumentLoader.isLoadingMainResource()
+            &amp;&amp; frame-&gt;isMainFrame()
+            &amp;&amp; resourceType == ResourceType::Document)
+            mainDocumentURL = request.url();
+        else if (Document* mainDocument = frame-&gt;mainFrame().document())
</ins><span class="cx">             mainDocumentURL = mainDocument-&gt;url();
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>