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

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: 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
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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 bool MHTMLFrameSerializerDelegate::ShouldIgnoreAttribute( 176 bool MHTMLFrameSerializerDelegate::ShouldIgnoreAttribute(
177 const Element& element, 177 const Element& element,
178 const Attribute& attribute) { 178 const Attribute& attribute) {
179 // TODO(fgorski): Presence of srcset attribute causes MHTML to not display 179 // TODO(fgorski): Presence of srcset attribute causes MHTML to not display
180 // images, as only the value of src is pulled into the archive. Discarding 180 // images, as only the value of src is pulled into the archive. Discarding
181 // srcset prevents the problem. Long term we should make sure to MHTML plays 181 // srcset prevents the problem. Long term we should make sure to MHTML plays
182 // nicely with srcset. 182 // nicely with srcset.
183 if (attribute.LocalName() == HTMLNames::srcsetAttr) 183 if (attribute.LocalName() == HTMLNames::srcsetAttr)
184 return true; 184 return true;
185 185
186 // Do not save ping attribute since anyway the ping will be blocked from
187 // MHTML.
188 if (isHTMLAnchorElement(element) &&
189 attribute.LocalName() == HTMLNames::pingAttr) {
190 return true;
191 }
192
186 // If srcdoc attribute for frame elements will be rewritten as src attribute 193 // If srcdoc attribute for frame elements will be rewritten as src attribute
187 // containing link instead of html contents, don't ignore the attribute. 194 // containing link instead of html contents, don't ignore the attribute.
188 // Bail out now to avoid the check in Element::isScriptingAttribute. 195 // Bail out now to avoid the check in Element::isScriptingAttribute.
189 bool is_src_doc_attribute = IsHTMLFrameElementBase(element) && 196 bool is_src_doc_attribute = IsHTMLFrameElementBase(element) &&
190 attribute.GetName() == HTMLNames::srcdocAttr; 197 attribute.GetName() == HTMLNames::srcdocAttr;
191 String new_link_for_the_element; 198 String new_link_for_the_element;
192 if (is_src_doc_attribute && RewriteLink(element, new_link_for_the_element)) 199 if (is_src_doc_attribute && RewriteLink(element, new_link_for_the_element))
193 return false; 200 return false;
194 201
195 // Do not include attributes that contain javascript. This is because the 202 // Do not include attributes that contain javascript. This is because the
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 const WebString& base_target) { 467 const WebString& base_target) {
461 // TODO(yosin) We should call |FrameSerializer::baseTagDeclarationOf()|. 468 // TODO(yosin) We should call |FrameSerializer::baseTagDeclarationOf()|.
462 if (base_target.IsEmpty()) 469 if (base_target.IsEmpty())
463 return String("<base href=\".\">"); 470 return String("<base href=\".\">");
464 String base_string = "<base href=\".\" target=\"" + 471 String base_string = "<base href=\".\" target=\"" +
465 static_cast<const String&>(base_target) + "\">"; 472 static_cast<const String&>(base_target) + "\">";
466 return base_string; 473 return base_string;
467 } 474 }
468 475
469 } // namespace blink 476 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698