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

Side by Side Diff: third_party/WebKit/Source/web/WebFrameSerializer.cpp

Issue 2848953003: Do not send pings for anchor elements in MHTML pages (Closed)
Patch Set: Rebase 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 bool MHTMLFrameSerializerDelegate::ShouldIgnoreAttribute( 188 bool MHTMLFrameSerializerDelegate::ShouldIgnoreAttribute(
189 const Element& element, 189 const Element& element,
190 const Attribute& attribute) { 190 const Attribute& attribute) {
191 // TODO(fgorski): Presence of srcset attribute causes MHTML to not display 191 // TODO(fgorski): Presence of srcset attribute causes MHTML to not display
192 // images, as only the value of src is pulled into the archive. Discarding 192 // images, as only the value of src is pulled into the archive. Discarding
193 // srcset prevents the problem. Long term we should make sure to MHTML plays 193 // srcset prevents the problem. Long term we should make sure to MHTML plays
194 // nicely with srcset. 194 // nicely with srcset.
195 if (attribute.LocalName() == HTMLNames::srcsetAttr) 195 if (attribute.LocalName() == HTMLNames::srcsetAttr)
196 return true; 196 return true;
197 197
198 // Do not save ping attribute since anyway the ping will be blocked from
199 // MHTML.
200 if (isHTMLAnchorElement(element) &&
201 attribute.LocalName() == HTMLNames::pingAttr) {
202 return true;
203 }
204
198 // If srcdoc attribute for frame elements will be rewritten as src attribute 205 // If srcdoc attribute for frame elements will be rewritten as src attribute
199 // containing link instead of html contents, don't ignore the attribute. 206 // containing link instead of html contents, don't ignore the attribute.
200 // Bail out now to avoid the check in Element::isScriptingAttribute. 207 // Bail out now to avoid the check in Element::isScriptingAttribute.
201 bool is_src_doc_attribute = IsHTMLFrameElementBase(element) && 208 bool is_src_doc_attribute = IsHTMLFrameElementBase(element) &&
202 attribute.GetName() == HTMLNames::srcdocAttr; 209 attribute.GetName() == HTMLNames::srcdocAttr;
203 String new_link_for_the_element; 210 String new_link_for_the_element;
204 if (is_src_doc_attribute && RewriteLink(element, new_link_for_the_element)) 211 if (is_src_doc_attribute && RewriteLink(element, new_link_for_the_element))
205 return false; 212 return false;
206 213
207 // Do not include attributes that contain javascript. This is because the 214 // Do not include attributes that contain javascript. This is because the
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 const WebString& base_target) { 479 const WebString& base_target) {
473 // TODO(yosin) We should call |FrameSerializer::baseTagDeclarationOf()|. 480 // TODO(yosin) We should call |FrameSerializer::baseTagDeclarationOf()|.
474 if (base_target.IsEmpty()) 481 if (base_target.IsEmpty())
475 return String("<base href=\".\">"); 482 return String("<base href=\".\">");
476 String base_string = "<base href=\".\" target=\"" + 483 String base_string = "<base href=\".\" target=\"" +
477 static_cast<const String&>(base_target) + "\">"; 484 static_cast<const String&>(base_target) + "\">";
478 return base_string; 485 return base_string;
479 } 486 }
480 487
481 } // namespace blink 488 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698