<!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>[184598] 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/184598">184598</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2015-05-19 15:22:51 -0700 (Tue, 19 May 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>X-Frame-Options headers not respected when loading from application cache.
&lt;rdar://problem/14877623&gt; and https://bugs.webkit.org/show_bug.cgi?id=131800

Reviewed by Alexey Proskuryakov.

Source/WebCore:

Test: http/tests/appcache/x-frame-options-prevents-framing.php

This patch updates SubstituteData to hold on to a ResourceResponse instead of just a URL.

It also updates all users of SubstituteData to reflect this.

Finally it updates ApplicationCacheHost to put the full response (including x-frame-options header)
in the SubstituteData so they can be checked at the appropriate times.

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::handleSubstituteDataLoadNow):
(WebCore::DocumentLoader::responseReceived): Update an ASSERT to reflect that it's okay to not have
  a main resource as long as you have a substitute identifier for it.
(WebCore::DocumentLoader::documentURL):
(WebCore::DocumentLoader::contentFilterDidDecide):

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadArchive):
(WebCore::FrameLoader::defaultSubstituteDataForURL):

* loader/SubstituteData.h:
(WebCore::SubstituteData::SubstituteData):
(WebCore::SubstituteData::shouldRevealToSessionHistory):
(WebCore::SubstituteData::mimeType):
(WebCore::SubstituteData::textEncoding):
(WebCore::SubstituteData::response):
(WebCore::SubstituteData::responseURL): Deleted.

* loader/appcache/ApplicationCacheHost.cpp:
(WebCore::ApplicationCacheHost::maybeLoadMainResource): Put the full ResourceResponse here, which
  includes x-frame-options headers sent back when the resources was initially loaded from the network.

* platform/network/ResourceResponseBase.h:

Source/WebKit/mac:

* WebView/WebFrame.mm:
(-[WebFrame _loadData:MIMEType:textEncodingName:baseURL:unreachableURL:]):

Source/WebKit/win:

* WebFrame.cpp:
(WebFrame::loadData):

Source/WebKit2:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::loadDataImpl):

LayoutTests:

