| Index: chrome/renderer/safe_browsing/phishing_dom_feature_extractor.cc
|
| diff --git a/chrome/renderer/safe_browsing/phishing_dom_feature_extractor.cc b/chrome/renderer/safe_browsing/phishing_dom_feature_extractor.cc
|
| index c0ffb7568826432ab2f93a28abe9076121bcdd5d..c785a863b39a503a774cc5de267edc0b578a39b6 100644
|
| --- a/chrome/renderer/safe_browsing/phishing_dom_feature_extractor.cc
|
| +++ b/chrome/renderer/safe_browsing/phishing_dom_feature_extractor.cc
|
| @@ -18,8 +18,8 @@
|
| #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
|
| #include "third_party/WebKit/public/platform/WebString.h"
|
| #include "third_party/WebKit/public/web/WebElement.h"
|
| +#include "third_party/WebKit/public/web/WebElementCollection.h"
|
| #include "third_party/WebKit/public/web/WebFrame.h"
|
| -#include "third_party/WebKit/public/web/WebNodeCollection.h"
|
| #include "third_party/WebKit/public/web/WebView.h"
|
|
|
| namespace safe_browsing {
|
| @@ -92,7 +92,7 @@ struct PhishingDOMFeatureExtractor::PageFeatureState {
|
| struct PhishingDOMFeatureExtractor::FrameData {
|
| // This is our reference to document.all, which is an iterator over all
|
| // of the elements in the document. It keeps track of our current position.
|
| - blink::WebNodeCollection elements;
|
| + blink::WebElementCollection elements;
|
| // The domain of the document URL, stored here so that we don't need to
|
| // recompute it every time it's needed.
|
| std::string domain;
|
| @@ -158,10 +158,11 @@ void PhishingDOMFeatureExtractor::ExtractFeaturesWithTimeout() {
|
|
|
| int num_elements = 0;
|
| for (; !cur_document_.isNull(); cur_document_ = GetNextDocument()) {
|
| - blink::WebNode cur_node;
|
| + blink::WebElement cur_element;
|
| if (cur_frame_data_.get()) {
|
| - // We're resuming traversal of a frame, so just advance to the next node.
|
| - cur_node = cur_frame_data_->elements.nextItem();
|
| + // We're resuming traversal of a frame, so just advance to the next
|
| + // element.
|
| + cur_element = cur_frame_data_->elements.nextItem();
|
| // When we resume the traversal, the first call to nextItem() potentially
|
| // has to walk through the document again from the beginning, if it was
|
| // modified between our chunks of work. Log how long this takes, so we
|
| @@ -172,25 +173,21 @@ void PhishingDOMFeatureExtractor::ExtractFeaturesWithTimeout() {
|
| // We just moved to a new frame, so update our frame state
|
| // and advance to the first element.
|
| ResetFrameData();
|
| - cur_node = cur_frame_data_->elements.firstItem();
|
| + cur_element = cur_frame_data_->elements.firstItem();
|
| }
|
|
|
| - for (; !cur_node.isNull();
|
| - cur_node = cur_frame_data_->elements.nextItem()) {
|
| - if (!cur_node.isElementNode()) {
|
| - continue;
|
| - }
|
| - blink::WebElement element = cur_node.to<blink::WebElement>();
|
| - if (element.hasTagName("a")) {
|
| - HandleLink(element);
|
| - } else if (element.hasTagName("form")) {
|
| - HandleForm(element);
|
| - } else if (element.hasTagName("img")) {
|
| - HandleImage(element);
|
| - } else if (element.hasTagName("input")) {
|
| - HandleInput(element);
|
| - } else if (element.hasTagName("script")) {
|
| - HandleScript(element);
|
| + for (; !cur_element.isNull();
|
| + cur_element = cur_frame_data_->elements.nextItem()) {
|
| + if (cur_element.hasTagName("a")) {
|
| + HandleLink(cur_element);
|
| + } else if (cur_element.hasTagName("form")) {
|
| + HandleForm(cur_element);
|
| + } else if (cur_element.hasTagName("img")) {
|
| + HandleImage(cur_element);
|
| + } else if (cur_element.hasTagName("input")) {
|
| + HandleInput(cur_element);
|
| + } else if (cur_element.hasTagName("script")) {
|
| + HandleScript(cur_element);
|
| }
|
|
|
| if (++num_elements >= kClockCheckGranularity) {
|
|
|