diff options
author | Ben Murdoch <benm@google.com> | 2010-12-02 15:10:50 +0000 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-12-02 15:25:34 +0000 |
commit | 08b7b3c68ddad8c6ad95eb01db4be376fefcd1d7 (patch) | |
tree | 9e40e898352f397968d709069f15616106c3fce1 /WebKit/android/jni/WebSettings.cpp | |
parent | 0dea64c9575802352241ad43b78e20198a6e137c (diff) | |
download | external_webkit-08b7b3c68ddad8c6ad95eb01db4be376fefcd1d7.zip external_webkit-08b7b3c68ddad8c6ad95eb01db4be376fefcd1d7.tar.gz external_webkit-08b7b3c68ddad8c6ad95eb01db4be376fefcd1d7.tar.bz2 |
Fix crash when syncing autofill settings.
Since we moved the autofill initiation code out of the constructor
and into it's own method, we may crash if there is an autofill profile
set but the feature is turned off (i.e. the user had it on at one point
and had a profile set up but turned it off without deleting the
profile). That's because in this case we execute setAutoFillProfile()
in WebSettings without having first called the new init method. It makes
sense to not sync any profiles though when the feature is not enabled,
so add that check.
Change-Id: I9d99e96347770e5b08c982513f2370cb770cbe94
Diffstat (limited to 'WebKit/android/jni/WebSettings.cpp')
-rw-r--r-- | WebKit/android/jni/WebSettings.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/WebKit/android/jni/WebSettings.cpp b/WebKit/android/jni/WebSettings.cpp index 6b40b65..75f42b3 100644 --- a/WebKit/android/jni/WebSettings.cpp +++ b/WebKit/android/jni/WebSettings.cpp @@ -514,15 +514,17 @@ public: if (!oldAutoFillSetting && flag) webAutoFill->searchDocument(pFrame); - // Set the active AutoFillProfile data. - jobject autoFillProfile = env->GetObjectField(obj, gFieldIds->mAutoFillProfile); - if (autoFillProfile) - syncAutoFillProfile(env, autoFillProfile, webAutoFill); - else { - // The autofill profile is null. We need to tell Chromium about this because - // this may be because the user just deleted their profile but left the - // autofill feature setting enabled. - webAutoFill->clearProfiles(); + if (flag) { + // Set the active AutoFillProfile data. + jobject autoFillProfile = env->GetObjectField(obj, gFieldIds->mAutoFillProfile); + if (autoFillProfile) + syncAutoFillProfile(env, autoFillProfile, webAutoFill); + else { + // The autofill profile is null. We need to tell Chromium about this because + // this may be because the user just deleted their profile but left the + // autofill feature setting enabled. + webAutoFill->clearProfiles(); + } } #endif } |