diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-06 00:21:16 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-06 00:21:16 +0000 |
commit | 174e60eb98f71a970a1d443946b4adbdb265646a (patch) | |
tree | d868ef3274b21d4504739d60d78bc209cc8441ba /chrome/renderer | |
parent | 5db28bf1d91f1f1ff5f5bd570ca87976266ed471 (diff) | |
download | chromium_src-174e60eb98f71a970a1d443946b4adbdb265646a.zip chromium_src-174e60eb98f71a970a1d443946b4adbdb265646a.tar.gz chromium_src-174e60eb98f71a970a1d443946b4adbdb265646a.tar.bz2 |
AutoFill: Fix a renderer crash by resetting the form cache when each WebFrame
closes.
BUG=43353
TEST=none
Review URL: http://codereview.chromium.org/1980004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46529 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/form_manager.cc | 16 | ||||
-rw-r--r-- | chrome/renderer/form_manager.h | 6 | ||||
-rw-r--r-- | chrome/renderer/render_view.cc | 2 |
3 files changed, 13 insertions, 11 deletions
diff --git a/chrome/renderer/form_manager.cc b/chrome/renderer/form_manager.cc index ab9e9e7..e39c3b1 100644 --- a/chrome/renderer/form_manager.cc +++ b/chrome/renderer/form_manager.cc @@ -470,6 +470,14 @@ void FormManager::Reset() { form_elements_map_.clear(); } +void FormManager::ResetFrame(const WebFrame* frame) { + WebFrameFormElementMap::iterator iter = form_elements_map_.find(frame); + if (iter != form_elements_map_.end()) { + STLDeleteElements(&iter->second); + form_elements_map_.erase(iter); + } +} + // static bool FormManager::FormElementToFormData(const WebFrame* frame, const FormElement* form_element, @@ -515,14 +523,6 @@ bool FormManager::FormElementToFormData(const WebFrame* frame, return true; } -void FormManager::ResetFrame(const WebFrame* frame) { - WebFrameFormElementMap::iterator iter = form_elements_map_.find(frame); - if (iter != form_elements_map_.end()) { - STLDeleteElements(&iter->second); - form_elements_map_.erase(iter); - } -} - // static string16 FormManager::InferLabelForElement( const WebFormControlElement& element) { diff --git a/chrome/renderer/form_manager.h b/chrome/renderer/form_manager.h index c35d780..67d50a9 100644 --- a/chrome/renderer/form_manager.h +++ b/chrome/renderer/form_manager.h @@ -96,6 +96,9 @@ class FormManager { // Resets the stored set of forms. void Reset(); + // Resets the forms for the specified |frame|. + void ResetFrame(const WebKit::WebFrame* frame); + private: // Stores the WebFormElement and the form control elements for a form. struct FormElement { @@ -116,9 +119,6 @@ class FormManager { RequirementsMask requirements, webkit_glue::FormData* form); - // Resets the forms for the specified |frame|. - void ResetFrame(const WebKit::WebFrame* frame); - // Infers corresponding label for |element| from surrounding context in the // DOM. Contents of preceeding <p> tag or preceeding text element found in // the form. diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index d3c1744..804df48 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -2205,6 +2205,8 @@ void RenderView::willClose(WebFrame* frame) { WebDataSource* ds = frame->dataSource(); NavigationState* navigation_state = NavigationState::FromDataSource(ds); navigation_state->user_script_idle_scheduler()->Cancel(); + + form_manager_.ResetFrame(frame); } bool RenderView::allowPlugins(WebFrame* frame, bool enabled_per_settings) { |