Title: [206562] trunk
Revision
206562
Author
[email protected]
Date
2016-09-28 16:51:04 -0700 (Wed, 28 Sep 2016)

Log Message

Log console messages when the anchor download attribute is ignored
https://bugs.webkit.org/show_bug.cgi?id=162703

Reviewed by Alex Christensen.

Log console messages when the anchor download attribute is ignored so
that the developer can better understand what's happening.

Source/WebCore:

No new tests, rebaselined existing tests.

* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::handleClick):

LayoutTests:

* fast/dom/HTMLAnchorElement/anchor-download-synthetic-click-expected.txt:
* http/tests/security/anchor-download-block-crossorigin-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (206561 => 206562)


--- trunk/LayoutTests/ChangeLog	2016-09-28 23:49:50 UTC (rev 206561)
+++ trunk/LayoutTests/ChangeLog	2016-09-28 23:51:04 UTC (rev 206562)
@@ -1,5 +1,18 @@
 2016-09-28  Chris Dumez  <[email protected]>
 
+        Log console messages when the anchor download attribute is ignored
+        https://bugs.webkit.org/show_bug.cgi?id=162703
+
+        Reviewed by Alex Christensen.
+
+        Log console messages when the anchor download attribute is ignored so
+        that the developer can better understand what's happening.
+
+        * fast/dom/HTMLAnchorElement/anchor-download-synthetic-click-expected.txt:
+        * http/tests/security/anchor-download-block-crossorigin-expected.txt:
+
+2016-09-28  Chris Dumez  <[email protected]>
+
         Add support for DOMTokenList.supports()
         https://bugs.webkit.org/show_bug.cgi?id=162659
 

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download-synthetic-click-expected.txt (206561 => 206562)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download-synthetic-click-expected.txt	2016-09-28 23:49:50 UTC (rev 206561)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download-synthetic-click-expected.txt	2016-09-28 23:51:04 UTC (rev 206562)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 22: Synthetic clicks on 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.

Modified: trunk/LayoutTests/http/tests/security/anchor-download-block-crossorigin-expected.txt (206561 => 206562)


--- trunk/LayoutTests/http/tests/security/anchor-download-block-crossorigin-expected.txt	2016-09-28 23:49:50 UTC (rev 206561)
+++ trunk/LayoutTests/http/tests/security/anchor-download-block-crossorigin-expected.txt	2016-09-28 23:51:04 UTC (rev 206562)
@@ -1 +1,2 @@
+CONSOLE MESSAGE: line 24: The download attribute on anchor was ignored because its href URL has a different security origin.
 PASS

Modified: trunk/Source/WebCore/ChangeLog (206561 => 206562)


--- trunk/Source/WebCore/ChangeLog	2016-09-28 23:49:50 UTC (rev 206561)
+++ trunk/Source/WebCore/ChangeLog	2016-09-28 23:51:04 UTC (rev 206562)
@@ -1,5 +1,20 @@
 2016-09-28  Chris Dumez  <[email protected]>
 
+        Log console messages when the anchor download attribute is ignored
+        https://bugs.webkit.org/show_bug.cgi?id=162703
+
+        Reviewed by Alex Christensen.
+
+        Log console messages when the anchor download attribute is ignored so
+        that the developer can better understand what's happening.
+
+        No new tests, rebaselined existing tests.
+
+        * html/HTMLAnchorElement.cpp:
+        (WebCore::HTMLAnchorElement::handleClick):
+
+2016-09-28  Chris Dumez  <[email protected]>
+
         Add support for DOMTokenList.supports()
         https://bugs.webkit.org/show_bug.cgi?id=162659
 

Modified: trunk/Source/WebCore/html/HTMLAnchorElement.cpp (206561 => 206562)


--- trunk/Source/WebCore/html/HTMLAnchorElement.cpp	2016-09-28 23:49:50 UTC (rev 206561)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.cpp	2016-09-28 23:51:04 UTC (rev 206562)
@@ -375,11 +375,16 @@
         bool isSameOrigin = completedURL.protocolIsData() || document().securityOrigin()->canRequest(completedURL);
         if (isSameOrigin)
             downloadAttribute = attributeWithoutSynchronization(downloadAttr);
+        else if (hasAttributeWithoutSynchronization(downloadAttr))
+            document().addConsoleMessage(MessageSource::Security, MessageLevel::Warning, "The download attribute on anchor was ignored because its href URL has a different security origin.");
         // 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()) {
+            // 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.");
             return;
+        }
     }
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to