<!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>[213010] 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/213010">213010</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2017-02-26 10:31:13 -0800 (Sun, 26 Feb 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>HitTestResult's linkSuggestedFilename should sanitize download attribute
https://bugs.webkit.org/show_bug.cgi?id=168856
&lt;rdar://problem/30683109&gt;

Reviewed by Antti Koivisto.

Source/WebCore:

HitTestResult's linkSuggestedFilename should sanitize download attribute.
This is used by the context menu's &quot;Download Linked File&quot; &amp; &quot;Download Linked
File As...&quot; actions.

* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::linkSuggestedFilename):
* rendering/HitTestResult.h:

Source/WebKit2:

HitTestResult's linkSuggestedFilename should sanitize download attribute.
This is used by the context menu's &quot;Download Linked File&quot; &amp; &quot;Download Linked
File As...&quot; actions.

* Shared/WebHitTestResultData.cpp:
(WebKit::WebHitTestResultData::WebHitTestResultData):
* WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp:
(WebKit::InjectedBundleHitTestResult::linkSuggestedFilename):

Tools:

Add test coverage.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/link-with-download-attribute-with-slashes.html: Added.
* TestWebKitAPI/Tests/WebKit2/mac/ContextMenuDownload.mm:
(TestWebKitAPI::decideDestinationWithSuggestedFilenameContainingSlashes):
(TestWebKitAPI::TEST):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingHitTestResultcpp">trunk/Source/WebCore/rendering/HitTestResult.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingHitTestResulth">trunk/Source/WebCore/rendering/HitTestResult.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedWebHitTestResultDatacpp">trunk/Source/WebKit2/Shared/WebHitTestResultData.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleInjectedBundleHitTestResultcpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2macContextMenuDownloadmm">trunk/Tools/TestWebKitAPI/Tests/WebKit2/mac/ContextMenuDownload.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2linkwithdownloadattributewithslasheshtml">trunk/Tools/TestWebKitAPI/Tests/WebKit2/link-with-download-attribute-with-slashes.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (213009 => 213010)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-02-26 07:19:22 UTC (rev 213009)
+++ trunk/Source/WebCore/ChangeLog        2017-02-26 18:31:13 UTC (rev 213010)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2017-02-26  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        HitTestResult's linkSuggestedFilename should sanitize download attribute
+        https://bugs.webkit.org/show_bug.cgi?id=168856
+        &lt;rdar://problem/30683109&gt;
+
+        Reviewed by Antti Koivisto.
+
+        HitTestResult's linkSuggestedFilename should sanitize download attribute.
+        This is used by the context menu's &quot;Download Linked File&quot; &amp; &quot;Download Linked
+        File As...&quot; actions.
+
+        * rendering/HitTestResult.cpp:
+        (WebCore::HitTestResult::linkSuggestedFilename):
+        * rendering/HitTestResult.h:
+
</ins><span class="cx"> 2017-02-25  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Simple line layout: Move coverage functions out of SimpleLineLayout.cpp
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingHitTestResultcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/HitTestResult.cpp (213009 => 213010)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/HitTestResult.cpp        2017-02-26 07:19:22 UTC (rev 213009)
+++ trunk/Source/WebCore/rendering/HitTestResult.cpp        2017-02-26 18:31:13 UTC (rev 213010)
</span><span class="lines">@@ -784,12 +784,12 @@
</span><span class="cx">     return node-&gt;parentElement();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-const AtomicString&amp; HitTestResult::URLElementDownloadAttribute() const
</del><ins>+String HitTestResult::linkSuggestedFilename() const
</ins><span class="cx"> {
</span><span class="cx">     auto* urlElement = URLElement();
</span><span class="cx">     if (!is&lt;HTMLAnchorElement&gt;(urlElement))
</span><span class="cx">         return nullAtom;
</span><del>-    return urlElement-&gt;attributeWithoutSynchronization(HTMLNames::downloadAttr);
</del><ins>+    return ResourceResponse::sanitizeSuggestedFilename(urlElement-&gt;attributeWithoutSynchronization(HTMLNames::downloadAttr));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool HitTestResult::mediaSupportsEnhancedFullscreen() const
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingHitTestResulth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/HitTestResult.h (213009 => 213010)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/HitTestResult.h        2017-02-26 07:19:22 UTC (rev 213009)
+++ trunk/Source/WebCore/rendering/HitTestResult.h        2017-02-26 18:31:13 UTC (rev 213010)
</span><span class="lines">@@ -62,7 +62,7 @@
</span><span class="cx">     Scrollbar* scrollbar() const { return m_scrollbar.get(); }
</span><span class="cx">     bool isOverWidget() const { return m_isOverWidget; }
</span><span class="cx"> 
</span><del>-    WEBCORE_EXPORT const AtomicString&amp; URLElementDownloadAttribute() const;
</del><ins>+    WEBCORE_EXPORT String linkSuggestedFilename() const;
</ins><span class="cx"> 
</span><span class="cx">     // Forwarded from HitTestLocation
</span><span class="cx">     bool isRectBasedTest() const { return m_hitTestLocation.isRectBasedTest(); }
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (213009 => 213010)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-02-26 07:19:22 UTC (rev 213009)
+++ trunk/Source/WebKit2/ChangeLog        2017-02-26 18:31:13 UTC (rev 213010)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2017-02-26  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        HitTestResult's linkSuggestedFilename should sanitize download attribute
+        https://bugs.webkit.org/show_bug.cgi?id=168856
+        &lt;rdar://problem/30683109&gt;
+
+        Reviewed by Antti Koivisto.
+
+        HitTestResult's linkSuggestedFilename should sanitize download attribute.
+        This is used by the context menu's &quot;Download Linked File&quot; &amp; &quot;Download Linked
+        File As...&quot; actions.
+
+        * Shared/WebHitTestResultData.cpp:
+        (WebKit::WebHitTestResultData::WebHitTestResultData):
+        * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp:
+        (WebKit::InjectedBundleHitTestResult::linkSuggestedFilename):
+
</ins><span class="cx"> 2017-02-25  Michael Catanzaro  &lt;mcatanzaro@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Unreviewed, document deficiency in webkit_website_data_manager_clear() API
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebHitTestResultDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebHitTestResultData.cpp (213009 => 213010)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebHitTestResultData.cpp        2017-02-26 07:19:22 UTC (rev 213009)
+++ trunk/Source/WebKit2/Shared/WebHitTestResultData.cpp        2017-02-26 18:31:13 UTC (rev 213010)
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx">     , absoluteMediaURL(hitTestResult.absoluteMediaURL().string())
</span><span class="cx">     , linkLabel(hitTestResult.textContent())
</span><span class="cx">     , linkTitle(hitTestResult.titleDisplayString())
</span><del>-    , linkSuggestedFilename(hitTestResult.URLElementDownloadAttribute().string())
</del><ins>+    , linkSuggestedFilename(hitTestResult.linkSuggestedFilename())
</ins><span class="cx">     , isContentEditable(hitTestResult.isContentEditable())
</span><span class="cx">     , elementBoundingBox(elementBoundingBoxInWindowCoordinates(hitTestResult))
</span><span class="cx">     , isScrollbar(hitTestResult.scrollbar())
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx">     , absoluteMediaURL(hitTestResult.absoluteMediaURL().string())
</span><span class="cx">     , linkLabel(hitTestResult.textContent())
</span><span class="cx">     , linkTitle(hitTestResult.titleDisplayString())
</span><del>-    , linkSuggestedFilename(hitTestResult.URLElementDownloadAttribute().string())
</del><ins>+    , linkSuggestedFilename(hitTestResult.linkSuggestedFilename())
</ins><span class="cx">     , isContentEditable(hitTestResult.isContentEditable())
</span><span class="cx">     , elementBoundingBox(elementBoundingBoxInWindowCoordinates(hitTestResult))
</span><span class="cx">     , isScrollbar(hitTestResult.scrollbar())
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleInjectedBundleHitTestResultcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp (213009 => 213010)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp        2017-02-26 07:19:22 UTC (rev 213009)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp        2017-02-26 18:31:13 UTC (rev 213010)
</span><span class="lines">@@ -141,7 +141,7 @@
</span><span class="cx"> 
</span><span class="cx"> String InjectedBundleHitTestResult::linkSuggestedFilename() const
</span><span class="cx"> {
</span><del>-    return m_hitTestResult.URLElementDownloadAttribute();
</del><ins>+    return m_hitTestResult.linkSuggestedFilename();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> IntRect InjectedBundleHitTestResult::imageRect() const
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (213009 => 213010)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2017-02-26 07:19:22 UTC (rev 213009)
+++ trunk/Tools/ChangeLog        2017-02-26 18:31:13 UTC (rev 213010)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2017-02-26  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        HitTestResult's linkSuggestedFilename should sanitize download attribute
+        https://bugs.webkit.org/show_bug.cgi?id=168856
+        &lt;rdar://problem/30683109&gt;
+
+        Reviewed by Antti Koivisto.
+
+        Add test coverage.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKit2/link-with-download-attribute-with-slashes.html: Added.
+        * TestWebKitAPI/Tests/WebKit2/mac/ContextMenuDownload.mm:
+        (TestWebKitAPI::decideDestinationWithSuggestedFilenameContainingSlashes):
+        (TestWebKitAPI::TEST):
+
</ins><span class="cx"> 2017-02-24  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Resource Timing] Media elements initiated loads should set the initiatorType to their element name (video/audio)
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (213009 => 213010)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2017-02-26 07:19:22 UTC (rev 213009)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2017-02-26 18:31:13 UTC (rev 213010)
</span><span class="lines">@@ -436,6 +436,7 @@
</span><span class="cx">                 8349D3C21DB96DDE004A9F65 /* ContextMenuDownload.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8349D3C11DB96DDA004A9F65 /* ContextMenuDownload.mm */; };
</span><span class="cx">                 8349D3C41DB9728E004A9F65 /* link-with-download-attribute.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 8349D3C31DB9724F004A9F65 /* link-with-download-attribute.html */; };
</span><span class="cx">                 835CF9671D25FCD6001A65D4 /* RestoreSessionStateWithoutNavigation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 835CF9661D25FCD6001A65D4 /* RestoreSessionStateWithoutNavigation.cpp */; };
</span><ins>+                8361F1781E610B4E00759B25 /* link-with-download-attribute-with-slashes.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 8361F1771E610B2100759B25 /* link-with-download-attribute-with-slashes.html */; };
</ins><span class="cx">                 837A35F11D9A1E7D00663C57 /* DownloadRequestBlobURL.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 837A35F01D9A1E6400663C57 /* DownloadRequestBlobURL.html */; };
</span><span class="cx">                 83CF1C301C4F1B8B00688447 /* StringUtilities.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83CF1C2C1C4F19AE00688447 /* StringUtilities.mm */; };
</span><span class="cx">                 8E4A85371E1D1AB200F53B0F /* GridPosition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8E4A85361E1D1AA100F53B0F /* GridPosition.cpp */; };
</span><span class="lines">@@ -635,6 +636,7 @@
</span><span class="cx">                         dstPath = TestWebKitAPI.resources;
</span><span class="cx">                         dstSubfolderSpec = 7;
</span><span class="cx">                         files = (
</span><ins>+                                8361F1781E610B4E00759B25 /* link-with-download-attribute-with-slashes.html in Copy Resources */,
</ins><span class="cx">                                 C25CCA0D1E5141840026CB8A /* AllAhem.svg in Copy Resources */,
</span><span class="cx">                                 C25CCA0B1E5140C10026CB8A /* LineBreaking.html in Copy Resources */,
</span><span class="cx">                                 C9C60E651E53A9DC006DA181 /* autoplay-check-frame.html in Copy Resources */,
</span><span class="lines">@@ -1139,6 +1141,7 @@
</span><span class="cx">                 8349D3C11DB96DDA004A9F65 /* ContextMenuDownload.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ContextMenuDownload.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 8349D3C31DB9724F004A9F65 /* link-with-download-attribute.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = &quot;link-with-download-attribute.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 835CF9661D25FCD6001A65D4 /* RestoreSessionStateWithoutNavigation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RestoreSessionStateWithoutNavigation.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                8361F1771E610B2100759B25 /* link-with-download-attribute-with-slashes.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = &quot;link-with-download-attribute-with-slashes.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 837A35F01D9A1E6400663C57 /* DownloadRequestBlobURL.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = DownloadRequestBlobURL.html; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 83B88A331C80056D00BB2418 /* HTMLParserIdioms.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLParserIdioms.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 83CF1C2C1C4F19AE00688447 /* StringUtilities.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringUtilities.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -2078,6 +2081,7 @@
</span><span class="cx">                                 CE3524F51B142BBB0028A7C5 /* input-focus-blur.html */,
</span><span class="cx">                                 C99B675B1E3971FC00FC6C80 /* js-play-with-controls.html */,
</span><span class="cx">                                 8349D3C31DB9724F004A9F65 /* link-with-download-attribute.html */,
</span><ins>+                                8361F1771E610B2100759B25 /* link-with-download-attribute-with-slashes.html */,
</ins><span class="cx">                                 378E647816326FDF00B6C676 /* link-with-title.html */,
</span><span class="cx">                                 9361002814DC957B0061379D /* lots-of-iframes.html */,
</span><span class="cx">                                 93AF4ECF1506F123007FD57E /* lots-of-images.html */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2linkwithdownloadattributewithslasheshtml"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/link-with-download-attribute-with-slashes.html (0 => 213010)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/link-with-download-attribute-with-slashes.html                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/link-with-download-attribute-with-slashes.html        2017-02-26 18:31:13 UTC (rev 213010)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;html&gt;
+    &lt;body&gt;
+        &lt;a id=&quot;testAnchor&quot; style=&quot;display: block; height: 100%; width: 100%&quot; download=&quot;test1/test2/downloadAttributeValue.txt&quot;&gt;&lt;/a&gt;
+        &lt;script&gt;
+            var blob = new Blob([&quot;Hello world!&quot;], {type: &quot;application/octet-stream&quot;});
+            var link = document.getElementById(&quot;testAnchor&quot;);
+            link.href = window.URL.createObjectURL(blob);
+        &lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2macContextMenuDownloadmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2/mac/ContextMenuDownload.mm (213009 => 213010)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/mac/ContextMenuDownload.mm        2017-02-26 07:19:22 UTC (rev 213009)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/mac/ContextMenuDownload.mm        2017-02-26 18:31:13 UTC (rev 213010)
</span><span class="lines">@@ -108,4 +108,50 @@
</span><span class="cx">     Util::run(&amp;didDecideDownloadDestination);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static WKStringRef decideDestinationWithSuggestedFilenameContainingSlashes(WKContextRef, WKDownloadRef download, WKStringRef suggestedFilename, bool*, const void*)
+{
+    // Make sure the suggested filename is provided and matches the value of the download attribute in the HTML, after sanitization.
+    EXPECT_WK_STREQ(&quot;test1_test2_downloadAttributeValue.txt&quot;, suggestedFilename);
+
+    WKDownloadCancel(download);
+    didDecideDownloadDestination = true;
+
+    return Util::toWK(&quot;/tmp/WebKitAPITest/ContextMenuDownload&quot;).leakRef();
</ins><span class="cx"> }
</span><ins>+
+TEST(WebKit2, ContextMenuDownloadHTMLDownloadAttributeWithSlashes)
+{
+    WKRetainPtr&lt;WKContextRef&gt; context(AdoptWK, Util::createContextWithInjectedBundle());
+
+    WKContextDownloadClientV0 client;
+    memset(&amp;client, 0, sizeof(client));
+    client.base.version = 0;
+    client.decideDestinationWithSuggestedFilename = decideDestinationWithSuggestedFilenameContainingSlashes;
+    WKContextSetDownloadClient(context.get(), &amp;client.base);
+
+    WKRetainPtr&lt;WKPageGroupRef&gt; pageGroup(AdoptWK, WKPageGroupCreateWithIdentifier(Util::toWK(&quot;MyGroup&quot;).get()));
+    PlatformWebView webView(context.get(), pageGroup.get());
+
+    WKPageLoaderClientV0 loaderClient;
+    memset(&amp;loaderClient, 0, sizeof(loaderClient));
+    loaderClient.base.version = 0;
+    loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
+    WKPageSetPageLoaderClient(webView.page(), &amp;loaderClient.base);
+
+    WKPageContextMenuClientV3 contextMenuClient;
+    memset(&amp;contextMenuClient, 0, sizeof(contextMenuClient));
+    contextMenuClient.base.version = 3;
+    contextMenuClient.getContextMenuFromProposedMenu = getContextMenuFromProposedMenu;
+    WKPageSetPageContextMenuClient(webView.page(), &amp;contextMenuClient.base);
+
+    WKRetainPtr&lt;WKURLRef&gt; url(AdoptWK, Util::createURLForResource(&quot;link-with-download-attribute-with-slashes&quot;, &quot;html&quot;));
+
+    WKPageLoadURL(webView.page(), url.get());
+    Util::run(&amp;didFinishLoad);
+
+    // Right click on link.
+    webView.simulateButtonClick(kWKEventMouseButtonRightButton, 50, 50, 0);
+    Util::run(&amp;didDecideDownloadDestination);
+}
+
+}
</ins></span></pre>
</div>
</div>

</body>
</html>