Changeset 206562 in webkit


Ignore:
Timestamp:
Sep 28, 2016 4:51:04 PM (8 years ago)
Author:
Chris Dumez
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:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r206561 r206562  
     12016-09-28  Chris Dumez  <cdumez@apple.com>
     2
     3        Log console messages when the anchor download attribute is ignored
     4        https://bugs.webkit.org/show_bug.cgi?id=162703
     5
     6        Reviewed by Alex Christensen.
     7
     8        Log console messages when the anchor download attribute is ignored so
     9        that the developer can better understand what's happening.
     10
     11        * fast/dom/HTMLAnchorElement/anchor-download-synthetic-click-expected.txt:
     12        * http/tests/security/anchor-download-block-crossorigin-expected.txt:
     13
    1142016-09-28  Chris Dumez  <cdumez@apple.com>
    215
  • trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download-synthetic-click-expected.txt

    r206356 r206562  
     1CONSOLE MESSAGE: line 22: Synthetic clicks on anchors that have a download attribute are ignored.
    12Test that synthetic clicks on an anchor with a download attribute are ignored.
    23
  • trunk/LayoutTests/http/tests/security/anchor-download-block-crossorigin-expected.txt

    r206478 r206562  
     1CONSOLE MESSAGE: line 24: The download attribute on anchor was ignored because its href URL has a different security origin.
    12PASS
  • trunk/Source/WebCore/ChangeLog

    r206561 r206562  
     12016-09-28  Chris Dumez  <cdumez@apple.com>
     2
     3        Log console messages when the anchor download attribute is ignored
     4        https://bugs.webkit.org/show_bug.cgi?id=162703
     5
     6        Reviewed by Alex Christensen.
     7
     8        Log console messages when the anchor download attribute is ignored so
     9        that the developer can better understand what's happening.
     10
     11        No new tests, rebaselined existing tests.
     12
     13        * html/HTMLAnchorElement.cpp:
     14        (WebCore::HTMLAnchorElement::handleClick):
     15
    1162016-09-28  Chris Dumez  <cdumez@apple.com>
    217
  • trunk/Source/WebCore/html/HTMLAnchorElement.cpp

    r206561 r206562  
    376376        if (isSameOrigin)
    377377            downloadAttribute = attributeWithoutSynchronization(downloadAttr);
     378        else if (hasAttributeWithoutSynchronization(downloadAttr))
     379            document().addConsoleMessage(MessageSource::Security, MessageLevel::Warning, "The download attribute on anchor was ignored because its href URL has a different security origin.");
    378380        // If the a element has a download attribute and the algorithm is not triggered by user activation
    379381        // then abort these steps.
    380382        // https://html.spec.whatwg.org/#the-a-element:triggered-by-user-activation
    381         if (!downloadAttribute.isNull() && !event.isTrusted())
     383        if (!downloadAttribute.isNull() && !event.isTrusted()) {
     384            // The specification says to throw an InvalidAccessError but other browsers do not.
     385            document().addConsoleMessage(MessageSource::Security, MessageLevel::Warning, "Synthetic clicks on anchors that have a download attribute are ignored.");
    382386            return;
     387        }
    383388    }
    384389#endif
Note: See TracChangeset for help on using the changeset viewer.