Merge m-c to inbound. a=merge
authorRyan VanderMeulen <ryanvm@gmail.com>
Sat, 29 Oct 2016 09:44:28 -0400
changeset 320190 93ab9dfffbbc67c10f933771535dd771da277825
parent 320189 eab68afb07088c28bd8bdff5615ef1131799e28f (current diff)
parent 320150 969c3295d3aa77931cca26eddb047d9d74bd9858 (diff)
child 320191 5fb5979e6bfb1e81637e0c5129e6e4f55567902c
push id20751
push userphilringnalda@gmail.com
push dateSun, 30 Oct 2016 18:06:35 +0000
treeherderfx-team@e3279760cd97 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone52.0a1
Merge m-c to inbound. a=merge
--- a/chrome/nsChromeRegistry.cpp
+++ b/chrome/nsChromeRegistry.cpp
@@ -645,21 +645,16 @@ nsChromeRegistry::MustLoadURLRemotely(ns
     *aResult = !!(flags & REMOTE_REQUIRED);
   }
   return NS_OK;
 }
 
 bool
 nsChromeRegistry::GetDirectionForLocale(const nsACString& aLocale)
 {
-#ifdef ENABLE_INTL_API
-  nsAutoCString locale(aLocale);
-  SanitizeForBCP47(locale);
-  return uloc_isRightToLeft(locale.get());
-#else
   // first check the intl.uidirection.<locale> preference, and if that is not
   // set, check the same preference but with just the first two characters of
   // the locale. If that isn't set, default to left-to-right.
   nsAutoCString prefString = NS_LITERAL_CSTRING("intl.uidirection.") + aLocale;
   nsCOMPtr<nsIPrefBranch> prefBranch (do_GetService(NS_PREFSERVICE_CONTRACTID));
   if (!prefBranch) {
     return false;
   }
@@ -670,17 +665,16 @@ nsChromeRegistry::GetDirectionForLocale(
     int32_t hyphen = prefString.FindChar('-');
     if (hyphen >= 1) {
       nsAutoCString shortPref(Substring(prefString, 0, hyphen));
       prefBranch->GetCharPref(shortPref.get(), getter_Copies(dir));
     }
   }
 
   return dir.EqualsLiteral("rtl");
-#endif
 }
 
 NS_IMETHODIMP_(bool)
 nsChromeRegistry::WrappersEnabled(nsIURI *aURI)
 {
   nsCOMPtr<nsIURL> chromeURL (do_QueryInterface(aURI));
   if (!chromeURL)
     return false;
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -2040,24 +2040,22 @@ pref("intl.ime.hack.on_ime_unaware_apps.
 #endif
 
 // If you use legacy Chinese IME which puts an ideographic space to composition
 // string as placeholder, this pref might be useful.  If this is true and when
 // web contents forcibly commits composition (e.g., moving focus), the
 // ideographic space will be ignored (i.e., commits with empty string).
 pref("intl.ime.remove_placeholder_character_at_commit", false);
 
-#ifndef ENABLE_INTL_API
 // these locales have right-to-left UI
 pref("intl.uidirection.ar", "rtl");
 pref("intl.uidirection.he", "rtl");
 pref("intl.uidirection.fa", "rtl");
 pref("intl.uidirection.ug", "rtl");
 pref("intl.uidirection.ur", "rtl");
-#endif
 
 // use en-US hyphenation by default for content tagged with plain lang="en"
 pref("intl.hyphenation-alias.en", "en-us");
 // and for other subtags of en-*, if no specific patterns are available
 pref("intl.hyphenation-alias.en-*", "en-us");
 
 pref("intl.hyphenation-alias.af-*", "af");
 pref("intl.hyphenation-alias.bg-*", "bg");
--- a/toolkit/components/extensions/test/mochitest/test_ext_i18n_css.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_i18n_css.html
@@ -34,17 +34,17 @@ add_task(function* test_i18n_css() {
 
         browser.test.notifyPass("i18n-css");
       });
 
       browser.test.sendMessage("ready", browser.runtime.getURL("foo.css"));
     },
 
     manifest: {
-      "web_accessible_resources": ["foo.css", "foo.txt"],
+      "web_accessible_resources": ["foo.css", "foo.txt", "locale.css"],
 
       "content_scripts": [{
         "matches": ["http://mochi.test/*/file_sample.html"],
         "css": ["foo.css"],
       }],
 
       "default_locale": "en",
     },
@@ -55,16 +55,17 @@ add_task(function* test_i18n_css() {
           "message": "max-width: 42px",
           "description": "foo",
         },
       }),
 
       "foo.css": "body { __MSG_foo__; }",
       "bar.CsS": "body { __MSG_foo__; }",
       "foo.txt": "body { __MSG_foo__; }",
