Title: [210083] trunk/Source/WebCore
- Revision
- 210083
- Author
- [email protected]
- Date
- 2016-12-21 16:04:11 -0800 (Wed, 21 Dec 2016)
Log Message
WebKit should set Original URL of a download request correctly
https://bugs.webkit.org/show_bug.cgi?id=166394
<rdar://problem/25391382>
Reviewed by Alex Christensen.
WebKit should set Original URL of a download request correctly if the download
is initiated by clicking on a link with target=_blank.
Manually tested as the requested test infrastructure doesn't exist yet. We need actual
loading process for API test such that we could simulate the real situation which
PolicyDownload is only set when we receive responds. Currently we can only set
PolicyDownload in a NavigationDelegate when the load starts. Hence we cannot simulate
the following process: load starts -> PolicyUse -> creates a new WebView ->
respond receives -> PolicyDownload -> downloads.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::setOriginalURLForDownloadRequest):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (210082 => 210083)
--- trunk/Source/WebCore/ChangeLog 2016-12-21 23:58:46 UTC (rev 210082)
+++ trunk/Source/WebCore/ChangeLog 2016-12-22 00:04:11 UTC (rev 210083)
@@ -1,3 +1,24 @@
+2016-12-21 Jiewen Tan <[email protected]>
+
+ WebKit should set Original URL of a download request correctly
+ https://bugs.webkit.org/show_bug.cgi?id=166394
+ <rdar://problem/25391382>
+
+ Reviewed by Alex Christensen.
+
+ WebKit should set Original URL of a download request correctly if the download
+ is initiated by clicking on a link with target=_blank.
+
+ Manually tested as the requested test infrastructure doesn't exist yet. We need actual
+ loading process for API test such that we could simulate the real situation which
+ PolicyDownload is only set when we receive responds. Currently we can only set
+ PolicyDownload in a NavigationDelegate when the load starts. Hence we cannot simulate
+ the following process: load starts -> PolicyUse -> creates a new WebView ->
+ respond receives -> PolicyDownload -> downloads.
+
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::setOriginalURLForDownloadRequest):
+
2016-12-21 Sam Weinig <[email protected]>
[WebIDL] Remove custom binding for ErrorEvent
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (210082 => 210083)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2016-12-21 23:58:46 UTC (rev 210082)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2016-12-22 00:04:11 UTC (rev 210083)
@@ -2363,7 +2363,14 @@
{
// FIXME: Rename firstPartyForCookies back to mainDocumentURL. It was a mistake to think that it was only used for cookies.
// The originalURL is defined as the URL of the page where the download was initiated.
- URL originalURL = m_frame.document() ? m_frame.document()->firstPartyForCookies() : URL();
+ URL originalURL;
+ if (m_frame.document()) {
+ originalURL = m_frame.document()->firstPartyForCookies();
+ // If there is no main document URL, it means that this document is newly opened and just for download purpose.
+ // In this case, we need to set the originalURL to this document's opener's main document URL.
+ if (originalURL.isEmpty() && opener() && opener()->document())
+ originalURL = opener()->document()->firstPartyForCookies();
+ }
// If the originalURL is the same as the requested URL, we are processing a download
// initiated directly without a page and do not need to specify the originalURL.
if (originalURL == request.url())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes