Refuse to render RSS as XML by treating the response as text/plain.  This is
somewhat unfortunate, but we need to do this until we have a built-in feed
previewer.

R=mal
BUG=21238

Review URL: http://codereview.chromium.org/201044

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25608 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/renderer_host/buffered_resource_handler.cc b/chrome/browser/renderer_host/buffered_resource_handler.cc
index cba1754..53e78097 100644
--- a/chrome/browser/renderer_host/buffered_resource_handler.cc
+++ b/chrome/browser/renderer_host/buffered_resource_handler.cc
@@ -178,6 +178,19 @@
     response_->response_head.mime_type.assign(mime_type);
   }
 
+  if (mime_type == "application/rss+xml" ||
+      mime_type == "application/atom+xml") {
+    // Sad face.  The server told us that they wanted us to treat the response
+    // as RSS or Atom.  Unfortunately, we don't have a built-in feed previewer
+    // like other browsers.  We can't just render the content as XML because
+    // web sites let third parties inject arbitrary script into their RSS
+    // feeds.  That leaves us with little choice but to practically ignore the
+    // response.  In the future, when we have an RSS feed previewer, we can
+    // remove this logic.
+    mime_type.assign("text/plain");
+    response_->response_head.mime_type.assign(mime_type);
+  }
+
   if (ShouldBuffer(request_->url(), mime_type)) {
     // This is a temporary fix for the fact that webkit expects to have
     // enough data to decode the doctype in order to select the rendering