From 282f45d3174ffabf6e18e24adad9f9b2d7e660b6 Mon Sep 17 00:00:00 2001 From: dfperry5 Date: Wed, 2 Aug 2017 06:54:51 -0400 Subject: [PATCH 1/6] Converted Country Textbox to Select Dropdown Creating a dropdown for the country list in the about:autofill panel Fix #9053 --- app/extensions/brave/about-autofill.html | 1 + app/extensions/brave/index-dev.html | 1 + app/extensions/brave/index.html | 1 + .../brave/locales/en-US/countries.properties | 249 ++++ app/locale.js | 256 ++++- .../autofill/autofillAddressPanel.js | 55 +- js/about/autofill.js | 3 +- js/constants/countries.js | 1000 +++++++++++++++++ js/constants/countryCodes.js | 253 +++++ 9 files changed, 1805 insertions(+), 14 deletions(-) create mode 100644 app/extensions/brave/locales/en-US/countries.properties create mode 100644 js/constants/countries.js create mode 100644 js/constants/countryCodes.js diff --git a/app/extensions/brave/about-autofill.html b/app/extensions/brave/about-autofill.html index b82e72374b9..9a8059d6cdf 100644 --- a/app/extensions/brave/about-autofill.html +++ b/app/extensions/brave/about-autofill.html @@ -14,6 +14,7 @@ +
diff --git a/app/extensions/brave/index-dev.html b/app/extensions/brave/index-dev.html index e7ae6ae3cee..0b8496dc191 100644 --- a/app/extensions/brave/index-dev.html +++ b/app/extensions/brave/index-dev.html @@ -18,6 +18,7 @@ +
diff --git a/app/extensions/brave/index.html b/app/extensions/brave/index.html index 833af07d72c..bc3b4dec0f8 100644 --- a/app/extensions/brave/index.html +++ b/app/extensions/brave/index.html @@ -18,6 +18,7 @@ +
diff --git a/app/extensions/brave/locales/en-US/countries.properties b/app/extensions/brave/locales/en-US/countries.properties new file mode 100644 index 00000000000..f16dcf033b1 --- /dev/null +++ b/app/extensions/brave/locales/en-US/countries.properties @@ -0,0 +1,249 @@ +AF=Afghanistan +AX=Åland Islands +AL=Albania +DZ=Algeria +AS=American Samoa +AD=Andorra +AO=Angola +AI=Anguilla +AQ=Antarctica +AG=Antigua and Barbuda +AR=Argentina +AM=Armenia +AW=Aruba +AU=Australia +AT=Austria +AZ=Azerbaijan +BS=Bahamas +BH=Bahrain +BD=Bangladesh +BB=Barbados +BY=Belarus +BE=Belgium +BZ=Belize +BJ=Benin +BM=Bermuda +BT=Bhutan +BO=Bolivia, Plurinational State of +BQ=Bonaire, Sint Eustatius and Saba +BA=Bosnia and Herzegovina +BW=Botswana +BV=Bouvet Island +BR=Brazil +IO=British Indian Ocean Territory +BN=Brunei Darussalam +BG=Bulgaria +BF=Burkina Faso +BI=Burundi +KH=Cambodia +CM=Cameroon +CA=Canada +CV=Cape Verde +KY=Cayman Islands +CF=Central African Republic +TD=Chad +CL=Chile +CN=China +CX=Christmas Island +CC=Cocos (Keeling) Islands +CO=Colombia +KM=Comoros +CG=Congo +CD=Congo, the Democratic Republic of the +CK=Cook Islands +CR=Costa Rica +CI=Côte d'Ivoire +HR=Croatia +CU=Cuba +CW=Curaçao +CY=Cyprus +CZ=Czech Republic +DK=Denmark +DJ=Djibouti +DM=Dominica +DO=Dominican Republic +EC=Ecuador +EG=Egypt +SV=El Salvador +GQ=Equatorial Guinea +ER=Eritrea +EE=Estonia +ET=Ethiopia +FK=Falkland Islands (Malvinas) +FO=Faroe Islands +FJ=Fiji +FI=Finland +FR=France +GF=French Guiana +PF=French Polynesia +TF=French Southern Territories +GA=Gabon +GM=Gambia +GE=Georgia +DE=Germany +GH=Ghana +GI=Gibraltar +GR=Greece +GL=Greenland +GD=Grenada +GP=Guadeloupe +GU=Guam +GT=Guatemala +GG=Guernsey +GN=Guinea +GW=Guinea-Bissau +GY=Guyana +HT=Haiti +HM=Heard Island and McDonald Islands +VA=Holy See (Vatican City State) +HN=Honduras +HK=Hong Kong +HU=Hungary +IS=Iceland +IN=India +ID=Indonesia +IR=Iran, Islamic Republic of +IQ=Iraq +IE=Ireland +IM=Isle of Man +IL=Israel +IT=Italy +JM=Jamaica +JP=Japan +JE=Jersey +JO=Jordan +KZ=Kazakhstan +KE=Kenya +KI=Kiribati +KP=Korea, Democratic People's Republic of +KR=Korea, Republic of +KW=Kuwait +KG=Kyrgyzstan +LA=Lao People's Democratic Republic +LV=Latvia +LB=Lebanon +LS=Lesotho +LR=Liberia +LY=Libya +LI=Liechtenstein +LT=Lithuania +LU=Luxembourg +MO=Macao +MK=Macedonia, the Former Yugoslav Republic of +MG=Madagascar +MW=Malawi +MY=Malaysia +MV=Maldives +ML=Mali +MT=Malta +MH=Marshall Islands +MQ=Martinique +MR=Mauritania +MU=Mauritius +YT=Mayotte +MX=Mexico +FM=Micronesia, Federated States of +MD=Moldova, Republic of +MC=Monaco +MN=Mongolia +ME=Montenegro +MS=Montserrat +MA=Morocco +MZ=Mozambique +MM=Myanmar +NA=Namibia +NR=Nauru +NP=Nepal +NL=Netherlands +NC=New Caledonia +NZ=New Zealand +NI=Nicaragua +NE=Niger +NG=Nigeria +NU=Niue +NF=Norfolk Island +MP=Northern Mariana Islands +NO=Norway +OM=Oman +PK=Pakistan +PW=Palau +PS=Palestine, State of +PA=Panama +PG=Papua New Guinea +PY=Paraguay +PE=Peru +PH=Philippines +PN=Pitcairn +PL=Poland +PT=Portugal +PR=Puerto Rico +QA=Qatar +RE=Réunion +RO=Romania +RU=Russian Federation +RW=Rwanda +BL=Saint Barthélemy +SH=Saint Helena, Ascension and Tristan da Cunha +KN=Saint Kitts and Nevis +LC=Saint Lucia +MF=Saint Martin (French part) +PM=Saint Pierre and Miquelon +VC=Saint Vincent and the Grenadines +WS=Samoa +SM=San Marino +ST=Sao Tome and Principe +SA=Saudi Arabia +SN=Senegal +RS=Serbia +SC=Seychelles +SL=Sierra Leone +SG=Singapore +SX=Sint Maarten (Dutch part) +SK=Slovakia +SI=Slovenia +SB=Solomon Islands +SO=Somalia +ZA=South Africa +GS=South Georgia and the South Sandwich Islands +SS=South Sudan +ES=Spain +LK=Sri Lanka +SD=Sudan +SR=Suriname +SJ=Svalbard and Jan Mayen +SZ=Swaziland +SE=Sweden +CH=Switzerland +SY=Syrian Arab Republic +TW=Taiwan +TJ=Tajikistan +TZ=Tanzania, United Republic of +TH=Thailand +TL=Timor-Leste +TG=Togo +TK=Tokelau +TO=Tonga +TT=Trinidad and Tobago +TN=Tunisia +TR=Turkey +TM=Turkmenistan +TC=Turks and Caicos Islands +TV=Tuvalu +UG=Uganda +UA=Ukraine +AE=United Arab Emirates +GB=United Kingdom +US=United States +UM=United States Minor Outlying Islands +UY=Uruguay +UZ=Uzbekistan +VU=Vanuatu +VE=Venezuela, Bolivarian Republic of +VN=Viet Nam +VG=Virgin Islands, British +VI=Virgin Islands, U.S. +WF=Wallis and Futuna +EH=Western Sahara +YE=Yemen +ZM=Zambia +ZW=Zimbabwe \ No newline at end of file diff --git a/app/locale.js b/app/locale.js index b88e8c51fe6..a40fca5599f 100644 --- a/app/locale.js +++ b/app/locale.js @@ -258,7 +258,257 @@ var rendererIdentifiers = function () { 'autoplayMedia', // Release channels 'channelDev', - 'channelBeta' + 'channelBeta', + // Country Codes, + 'AF', + 'AX', + 'AL', + 'DZ', + 'AS', + 'AD', + 'AO', + 'AI', + 'AQ', + 'AG', + 'AR', + 'AM', + 'AW', + 'AU', + 'AT', + 'AZ', + 'BS', + 'BH', + 'BD', + 'BB', + 'BY', + 'BE', + 'BZ', + 'BJ', + 'BM', + 'BT', + 'BO', + 'BQ', + 'BA', + 'BW', + 'BV', + 'BR', + 'IO', + 'BN', + 'BG', + 'BF', + 'BI', + 'KH', + 'CM', + 'CA', + 'CV', + 'KY', + 'CF', + 'TD', + 'CL', + 'CN', + 'CX', + 'CC', + 'CO', + 'KM', + 'CG', + 'CD', + 'CK', + 'CR', + 'CI', + 'HR', + 'CU', + 'CW', + 'CY', + 'CZ', + 'DK', + 'DJ', + 'DM', + 'DO', + 'EC', + 'EG', + 'SV', + 'GQ', + 'ER', + 'EE', + 'ET', + 'FK', + 'FO', + 'FJ', + 'FI', + 'FR', + 'GF', + 'PF', + 'TF', + 'GA', + 'GM', + 'GE', + 'DE', + 'GH', + 'GI', + 'GR', + 'GL', + 'GD', + 'GP', + 'GU', + 'GT', + 'GG', + 'GN', + 'GW', + 'GY', + 'HT', + 'HM', + 'VA', + 'HN', + 'HK', + 'HU', + 'IS', + 'IN', + 'ID', + 'IR', + 'IQ', + 'IE', + 'IM', + 'IL', + 'IT', + 'JM', + 'JP', + 'JE', + 'JO', + 'KZ', + 'KE', + 'KI', + 'KP', + 'KR', + 'KW', + 'KG', + 'LA', + 'LV', + 'LB', + 'LS', + 'LR', + 'LY', + 'LI', + 'LT', + 'LU', + 'MO', + 'MK', + 'MG', + 'MW', + 'MY', + 'MV', + 'ML', + 'MT', + 'MH', + 'MQ', + 'MR', + 'MU', + 'YT', + 'MX', + 'FM', + 'MD', + 'MC', + 'MN', + 'ME', + 'MS', + 'MA', + 'MZ', + 'MM', + 'NA', + 'NR', + 'NP', + 'NL', + 'NC', + 'NZ', + 'NI', + 'NE', + 'NG', + 'NU', + 'NF', + 'MP', + 'NO', + 'OM', + 'PK', + 'PW', + 'PS', + 'PA', + 'PG', + 'PY', + 'PE', + 'PH', + 'PN', + 'PL', + 'PT', + 'PR', + 'QA', + 'RE', + 'RO', + 'RU', + 'RW', + 'BL', + 'SH', + 'KN', + 'LC', + 'MF', + 'PM', + 'VC', + 'WS', + 'SM', + 'ST', + 'SA', + 'SN', + 'RS', + 'SC', + 'SL', + 'SG', + 'SX', + 'SK', + 'SI', + 'SB', + 'SO', + 'ZA', + 'GS', + 'SS', + 'ES', + 'LK', + 'SD', + 'SR', + 'SJ', + 'SZ', + 'SE', + 'CH', + 'SY', + 'TW', + 'TJ', + 'TZ', + 'TH', + 'TL', + 'TG', + 'TK', + 'TO', + 'TT', + 'TN', + 'TR', + 'TM', + 'TC', + 'TV', + 'UG', + 'UA', + 'AE', + 'GB', + 'US', + 'UM', + 'UY', + 'UZ', + 'VU', + 'VE', + 'VN', + 'VG', + 'VI', + 'WF', + 'EH', + 'YE', + 'ZM', + 'ZW' ] } @@ -383,7 +633,9 @@ exports.init = function (language) { path.join(__dirname, 'extensions', 'brave', 'locales', lang, 'app.properties'), path.join(__dirname, 'extensions', 'brave', 'locales', lang, 'error.properties'), path.join(__dirname, 'extensions', 'brave', 'locales', lang, 'passwords.properties'), - path.join(__dirname, 'extensions', 'brave', 'locales', lang, 'common.properties')) + path.join(__dirname, 'extensions', 'brave', 'locales', lang, 'common.properties'), + path.join(__dirname, 'extensions', 'brave', 'locales', lang, 'countries.properties') + ) } appendLangProperties(lang) diff --git a/app/renderer/components/autofill/autofillAddressPanel.js b/app/renderer/components/autofill/autofillAddressPanel.js index 4187503eebb..7e0ff85da29 100644 --- a/app/renderer/components/autofill/autofillAddressPanel.js +++ b/app/renderer/components/autofill/autofillAddressPanel.js @@ -4,8 +4,7 @@ const React = require('react') const Immutable = require('immutable') -const {css} = require('aphrodite/no-important') - +const {StyleSheet, css} = require('aphrodite/no-important') // Components const ReduxComponent = require('../reduxComponent') const Dialog = require('../common/dialog') @@ -14,6 +13,7 @@ const { CommonFormLarge, CommonFormSection, CommonFormTitle, + CommonFormDropdown, CommonFormButtonWrapper, commonFormStyles } = require('../common/commonForm') @@ -21,12 +21,18 @@ const { // Actions const windowActions = require('../../../../js/actions/windowActions') const appActions = require('../../../../js/actions/appActions') +const countries = require('../../../../js/constants/countries') // Constants const KeyCodes = require('../../../common/constants/keyCodes') // Styles const commonStyles = require('../styles/commonStyles') +const globalStyles = require('../styles/global') + +// Localization +const locale = require('../../../../js/l10n') // NOTE: path will change; it's located at `./js/l10n` + const commonForm = css( commonStyles.formControl, commonStyles.textbox, @@ -118,7 +124,14 @@ class AutofillAddressPanel extends React.Component { onHide () { windowActions.setAutofillAddressDetail() } - + get countryList () { + const countryList = [] + for (let i = 0; i < countries.length; i++) { + let localizedCountryName = locale.translation(countries[i].Code) + countryList.push() + } + return countryList + } mergeProps (state, ownProps) { const currentWindow = state.get('currentWindow') const detail = currentWindow.get('autofillAddressDetail', Immutable.Map()) @@ -225,15 +238,17 @@ class AutofillAddressPanel extends React.Component { defaultValue={this.props.postalCode} />
-
- + + data-test-id='country' + > + {this.countryList} +
{address.get('city')} {address.get('state')} {address.get('postalCode')} - {address.get('country')} + {locale.translation(address.get('country'))} {address.get('phone')} {address.get('email')} diff --git a/js/constants/countries.js b/js/constants/countries.js new file mode 100644 index 00000000000..3f0f3e5d7f2 --- /dev/null +++ b/js/constants/countries.js @@ -0,0 +1,1000 @@ +const countries = [ + { + 'Name': 'Afghanistan', + 'Code': 'AF' + }, + { + 'Name': 'Åland Islands', + 'Code': 'AX' + }, + { + 'Name': 'Albania', + 'Code': 'AL' + }, + { + 'Name': 'Algeria', + 'Code': 'DZ' + }, + { + 'Name': 'American Samoa', + 'Code': 'AS' + }, + { + 'Name': 'Andorra', + 'Code': 'AD' + }, + { + 'Name': 'Angola', + 'Code': 'AO' + }, + { + 'Name': 'Anguilla', + 'Code': 'AI' + }, + { + 'Name': 'Antarctica', + 'Code': 'AQ' + }, + { + 'Name': 'Antigua and Barbuda', + 'Code': 'AG' + }, + { + 'Name': 'Argentina', + 'Code': 'AR' + }, + { + 'Name': 'Armenia', + 'Code': 'AM' + }, + { + 'Name': 'Aruba', + 'Code': 'AW' + }, + { + 'Name': 'Australia', + 'Code': 'AU' + }, + { + 'Name': 'Austria', + 'Code': 'AT' + }, + { + 'Name': 'Azerbaijan', + 'Code': 'AZ' + }, + { + 'Name': 'Bahamas', + 'Code': 'BS' + }, + { + 'Name': 'Bahrain', + 'Code': 'BH' + }, + { + 'Name': 'Bangladesh', + 'Code': 'BD' + }, + { + 'Name': 'Barbados', + 'Code': 'BB' + }, + { + 'Name': 'Belarus', + 'Code': 'BY' + }, + { + 'Name': 'Belgium', + 'Code': 'BE' + }, + { + 'Name': 'Belize', + 'Code': 'BZ' + }, + { + 'Name': 'Benin', + 'Code': 'BJ' + }, + { + 'Name': 'Bermuda', + 'Code': 'BM' + }, + { + 'Name': 'Bhutan', + 'Code': 'BT' + }, + { + 'Name': 'Bolivia, Plurinational State of', + 'Code': 'BO' + }, + { + 'Name': 'Bonaire, Sint Eustatius and Saba', + 'Code': 'BQ' + }, + { + 'Name': 'Bosnia and Herzegovina', + 'Code': 'BA' + }, + { + 'Name': 'Botswana', + 'Code': 'BW' + }, + { + 'Name': 'Bouvet Island', + 'Code': 'BV' + }, + { + 'Name': 'Brazil', + 'Code': 'BR' + }, + { + 'Name': 'British Indian Ocean Territory', + 'Code': 'IO' + }, + { + 'Name': 'Brunei Darussalam', + 'Code': 'BN' + }, + { + 'Name': 'Bulgaria', + 'Code': 'BG' + }, + { + 'Name': 'Burkina Faso', + 'Code': 'BF' + }, + { + 'Name': 'Burundi', + 'Code': 'BI' + }, + { + 'Name': 'Cambodia', + 'Code': 'KH' + }, + { + 'Name': 'Cameroon', + 'Code': 'CM' + }, + { + 'Name': 'Canada', + 'Code': 'CA' + }, + { + 'Name': 'Cape Verde', + 'Code': 'CV' + }, + { + 'Name': 'Cayman Islands', + 'Code': 'KY' + }, + { + 'Name': 'Central African Republic', + 'Code': 'CF' + }, + { + 'Name': 'Chad', + 'Code': 'TD' + }, + { + 'Name': 'Chile', + 'Code': 'CL' + }, + { + 'Name': 'China', + 'Code': 'CN' + }, + { + 'Name': 'Christmas Island', + 'Code': 'CX' + }, + { + 'Name': 'Cocos (Keeling) Islands', + 'Code': 'CC' + }, + { + 'Name': 'Colombia', + 'Code': 'CO' + }, + { + 'Name': 'Comoros', + 'Code': 'KM' + }, + { + 'Name': 'Congo', + 'Code': 'CG' + }, + { + 'Name': 'Congo, the Democratic Republic of the', + 'Code': 'CD' + }, + { + 'Name': 'Cook Islands', + 'Code': 'CK' + }, + { + 'Name': 'Costa Rica', + 'Code': 'CR' + }, + { + 'Name': 'Côte d\'Ivoire', + 'Code': 'CI' + }, + { + 'Name': 'Croatia', + 'Code': 'HR' + }, + { + 'Name': 'Cuba', + 'Code': 'CU' + }, + { + 'Name': 'Curaçao', + 'Code': 'CW' + }, + { + 'Name': 'Cyprus', + 'Code': 'CY' + }, + { + 'Name': 'Czech Republic', + 'Code': 'CZ' + }, + { + 'Name': 'Denmark', + 'Code': 'DK' + }, + { + 'Name': 'Djibouti', + 'Code': 'DJ' + }, + { + 'Name': 'Dominica', + 'Code': 'DM' + }, + { + 'Name': 'Dominican Republic', + 'Code': 'DO' + }, + { + 'Name': 'Ecuador', + 'Code': 'EC' + }, + { + 'Name': 'Egypt', + 'Code': 'EG' + }, + { + 'Name': 'El Salvador', + 'Code': 'SV' + }, + { + 'Name': 'Equatorial Guinea', + 'Code': 'GQ' + }, + { + 'Name': 'Eritrea', + 'Code': 'ER' + }, + { + 'Name': 'Estonia', + 'Code': 'EE' + }, + { + 'Name': 'Ethiopia', + 'Code': 'ET' + }, + { + 'Name': 'Falkland Islands (Malvinas)', + 'Code': 'FK' + }, + { + 'Name': 'Faroe Islands', + 'Code': 'FO' + }, + { + 'Name': 'Fiji', + 'Code': 'FJ' + }, + { + 'Name': 'Finland', + 'Code': 'FI' + }, + { + 'Name': 'France', + 'Code': 'FR' + }, + { + 'Name': 'French Guiana', + 'Code': 'GF' + }, + { + 'Name': 'French Polynesia', + 'Code': 'PF' + }, + { + 'Name': 'French Southern Territories', + 'Code': 'TF' + }, + { + 'Name': 'Gabon', + 'Code': 'GA' + }, + { + 'Name': 'Gambia', + 'Code': 'GM' + }, + { + 'Name': 'Georgia', + 'Code': 'GE' + }, + { + 'Name': 'Germany', + 'Code': 'DE' + }, + { + 'Name': 'Ghana', + 'Code': 'GH' + }, + { + 'Name': 'Gibraltar', + 'Code': 'GI' + }, + { + 'Name': 'Greece', + 'Code': 'GR' + }, + { + 'Name': 'Greenland', + 'Code': 'GL' + }, + { + 'Name': 'Grenada', + 'Code': 'GD' + }, + { + 'Name': 'Guadeloupe', + 'Code': 'GP' + }, + { + 'Name': 'Guam', + 'Code': 'GU' + }, + { + 'Name': 'Guatemala', + 'Code': 'GT' + }, + { + 'Name': 'Guernsey', + 'Code': 'GG' + }, + { + 'Name': 'Guinea', + 'Code': 'GN' + }, + { + 'Name': 'Guinea-Bissau', + 'Code': 'GW' + }, + { + 'Name': 'Guyana', + 'Code': 'GY' + }, + { + 'Name': 'Haiti', + 'Code': 'HT' + }, + { + 'Name': 'Heard Island and McDonald Islands', + 'Code': 'HM' + }, + { + 'Name': 'Holy See (Vatican City State)', + 'Code': 'VA' + }, + { + 'Name': 'Honduras', + 'Code': 'HN' + }, + { + 'Name': 'Hong Kong', + 'Code': 'HK' + }, + { + 'Name': 'Hungary', + 'Code': 'HU' + }, + { + 'Name': 'Iceland', + 'Code': 'IS' + }, + { + 'Name': 'India', + 'Code': 'IN' + }, + { + 'Name': 'Indonesia', + 'Code': 'ID' + }, + { + 'Name': 'Iran, Islamic Republic of', + 'Code': 'IR' + }, + { + 'Name': 'Iraq', + 'Code': 'IQ' + }, + { + 'Name': 'Ireland', + 'Code': 'IE' + }, + { + 'Name': 'Isle of Man', + 'Code': 'IM' + }, + { + 'Name': 'Israel', + 'Code': 'IL' + }, + { + 'Name': 'Italy', + 'Code': 'IT' + }, + { + 'Name': 'Jamaica', + 'Code': 'JM' + }, + { + 'Name': 'Japan', + 'Code': 'JP' + }, + { + 'Name': 'Jersey', + 'Code': 'JE' + }, + { + 'Name': 'Jordan', + 'Code': 'JO' + }, + { + 'Name': 'Kazakhstan', + 'Code': 'KZ' + }, + { + 'Name': 'Kenya', + 'Code': 'KE' + }, + { + 'Name': 'Kiribati', + 'Code': 'KI' + }, + { + 'Name': 'Korea, Democratic People\'s Republic of', + 'Code': 'KP' + }, + { + 'Name': 'Korea, Republic of', + 'Code': 'KR' + }, + { + 'Name': 'Kuwait', + 'Code': 'KW' + }, + { + 'Name': 'Kyrgyzstan', + 'Code': 'KG' + }, + { + 'Name': 'Lao People\'s Democratic Republic', + 'Code': 'LA' + }, + { + 'Name': 'Latvia', + 'Code': 'LV' + }, + { + 'Name': 'Lebanon', + 'Code': 'LB' + }, + { + 'Name': 'Lesotho', + 'Code': 'LS' + }, + { + 'Name': 'Liberia', + 'Code': 'LR' + }, + { + 'Name': 'Libya', + 'Code': 'LY' + }, + { + 'Name': 'Liechtenstein', + 'Code': 'LI' + }, + { + 'Name': 'Lithuania', + 'Code': 'LT' + }, + { + 'Name': 'Luxembourg', + 'Code': 'LU' + }, + { + 'Name': 'Macao', + 'Code': 'MO' + }, + { + 'Name': 'Macedonia, the Former Yugoslav Republic of', + 'Code': 'MK' + }, + { + 'Name': 'Madagascar', + 'Code': 'MG' + }, + { + 'Name': 'Malawi', + 'Code': 'MW' + }, + { + 'Name': 'Malaysia', + 'Code': 'MY' + }, + { + 'Name': 'Maldives', + 'Code': 'MV' + }, + { + 'Name': 'Mali', + 'Code': 'ML' + }, + { + 'Name': 'Malta', + 'Code': 'MT' + }, + { + 'Name': 'Marshall Islands', + 'Code': 'MH' + }, + { + 'Name': 'Martinique', + 'Code': 'MQ' + }, + { + 'Name': 'Mauritania', + 'Code': 'MR' + }, + { + 'Name': 'Mauritius', + 'Code': 'MU' + }, + { + 'Name': 'Mayotte', + 'Code': 'YT' + }, + { + 'Name': 'Mexico', + 'Code': 'MX' + }, + { + 'Name': 'Micronesia, Federated States of', + 'Code': 'FM' + }, + { + 'Name': 'Moldova, Republic of', + 'Code': 'MD' + }, + { + 'Name': 'Monaco', + 'Code': 'MC' + }, + { + 'Name': 'Mongolia', + 'Code': 'MN' + }, + { + 'Name': 'Montenegro', + 'Code': 'ME' + }, + { + 'Name': 'Montserrat', + 'Code': 'MS' + }, + { + 'Name': 'Morocco', + 'Code': 'MA' + }, + { + 'Name': 'Mozambique', + 'Code': 'MZ' + }, + { + 'Name': 'Myanmar', + 'Code': 'MM' + }, + { + 'Name': 'Namibia', + 'Code': 'NA' + }, + { + 'Name': 'Nauru', + 'Code': 'NR' + }, + { + 'Name': 'Nepal', + 'Code': 'NP' + }, + { + 'Name': 'Netherlands', + 'Code': 'NL' + }, + { + 'Name': 'New Caledonia', + 'Code': 'NC' + }, + { + 'Name': 'New Zealand', + 'Code': 'NZ' + }, + { + 'Name': 'Nicaragua', + 'Code': 'NI' + }, + { + 'Name': 'Niger', + 'Code': 'NE' + }, + { + 'Name': 'Nigeria', + 'Code': 'NG' + }, + { + 'Name': 'Niue', + 'Code': 'NU' + }, + { + 'Name': 'Norfolk Island', + 'Code': 'NF' + }, + { + 'Name': 'Northern Mariana Islands', + 'Code': 'MP' + }, + { + 'Name': 'Norway', + 'Code': 'NO' + }, + { + 'Name': 'Oman', + 'Code': 'OM' + }, + { + 'Name': 'Pakistan', + 'Code': 'PK' + }, + { + 'Name': 'Palau', + 'Code': 'PW' + }, + { + 'Name': 'Palestine, State of', + 'Code': 'PS' + }, + { + 'Name': 'Panama', + 'Code': 'PA' + }, + { + 'Name': 'Papua New Guinea', + 'Code': 'PG' + }, + { + 'Name': 'Paraguay', + 'Code': 'PY' + }, + { + 'Name': 'Peru', + 'Code': 'PE' + }, + { + 'Name': 'Philippines', + 'Code': 'PH' + }, + { + 'Name': 'Pitcairn', + 'Code': 'PN' + }, + { + 'Name': 'Poland', + 'Code': 'PL' + }, + { + 'Name': 'Portugal', + 'Code': 'PT' + }, + { + 'Name': 'Puerto Rico', + 'Code': 'PR' + }, + { + 'Name': 'Qatar', + 'Code': 'QA' + }, + { + 'Name': 'Réunion', + 'Code': 'RE' + }, + { + 'Name': 'Romania', + 'Code': 'RO' + }, + { + 'Name': 'Russian Federation', + 'Code': 'RU' + }, + { + 'Name': 'Rwanda', + 'Code': 'RW' + }, + { + 'Name': 'Saint Barthélemy', + 'Code': 'BL' + }, + { + 'Name': 'Saint Helena, Ascension and Tristan da Cunha', + 'Code': 'SH' + }, + { + 'Name': 'Saint Kitts and Nevis', + 'Code': 'KN' + }, + { + 'Name': 'Saint Lucia', + 'Code': 'LC' + }, + { + 'Name': 'Saint Martin (French part)', + 'Code': 'MF' + }, + { + 'Name': 'Saint Pierre and Miquelon', + 'Code': 'PM' + }, + { + 'Name': 'Saint Vincent and the Grenadines', + 'Code': 'VC' + }, + { + 'Name': 'Samoa', + 'Code': 'WS' + }, + { + 'Name': 'San Marino', + 'Code': 'SM' + }, + { + 'Name': 'Sao Tome and Principe', + 'Code': 'ST' + }, + { + 'Name': 'Saudi Arabia', + 'Code': 'SA' + }, + { + 'Name': 'Senegal', + 'Code': 'SN' + }, + { + 'Name': 'Serbia', + 'Code': 'RS' + }, + { + 'Name': 'Seychelles', + 'Code': 'SC' + }, + { + 'Name': 'Sierra Leone', + 'Code': 'SL' + }, + { + 'Name': 'Singapore', + 'Code': 'SG' + }, + { + 'Name': 'Sint Maarten (Dutch part)', + 'Code': 'SX' + }, + { + 'Name': 'Slovakia', + 'Code': 'SK' + }, + { + 'Name': 'Slovenia', + 'Code': 'SI' + }, + { + 'Name': 'Solomon Islands', + 'Code': 'SB' + }, + { + 'Name': 'Somalia', + 'Code': 'SO' + }, + { + 'Name': 'South Africa', + 'Code': 'ZA' + }, + { + 'Name': 'South Georgia and the South Sandwich Islands', + 'Code': 'GS' + }, + { + 'Name': 'South Sudan', + 'Code': 'SS' + }, + { + 'Name': 'Spain', + 'Code': 'ES' + }, + { + 'Name': 'Sri Lanka', + 'Code': 'LK' + }, + { + 'Name': 'Sudan', + 'Code': 'SD' + }, + { + 'Name': 'Suriname', + 'Code': 'SR' + }, + { + 'Name': 'Svalbard and Jan Mayen', + 'Code': 'SJ' + }, + { + 'Name': 'Swaziland', + 'Code': 'SZ' + }, + { + 'Name': 'Sweden', + 'Code': 'SE' + }, + { + 'Name': 'Switzerland', + 'Code': 'CH' + }, + { + 'Name': 'Syrian Arab Republic', + 'Code': 'SY' + }, + { + 'Name': 'Taiwan', + 'Code': 'TW' + }, + { + 'Name': 'Tajikistan', + 'Code': 'TJ' + }, + { + 'Name': 'Tanzania, United Republic of', + 'Code': 'TZ' + }, + { + 'Name': 'Thailand', + 'Code': 'TH' + }, + { + 'Name': 'Timor-Leste', + 'Code': 'TL' + }, + { + 'Name': 'Togo', + 'Code': 'TG' + }, + { + 'Name': 'Tokelau', + 'Code': 'TK' + }, + { + 'Name': 'Tonga', + 'Code': 'TO' + }, + { + 'Name': 'Trinidad and Tobago', + 'Code': 'TT' + }, + { + 'Name': 'Tunisia', + 'Code': 'TN' + }, + { + 'Name': 'Turkey', + 'Code': 'TR' + }, + { + 'Name': 'Turkmenistan', + 'Code': 'TM' + }, + { + 'Name': 'Turks and Caicos Islands', + 'Code': 'TC' + }, + { + 'Name': 'Tuvalu', + 'Code': 'TV' + }, + { + 'Name': 'Uganda', + 'Code': 'UG' + }, + { + 'Name': 'Ukraine', + 'Code': 'UA' + }, + { + 'Name': 'United Arab Emirates', + 'Code': 'AE' + }, + { + 'Name': 'United Kingdom', + 'Code': 'GB' + }, + { + 'Name': 'United States', + 'Code': 'US' + }, + { + 'Name': 'United States Minor Outlying Islands', + 'Code': 'UM' + }, + { + 'Name': 'Uruguay', + 'Code': 'UY' + }, + { + 'Name': 'Uzbekistan', + 'Code': 'UZ' + }, + { + 'Name': 'Vanuatu', + 'Code': 'VU' + }, + { + 'Name': 'Venezuela, Bolivarian Republic of', + 'Code': 'VE' + }, + { + 'Name': 'Viet Nam', + 'Code': 'VN' + }, + { + 'Name': 'Virgin Islands, British', + 'Code': 'VG' + }, + { + 'Name': 'Virgin Islands, U.S.', + 'Code': 'VI' + }, + { + 'Name': 'Wallis and Futuna', + 'Code': 'WF' + }, + { + 'Name': 'Western Sahara', + 'Code': 'EH' + }, + { + 'Name': 'Yemen', + 'Code': 'YE' + }, + { + 'Name': 'Zambia', + 'Code': 'ZM' + }, + { + 'Name': 'Zimbabwe', + 'Code': 'ZW' + } +] + +module.exports = countries diff --git a/js/constants/countryCodes.js b/js/constants/countryCodes.js new file mode 100644 index 00000000000..e62eeeb2748 --- /dev/null +++ b/js/constants/countryCodes.js @@ -0,0 +1,253 @@ +const countryCodes = [ + 'AF', + 'AX', + 'AL', + 'DZ', + 'AS', + 'AD', + 'AO', + 'AI', + 'AQ', + 'AG', + 'AR', + 'AM', + 'AW', + 'AU', + 'AT', + 'AZ', + 'BS', + 'BH', + 'BD', + 'BB', + 'BY', + 'BE', + 'BZ', + 'BJ', + 'BM', + 'BT', + 'BO', + 'BQ', + 'BA', + 'BW', + 'BV', + 'BR', + 'IO', + 'BN', + 'BG', + 'BF', + 'BI', + 'KH', + 'CM', + 'CA', + 'CV', + 'KY', + 'CF', + 'TD', + 'CL', + 'CN', + 'CX', + 'CC', + 'CO', + 'KM', + 'CG', + 'CD', + 'CK', + 'CR', + 'CI', + 'HR', + 'CU', + 'CW', + 'CY', + 'CZ', + 'DK', + 'DJ', + 'DM', + 'DO', + 'EC', + 'EG', + 'SV', + 'GQ', + 'ER', + 'EE', + 'ET', + 'FK', + 'FO', + 'FJ', + 'FI', + 'FR', + 'GF', + 'PF', + 'TF', + 'GA', + 'GM', + 'GE', + 'DE', + 'GH', + 'GI', + 'GR', + 'GL', + 'GD', + 'GP', + 'GU', + 'GT', + 'GG', + 'GN', + 'GW', + 'GY', + 'HT', + 'HM', + 'VA', + 'HN', + 'HK', + 'HU', + 'IS', + 'IN', + 'ID', + 'IR', + 'IQ', + 'IE', + 'IM', + 'IL', + 'IT', + 'JM', + 'JP', + 'JE', + 'JO', + 'KZ', + 'KE', + 'KI', + 'KP', + 'KR', + 'KW', + 'KG', + 'LA', + 'LV', + 'LB', + 'LS', + 'LR', + 'LY', + 'LI', + 'LT', + 'LU', + 'MO', + 'MK', + 'MG', + 'MW', + 'MY', + 'MV', + 'ML', + 'MT', + 'MH', + 'MQ', + 'MR', + 'MU', + 'YT', + 'MX', + 'FM', + 'MD', + 'MC', + 'MN', + 'ME', + 'MS', + 'MA', + 'MZ', + 'MM', + 'NA', + 'NR', + 'NP', + 'NL', + 'NC', + 'NZ', + 'NI', + 'NE', + 'NG', + 'NU', + 'NF', + 'MP', + 'NO', + 'OM', + 'PK', + 'PW', + 'PS', + 'PA', + 'PG', + 'PY', + 'PE', + 'PH', + 'PN', + 'PL', + 'PT', + 'PR', + 'QA', + 'RE', + 'RO', + 'RU', + 'RW', + 'BL', + 'SH', + 'KN', + 'LC', + 'MF', + 'PM', + 'VC', + 'WS', + 'SM', + 'ST', + 'SA', + 'SN', + 'RS', + 'SC', + 'SL', + 'SG', + 'SX', + 'SK', + 'SI', + 'SB', + 'SO', + 'ZA', + 'GS', + 'SS', + 'ES', + 'LK', + 'SD', + 'SR', + 'SJ', + 'SZ', + 'SE', + 'CH', + 'SY', + 'TW', + 'TJ', + 'TZ', + 'TH', + 'TL', + 'TG', + 'TK', + 'TO', + 'TT', + 'TN', + 'TR', + 'TM', + 'TC', + 'TV', + 'UG', + 'UA', + 'AE', + 'GB', + 'US', + 'UM', + 'UY', + 'UZ', + 'VU', + 'VE', + 'VN', + 'VG', + 'VI', + 'WF', + 'EH', + 'YE', + 'ZM', + 'ZW' +] + +module.exports = countryCodes From defd43c94a970466c328d831a4c3d8e16d609c5f Mon Sep 17 00:00:00 2001 From: Brian Clifton Date: Mon, 21 Aug 2017 14:57:35 -0700 Subject: [PATCH 2/6] Small cleanup for autofill country list per discussion in PR Auditors: @dfperry5 --- {js => app/common}/constants/countryCodes.js | 0 .../brave/locales/en-US/countries.properties | 2 +- app/locale.js | 256 +---- .../autofill/autofillAddressPanel.js | 11 +- js/constants/countries.js | 1000 ----------------- 5 files changed, 11 insertions(+), 1258 deletions(-) rename {js => app/common}/constants/countryCodes.js (100%) delete mode 100644 js/constants/countries.js diff --git a/js/constants/countryCodes.js b/app/common/constants/countryCodes.js similarity index 100% rename from js/constants/countryCodes.js rename to app/common/constants/countryCodes.js diff --git a/app/extensions/brave/locales/en-US/countries.properties b/app/extensions/brave/locales/en-US/countries.properties index f16dcf033b1..3fa9aaac45d 100644 --- a/app/extensions/brave/locales/en-US/countries.properties +++ b/app/extensions/brave/locales/en-US/countries.properties @@ -246,4 +246,4 @@ WF=Wallis and Futuna EH=Western Sahara YE=Yemen ZM=Zambia -ZW=Zimbabwe \ No newline at end of file +ZW=Zimbabwe diff --git a/app/locale.js b/app/locale.js index a40fca5599f..1443a9f2b45 100644 --- a/app/locale.js +++ b/app/locale.js @@ -13,6 +13,8 @@ const {LANGUAGE, REQUEST_LANGUAGE} = require('../js/constants/messages') // Exhaustive list of identifiers used by top and context menus var rendererIdentifiers = function () { + const countryCodes = require('./common/constants/countryCodes') + return [ 'downloadsManager', 'confirmClearPasswords', @@ -258,258 +260,8 @@ var rendererIdentifiers = function () { 'autoplayMedia', // Release channels 'channelDev', - 'channelBeta', - // Country Codes, - 'AF', - 'AX', - 'AL', - 'DZ', - 'AS', - 'AD', - 'AO', - 'AI', - 'AQ', - 'AG', - 'AR', - 'AM', - 'AW', - 'AU', - 'AT', - 'AZ', - 'BS', - 'BH', - 'BD', - 'BB', - 'BY', - 'BE', - 'BZ', - 'BJ', - 'BM', - 'BT', - 'BO', - 'BQ', - 'BA', - 'BW', - 'BV', - 'BR', - 'IO', - 'BN', - 'BG', - 'BF', - 'BI', - 'KH', - 'CM', - 'CA', - 'CV', - 'KY', - 'CF', - 'TD', - 'CL', - 'CN', - 'CX', - 'CC', - 'CO', - 'KM', - 'CG', - 'CD', - 'CK', - 'CR', - 'CI', - 'HR', - 'CU', - 'CW', - 'CY', - 'CZ', - 'DK', - 'DJ', - 'DM', - 'DO', - 'EC', - 'EG', - 'SV', - 'GQ', - 'ER', - 'EE', - 'ET', - 'FK', - 'FO', - 'FJ', - 'FI', - 'FR', - 'GF', - 'PF', - 'TF', - 'GA', - 'GM', - 'GE', - 'DE', - 'GH', - 'GI', - 'GR', - 'GL', - 'GD', - 'GP', - 'GU', - 'GT', - 'GG', - 'GN', - 'GW', - 'GY', - 'HT', - 'HM', - 'VA', - 'HN', - 'HK', - 'HU', - 'IS', - 'IN', - 'ID', - 'IR', - 'IQ', - 'IE', - 'IM', - 'IL', - 'IT', - 'JM', - 'JP', - 'JE', - 'JO', - 'KZ', - 'KE', - 'KI', - 'KP', - 'KR', - 'KW', - 'KG', - 'LA', - 'LV', - 'LB', - 'LS', - 'LR', - 'LY', - 'LI', - 'LT', - 'LU', - 'MO', - 'MK', - 'MG', - 'MW', - 'MY', - 'MV', - 'ML', - 'MT', - 'MH', - 'MQ', - 'MR', - 'MU', - 'YT', - 'MX', - 'FM', - 'MD', - 'MC', - 'MN', - 'ME', - 'MS', - 'MA', - 'MZ', - 'MM', - 'NA', - 'NR', - 'NP', - 'NL', - 'NC', - 'NZ', - 'NI', - 'NE', - 'NG', - 'NU', - 'NF', - 'MP', - 'NO', - 'OM', - 'PK', - 'PW', - 'PS', - 'PA', - 'PG', - 'PY', - 'PE', - 'PH', - 'PN', - 'PL', - 'PT', - 'PR', - 'QA', - 'RE', - 'RO', - 'RU', - 'RW', - 'BL', - 'SH', - 'KN', - 'LC', - 'MF', - 'PM', - 'VC', - 'WS', - 'SM', - 'ST', - 'SA', - 'SN', - 'RS', - 'SC', - 'SL', - 'SG', - 'SX', - 'SK', - 'SI', - 'SB', - 'SO', - 'ZA', - 'GS', - 'SS', - 'ES', - 'LK', - 'SD', - 'SR', - 'SJ', - 'SZ', - 'SE', - 'CH', - 'SY', - 'TW', - 'TJ', - 'TZ', - 'TH', - 'TL', - 'TG', - 'TK', - 'TO', - 'TT', - 'TN', - 'TR', - 'TM', - 'TC', - 'TV', - 'UG', - 'UA', - 'AE', - 'GB', - 'US', - 'UM', - 'UY', - 'UZ', - 'VU', - 'VE', - 'VN', - 'VG', - 'VI', - 'WF', - 'EH', - 'YE', - 'ZM', - 'ZW' - ] + 'channelBeta' + ].concat(countryCodes) } var ctx = null diff --git a/app/renderer/components/autofill/autofillAddressPanel.js b/app/renderer/components/autofill/autofillAddressPanel.js index 7e0ff85da29..3c14f150dbf 100644 --- a/app/renderer/components/autofill/autofillAddressPanel.js +++ b/app/renderer/components/autofill/autofillAddressPanel.js @@ -21,17 +21,17 @@ const { // Actions const windowActions = require('../../../../js/actions/windowActions') const appActions = require('../../../../js/actions/appActions') -const countries = require('../../../../js/constants/countries') // Constants const KeyCodes = require('../../../common/constants/keyCodes') +const countryCodes = require('../../../common/constants/countryCodes') // Styles const commonStyles = require('../styles/commonStyles') const globalStyles = require('../styles/global') // Localization -const locale = require('../../../../js/l10n') // NOTE: path will change; it's located at `./js/l10n` +const locale = require('../../../../js/l10n') const commonForm = css( commonStyles.formControl, @@ -126,9 +126,10 @@ class AutofillAddressPanel extends React.Component { } get countryList () { const countryList = [] - for (let i = 0; i < countries.length; i++) { - let localizedCountryName = locale.translation(countries[i].Code) - countryList.push() + for (let i = 0; i < countryCodes.length; i++) { + const countryCode = countryCodes[i] + const localizedCountryName = locale.translation(countryCode) + countryList.push() } return countryList } diff --git a/js/constants/countries.js b/js/constants/countries.js deleted file mode 100644 index 3f0f3e5d7f2..00000000000 --- a/js/constants/countries.js +++ /dev/null @@ -1,1000 +0,0 @@ -const countries = [ - { - 'Name': 'Afghanistan', - 'Code': 'AF' - }, - { - 'Name': 'Åland Islands', - 'Code': 'AX' - }, - { - 'Name': 'Albania', - 'Code': 'AL' - }, - { - 'Name': 'Algeria', - 'Code': 'DZ' - }, - { - 'Name': 'American Samoa', - 'Code': 'AS' - }, - { - 'Name': 'Andorra', - 'Code': 'AD' - }, - { - 'Name': 'Angola', - 'Code': 'AO' - }, - { - 'Name': 'Anguilla', - 'Code': 'AI' - }, - { - 'Name': 'Antarctica', - 'Code': 'AQ' - }, - { - 'Name': 'Antigua and Barbuda', - 'Code': 'AG' - }, - { - 'Name': 'Argentina', - 'Code': 'AR' - }, - { - 'Name': 'Armenia', - 'Code': 'AM' - }, - { - 'Name': 'Aruba', - 'Code': 'AW' - }, - { - 'Name': 'Australia', - 'Code': 'AU' - }, - { - 'Name': 'Austria', - 'Code': 'AT' - }, - { - 'Name': 'Azerbaijan', - 'Code': 'AZ' - }, - { - 'Name': 'Bahamas', - 'Code': 'BS' - }, - { - 'Name': 'Bahrain', - 'Code': 'BH' - }, - { - 'Name': 'Bangladesh', - 'Code': 'BD' - }, - { - 'Name': 'Barbados', - 'Code': 'BB' - }, - { - 'Name': 'Belarus', - 'Code': 'BY' - }, - { - 'Name': 'Belgium', - 'Code': 'BE' - }, - { - 'Name': 'Belize', - 'Code': 'BZ' - }, - { - 'Name': 'Benin', - 'Code': 'BJ' - }, - { - 'Name': 'Bermuda', - 'Code': 'BM' - }, - { - 'Name': 'Bhutan', - 'Code': 'BT' - }, - { - 'Name': 'Bolivia, Plurinational State of', - 'Code': 'BO' - }, - { - 'Name': 'Bonaire, Sint Eustatius and Saba', - 'Code': 'BQ' - }, - { - 'Name': 'Bosnia and Herzegovina', - 'Code': 'BA' - }, - { - 'Name': 'Botswana', - 'Code': 'BW' - }, - { - 'Name': 'Bouvet Island', - 'Code': 'BV' - }, - { - 'Name': 'Brazil', - 'Code': 'BR' - }, - { - 'Name': 'British Indian Ocean Territory', - 'Code': 'IO' - }, - { - 'Name': 'Brunei Darussalam', - 'Code': 'BN' - }, - { - 'Name': 'Bulgaria', - 'Code': 'BG' - }, - { - 'Name': 'Burkina Faso', - 'Code': 'BF' - }, - { - 'Name': 'Burundi', - 'Code': 'BI' - }, - { - 'Name': 'Cambodia', - 'Code': 'KH' - }, - { - 'Name': 'Cameroon', - 'Code': 'CM' - }, - { - 'Name': 'Canada', - 'Code': 'CA' - }, - { - 'Name': 'Cape Verde', - 'Code': 'CV' - }, - { - 'Name': 'Cayman Islands', - 'Code': 'KY' - }, - { - 'Name': 'Central African Republic', - 'Code': 'CF' - }, - { - 'Name': 'Chad', - 'Code': 'TD' - }, - { - 'Name': 'Chile', - 'Code': 'CL' - }, - { - 'Name': 'China', - 'Code': 'CN' - }, - { - 'Name': 'Christmas Island', - 'Code': 'CX' - }, - { - 'Name': 'Cocos (Keeling) Islands', - 'Code': 'CC' - }, - { - 'Name': 'Colombia', - 'Code': 'CO' - }, - { - 'Name': 'Comoros', - 'Code': 'KM' - }, - { - 'Name': 'Congo', - 'Code': 'CG' - }, - { - 'Name': 'Congo, the Democratic Republic of the', - 'Code': 'CD' - }, - { - 'Name': 'Cook Islands', - 'Code': 'CK' - }, - { - 'Name': 'Costa Rica', - 'Code': 'CR' - }, - { - 'Name': 'Côte d\'Ivoire', - 'Code': 'CI' - }, - { - 'Name': 'Croatia', - 'Code': 'HR' - }, - { - 'Name': 'Cuba', - 'Code': 'CU' - }, - { - 'Name': 'Curaçao', - 'Code': 'CW' - }, - { - 'Name': 'Cyprus', - 'Code': 'CY' - }, - { - 'Name': 'Czech Republic', - 'Code': 'CZ' - }, - { - 'Name': 'Denmark', - 'Code': 'DK' - }, - { - 'Name': 'Djibouti', - 'Code': 'DJ' - }, - { - 'Name': 'Dominica', - 'Code': 'DM' - }, - { - 'Name': 'Dominican Republic', - 'Code': 'DO' - }, - { - 'Name': 'Ecuador', - 'Code': 'EC' - }, - { - 'Name': 'Egypt', - 'Code': 'EG' - }, - { - 'Name': 'El Salvador', - 'Code': 'SV' - }, - { - 'Name': 'Equatorial Guinea', - 'Code': 'GQ' - }, - { - 'Name': 'Eritrea', - 'Code': 'ER' - }, - { - 'Name': 'Estonia', - 'Code': 'EE' - }, - { - 'Name': 'Ethiopia', - 'Code': 'ET' - }, - { - 'Name': 'Falkland Islands (Malvinas)', - 'Code': 'FK' - }, - { - 'Name': 'Faroe Islands', - 'Code': 'FO' - }, - { - 'Name': 'Fiji', - 'Code': 'FJ' - }, - { - 'Name': 'Finland', - 'Code': 'FI' - }, - { - 'Name': 'France', - 'Code': 'FR' - }, - { - 'Name': 'French Guiana', - 'Code': 'GF' - }, - { - 'Name': 'French Polynesia', - 'Code': 'PF' - }, - { - 'Name': 'French Southern Territories', - 'Code': 'TF' - }, - { - 'Name': 'Gabon', - 'Code': 'GA' - }, - { - 'Name': 'Gambia', - 'Code': 'GM' - }, - { - 'Name': 'Georgia', - 'Code': 'GE' - }, - { - 'Name': 'Germany', - 'Code': 'DE' - }, - { - 'Name': 'Ghana', - 'Code': 'GH' - }, - { - 'Name': 'Gibraltar', - 'Code': 'GI' - }, - { - 'Name': 'Greece', - 'Code': 'GR' - }, - { - 'Name': 'Greenland', - 'Code': 'GL' - }, - { - 'Name': 'Grenada', - 'Code': 'GD' - }, - { - 'Name': 'Guadeloupe', - 'Code': 'GP' - }, - { - 'Name': 'Guam', - 'Code': 'GU' - }, - { - 'Name': 'Guatemala', - 'Code': 'GT' - }, - { - 'Name': 'Guernsey', - 'Code': 'GG' - }, - { - 'Name': 'Guinea', - 'Code': 'GN' - }, - { - 'Name': 'Guinea-Bissau', - 'Code': 'GW' - }, - { - 'Name': 'Guyana', - 'Code': 'GY' - }, - { - 'Name': 'Haiti', - 'Code': 'HT' - }, - { - 'Name': 'Heard Island and McDonald Islands', - 'Code': 'HM' - }, - { - 'Name': 'Holy See (Vatican City State)', - 'Code': 'VA' - }, - { - 'Name': 'Honduras', - 'Code': 'HN' - }, - { - 'Name': 'Hong Kong', - 'Code': 'HK' - }, - { - 'Name': 'Hungary', - 'Code': 'HU' - }, - { - 'Name': 'Iceland', - 'Code': 'IS' - }, - { - 'Name': 'India', - 'Code': 'IN' - }, - { - 'Name': 'Indonesia', - 'Code': 'ID' - }, - { - 'Name': 'Iran, Islamic Republic of', - 'Code': 'IR' - }, - { - 'Name': 'Iraq', - 'Code': 'IQ' - }, - { - 'Name': 'Ireland', - 'Code': 'IE' - }, - { - 'Name': 'Isle of Man', - 'Code': 'IM' - }, - { - 'Name': 'Israel', - 'Code': 'IL' - }, - { - 'Name': 'Italy', - 'Code': 'IT' - }, - { - 'Name': 'Jamaica', - 'Code': 'JM' - }, - { - 'Name': 'Japan', - 'Code': 'JP' - }, - { - 'Name': 'Jersey', - 'Code': 'JE' - }, - { - 'Name': 'Jordan', - 'Code': 'JO' - }, - { - 'Name': 'Kazakhstan', - 'Code': 'KZ' - }, - { - 'Name': 'Kenya', - 'Code': 'KE' - }, - { - 'Name': 'Kiribati', - 'Code': 'KI' - }, - { - 'Name': 'Korea, Democratic People\'s Republic of', - 'Code': 'KP' - }, - { - 'Name': 'Korea, Republic of', - 'Code': 'KR' - }, - { - 'Name': 'Kuwait', - 'Code': 'KW' - }, - { - 'Name': 'Kyrgyzstan', - 'Code': 'KG' - }, - { - 'Name': 'Lao People\'s Democratic Republic', - 'Code': 'LA' - }, - { - 'Name': 'Latvia', - 'Code': 'LV' - }, - { - 'Name': 'Lebanon', - 'Code': 'LB' - }, - { - 'Name': 'Lesotho', - 'Code': 'LS' - }, - { - 'Name': 'Liberia', - 'Code': 'LR' - }, - { - 'Name': 'Libya', - 'Code': 'LY' - }, - { - 'Name': 'Liechtenstein', - 'Code': 'LI' - }, - { - 'Name': 'Lithuania', - 'Code': 'LT' - }, - { - 'Name': 'Luxembourg', - 'Code': 'LU' - }, - { - 'Name': 'Macao', - 'Code': 'MO' - }, - { - 'Name': 'Macedonia, the Former Yugoslav Republic of', - 'Code': 'MK' - }, - { - 'Name': 'Madagascar', - 'Code': 'MG' - }, - { - 'Name': 'Malawi', - 'Code': 'MW' - }, - { - 'Name': 'Malaysia', - 'Code': 'MY' - }, - { - 'Name': 'Maldives', - 'Code': 'MV' - }, - { - 'Name': 'Mali', - 'Code': 'ML' - }, - { - 'Name': 'Malta', - 'Code': 'MT' - }, - { - 'Name': 'Marshall Islands', - 'Code': 'MH' - }, - { - 'Name': 'Martinique', - 'Code': 'MQ' - }, - { - 'Name': 'Mauritania', - 'Code': 'MR' - }, - { - 'Name': 'Mauritius', - 'Code': 'MU' - }, - { - 'Name': 'Mayotte', - 'Code': 'YT' - }, - { - 'Name': 'Mexico', - 'Code': 'MX' - }, - { - 'Name': 'Micronesia, Federated States of', - 'Code': 'FM' - }, - { - 'Name': 'Moldova, Republic of', - 'Code': 'MD' - }, - { - 'Name': 'Monaco', - 'Code': 'MC' - }, - { - 'Name': 'Mongolia', - 'Code': 'MN' - }, - { - 'Name': 'Montenegro', - 'Code': 'ME' - }, - { - 'Name': 'Montserrat', - 'Code': 'MS' - }, - { - 'Name': 'Morocco', - 'Code': 'MA' - }, - { - 'Name': 'Mozambique', - 'Code': 'MZ' - }, - { - 'Name': 'Myanmar', - 'Code': 'MM' - }, - { - 'Name': 'Namibia', - 'Code': 'NA' - }, - { - 'Name': 'Nauru', - 'Code': 'NR' - }, - { - 'Name': 'Nepal', - 'Code': 'NP' - }, - { - 'Name': 'Netherlands', - 'Code': 'NL' - }, - { - 'Name': 'New Caledonia', - 'Code': 'NC' - }, - { - 'Name': 'New Zealand', - 'Code': 'NZ' - }, - { - 'Name': 'Nicaragua', - 'Code': 'NI' - }, - { - 'Name': 'Niger', - 'Code': 'NE' - }, - { - 'Name': 'Nigeria', - 'Code': 'NG' - }, - { - 'Name': 'Niue', - 'Code': 'NU' - }, - { - 'Name': 'Norfolk Island', - 'Code': 'NF' - }, - { - 'Name': 'Northern Mariana Islands', - 'Code': 'MP' - }, - { - 'Name': 'Norway', - 'Code': 'NO' - }, - { - 'Name': 'Oman', - 'Code': 'OM' - }, - { - 'Name': 'Pakistan', - 'Code': 'PK' - }, - { - 'Name': 'Palau', - 'Code': 'PW' - }, - { - 'Name': 'Palestine, State of', - 'Code': 'PS' - }, - { - 'Name': 'Panama', - 'Code': 'PA' - }, - { - 'Name': 'Papua New Guinea', - 'Code': 'PG' - }, - { - 'Name': 'Paraguay', - 'Code': 'PY' - }, - { - 'Name': 'Peru', - 'Code': 'PE' - }, - { - 'Name': 'Philippines', - 'Code': 'PH' - }, - { - 'Name': 'Pitcairn', - 'Code': 'PN' - }, - { - 'Name': 'Poland', - 'Code': 'PL' - }, - { - 'Name': 'Portugal', - 'Code': 'PT' - }, - { - 'Name': 'Puerto Rico', - 'Code': 'PR' - }, - { - 'Name': 'Qatar', - 'Code': 'QA' - }, - { - 'Name': 'Réunion', - 'Code': 'RE' - }, - { - 'Name': 'Romania', - 'Code': 'RO' - }, - { - 'Name': 'Russian Federation', - 'Code': 'RU' - }, - { - 'Name': 'Rwanda', - 'Code': 'RW' - }, - { - 'Name': 'Saint Barthélemy', - 'Code': 'BL' - }, - { - 'Name': 'Saint Helena, Ascension and Tristan da Cunha', - 'Code': 'SH' - }, - { - 'Name': 'Saint Kitts and Nevis', - 'Code': 'KN' - }, - { - 'Name': 'Saint Lucia', - 'Code': 'LC' - }, - { - 'Name': 'Saint Martin (French part)', - 'Code': 'MF' - }, - { - 'Name': 'Saint Pierre and Miquelon', - 'Code': 'PM' - }, - { - 'Name': 'Saint Vincent and the Grenadines', - 'Code': 'VC' - }, - { - 'Name': 'Samoa', - 'Code': 'WS' - }, - { - 'Name': 'San Marino', - 'Code': 'SM' - }, - { - 'Name': 'Sao Tome and Principe', - 'Code': 'ST' - }, - { - 'Name': 'Saudi Arabia', - 'Code': 'SA' - }, - { - 'Name': 'Senegal', - 'Code': 'SN' - }, - { - 'Name': 'Serbia', - 'Code': 'RS' - }, - { - 'Name': 'Seychelles', - 'Code': 'SC' - }, - { - 'Name': 'Sierra Leone', - 'Code': 'SL' - }, - { - 'Name': 'Singapore', - 'Code': 'SG' - }, - { - 'Name': 'Sint Maarten (Dutch part)', - 'Code': 'SX' - }, - { - 'Name': 'Slovakia', - 'Code': 'SK' - }, - { - 'Name': 'Slovenia', - 'Code': 'SI' - }, - { - 'Name': 'Solomon Islands', - 'Code': 'SB' - }, - { - 'Name': 'Somalia', - 'Code': 'SO' - }, - { - 'Name': 'South Africa', - 'Code': 'ZA' - }, - { - 'Name': 'South Georgia and the South Sandwich Islands', - 'Code': 'GS' - }, - { - 'Name': 'South Sudan', - 'Code': 'SS' - }, - { - 'Name': 'Spain', - 'Code': 'ES' - }, - { - 'Name': 'Sri Lanka', - 'Code': 'LK' - }, - { - 'Name': 'Sudan', - 'Code': 'SD' - }, - { - 'Name': 'Suriname', - 'Code': 'SR' - }, - { - 'Name': 'Svalbard and Jan Mayen', - 'Code': 'SJ' - }, - { - 'Name': 'Swaziland', - 'Code': 'SZ' - }, - { - 'Name': 'Sweden', - 'Code': 'SE' - }, - { - 'Name': 'Switzerland', - 'Code': 'CH' - }, - { - 'Name': 'Syrian Arab Republic', - 'Code': 'SY' - }, - { - 'Name': 'Taiwan', - 'Code': 'TW' - }, - { - 'Name': 'Tajikistan', - 'Code': 'TJ' - }, - { - 'Name': 'Tanzania, United Republic of', - 'Code': 'TZ' - }, - { - 'Name': 'Thailand', - 'Code': 'TH' - }, - { - 'Name': 'Timor-Leste', - 'Code': 'TL' - }, - { - 'Name': 'Togo', - 'Code': 'TG' - }, - { - 'Name': 'Tokelau', - 'Code': 'TK' - }, - { - 'Name': 'Tonga', - 'Code': 'TO' - }, - { - 'Name': 'Trinidad and Tobago', - 'Code': 'TT' - }, - { - 'Name': 'Tunisia', - 'Code': 'TN' - }, - { - 'Name': 'Turkey', - 'Code': 'TR' - }, - { - 'Name': 'Turkmenistan', - 'Code': 'TM' - }, - { - 'Name': 'Turks and Caicos Islands', - 'Code': 'TC' - }, - { - 'Name': 'Tuvalu', - 'Code': 'TV' - }, - { - 'Name': 'Uganda', - 'Code': 'UG' - }, - { - 'Name': 'Ukraine', - 'Code': 'UA' - }, - { - 'Name': 'United Arab Emirates', - 'Code': 'AE' - }, - { - 'Name': 'United Kingdom', - 'Code': 'GB' - }, - { - 'Name': 'United States', - 'Code': 'US' - }, - { - 'Name': 'United States Minor Outlying Islands', - 'Code': 'UM' - }, - { - 'Name': 'Uruguay', - 'Code': 'UY' - }, - { - 'Name': 'Uzbekistan', - 'Code': 'UZ' - }, - { - 'Name': 'Vanuatu', - 'Code': 'VU' - }, - { - 'Name': 'Venezuela, Bolivarian Republic of', - 'Code': 'VE' - }, - { - 'Name': 'Viet Nam', - 'Code': 'VN' - }, - { - 'Name': 'Virgin Islands, British', - 'Code': 'VG' - }, - { - 'Name': 'Virgin Islands, U.S.', - 'Code': 'VI' - }, - { - 'Name': 'Wallis and Futuna', - 'Code': 'WF' - }, - { - 'Name': 'Western Sahara', - 'Code': 'EH' - }, - { - 'Name': 'Yemen', - 'Code': 'YE' - }, - { - 'Name': 'Zambia', - 'Code': 'ZM' - }, - { - 'Name': 'Zimbabwe', - 'Code': 'ZW' - } -] - -module.exports = countries From 316eb8d7a8ed3d5bf09a5cc764cc87be04e38ff9 Mon Sep 17 00:00:00 2001 From: Brian Clifton Date: Tue, 22 Aug 2017 16:24:50 -0700 Subject: [PATCH 3/6] Fix two issues - handle when locale is called with null/undefined/falsey value (before would fail on toLowerCase()) - handle situation where activeTab is not set and developer tools are opened (will be fixed soon by @bbondy) Auditors: @bbondy, @dfperry5 --- app/browser/menu.js | 6 +++++- js/l10n.js | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/browser/menu.js b/app/browser/menu.js index b3d8e62a8e2..a4c5cde12f8 100644 --- a/app/browser/menu.js +++ b/app/browser/menu.js @@ -270,7 +270,11 @@ const createViewSubmenu = () => { click: function () { const win = BrowserWindow.getActiveWindow() const activeTab = tabState.getActiveTab(appStore.getState(), win.id) - appActions.toggleDevTools(activeTab.get('tabId')) + if (activeTab) { + appActions.toggleDevTools(activeTab.get('tabId')) + } else { + console.warn('Unable to open developer tools; activeTab is null or undefined') + } } }, CommonMenu.separatorMenuItem, diff --git a/js/l10n.js b/js/l10n.js index 396027e87aa..f8617a58029 100644 --- a/js/l10n.js +++ b/js/l10n.js @@ -12,6 +12,8 @@ var rendererTranslationCache = {} // As for a translation for the current language exports.translation = (token) => { + if (!token) return '' + // If we are in the renderer process if (ipcRenderer) { // If the token does not exist in the renderer translations cache From e6008fd60871c4362526128db97e0c0161386630 Mon Sep 17 00:00:00 2001 From: dfperry5 Date: Mon, 4 Sep 2017 16:56:25 -0400 Subject: [PATCH 4/6] Issue #9053 - Updating so that first option on dropdown for countries is a blank modified: app/renderer/components/autofill/autofillAddressPanel.js modified: app/renderer/components/autofill/autofillAddressPanel.js modified: app/renderer/components/autofill/autofillAddressPanel.js modified: app/renderer/components/autofill/autofillAddressPanel.js --- app/renderer/components/autofill/autofillAddressPanel.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/renderer/components/autofill/autofillAddressPanel.js b/app/renderer/components/autofill/autofillAddressPanel.js index 3c14f150dbf..a43d1baa98a 100644 --- a/app/renderer/components/autofill/autofillAddressPanel.js +++ b/app/renderer/components/autofill/autofillAddressPanel.js @@ -126,6 +126,7 @@ class AutofillAddressPanel extends React.Component { } get countryList () { const countryList = [] + countryList.push(
-
- + {this.countryList} - +
+ } +} + class CommonFormTextbox extends ImmutableComponent { render () { return @@ -234,6 +240,7 @@ module.exports = { CommonFormLarge, CommonFormBookmarkHanger, CommonFormDropdown, + CommonFormFullWidthDropdown, CommonFormTextbox, CommonFormClickable, CommonFormSection, diff --git a/app/renderer/components/common/dropdown.js b/app/renderer/components/common/dropdown.js index b20ba495935..1c9ab9cd297 100644 --- a/app/renderer/components/common/dropdown.js +++ b/app/renderer/components/common/dropdown.js @@ -17,6 +17,7 @@ class Dropdown extends ImmutableComponent { styles.dropdown, this.props['data-isCommonForm'] && styles.commonForm, this.props['data-isSettings'] && styles.settings, + this.props['data-isFullWidth'] && styles.fullWidth, this.props['data-isBraveryPanel'] && styles.braveryPanel ) @@ -59,6 +60,7 @@ const styles = StyleSheet.create({ '-webkit-appearance': 'none', width: 'auto' }, + outlineable: { ':focus': { outlineColor: globalStyles.color.statsBlue, @@ -67,13 +69,20 @@ const styles = StyleSheet.create({ outlineWidth: '1px' } }, + commonForm: { backgroundColor: '#fff', fontSize: globalStyles.fontSize.flyoutDialog }, + settings: { width: '280px' }, + + fullWidth: { + width: '100%' + }, + braveryPanel: { fontSize: '13px', width: '100%' From eb8d792748286a1a2f52a17c0154f3d89d8086df Mon Sep 17 00:00:00 2001 From: Brian Clifton Date: Fri, 8 Sep 2017 23:54:43 -0700 Subject: [PATCH 6/6] Update autofill webdriver tests to use Country as a dropdown value instead of a text field Auditors: @dfperry5, @darkdh, @luixxiul Test Plan: `npm run test -- --grep="Autofill" --- test/contents/autofillTest.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/test/contents/autofillTest.js b/test/contents/autofillTest.js index 07a6fb34416..792b57b9da6 100644 --- a/test/contents/autofillTest.js +++ b/test/contents/autofillTest.js @@ -22,6 +22,7 @@ const postalCode = '94103-1550' const postalCodeInput = '[data-test-id="postalCode"]' const country = 'US' const countryInput = '[data-test-id="country"]' +const countryValue = 'United States' const phone = '0987654321' const phoneInput = '[data-test-id="phone"]' const email = 'press@brave.com' @@ -75,8 +76,7 @@ describe('Autofill', function () { .typeText(stateInput, state) .click(postalCodeInput) .typeText(postalCodeInput, postalCode) - .click(countryInput) - .typeText(countryInput, country) + .selectByValue(countryInput, country) .click(phoneInput) .typeText(phoneInput, phone) .click(emailInput) @@ -100,7 +100,7 @@ describe('Autofill', function () { .waitForTextValue(cityInput, city) .waitForTextValue(stateInput, state) .waitForTextValue(postalCodeInput, postalCode) - .waitForTextValue(countryInput, country) + .waitForTextValue(countryInput, countryValue) .waitForTextValue(phoneInput, phone) .waitForTextValue(emailInput, email) }) @@ -168,7 +168,7 @@ describe('Autofill', function () { .waitForTextValue(cityInput, city) .waitForTextValue(stateInput, state) .waitForTextValue(postalCodeInput, postalCode) - .waitForTextValue(countryInput, country) + .waitForTextValue(countryInput, countryValue) .waitForTextValue(phoneInput, phone + '123') .waitForTextValue(emailInput, email + 'mm') // fill out the form @@ -346,8 +346,7 @@ describe('Autofill', function () { .typeText(stateInput, state) .click(postalCodeInput) .typeText(postalCodeInput, postalCode) - .click(countryInput) - .typeText(countryInput, country) + .selectByValue(countryInput, country) .click(phoneInput) .typeText(phoneInput, phone) .click(emailInput) @@ -388,7 +387,7 @@ describe('Autofill', function () { .waitForTextValue(cityInput, city) .waitForTextValue(stateInput, state) .waitForTextValue(postalCodeInput, postalCode) - .waitForTextValue(countryInput, country) + .waitForTextValue(countryInput, countryValue) .waitForTextValue(phoneInput, phone) .waitForTextValue(emailInput, email) })