~ubuntu-branches/ubuntu/oneiric/chromium-browser/oneiric

« back to all changes in this revision

Viewing changes to debian/patches/grit_language_variants.patch

  • Committer: Bazaar Package Importer
  • Author(s): Fabien Tassin
  • Date: 2011-06-28 07:17:52 UTC
  • mfrom: (1.5.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20110628071752-pilye3kyyfr2tpio
Tags: 12.0.742.112~r90304-0ubuntu1
* New Minor upstream release from the Stable Channel (LP: #803107)
  This release fixes the following security issues:
  + WebKit issues:
    - [84355] High, CVE-2011-2346: Use-after-free in SVG font handling.
      Credit to miaubiz.
    - [85003] High, CVE-2011-2347: Memory corruption in CSS parsing. Credit
      to miaubiz.
    - [85102] High, CVE-2011-2350: Lifetime and re-entrancy issues in the
      HTML parser. Credit to miaubiz.
    - [85211] High, CVE-2011-2351: Use-after-free with SVG use element.
      Credit to miaubiz.
    - [85418] High, CVE-2011-2349: Use-after-free in text selection. Credit
      to miaubiz.
  + Chromium issues:
    - [77493] Medium, CVE-2011-2345: Out-of-bounds read in NPAPI string
      handling. Credit to Philippe Arteau.
    - [85177] High, CVE-2011-2348: Bad bounds check in v8. Credit to Aki
      Helin of OUSPG.
Packaging changes:
* Add Valencian (ca@valencia) to the list of supported langs for the
  lang-packs
  - update debian/rules
  - update debian/control
* Add support for language variants in Grit, backported from trunk.
  This is needed to support lang-codes like ca@valencia
  - add debian/patches/grit_language_variants.patch
  - update debian/patches/series
* Add a WANT_ONLY_WHITELISTED_NEW_LANGS knob to make it easier to
  sync translations of new langs between all the branches
  - update debian/rules
* Properly stop the keep-alive when the build fails
  - update debian/rules
* Fix the HTML5 <video> tag regression in Oneiric by properly linking
  libvpx so it's not being dropped from libffmpegsumo.so (LP: #795171)
  - add debian/patches/html5-codecs-fix.patch
  - update debian/patches/series
* Drop the -inspector package, its content has been merged into the main deb
  in M12 and the deb remained empty since.
  Also drop chromium-codecs-ffmpeg-nonfree, renamed in M5 to -extra
  - update debian/control
  - update debian/rules
* Backport of http://codereview.chromium.org/6883221 from M13 presumably
  fixing the ARM ftbfs from the last update, and set use_cups=0 on armel
  - add debian/patches/cups_cleanup_cr6883221.patch
  - update debian/patches/series
  - update debian/rules

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Backport of http://code.google.com/p/chromium/issues/detail?id=83397
 
2
 
 
3
---
 
4
 base/i18n/rtl.cc                   |   10 +++++++++-
 
5
 ui/base/l10n/l10n_util.cc          |   20 ++++++++++++++------
 
6
 ui/base/l10n/l10n_util_unittest.cc |   17 +++++++++++++++++
 
7
 3 files changed, 40 insertions(+), 7 deletions(-)
 
8
 
 
9
Index: src/base/i18n/rtl.cc
 
10
===================================================================
 
11
--- src.orig/base/i18n/rtl.cc
 
12
+++ src/base/i18n/rtl.cc
 
13
@@ -15,29 +15,37 @@
 
14
 #include "unicode/uscript.h"
 
15
 
 
16
 #if defined(TOOLKIT_USES_GTK)
 
17
 #include <gtk/gtk.h>
 
18
 #endif
 
19
 
 
20
 namespace {
 
21
 
 
22
-// Extract language and country, ignore keywords, concatenate using dash.
 
23
+// Extract language, country and variant, but ignore keywords.  For example,
 
24
+// en-US, ca@valencia, ca-ES@valencia.
 
25
 std::string GetLocaleString(const icu::Locale& locale) {
 
26
   const char* language = locale.getLanguage();
 
27
   const char* country = locale.getCountry();
 
28
+  const char* variant = locale.getVariant();
 
29
 
 
30
   std::string result =
 
31
       (language != NULL && *language != '\0') ? language : "und";
 
32
 
 
33
   if (country != NULL && *country != '\0') {
 
34
     result += '-';
 
35
     result += country;
 
36
   }
 
37
 
 
38
+  if (variant != NULL && *variant != '\0') {
 
39
+    std::string variant_str(variant);
 
40
+    StringToLowerASCII(&variant_str);
 
41
+    result += '@' + variant_str;
 
42
+  }
 
43
+
 
44
   return result;
 
45
 }
 
46
 
 
47
 }  // namespace
 
48
 
 
49
 namespace base {
 
50
 namespace i18n {
 
51
 
 
52
Index: src/ui/base/l10n/l10n_util.cc
 
53
===================================================================
 
54
--- src.orig/ui/base/l10n/l10n_util.cc
 
55
+++ src/ui/base/l10n/l10n_util.cc
 
56
@@ -253,38 +253,46 @@
 
57
 
 
58
 bool CheckAndResolveLocale(const std::string& locale,
 
59
                            const FilePath& locale_path,
 
60
                            std::string* resolved_locale) {
 
61
   if (IsLocaleAvailable(locale, locale_path)) {
 
62
     *resolved_locale = locale;
 
63
     return true;
 
64
   }
 
65
+
 
66
+  // If there's a variant, skip over it so we can try without the region
 
67
+  // code.  For example, ca_ES@valencia should cause us to try ca@valencia
 
68
+  // before ca.
 
69
+  std::string::size_type variant_pos = locale.find('@');
 
70
+  if (variant_pos != std::string::npos)
 
71
+    return false;
 
72
+
 
73
   // If the locale matches language but not country, use that instead.
 
74
   // TODO(jungshik) : Nothing is done about languages that Chrome
 
75
   // does not support but available on Windows. We fall
 
76
   // back to en-US in GetApplicationLocale so that it's a not critical,
 
77
   // but we can do better.
 
78
   std::string::size_type hyphen_pos = locale.find('-');
 
79
   if (hyphen_pos != std::string::npos && hyphen_pos > 0) {
 
80
     std::string lang(locale, 0, hyphen_pos);
 
81
     std::string region(locale, hyphen_pos + 1);
 
82
     std::string tmp_locale(lang);
 
83
     // Map es-RR other than es-ES to es-419 (Chrome's Latin American
 
84
     // Spanish locale).
 
85
     if (LowerCaseEqualsASCII(lang, "es") && !LowerCaseEqualsASCII(region, "es"))
 
86
       tmp_locale.append("-419");
 
87
     else if (LowerCaseEqualsASCII(lang, "zh")) {
 
88
       // Map zh-HK and zh-MO to zh-TW. Otherwise, zh-FOO is mapped to zh-CN.
 
89
-     if (LowerCaseEqualsASCII(region, "hk") ||
 
90
-         LowerCaseEqualsASCII(region, "mo")) { // Macao
 
91
-       tmp_locale.append("-TW");
 
92
-     } else {
 
93
-       tmp_locale.append("-CN");
 
94
-     }
 
95
+      if (LowerCaseEqualsASCII(region, "hk") ||
 
96
+          LowerCaseEqualsASCII(region, "mo")) { // Macao
 
97
+        tmp_locale.append("-TW");
 
98
+      } else {
 
99
+        tmp_locale.append("-CN");
 
100
+      }
 
101
     }
 
102
     if (IsLocaleAvailable(tmp_locale, locale_path)) {
 
103
       resolved_locale->swap(tmp_locale);
 
104
       return true;
 
105
     }
 
106
   }
 
107
 
 
108
   // Google updater uses no, iw and en for our nb, he, and en-US.
 
109
Index: src/ui/base/l10n/l10n_util_unittest.cc
 
110
===================================================================
 
111
--- src.orig/ui/base/l10n/l10n_util_unittest.cc
 
112
+++ src/ui/base/l10n/l10n_util_unittest.cc
 
113
@@ -135,16 +135,18 @@
 
114
     "es-419",
 
115
     "es",
 
116
     "zh-TW",
 
117
     "zh-CN",
 
118
     "he",
 
119
     "fil",
 
120
     "nb",
 
121
     "am",
 
122
+    "ca",
 
123
+    "ca@valencia",
 
124
   };
 
125
 
 
126
 #if defined(OS_WIN)
 
127
   static const char kLocaleFileExtension[] = ".dll";
 
128
 #elif defined(OS_POSIX)
 
129
   static const char kLocaleFileExtension[] = ".pak";
 
130
 #endif
 
131
   for (size_t i = 0; i < arraysize(filenames); ++i) {
 
132
@@ -188,16 +190,31 @@
 
133
   EXPECT_EQ("fr", l10n_util::GetApplicationLocale(""));
 
134
   env->UnSetVar("LANGUAGE");
 
135
   EXPECT_EQ("es", l10n_util::GetApplicationLocale(""));
 
136
   env->UnSetVar("LC_ALL");
 
137
   EXPECT_EQ("he", l10n_util::GetApplicationLocale(""));
 
138
   env->UnSetVar("LC_MESSAGES");
 
139
   EXPECT_EQ("nb", l10n_util::GetApplicationLocale(""));
 
140
   env->UnSetVar("LANG");
 
141
+
 
142
+  SetDefaultLocaleForTest("ca", env.get());
 
143
+  EXPECT_EQ("ca", l10n_util::GetApplicationLocale(""));
 
144
+
 
145
+  SetDefaultLocaleForTest("ca-ES", env.get());
 
146
+  EXPECT_EQ("ca", l10n_util::GetApplicationLocale(""));
 
147
+
 
148
+  SetDefaultLocaleForTest("ca@valencia", env.get());
 
149
+  EXPECT_EQ("ca@valencia", l10n_util::GetApplicationLocale(""));
 
150
+
 
151
+  SetDefaultLocaleForTest("ca_ES@valencia", env.get());
 
152
+  EXPECT_EQ("ca@valencia", l10n_util::GetApplicationLocale(""));
 
153
+
 
154
+  SetDefaultLocaleForTest("ca_ES.UTF8@valencia", env.get());
 
155
+  EXPECT_EQ("ca@valencia", l10n_util::GetApplicationLocale(""));
 
156
 #endif  // defined(OS_POSIX) && !defined(OS_CHROMEOS)
 
157
 
 
158
   SetDefaultLocaleForTest("en-US", env.get());
 
159
   EXPECT_EQ("en-US", l10n_util::GetApplicationLocale(""));
 
160
 
 
161
   SetDefaultLocaleForTest("xx", env.get());
 
162
   EXPECT_EQ("en-US", l10n_util::GetApplicationLocale(""));
 
163