Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: Source/core/html/HTMLAnchorElement.cpp

Issue 197033005: Ignore suggested download filename for cross origin links. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Revive Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/http/tests/security/anchor-download-block-crossorigin-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Simon Hausmann <hausmann@kde.org> 4 * (C) 2000 Simon Hausmann <hausmann@kde.org>
5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
6 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 ResourceRequest request(completedURL); 387 ResourceRequest request(completedURL);
388 if (prefetchEventHandler()->hasIssuedPreconnect()) 388 if (prefetchEventHandler()->hasIssuedPreconnect())
389 frame->loader().client()->dispatchWillRequestAfterPreconnect(request); 389 frame->loader().client()->dispatchWillRequestAfterPreconnect(request);
390 if (hasAttribute(downloadAttr)) { 390 if (hasAttribute(downloadAttr)) {
391 if (!hasRel(RelationNoReferrer)) { 391 if (!hasRel(RelationNoReferrer)) {
392 String referrer = SecurityPolicy::generateReferrerHeader(document(). referrerPolicy(), completedURL, document().outgoingReferrer()); 392 String referrer = SecurityPolicy::generateReferrerHeader(document(). referrerPolicy(), completedURL, document().outgoingReferrer());
393 if (!referrer.isEmpty()) 393 if (!referrer.isEmpty())
394 request.setHTTPReferrer(Referrer(referrer, document().referrerPo licy())); 394 request.setHTTPReferrer(Referrer(referrer, document().referrerPo licy()));
395 } 395 }
396 396
397 frame->loader().client()->loadURLExternally(request, NavigationPolicyDow nload, fastGetAttribute(downloadAttr)); 397 bool isSameOrigin = document().securityOrigin()->canRequest(completedURL );
398 const AtomicString& suggestedName = (isSameOrigin ? fastGetAttribute(dow nloadAttr) : nullAtom);
399
400 frame->loader().client()->loadURLExternally(request, NavigationPolicyDow nload, suggestedName);
398 } else { 401 } else {
399 FrameLoadRequest frameRequest(&document(), request, target()); 402 FrameLoadRequest frameRequest(&document(), request, target());
400 frameRequest.setTriggeringEvent(event); 403 frameRequest.setTriggeringEvent(event);
401 if (hasRel(RelationNoReferrer)) 404 if (hasRel(RelationNoReferrer))
402 frameRequest.setShouldSendReferrer(NeverSendReferrer); 405 frameRequest.setShouldSendReferrer(NeverSendReferrer);
403 frame->loader().load(frameRequest); 406 frame->loader().load(frameRequest);
404 } 407 }
405 } 408 }
406 409
407 bool isEnterKeyKeydownEvent(Event* event) 410 bool isEnterKeyKeydownEvent(Event* event)
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 preconnectToURL(url, motivation); 588 preconnectToURL(url, motivation);
586 m_hasIssuedPreconnect = true; 589 m_hasIssuedPreconnect = true;
587 } 590 }
588 591
589 bool HTMLAnchorElement::isInteractiveContent() const 592 bool HTMLAnchorElement::isInteractiveContent() const
590 { 593 {
591 return isLink(); 594 return isLink();
592 } 595 }
593 596
594 } 597 }
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/security/anchor-download-block-crossorigin-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698