OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/child/site_isolation_policy.h" | 5 #include "content/child/site_isolation_policy.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 HistogramCountBlockedResponse(bucket_prefix, resp_data, false); | 283 HistogramCountBlockedResponse(bucket_prefix, resp_data, false); |
284 } else if (resp_data->no_sniff) { | 284 } else if (resp_data->no_sniff) { |
285 is_blocked = true; | 285 is_blocked = true; |
286 HistogramCountBlockedResponse("SiteIsolation.XSD.Plain", resp_data, true); | 286 HistogramCountBlockedResponse("SiteIsolation.XSD.Plain", resp_data, true); |
287 } else { | 287 } else { |
288 HistogramCountNotBlockedResponse("SiteIsolation.XSD.Plain", | 288 HistogramCountNotBlockedResponse("SiteIsolation.XSD.Plain", |
289 sniffed_as_js); | 289 sniffed_as_js); |
290 } | 290 } |
291 } | 291 } |
292 | 292 |
293 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 293 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
294 switches::kBlockCrossSiteDocuments)) | 294 switches::kBlockCrossSiteDocuments)) |
295 is_blocked = false; | 295 is_blocked = false; |
296 | 296 |
297 if (is_blocked) { | 297 if (is_blocked) { |
298 alternative_data->erase(); | 298 alternative_data->erase(); |
299 alternative_data->insert(0, " "); | 299 alternative_data->insert(0, " "); |
300 LOG(ERROR) << resp_data->response_url | 300 LOG(ERROR) << resp_data->response_url |
301 << " is blocked as an illegal cross-site document from " | 301 << " is blocked as an illegal cross-site document from " |
302 << resp_data->frame_origin; | 302 << resp_data->frame_origin; |
303 } | 303 } |
304 return is_blocked; | 304 return is_blocked; |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 // TODO(dsjang): This is a real hack. The only purpose of this function is to | 504 // TODO(dsjang): This is a real hack. The only purpose of this function is to |
505 // try to see if there's any possibility that this data can be JavaScript | 505 // try to see if there's any possibility that this data can be JavaScript |
506 // (superset of JS). This function will be removed once UMA stats are | 506 // (superset of JS). This function will be removed once UMA stats are |
507 // gathered. | 507 // gathered. |
508 | 508 |
509 // Search for "var " for JS detection. | 509 // Search for "var " for JS detection. |
510 return data.find("var ") != base::StringPiece::npos; | 510 return data.find("var ") != base::StringPiece::npos; |
511 } | 511 } |
512 | 512 |
513 } // namespace content | 513 } // namespace content |
OLD | NEW |