Verified Commit 95810c87 authored by ma1's avatar ma1 Committed by Pier Angelo Vendrame
Browse files

Bug 42288: Allow language spoofing in status messages.

parent 62d5526b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -313,6 +313,7 @@
@RESPATH@/res/locale/layout/HtmlForm.properties
@RESPATH@/res/locale/layout/MediaDocument.properties
@RESPATH@/res/locale/layout/xmlparser.properties
@RESPATH@/res/locale/xslt/xslt.properties
@RESPATH@/res/locale/dom/dom.properties
#ifdef XP_MACOSX
@RESPATH@/res/MainMenu.nib/
+4 −0
Original line number Diff line number Diff line
@@ -57,6 +57,10 @@ RESOURCE_FILES.locale.layout += [
    "en-US/chrome/layout/xmlparser.properties",
]

RESOURCE_FILES.locale.xslt += [
    "en-US/chrome/xslt/xslt.properties",
]

RESOURCE_FILES.locale.dom += [
    "en-US/chrome/dom/dom.properties",
]
+8 −2
Original line number Diff line number Diff line
@@ -942,11 +942,17 @@ void txMozillaXSLTProcessor::reportError(nsresult aResult,
        mozilla::components::StringBundle::Service();
    if (sbs) {
      nsString errorText;
      sbs->FormatStatusMessage(aResult, u"", errorText);
      bool spoofLocale = nsContentUtils::SpoofLocaleEnglish();
      if (spoofLocale && mSource) {
        Document* sourceDoc = mSource->OwnerDoc();
        spoofLocale = !(sourceDoc && sourceDoc->AllowsL10n());
      }
      sbs->FormatStatusMessage(aResult, u"", spoofLocale, errorText);

      nsAutoString errorMessage;
      nsCOMPtr<nsIStringBundle> bundle;
      sbs->CreateBundle(XSLT_MSGS_URL, getter_AddRefs(bundle));
      sbs->CreateBundle(spoofLocale ? XSLT_MSGS_URL_en_US : XSLT_MSGS_URL,
        getter_AddRefs(bundle));

      if (bundle) {
        AutoTArray<nsString, 1> error = {errorText};
+1 −0
Original line number Diff line number Diff line
@@ -7,5 +7,6 @@
#define DOM_XSLT_XSLT_TXXSLTMSGSURL_H_

#define XSLT_MSGS_URL "chrome://global/locale/xslt/xslt.properties"
#define XSLT_MSGS_URL_en_US "resource://gre/res/locale/xslt/xslt.properties"

#endif  // DOM_XSLT_XSLT_TXXSLTMSGSURL_H_
+5 −1
Original line number Diff line number Diff line
@@ -86,9 +86,13 @@ interface nsIStringBundleService : nsISupports
   *            used in the string lookup process.
   * @param aStatusArg - The status message argument(s). Multiple arguments
   *            can be separated by newline ('\n') characters.
   * @param aSpoofLocale - If true (default is false), forces the en-US
                locale on content-accessible messages (XSLT errors so far).
   * @return the formatted message
   */
  AString formatStatusMessage(in nsresult aStatus, in wstring aStatusArg);
  AString formatStatusMessage(in nsresult aStatus,
                              in wstring aStatusArg,
                              [optional] in boolean aSpoofLocale);

  /**
   * flushes the string bundle cache - useful when the locale changes or
Loading