WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-162788-20160930103123.patch (text/plain), 9.45 KB, created by
Chris Dumez
on 2016-09-30 10:34:27 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2016-09-30 10:34:27 PDT
Size:
9.45 KB
patch
obsolete
>Subversion Revision: 206635 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 5334b7bfc149ef4fa9263a81d3496ac51fc6b84b..f8cd81cd9247fb24e5ad86a7e2f2d32acfd1a598 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,24 @@ >+2016-09-30 Chris Dumez <cdumez@apple.com> >+ >+ FileSaver.js does not work in WebKit >+ https://bugs.webkit.org/show_bug.cgi?id=162788 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ FileSaver.js does not work in WebKit: >+ - https://eligrey.com/demos/FileSaver.js/ >+ >+ It works in Firefox and Chrome, but in WebKit, we were getting a >+ "Synthetic clicks on anchors that have a download attribute are >+ ignored." warning. We were too strict in restricting synthetic clicks. >+ We now allow synthetic clicks as long as they are triggered by a user >+ gesture. >+ >+ Test: fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html >+ >+ * html/HTMLAnchorElement.cpp: >+ (WebCore::HTMLAnchorElement::handleClick): >+ > 2016-09-30 Said Abou-Hallawa <sabouhallawa@apple.com> > > Change the MemoryCache and CachedResource adjustSize functions to take a long argument >diff --git a/Source/WebCore/html/HTMLAnchorElement.cpp b/Source/WebCore/html/HTMLAnchorElement.cpp >index 4329e16264030be5a046babbbce5b566d5cfbe60..253d35c488ef71bcd7063273654c7665a76190c3 100644 >--- a/Source/WebCore/html/HTMLAnchorElement.cpp >+++ b/Source/WebCore/html/HTMLAnchorElement.cpp >@@ -44,6 +44,7 @@ > #include "ResourceRequest.h" > #include "RuntimeEnabledFeatures.h" > #include "SVGImage.h" >+#include "ScriptController.h" > #include "SecurityOrigin.h" > #include "SecurityPolicy.h" > #include "Settings.h" >@@ -380,9 +381,9 @@ void HTMLAnchorElement::handleClick(Event& event) > // If the a element has a download attribute and the algorithm is not triggered by user activation > // then abort these steps. > // https://html.spec.whatwg.org/#the-a-element:triggered-by-user-activation >- if (!downloadAttribute.isNull() && !event.isTrusted()) { >+ if (!downloadAttribute.isNull() && !event.isTrusted() && !ScriptController::processingUserGesture()) { > // The specification says to throw an InvalidAccessError but other browsers do not. >- document().addConsoleMessage(MessageSource::Security, MessageLevel::Warning, "Synthetic clicks on anchors that have a download attribute are ignored."); >+ document().addConsoleMessage(MessageSource::Security, MessageLevel::Warning, "Non user-triggered activations of anchors that have a download attribute are ignored."); > return; > } > } >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 042c9b05d1ae81b004b974a9d3bf6ac66e1ce66f..bfeda30d59938742f51c056b6c6e6753fc0355c8 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,16 @@ >+2016-09-30 Chris Dumez <cdumez@apple.com> >+ >+ FileSaver.js does not work in WebKit >+ https://bugs.webkit.org/show_bug.cgi?id=162788 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add layout test coverage. >+ >+ * fast/dom/HTMLAnchorElement/anchor-download-synthetic-click-expected.txt: >+ * fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click-expected.txt: Added. >+ * fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html: Added. >+ > 2016-09-30 Said Abou-Hallawa <sabouhallawa@apple.com> > > Change the MemoryCache and CachedResource adjustSize functions to take a long argument >diff --git a/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download-synthetic-click-expected.txt b/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download-synthetic-click-expected.txt >index d649a2436cba334aafe5649031a6224cdd9786ed..12a6512785268f1d4134f40ce8c59c0c438d2dfe 100644 >--- a/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download-synthetic-click-expected.txt >+++ b/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download-synthetic-click-expected.txt >@@ -1,4 +1,4 @@ >-CONSOLE MESSAGE: line 22: Synthetic clicks on anchors that have a download attribute are ignored. >+CONSOLE MESSAGE: line 22: Non user-triggered activations of anchors that have a download attribute are ignored. > Test that synthetic clicks on an anchor with a download attribute are ignored. > > This test passes if you do not see any 'Download started' message above. >diff --git a/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click-expected.txt b/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..e442e7bd68269f26df457b3bead34d5fc120353a >--- /dev/null >+++ b/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click-expected.txt >@@ -0,0 +1,8 @@ >+Download started. >+Downloading URL with suggested filename "unknown" >+Download completed. >+Test that user triggered synthetic clicks on an anchor with a download attribute are not ignored. >+ >+This test passes if you see a 'Download started' message above. >+ >+ >diff --git a/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html b/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html >new file mode 100644 >index 0000000000000000000000000000000000000000..1cf5419d52b2354f92de8fc3290577c33425856b >--- /dev/null >+++ b/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html >@@ -0,0 +1,46 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script type='text/javascript'> >+if (window.testRunner) { >+ testRunner.dumpAsText(); >+ testRunner.waitUntilDone(); >+} >+</script> >+</head> >+<body> >+<p>Test that user triggered synthetic clicks on an anchor with a download attribute are not ignored.</p> >+<p> This test passes if you see a 'Download started' message above.</p> >+<a style="display:none" id="blob-url" download>Blob URL</a> >+<input type="button" id="testButton" value="Download"> >+<script> >+function userClick(element) >+{ >+ if (!window.eventSender) { >+ alert('Click the button to run the test.'); >+ return; >+ } >+ eventSender.mouseMoveTo(element.offsetLeft + 5, element.offsetTop + 5); >+ eventSender.mouseDown(); >+ eventSender.mouseUp(); >+} >+ >+function runTest() >+{ >+ var string = "test"; >+ var blob = new Blob([string], {type: "text/html"}); >+ var link = document.getElementById("blob-url"); >+ link.href = window.URL.createObjectURL(blob); >+ var button = document.getElementById("testButton"); >+ button.onclick = function() { >+ link.click(); >+ } >+ userClick(button); >+ setTimeout(function() { >+ testRunner.notifyDone(); >+ }, 100); >+} >+runTest(); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/platform/ios-simulator-wk1/TestExpectations b/LayoutTests/platform/ios-simulator-wk1/TestExpectations >index c94b1a4231422a3d8d90799a3ecca2a44b87d640..770c7b9ad04d9606c8c8e7044d3f7e45bec306ac 100644 >--- a/LayoutTests/platform/ios-simulator-wk1/TestExpectations >+++ b/LayoutTests/platform/ios-simulator-wk1/TestExpectations >@@ -1314,6 +1314,7 @@ webkit.org/b/155495 compositing/visible-rect/animated-from-none.html [ Failure P > > # <a download> is not supported in WK1 yet. > 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 http/tests/download/area-download.html [ Skip ] > webkit.org/b/156069 http/tests/security/anchor-download-allow-blob.html [ Skip ] > webkit.org/b/156069 http/tests/security/anchor-download-allow-data.html [ Skip ] >diff --git a/LayoutTests/platform/mac-wk1/TestExpectations b/LayoutTests/platform/mac-wk1/TestExpectations >index 147f0f45b0d935d6d0d6ff0f0d2860ee47f3e3e1..763845111901824f23fa9b11fdc1c5be938c6708 100644 >--- a/LayoutTests/platform/mac-wk1/TestExpectations >+++ b/LayoutTests/platform/mac-wk1/TestExpectations >@@ -191,6 +191,7 @@ webkit.org/b/156084 accessibility/mac/video-tag-hit-test.html [ Skip ] > webkit.org/b/156069 fast/dom/HTMLAnchorElement/anchor-nodownload-set.html [ Failure ] > webkit.org/b/156069 fast/dom/HTMLAnchorElement/anchor-download.html [ Failure ] > 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 http/tests/download/area-download.html [ Skip ] > webkit.org/b/156069 http/tests/security/anchor-download-allow-blob.html [ Skip ] > webkit.org/b/156069 http/tests/security/anchor-download-allow-data.html [ Skip ] >diff --git a/LayoutTests/platform/win/TestExpectations b/LayoutTests/platform/win/TestExpectations >index e4e6f1b6b4d30f9343f78e58054146db34b43cc6..9c7c905b8b2145219f1a13642de7ed547e509be8 100644 >--- a/LayoutTests/platform/win/TestExpectations >+++ b/LayoutTests/platform/win/TestExpectations >@@ -442,6 +442,8 @@ fast/dom/HTMLAnchorElement/anchor-nodownload.html [ Skip ] > fast/dom/HTMLAnchorElement/anchor-download.html [ Skip ] > fast/dom/HTMLAnchorElement/anchor-nodownload-set.html [ Skip ] > fast/dom/HTMLAnchorElement/anchor-download-unset.html [ Skip ] >+fast/dom/HTMLAnchorElement/anchor-download-synthetic-click.html [ Skip ] >+fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html [ Skip ] > http/tests/download/area-download.html [ Skip ] > http/tests/security/anchor-download-allow-data.html [ Skip ] > http/tests/security/anchor-download-allow-sameorigin.html [ Skip ]
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 162788
:
290345
|
290346
|
290354
|
290372