Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(786)

Unified Diff: pkg/intl/lib/date_symbol_data_http_request.dart

Issue 23090005: Verify the locale when initializing dates over http (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/intl/test/date_time_format_http_request_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/intl/lib/date_symbol_data_http_request.dart
diff --git a/pkg/intl/lib/date_symbol_data_http_request.dart b/pkg/intl/lib/date_symbol_data_http_request.dart
index 218952c3b154bb2fd127e654756bcf4d03f36b80..20d35a109fed6a70461d9dbd822d3a0a9c7450f6 100644
--- a/pkg/intl/lib/date_symbol_data_http_request.dart
+++ b/pkg/intl/lib/date_symbol_data_http_request.dart
@@ -13,6 +13,7 @@ import 'date_symbols.dart';
import 'src/lazy_locale_data.dart';
import 'src/date_format_internal.dart';
import 'src/http_request_data_reader.dart';
+import 'intl.dart';
part "src/data/dates/localeList.dart";
@@ -29,11 +30,13 @@ Future initializeDateFormatting(String locale, String url) {
var reader2 = new HTTPRequestDataReader('${url}patterns/');
initializeDatePatterns(() => new LazyLocaleData(
reader2, (x) => x, availableLocalesForDateFormatting));
+ var actualLocale = Intl.verifiedLocale(locale,
+ (l) => availableLocalesForDateFormatting.contains(l));
return initializeIndividualLocaleDateFormatting(
(symbols, patterns) {
return Future.wait([
- symbols.initLocale(locale),
- patterns.initLocale(locale)]);
+ symbols.initLocale(actualLocale),
+ patterns.initLocale(actualLocale)]);
});
}
« no previous file with comments | « no previous file | pkg/intl/test/date_time_format_http_request_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698