OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/renderer/safe_browsing/phishing_dom_feature_extractor.h" | 5 #include "chrome/renderer/safe_browsing/phishing_dom_feature_extractor.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
383 cur_document_.Url(), | 383 cur_document_.Url(), |
384 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); | 384 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); |
385 } | 385 } |
386 | 386 |
387 blink::WebDocument PhishingDOMFeatureExtractor::GetNextDocument() { | 387 blink::WebDocument PhishingDOMFeatureExtractor::GetNextDocument() { |
388 DCHECK(!cur_document_.IsNull()); | 388 DCHECK(!cur_document_.IsNull()); |
389 blink::WebFrame* frame = cur_document_.GetFrame(); | 389 blink::WebFrame* frame = cur_document_.GetFrame(); |
390 // Advance to the next frame that contains a document, with no wrapping. | 390 // Advance to the next frame that contains a document, with no wrapping. |
391 if (frame) { | 391 if (frame) { |
392 for (frame = frame->TraverseNext(); frame; frame = frame->TraverseNext()) { | 392 for (frame = frame->TraverseNext(); frame; frame = frame->TraverseNext()) { |
393 if (!frame->GetDocument().IsNull()) { | 393 if (frame->IsWebLocalFrame() && |
394 return frame->GetDocument(); | 394 !frame->ToWebLocalFrame()->GetDocument().IsNull()) { |
395 return frame->ToWebLocalFrame()->GetDocument(); | |
Łukasz Anforowicz
2017/06/15 20:15:59
Skipping remote frames seems okay here?
dcheng
2017/06/15 23:17:00
Yeah. That being said, I'm quite skeptical of the
Łukasz Anforowicz
2017/06/16 19:39:24
Done.
| |
395 } | 396 } |
396 } | 397 } |
397 } else { | 398 } else { |
398 // Keep track of how often frame traversal got "stuck" due to the | 399 // Keep track of how often frame traversal got "stuck" due to the |
399 // current subdocument getting removed from the frame tree. | 400 // current subdocument getting removed from the frame tree. |
400 UMA_HISTOGRAM_COUNTS("SBClientPhishing.DOMFeatureFrameRemoved", 1); | 401 UMA_HISTOGRAM_COUNTS("SBClientPhishing.DOMFeatureFrameRemoved", 1); |
401 } | 402 } |
402 return blink::WebDocument(); | 403 return blink::WebDocument(); |
403 } | 404 } |
404 | 405 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
493 // Record number of script tags (discretized for numerical stability.) | 494 // Record number of script tags (discretized for numerical stability.) |
494 if (page_feature_state_->num_script_tags > 1) { | 495 if (page_feature_state_->num_script_tags > 1) { |
495 features_->AddBooleanFeature(features::kPageNumScriptTagsGTOne); | 496 features_->AddBooleanFeature(features::kPageNumScriptTagsGTOne); |
496 if (page_feature_state_->num_script_tags > 6) { | 497 if (page_feature_state_->num_script_tags > 6) { |
497 features_->AddBooleanFeature(features::kPageNumScriptTagsGTSix); | 498 features_->AddBooleanFeature(features::kPageNumScriptTagsGTSix); |
498 } | 499 } |
499 } | 500 } |
500 } | 501 } |
501 | 502 |
502 } // namespace safe_browsing | 503 } // namespace safe_browsing |
OLD | NEW |