+      "locale.css": '* { content: "__MSG_@@ui_locale__ __MSG_@@bidi_dir__ __MSG_@@bidi_reversed_dir__ __MSG_@@bidi_start_edge__ __MSG_@@bidi_end_edge__" }',
     },
   });
 
   yield extension.startup();
   let cssURL = yield extension.awaitMessage("ready");
 
   function fetch(url) {
     return new Promise((resolve, reject) => {
@@ -82,15 +83,34 @@ add_task(function* test_i18n_css() {
 
   let win = window.open("file_sample.html");
   yield waitForLoad(win);
 
   let style = win.getComputedStyle(win.document.body);
   is(style.maxWidth, "42px", "stylesheet correctly applied");
   win.close();
 
+  cssURL = cssURL.replace(/foo.css$/, "locale.css");
+
+  css = yield fetch(cssURL);
+  is(css, '* { content: "en_US ltr rtl left right" }', "CSS file localized in mochitest scope");
+
+  const LOCALE = "general.useragent.locale";
+  const DIR = "intl.uidirection.en";
+
+  // We don't wind up actually switching the chrome registry locale, since we
+  // don't have a chrome package for Hebrew. So just override it.
+  SpecialPowers.setCharPref(LOCALE, "he");
+  SpecialPowers.setCharPref(DIR, "rtl");
+
+  css = yield fetch(cssURL);
+  is(css, '* { content: "he rtl ltr right left" }', "CSS file localized in mochitest scope");
+
+  SpecialPowers.clearUserPref(LOCALE);
+  SpecialPowers.clearUserPref(DIR);
+
   yield extension.awaitFinish("i18n-css");
   yield extension.unload();
 });
 </script>
 
 </body>
 </html>
--- a/toolkit/content/tests/chrome/chrome.ini
+++ b/toolkit/content/tests/chrome/chrome.ini
@@ -74,17 +74,16 @@ subsuite = clipboard
 skip-if = os == 'linux' # Bug 1264604
 [test_bug365773.xul]
 [test_bug366992.xul]
 [test_bug382990.xul]
 [test_bug409624.xul]
 [test_bug418874.xul]
 [test_bug429723.xul]
 [test_bug437844.xul]
-disabled = # bug 1312049 prevents this test working in its current form
 [test_bug457632.xul]
 [test_bug460942.xul]
 [test_bug471776.xul]
 [test_bug509732.xul]
 [test_bug554279.xul]
 [test_bug557987.xul]
 [test_bug562554.xul]
 [test_bug570192.xul]
@@ -158,17 +157,16 @@ skip-if = os == 'linux' && asan # Bug 12
 support-files = window_preferences_beforeaccept.xul
 [test_preferences_onsyncfrompreference.xul]
 support-files = window_preferences_onsyncfrompreference.xul
 [test_progressmeter.xul]
 [test_props.xul]
 [test_radio.xul]
 [test_richlist_direction.xul]
 [test_righttoleft.xul]
-disabled = # bug 1312049 prevents this test working in its current form
 [test_scale.xul]
 [test_scaledrag.xul]
 skip-if = buildapp == 'mulet'
 [test_screenPersistence.xul]
 [test_scrollbar.xul]
 skip-if = buildapp == 'mulet'
 [test_showcaret.xul]
 [test_sorttemplate.xul]