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

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

Issue 1371323003: Escape "--" in the page URL at page serialization (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2015-09-30T19:11:33 Follow review comments Created 5 years, 2 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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 WebVector<WebURL> resultFrameURLs(frameKURLs.size()); 260 WebVector<WebURL> resultFrameURLs(frameKURLs.size());
261 for (size_t i = 0; i < frameKURLs.size(); ++i) 261 for (size_t i = 0; i < frameKURLs.size(); ++i)
262 resultFrameURLs[i] = frameKURLs[i]; 262 resultFrameURLs[i] = frameKURLs[i];
263 *frameURLs = resultFrameURLs; 263 *frameURLs = resultFrameURLs;
264 264
265 return true; 265 return true;
266 } 266 }
267 267
268 WebString WebPageSerializer::generateMetaCharsetDeclaration(const WebString& cha rset) 268 WebString WebPageSerializer::generateMetaCharsetDeclaration(const WebString& cha rset)
269 { 269 {
270 // TODO(yosin) We should call |PageSerializer::metaCharsetDeclarationOf()|.
270 String charsetString = "<meta http-equiv=\"Content-Type\" content=\"text/htm l; charset=" + static_cast<const String&>(charset) + "\">"; 271 String charsetString = "<meta http-equiv=\"Content-Type\" content=\"text/htm l; charset=" + static_cast<const String&>(charset) + "\">";
271 return charsetString; 272 return charsetString;
272 } 273 }
273 274
274 WebString WebPageSerializer::generateMarkOfTheWebDeclaration(const WebURL& url) 275 WebString WebPageSerializer::generateMarkOfTheWebDeclaration(const WebURL& url)
275 { 276 {
276 return String::format("\n<!-- saved from url=(%04d)%s -->\n", 277 StringBuilder builder;
277 static_cast<int>(url.spec().length()), 278 builder.append("\n<!-- ");
278 url.spec().data()); 279 builder.append(PageSerializer::markOfTheWebDeclaration(url));
280 builder.append(" -->\n");
281 return builder.toString();
279 } 282 }
280 283
281 WebString WebPageSerializer::generateBaseTagDeclaration(const WebString& baseTar get) 284 WebString WebPageSerializer::generateBaseTagDeclaration(const WebString& baseTar get)
282 { 285 {
286 // TODO(yosin) We should call |PageSerializer::baseTagDeclarationOf()|.
283 if (baseTarget.isEmpty()) 287 if (baseTarget.isEmpty())
284 return String("<base href=\".\">"); 288 return String("<base href=\".\">");
285 String baseString = "<base href=\".\" target=\"" + static_cast<const String& >(baseTarget) + "\">"; 289 String baseString = "<base href=\".\" target=\"" + static_cast<const String& >(baseTarget) + "\">";
286 return baseString; 290 return baseString;
287 } 291 }
288 292
289 } // namespace blink 293 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/page/PageSerializer.cpp ('k') | third_party/WebKit/Source/web/tests/PageSerializerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698