Title: [236970] trunk
Revision
236970
Author
[email protected]
Date
2018-10-09 11:25:29 -0700 (Tue, 09 Oct 2018)

Log Message

REGRESSION (Safari 12): Download of Blob URL fails
https://bugs.webkit.org/show_bug.cgi?id=190351
<rdar://problem/45091181>

Reviewed by Geoffrey Garen.

Source/WebCore:

When using both the download attribute and target="_blank" on an anchor element, we would
mistakenly drop the download attribute after the "new window" policy decision has been made.
As a result, we would try to load the blob instead of downloading it.

Test: fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target.html

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):

LayoutTests:

Add layout test coverage.

* fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target-expected.txt: Added.
* fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (236969 => 236970)


--- trunk/LayoutTests/ChangeLog	2018-10-09 18:15:56 UTC (rev 236969)
+++ trunk/LayoutTests/ChangeLog	2018-10-09 18:25:29 UTC (rev 236970)
@@ -1,3 +1,16 @@
+2018-10-09  Chris Dumez  <[email protected]>
+
+        REGRESSION (Safari 12): Download of Blob URL fails
+        https://bugs.webkit.org/show_bug.cgi?id=190351
+        <rdar://problem/45091181>
+
+        Reviewed by Geoffrey Garen.
+
+        Add layout test coverage.
+
+        * fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target-expected.txt: Added.
+        * fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target.html: Added.
+
 2018-10-09  Youenn Fablet  <[email protected]>
 
         Add support for IceCandidate stats

Added: trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target-expected.txt (0 => 236970)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target-expected.txt	2018-10-09 18:25:29 UTC (rev 236970)
@@ -0,0 +1,6 @@
+Download started.
+Downloading URL with suggested filename "abe.png"
+Download completed.
+The suggested filename above should be "abe.png" and the download should succeed.
+
+File backed blob URL

Added: trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target.html (0 => 236970)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target.html	2018-10-09 18:25:29 UTC (rev 236970)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner) {
+  testRunner.dumpAsText();
+  testRunner.setCanOpenWindows();
+  testRunner.setShouldLogDownloadCallbacks(true);
+  testRunner.waitUntilDownloadFinished();
+}
+</script>
+</head>
+<body>
+<p>The suggested filename above should be "abe.png" and the download should succeed.</p>
+<a id="blob-url" download="abe.png" target="_blank">File backed blob URL</a>
+<script>
+function click(elmt)
+{
+    if (!window.eventSender) {
+        alert('Click the link to run the test.');
+        return;
+    }
+    eventSender.mouseMoveTo(elmt.offsetLeft + 5, elmt.offsetTop + 5);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+}
+
+function runTest()
+{
+    file = internals.createFile("../resources/abe.png");
+    var link = document.getElementById("blob-url");
+    link.href = ""
+    click(link);
+}
+runTest();
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (236969 => 236970)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2018-10-09 18:15:56 UTC (rev 236969)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2018-10-09 18:25:29 UTC (rev 236970)
@@ -307,6 +307,7 @@
 webkit.org/b/156069 fast/dom/HTMLAnchorElement/anchor-download-synthetic-click.html [ Skip ]
 webkit.org/b/156069 fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html [ Skip ]
 webkit.org/b/156069 fast/dom/HTMLAnchorElement/anchor-file-blob-download.html [ Skip ]
+webkit.org/b/156069 fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target.html [ Skip ]
 webkit.org/b/156069 fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-backslash.html [ Skip ]
 webkit.org/b/156069 fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-doublequote.html [ Skip ]
 webkit.org/b/156069 fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-slashes.html [ Skip ]

Modified: trunk/LayoutTests/platform/win/TestExpectations (236969 => 236970)


--- trunk/LayoutTests/platform/win/TestExpectations	2018-10-09 18:15:56 UTC (rev 236969)
+++ trunk/LayoutTests/platform/win/TestExpectations	2018-10-09 18:25:29 UTC (rev 236970)
@@ -455,6 +455,7 @@
 fast/dom/HTMLAnchorElement/anchor-download-synthetic-click.html [ Skip ]
 fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html [ Skip ]
 fast/dom/HTMLAnchorElement/anchor-file-blob-download.html [ Skip ]
+fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target.html [ Skip ]
 fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-backslash.html [ Skip ]
 fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-doublequote.html [ Skip ]
 fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-slashes.html [ Skip ]

Modified: trunk/Source/WebCore/ChangeLog (236969 => 236970)


--- trunk/Source/WebCore/ChangeLog	2018-10-09 18:15:56 UTC (rev 236969)
+++ trunk/Source/WebCore/ChangeLog	2018-10-09 18:25:29 UTC (rev 236970)
@@ -1,3 +1,20 @@
+2018-10-09  Chris Dumez  <[email protected]>
+
+        REGRESSION (Safari 12): Download of Blob URL fails
+        https://bugs.webkit.org/show_bug.cgi?id=190351
+        <rdar://problem/45091181>
+
+        Reviewed by Geoffrey Garen.
+
+        When using both the download attribute and target="_blank" on an anchor element, we would
+        mistakenly drop the download attribute after the "new window" policy decision has been made.
+        As a result, we would try to load the blob instead of downloading it.
+
+        Test: fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target.html
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
+
 2018-10-09  Alicia Boya GarcĂ­a  <[email protected]>
 
         [MSE][GStreamer] r236735 has some dead ASSERTs that need to be moved

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (236969 => 236970)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2018-10-09 18:15:56 UTC (rev 236969)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2018-10-09 18:25:29 UTC (rev 236970)
@@ -3396,7 +3396,7 @@
         mainFrame->document()->setReferrerPolicy(frame->document()->referrerPolicy());
     }
 
-    NavigationAction newAction { *frame->document(), request, InitiatedByMainFrame::Unknown, NavigationType::Other, action.shouldOpenExternalURLsPolicy() };
+    NavigationAction newAction { *frame->document(), request, InitiatedByMainFrame::Unknown, NavigationType::Other, action.shouldOpenExternalURLsPolicy(), nullptr, action.downloadAttribute() };
     mainFrame->loader().loadWithNavigationAction(request, WTFMove(newAction), LockHistory::No, FrameLoadType::Standard, formState, allowNavigationToInvalidURL);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to