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

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

Issue 2848953003: Do not send pings for anchor elements in MHTML pages (Closed)
Patch Set: Add new file Created 3 years, 7 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/WebFrameSerializer.cpp » ('j') | 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 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
6 * reserved. 6 * reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 19 matching lines...) Expand all
30 #include "core/frame/LocalFrameClient.h" 30 #include "core/frame/LocalFrameClient.h"
31 #include "core/frame/Settings.h" 31 #include "core/frame/Settings.h"
32 #include "core/frame/UseCounter.h" 32 #include "core/frame/UseCounter.h"
33 #include "core/html/HTMLImageElement.h" 33 #include "core/html/HTMLImageElement.h"
34 #include "core/html/parser/HTMLParserIdioms.h" 34 #include "core/html/parser/HTMLParserIdioms.h"
35 #include "core/layout/LayoutBox.h" 35 #include "core/layout/LayoutBox.h"
36 #include "core/loader/FrameLoadRequest.h" 36 #include "core/loader/FrameLoadRequest.h"
37 #include "core/loader/PingLoader.h" 37 #include "core/loader/PingLoader.h"
38 #include "core/page/ChromeClient.h" 38 #include "core/page/ChromeClient.h"
39 #include "core/page/Page.h" 39 #include "core/page/Page.h"
40 #include "platform/loader/fetch/ResourceFetcher.h"
40 #include "platform/network/NetworkHints.h" 41 #include "platform/network/NetworkHints.h"
41 #include "platform/weborigin/SecurityPolicy.h" 42 #include "platform/weborigin/SecurityPolicy.h"
42 43
43 namespace blink { 44 namespace blink {
44 45
45 using namespace HTMLNames; 46 using namespace HTMLNames;
46 47
47 HTMLAnchorElement::HTMLAnchorElement(const QualifiedName& tag_name, 48 HTMLAnchorElement::HTMLAnchorElement(const QualifiedName& tag_name,
48 Document& document) 49 Document& document)
49 : HTMLElement(tag_name, document), 50 : HTMLElement(tag_name, document),
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 bool HTMLAnchorElement::IsLiveLink() const { 299 bool HTMLAnchorElement::IsLiveLink() const {
299 return IsLink() && !HasEditableStyle(*this); 300 return IsLink() && !HasEditableStyle(*this);
300 } 301 }
301 302
302 void HTMLAnchorElement::SendPings(const KURL& destination_url) const { 303 void HTMLAnchorElement::SendPings(const KURL& destination_url) const {
303 const AtomicString& ping_value = getAttribute(pingAttr); 304 const AtomicString& ping_value = getAttribute(pingAttr);
304 if (ping_value.IsNull() || !GetDocument().GetSettings() || 305 if (ping_value.IsNull() || !GetDocument().GetSettings() ||
305 !GetDocument().GetSettings()->GetHyperlinkAuditingEnabled()) 306 !GetDocument().GetSettings()->GetHyperlinkAuditingEnabled())
306 return; 307 return;
307 308
309 // Pings should not be sent if MHTML page is loaded.
310 if (GetDocument().Fetcher()->Archive())
311 return;
Mike West 2017/05/02 07:43:21 What about other things that go through `PingLoade
jianli 2017/05/03 21:15:17 I don't think other types of pings/beacons can be
312
308 UseCounter::Count(GetDocument(), UseCounter::kHTMLAnchorElementPingAttribute); 313 UseCounter::Count(GetDocument(), UseCounter::kHTMLAnchorElementPingAttribute);
309 314
310 SpaceSplitString ping_urls(ping_value, SpaceSplitString::kShouldNotFoldCase); 315 SpaceSplitString ping_urls(ping_value, SpaceSplitString::kShouldNotFoldCase);
311 for (unsigned i = 0; i < ping_urls.size(); i++) 316 for (unsigned i = 0; i < ping_urls.size(); i++)
312 PingLoader::SendLinkAuditPing(GetDocument().GetFrame(), 317 PingLoader::SendLinkAuditPing(GetDocument().GetFrame(),
313 GetDocument().CompleteURL(ping_urls[i]), 318 GetDocument().CompleteURL(ping_urls[i]),
314 destination_url); 319 destination_url);
315 } 320 }
316 321
317 void HTMLAnchorElement::HandleClick(Event* event) { 322 void HTMLAnchorElement::HandleClick(Event* event) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 406
402 Node::InsertionNotificationRequest HTMLAnchorElement::InsertedInto( 407 Node::InsertionNotificationRequest HTMLAnchorElement::InsertedInto(
403 ContainerNode* insertion_point) { 408 ContainerNode* insertion_point) {
404 InsertionNotificationRequest request = 409 InsertionNotificationRequest request =
405 HTMLElement::InsertedInto(insertion_point); 410 HTMLElement::InsertedInto(insertion_point);
406 LogAddElementIfIsolatedWorldAndInDocument("a", hrefAttr); 411 LogAddElementIfIsolatedWorldAndInDocument("a", hrefAttr);
407 return request; 412 return request;
408 } 413 }
409 414
410 } // namespace blink 415 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/WebFrameSerializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698