Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Revert of Use language-specific street address line separators (https…
Browse files Browse the repository at this point in the history
…://codereview.chromium.org/397233002/)

Reason for revert:
Broke 'Chromium Linux on Linux Clang (dbg)':

http://build.chromium.org/p/chromium.linux/builders/Linux%20Clang%20%28dbg%29/builds/62289

AutofillDialogControllerTest.BillingVsShippingStreetAddress (run #1):
[ RUN      ] AutofillDialogControllerTest.BillingVsShippingStreetAddress
Xlib:  extension "RANDR" missing on display ":9".
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/debug/safe_iterator.h:289:
    error: attempt to advance a past-the-end iterator 1 steps, which falls
    outside its valid range.

Objects involved in the operation:
iterator @ 0x0x7fffd4a50d58 {
  state = past-the-end;
  references sequence @ 0x0x7fffd4a50d58
}
Received signal 6
#0 0x7f716d77ecee base::debug::StackTrace::StackTrace()
#1 0x7f716d77e827 base::debug::(anonymous namespace)::StackDumpSignalHandler()
#2 0x7f7168451cb0 \u003Cunknown>
#3 0x7f71648cf425 gsignal
#4 0x7f71648d2b8b abort
#5 0x7f7164ed25ad __gnu_debug::_Error_formatter::_M_error()
#6 0x0000026271ce __gnu_debug::_Safe_iterator\u003C>::operator+=()
#7 0x0000026270f5 __gnu_debug::_Safe_iterator\u003C>::operator+()
#8 0x000005506f39 i18n::addressinput::(anonymous namespace)::CombineLinesForLanguage()
#9 0x00000550703a i18n::addressinput::GetStreetAddressLinesAsSingleLine()
#10 0x000005548289 autofill::(anonymous namespace)::FillStreetAddress()
#11 0x000005547b91 autofill::AutofillField::FillFormField()
#12 0x0000055907cd autofill::FormStructure::FillFields()
#13 0x000004972335 autofill::AutofillDialogControllerImpl::Show()
#14 0x000001ec0f2a autofill::(anonymous namespace)::AutofillDialogControllerTest::SetUpControllerWithFormData()
#15 0x000001ece5c8 autofill::AutofillDialogControllerTest_BillingVsShippingStreetAddress_Test::TestBody()
#16 0x0000039fcc63 testing::internal::HandleSehExceptionsInMethodIfSupported\u003C>()
#17 0x0000039e9f9e testing::internal::HandleExceptionsInMethodIfSupported\u003C>()
#18 0x0000039e0e05 testing::Test::Run()
#19 0x0000039e151b testing::TestInfo::Run()
#20 0x0000039e1b0a testing::TestCase::Run()
#21 0x0000039e6118 testing::internal::UnitTestImpl::RunAllTests()
#22 0x0000039f5973 testing::internal::HandleSehExceptionsInMethodIfSupported\u003C>()
#23 0x0000039ebb0e testing::internal::HandleExceptionsInMethodIfSupported\u003C>()
#24 0x0000039e5da4 testing::UnitTest::Run()
#25 0x000005b72b61 RUN_ALL_TESTS()
#26 0x000005b71be7 base::TestSuite::Run()
#27 0x000005b8455d content::UnitTestTestSuite::Run()
#28 0x000003aa40d2 base::internal::RunnableAdapter\u003C>::Run()
#29 0x000003aa403c base::internal::InvokeHelper\u003C>::MakeItSo()
#30 0x000003aa3fea base::internal::Invoker\u003C>::Run()
#31 0x000002a29e9e base::Callback\u003C>::Run()
#32 0x000005b6b830 base::(anonymous namespace)::LaunchUnitTestsInternal()
#33 0x000005b6b527 base::LaunchUnitTests()
#34 0x000003aa3db5 main
#35 0x7f71648ba76d __libc_start_main
#36 0x000000715159 \u003Cunknown>
  r8: 00007f715f665980  r9: 00007fffd4a507d8 r10: 0000000000000008 r11: 0000000000000206
 r12: 00007fffd4a50aa0 r13: 0000000000000001 r14: 0000000000000001 r15: 0000000000000000
  di: 00000000000016b2  si: 00000000000016b2  bp: 0000000000000002  bx: 00007fffd4a50a30
  dx: 0000000000000006  ax: 0000000000000000  cx: ffffffffffffffff  sp: 00007fffd4a50828
  ip: 00007f71648cf425 efl: 0000000000000206 cgf: 0000000000000033 erf: 0000000000000000
 trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000


Original issue's description:
> Use language-specific street address line separators
> 
> Fill street address into a single-line text input field with separators
> that depend on the language code of the profile.
> 
> TEST=components_unittests:AutofillFieldTest.FillStreetAddress*
> BUG=270261
> 
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=284335

[email protected],[email protected]
NOTREECHECKS=true
NOTRY=true
BUG=270261

Review URL: https://codereview.chromium.org/401103004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284340 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
[email protected] committed Jul 19, 2014
1 parent 7e1a73c commit 4eef752
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 126 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,10 @@ void FillOutputForSectionWithComparator(
g_browser_process->GetApplicationLocale());

std::vector<ServerFieldType> types = common::TypesFromInputs(inputs);
form_structure.FillFields(
types,
compare,
get_info,
section == SECTION_CC_BILLING
? full_wallet->billing_address()->language_code()
: full_wallet->shipping_address()->language_code(),
g_browser_process->GetApplicationLocale());
form_structure.FillFields(types,
compare,
get_info,
g_browser_process->GetApplicationLocale());
}

void FillOutputForSection(
Expand Down Expand Up @@ -349,7 +345,6 @@ void AutofillDialogControllerAndroid::Show() {
common::TypesFromInputs(inputs),
base::Bind(common::ServerTypeMatchesField, SECTION_SHIPPING),
base::Bind(NullGetInfo),
std::string(),
g_browser_process->GetApplicationLocale());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,6 @@ void AutofillDialogControllerImpl::Show() {
RequestedTypesForSection(SECTION_SHIPPING),
base::Bind(common::ServerTypeMatchesField, SECTION_SHIPPING),
base::Bind(NullGetInfo),
std::string(),
g_browser_process->GetApplicationLocale());

transaction_amount_ = form_structure_.GetUniqueValue(
Expand Down
1 change: 0 additions & 1 deletion chrome/browser/ui/autofill/data_model_wrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ bool DataModelWrapper::FillFormStructure(
types,
compare,
base::Bind(&DataModelWrapper::GetInfo, base::Unretained(this)),
GetLanguageCode(),
g_browser_process->GetApplicationLocale());
}

Expand Down
20 changes: 5 additions & 15 deletions components/autofill/core/browser/autofill_field.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,8 @@
#include "components/autofill/core/browser/phone_number.h"
#include "components/autofill/core/browser/state_names.h"
#include "grit/components_strings.h"
#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_data.h"
#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_formatter.h"
#include "ui/base/l10n/l10n_util.h"

using ::i18n::addressinput::AddressData;
using ::i18n::addressinput::GetStreetAddressLinesAsSingleLine;
using base::ASCIIToUTF16;
using base::StringToInt;

Expand Down Expand Up @@ -358,23 +354,18 @@ bool FillMonthControl(const base::string16& value, FormFieldData* field) {
return true;
}

// Fills |field| with the street address in |value|. Translates newlines into
// Fills |field| with the street address in |value|. Translates newlines into
// equivalent separators when necessary, i.e. when filling a single-line field.
// The separators depend on |address_language_code|.
void FillStreetAddress(const base::string16& value,
const std::string& address_language_code,
FormFieldData* field) {
if (field->form_control_type == "textarea") {
field->value = value;
return;
}

AddressData address_data;
address_data.language_code = address_language_code;
base::SplitString(base::UTF16ToUTF8(value), '\n', &address_data.address_line);
std::string line;
GetStreetAddressLinesAsSingleLine(address_data, &line);
field->value = base::UTF8ToUTF16(line);
const base::string16& separator =
l10n_util::GetStringUTF16(IDS_AUTOFILL_ADDRESS_LINE_SEPARATOR);
base::ReplaceChars(value, base::ASCIIToUTF16("\n"), separator, &field->value);
}

std::string Hash32Bit(const std::string& str) {
Expand Down Expand Up @@ -471,7 +462,6 @@ bool AutofillField::IsFieldFillable() const {
// static
bool AutofillField::FillFormField(const AutofillField& field,
const base::string16& value,
const std::string& address_language_code,
const std::string& app_locale,
FormFieldData* field_data) {
AutofillType type = field.Type();
Expand All @@ -484,7 +474,7 @@ bool AutofillField::FillFormField(const AutofillField& field,
} else if (field_data->form_control_type == "month") {
return FillMonthControl(value, field_data);
} else if (type.GetStorableType() == ADDRESS_HOME_STREET_ADDRESS) {
FillStreetAddress(value, address_language_code, field_data);
FillStreetAddress(value, field_data);
return true;
}

Expand Down
8 changes: 3 additions & 5 deletions components/autofill/core/browser/autofill_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,11 @@ class AutofillField : public FormFieldData {
void set_default_value(const std::string& value) { default_value_ = value; }
const std::string& default_value() const { return default_value_; }

// Set |field_data|'s value to |value|. Uses |field|, |address_language_code|,
// and |app_locale| as hints when filling exceptional cases like phone number
// values and <select> fields. Returns |true| if the field has been filled,
// |false| otherwise.
// Set |field_data|'s value to |value|. Uses |field| and |app_locale| as
// hints when filling exceptional cases like phone number values and <select>
// fields. Returns |true| if the field has been filled, |false| otherwise.
static bool FillFormField(const AutofillField& field,
const base::string16& value,
const std::string& address_language_code,
const std::string& app_locale,
FormFieldData* field_data);

Expand Down
Loading

0 comments on commit 4eef752

Please sign in to comment.