From 3b59169ffc442d8afa7ca2141dc45b258dd1ccc5 Mon Sep 17 00:00:00 2001
From: Jonas Jenwald <jonas.jenwald@gmail.com>
Date: Tue, 18 Apr 2017 23:26:30 +0200
Subject: [PATCH] [Firefox addon] Upstream changes from: Bug 1346616 - Migrate
 callsites that are retrieving requested locale from pref, to use
 LocaleService::GetRequestedLocales

With [bug 1346616](https://bugzilla.mozilla.org/show_bug.cgi?id=1346616) and [this commit](https://hg.mozilla.org/mozilla-central/rev/39a903b099a6#l7.2), it's apparently no longer recommended to check the `general.useragent.locale` pref directly, but instead the `Services.locale.getRequestedLocale()` function should be used.

In this case, it's at least really easy to feature detect this properly :-)
---
 extensions/firefox/content/PdfStreamConverter.jsm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/extensions/firefox/content/PdfStreamConverter.jsm b/extensions/firefox/content/PdfStreamConverter.jsm
index c5ea64112..451d55255 100644
--- a/extensions/firefox/content/PdfStreamConverter.jsm
+++ b/extensions/firefox/content/PdfStreamConverter.jsm
@@ -319,7 +319,12 @@ class ChromeActions {
   }
 
   getLocale() {
-    return getStringPref("general.useragent.locale", "en-US");
+//#if !MOZCENTRAL
+    if (!Services.locale.getRequestedLocale) {
+      return getStringPref("general.useragent.locale", "en-US");
+    }
+//#endif
+    return Services.locale.getRequestedLocale() || "en-US";
   }
 
   getStrings(data) {