* http/tests/appcache/resources/x-frame-options-prevents-framing-test.html: Added.
* http/tests/appcache/resources/x-frame-options-prevents-framing.manifest: Added.
* http/tests/appcache/x-frame-options-prevents-framing-expected.txt: Added.
* http/tests/appcache/x-frame-options-prevents-framing.php: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreloaderDocumentLoadercpp">trunk/Source/WebCore/loader/DocumentLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderFrameLoadercpp">trunk/Source/WebCore/loader/FrameLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderSubstituteDatah">trunk/Source/WebCore/loader/SubstituteData.h</a></li>
<li><a href="#trunkSourceWebCoreloaderappcacheApplicationCacheHostcpp">trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceResponseBaseh">trunk/Source/WebCore/platform/network/ResourceResponseBase.h</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebFramemm">trunk/Source/WebKit/mac/WebView/WebFrame.mm</a></li>
<li><a href="#trunkSourceWebKitwinChangeLog">trunk/Source/WebKit/win/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitwinWebFramecpp">trunk/Source/WebKit/win/WebFrame.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestsappcacheresourcesxframeoptionspreventsframingtesthtml">trunk/LayoutTests/http/tests/appcache/resources/x-frame-options-prevents-framing-test.html</a></li>
<li><a href="#trunkLayoutTestshttptestsappcacheresourcesxframeoptionspreventsframingmanifest">trunk/LayoutTests/http/tests/appcache/resources/x-frame-options-prevents-framing.manifest</a></li>
<li><a href="#trunkLayoutTestshttptestsappcachexframeoptionspreventsframingexpectedtxt">trunk/LayoutTests/http/tests/appcache/x-frame-options-prevents-framing-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsappcachexframeoptionspreventsframingphp">trunk/LayoutTests/http/tests/appcache/x-frame-options-prevents-framing.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (184597 => 184598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-05-19 22:10:07 UTC (rev 184597)
+++ trunk/LayoutTests/ChangeLog        2015-05-19 22:22:51 UTC (rev 184598)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-05-19  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        X-Frame-Options headers not respected when loading from application cache.
+        &lt;rdar://problem/14877623&gt; and https://bugs.webkit.org/show_bug.cgi?id=131800
+
+        Reviewed by Alexey Proskuryakov.
+
+        * http/tests/appcache/resources/x-frame-options-prevents-framing-test.html: Added.
+        * http/tests/appcache/resources/x-frame-options-prevents-framing.manifest: Added.
+        * http/tests/appcache/x-frame-options-prevents-framing-expected.txt: Added.
+        * http/tests/appcache/x-frame-options-prevents-framing.php: Added.
+
</ins><span class="cx"> 2015-05-19  Youenn Fablet  &lt;youenn.fablet@crf.canon.fr&gt;
</span><span class="cx"> 
</span><span class="cx">         AudioContext should resolve promises with jsUndefined() and not jsNull()
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsappcacheresourcesxframeoptionspreventsframingtesthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/appcache/resources/x-frame-options-prevents-framing-test.html (0 => 184598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/appcache/resources/x-frame-options-prevents-framing-test.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/appcache/resources/x-frame-options-prevents-framing-test.html        2015-05-19 22:22:51 UTC (rev 184598)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+&lt;script&gt;
+
+function loaded()
+{
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+window.onload = loaded();
+
+&lt;/script&gt;
+The following iframe is a document that was cached in the application cache.&lt;br&gt;
+It also had &quot;x-frame-options: deny&quot; set, so it should not actually show up in the iframe&lt;br&gt;
+&lt;iframe src=&quot;http:/127.0.0.1:8000/appcache/x-frame-options-prevents-framing.php&quot;&gt;&lt;/iframe&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsappcacheresourcesxframeoptionspreventsframingmanifest"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/appcache/resources/x-frame-options-prevents-framing.manifest (0 => 184598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/appcache/resources/x-frame-options-prevents-framing.manifest                                (rev 0)
+++ trunk/LayoutTests/http/tests/appcache/resources/x-frame-options-prevents-framing.manifest        2015-05-19 22:22:51 UTC (rev 184598)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+CACHE MANIFEST
+empty.txt
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsappcachexframeoptionspreventsframingexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/appcache/x-frame-options-prevents-framing-expected.txt (0 => 184598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/appcache/x-frame-options-prevents-framing-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/appcache/x-frame-options-prevents-framing-expected.txt        2015-05-19 22:22:51 UTC (rev 184598)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+CONSOLE MESSAGE: Refused to display 'http://127.0.0.1:8000/appcache/x-frame-options-prevents-framing.php' in a frame because it set 'X-Frame-Options' to 'deny'.
+The following iframe is a document that was cached in the application cache.
+It also had &quot;x-frame-options: deny&quot; set, so it should not actually show up in the iframe
+
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame0--&gt;--&gt;'
+--------
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsappcachexframeoptionspreventsframingphp"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/appcache/x-frame-options-prevents-framing.php (0 => 184598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/appcache/x-frame-options-prevents-framing.php                                (rev 0)
+++ trunk/LayoutTests/http/tests/appcache/x-frame-options-prevents-framing.php        2015-05-19 22:22:51 UTC (rev 184598)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+&lt;?php
+header(&quot;X-FRAME-OPTIONS: deny&quot;);
+?&gt;
+&lt;html manifest=&quot;resources/x-frame-options-prevents-framing.manifest&quot;&gt;
+&lt;script&gt;
+
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.dumpChildFramesAsText();
+    testRunner.waitUntilDone();
+}
+
+function cached()
+{
+     window.location.href = &quot;/appcache/resources/x-frame-options-prevents-framing-test.html&quot;;
+}
+applicationCache.addEventListener('cached', cached, false);
+
+&lt;/script&gt;
+This document should not be frameable.&lt;br&gt;
+If you see this text in an iframe, then there is a bug.&lt;br&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (184597 => 184598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-05-19 22:10:07 UTC (rev 184597)
+++ trunk/Source/WebCore/ChangeLog        2015-05-19 22:22:51 UTC (rev 184598)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2015-05-19  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        X-Frame-Options headers not respected when loading from application cache.
+        &lt;rdar://problem/14877623&gt; and https://bugs.webkit.org/show_bug.cgi?id=131800
+
+        Reviewed by Alexey Proskuryakov.
+
+        Test: http/tests/appcache/x-frame-options-prevents-framing.php
+
+        This patch updates SubstituteData to hold on to a ResourceResponse instead of just a URL.
+        
+        It also updates all users of SubstituteData to reflect this.
+        
+        Finally it updates ApplicationCacheHost to put the full response (including x-frame-options header)
+        in the SubstituteData so they can be checked at the appropriate times.
+        
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::handleSubstituteDataLoadNow):
+        (WebCore::DocumentLoader::responseReceived): Update an ASSERT to reflect that it's okay to not have
+          a main resource as long as you have a substitute identifier for it.
+        (WebCore::DocumentLoader::documentURL):
+        (WebCore::DocumentLoader::contentFilterDidDecide):
+        
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::loadArchive):
+        (WebCore::FrameLoader::defaultSubstituteDataForURL):
+
+        * loader/SubstituteData.h:
+        (WebCore::SubstituteData::SubstituteData):
+        (WebCore::SubstituteData::shouldRevealToSessionHistory):
+        (WebCore::SubstituteData::mimeType):
+        (WebCore::SubstituteData::textEncoding):
+        (WebCore::SubstituteData::response):
+        (WebCore::SubstituteData::responseURL): Deleted.
+
+        * loader/appcache/ApplicationCacheHost.cpp:
+        (WebCore::ApplicationCacheHost::maybeLoadMainResource): Put the full ResourceResponse here, which 
+          includes x-frame-options headers sent back when the resources was initially loaded from the network.
+
+        * platform/network/ResourceResponseBase.h:
+
</ins><span class="cx"> 2015-05-19  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(142590): Part 2: Scroll-snap points are improperly snapping to earlier index values (Scrolling Thread) 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderDocumentLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (184597 => 184598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/DocumentLoader.cpp        2015-05-19 22:10:07 UTC (rev 184597)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp        2015-05-19 22:22:51 UTC (rev 184598)
</span><span class="lines">@@ -457,10 +457,10 @@
</span><span class="cx"> 
</span><span class="cx"> void DocumentLoader::handleSubstituteDataLoadNow()
</span><span class="cx"> {
</span><del>-    URL url = m_substituteData.responseURL();
-    if (url.isEmpty())
-        url = m_request.url();
-    ResourceResponse response(url, m_substituteData.mimeType(), m_substituteData.content()-&gt;size(), m_substituteData.textEncoding());
</del><ins>+    ResourceResponse response = m_substituteData.response();
+    if (response.url().isEmpty())
+        response = ResourceResponse(m_request.url(), m_substituteData.mimeType(), m_substituteData.content()-&gt;size(), m_substituteData.textEncoding());
+
</ins><span class="cx">     responseReceived(0, response);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -606,7 +606,7 @@
</span><span class="cx">     auto it = commonHeaders.find(HTTPHeaderName::XFrameOptions);
</span><span class="cx">     if (it != commonHeaders.end()) {
</span><span class="cx">         String content = it-&gt;value;
</span><del>-        ASSERT(m_mainResource);
</del><ins>+        ASSERT(m_identifierForLoadWithoutResourceLoader || m_mainResource);
</ins><span class="cx">         unsigned long identifier = m_identifierForLoadWithoutResourceLoader ? m_identifierForLoadWithoutResourceLoader : m_mainResource-&gt;identifier();
</span><span class="cx">         ASSERT(identifier);
</span><span class="cx">         if (frameLoader()-&gt;shouldInterruptLoadForXFrameOptions(content, response.url(), identifier)) {
</span><span class="lines">@@ -1234,7 +1234,7 @@
</span><span class="cx"> 
</span><span class="cx"> URL DocumentLoader::documentURL() const
</span><span class="cx"> {
</span><del>-    URL url = substituteData().responseURL();
</del><ins>+    URL url = substituteData().response().url();
</ins><span class="cx"> #if ENABLE(WEB_ARCHIVE)
</span><span class="cx">     if (url.isEmpty() &amp;&amp; m_archive &amp;&amp; m_archive-&gt;type() == Archive::WebArchive)
</span><span class="cx">         url = m_archive-&gt;mainResource()-&gt;url();
</span><span class="lines">@@ -1609,7 +1609,8 @@
</span><span class="cx">     URL blockedURL;
</span><span class="cx">     blockedURL.setProtocol(ContentFilter::urlScheme());
</span><span class="cx">     blockedURL.setHost(ASCIILiteral(&quot;blocked-page&quot;));
</span><del>-    SubstituteData substituteData { contentFilter-&gt;replacementData(), ASCIILiteral(&quot;text/html&quot;), ASCIILiteral(&quot;UTF-8&quot;), documentURL() };
</del><ins>+    ResourceResponse response(URL(), ASCIILiteral(&quot;text/html&quot;), contentFilter-&gt;replacementData()-&gt;size(), ASCIILiteral(&quot;UTF-8&quot;));
+    SubstituteData substituteData { contentFilter-&gt;replacementData(), documentURL(), response, SubstituteData::SessionHistoryVisibility::Hidden };
</ins><span class="cx">     frame()-&gt;navigationScheduler().scheduleSubstituteDataLoad(blockedURL, substituteData);
</span><span class="cx"> }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFrameLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (184597 => 184598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FrameLoader.cpp        2015-05-19 22:10:07 UTC (rev 184597)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp        2015-05-19 22:22:51 UTC (rev 184598)
</span><span class="lines">@@ -925,8 +925,9 @@
</span><span class="cx">     ASSERT(mainResource);
</span><span class="cx">     if (!mainResource)
</span><span class="cx">         return;
</span><del>-        
-    SubstituteData substituteData(mainResource-&gt;data(), mainResource-&gt;mimeType(), mainResource-&gt;textEncoding(), URL());
</del><ins>+
+    ResourceResponse response(URL(), mainResource-&gt;mimeType(), mainResource-&gt;data()-&gt;size(), mainResource-&gt;textEncoding());
+    SubstituteData substituteData(mainResource-&gt;data(), URL(), response, SubstituteData::SessionHistoryVisibility::Hidden);
</ins><span class="cx">     
</span><span class="cx">     ResourceRequest request(mainResource-&gt;url());
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="lines">@@ -1272,7 +1273,9 @@
</span><span class="cx">     String srcdoc = m_frame.ownerElement()-&gt;fastGetAttribute(srcdocAttr);
</span><span class="cx">     ASSERT(!srcdoc.isNull());
</span><span class="cx">     CString encodedSrcdoc = srcdoc.utf8();
</span><del>-    return SubstituteData(SharedBuffer::create(encodedSrcdoc.data(), encodedSrcdoc.length()), &quot;text/html&quot;, &quot;UTF-8&quot;, URL());
</del><ins>+
+    ResourceResponse response(URL(), ASCIILiteral(&quot;text/html&quot;), encodedSrcdoc.length(), ASCIILiteral(&quot;UTF-8&quot;));
+    return SubstituteData(SharedBuffer::create(encodedSrcdoc.data(), encodedSrcdoc.length()), URL(), response, SubstituteData::SessionHistoryVisibility::Hidden);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FrameLoader::load(const FrameLoadRequest&amp; passedRequest)
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderSubstituteDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/SubstituteData.h (184597 => 184598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/SubstituteData.h        2015-05-19 22:10:07 UTC (rev 184597)
+++ trunk/Source/WebCore/loader/SubstituteData.h        2015-05-19 22:22:51 UTC (rev 184598)
</span><span class="lines">@@ -26,8 +26,9 @@
</span><span class="cx"> #ifndef SubstituteData_h
</span><span class="cx"> #define SubstituteData_h
</span><span class="cx"> 
</span><del>-#include &quot;URL.h&quot;
</del><ins>+#include &quot;ResourceResponse.h&quot;
</ins><span class="cx"> #include &quot;SharedBuffer.h&quot;
</span><ins>+#include &quot;URL.h&quot;
</ins><span class="cx"> #include &lt;wtf/PassRefPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/RefPtr.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -35,41 +36,37 @@
</span><span class="cx"> 
</span><span class="cx">     class SubstituteData {
</span><span class="cx">     public:
</span><ins>+        enum class SessionHistoryVisibility {
+            Visible,
+            Hidden,
+        };
+
</ins><span class="cx">         SubstituteData()
</span><del>-            : m_shouldRevealToSessionHistory(false)
</del><span class="cx">         {
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        SubstituteData(PassRefPtr&lt;SharedBuffer&gt; content, const String&amp; mimeType,
-                const String&amp; textEncoding, const URL&amp; failingURL,
-                const URL&amp; responseURL = URL(), bool shouldRevealToSessionHistory = false)
</del><ins>+        SubstituteData(PassRefPtr&lt;SharedBuffer&gt; content, const URL&amp; failingURL, const ResourceResponse&amp; response, SessionHistoryVisibility shouldRevealToSessionHistory)
</ins><span class="cx">             : m_content(content)
</span><del>-            , m_mimeType(mimeType)
-            , m_textEncoding(textEncoding)
</del><span class="cx">             , m_failingURL(failingURL)
</span><del>-            , m_responseURL(responseURL)
</del><ins>+            , m_response(response)
</ins><span class="cx">             , m_shouldRevealToSessionHistory(shouldRevealToSessionHistory)
</span><span class="cx">         {
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        static const bool ShouldRevealToSessionHistory = true;
-
</del><span class="cx">         bool isValid() const { return m_content != 0; }
</span><del>-        bool shouldRevealToSessionHistory() const { return m_shouldRevealToSessionHistory; }
</del><ins>+        bool shouldRevealToSessionHistory() const { return m_shouldRevealToSessionHistory == SessionHistoryVisibility::Visible; }
</ins><span class="cx"> 
</span><span class="cx">         const SharedBuffer* content() const { return m_content.get(); }
</span><del>-        const String&amp; mimeType() const { return m_mimeType; }
-        const String&amp; textEncoding() const { return m_textEncoding; }
</del><ins>+        const String&amp; mimeType() const { return m_response.mimeType(); }
+        const String&amp; textEncoding() const { return m_response.textEncodingName(); }
</ins><span class="cx">         const URL&amp; failingURL() const { return m_failingURL; }
</span><del>-        const URL&amp; responseURL() const { return m_responseURL; }
</del><ins>+        const ResourceResponse&amp; response() const { return m_response; }
</ins><span class="cx">         
</span><span class="cx">     private:
</span><span class="cx">         RefPtr&lt;SharedBuffer&gt; m_content;
</span><del>-        String m_mimeType;
-        String m_textEncoding;
</del><span class="cx">         URL m_failingURL;
</span><del>-        URL m_responseURL;
-        bool m_shouldRevealToSessionHistory;
</del><ins>+        ResourceResponse m_response;
+        SessionHistoryVisibility m_shouldRevealToSessionHistory { SessionHistoryVisibility::Hidden };
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderappcacheApplicationCacheHostcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp (184597 => 184598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp        2015-05-19 22:10:07 UTC (rev 184597)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp        2015-05-19 22:22:51 UTC (rev 184598)
</span><span class="lines">@@ -84,12 +84,20 @@
</span><span class="cx">         if (m_mainResourceApplicationCache) {
</span><span class="cx">             // Get the resource from the application cache. By definition, cacheForMainRequest() returns a cache that contains the resource.
</span><span class="cx">             ApplicationCacheResource* resource = m_mainResourceApplicationCache-&gt;resourceForRequest(request);
</span><ins>+
+            // ApplicationCache resources have fragment identifiers stripped off of their URLs,
+            // but we'll need to restore that for the SubstituteData.
+            ResourceResponse responseToUse = resource-&gt;response();
+            if (request.url().hasFragmentIdentifier()) {
+                URL url = responseToUse.url();
+                url.setFragmentIdentifier(request.url().fragmentIdentifier());
+                responseToUse.setURL(url);
+            }
+
</ins><span class="cx">             substituteData = SubstituteData(resource-&gt;data(),
</span><del>-                                            resource-&gt;response().mimeType(),
-                                            resource-&gt;response().textEncodingName(),
</del><span class="cx">                                             URL(),
</span><del>-                                            URL(),
-                                            SubstituteData::ShouldRevealToSessionHistory);
</del><ins>+                                            responseToUse,
+                                            SubstituteData::SessionHistoryVisibility::Visible);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceResponseBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.h (184597 => 184598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceResponseBase.h        2015-05-19 22:10:07 UTC (rev 184597)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.h        2015-05-19 22:22:51 UTC (rev 184598)
</span><span class="lines">@@ -133,7 +133,7 @@
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT ResourceResponseBase();
</span><del>-    ResourceResponseBase(const URL&amp;, const String&amp; mimeType, long long expectedLength, const String&amp; textEncodingName);
</del><ins>+    WEBCORE_EXPORT ResourceResponseBase(const URL&amp;, const String&amp; mimeType, long long expectedLength, const String&amp; textEncodingName);
</ins><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT void lazyInit(InitLevel) const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (184597 => 184598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2015-05-19 22:10:07 UTC (rev 184597)
+++ trunk/Source/WebKit/mac/ChangeLog        2015-05-19 22:22:51 UTC (rev 184598)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2015-05-19  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        X-Frame-Options headers not respected when loading from application cache.
+        &lt;rdar://problem/14877623&gt; and https://bugs.webkit.org/show_bug.cgi?id=131800
+
+        Reviewed by Alexey Proskuryakov.
+
+        * WebView/WebFrame.mm:
+        (-[WebFrame _loadData:MIMEType:textEncodingName:baseURL:unreachableURL:]):
+
</ins><span class="cx"> 2015-05-18  Skachkov Alexandr  &lt;gskachkov@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [ES6] Arrow function syntax. Feature flag for arrow function
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebFramemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebFrame.mm (184597 => 184598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebFrame.mm        2015-05-19 22:10:07 UTC (rev 184597)
+++ trunk/Source/WebKit/mac/WebView/WebFrame.mm        2015-05-19 22:22:51 UTC (rev 184598)
</span><span class="lines">@@ -2525,7 +2525,8 @@
</span><span class="cx">     [NSURLProtocol setProperty:@&quot;&quot; forKey:@&quot;WebDataRequest&quot; inRequest:(NSMutableURLRequest *)request.nsURLRequest(UpdateHTTPBody)];
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    SubstituteData substituteData(WebCore::SharedBuffer::wrapNSData(data), MIMEType, encodingName, [unreachableURL absoluteURL], responseURL);
</del><ins>+    ResourceResponse response(responseURL, MIMEType, [data length], encodingName);
+    SubstituteData substituteData(WebCore::SharedBuffer::wrapNSData(data), [unreachableURL absoluteURL], response, SubstituteData::SessionHistoryVisibility::Hidden);
</ins><span class="cx"> 
</span><span class="cx">     _private-&gt;coreFrame-&gt;loader().load(FrameLoadRequest(_private-&gt;coreFrame, request, substituteData));
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitwinChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/ChangeLog (184597 => 184598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/ChangeLog        2015-05-19 22:10:07 UTC (rev 184597)
+++ trunk/Source/WebKit/win/ChangeLog        2015-05-19 22:22:51 UTC (rev 184598)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2015-05-19  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        X-Frame-Options headers not respected when loading from application cache.
+        &lt;rdar://problem/14877623&gt; and https://bugs.webkit.org/show_bug.cgi?id=131800
+
+        Reviewed by Alexey Proskuryakov.
+
+        * WebFrame.cpp:
+        (WebFrame::loadData):
+
</ins><span class="cx"> 2015-05-11  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Win] Move Windows build target to Windows 7 (or newer)
</span></span></pre></div>
<a id="trunkSourceWebKitwinWebFramecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/WebFrame.cpp (184597 => 184598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/WebFrame.cpp        2015-05-19 22:10:07 UTC (rev 184597)
+++ trunk/Source/WebKit/win/WebFrame.cpp        2015-05-19 22:22:51 UTC (rev 184598)
</span><span class="lines">@@ -561,12 +561,13 @@
</span><span class="cx">     // FIXME: We should really be using MarshallingHelpers::BSTRToKURL here,
</span><span class="cx">     // but that would turn a null BSTR into a null URL, and we crash inside of
</span><span class="cx">     // WebCore if we use a null URL in constructing the ResourceRequest.
</span><del>-    URL baseKURL = URL(URL(), String(baseURL ? baseURL : L&quot;&quot;, SysStringLen(baseURL)));
</del><ins>+    URL baseCoreURL = URL(URL(), String(baseURL ? baseURL : L&quot;&quot;, SysStringLen(baseURL)));
</ins><span class="cx"> 
</span><del>-    URL failingKURL = MarshallingHelpers::BSTRToKURL(failingURL);
</del><ins>+    URL failingCoreURL = MarshallingHelpers::BSTRToKURL(failingURL);
</ins><span class="cx"> 
</span><del>-    ResourceRequest request(baseKURL);
-    SubstituteData substituteData(data, mimeTypeString, encodingString, failingKURL);
</del><ins>+    ResourceRequest request(baseCoreURL);
+    ResourceResponse response(URL(), mimeTypeString, data-&gt;size(), encodingString);
+    SubstituteData substituteData(data, failingCoreURL, response, SubstituteData::SessionHistoryVisibility::Hidden);
</ins><span class="cx"> 
</span><span class="cx">     // This method is only called from IWebFrame methods, so don't ASSERT that the Frame pointer isn't null.
</span><span class="cx">     if (Frame* coreFrame = core(this))
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (184597 => 184598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-05-19 22:10:07 UTC (rev 184597)
+++ trunk/Source/WebKit2/ChangeLog        2015-05-19 22:22:51 UTC (rev 184598)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2015-05-19  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        X-Frame-Options headers not respected when loading from application cache.
+        &lt;rdar://problem/14877623&gt; and https://bugs.webkit.org/show_bug.cgi?id=131800
+
+        Reviewed by Alexey Proskuryakov.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::loadDataImpl):
+
</ins><span class="cx"> 2015-05-19  Sungmann Cho  &lt;sungmann.cho@navercorp.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add PLUGIN_ARCHITECTURE(MAC) around WKNVCALayerRenderServerPort in NetscapeBrowserFunc.h.
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (184597 => 184598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2015-05-19 22:10:07 UTC (rev 184597)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2015-05-19 22:22:51 UTC (rev 184598)
</span><span class="lines">@@ -1039,7 +1039,8 @@
</span><span class="cx">     m_pendingNavigationID = navigationID;
</span><span class="cx"> 
</span><span class="cx">     ResourceRequest request(baseURL);
</span><del>-    SubstituteData substituteData(sharedBuffer, MIMEType, encodingName, unreachableURL);
</del><ins>+    ResourceResponse response(URL(), MIMEType, sharedBuffer-&gt;size(), encodingName);
+    SubstituteData substituteData(sharedBuffer, unreachableURL, response, SubstituteData::SessionHistoryVisibility::Hidden);
</ins><span class="cx"> 
</span><span class="cx">     // Let the InjectedBundle know we are about to start the load, passing the user data from the UIProcess
</span><span class="cx">     // to all the client to set up any needed state.
</span></span></pre>
</div>
</div>

</body>
</html>